qpc/doxygen/snippets/qep_qmsm_use.c
Quantum Leaps cd6736f1fd 5.4.0
2015-04-28 13:45:35 -04:00

20 lines
586 B
C

#include "qpc.h" /* QP/C public interface */
#include "calc.h" /* Calc derived from QMsm */
static Calc l_calc; /* an instance of Calc SM */
int main() {
Calc_ctor(&l_calc); /* Calc "constructor" invokes QMsm_ctor() */
QMSM_INIT(&l_calc.super, (QEvt *)0); /* trigger initial transition */
for (;;) { /* event loop */
QEvt e;
. . .
/* wait for the next event and assign it to the event object e */
. . .
QMSM_DISPATCH(&l_calc.super, &e); /* dispatch e */
}
return 0; /* never reached, needed for some compilers */
}