qpc/doxygen/snippets/qep_qhsm_use.c
MMS d0160c8c7b 7.0.0rc1
major release 7.0.0 release candidate 1
2022-04-19 19:18:37 -04:00

22 lines
571 B
C

#include "qpc.h" /* QP/C public interface */
#include "calc.h" /* Calc derived from QHsm */
Q_DEFINE_THIS_FILE
static Calc Calc_inst; /* an instance of Calc SM */
int main() {
Calc_ctor(&Calc_inst); /* Calc "constructor" invokes QHsm_ctor() */
QMSM_INIT(&Calc_inst.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(&Calc_inst.super, &e); /* dispatch e */
}
return 0;
}