123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- #include <stdlib.h>
- #include <string.h>
- #include "sc_types.h"
- #include "InternalEventLifeCycle.h"
- /*! \file Implementation of the state machine 'InternalEventLifeCycle'
- */
- /* prototypes of all internal functions */
- static sc_boolean internalEventLifeCycle_check_r1_A_tr0_tr0(const InternalEventLifeCycle* handle);
- static sc_boolean internalEventLifeCycle_check_r1_A_lr0_lr0(const InternalEventLifeCycle* handle);
- static sc_boolean internalEventLifeCycle_check_r1_B_tr0_tr0(const InternalEventLifeCycle* handle);
- static sc_boolean internalEventLifeCycle_check_r2_C_tr0_tr0(const InternalEventLifeCycle* handle);
- static sc_boolean internalEventLifeCycle_check_r2_D_tr0_tr0(const InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_effect_r1_A_tr0(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_effect_r1_A_lr0_lr0(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_effect_r1_B_tr0(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_effect_r2_C_tr0(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_effect_r2_D_tr0(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_enseq_r1_A_default(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_enseq_r1_B_default(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_enseq_r2_C_default(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_enseq_r2_D_default(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_enseq_r1_default(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_enseq_r2_default(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_exseq_r1_A(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_exseq_r1_B(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_exseq_r2_C(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_exseq_r2_D(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_exseq_r1(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_exseq_r2(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_react_r1_A(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_react_r1_B(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_react_r2_C(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_react_r2_D(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_react_r1__entry_Default(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_react_r2__entry_Default(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_clearInEvents(InternalEventLifeCycle* handle);
- static void internalEventLifeCycle_clearOutEvents(InternalEventLifeCycle* handle);
- void internalEventLifeCycle_init(InternalEventLifeCycle* handle)
- {
- sc_integer i;
- for (i = 0; i < INTERNALEVENTLIFECYCLE_MAX_ORTHOGONAL_STATES; ++i)
- {
- handle->stateConfVector[i] = InternalEventLifeCycle_last_state;
- }
-
-
- handle->stateConfVectorPosition = 0;
- internalEventLifeCycle_clearInEvents(handle);
- internalEventLifeCycle_clearOutEvents(handle);
- }
- void internalEventLifeCycle_enter(InternalEventLifeCycle* handle)
- {
- /* Default enter sequence for statechart InternalEventLifeCycle */
- internalEventLifeCycle_enseq_r1_default(handle);
- internalEventLifeCycle_enseq_r2_default(handle);
- }
- void internalEventLifeCycle_exit(InternalEventLifeCycle* handle)
- {
- /* Default exit sequence for statechart InternalEventLifeCycle */
- internalEventLifeCycle_exseq_r1(handle);
- internalEventLifeCycle_exseq_r2(handle);
- }
- sc_boolean internalEventLifeCycle_isActive(const InternalEventLifeCycle* handle)
- {
- sc_boolean result = bool_false;
- int i;
-
- for(i = 0; i < INTERNALEVENTLIFECYCLE_MAX_ORTHOGONAL_STATES; i++)
- {
- result = result || handle->stateConfVector[i] != InternalEventLifeCycle_last_state;
- }
-
- return result;
- }
- /*
- * Always returns 'false' since this state machine can never become final.
- */
- sc_boolean internalEventLifeCycle_isFinal(const InternalEventLifeCycle* handle)
- {
- return bool_false;
- }
- static void internalEventLifeCycle_clearInEvents(InternalEventLifeCycle* handle)
- {
- handle->iface.e_raised = bool_false;
- handle->iface.f_raised = bool_false;
- handle->internal.i1_raised = bool_false;
- handle->internal.i2_raised = bool_false;
- }
- static void internalEventLifeCycle_clearOutEvents(InternalEventLifeCycle* handle)
- {
- }
- void internalEventLifeCycle_runCycle(InternalEventLifeCycle* handle)
- {
-
- internalEventLifeCycle_clearOutEvents(handle);
-
- for (handle->stateConfVectorPosition = 0;
- handle->stateConfVectorPosition < INTERNALEVENTLIFECYCLE_MAX_ORTHOGONAL_STATES;
- handle->stateConfVectorPosition++)
- {
-
- switch (handle->stateConfVector[handle->stateConfVectorPosition])
- {
- case InternalEventLifeCycle_r1_A :
- {
- internalEventLifeCycle_react_r1_A(handle);
- break;
- }
- case InternalEventLifeCycle_r1_B :
- {
- internalEventLifeCycle_react_r1_B(handle);
- break;
- }
- case InternalEventLifeCycle_r2_C :
- {
- internalEventLifeCycle_react_r2_C(handle);
- break;
- }
- case InternalEventLifeCycle_r2_D :
- {
- internalEventLifeCycle_react_r2_D(handle);
- break;
- }
- default:
- break;
- }
- }
-
- internalEventLifeCycle_clearInEvents(handle);
- }
- sc_boolean internalEventLifeCycle_isStateActive(const InternalEventLifeCycle* handle, InternalEventLifeCycleStates state)
- {
- sc_boolean result = bool_false;
- switch (state)
- {
- case InternalEventLifeCycle_r1_A :
- result = (sc_boolean) (handle->stateConfVector[SCVI_INTERNALEVENTLIFECYCLE_R1_A] == InternalEventLifeCycle_r1_A
- );
- break;
- case InternalEventLifeCycle_r1_B :
- result = (sc_boolean) (handle->stateConfVector[SCVI_INTERNALEVENTLIFECYCLE_R1_B] == InternalEventLifeCycle_r1_B
- );
- break;
- case InternalEventLifeCycle_r2_C :
- result = (sc_boolean) (handle->stateConfVector[SCVI_INTERNALEVENTLIFECYCLE_R2_C] == InternalEventLifeCycle_r2_C
- );
- break;
- case InternalEventLifeCycle_r2_D :
- result = (sc_boolean) (handle->stateConfVector[SCVI_INTERNALEVENTLIFECYCLE_R2_D] == InternalEventLifeCycle_r2_D
- );
- break;
- default:
- result = bool_false;
- break;
- }
- return result;
- }
- void internalEventLifeCycleIface_raise_e(InternalEventLifeCycle* handle)
- {
- handle->iface.e_raised = bool_true;
- }
- void internalEventLifeCycleIface_raise_f(InternalEventLifeCycle* handle)
- {
- handle->iface.f_raised = bool_true;
- }
- /* implementations of all internal functions */
- static sc_boolean internalEventLifeCycle_check_r1_A_tr0_tr0(const InternalEventLifeCycle* handle)
- {
- return handle->internal.i2_raised;
- }
- static sc_boolean internalEventLifeCycle_check_r1_A_lr0_lr0(const InternalEventLifeCycle* handle)
- {
- return handle->iface.e_raised;
- }
- static sc_boolean internalEventLifeCycle_check_r1_B_tr0_tr0(const InternalEventLifeCycle* handle)
- {
- return handle->iface.e_raised;
- }
- static sc_boolean internalEventLifeCycle_check_r2_C_tr0_tr0(const InternalEventLifeCycle* handle)
- {
- return handle->internal.i1_raised;
- }
- static sc_boolean internalEventLifeCycle_check_r2_D_tr0_tr0(const InternalEventLifeCycle* handle)
- {
- return handle->iface.f_raised;
- }
- static void internalEventLifeCycle_effect_r1_A_tr0(InternalEventLifeCycle* handle)
- {
- internalEventLifeCycle_exseq_r1_A(handle);
- internalEventLifeCycle_enseq_r1_B_default(handle);
- }
- static void internalEventLifeCycle_effect_r1_A_lr0_lr0(InternalEventLifeCycle* handle)
- {
- handle->internal.i1_raised = bool_true;
- }
- static void internalEventLifeCycle_effect_r1_B_tr0(InternalEventLifeCycle* handle)
- {
- internalEventLifeCycle_exseq_r1_B(handle);
- internalEventLifeCycle_enseq_r1_A_default(handle);
- }
- static void internalEventLifeCycle_effect_r2_C_tr0(InternalEventLifeCycle* handle)
- {
- internalEventLifeCycle_exseq_r2_C(handle);
- internalEventLifeCycle_enseq_r2_D_default(handle);
- }
- static void internalEventLifeCycle_effect_r2_D_tr0(InternalEventLifeCycle* handle)
- {
- internalEventLifeCycle_exseq_r2_D(handle);
- handle->internal.i2_raised = bool_true;
- internalEventLifeCycle_enseq_r2_C_default(handle);
- }
- /* 'default' enter sequence for state A */
- static void internalEventLifeCycle_enseq_r1_A_default(InternalEventLifeCycle* handle)
- {
- /* 'default' enter sequence for state A */
- handle->stateConfVector[0] = InternalEventLifeCycle_r1_A;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state B */
- static void internalEventLifeCycle_enseq_r1_B_default(InternalEventLifeCycle* handle)
- {
- /* 'default' enter sequence for state B */
- handle->stateConfVector[0] = InternalEventLifeCycle_r1_B;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state C */
- static void internalEventLifeCycle_enseq_r2_C_default(InternalEventLifeCycle* handle)
- {
- /* 'default' enter sequence for state C */
- handle->stateConfVector[1] = InternalEventLifeCycle_r2_C;
- handle->stateConfVectorPosition = 1;
- }
- /* 'default' enter sequence for state D */
- static void internalEventLifeCycle_enseq_r2_D_default(InternalEventLifeCycle* handle)
- {
- /* 'default' enter sequence for state D */
- handle->stateConfVector[1] = InternalEventLifeCycle_r2_D;
- handle->stateConfVectorPosition = 1;
- }
- /* 'default' enter sequence for region r1 */
- static void internalEventLifeCycle_enseq_r1_default(InternalEventLifeCycle* handle)
- {
- /* 'default' enter sequence for region r1 */
- internalEventLifeCycle_react_r1__entry_Default(handle);
- }
- /* 'default' enter sequence for region r2 */
- static void internalEventLifeCycle_enseq_r2_default(InternalEventLifeCycle* handle)
- {
- /* 'default' enter sequence for region r2 */
- internalEventLifeCycle_react_r2__entry_Default(handle);
- }
- /* Default exit sequence for state A */
- static void internalEventLifeCycle_exseq_r1_A(InternalEventLifeCycle* handle)
- {
- /* Default exit sequence for state A */
- handle->stateConfVector[0] = InternalEventLifeCycle_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state B */
- static void internalEventLifeCycle_exseq_r1_B(InternalEventLifeCycle* handle)
- {
- /* Default exit sequence for state B */
- handle->stateConfVector[0] = InternalEventLifeCycle_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state C */
- static void internalEventLifeCycle_exseq_r2_C(InternalEventLifeCycle* handle)
- {
- /* Default exit sequence for state C */
- handle->stateConfVector[1] = InternalEventLifeCycle_last_state;
- handle->stateConfVectorPosition = 1;
- }
- /* Default exit sequence for state D */
- static void internalEventLifeCycle_exseq_r2_D(InternalEventLifeCycle* handle)
- {
- /* Default exit sequence for state D */
- handle->stateConfVector[1] = InternalEventLifeCycle_last_state;
- handle->stateConfVectorPosition = 1;
- }
- /* Default exit sequence for region r1 */
- static void internalEventLifeCycle_exseq_r1(InternalEventLifeCycle* handle)
- {
- /* Default exit sequence for region r1 */
- /* Handle exit of all possible states (of InternalEventLifeCycle.r1) at position 0... */
- switch(handle->stateConfVector[ 0 ])
- {
- case InternalEventLifeCycle_r1_A :
- {
- internalEventLifeCycle_exseq_r1_A(handle);
- break;
- }
- case InternalEventLifeCycle_r1_B :
- {
- internalEventLifeCycle_exseq_r1_B(handle);
- break;
- }
- default: break;
- }
- }
- /* Default exit sequence for region r2 */
- static void internalEventLifeCycle_exseq_r2(InternalEventLifeCycle* handle)
- {
- /* Default exit sequence for region r2 */
- /* Handle exit of all possible states (of InternalEventLifeCycle.r2) at position 1... */
- switch(handle->stateConfVector[ 1 ])
- {
- case InternalEventLifeCycle_r2_C :
- {
- internalEventLifeCycle_exseq_r2_C(handle);
- break;
- }
- case InternalEventLifeCycle_r2_D :
- {
- internalEventLifeCycle_exseq_r2_D(handle);
- break;
- }
- default: break;
- }
- }
- /* The reactions of state A. */
- static void internalEventLifeCycle_react_r1_A(InternalEventLifeCycle* handle)
- {
- /* The reactions of state A. */
- if (internalEventLifeCycle_check_r1_A_tr0_tr0(handle) == bool_true)
- {
- internalEventLifeCycle_effect_r1_A_tr0(handle);
- } else
- {
- if (internalEventLifeCycle_check_r1_A_lr0_lr0(handle) == bool_true)
- {
- internalEventLifeCycle_effect_r1_A_lr0_lr0(handle);
- }
- }
- }
- /* The reactions of state B. */
- static void internalEventLifeCycle_react_r1_B(InternalEventLifeCycle* handle)
- {
- /* The reactions of state B. */
- if (internalEventLifeCycle_check_r1_B_tr0_tr0(handle) == bool_true)
- {
- internalEventLifeCycle_effect_r1_B_tr0(handle);
- }
- }
- /* The reactions of state C. */
- static void internalEventLifeCycle_react_r2_C(InternalEventLifeCycle* handle)
- {
- /* The reactions of state C. */
- if (internalEventLifeCycle_check_r2_C_tr0_tr0(handle) == bool_true)
- {
- internalEventLifeCycle_effect_r2_C_tr0(handle);
- }
- }
- /* The reactions of state D. */
- static void internalEventLifeCycle_react_r2_D(InternalEventLifeCycle* handle)
- {
- /* The reactions of state D. */
- if (internalEventLifeCycle_check_r2_D_tr0_tr0(handle) == bool_true)
- {
- internalEventLifeCycle_effect_r2_D_tr0(handle);
- }
- }
- /* Default react sequence for initial entry */
- static void internalEventLifeCycle_react_r1__entry_Default(InternalEventLifeCycle* handle)
- {
- /* Default react sequence for initial entry */
- internalEventLifeCycle_enseq_r1_A_default(handle);
- }
- /* Default react sequence for initial entry */
- static void internalEventLifeCycle_react_r2__entry_Default(InternalEventLifeCycle* handle)
- {
- /* Default react sequence for initial entry */
- internalEventLifeCycle_enseq_r2_C_default(handle);
- }
|