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

20 lines
597 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; /* never reached, needed for some compilers */
}