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

20 lines
570 B
C

#include "qep.h" /* QEP/C public interface */
#include "qbomb.h" /* QBomb derived from QFsm */
static QBomb l_qbomb; /* an instance of QBomb FSM */
int main() {
QBomb_ctor(&l_bomb); /* QBomb "constructor" invokes QFsm_ctor() */
QMSM_INIT(&l_qbomb.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_qbomb.super, &e); /* dispatch e */
}
return 0;
}