qpc/doxygen/snippets/qep_qmsm_use.c
Quantum Leaps 0e95d49224 5.1.0
2013-09-23 14:34:35 -04:00

20 lines
586 B
C

#include "qep.h" /* QEP/C public interface */
#include "qcalc.h" /* QCalc derived from QMsm */
static QCalc l_qcalc; /* an instance of QCalc SM */
int main() {
QCalc_ctor(&l_qcalc); /* QCalc "constructor" invokes QMsm_ctor_() */
QMSM_INIT(&l_qcalc.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_qcalc.super, &e); /* dispatch e */
}
return 0;
}