ConstOnlyNamedScope.c 11 KB

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