123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364 |
- #include <stdlib.h>
- #include <string.h>
- #include "sc_types.h"
- #include "StateIsActive.h"
- /*! \file Implementation of the state machine 'StateIsActive'
- */
- /* prototypes of all internal functions */
- static sc_boolean stateIsActive_check_R1_R1A_tr0_tr0(const StateIsActive* handle);
- static sc_boolean stateIsActive_check_R2_R2A_tr0_tr0(const StateIsActive* handle);
- static void stateIsActive_effect_R1_R1A_tr0(StateIsActive* handle);
- static void stateIsActive_effect_R2_R2A_tr0(StateIsActive* handle);
- static void stateIsActive_enseq_R1_R1A_default(StateIsActive* handle);
- static void stateIsActive_enseq_R1_R1B_default(StateIsActive* handle);
- static void stateIsActive_enseq_R2_R2A_default(StateIsActive* handle);
- static void stateIsActive_enseq_R2_R2B_default(StateIsActive* handle);
- static void stateIsActive_enseq_R1_default(StateIsActive* handle);
- static void stateIsActive_enseq_R2_default(StateIsActive* handle);
- static void stateIsActive_exseq_R1_R1A(StateIsActive* handle);
- static void stateIsActive_exseq_R1_R1B(StateIsActive* handle);
- static void stateIsActive_exseq_R2_R2A(StateIsActive* handle);
- static void stateIsActive_exseq_R2_R2B(StateIsActive* handle);
- static void stateIsActive_exseq_R1(StateIsActive* handle);
- static void stateIsActive_exseq_R2(StateIsActive* handle);
- static void stateIsActive_react_R1_R1A(StateIsActive* handle);
- static void stateIsActive_react_R1_R1B(StateIsActive* handle);
- static void stateIsActive_react_R2_R2A(StateIsActive* handle);
- static void stateIsActive_react_R2_R2B(StateIsActive* handle);
- static void stateIsActive_react_R1__entry_Default(StateIsActive* handle);
- static void stateIsActive_react_R2__entry_Default(StateIsActive* handle);
- static void stateIsActive_clearInEvents(StateIsActive* handle);
- static void stateIsActive_clearOutEvents(StateIsActive* handle);
- void stateIsActive_init(StateIsActive* handle)
- {
- sc_integer i;
- for (i = 0; i < STATEISACTIVE_MAX_ORTHOGONAL_STATES; ++i)
- {
- handle->stateConfVector[i] = StateIsActive_last_state;
- }
-
-
- handle->stateConfVectorPosition = 0;
- stateIsActive_clearInEvents(handle);
- stateIsActive_clearOutEvents(handle);
- }
- void stateIsActive_enter(StateIsActive* handle)
- {
- /* Default enter sequence for statechart StateIsActive */
- stateIsActive_enseq_R1_default(handle);
- stateIsActive_enseq_R2_default(handle);
- }
- void stateIsActive_exit(StateIsActive* handle)
- {
- /* Default exit sequence for statechart StateIsActive */
- stateIsActive_exseq_R1(handle);
- stateIsActive_exseq_R2(handle);
- }
- sc_boolean stateIsActive_isActive(const StateIsActive* handle)
- {
- sc_boolean result = bool_false;
- int i;
-
- for(i = 0; i < STATEISACTIVE_MAX_ORTHOGONAL_STATES; i++)
- {
- result = result || handle->stateConfVector[i] != StateIsActive_last_state;
- }
-
- return result;
- }
- /*
- * Always returns 'false' since this state machine can never become final.
- */
- sc_boolean stateIsActive_isFinal(const StateIsActive* handle)
- {
- return bool_false;
- }
- static void stateIsActive_clearInEvents(StateIsActive* handle)
- {
- handle->iface.Event1_raised = bool_false;
- }
- static void stateIsActive_clearOutEvents(StateIsActive* handle)
- {
- }
- void stateIsActive_runCycle(StateIsActive* handle)
- {
-
- stateIsActive_clearOutEvents(handle);
-
- for (handle->stateConfVectorPosition = 0;
- handle->stateConfVectorPosition < STATEISACTIVE_MAX_ORTHOGONAL_STATES;
- handle->stateConfVectorPosition++)
- {
-
- switch (handle->stateConfVector[handle->stateConfVectorPosition])
- {
- case StateIsActive_R1_R1A :
- {
- stateIsActive_react_R1_R1A(handle);
- break;
- }
- case StateIsActive_R1_R1B :
- {
- stateIsActive_react_R1_R1B(handle);
- break;
- }
- case StateIsActive_R2_R2A :
- {
- stateIsActive_react_R2_R2A(handle);
- break;
- }
- case StateIsActive_R2_R2B :
- {
- stateIsActive_react_R2_R2B(handle);
- break;
- }
- default:
- break;
- }
- }
-
- stateIsActive_clearInEvents(handle);
- }
- sc_boolean stateIsActive_isStateActive(const StateIsActive* handle, StateIsActiveStates state)
- {
- sc_boolean result = bool_false;
- switch (state)
- {
- case StateIsActive_R1_R1A :
- result = (sc_boolean) (handle->stateConfVector[SCVI_STATEISACTIVE_R1_R1A] == StateIsActive_R1_R1A
- );
- break;
- case StateIsActive_R1_R1B :
- result = (sc_boolean) (handle->stateConfVector[SCVI_STATEISACTIVE_R1_R1B] == StateIsActive_R1_R1B
- );
- break;
- case StateIsActive_R2_R2A :
- result = (sc_boolean) (handle->stateConfVector[SCVI_STATEISACTIVE_R2_R2A] == StateIsActive_R2_R2A
- );
- break;
- case StateIsActive_R2_R2B :
- result = (sc_boolean) (handle->stateConfVector[SCVI_STATEISACTIVE_R2_R2B] == StateIsActive_R2_R2B
- );
- break;
- default:
- result = bool_false;
- break;
- }
- return result;
- }
- void stateIsActiveIface_raise_event1(StateIsActive* handle)
- {
- handle->iface.Event1_raised = bool_true;
- }
- /* implementations of all internal functions */
- static sc_boolean stateIsActive_check_R1_R1A_tr0_tr0(const StateIsActive* handle)
- {
- return stateIsActive_isStateActive(handle, StateIsActive_R2_R2B);
- }
- static sc_boolean stateIsActive_check_R2_R2A_tr0_tr0(const StateIsActive* handle)
- {
- return handle->iface.Event1_raised;
- }
- static void stateIsActive_effect_R1_R1A_tr0(StateIsActive* handle)
- {
- stateIsActive_exseq_R1_R1A(handle);
- stateIsActive_enseq_R1_R1B_default(handle);
- }
- static void stateIsActive_effect_R2_R2A_tr0(StateIsActive* handle)
- {
- stateIsActive_exseq_R2_R2A(handle);
- stateIsActive_enseq_R2_R2B_default(handle);
- }
- /* 'default' enter sequence for state R1A */
- static void stateIsActive_enseq_R1_R1A_default(StateIsActive* handle)
- {
- /* 'default' enter sequence for state R1A */
- handle->stateConfVector[0] = StateIsActive_R1_R1A;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state R1B */
- static void stateIsActive_enseq_R1_R1B_default(StateIsActive* handle)
- {
- /* 'default' enter sequence for state R1B */
- handle->stateConfVector[0] = StateIsActive_R1_R1B;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state R2A */
- static void stateIsActive_enseq_R2_R2A_default(StateIsActive* handle)
- {
- /* 'default' enter sequence for state R2A */
- handle->stateConfVector[1] = StateIsActive_R2_R2A;
- handle->stateConfVectorPosition = 1;
- }
- /* 'default' enter sequence for state R2B */
- static void stateIsActive_enseq_R2_R2B_default(StateIsActive* handle)
- {
- /* 'default' enter sequence for state R2B */
- handle->stateConfVector[1] = StateIsActive_R2_R2B;
- handle->stateConfVectorPosition = 1;
- }
- /* 'default' enter sequence for region R1 */
- static void stateIsActive_enseq_R1_default(StateIsActive* handle)
- {
- /* 'default' enter sequence for region R1 */
- stateIsActive_react_R1__entry_Default(handle);
- }
- /* 'default' enter sequence for region R2 */
- static void stateIsActive_enseq_R2_default(StateIsActive* handle)
- {
- /* 'default' enter sequence for region R2 */
- stateIsActive_react_R2__entry_Default(handle);
- }
- /* Default exit sequence for state R1A */
- static void stateIsActive_exseq_R1_R1A(StateIsActive* handle)
- {
- /* Default exit sequence for state R1A */
- handle->stateConfVector[0] = StateIsActive_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state R1B */
- static void stateIsActive_exseq_R1_R1B(StateIsActive* handle)
- {
- /* Default exit sequence for state R1B */
- handle->stateConfVector[0] = StateIsActive_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state R2A */
- static void stateIsActive_exseq_R2_R2A(StateIsActive* handle)
- {
- /* Default exit sequence for state R2A */
- handle->stateConfVector[1] = StateIsActive_last_state;
- handle->stateConfVectorPosition = 1;
- }
- /* Default exit sequence for state R2B */
- static void stateIsActive_exseq_R2_R2B(StateIsActive* handle)
- {
- /* Default exit sequence for state R2B */
- handle->stateConfVector[1] = StateIsActive_last_state;
- handle->stateConfVectorPosition = 1;
- }
- /* Default exit sequence for region R1 */
- static void stateIsActive_exseq_R1(StateIsActive* handle)
- {
- /* Default exit sequence for region R1 */
- /* Handle exit of all possible states (of StateIsActive.R1) at position 0... */
- switch(handle->stateConfVector[ 0 ])
- {
- case StateIsActive_R1_R1A :
- {
- stateIsActive_exseq_R1_R1A(handle);
- break;
- }
- case StateIsActive_R1_R1B :
- {
- stateIsActive_exseq_R1_R1B(handle);
- break;
- }
- default: break;
- }
- }
- /* Default exit sequence for region R2 */
- static void stateIsActive_exseq_R2(StateIsActive* handle)
- {
- /* Default exit sequence for region R2 */
- /* Handle exit of all possible states (of StateIsActive.R2) at position 1... */
- switch(handle->stateConfVector[ 1 ])
- {
- case StateIsActive_R2_R2A :
- {
- stateIsActive_exseq_R2_R2A(handle);
- break;
- }
- case StateIsActive_R2_R2B :
- {
- stateIsActive_exseq_R2_R2B(handle);
- break;
- }
- default: break;
- }
- }
- /* The reactions of state R1A. */
- static void stateIsActive_react_R1_R1A(StateIsActive* handle)
- {
- /* The reactions of state R1A. */
- if (stateIsActive_check_R1_R1A_tr0_tr0(handle) == bool_true)
- {
- stateIsActive_effect_R1_R1A_tr0(handle);
- }
- }
- /* The reactions of state R1B. */
- static void stateIsActive_react_R1_R1B(StateIsActive* handle)
- {
- /* The reactions of state R1B. */
- }
- /* The reactions of state R2A. */
- static void stateIsActive_react_R2_R2A(StateIsActive* handle)
- {
- /* The reactions of state R2A. */
- if (stateIsActive_check_R2_R2A_tr0_tr0(handle) == bool_true)
- {
- stateIsActive_effect_R2_R2A_tr0(handle);
- }
- }
- /* The reactions of state R2B. */
- static void stateIsActive_react_R2_R2B(StateIsActive* handle)
- {
- }
- /* Default react sequence for initial entry */
- static void stateIsActive_react_R1__entry_Default(StateIsActive* handle)
- {
- /* Default react sequence for initial entry */
- stateIsActive_enseq_R1_R1A_default(handle);
- }
- /* Default react sequence for initial entry */
- static void stateIsActive_react_R2__entry_Default(StateIsActive* handle)
- {
- /* Default react sequence for initial entry */
- stateIsActive_enseq_R2_R2A_default(handle);
- }
|