NetSim Source Code Help
Loading...
Searching...
No Matches
SimProcessInterpretor.c
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2020 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* Author: Shashi kant suman
12* *
13* ---------------------------------------------------------------------------------*/
14#include "main.h"
15#include <signal.h>
16#include "CLI.h"
17
19{
21 if (sim == SIMSTATE_NOTSTARTED)
22 send_message(info, "Simulation is not yet started\n");
23 else if (sim == SIMSTATE_STOPPED)
24 send_message(info, "Simulation is already stopped\n");
25 else
26 raise(SIGINT);
27}
28
30{
32 if (sim == SIMSTATE_STOPPED)
33 send_message(info, "Simulation is already stopped\n");
34 else
35 {
37 memset(&pevent, 0, sizeof pevent);
38 pevent.dEventTime = time*SECOND;
39 pevent.nEventType = TIMER_EVENT;
41 fnpAddEvent(&pevent);
42 }
43}
44
46{
48 if (sim == SIMSTATE_NOTSTARTED)
49 {
50 send_message(info, "Simulation is not yet started. Pausing at 0 sec.\n");
52 }
53 else if (sim != SIMSTATE_RUNNING)
54 send_message(info, "Simulation is not in running state\n");
55 else
57}
58
60{
62 if (sim == SIMSTATE_NOTSTARTED)
63 send_message(info, "Simulation is not yet started\n");
64 else if (sim == SIMSTATE_STOPPED)
65 send_message(info, "Simulation is already stopped\n");
66 else if (sim == SIMSTATE_RUNNING)
67 send_message(info, "Simulation is already running\n");
68 else
70}
71
73{
74 free(info->promptString);
75 info->promptString = NULL;
77}
#define DEFAULT_PROMPT
Definition: CLI.h:10
#define CMD_CHANGEPROMPT
Definition: CLI.h:12
void send_message(ptrCLIENTINFO info, char *msg,...)
#define free(p)
Definition: Memory.h:31
void cli_continue_simulation(ptrCLIENTINFO info)
void cli_pause_simulation_at(ptrCLIENTINFO info, double time)
void cli_clear_prompt(ptrCLIENTINFO info)
void cli_pause_simulation(ptrCLIENTINFO info)
void cli_stop_simulation(ptrCLIENTINFO info)
@ SUBEVENT_PAUSESIMULATION
Definition: Stack.h:126
@ SIMSTATE_PAUSED
Definition: Stack.h:83
@ SIMSTATE_RUNNING
Definition: Stack.h:84
@ SIMSTATE_NOTSTARTED
Definition: Stack.h:82
@ SIMSTATE_STOPPED
Definition: Stack.h:85
void netsim_set_simstate(SIMSTATE state)
SIMSTATE netsim_get_simstate()
#define SECOND
Definition: Stack.h:60
@ TIMER_EVENT
Definition: Stack.h:114
enum enum_sim_state SIMSTATE
#define fnpAddEvent(pstruEvent)
Definition: main.h:191
EVENT_TYPE nEventType
Definition: Stack.h:747
NETSIM_ID nSubEventType
Definition: Stack.h:757
char * promptString
Definition: CLI.h:82