123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525 |
- #include <stdlib.h>
- #include <string.h>
- #include "sc_types.h"
- #include "Declarations.h"
- /*! \file Implementation of the state machine 'Declarations'
- */
- /* prototypes of all internal functions */
- static sc_boolean declarations_check_main_region_A_tr0_tr0(const Declarations* handle);
- static sc_boolean declarations_check_main_region_A_tr1_tr1(const Declarations* handle);
- static sc_boolean declarations_check_main_region_B_tr0_tr0(const Declarations* handle);
- static sc_boolean declarations_check_main_region_B_tr1_tr1(const Declarations* handle);
- static sc_boolean declarations_check_main_region_B_tr2_tr2(const Declarations* handle);
- static sc_boolean declarations_check_main_region_B_tr3_tr3(const Declarations* handle);
- static void declarations_effect_main_region_A_tr0(Declarations* handle);
- static void declarations_effect_main_region_A_tr1(Declarations* handle);
- static void declarations_effect_main_region_B_tr0(Declarations* handle);
- static void declarations_effect_main_region_B_tr1(Declarations* handle);
- static void declarations_effect_main_region_B_tr2(Declarations* handle);
- static void declarations_effect_main_region_B_tr3(Declarations* handle);
- static void declarations_enact_main_region_A(Declarations* handle);
- static void declarations_enseq_main_region_A_default(Declarations* handle);
- static void declarations_enseq_main_region_B_default(Declarations* handle);
- static void declarations_enseq_main_region_default(Declarations* handle);
- static void declarations_exseq_main_region_A(Declarations* handle);
- static void declarations_exseq_main_region_B(Declarations* handle);
- static void declarations_exseq_main_region(Declarations* handle);
- static void declarations_react_main_region_A(Declarations* handle);
- static void declarations_react_main_region_B(Declarations* handle);
- static void declarations_react_main_region__entry_Default(Declarations* handle);
- static void declarations_clearInEvents(Declarations* handle);
- static void declarations_clearOutEvents(Declarations* handle);
- void declarations_init(Declarations* handle)
- {
- sc_integer i;
- for (i = 0; i < DECLARATIONS_MAX_ORTHOGONAL_STATES; ++i)
- {
- handle->stateConfVector[i] = Declarations_last_state;
- }
-
-
- handle->stateConfVectorPosition = 0;
- declarations_clearInEvents(handle);
- declarations_clearOutEvents(handle);
- /* Default init sequence for statechart Declarations */
- handle->iface.varA = bool_false;
- handle->iface.varB = 1;
- handle->iface.varC = 1.0;
- handle->iface.varD = "myString";
- handle->iface.varE = 0x10;
- handle->ifaceIfA.varA = bool_false;
- handle->ifaceIfA.varB = 1;
- handle->ifaceIfA.varC = 1.0;
- handle->ifaceIfA.varD = "myString";
- handle->ifaceIfA.varE = 0x10;
- handle->internal.varInA = bool_false;
- handle->internal.varInB = 1;
- handle->internal.varInC = 1.0;
- handle->internal.varInD = "myString";
- handle->internal.varInE = 0x10;
- }
- void declarations_enter(Declarations* handle)
- {
- /* Default enter sequence for statechart Declarations */
- declarations_enseq_main_region_default(handle);
- }
- void declarations_exit(Declarations* handle)
- {
- /* Default exit sequence for statechart Declarations */
- declarations_exseq_main_region(handle);
- }
- sc_boolean declarations_isActive(const Declarations* handle)
- {
- sc_boolean result = bool_false;
- int i;
-
- for(i = 0; i < DECLARATIONS_MAX_ORTHOGONAL_STATES; i++)
- {
- result = result || handle->stateConfVector[i] != Declarations_last_state;
- }
-
- return result;
- }
- /*
- * Always returns 'false' since this state machine can never become final.
- */
- sc_boolean declarations_isFinal(const Declarations* handle)
- {
- return bool_false;
- }
- static void declarations_clearInEvents(Declarations* handle)
- {
- handle->iface.evA_raised = bool_false;
- handle->iface.evC_raised = bool_false;
- handle->iface.evE_raised = bool_false;
- handle->ifaceIfA.evA_raised = bool_false;
- handle->ifaceIfA.evC_raised = bool_false;
- handle->ifaceIfA.evE_raised = bool_false;
- handle->internal.evInA_raised = bool_false;
- handle->internal.evInB_raised = bool_false;
- handle->internal.evInC_raised = bool_false;
- handle->internal.evInD_raised = bool_false;
- handle->internal.evInE_raised = bool_false;
- handle->internal.evInF_raised = bool_false;
- }
- static void declarations_clearOutEvents(Declarations* handle)
- {
- handle->iface.evB_raised = bool_false;
- handle->iface.evD_raised = bool_false;
- handle->iface.evF_raised = bool_false;
- handle->ifaceIfA.evB_raised = bool_false;
- handle->ifaceIfA.evD_raised = bool_false;
- handle->ifaceIfA.evF_raised = bool_false;
- }
- void declarations_runCycle(Declarations* handle)
- {
-
- declarations_clearOutEvents(handle);
-
- for (handle->stateConfVectorPosition = 0;
- handle->stateConfVectorPosition < DECLARATIONS_MAX_ORTHOGONAL_STATES;
- handle->stateConfVectorPosition++)
- {
-
- switch (handle->stateConfVector[handle->stateConfVectorPosition])
- {
- case Declarations_main_region_A :
- {
- declarations_react_main_region_A(handle);
- break;
- }
- case Declarations_main_region_B :
- {
- declarations_react_main_region_B(handle);
- break;
- }
- default:
- break;
- }
- }
-
- declarations_clearInEvents(handle);
- }
- sc_boolean declarations_isStateActive(const Declarations* handle, DeclarationsStates state)
- {
- sc_boolean result = bool_false;
- switch (state)
- {
- case Declarations_main_region_A :
- result = (sc_boolean) (handle->stateConfVector[SCVI_DECLARATIONS_MAIN_REGION_A] == Declarations_main_region_A
- );
- break;
- case Declarations_main_region_B :
- result = (sc_boolean) (handle->stateConfVector[SCVI_DECLARATIONS_MAIN_REGION_B] == Declarations_main_region_B
- );
- break;
- default:
- result = bool_false;
- break;
- }
- return result;
- }
- void declarationsIface_raise_evA(Declarations* handle)
- {
- handle->iface.evA_raised = bool_true;
- }
- void declarationsIface_raise_evC(Declarations* handle, sc_boolean value)
- {
- handle->iface.evC_value = value;
- handle->iface.evC_raised = bool_true;
- }
- void declarationsIface_raise_evE(Declarations* handle, sc_real value)
- {
- handle->iface.evE_value = value;
- handle->iface.evE_raised = bool_true;
- }
- sc_boolean declarationsIface_israised_evB(const Declarations* handle)
- {
- return handle->iface.evB_raised;
- }
- sc_boolean declarationsIface_israised_evD(const Declarations* handle)
- {
- return handle->iface.evD_raised;
- }
- sc_integer declarationsIface_get_evD_value(const Declarations* handle)
- {
- return handle->iface.evD_value;
- }
- sc_boolean declarationsIface_israised_evF(const Declarations* handle)
- {
- return handle->iface.evF_raised;
- }
- sc_string declarationsIface_get_evF_value(const Declarations* handle)
- {
- return handle->iface.evF_value;
- }
- sc_boolean declarationsIface_get_varA(const Declarations* handle)
- {
- return handle->iface.varA;
- }
- void declarationsIface_set_varA(Declarations* handle, sc_boolean value)
- {
- handle->iface.varA = value;
- }
- sc_integer declarationsIface_get_varB(const Declarations* handle)
- {
- return handle->iface.varB;
- }
- void declarationsIface_set_varB(Declarations* handle, sc_integer value)
- {
- handle->iface.varB = value;
- }
- sc_real declarationsIface_get_varC(const Declarations* handle)
- {
- return handle->iface.varC;
- }
- void declarationsIface_set_varC(Declarations* handle, sc_real value)
- {
- handle->iface.varC = value;
- }
- sc_string declarationsIface_get_varD(const Declarations* handle)
- {
- return handle->iface.varD;
- }
- void declarationsIface_set_varD(Declarations* handle, sc_string value)
- {
- handle->iface.varD = value;
- }
- sc_integer declarationsIface_get_varE(const Declarations* handle)
- {
- return handle->iface.varE;
- }
- void declarationsIface_set_varE(Declarations* handle, sc_integer value)
- {
- handle->iface.varE = value;
- }
- void declarationsIfaceIfA_raise_evA(Declarations* handle)
- {
- handle->ifaceIfA.evA_raised = bool_true;
- }
- void declarationsIfaceIfA_raise_evC(Declarations* handle, sc_boolean value)
- {
- handle->ifaceIfA.evC_value = value;
- handle->ifaceIfA.evC_raised = bool_true;
- }
- void declarationsIfaceIfA_raise_evE(Declarations* handle, sc_real value)
- {
- handle->ifaceIfA.evE_value = value;
- handle->ifaceIfA.evE_raised = bool_true;
- }
- sc_boolean declarationsIfaceIfA_israised_evB(const Declarations* handle)
- {
- return handle->ifaceIfA.evB_raised;
- }
- sc_boolean declarationsIfaceIfA_israised_evD(const Declarations* handle)
- {
- return handle->ifaceIfA.evD_raised;
- }
- sc_integer declarationsIfaceIfA_get_evD_value(const Declarations* handle)
- {
- return handle->ifaceIfA.evD_value;
- }
- sc_boolean declarationsIfaceIfA_israised_evF(const Declarations* handle)
- {
- return handle->ifaceIfA.evF_raised;
- }
- sc_string declarationsIfaceIfA_get_evF_value(const Declarations* handle)
- {
- return handle->ifaceIfA.evF_value;
- }
- sc_boolean declarationsIfaceIfA_get_varA(const Declarations* handle)
- {
- return handle->ifaceIfA.varA;
- }
- void declarationsIfaceIfA_set_varA(Declarations* handle, sc_boolean value)
- {
- handle->ifaceIfA.varA = value;
- }
- sc_integer declarationsIfaceIfA_get_varB(const Declarations* handle)
- {
- return handle->ifaceIfA.varB;
- }
- void declarationsIfaceIfA_set_varB(Declarations* handle, sc_integer value)
- {
- handle->ifaceIfA.varB = value;
- }
- sc_real declarationsIfaceIfA_get_varC(const Declarations* handle)
- {
- return handle->ifaceIfA.varC;
- }
- void declarationsIfaceIfA_set_varC(Declarations* handle, sc_real value)
- {
- handle->ifaceIfA.varC = value;
- }
- sc_string declarationsIfaceIfA_get_varD(const Declarations* handle)
- {
- return handle->ifaceIfA.varD;
- }
- void declarationsIfaceIfA_set_varD(Declarations* handle, sc_string value)
- {
- handle->ifaceIfA.varD = value;
- }
- sc_integer declarationsIfaceIfA_get_varE(const Declarations* handle)
- {
- return handle->ifaceIfA.varE;
- }
- void declarationsIfaceIfA_set_varE(Declarations* handle, sc_integer value)
- {
- handle->ifaceIfA.varE = value;
- }
- /* implementations of all internal functions */
- static sc_boolean declarations_check_main_region_A_tr0_tr0(const Declarations* handle)
- {
- return handle->internal.evInA_raised;
- }
- static sc_boolean declarations_check_main_region_A_tr1_tr1(const Declarations* handle)
- {
- return handle->internal.evInC_raised;
- }
- static sc_boolean declarations_check_main_region_B_tr0_tr0(const Declarations* handle)
- {
- return handle->internal.evInB_raised;
- }
- static sc_boolean declarations_check_main_region_B_tr1_tr1(const Declarations* handle)
- {
- return handle->internal.evInD_raised;
- }
- static sc_boolean declarations_check_main_region_B_tr2_tr2(const Declarations* handle)
- {
- return handle->internal.evInE_raised;
- }
- static sc_boolean declarations_check_main_region_B_tr3_tr3(const Declarations* handle)
- {
- return handle->internal.evInF_raised;
- }
- static void declarations_effect_main_region_A_tr0(Declarations* handle)
- {
- declarations_exseq_main_region_A(handle);
- declarations_enseq_main_region_B_default(handle);
- }
- static void declarations_effect_main_region_A_tr1(Declarations* handle)
- {
- declarations_exseq_main_region_A(handle);
- declarations_enseq_main_region_A_default(handle);
- }
- static void declarations_effect_main_region_B_tr0(Declarations* handle)
- {
- declarations_exseq_main_region_B(handle);
- declarations_enseq_main_region_A_default(handle);
- }
- static void declarations_effect_main_region_B_tr1(Declarations* handle)
- {
- declarations_exseq_main_region_B(handle);
- declarations_enseq_main_region_B_default(handle);
- }
- static void declarations_effect_main_region_B_tr2(Declarations* handle)
- {
- declarations_exseq_main_region_B(handle);
- declarations_enseq_main_region_B_default(handle);
- }
- static void declarations_effect_main_region_B_tr3(Declarations* handle)
- {
- declarations_exseq_main_region_B(handle);
- declarations_enseq_main_region_A_default(handle);
- }
- /* Entry action for state 'A'. */
- static void declarations_enact_main_region_A(Declarations* handle)
- {
- /* Entry action for state 'A'. */
- handle->internal.varInA = bool_false;
- handle->internal.varInB = 1;
- handle->internal.varInC = 1.1;
- handle->internal.varInD = "blub";
- handle->internal.varInE = 1;
- }
- /* 'default' enter sequence for state A */
- static void declarations_enseq_main_region_A_default(Declarations* handle)
- {
- /* 'default' enter sequence for state A */
- declarations_enact_main_region_A(handle);
- handle->stateConfVector[0] = Declarations_main_region_A;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for state B */
- static void declarations_enseq_main_region_B_default(Declarations* handle)
- {
- /* 'default' enter sequence for state B */
- handle->stateConfVector[0] = Declarations_main_region_B;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for region main region */
- static void declarations_enseq_main_region_default(Declarations* handle)
- {
- /* 'default' enter sequence for region main region */
- declarations_react_main_region__entry_Default(handle);
- }
- /* Default exit sequence for state A */
- static void declarations_exseq_main_region_A(Declarations* handle)
- {
- /* Default exit sequence for state A */
- handle->stateConfVector[0] = Declarations_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for state B */
- static void declarations_exseq_main_region_B(Declarations* handle)
- {
- /* Default exit sequence for state B */
- handle->stateConfVector[0] = Declarations_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for region main region */
- static void declarations_exseq_main_region(Declarations* handle)
- {
- /* Default exit sequence for region main region */
- /* Handle exit of all possible states (of Declarations.main_region) at position 0... */
- switch(handle->stateConfVector[ 0 ])
- {
- case Declarations_main_region_A :
- {
- declarations_exseq_main_region_A(handle);
- break;
- }
- case Declarations_main_region_B :
- {
- declarations_exseq_main_region_B(handle);
- break;
- }
- default: break;
- }
- }
- /* The reactions of state A. */
- static void declarations_react_main_region_A(Declarations* handle)
- {
- /* The reactions of state A. */
- if (declarations_check_main_region_A_tr0_tr0(handle) == bool_true)
- {
- declarations_effect_main_region_A_tr0(handle);
- } else
- {
- if (declarations_check_main_region_A_tr1_tr1(handle) == bool_true)
- {
- declarations_effect_main_region_A_tr1(handle);
- }
- }
- }
- /* The reactions of state B. */
- static void declarations_react_main_region_B(Declarations* handle)
- {
- /* The reactions of state B. */
- if (declarations_check_main_region_B_tr0_tr0(handle) == bool_true)
- {
- declarations_effect_main_region_B_tr0(handle);
- } else
- {
- if (declarations_check_main_region_B_tr1_tr1(handle) == bool_true)
- {
- declarations_effect_main_region_B_tr1(handle);
- } else
- {
- if (declarations_check_main_region_B_tr2_tr2(handle) == bool_true)
- {
- declarations_effect_main_region_B_tr2(handle);
- } else
- {
- if (declarations_check_main_region_B_tr3_tr3(handle) == bool_true)
- {
- declarations_effect_main_region_B_tr3(handle);
- }
- }
- }
- }
- }
- /* Default react sequence for initial entry */
- static void declarations_react_main_region__entry_Default(Declarations* handle)
- {
- /* Default react sequence for initial entry */
- declarations_enseq_main_region_A_default(handle);
- }
|