123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542 |
- #include <stdlib.h>
- #include <string.h>
- #include "sc_types.h"
- #include "Choice.h"
- /*! \file Implementation of the state machine 'Choice'
- */
- /* prototypes of all internal functions */
- static sc_boolean choice_check_main_region_A_tr0_tr0(const Choice* handle);
- static sc_boolean choice_check_main_region_A_tr1_tr1(const Choice* handle);
- static sc_boolean choice_check_main_region_A_tr2_tr2(const Choice* handle);
- static sc_boolean choice_check_main_region_A_tr3_tr3(const Choice* handle);
- static sc_boolean choice_check_main_region_B_tr0_tr0(const Choice* handle);
- static sc_boolean choice_check_main_region_C_tr0_tr0(const Choice* handle);
- static sc_boolean choice_check_main_region__choice_0_tr1_tr1(const Choice* handle);
- static sc_boolean choice_check_main_region__choice_0_tr0_tr0(const Choice* handle);
- static sc_boolean choice_check_main_region__choice_1_tr0_tr0(const Choice* handle);
- static sc_boolean choice_check_main_region__choice_1_tr1_tr1(const Choice* handle);
- static sc_boolean choice_check_main_region__choice_2_tr1_tr1(const Choice* handle);
- static sc_boolean choice_check_main_region__choice_2_tr0(const Choice* handle);
- static sc_boolean choice_check_main_region__choice_3_tr1_tr1(const Choice* handle);
- static sc_boolean choice_check_main_region__choice_3_tr0_tr0(const Choice* handle);
- static void choice_effect_main_region_A_tr0(Choice* handle);
- static void choice_effect_main_region_A_tr1(Choice* handle);
- static void choice_effect_main_region_A_tr2(Choice* handle);
- static void choice_effect_main_region_A_tr3(Choice* handle);
- static void choice_effect_main_region_B_tr0(Choice* handle);
- static void choice_effect_main_region_C_tr0(Choice* handle);
- static void choice_effect_main_region__choice_0_tr1(Choice* handle);
- static void choice_effect_main_region__choice_0_tr0(Choice* handle);
- static void choice_effect_main_region__choice_1_tr0(Choice* handle);
- static void choice_effect_main_region__choice_1_tr1(Choice* handle);
- static void choice_effect_main_region__choice_2_tr1(Choice* handle);
- static void choice_effect_main_region__choice_2_tr0(Choice* handle);
- static void choice_effect_main_region__choice_3_tr1(Choice* handle);
- static void choice_effect_main_region__choice_3_tr0(Choice* handle);
- static void choice_enseq_main_region_A_default(Choice* handle);
- static void choice_enseq_main_region_B_default(Choice* handle);
- static void choice_enseq_main_region_C_default(Choice* handle);
- static void choice_enseq_main_region_default(Choice* handle);
- static void choice_exseq_main_region_A(Choice* handle);
- static void choice_exseq_main_region_B(Choice* handle);
- static void choice_exseq_main_region_C(Choice* handle);
- static void choice_exseq_main_region(Choice* handle);
- static void choice_react_main_region_A(Choice* handle);
- static void choice_react_main_region_B(Choice* handle);
- static void choice_react_main_region_C(Choice* handle);
- static void choice_react_main_region__choice_0(Choice* handle);
- static void choice_react_main_region__choice_1(Choice* handle);
- static void choice_react_main_region__choice_2(Choice* handle);
- static void choice_react_main_region__choice_3(Choice* handle);
- static void choice_react_main_region__entry_Default(Choice* handle);
- static void choice_clearInEvents(Choice* handle);
- static void choice_clearOutEvents(Choice* handle);
- void choice_init(Choice* handle)
- {
- sc_integer i;
- for (i = 0; i < CHOICE_MAX_ORTHOGONAL_STATES; ++i)
- {
- handle->stateConfVector[i] = Choice_last_state;
- }
-
-
- handle->stateConfVectorPosition = 0;
- choice_clearInEvents(handle);
- choice_clearOutEvents(handle);
- /* Default init sequence for statechart Choice */
- handle->iface.c = bool_false;
- }
- void choice_enter(Choice* handle)
- {
- /* Default enter sequence for statechart Choice */
- choice_enseq_main_region_default(handle);
- }
- void choice_exit(Choice* handle)
- {
- /* Default exit sequence for statechart Choice */
- choice_exseq_main_region(handle);
- }
- sc_boolean choice_isActive(const Choice* handle)
- {
- sc_boolean result;
- if (handle->stateConfVector[0] != Choice_last_state)
- {
- result = bool_true;
- }
- else
- {
- result = bool_false;
- }
- return result;
- }
- /*
- * Always returns 'false' since this state machine can never become final.
- */
- sc_boolean choice_isFinal(const Choice* handle)
- {
- return bool_false;
- }
- static void choice_clearInEvents(Choice* handle)
- {
- handle->iface.e_raised = bool_false;
- handle->iface.f_raised = bool_false;
- handle->iface.g_raised = bool_false;
- handle->iface.h_raised = bool_false;
- }
- static void choice_clearOutEvents(Choice* handle)
- {
- }
- void choice_runCycle(Choice* handle)
- {
-
- choice_clearOutEvents(handle);
-
- for (handle->stateConfVectorPosition = 0;
- handle->stateConfVectorPosition < CHOICE_MAX_ORTHOGONAL_STATES;
- handle->stateConfVectorPosition++)
- {
-
- switch (handle->stateConfVector[handle->stateConfVectorPosition])
- {
- case Choice_main_region_A :
- {
- choice_react_main_region_A(handle);
- break;
- }
- case Choice_main_region_B :
- {
- choice_react_main_region_B(handle);
- break;
- }
- case Choice_main_region_C :
- {
- choice_react_main_region_C(handle);
- break;
- }
- default:
- break;
- }
- }
-
- choice_clearInEvents(handle);
- }
- sc_boolean choice_isStateActive(const Choice* handle, ChoiceStates state)
- {
- sc_boolean result = bool_false;
- switch (state)
- {
- case Choice_main_region_A :
- result = (sc_boolean) (handle->stateConfVector[0] == Choice_main_region_A
- );
- break;
- case Choice_main_region_B :
- result = (sc_boolean) (handle->stateConfVector[0] == Choice_main_region_B
- );
- break;
- case Choice_main_region_C :
- result = (sc_boolean) (handle->stateConfVector[0] == Choice_main_region_C
- );
- break;
- default:
- result = bool_false;
- break;
- }
- return result;
- }
- void choiceIface_raise_e(Choice* handle)
- {
- handle->iface.e_raised = bool_true;
- }
- void choiceIface_raise_f(Choice* handle)
- {
- handle->iface.f_raised = bool_true;
- }
- void choiceIface_raise_g(Choice* handle)
- {
- handle->iface.g_raised = bool_true;
- }
- void choiceIface_raise_h(Choice* handle)
- {
- handle->iface.h_raised = bool_true;
- }
- sc_boolean choiceIface_get_c(const Choice* handle)
- {
- return handle->iface.c;
- }
- void choiceIface_set_c(Choice* handle, sc_boolean value)
- {
- handle->iface.c = value;
- }
- /* implementations of all internal functions */
- static sc_boolean choice_check_main_region_A_tr0_tr0(const Choice* handle)
- {
- return handle->iface.e_raised;
- }
- static sc_boolean choice_check_main_region_A_tr1_tr1(const Choice* handle)
- {
- return handle->iface.f_raised;
- }
- static sc_boolean choice_check_main_region_A_tr2_tr2(const Choice* handle)
- {
- return handle->iface.g_raised;
- }
- static sc_boolean choice_check_main_region_A_tr3_tr3(const Choice* handle)
- {
- return handle->iface.h_raised;
- }
- static sc_boolean choice_check_main_region_B_tr0_tr0(const Choice* handle)
- {
- return bool_true;
- }
- static sc_boolean choice_check_main_region_C_tr0_tr0(const Choice* handle)
- {
- return bool_true;
- }
- static sc_boolean choice_check_main_region__choice_0_tr1_tr1(const Choice* handle)
- {
- return handle->iface.c;
- }
- static sc_boolean choice_check_main_region__choice_0_tr0_tr0(const Choice* handle)
- {
- return bool_true;
- }
- static sc_boolean choice_check_main_region__choice_1_tr0_tr0(const Choice* handle)
- {
- return handle->iface.c;
- }
- static sc_boolean choice_check_main_region__choice_1_tr1_tr1(const Choice* handle)
- {
- return bool_true;
- }
- static sc_boolean choice_check_main_region__choice_2_tr1_tr1(const Choice* handle)
- {
- return handle->iface.c;
- }
- static sc_boolean choice_check_main_region__choice_2_tr0(const Choice* handle)
- {
- return bool_true;
- }
- static sc_boolean choice_check_main_region__choice_3_tr1_tr1(const Choice* handle)
- {
- return handle->iface.c;
- }
- static sc_boolean choice_check_main_region__choice_3_tr0_tr0(const Choice* handle)
- {
- return bool_true;
- }
- static void choice_effect_main_region_A_tr0(Choice* handle)
- {
- choice_exseq_main_region_A(handle);
- choice_react_main_region__choice_0(handle);
- }
- static void choice_effect_main_region_A_tr1(Choice* handle)
- {
- choice_exseq_main_region_A(handle);
- choice_react_main_region__choice_2(handle);
- }
- static void choice_effect_main_region_A_tr2(Choice* handle)
- {
- choice_exseq_main_region_A(handle);
- choice_react_main_region__choice_1(handle);
- }
- static void choice_effect_main_region_A_tr3(Choice* handle)
- {
- choice_exseq_main_region_A(handle);
- choice_react_main_region__choice_3(handle);
- }
- static void choice_effect_main_region_B_tr0(Choice* handle)
- {
- choice_exseq_main_region_B(handle);
- choice_enseq_main_region_A_default(handle);
- }
- static void choice_effect_main_region_C_tr0(Choice* handle)
- {
- choice_exseq_main_region_C(handle);
- choice_enseq_main_region_A_default(handle);
- }
- static void choice_effect_main_region__choice_0_tr1(Choice* handle)
- {
- choice_enseq_main_region_C_default(handle);
- }
- static void choice_effect_main_region__choice_0_tr0(Choice* handle)
- {
- choice_enseq_main_region_B_default(handle);
- }
- static void choice_effect_main_region__choice_1_tr0(Choice* handle)
- {
- choice_enseq_main_region_C_default(handle);
- }
- static void choice_effect_main_region__choice_1_tr1(Choice* handle)
- {
- choice_enseq_main_region_B_default(handle);
- }
- static void choice_effect_main_region__choice_2_tr1(Choice* handle)
- {
- choice_enseq_main_region_C_default(handle);
- }
- static void choice_effect_main_region__choice_2_tr0(Choice* handle)
- {
- choice_enseq_main_region_B_default(handle);
- }
- static void choice_effect_main_region__choice_3_tr1(Choice* handle)
- {
- choice_enseq_main_region_C_default(handle);
- }
- static void choice_effect_main_region__choice_3_tr0(Choice* handle)
- {
- choice_enseq_main_region_B_default(handle);
- }
- /* 'default' enter sequence for state A */
- static void choice_enseq_main_region_A_default(Choice* handle)
- {
- /* 'default' enter sequence for state A */
- handle->stateConfVector[0] = Choice_main_region_A;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state B */
- static void choice_enseq_main_region_B_default(Choice* handle)
- {
- /* 'default' enter sequence for state B */
- handle->stateConfVector[0] = Choice_main_region_B;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state C */
- static void choice_enseq_main_region_C_default(Choice* handle)
- {
- /* 'default' enter sequence for state C */
- handle->stateConfVector[0] = Choice_main_region_C;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for region main region */
- static void choice_enseq_main_region_default(Choice* handle)
- {
- /* 'default' enter sequence for region main region */
- choice_react_main_region__entry_Default(handle);
- }
- /* Default exit sequence for state A */
- static void choice_exseq_main_region_A(Choice* handle)
- {
- /* Default exit sequence for state A */
- handle->stateConfVector[0] = Choice_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state B */
- static void choice_exseq_main_region_B(Choice* handle)
- {
- /* Default exit sequence for state B */
- handle->stateConfVector[0] = Choice_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state C */
- static void choice_exseq_main_region_C(Choice* handle)
- {
- /* Default exit sequence for state C */
- handle->stateConfVector[0] = Choice_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for region main region */
- static void choice_exseq_main_region(Choice* handle)
- {
- /* Default exit sequence for region main region */
- /* Handle exit of all possible states (of Choice.main_region) at position 0... */
- switch(handle->stateConfVector[ 0 ])
- {
- case Choice_main_region_A :
- {
- choice_exseq_main_region_A(handle);
- break;
- }
- case Choice_main_region_B :
- {
- choice_exseq_main_region_B(handle);
- break;
- }
- case Choice_main_region_C :
- {
- choice_exseq_main_region_C(handle);
- break;
- }
- default: break;
- }
- }
- /* The reactions of state A. */
- static void choice_react_main_region_A(Choice* handle)
- {
- /* The reactions of state A. */
- if (choice_check_main_region_A_tr0_tr0(handle) == bool_true)
- {
- choice_effect_main_region_A_tr0(handle);
- } else
- {
- if (choice_check_main_region_A_tr1_tr1(handle) == bool_true)
- {
- choice_effect_main_region_A_tr1(handle);
- } else
- {
- if (choice_check_main_region_A_tr2_tr2(handle) == bool_true)
- {
- choice_effect_main_region_A_tr2(handle);
- } else
- {
- if (choice_check_main_region_A_tr3_tr3(handle) == bool_true)
- {
- choice_effect_main_region_A_tr3(handle);
- }
- }
- }
- }
- }
- /* The reactions of state B. */
- static void choice_react_main_region_B(Choice* handle)
- {
- /* The reactions of state B. */
- choice_effect_main_region_B_tr0(handle);
- }
- /* The reactions of state C. */
- static void choice_react_main_region_C(Choice* handle)
- {
- /* The reactions of state C. */
- choice_effect_main_region_C_tr0(handle);
- }
- /* The reactions of state null. */
- static void choice_react_main_region__choice_0(Choice* handle)
- {
- /* The reactions of state null. */
- if (choice_check_main_region__choice_0_tr1_tr1(handle) == bool_true)
- {
- choice_effect_main_region__choice_0_tr1(handle);
- } else
- {
- choice_effect_main_region__choice_0_tr0(handle);
- }
- }
- /* The reactions of state null. */
- static void choice_react_main_region__choice_1(Choice* handle)
- {
- /* The reactions of state null. */
- if (choice_check_main_region__choice_1_tr0_tr0(handle) == bool_true)
- {
- choice_effect_main_region__choice_1_tr0(handle);
- } else
- {
- choice_effect_main_region__choice_1_tr1(handle);
- }
- }
- /* The reactions of state null. */
- static void choice_react_main_region__choice_2(Choice* handle)
- {
- /* The reactions of state null. */
- if (choice_check_main_region__choice_2_tr1_tr1(handle) == bool_true)
- {
- choice_effect_main_region__choice_2_tr1(handle);
- } else
- {
- choice_effect_main_region__choice_2_tr0(handle);
- }
- }
- /* The reactions of state null. */
- static void choice_react_main_region__choice_3(Choice* handle)
- {
- /* The reactions of state null. */
- if (choice_check_main_region__choice_3_tr1_tr1(handle) == bool_true)
- {
- choice_effect_main_region__choice_3_tr1(handle);
- } else
- {
- choice_effect_main_region__choice_3_tr0(handle);
- }
- }
- /* Default react sequence for initial entry */
- static void choice_react_main_region__entry_Default(Choice* handle)
- {
- /* Default react sequence for initial entry */
- choice_enseq_main_region_A_default(handle);
- }
|