/* C code for program sncExample, generated by snc from ./../sncExample.stt */ #include #include #include #include #include "seq_snc.h" /* Variable declarations */ # line 2 "./../sncExample.stt" static double v; /* Function declarations */ #define seqg_var (*(struct seqg_vars *const *)seqg_env) /* Program init func */ static void seqg_init(PROG_ID seqg_env) { } /****** Code for state "low" in state set "ss1" ******/ /* Event function for state "low" in state set "ss1" */ static seqBool seqg_event_ss1_0_low(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 10 "./../sncExample.stt" if (v > 5.0) { *seqg_pnst = 1; *seqg_ptrn = 0; return TRUE; } # line 14 "./../sncExample.stt" if (seq_delay(seqg_env, .1)) { *seqg_pnst = 0; *seqg_ptrn = 1; return TRUE; } return FALSE; } /* Action function for state "low" in state set "ss1" */ static void seqg_action_ss1_0_low(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 12 "./../sncExample.stt" printf("changing to high\n"); } return; case 1: { } return; } } /****** Code for state "high" in state set "ss1" ******/ /* Event function for state "high" in state set "ss1" */ static seqBool seqg_event_ss1_0_high(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 20 "./../sncExample.stt" if (v <= 5.0) { *seqg_pnst = 0; *seqg_ptrn = 0; return TRUE; } # line 24 "./../sncExample.stt" if (seq_delay(seqg_env, .1)) { *seqg_pnst = 1; *seqg_ptrn = 1; return TRUE; } return FALSE; } /* Action function for state "high" in state set "ss1" */ static void seqg_action_ss1_0_high(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 22 "./../sncExample.stt" printf("changing to low\n"); } return; case 1: { } return; } } #undef seqg_var /************************ Tables ************************/ /* Channel table */ static seqChan seqg_chans[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"{user}:xxxExample", (size_t)&v, "v", P_DOUBLE, 1, 1, 0, 1, 0, 0}, }; /* Event masks for state set "ss1" */ static const seqMask seqg_mask_ss1_0_low[] = { 0x00000002, }; static const seqMask seqg_mask_ss1_0_high[] = { 0x00000002, }; /* State table for state set "ss1" */ static seqState seqg_states_ss1[] = { { /* state name */ "low", /* action function */ seqg_action_ss1_0_low, /* event function */ seqg_event_ss1_0_low, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_ss1_0_low, /* state options */ (0) }, { /* state name */ "high", /* action function */ seqg_action_ss1_0_high, /* event function */ seqg_event_ss1_0_high, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_ss1_0_high, /* state options */ (0) }, }; /* State set table */ static seqSS seqg_statesets[] = { { /* state set name */ "ss1", /* states */ seqg_states_ss1, /* number of states */ 2 }, }; /* Program table (global) */ seqProgram sncExample = { /* magic number */ 2002004, /* program name */ "sncExample", /* channels */ seqg_chans, /* num. channels */ 1, /* state sets */ seqg_statesets, /* num. state sets */ 1, /* user var size */ 0, /* param */ "", /* num. event flags */ 0, /* encoded options */ (0 | OPT_CONN | OPT_NEWEF), /* init func */ seqg_init, /* entry func */ 0, /* exit func */ 0, /* num. queues */ 0 }; #define PROG_NAME sncExample #include "seqMain.c" /* Register sequencer commands and program */ #include "epicsExport.h" static void sncExampleRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&sncExample); } epicsExportRegistrar(sncExampleRegistrar);