ConstOnlyInternalScope.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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 = bool_false;
  52. int i;
  53. for(i = 0; i < CONSTONLYINTERNALSCOPE_MAX_ORTHOGONAL_STATES; i++)
  54. {
  55. result = result || handle->stateConfVector[i] != ConstOnlyInternalScope_last_state;
  56. }
  57. return result;
  58. }
  59. /*
  60. * Always returns 'false' since this state machine can never become final.
  61. */
  62. sc_boolean constOnlyInternalScope_isFinal(const ConstOnlyInternalScope* handle)
  63. {
  64. return bool_false;
  65. }
  66. static void constOnlyInternalScope_clearInEvents(ConstOnlyInternalScope* handle)
  67. {
  68. handle->iface.e_raised = bool_false;
  69. }
  70. static void constOnlyInternalScope_clearOutEvents(ConstOnlyInternalScope* handle)
  71. {
  72. }
  73. void constOnlyInternalScope_runCycle(ConstOnlyInternalScope* handle)
  74. {
  75. constOnlyInternalScope_clearOutEvents(handle);
  76. for (handle->stateConfVectorPosition = 0;
  77. handle->stateConfVectorPosition < CONSTONLYINTERNALSCOPE_MAX_ORTHOGONAL_STATES;
  78. handle->stateConfVectorPosition++)
  79. {
  80. switch (handle->stateConfVector[handle->stateConfVectorPosition])
  81. {
  82. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A :
  83. {
  84. constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_A(handle);
  85. break;
  86. }
  87. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B :
  88. {
  89. constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_B(handle);
  90. break;
  91. }
  92. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C :
  93. {
  94. constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_C(handle);
  95. break;
  96. }
  97. default:
  98. break;
  99. }
  100. }
  101. constOnlyInternalScope_clearInEvents(handle);
  102. }
  103. sc_boolean constOnlyInternalScope_isStateActive(const ConstOnlyInternalScope* handle, ConstOnlyInternalScopeStates state)
  104. {
  105. sc_boolean result = bool_false;
  106. switch (state)
  107. {
  108. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A :
  109. result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPE_MAIN_REGION_A] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A
  110. );
  111. break;
  112. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B :
  113. result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPE_MAIN_REGION_B] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B
  114. );
  115. break;
  116. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C :
  117. result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPE_MAIN_REGION_C] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C
  118. );
  119. break;
  120. default:
  121. result = bool_false;
  122. break;
  123. }
  124. return result;
  125. }
  126. void constOnlyInternalScopeIface_raise_e(ConstOnlyInternalScope* handle, sc_integer value)
  127. {
  128. handle->iface.e_value = value;
  129. handle->iface.e_raised = bool_true;
  130. }
  131. /* implementations of all internal functions */
  132. static sc_boolean constOnlyInternalScope_check_ConstOnlyInternalScope_main_region_A_tr0_tr0(const ConstOnlyInternalScope* handle)
  133. {
  134. return ((handle->iface.e_raised) && (handle->iface.e_value == CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPEINTERNAL_B)) ? bool_true : bool_false;
  135. }
  136. static sc_boolean constOnlyInternalScope_check_ConstOnlyInternalScope_main_region_A_tr1_tr1(const ConstOnlyInternalScope* handle)
  137. {
  138. return ((handle->iface.e_raised) && (handle->iface.e_value == CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPEINTERNAL_C)) ? bool_true : bool_false;
  139. }
  140. static void constOnlyInternalScope_effect_ConstOnlyInternalScope_main_region_A_tr0(ConstOnlyInternalScope* handle)
  141. {
  142. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_A(handle);
  143. constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_B_default(handle);
  144. }
  145. static void constOnlyInternalScope_effect_ConstOnlyInternalScope_main_region_A_tr1(ConstOnlyInternalScope* handle)
  146. {
  147. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_A(handle);
  148. constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_C_default(handle);
  149. }
  150. /* 'default' enter sequence for state A */
  151. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_A_default(ConstOnlyInternalScope* handle)
  152. {
  153. /* 'default' enter sequence for state A */
  154. handle->stateConfVector[0] = ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A;
  155. handle->stateConfVectorPosition = 0;
  156. }
  157. /* 'default' enter sequence for state B */
  158. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_B_default(ConstOnlyInternalScope* handle)
  159. {
  160. /* 'default' enter sequence for state B */
  161. handle->stateConfVector[0] = ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B;
  162. handle->stateConfVectorPosition = 0;
  163. }
  164. /* 'default' enter sequence for state C */
  165. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_C_default(ConstOnlyInternalScope* handle)
  166. {
  167. /* 'default' enter sequence for state C */
  168. handle->stateConfVector[0] = ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C;
  169. handle->stateConfVectorPosition = 0;
  170. }
  171. /* 'default' enter sequence for region main region */
  172. static void constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_default(ConstOnlyInternalScope* handle)
  173. {
  174. /* 'default' enter sequence for region main region */
  175. constOnlyInternalScope_react_ConstOnlyInternalScope_main_region__entry_Default(handle);
  176. }
  177. /* Default exit sequence for state A */
  178. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_A(ConstOnlyInternalScope* handle)
  179. {
  180. /* Default exit sequence for state A */
  181. handle->stateConfVector[0] = ConstOnlyInternalScope_last_state;
  182. handle->stateConfVectorPosition = 0;
  183. }
  184. /* Default exit sequence for state B */
  185. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_B(ConstOnlyInternalScope* handle)
  186. {
  187. /* Default exit sequence for state B */
  188. handle->stateConfVector[0] = ConstOnlyInternalScope_last_state;
  189. handle->stateConfVectorPosition = 0;
  190. }
  191. /* Default exit sequence for state C */
  192. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_C(ConstOnlyInternalScope* handle)
  193. {
  194. /* Default exit sequence for state C */
  195. handle->stateConfVector[0] = ConstOnlyInternalScope_last_state;
  196. handle->stateConfVectorPosition = 0;
  197. }
  198. /* Default exit sequence for region main region */
  199. static void constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region(ConstOnlyInternalScope* handle)
  200. {
  201. /* Default exit sequence for region main region */
  202. /* Handle exit of all possible states (of declarations.ConstOnlyInternalScope.main_region) at position 0... */
  203. switch(handle->stateConfVector[ 0 ])
  204. {
  205. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A :
  206. {
  207. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_A(handle);
  208. break;
  209. }
  210. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B :
  211. {
  212. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_B(handle);
  213. break;
  214. }
  215. case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C :
  216. {
  217. constOnlyInternalScope_exseq_ConstOnlyInternalScope_main_region_C(handle);
  218. break;
  219. }
  220. default: break;
  221. }
  222. }
  223. /* The reactions of state A. */
  224. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_A(ConstOnlyInternalScope* handle)
  225. {
  226. /* The reactions of state A. */
  227. if (constOnlyInternalScope_check_ConstOnlyInternalScope_main_region_A_tr0_tr0(handle) == bool_true)
  228. {
  229. constOnlyInternalScope_effect_ConstOnlyInternalScope_main_region_A_tr0(handle);
  230. } else
  231. {
  232. if (constOnlyInternalScope_check_ConstOnlyInternalScope_main_region_A_tr1_tr1(handle) == bool_true)
  233. {
  234. constOnlyInternalScope_effect_ConstOnlyInternalScope_main_region_A_tr1(handle);
  235. }
  236. }
  237. }
  238. /* The reactions of state B. */
  239. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_B(ConstOnlyInternalScope* handle)
  240. {
  241. /* The reactions of state B. */
  242. }
  243. /* The reactions of state C. */
  244. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region_C(ConstOnlyInternalScope* handle)
  245. {
  246. /* The reactions of state C. */
  247. }
  248. /* Default react sequence for initial entry */
  249. static void constOnlyInternalScope_react_ConstOnlyInternalScope_main_region__entry_Default(ConstOnlyInternalScope* handle)
  250. {
  251. /* Default react sequence for initial entry */
  252. constOnlyInternalScope_enseq_ConstOnlyInternalScope_main_region_A_default(handle);
  253. }