123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570 |
- #include <stdlib.h>
- #include <string.h>
- #include "sc_types.h"
- #include "SyncJoin.h"
- /*! \file Implementation of the state machine 'SyncJoin'
- */
- /* prototypes of all internal functions */
- static sc_boolean syncJoin_check_main_region_A_tr0_tr0(const SyncJoin* handle);
- static sc_boolean syncJoin_check_main_region_B_r1_C1_tr0_tr0(const SyncJoin* handle);
- static sc_boolean syncJoin_check_main_region_B_r1_C2_tr0_tr0(const SyncJoin* handle);
- static sc_boolean syncJoin_check_main_region_B_r2_D1_tr0_tr0(const SyncJoin* handle);
- static sc_boolean syncJoin_check_main_region_B_r2_D2_tr0_tr0(const SyncJoin* handle);
- static void syncJoin_effect_main_region_A_tr0(SyncJoin* handle);
- static void syncJoin_effect_main_region_B_r1_C1_tr0(SyncJoin* handle);
- static void syncJoin_effect_main_region_B_r1_C2_tr0(SyncJoin* handle);
- static void syncJoin_effect_main_region_B_r2_D1_tr0(SyncJoin* handle);
- static void syncJoin_effect_main_region_B_r2_D2_tr0(SyncJoin* handle);
- static void syncJoin_enact_main_region_A(SyncJoin* handle);
- static void syncJoin_enseq_main_region_A_default(SyncJoin* handle);
- static void syncJoin_enseq_main_region_B_default(SyncJoin* handle);
- static void syncJoin_enseq_main_region_B_r1_C1_default(SyncJoin* handle);
- static void syncJoin_enseq_main_region_B_r1_C2_default(SyncJoin* handle);
- static void syncJoin_enseq_main_region_B_r2_D1_default(SyncJoin* handle);
- static void syncJoin_enseq_main_region_B_r2_D2_default(SyncJoin* handle);
- static void syncJoin_enseq_main_region_default(SyncJoin* handle);
- static void syncJoin_enseq_main_region_B_r1_default(SyncJoin* handle);
- static void syncJoin_enseq_main_region_B_r2_default(SyncJoin* handle);
- static void syncJoin_exseq_main_region_A(SyncJoin* handle);
- static void syncJoin_exseq_main_region_B(SyncJoin* handle);
- static void syncJoin_exseq_main_region_B_r1_C1(SyncJoin* handle);
- static void syncJoin_exseq_main_region_B_r1_C2(SyncJoin* handle);
- static void syncJoin_exseq_main_region_B_r2_D1(SyncJoin* handle);
- static void syncJoin_exseq_main_region_B_r2_D2(SyncJoin* handle);
- static void syncJoin_exseq_main_region(SyncJoin* handle);
- static void syncJoin_exseq_main_region_B_r1(SyncJoin* handle);
- static void syncJoin_exseq_main_region_B_r2(SyncJoin* handle);
- static void syncJoin_react_main_region_A(SyncJoin* handle);
- static void syncJoin_react_main_region_B_r1_C1(SyncJoin* handle);
- static void syncJoin_react_main_region_B_r1_C2(SyncJoin* handle);
- static void syncJoin_react_main_region_B_r2_D1(SyncJoin* handle);
- static void syncJoin_react_main_region_B_r2_D2(SyncJoin* handle);
- static void syncJoin_react_main_region__entry_Default(SyncJoin* handle);
- static void syncJoin_react_main_region_B_r1__entry_Default(SyncJoin* handle);
- static void syncJoin_react_main_region_B_r2__entry_Default(SyncJoin* handle);
- static void syncJoin_react_main_region__sync0(SyncJoin* handle);
- static void syncJoin_clearInEvents(SyncJoin* handle);
- static void syncJoin_clearOutEvents(SyncJoin* handle);
- void syncJoin_init(SyncJoin* handle)
- {
- sc_integer i;
- for (i = 0; i < SYNCJOIN_MAX_ORTHOGONAL_STATES; ++i)
- {
- handle->stateConfVector[i] = SyncJoin_last_state;
- }
-
-
- handle->stateConfVectorPosition = 0;
- syncJoin_clearInEvents(handle);
- syncJoin_clearOutEvents(handle);
- /* Default init sequence for statechart SyncJoin */
- handle->iface.x = 0;
- }
- void syncJoin_enter(SyncJoin* handle)
- {
- /* Default enter sequence for statechart SyncJoin */
- syncJoin_enseq_main_region_default(handle);
- }
- void syncJoin_exit(SyncJoin* handle)
- {
- /* Default exit sequence for statechart SyncJoin */
- syncJoin_exseq_main_region(handle);
- }
- sc_boolean syncJoin_isActive(const SyncJoin* handle)
- {
- sc_boolean result = bool_false;
- int i;
-
- for(i = 0; i < SYNCJOIN_MAX_ORTHOGONAL_STATES; i++)
- {
- result = result || handle->stateConfVector[i] != SyncJoin_last_state;
- }
-
- return result;
- }
- /*
- * Always returns 'false' since this state machine can never become final.
- */
- sc_boolean syncJoin_isFinal(const SyncJoin* handle)
- {
- return bool_false;
- }
- static void syncJoin_clearInEvents(SyncJoin* handle)
- {
- handle->iface.e_raised = bool_false;
- handle->iface.f_raised = bool_false;
- handle->iface.jc_raised = bool_false;
- handle->iface.jd_raised = bool_false;
- }
- static void syncJoin_clearOutEvents(SyncJoin* handle)
- {
- }
- void syncJoin_runCycle(SyncJoin* handle)
- {
-
- syncJoin_clearOutEvents(handle);
-
- for (handle->stateConfVectorPosition = 0;
- handle->stateConfVectorPosition < SYNCJOIN_MAX_ORTHOGONAL_STATES;
- handle->stateConfVectorPosition++)
- {
-
- switch (handle->stateConfVector[handle->stateConfVectorPosition])
- {
- case SyncJoin_main_region_A :
- {
- syncJoin_react_main_region_A(handle);
- break;
- }
- case SyncJoin_main_region_B_r1_C1 :
- {
- syncJoin_react_main_region_B_r1_C1(handle);
- break;
- }
- case SyncJoin_main_region_B_r1_C2 :
- {
- syncJoin_react_main_region_B_r1_C2(handle);
- break;
- }
- case SyncJoin_main_region_B_r2_D1 :
- {
- syncJoin_react_main_region_B_r2_D1(handle);
- break;
- }
- case SyncJoin_main_region_B_r2_D2 :
- {
- syncJoin_react_main_region_B_r2_D2(handle);
- break;
- }
- default:
- break;
- }
- }
-
- syncJoin_clearInEvents(handle);
- }
- sc_boolean syncJoin_isStateActive(const SyncJoin* handle, SyncJoinStates state)
- {
- sc_boolean result = bool_false;
- switch (state)
- {
- case SyncJoin_main_region_A :
- result = (sc_boolean) (handle->stateConfVector[SCVI_SYNCJOIN_MAIN_REGION_A] == SyncJoin_main_region_A
- );
- break;
- case SyncJoin_main_region_B :
- result = (sc_boolean) (handle->stateConfVector[SCVI_SYNCJOIN_MAIN_REGION_B] >= SyncJoin_main_region_B
- && handle->stateConfVector[SCVI_SYNCJOIN_MAIN_REGION_B] <= SyncJoin_main_region_B_r2_D2);
- break;
- case SyncJoin_main_region_B_r1_C1 :
- result = (sc_boolean) (handle->stateConfVector[SCVI_SYNCJOIN_MAIN_REGION_B_R1_C1] == SyncJoin_main_region_B_r1_C1
- );
- break;
- case SyncJoin_main_region_B_r1_C2 :
- result = (sc_boolean) (handle->stateConfVector[SCVI_SYNCJOIN_MAIN_REGION_B_R1_C2] == SyncJoin_main_region_B_r1_C2
- );
- break;
- case SyncJoin_main_region_B_r2_D1 :
- result = (sc_boolean) (handle->stateConfVector[SCVI_SYNCJOIN_MAIN_REGION_B_R2_D1] == SyncJoin_main_region_B_r2_D1
- );
- break;
- case SyncJoin_main_region_B_r2_D2 :
- result = (sc_boolean) (handle->stateConfVector[SCVI_SYNCJOIN_MAIN_REGION_B_R2_D2] == SyncJoin_main_region_B_r2_D2
- );
- break;
- default:
- result = bool_false;
- break;
- }
- return result;
- }
- void syncJoinIface_raise_e(SyncJoin* handle)
- {
- handle->iface.e_raised = bool_true;
- }
- void syncJoinIface_raise_f(SyncJoin* handle)
- {
- handle->iface.f_raised = bool_true;
- }
- void syncJoinIface_raise_jc(SyncJoin* handle)
- {
- handle->iface.jc_raised = bool_true;
- }
- void syncJoinIface_raise_jd(SyncJoin* handle)
- {
- handle->iface.jd_raised = bool_true;
- }
- sc_integer syncJoinIface_get_x(const SyncJoin* handle)
- {
- return handle->iface.x;
- }
- void syncJoinIface_set_x(SyncJoin* handle, sc_integer value)
- {
- handle->iface.x = value;
- }
- /* implementations of all internal functions */
- static sc_boolean syncJoin_check_main_region_A_tr0_tr0(const SyncJoin* handle)
- {
- return (handle->iface.e_raised || handle->iface.f_raised) ? bool_true : bool_false;
- }
- static sc_boolean syncJoin_check_main_region_B_r1_C1_tr0_tr0(const SyncJoin* handle)
- {
- return handle->iface.e_raised;
- }
- static sc_boolean syncJoin_check_main_region_B_r1_C2_tr0_tr0(const SyncJoin* handle)
- {
- return (handle->iface.jc_raised && syncJoin_isStateActive(handle, SyncJoin_main_region_B_r2_D2) && handle->iface.jd_raised) ? bool_true : bool_false;
- }
- static sc_boolean syncJoin_check_main_region_B_r2_D1_tr0_tr0(const SyncJoin* handle)
- {
- return handle->iface.f_raised;
- }
- static sc_boolean syncJoin_check_main_region_B_r2_D2_tr0_tr0(const SyncJoin* handle)
- {
- return (handle->iface.jd_raised && syncJoin_isStateActive(handle, SyncJoin_main_region_B_r1_C2) && handle->iface.jc_raised) ? bool_true : bool_false;
- }
- static void syncJoin_effect_main_region_A_tr0(SyncJoin* handle)
- {
- syncJoin_exseq_main_region_A(handle);
- syncJoin_enseq_main_region_B_default(handle);
- }
- static void syncJoin_effect_main_region_B_r1_C1_tr0(SyncJoin* handle)
- {
- syncJoin_exseq_main_region_B_r1_C1(handle);
- syncJoin_enseq_main_region_B_r1_C2_default(handle);
- }
- static void syncJoin_effect_main_region_B_r1_C2_tr0(SyncJoin* handle)
- {
- syncJoin_exseq_main_region_B(handle);
- syncJoin_react_main_region__sync0(handle);
- }
- static void syncJoin_effect_main_region_B_r2_D1_tr0(SyncJoin* handle)
- {
- syncJoin_exseq_main_region_B_r2_D1(handle);
- syncJoin_enseq_main_region_B_r2_D2_default(handle);
- }
- static void syncJoin_effect_main_region_B_r2_D2_tr0(SyncJoin* handle)
- {
- syncJoin_exseq_main_region_B(handle);
- syncJoin_react_main_region__sync0(handle);
- }
- /* Entry action for state 'A'. */
- static void syncJoin_enact_main_region_A(SyncJoin* handle)
- {
- /* Entry action for state 'A'. */
- handle->iface.x += 1;
- }
- /* 'default' enter sequence for state A */
- static void syncJoin_enseq_main_region_A_default(SyncJoin* handle)
- {
- /* 'default' enter sequence for state A */
- syncJoin_enact_main_region_A(handle);
- handle->stateConfVector[0] = SyncJoin_main_region_A;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state B */
- static void syncJoin_enseq_main_region_B_default(SyncJoin* handle)
- {
- /* 'default' enter sequence for state B */
- syncJoin_enseq_main_region_B_r1_default(handle);
- syncJoin_enseq_main_region_B_r2_default(handle);
- }
- /* 'default' enter sequence for state C1 */
- static void syncJoin_enseq_main_region_B_r1_C1_default(SyncJoin* handle)
- {
- /* 'default' enter sequence for state C1 */
- handle->stateConfVector[0] = SyncJoin_main_region_B_r1_C1;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state C2 */
- static void syncJoin_enseq_main_region_B_r1_C2_default(SyncJoin* handle)
- {
- /* 'default' enter sequence for state C2 */
- handle->stateConfVector[0] = SyncJoin_main_region_B_r1_C2;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state D1 */
- static void syncJoin_enseq_main_region_B_r2_D1_default(SyncJoin* handle)
- {
- /* 'default' enter sequence for state D1 */
- handle->stateConfVector[1] = SyncJoin_main_region_B_r2_D1;
- handle->stateConfVectorPosition = 1;
- }
- /* 'default' enter sequence for state D2 */
- static void syncJoin_enseq_main_region_B_r2_D2_default(SyncJoin* handle)
- {
- /* 'default' enter sequence for state D2 */
- handle->stateConfVector[1] = SyncJoin_main_region_B_r2_D2;
- handle->stateConfVectorPosition = 1;
- }
- /* 'default' enter sequence for region main region */
- static void syncJoin_enseq_main_region_default(SyncJoin* handle)
- {
- /* 'default' enter sequence for region main region */
- syncJoin_react_main_region__entry_Default(handle);
- }
- /* 'default' enter sequence for region r1 */
- static void syncJoin_enseq_main_region_B_r1_default(SyncJoin* handle)
- {
- /* 'default' enter sequence for region r1 */
- syncJoin_react_main_region_B_r1__entry_Default(handle);
- }
- /* 'default' enter sequence for region r2 */
- static void syncJoin_enseq_main_region_B_r2_default(SyncJoin* handle)
- {
- /* 'default' enter sequence for region r2 */
- syncJoin_react_main_region_B_r2__entry_Default(handle);
- }
- /* Default exit sequence for state A */
- static void syncJoin_exseq_main_region_A(SyncJoin* handle)
- {
- /* Default exit sequence for state A */
- handle->stateConfVector[0] = SyncJoin_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state B */
- static void syncJoin_exseq_main_region_B(SyncJoin* handle)
- {
- /* Default exit sequence for state B */
- syncJoin_exseq_main_region_B_r1(handle);
- syncJoin_exseq_main_region_B_r2(handle);
- }
- /* Default exit sequence for state C1 */
- static void syncJoin_exseq_main_region_B_r1_C1(SyncJoin* handle)
- {
- /* Default exit sequence for state C1 */
- handle->stateConfVector[0] = SyncJoin_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state C2 */
- static void syncJoin_exseq_main_region_B_r1_C2(SyncJoin* handle)
- {
- /* Default exit sequence for state C2 */
- handle->stateConfVector[0] = SyncJoin_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state D1 */
- static void syncJoin_exseq_main_region_B_r2_D1(SyncJoin* handle)
- {
- /* Default exit sequence for state D1 */
- handle->stateConfVector[1] = SyncJoin_last_state;
- handle->stateConfVectorPosition = 1;
- }
- /* Default exit sequence for state D2 */
- static void syncJoin_exseq_main_region_B_r2_D2(SyncJoin* handle)
- {
- /* Default exit sequence for state D2 */
- handle->stateConfVector[1] = SyncJoin_last_state;
- handle->stateConfVectorPosition = 1;
- }
- /* Default exit sequence for region main region */
- static void syncJoin_exseq_main_region(SyncJoin* handle)
- {
- /* Default exit sequence for region main region */
- /* Handle exit of all possible states (of SyncJoin.main_region) at position 0... */
- switch(handle->stateConfVector[ 0 ])
- {
- case SyncJoin_main_region_A :
- {
- syncJoin_exseq_main_region_A(handle);
- break;
- }
- case SyncJoin_main_region_B_r1_C1 :
- {
- syncJoin_exseq_main_region_B_r1_C1(handle);
- break;
- }
- case SyncJoin_main_region_B_r1_C2 :
- {
- syncJoin_exseq_main_region_B_r1_C2(handle);
- break;
- }
- default: break;
- }
- /* Handle exit of all possible states (of SyncJoin.main_region) at position 1... */
- switch(handle->stateConfVector[ 1 ])
- {
- case SyncJoin_main_region_B_r2_D1 :
- {
- syncJoin_exseq_main_region_B_r2_D1(handle);
- break;
- }
- case SyncJoin_main_region_B_r2_D2 :
- {
- syncJoin_exseq_main_region_B_r2_D2(handle);
- break;
- }
- default: break;
- }
- }
- /* Default exit sequence for region r1 */
- static void syncJoin_exseq_main_region_B_r1(SyncJoin* handle)
- {
- /* Default exit sequence for region r1 */
- /* Handle exit of all possible states (of SyncJoin.main_region.B.r1) at position 0... */
- switch(handle->stateConfVector[ 0 ])
- {
- case SyncJoin_main_region_B_r1_C1 :
- {
- syncJoin_exseq_main_region_B_r1_C1(handle);
- break;
- }
- case SyncJoin_main_region_B_r1_C2 :
- {
- syncJoin_exseq_main_region_B_r1_C2(handle);
- break;
- }
- default: break;
- }
- }
- /* Default exit sequence for region r2 */
- static void syncJoin_exseq_main_region_B_r2(SyncJoin* handle)
- {
- /* Default exit sequence for region r2 */
- /* Handle exit of all possible states (of SyncJoin.main_region.B.r2) at position 1... */
- switch(handle->stateConfVector[ 1 ])
- {
- case SyncJoin_main_region_B_r2_D1 :
- {
- syncJoin_exseq_main_region_B_r2_D1(handle);
- break;
- }
- case SyncJoin_main_region_B_r2_D2 :
- {
- syncJoin_exseq_main_region_B_r2_D2(handle);
- break;
- }
- default: break;
- }
- }
- /* The reactions of state A. */
- static void syncJoin_react_main_region_A(SyncJoin* handle)
- {
- /* The reactions of state A. */
- if (syncJoin_check_main_region_A_tr0_tr0(handle) == bool_true)
- {
- syncJoin_effect_main_region_A_tr0(handle);
- }
- }
- /* The reactions of state C1. */
- static void syncJoin_react_main_region_B_r1_C1(SyncJoin* handle)
- {
- /* The reactions of state C1. */
- if (syncJoin_check_main_region_B_r1_C1_tr0_tr0(handle) == bool_true)
- {
- syncJoin_effect_main_region_B_r1_C1_tr0(handle);
- }
- }
- /* The reactions of state C2. */
- static void syncJoin_react_main_region_B_r1_C2(SyncJoin* handle)
- {
- /* The reactions of state C2. */
- if (syncJoin_check_main_region_B_r1_C2_tr0_tr0(handle) == bool_true)
- {
- syncJoin_effect_main_region_B_r1_C2_tr0(handle);
- }
- }
- /* The reactions of state D1. */
- static void syncJoin_react_main_region_B_r2_D1(SyncJoin* handle)
- {
- /* The reactions of state D1. */
- if (syncJoin_check_main_region_B_r2_D1_tr0_tr0(handle) == bool_true)
- {
- syncJoin_effect_main_region_B_r2_D1_tr0(handle);
- }
- }
- /* The reactions of state D2. */
- static void syncJoin_react_main_region_B_r2_D2(SyncJoin* handle)
- {
- /* The reactions of state D2. */
- if (syncJoin_check_main_region_B_r2_D2_tr0_tr0(handle) == bool_true)
- {
- syncJoin_effect_main_region_B_r2_D2_tr0(handle);
- }
- }
- /* Default react sequence for initial entry */
- static void syncJoin_react_main_region__entry_Default(SyncJoin* handle)
- {
- /* Default react sequence for initial entry */
- syncJoin_enseq_main_region_B_default(handle);
- }
- /* Default react sequence for initial entry */
- static void syncJoin_react_main_region_B_r1__entry_Default(SyncJoin* handle)
- {
- /* Default react sequence for initial entry */
- syncJoin_enseq_main_region_B_r1_C1_default(handle);
- }
- /* Default react sequence for initial entry */
- static void syncJoin_react_main_region_B_r2__entry_Default(SyncJoin* handle)
- {
- /* Default react sequence for initial entry */
- syncJoin_enseq_main_region_B_r2_D1_default(handle);
- }
- /* The reactions of state null. */
- static void syncJoin_react_main_region__sync0(SyncJoin* handle)
- {
- /* The reactions of state null. */
- syncJoin_enseq_main_region_A_default(handle);
- }
|