QMsmTst is a QMsm state machine test based on the contrived state machine from Chapter 2 of the PSiCC2 book for testing all possible transition topologies with up to 4-levels of state nesting. Test active object (void)e; /* avoid compiler warning */ me->foo = 0U; BSP_display("top-INIT;"); BSP_display("s-ENTRY;"); BSP_display("s-EXIT;"); BSP_display("s-INIT;"); me->foo me->foo = 0U; BSP_display("s-I;"); BSP_display("s-E;"); BSP_exit(); BSP_display("s1-ENTRY;"); BSP_display("s1-EXIT;"); BSP_display("s1-INIT;"); BSP_display("s1-I;"); !me->foo me->foo = 1U; BSP_display("s1-D;"); BSP_display("s1-A;"); BSP_display("s1-B;"); BSP_display("s1-F;"); BSP_display("s1-C;"); BSP_display("s11-ENTRY;"); BSP_display("s11-EXIT;"); BSP_display("s11-H;"); me->foo me->foo = 0U; BSP_display("s11-D;"); BSP_display("s11-G;"); BSP_display("s2-ENTRY;"); BSP_display("s2-EXIT;"); BSP_display("s2-INIT;"); !me->foo me->foo = 1U; BSP_display("s2-I;"); BSP_display("s2-F;"); BSP_display("s2-C;"); BSP_display("s21-ENTRY;"); BSP_display("s21-EXIT;"); BSP_display("s21-INIT;"); BSP_display("s21-G;"); BSP_display("s21-A;"); BSP_display("s21-B;"); BSP_display("s211-ENTRY;"); BSP_display("s211-EXIT;"); BSP_display("s211-H;"); BSP_display("s211-D;"); QMsmTst *me = &l_msmtst; QMsm_ctor(&me->super, Q_STATE_CAST(&QMsmTst_initial)); #ifndef qmsmtst_h #define qmsmtst_h enum QMsmTstSignals { A_SIG = Q_USER_SIG, B_SIG, C_SIG, D_SIG, E_SIG, F_SIG, G_SIG, H_SIG, I_SIG, TERMINATE_SIG, IGNORE_SIG, MAX_SIG }; extern QMsm * const the_msm; /* opaque pointer to the test MSM */ $declare(SMs::QMsmTst_ctor) /* BSP functions to dispaly a message and exit */ void BSP_display(char const *msg); void BSP_exit(void); #endif /* qmsmtst_h */ #include "qpc.h" #include "qmsmtst.h" $declare(SMs::QMsmTst) static QMsmTst l_msmtst; /* the only instance of the QMsmTst class */ /* global-scope definitions ---------------------------------------*/ QMsm * const the_msm = (QMsm *)&l_msmtst; /* the opaque pointer */ $define(SMs::QMsmTst_ctor) $define(SMs::QMsmTst)