QHsmTst is a contrived state machine from Chapter 2 of the PSiCC2 book for testing all possible transition topologies with up to 4-levels of state nesting. Oven state machine constructor : QHsm(Q_STATE_CAST(&ToastOven::initial)) (void)e; /* avoid compiler warning */ printf("door-Closed;"); printf("heater-On;"); printf("heater-Off;"); printf("toasting;"); printf("baking;"); printf("toaster-Off;"); printf("door-Open,lamp-On;"); printf("lamp-Off;"); printf("-> final\nBye!Bye!\n"); _exit(0); #ifndef history_h #define history_h enum ToastOvenSignals { OPEN_SIG = QP::Q_USER_SIG, CLOSE_SIG, TOAST_SIG, BAKE_SIG, OFF_SIG, TERMINATE_SIG // terminate the application }; extern QP::QHsm * const the_oven; // opaque pointer to the oven HSM #endif // history_h #include "qep_port.h" #include "qassert.h" #include "history.h" #include <stdio.h> #include <stdlib.h> #include <string.h> Q_DEFINE_THIS_FILE $declare(SMs::ToastOven) static ToastOven l_oven; // the only instance of the ToastOven class // global-scope definitions ------------------------------------ QP::QHsm * const the_oven = &l_oven; // the opaque pointer $define(SMs::ToastOven)