123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- #include <stdlib.h>
- #include <string.h>
- #include "sc_types.h"
- #include "LocalReactions.h"
- /*! \file Implementation of the state machine 'LocalReactions'
- */
- /* prototypes of all internal functions */
- static sc_boolean localReactions_check_main_region_A_lr0_lr0(const LocalReactions* handle);
- static void localReactions_effect_main_region_A_lr0_lr0(LocalReactions* handle);
- static void localReactions_enseq_main_region_A_default(LocalReactions* handle);
- static void localReactions_enseq_main_region_default(LocalReactions* handle);
- static void localReactions_exseq_main_region_A(LocalReactions* handle);
- static void localReactions_exseq_main_region(LocalReactions* handle);
- static void localReactions_react_main_region_A(LocalReactions* handle);
- static void localReactions_react_main_region__entry_Default(LocalReactions* handle);
- static void localReactions_clearInEvents(LocalReactions* handle);
- static void localReactions_clearOutEvents(LocalReactions* handle);
- void localReactions_init(LocalReactions* handle)
- {
- sc_integer i;
- for (i = 0; i < LOCALREACTIONS_MAX_ORTHOGONAL_STATES; ++i)
- {
- handle->stateConfVector[i] = LocalReactions_last_state;
- }
-
-
- handle->stateConfVectorPosition = 0;
- localReactions_clearInEvents(handle);
- localReactions_clearOutEvents(handle);
- /* Default init sequence for statechart LocalReactions */
- handle->iface.x = 0;
- }
- void localReactions_enter(LocalReactions* handle)
- {
- /* Default enter sequence for statechart LocalReactions */
- localReactions_enseq_main_region_default(handle);
- }
- void localReactions_exit(LocalReactions* handle)
- {
- /* Default exit sequence for statechart LocalReactions */
- localReactions_exseq_main_region(handle);
- }
- sc_boolean localReactions_isActive(const LocalReactions* handle)
- {
- sc_boolean result = bool_false;
- int i;
-
- for(i = 0; i < LOCALREACTIONS_MAX_ORTHOGONAL_STATES; i++)
- {
- result = result || handle->stateConfVector[i] != LocalReactions_last_state;
- }
-
- return result;
- }
- /*
- * Always returns 'false' since this state machine can never become final.
- */
- sc_boolean localReactions_isFinal(const LocalReactions* handle)
- {
- return bool_false;
- }
- static void localReactions_clearInEvents(LocalReactions* handle)
- {
- }
- static void localReactions_clearOutEvents(LocalReactions* handle)
- {
- }
- void localReactions_runCycle(LocalReactions* handle)
- {
-
- localReactions_clearOutEvents(handle);
-
- for (handle->stateConfVectorPosition = 0;
- handle->stateConfVectorPosition < LOCALREACTIONS_MAX_ORTHOGONAL_STATES;
- handle->stateConfVectorPosition++)
- {
-
- switch (handle->stateConfVector[handle->stateConfVectorPosition])
- {
- case LocalReactions_main_region_A :
- {
- localReactions_react_main_region_A(handle);
- break;
- }
- default:
- break;
- }
- }
-
- localReactions_clearInEvents(handle);
- }
- sc_boolean localReactions_isStateActive(const LocalReactions* handle, LocalReactionsStates state)
- {
- sc_boolean result = bool_false;
- switch (state)
- {
- case LocalReactions_main_region_A :
- result = (sc_boolean) (handle->stateConfVector[SCVI_LOCALREACTIONS_MAIN_REGION_A] == LocalReactions_main_region_A
- );
- break;
- default:
- result = bool_false;
- break;
- }
- return result;
- }
- sc_integer localReactionsIface_get_x(const LocalReactions* handle)
- {
- return handle->iface.x;
- }
- void localReactionsIface_set_x(LocalReactions* handle, sc_integer value)
- {
- handle->iface.x = value;
- }
- /* implementations of all internal functions */
- static sc_boolean localReactions_check_main_region_A_lr0_lr0(const LocalReactions* handle)
- {
- return (handle->iface.x == 0) ? bool_true : bool_false;
- }
- static void localReactions_effect_main_region_A_lr0_lr0(LocalReactions* handle)
- {
- handle->iface.x += 1;
- }
- /* 'default' enter sequence for state A */
- static void localReactions_enseq_main_region_A_default(LocalReactions* handle)
- {
- /* 'default' enter sequence for state A */
- handle->stateConfVector[0] = LocalReactions_main_region_A;
- handle->stateConfVectorPosition = 0;
- }
- /* 'default' enter sequence for region main region */
- static void localReactions_enseq_main_region_default(LocalReactions* handle)
- {
- /* 'default' enter sequence for region main region */
- localReactions_react_main_region__entry_Default(handle);
- }
- /* Default exit sequence for state A */
- static void localReactions_exseq_main_region_A(LocalReactions* handle)
- {
- /* Default exit sequence for state A */
- handle->stateConfVector[0] = LocalReactions_last_state;
- handle->stateConfVectorPosition = 0;
- }
- /* Default exit sequence for region main region */
- static void localReactions_exseq_main_region(LocalReactions* handle)
- {
- /* Default exit sequence for region main region */
- /* Handle exit of all possible states (of LocalReactions.main_region) at position 0... */
- switch(handle->stateConfVector[ 0 ])
- {
- case LocalReactions_main_region_A :
- {
- localReactions_exseq_main_region_A(handle);
- break;
- }
- default: break;
- }
- }
- /* The reactions of state A. */
- static void localReactions_react_main_region_A(LocalReactions* handle)
- {
- /* The reactions of state A. */
- if (localReactions_check_main_region_A_lr0_lr0(handle) == bool_true)
- {
- localReactions_effect_main_region_A_lr0_lr0(handle);
- }
- }
- /* Default react sequence for initial entry */
- static void localReactions_react_main_region__entry_Default(LocalReactions* handle)
- {
- /* Default react sequence for initial entry */
- localReactions_enseq_main_region_A_default(handle);
- }
|