ConstOnlyInternalScope.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include "sc_types.h"
  4. #include "ConstOnlyInternalScope.h"
  5. /*! \file Implementation of the state machine 'ConstOnlyInternalScope'
  6. */
  7. /* prototypes of all internal functions */
  8. static sc_boolean constOnlyInternalScope_check_ConstOnlyInternalScope_main_region_A_tr0_tr0(const ConstOnlyInternalScope* handle);
  9. static sc_boolean constOnlyInternalScope_check_ConstOnlyInternalScope_main_region_A_tr1_tr1(const ConstOnlyInternalScope* handle);
  10. static void constOnlyInternalScope_effect_ConstOnlyInternalScope_main_region_A_tr0(ConstOnlyInternalScope* handle);
  11. static void constOnlyInternalScope_effect_ConstOnlyInternalScope_main_region_A_tr1(ConstOnlyInternalScope* handle);
  12. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_A_default(ConstOnlyInternalScope* handle);
  13. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_B_default(ConstOnlyInternalScope* handle);
  14. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_C_default(ConstOnlyInternalScope* handle);
  15. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_default(ConstOnlyInternalScope* handle);
  16. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_A(ConstOnlyInternalScope* handle);
  17. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_B(ConstOnlyInternalScope* handle);
  18. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_C(ConstOnlyInternalScope* handle);
  19. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region(ConstOnlyInternalScope* handle);
  20. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_A(ConstOnlyInternalScope* handle);
  21. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_B(ConstOnlyInternalScope* handle);
  22. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_C(ConstOnlyInternalScope* handle);
  23. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region__entry_Default(ConstOnlyInternalScope* handle);
  24. static void constOnlyInternalScope_clearInEvents(ConstOnlyInternalScope* handle);
  25. static void constOnlyInternalScope_clearOutEvents(ConstOnlyInternalScope* handle);
  26. const sc_integer CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPEINTERNAL_B = 1;
  27. const sc_integer CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPEINTERNAL_C = 2;
  28. void constOnlyInternalScope_init(ConstOnlyInternalScope* handle)
  29. {
  30. sc_integer i;
  31. for (i = 0; i < CONSTONLYINTERNALSCOPE_MAX_ORTHOGONAL_STATES; ++i)
  32. {
  33. handle->stateConfVector[i] = ConstOnlyInternalScope_last_state;
  34. }
  35. handle->stateConfVectorPosition = 0;
  36. constOnlyInternalScope_clearInEvents(handle);
  37. constOnlyInternalScope_clearOutEvents(handle);
  38. }
  39. void constOnlyInternalScope_enter(ConstOnlyInternalScope* handle)
  40. {
  41. /* Default enter sequence for statechart ConstOnlyInternalScope */
  42. constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_default(handle);
  43. }
  44. void constOnlyInternalScope_exit(ConstOnlyInternalScope* handle)
  45. {
  46. /* Default exit sequence for statechart ConstOnlyInternalScope */
  47. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region(handle);
  48. }
  49. sc_boolean constOnlyInternalScope_isActive(const ConstOnlyInternalScope* handle)
  50. {
  51. sc_boolean result;
  52. if (handle->stateConfVector[0] != ConstOnlyInternalScope_last_state)
  53. {
  54. result = bool_true;
  55. }
  56. else
  57. {
  58. result = bool_false;
  59. }
  60. return result;
  61. }
  62. /*
  63. * Always returns 'false' since this state machine can never become final.
  64. */
  65. sc_boolean constOnlyInternalScope_isFinal(const ConstOnlyInternalScope* handle)
  66. {
  67. return bool_false;
  68. }
  69. static void constOnlyInternalScope_clearInEvents(ConstOnlyInternalScope* handle)
  70. {
  71. handle->iface.e_raised = bool_false;
  72. }
  73. static void constOnlyInternalScope_clearOutEvents(ConstOnlyInternalScope* handle)
  74. {
  75. }
  76. void constOnlyInternalScope_runCycle(ConstOnlyInternalScope* handle)
  77. {
  78. constOnlyInternalScope_clearOutEvents(handle);
  79. for (handle->stateConfVectorPosition = 0;
  80. handle->stateConfVectorPosition < CONSTONLYINTERNALSCOPE_MAX_ORTHOGONAL_STATES;
  81. handle->stateConfVectorPosition++)
  82. {
  83. switch (handle->stateConfVector[handle->stateConfVectorPosition])
  84. {
  85. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A :
  86. {
  87. constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_A(handle);
  88. break;
  89. }
  90. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B :
  91. {
  92. constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_B(handle);
  93. break;
  94. }
  95. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C :
  96. {
  97. constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_C(handle);
  98. break;
  99. }
  100. default:
  101. break;
  102. }
  103. }
  104. constOnlyInternalScope_clearInEvents(handle);
  105. }
  106. sc_boolean constOnlyInternalScope_isStateActive(const ConstOnlyInternalScope* handle, ConstOnlyInternalScopeStates state)
  107. {
  108. sc_boolean result = bool_false;
  109. switch (state)
  110. {
  111. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A :
  112. result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A
  113. );
  114. break;
  115. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B :
  116. result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B
  117. );
  118. break;
  119. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C :
  120. result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C
  121. );
  122. break;
  123. default:
  124. result = bool_false;
  125. break;
  126. }
  127. return result;
  128. }
  129. void constOnlyInternalScopeIface_raise_e(ConstOnlyInternalScope* handle, sc_integer value)
  130. {
  131. handle->iface.e_value = value;
  132. handle->iface.e_raised = bool_true;
  133. }
  134. /* implementations of all internal functions */
  135. static sc_boolean constOnlyInternalScope_check_ConstOnlyInternalScope_main_region_A_tr0_tr0(const ConstOnlyInternalScope* handle)
  136. {
  137. return ((handle->iface.e_raised) && (handle->iface.e_value == CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPEINTERNAL_B)) ? bool_true : bool_false;
  138. }
  139. static sc_boolean constOnlyInternalScope_check_ConstOnlyInternalScope_main_region_A_tr1_tr1(const ConstOnlyInternalScope* handle)
  140. {
  141. return ((handle->iface.e_raised) && (handle->iface.e_value == CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPEINTERNAL_C)) ? bool_true : bool_false;
  142. }
  143. static void constOnlyInternalScope_effect_ConstOnlyInternalScope_main_region_A_tr0(ConstOnlyInternalScope* handle)
  144. {
  145. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_A(handle);
  146. constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_B_default(handle);
  147. }
  148. static void constOnlyInternalScope_effect_ConstOnlyInternalScope_main_region_A_tr1(ConstOnlyInternalScope* handle)
  149. {
  150. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_A(handle);
  151. constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_C_default(handle);
  152. }
  153. /* 'default' enter sequence for state A */
  154. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_A_default(ConstOnlyInternalScope* handle)
  155. {
  156. /* 'default' enter sequence for state A */
  157. handle->stateConfVector[0] = ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A;
  158. handle->stateConfVectorPosition = 0;
  159. }
  160. /* 'default' enter sequence for state B */
  161. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_B_default(ConstOnlyInternalScope* handle)
  162. {
  163. /* 'default' enter sequence for state B */
  164. handle->stateConfVector[0] = ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B;
  165. handle->stateConfVectorPosition = 0;
  166. }
  167. /* 'default' enter sequence for state C */
  168. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_C_default(ConstOnlyInternalScope* handle)
  169. {
  170. /* 'default' enter sequence for state C */
  171. handle->stateConfVector[0] = ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C;
  172. handle->stateConfVectorPosition = 0;
  173. }
  174. /* 'default' enter sequence for region main region */
  175. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_default(ConstOnlyInternalScope* handle)
  176. {
  177. /* 'default' enter sequence for region main region */
  178. constOnlyInternalScope_react_ConstOnlyInternalScope_main_region__entry_Default(handle);
  179. }
  180. /* Default exit sequence for state A */
  181. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_A(ConstOnlyInternalScope* handle)
  182. {
  183. /* Default exit sequence for state A */
  184. handle->stateConfVector[0] = ConstOnlyInternalScope_last_state;
  185. handle->stateConfVectorPosition = 0;
  186. }
  187. /* Default exit sequence for state B */
  188. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_B(ConstOnlyInternalScope* handle)
  189. {
  190. /* Default exit sequence for state B */
  191. handle->stateConfVector[0] = ConstOnlyInternalScope_last_state;
  192. handle->stateConfVectorPosition = 0;
  193. }
  194. /* Default exit sequence for state C */
  195. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_C(ConstOnlyInternalScope* handle)
  196. {
  197. /* Default exit sequence for state C */
  198. handle->stateConfVector[0] = ConstOnlyInternalScope_last_state;
  199. handle->stateConfVectorPosition = 0;
  200. }
  201. /* Default exit sequence for region main region */
  202. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region(ConstOnlyInternalScope* handle)
  203. {
  204. /* Default exit sequence for region main region */
  205. /* Handle exit of all possible states (of declarations.ConstOnlyInternalScope.main_region) at position 0... */
  206. switch(handle->stateConfVector[ 0 ])
  207. {
  208. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A :
  209. {
  210. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_A(handle);
  211. break;
  212. }
  213. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B :
  214. {
  215. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_B(handle);
  216. break;
  217. }
  218. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C :
  219. {
  220. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_C(handle);
  221. break;
  222. }
  223. default: break;
  224. }
  225. }
  226. /* The reactions of state A. */
  227. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_A(ConstOnlyInternalScope* handle)
  228. {
  229. /* The reactions of state A. */
  230. if (constOnlyInternalScope_check_ConstOnlyInternalScope_main_region_A_tr0_tr0(handle) == bool_true)
  231. {
  232. constOnlyInternalScope_effect_ConstOnlyInternalScope_main_region_A_tr0(handle);
  233. } else
  234. {
  235. if (constOnlyInternalScope_check_ConstOnlyInternalScope_main_region_A_tr1_tr1(handle) == bool_true)
  236. {
  237. constOnlyInternalScope_effect_ConstOnlyInternalScope_main_region_A_tr1(handle);
  238. }
  239. }
  240. }
  241. /* The reactions of state B. */
  242. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_B(ConstOnlyInternalScope* handle)
  243. {
  244. /* The reactions of state B. */
  245. }
  246. /* The reactions of state C. */
  247. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_C(ConstOnlyInternalScope* handle)
  248. {
  249. /* The reactions of state C. */
  250. }
  251. /* Default react sequence for initial entry */
  252. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region__entry_Default(ConstOnlyInternalScope* handle)
  253. {
  254. /* Default react sequence for initial entry */
  255. constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_A_default(handle);
  256. }