CKeywords.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. #ifndef CKEYWORDS_H_
  2. #define CKEYWORDS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'CKeywords'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. CKeywords_auto_char,
  13. CKeywords_auto_loop,
  14. CKeywords_auto_loop_switch_case,
  15. CKeywords_auto_loop_switch_case_enum_asm,
  16. CKeywords_last_state
  17. } CKeywordsStates;
  18. /*! Type definition of the data structure for the CKeywordsIface interface scope. */
  19. typedef struct
  20. {
  21. sc_boolean auto_raised;
  22. sc_boolean break_raised;
  23. sc_boolean case_ID;
  24. sc_integer do_ID;
  25. sc_boolean continue_ID;
  26. sc_boolean double_ID;
  27. sc_boolean enum_ID;
  28. sc_boolean extern_ID;
  29. sc_boolean float_ID;
  30. sc_boolean for_ID;
  31. sc_boolean goto_ID;
  32. sc_boolean if_ID;
  33. sc_boolean int_ID;
  34. sc_boolean long_ID;
  35. sc_boolean register_ID;
  36. sc_boolean return_ID;
  37. sc_boolean short_ID;
  38. sc_boolean signed_ID;
  39. sc_boolean sizeof_ID;
  40. sc_boolean static_ID;
  41. sc_boolean struct_ID;
  42. sc_boolean switch_ID;
  43. sc_boolean typedef_ID;
  44. sc_boolean union_ID;
  45. sc_boolean unsigned_ID;
  46. sc_boolean void_ID;
  47. sc_boolean volatile_ID;
  48. sc_boolean while_ID;
  49. } CKeywordsIface;
  50. /*! Define dimension of the state configuration vector for orthogonal states. */
  51. #define CKEYWORDS_MAX_ORTHOGONAL_STATES 1
  52. /*! Define dimension of the state configuration vector for history states. */
  53. #define CKEYWORDS_MAX_HISTORY_STATES 2
  54. /*!
  55. * Type definition of the data structure for the CKeywords state machine.
  56. * This data structure has to be allocated by the client code.
  57. */
  58. typedef struct
  59. {
  60. CKeywordsStates stateConfVector[CKEYWORDS_MAX_ORTHOGONAL_STATES];
  61. CKeywordsStates historyVector[CKEYWORDS_MAX_HISTORY_STATES];
  62. sc_ushort stateConfVectorPosition;
  63. CKeywordsIface iface;
  64. } CKeywords;
  65. /*! Initializes the CKeywords state machine data structures. Must be called before first usage.*/
  66. extern void cKeywords_init(CKeywords* handle);
  67. /*! Activates the state machine */
  68. extern void cKeywords_enter(CKeywords* handle);
  69. /*! Deactivates the state machine */
  70. extern void cKeywords_exit(CKeywords* handle);
  71. /*! Performs a 'run to completion' step. */
  72. extern void cKeywords_runCycle(CKeywords* handle);
  73. /*! Raises the in event 'auto' that is defined in the default interface scope. */
  74. extern void cKeywordsIface_raise_auto(CKeywords* handle);
  75. /*! Raises the in event 'break' that is defined in the default interface scope. */
  76. extern void cKeywordsIface_raise_break(CKeywords* handle);
  77. /*! Gets the value of the variable 'case' that is defined in the default interface scope. */
  78. extern sc_boolean cKeywordsIface_get_case(const CKeywords* handle);
  79. /*! Sets the value of the variable 'case' that is defined in the default interface scope. */
  80. extern void cKeywordsIface_set_case(CKeywords* handle, sc_boolean value);
  81. /*! Gets the value of the variable 'do' that is defined in the default interface scope. */
  82. extern sc_integer cKeywordsIface_get_do(const CKeywords* handle);
  83. /*! Sets the value of the variable 'do' that is defined in the default interface scope. */
  84. extern void cKeywordsIface_set_do(CKeywords* handle, sc_integer value);
  85. /*! Gets the value of the variable 'continue' that is defined in the default interface scope. */
  86. extern sc_boolean cKeywordsIface_get_continue(const CKeywords* handle);
  87. /*! Sets the value of the variable 'continue' that is defined in the default interface scope. */
  88. extern void cKeywordsIface_set_continue(CKeywords* handle, sc_boolean value);
  89. /*! Gets the value of the variable 'double' that is defined in the default interface scope. */
  90. extern sc_boolean cKeywordsIface_get_double(const CKeywords* handle);
  91. /*! Sets the value of the variable 'double' that is defined in the default interface scope. */
  92. extern void cKeywordsIface_set_double(CKeywords* handle, sc_boolean value);
  93. /*! Gets the value of the variable 'enum' that is defined in the default interface scope. */
  94. extern sc_boolean cKeywordsIface_get_enum(const CKeywords* handle);
  95. /*! Sets the value of the variable 'enum' that is defined in the default interface scope. */
  96. extern void cKeywordsIface_set_enum(CKeywords* handle, sc_boolean value);
  97. /*! Gets the value of the variable 'extern' that is defined in the default interface scope. */
  98. extern sc_boolean cKeywordsIface_get_extern(const CKeywords* handle);
  99. /*! Sets the value of the variable 'extern' that is defined in the default interface scope. */
  100. extern void cKeywordsIface_set_extern(CKeywords* handle, sc_boolean value);
  101. /*! Gets the value of the variable 'float' that is defined in the default interface scope. */
  102. extern sc_boolean cKeywordsIface_get_float(const CKeywords* handle);
  103. /*! Sets the value of the variable 'float' that is defined in the default interface scope. */
  104. extern void cKeywordsIface_set_float(CKeywords* handle, sc_boolean value);
  105. /*! Gets the value of the variable 'for' that is defined in the default interface scope. */
  106. extern sc_boolean cKeywordsIface_get_for(const CKeywords* handle);
  107. /*! Sets the value of the variable 'for' that is defined in the default interface scope. */
  108. extern void cKeywordsIface_set_for(CKeywords* handle, sc_boolean value);
  109. /*! Gets the value of the variable 'goto' that is defined in the default interface scope. */
  110. extern sc_boolean cKeywordsIface_get_goto(const CKeywords* handle);
  111. /*! Sets the value of the variable 'goto' that is defined in the default interface scope. */
  112. extern void cKeywordsIface_set_goto(CKeywords* handle, sc_boolean value);
  113. /*! Gets the value of the variable 'if' that is defined in the default interface scope. */
  114. extern sc_boolean cKeywordsIface_get_if(const CKeywords* handle);
  115. /*! Sets the value of the variable 'if' that is defined in the default interface scope. */
  116. extern void cKeywordsIface_set_if(CKeywords* handle, sc_boolean value);
  117. /*! Gets the value of the variable 'int' that is defined in the default interface scope. */
  118. extern sc_boolean cKeywordsIface_get_int(const CKeywords* handle);
  119. /*! Sets the value of the variable 'int' that is defined in the default interface scope. */
  120. extern void cKeywordsIface_set_int(CKeywords* handle, sc_boolean value);
  121. /*! Gets the value of the variable 'long' that is defined in the default interface scope. */
  122. extern sc_boolean cKeywordsIface_get_long(const CKeywords* handle);
  123. /*! Sets the value of the variable 'long' that is defined in the default interface scope. */
  124. extern void cKeywordsIface_set_long(CKeywords* handle, sc_boolean value);
  125. /*! Gets the value of the variable 'register' that is defined in the default interface scope. */
  126. extern sc_boolean cKeywordsIface_get_register(const CKeywords* handle);
  127. /*! Sets the value of the variable 'register' that is defined in the default interface scope. */
  128. extern void cKeywordsIface_set_register(CKeywords* handle, sc_boolean value);
  129. /*! Gets the value of the variable 'return' that is defined in the default interface scope. */
  130. extern sc_boolean cKeywordsIface_get_return(const CKeywords* handle);
  131. /*! Sets the value of the variable 'return' that is defined in the default interface scope. */
  132. extern void cKeywordsIface_set_return(CKeywords* handle, sc_boolean value);
  133. /*! Gets the value of the variable 'short' that is defined in the default interface scope. */
  134. extern sc_boolean cKeywordsIface_get_short(const CKeywords* handle);
  135. /*! Sets the value of the variable 'short' that is defined in the default interface scope. */
  136. extern void cKeywordsIface_set_short(CKeywords* handle, sc_boolean value);
  137. /*! Gets the value of the variable 'signed' that is defined in the default interface scope. */
  138. extern sc_boolean cKeywordsIface_get_signed(const CKeywords* handle);
  139. /*! Sets the value of the variable 'signed' that is defined in the default interface scope. */
  140. extern void cKeywordsIface_set_signed(CKeywords* handle, sc_boolean value);
  141. /*! Gets the value of the variable 'sizeof' that is defined in the default interface scope. */
  142. extern sc_boolean cKeywordsIface_get_sizeof(const CKeywords* handle);
  143. /*! Sets the value of the variable 'sizeof' that is defined in the default interface scope. */
  144. extern void cKeywordsIface_set_sizeof(CKeywords* handle, sc_boolean value);
  145. /*! Gets the value of the variable 'static' that is defined in the default interface scope. */
  146. extern sc_boolean cKeywordsIface_get_static(const CKeywords* handle);
  147. /*! Sets the value of the variable 'static' that is defined in the default interface scope. */
  148. extern void cKeywordsIface_set_static(CKeywords* handle, sc_boolean value);
  149. /*! Gets the value of the variable 'struct' that is defined in the default interface scope. */
  150. extern sc_boolean cKeywordsIface_get_struct(const CKeywords* handle);
  151. /*! Sets the value of the variable 'struct' that is defined in the default interface scope. */
  152. extern void cKeywordsIface_set_struct(CKeywords* handle, sc_boolean value);
  153. /*! Gets the value of the variable 'switch' that is defined in the default interface scope. */
  154. extern sc_boolean cKeywordsIface_get_switch(const CKeywords* handle);
  155. /*! Sets the value of the variable 'switch' that is defined in the default interface scope. */
  156. extern void cKeywordsIface_set_switch(CKeywords* handle, sc_boolean value);
  157. /*! Gets the value of the variable 'typedef' that is defined in the default interface scope. */
  158. extern sc_boolean cKeywordsIface_get_typedef(const CKeywords* handle);
  159. /*! Sets the value of the variable 'typedef' that is defined in the default interface scope. */
  160. extern void cKeywordsIface_set_typedef(CKeywords* handle, sc_boolean value);
  161. /*! Gets the value of the variable 'union' that is defined in the default interface scope. */
  162. extern sc_boolean cKeywordsIface_get_union(const CKeywords* handle);
  163. /*! Sets the value of the variable 'union' that is defined in the default interface scope. */
  164. extern void cKeywordsIface_set_union(CKeywords* handle, sc_boolean value);
  165. /*! Gets the value of the variable 'unsigned' that is defined in the default interface scope. */
  166. extern sc_boolean cKeywordsIface_get_unsigned(const CKeywords* handle);
  167. /*! Sets the value of the variable 'unsigned' that is defined in the default interface scope. */
  168. extern void cKeywordsIface_set_unsigned(CKeywords* handle, sc_boolean value);
  169. /*! Gets the value of the variable 'void' that is defined in the default interface scope. */
  170. extern sc_boolean cKeywordsIface_get_void(const CKeywords* handle);
  171. /*! Sets the value of the variable 'void' that is defined in the default interface scope. */
  172. extern void cKeywordsIface_set_void(CKeywords* handle, sc_boolean value);
  173. /*! Gets the value of the variable 'volatile' that is defined in the default interface scope. */
  174. extern sc_boolean cKeywordsIface_get_volatile(const CKeywords* handle);
  175. /*! Sets the value of the variable 'volatile' that is defined in the default interface scope. */
  176. extern void cKeywordsIface_set_volatile(CKeywords* handle, sc_boolean value);
  177. /*! Gets the value of the variable 'while' that is defined in the default interface scope. */
  178. extern sc_boolean cKeywordsIface_get_while(const CKeywords* handle);
  179. /*! Sets the value of the variable 'while' that is defined in the default interface scope. */
  180. extern void cKeywordsIface_set_while(CKeywords* handle, sc_boolean value);
  181. /*!
  182. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  183. * A state machine is active if it was entered. It is inactive if it has not been entered at all or if it has been exited.
  184. */
  185. extern sc_boolean cKeywords_isActive(const CKeywords* handle);
  186. /*!
  187. * Checks if all active states are final.
  188. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  189. */
  190. extern sc_boolean cKeywords_isFinal(const CKeywords* handle);
  191. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  192. extern sc_boolean cKeywords_isStateActive(const CKeywords* handle, CKeywordsStates state);
  193. #ifdef __cplusplus
  194. }
  195. #endif
  196. #endif /* CKEYWORDS_H_ */