ConstOnlyDefaultScope.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include "sc_types.h"
  4. #include "ConstOnlyDefaultScope.h"
  5. /*! \file Implementation of the state machine 'ConstOnlyDefaultScope'
  6. */
  7. /* prototypes of all internal functions */
  8. static sc_boolean constOnlyDefaultScope_check_ConstOnlyDefaultScope_main_region_A_tr0_tr0(const ConstOnlyDefaultScope* handle);
  9. static sc_boolean constOnlyDefaultScope_check_ConstOnlyDefaultScope_main_region_A_tr1_tr1(const ConstOnlyDefaultScope* handle);
  10. static void constOnlyDefaultScope_effect_ConstOnlyDefaultScope_main_region_A_tr0(ConstOnlyDefaultScope* handle);
  11. static void constOnlyDefaultScope_effect_ConstOnlyDefaultScope_main_region_A_tr1(ConstOnlyDefaultScope* handle);
  12. static void constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_A_default(ConstOnlyDefaultScope* handle);
  13. static void constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_B_default(ConstOnlyDefaultScope* handle);
  14. static void constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_C_default(ConstOnlyDefaultScope* handle);
  15. static void constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_default(ConstOnlyDefaultScope* handle);
  16. static void constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_A(ConstOnlyDefaultScope* handle);
  17. static void constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_B(ConstOnlyDefaultScope* handle);
  18. static void constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_C(ConstOnlyDefaultScope* handle);
  19. static void constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region(ConstOnlyDefaultScope* handle);
  20. static void constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region_A(ConstOnlyDefaultScope* handle);
  21. static void constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region_B(ConstOnlyDefaultScope* handle);
  22. static void constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region_C(ConstOnlyDefaultScope* handle);
  23. static void constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region__entry_Default(ConstOnlyDefaultScope* handle);
  24. static void constOnlyDefaultScope_clearInEvents(ConstOnlyDefaultScope* handle);
  25. static void constOnlyDefaultScope_clearOutEvents(ConstOnlyDefaultScope* handle);
  26. const sc_integer CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPEIFACE_B = 1;
  27. const sc_integer CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPEIFACE_C = 2;
  28. void constOnlyDefaultScope_init(ConstOnlyDefaultScope* handle)
  29. {
  30. sc_integer i;
  31. for (i = 0; i < CONSTONLYDEFAULTSCOPE_MAX_ORTHOGONAL_STATES; ++i)
  32. {
  33. handle->stateConfVector[i] = ConstOnlyDefaultScope_last_state;
  34. }
  35. handle->stateConfVectorPosition = 0;
  36. constOnlyDefaultScope_clearInEvents(handle);
  37. constOnlyDefaultScope_clearOutEvents(handle);
  38. }
  39. void constOnlyDefaultScope_enter(ConstOnlyDefaultScope* handle)
  40. {
  41. /* Default enter sequence for statechart ConstOnlyDefaultScope */
  42. constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_default(handle);
  43. }
  44. void constOnlyDefaultScope_exit(ConstOnlyDefaultScope* handle)
  45. {
  46. /* Default exit sequence for statechart ConstOnlyDefaultScope */
  47. constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region(handle);
  48. }
  49. sc_boolean constOnlyDefaultScope_isActive(const ConstOnlyDefaultScope* handle)
  50. {
  51. sc_boolean result;
  52. if (handle->stateConfVector[0] != ConstOnlyDefaultScope_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 constOnlyDefaultScope_isFinal(const ConstOnlyDefaultScope* handle)
  66. {
  67. return bool_false;
  68. }
  69. static void constOnlyDefaultScope_clearInEvents(ConstOnlyDefaultScope* handle)
  70. {
  71. handle->ifaceA.e_raised = bool_false;
  72. }
  73. static void constOnlyDefaultScope_clearOutEvents(ConstOnlyDefaultScope* handle)
  74. {
  75. }
  76. void constOnlyDefaultScope_runCycle(ConstOnlyDefaultScope* handle)
  77. {
  78. constOnlyDefaultScope_clearOutEvents(handle);
  79. for (handle->stateConfVectorPosition = 0;
  80. handle->stateConfVectorPosition < CONSTONLYDEFAULTSCOPE_MAX_ORTHOGONAL_STATES;
  81. handle->stateConfVectorPosition++)
  82. {
  83. switch (handle->stateConfVector[handle->stateConfVectorPosition])
  84. {
  85. case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A :
  86. {
  87. constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region_A(handle);
  88. break;
  89. }
  90. case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B :
  91. {
  92. constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region_B(handle);
  93. break;
  94. }
  95. case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_C :
  96. {
  97. constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region_C(handle);
  98. break;
  99. }
  100. default:
  101. break;
  102. }
  103. }
  104. constOnlyDefaultScope_clearInEvents(handle);
  105. }
  106. sc_boolean constOnlyDefaultScope_isStateActive(const ConstOnlyDefaultScope* handle, ConstOnlyDefaultScopeStates state)
  107. {
  108. sc_boolean result = bool_false;
  109. switch (state)
  110. {
  111. case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A :
  112. result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A
  113. );
  114. break;
  115. case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B :
  116. result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B
  117. );
  118. break;
  119. case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_C :
  120. result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_C
  121. );
  122. break;
  123. default:
  124. result = bool_false;
  125. break;
  126. }
  127. return result;
  128. }
  129. const sc_integer constOnlyDefaultScopeIface_get_b(const ConstOnlyDefaultScope* handle)
  130. {
  131. return CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPEIFACE_B;
  132. }
  133. const sc_integer constOnlyDefaultScopeIface_get_c(const ConstOnlyDefaultScope* handle)
  134. {
  135. return CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPEIFACE_C;
  136. }
  137. void constOnlyDefaultScopeIfaceA_raise_e(ConstOnlyDefaultScope* handle, sc_integer value)
  138. {
  139. handle->ifaceA.e_value = value;
  140. handle->ifaceA.e_raised = bool_true;
  141. }
  142. /* implementations of all internal functions */
  143. static sc_boolean constOnlyDefaultScope_check_ConstOnlyDefaultScope_main_region_A_tr0_tr0(const ConstOnlyDefaultScope* handle)
  144. {
  145. return ((handle->ifaceA.e_raised) && (handle->ifaceA.e_value == CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPEIFACE_B)) ? bool_true : bool_false;
  146. }
  147. static sc_boolean constOnlyDefaultScope_check_ConstOnlyDefaultScope_main_region_A_tr1_tr1(const ConstOnlyDefaultScope* handle)
  148. {
  149. return ((handle->ifaceA.e_raised) && (handle->ifaceA.e_value == CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPEIFACE_C)) ? bool_true : bool_false;
  150. }
  151. static void constOnlyDefaultScope_effect_ConstOnlyDefaultScope_main_region_A_tr0(ConstOnlyDefaultScope* handle)
  152. {
  153. constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_A(handle);
  154. constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_B_default(handle);
  155. }
  156. static void constOnlyDefaultScope_effect_ConstOnlyDefaultScope_main_region_A_tr1(ConstOnlyDefaultScope* handle)
  157. {
  158. constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_A(handle);
  159. constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_C_default(handle);
  160. }
  161. /* 'default' enter sequence for state A */
  162. static void constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_A_default(ConstOnlyDefaultScope* handle)
  163. {
  164. /* 'default' enter sequence for state A */
  165. handle->stateConfVector[0] = ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A;
  166. handle->stateConfVectorPosition = 0;
  167. }
  168. /* 'default' enter sequence for state B */
  169. static void constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_B_default(ConstOnlyDefaultScope* handle)
  170. {
  171. /* 'default' enter sequence for state B */
  172. handle->stateConfVector[0] = ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B;
  173. handle->stateConfVectorPosition = 0;
  174. }
  175. /* 'default' enter sequence for state C */
  176. static void constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_C_default(ConstOnlyDefaultScope* handle)
  177. {
  178. /* 'default' enter sequence for state C */
  179. handle->stateConfVector[0] = ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_C;
  180. handle->stateConfVectorPosition = 0;
  181. }
  182. /* 'default' enter sequence for region main region */
  183. static void constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_default(ConstOnlyDefaultScope* handle)
  184. {
  185. /* 'default' enter sequence for region main region */
  186. constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region__entry_Default(handle);
  187. }
  188. /* Default exit sequence for state A */
  189. static void constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_A(ConstOnlyDefaultScope* handle)
  190. {
  191. /* Default exit sequence for state A */
  192. handle->stateConfVector[0] = ConstOnlyDefaultScope_last_state;
  193. handle->stateConfVectorPosition = 0;
  194. }
  195. /* Default exit sequence for state B */
  196. static void constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_B(ConstOnlyDefaultScope* handle)
  197. {
  198. /* Default exit sequence for state B */
  199. handle->stateConfVector[0] = ConstOnlyDefaultScope_last_state;
  200. handle->stateConfVectorPosition = 0;
  201. }
  202. /* Default exit sequence for state C */
  203. static void constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_C(ConstOnlyDefaultScope* handle)
  204. {
  205. /* Default exit sequence for state C */
  206. handle->stateConfVector[0] = ConstOnlyDefaultScope_last_state;
  207. handle->stateConfVectorPosition = 0;
  208. }
  209. /* Default exit sequence for region main region */
  210. static void constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region(ConstOnlyDefaultScope* handle)
  211. {
  212. /* Default exit sequence for region main region */
  213. /* Handle exit of all possible states (of declarations.ConstOnlyDefaultScope.main_region) at position 0... */
  214. switch(handle->stateConfVector[ 0 ])
  215. {
  216. case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A :
  217. {
  218. constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_A(handle);
  219. break;
  220. }
  221. case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B :
  222. {
  223. constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_B(handle);
  224. break;
  225. }
  226. case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_C :
  227. {
  228. constOnlyDefaultScope_exseq_ConstOnlyDefaultScope_main_region_C(handle);
  229. break;
  230. }
  231. default: break;
  232. }
  233. }
  234. /* The reactions of state A. */
  235. static void constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region_A(ConstOnlyDefaultScope* handle)
  236. {
  237. /* The reactions of state A. */
  238. if (constOnlyDefaultScope_check_ConstOnlyDefaultScope_main_region_A_tr0_tr0(handle) == bool_true)
  239. {
  240. constOnlyDefaultScope_effect_ConstOnlyDefaultScope_main_region_A_tr0(handle);
  241. } else
  242. {
  243. if (constOnlyDefaultScope_check_ConstOnlyDefaultScope_main_region_A_tr1_tr1(handle) == bool_true)
  244. {
  245. constOnlyDefaultScope_effect_ConstOnlyDefaultScope_main_region_A_tr1(handle);
  246. }
  247. }
  248. }
  249. /* The reactions of state B. */
  250. static void constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region_B(ConstOnlyDefaultScope* handle)
  251. {
  252. /* The reactions of state B. */
  253. }
  254. /* The reactions of state C. */
  255. static void constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region_C(ConstOnlyDefaultScope* handle)
  256. {
  257. /* The reactions of state C. */
  258. }
  259. /* Default react sequence for initial entry */
  260. static void constOnlyDefaultScope_react_ConstOnlyDefaultScope_main_region__entry_Default(ConstOnlyDefaultScope* handle)
  261. {
  262. /* Default react sequence for initial entry */
  263. constOnlyDefaultScope_enseq_ConstOnlyDefaultScope_main_region_A_default(handle);
  264. }