/* Generated with snc from change.i */ /* Program "changeTest" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ struct UserVar_main { int x; int n; } UserVar_main = { # line 23 "../change.st" 0, # line 24 "../change.st" 1, }; /* C code definitions */ # line 10 "../change.st" #include # line 11 "../change.st" #include # line 12 "../change.st" #include "../testSupport.h" /* Program init func */ static void G_prog_init(struct UserVar *pVar) { } /* Program entry func */ static void G_prog_entry(SS_ID ssId, struct UserVar *pVar) { # line 17 "../change.st" testPlan(50); } /****** Code for state "zero" in state set "main" ******/ /* Delay function for state "zero" in state set "main" */ static void D_main_zero(SS_ID ssId, struct UserVar *pVar) { # line 34 "../change.st" seq_delayInit(ssId, 0, (0.01)); } /* Event function for state "zero" in state set "main" */ static seqBool E_main_zero(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 32 "../change.st" if (UserVar_main.n > 50) { seq_exit(ssId); *pTransNum = 0; return TRUE; } # line 34 "../change.st" if (seq_delay(ssId, 0)) { *pNextState = 0; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "zero" in state set "main" */ static void A_main_zero(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { # line 35 "../change.st" testOk(UserVar_main.x == 0, "state=zero, x=%d", UserVar_main.x); # line 36 "../change.st" UserVar_main.x = rand() % 10 - 5; # line 37 "../change.st" testDiag("new random x=%d", UserVar_main.x); # line 38 "../change.st" UserVar_main.n++; # line 39 "../change.st" if (UserVar_main.x > 0) { {*pNextState = 1; return;} } else # line 41 "../change.st" if (UserVar_main.x < 0) { {*pNextState = 2; return;} } } return; } } /****** Code for state "pos" in state set "main" ******/ /* Delay function for state "pos" in state set "main" */ static void D_main_pos(SS_ID ssId, struct UserVar *pVar) { # line 55 "../change.st" seq_delayInit(ssId, 0, (0.01)); } /* Event function for state "pos" in state set "main" */ static seqBool E_main_pos(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 53 "../change.st" if (UserVar_main.n > 50) { seq_exit(ssId); *pTransNum = 0; return TRUE; } # line 55 "../change.st" if (seq_delay(ssId, 0)) { *pNextState = 1; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "pos" in state set "main" */ static void A_main_pos(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { # line 56 "../change.st" testOk(UserVar_main.x > 0, "state=pos, x=%d", UserVar_main.x); # line 57 "../change.st" UserVar_main.n++; # line 58 "../change.st" UserVar_main.x--; # line 59 "../change.st" if (UserVar_main.x == 0) {*pNextState = 0; return;} } return; } } /****** Code for state "neg" in state set "main" ******/ /* Delay function for state "neg" in state set "main" */ static void D_main_neg(SS_ID ssId, struct UserVar *pVar) { # line 65 "../change.st" seq_delayInit(ssId, 0, (0.01)); } /* Event function for state "neg" in state set "main" */ static seqBool E_main_neg(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 63 "../change.st" if (UserVar_main.n > 50) { seq_exit(ssId); *pTransNum = 0; return TRUE; } # line 65 "../change.st" if (seq_delay(ssId, 0)) { *pNextState = 2; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "neg" in state set "main" */ static void A_main_neg(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { # line 66 "../change.st" testOk(UserVar_main.x < 0, "state=neg, x=%d", UserVar_main.x); # line 67 "../change.st" UserVar_main.n++; # line 68 "../change.st" UserVar_main.x++; # line 69 "../change.st" if (UserVar_main.x == 0) {*pNextState = 0; return;} } return; } } /* Program exit func */ static void G_prog_exit(SS_ID ssId, struct UserVar *pVar) { # line 75 "../change.st" testDone(); # line 76 "../change.st" seq_test_done(); } /************************ Tables ************************/ /* No channel definitions */ #define G_channels NULL /* Event masks for state set "main" */ static const seqMask EM_main_zero[] = { 0x00000000, }; static const seqMask EM_main_pos[] = { 0x00000000, }; static const seqMask EM_main_neg[] = { 0x00000000, }; /* State table for state set "main" */ static seqState G_main_states[] = { { /* state name */ "zero", /* action function */ A_main_zero, /* event function */ E_main_zero, /* delay function */ D_main_zero, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_main_zero, /* state options */ (0) }, { /* state name */ "pos", /* action function */ A_main_pos, /* event function */ E_main_pos, /* delay function */ D_main_pos, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_main_pos, /* state options */ (0) }, { /* state name */ "neg", /* action function */ A_main_neg, /* event function */ E_main_neg, /* delay function */ D_main_neg, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_main_neg, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "main", /* states */ G_main_states, /* number of states */ 3, /* number of delays */ 1 }, }; /* Program table (global) */ seqProgram changeTest = { /* magic number */ 2001003, /* program name */ "changeTest", /* channels */ G_channels, /* num. channels */ 0, /* state sets */ G_state_sets, /* num. state sets */ 1, /* user var size */ 0, /* param */ "", /* num. event flags */ 0, /* encoded options */ (0 | OPT_CONN | OPT_NEWEF | OPT_MAIN), /* init func */ G_prog_init, /* entry func */ G_prog_entry, /* exit func */ G_prog_exit, /* num. queues */ 0 }; #define PROG_NAME changeTest #include "seqMain.c"