@@ -163,10 +163,8 @@ void QHsm_ctor(QHsm * const me,
163163 static struct QAsmVtable const vtable = { // QAsm virtual table
164164 & QHsm_init_ ,
165165 & QHsm_dispatch_ ,
166- & QHsm_isIn_
167- #ifdef Q_SPY
168- ,& QHsm_getStateHandler_
169- #endif
166+ & QHsm_isIn_ ,
167+ & QHsm_getStateHandler_
170168 };
171169 // no need to call the superclass' constructor QAsm_ctor() here
172170 me -> super .vptr = & vtable ; // QHsm class' VTABLE
@@ -284,7 +282,6 @@ void QHsm_dispatch_(QAsm * const me,
284282
285283 // process the event hierarchically...
286284 QStateHandler path [QHSM_MAX_NEST_DEPTH_ ]; // entry path array
287- path [0 ] = s ; // save current state
288285 me -> temp .fun = s ;
289286 QState r ; // state handler return value
290287 int_fast8_t ip = QHSM_MAX_NEST_DEPTH_ ; // path index & fixed loop bound
@@ -307,7 +304,10 @@ void QHsm_dispatch_(QAsm * const me,
307304 }
308305 } while (r == Q_RET_SUPER ); // loop as long as superstate returned
309306
310- if (r == Q_RET_HANDLED ) { // did the last handler handle event e?
307+ if (r == Q_RET_IGNORED ) { // was event e ignored?
308+ QS_TRAN0_ (QS_QEP_IGNORED , me -> state .fun ); // output QS record
309+ }
310+ else if (r == Q_RET_HANDLED ) { // did the last handler handle event e?
311311 QS_TRAN0_ (QS_QEP_INTERN_TRAN , s ); // output QS record
312312 }
313313 else if ((r == Q_RET_TRAN ) || (r == Q_RET_TRAN_HIST )) { // tran. taken?
@@ -340,15 +340,13 @@ void QHsm_dispatch_(QAsm * const me,
340340 // enter the target (possibly recursively) by initial trans.
341341 QHsm_enter_target_ (me , & path [0 ], ip , qsId );
342342 QS_TRAN_END_ (QS_QEP_TRAN , s , path [0 ]); // output QS record
343- }
344- else if (r == Q_RET_IGNORED ) { // was event e ignored?
345- QS_TRAN0_ (QS_QEP_IGNORED , me -> state .fun ); // output QS record
343+
344+ me -> state .fun = path [0 ]; // change the current active state
346345 }
347346 else {
348347 Q_ERROR_LOCAL (360 ); // last state handler returned impossible value
349348 }
350349
351- me -> state .fun = path [0 ]; // change the current active state
352350#ifndef Q_UNSAFE
353351 // establish stable state configuration
354352 me -> temp .uint = QP_DIS_UPDATE (uintptr_t , me -> state .uint );
@@ -644,11 +642,9 @@ QStateHandler QHsm_state(QHsm const * const me) {
644642}
645643
646644//............................................................................
647- #ifdef Q_SPY
648645//! @private @memberof QHsm
649646QStateHandler QHsm_getStateHandler_ (QAsm const * const me ) {
650647 // NOTE: this function does NOT apply critical section, so it can
651648 // be safely called from an already established critical section.
652649 return me -> state .fun ;
653650}
654- #endif // def Q_SPY
0 commit comments