/* Generated with snc from pvSync.i */ /* Program "pvSyncTest" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ struct UserVar { # line 13 "../pvSync.st" int x; struct UserVar_pvSync { struct { int y; } UserVar_idle; } UserVar_pvSync; }; /* C code definitions */ # line 9 "../pvSync.st" #include "../testSupport.h" /* Program init func */ static void G_prog_init(struct UserVar *pVar) { static struct UserVar pVarInit = { # line 13 "../pvSync.st" 0, { { # line 26 "../pvSync.st" 0 }, }, }; *pVar = pVarInit; } /* Program entry func */ static void G_prog_entry(SS_ID ssId, struct UserVar *pVar) { # line 20 "../pvSync.st" testPlan(5); # line 21 "../pvSync.st" seq_pvSync(ssId, 0/*x*/, 1/*f*/); } /****** Code for state "idle" in state set "pvSync" ******/ /* Delay function for state "idle" in state set "pvSync" */ static void D_pvSync_idle(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "idle" in state set "pvSync" */ static seqBool E_pvSync_idle(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 27 "../pvSync.st" if (seq_efTestAndClear(ssId, 1/*f*/)) { *pNextState = 0; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "idle" in state set "pvSync" */ static void A_pvSync_idle(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 28 "../pvSync.st" pVar->UserVar_pvSync.UserVar_idle.y++; # line 29 "../pvSync.st" printf("test: x=%d\n", pVar->x); # line 30 "../pvSync.st" testOk(pVar->x == pVar->UserVar_pvSync.UserVar_idle.y, "test: x=%d==%d=y", pVar->x, pVar->UserVar_pvSync.UserVar_idle.y); # line 31 "../pvSync.st" if (pVar->UserVar_pvSync.UserVar_idle.y == 5) {*pNextState = 1; return;} } return; } } /****** Code for state "done" in state set "pvSync" ******/ /* Delay function for state "done" in state set "pvSync" */ static void D_pvSync_done(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "done" in state set "pvSync" */ static seqBool E_pvSync_done(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { if (TRUE) { seq_exit(ssId); *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "done" in state set "pvSync" */ static void A_pvSync_done(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; } } /****** Code for state "one" in state set "help" ******/ /* Delay function for state "one" in state set "help" */ static void D_help_one(SS_ID ssId, struct UserVar *pVar) { # line 42 "../pvSync.st" seq_delayInit(ssId, 0, (0.1)); } /* Event function for state "one" in state set "help" */ static seqBool E_help_one(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 42 "../pvSync.st" if (seq_delay(ssId, 0)) { *pNextState = 0; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "one" in state set "help" */ static void A_help_one(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 43 "../pvSync.st" testDiag("set: x=%d", pVar->x); # line 44 "../pvSync.st" pVar->x++; # line 45 "../pvSync.st" seq_pvPut(ssId, 0/*x*/, 0); } return; } } /* Program exit func */ static void G_prog_exit(SS_ID ssId, struct UserVar *pVar) { # line 51 "../pvSync.st" testDone(); # line 52 "../pvSync.st" seq_test_done(); } /************************ Tables ************************/ /* Channel table */ static seqChan G_channels[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"", offsetof(struct UserVar, x), "x", "int", 1, 2, 0, 1, 0, 0} }; /* Event masks for state set "pvSync" */ static const seqMask EM_pvSync_idle[] = { 0x00000002, }; static const seqMask EM_pvSync_done[] = { 0x00000000, }; /* State table for state set "pvSync" */ static seqState G_pvSync_states[] = { { /* state name */ "idle", /* action function */ A_pvSync_idle, /* event function */ E_pvSync_idle, /* delay function */ D_pvSync_idle, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_pvSync_idle, /* state options */ (0) }, { /* state name */ "done", /* action function */ A_pvSync_done, /* event function */ E_pvSync_done, /* delay function */ D_pvSync_done, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_pvSync_done, /* state options */ (0) }, }; /* Event masks for state set "help" */ static const seqMask EM_help_one[] = { 0x00000000, }; /* State table for state set "help" */ static seqState G_help_states[] = { { /* state name */ "one", /* action function */ A_help_one, /* event function */ E_help_one, /* delay function */ D_help_one, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_help_one, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "pvSync", /* states */ G_pvSync_states, /* number of states */ 2, /* number of delays */ 0 }, { /* state set name */ "help", /* states */ G_help_states, /* number of states */ 1, /* number of delays */ 1 }, }; /* Program table (global) */ seqProgram pvSyncTest = { /* magic number */ 2001003, /* program name */ "pvSyncTest", /* channels */ G_channels, /* num. channels */ 1, /* state sets */ G_state_sets, /* num. state sets */ 2, /* user var size */ sizeof(struct UserVar), /* param */ "", /* num. event flags */ 1, /* encoded options */ (0 | OPT_CONN | OPT_NEWEF | OPT_REENT | OPT_SAFE | OPT_MAIN), /* init func */ G_prog_init, /* entry func */ G_prog_entry, /* exit func */ G_prog_exit, /* num. queues */ 0 }; #define PROG_NAME pvSyncTest #include "seqMain.c"