CKeywords.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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_last_state,
  13. CKeywords_auto_char,
  14. CKeywords_auto_loop,
  15. CKeywords_auto_loop_switch_case,
  16. CKeywords_auto_loop_switch_case_enum_asm
  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. /*! Define indices of states in the StateConfVector */
  55. #define SCVI_CKEYWORDS_AUTO_CHAR 0
  56. #define SCVI_CKEYWORDS_AUTO_LOOP 0
  57. #define SCVI_CKEYWORDS_AUTO_LOOP_SWITCH_CASE 0
  58. #define SCVI_CKEYWORDS_AUTO_LOOP_SWITCH_CASE_ENUM_ASM 0
  59. /*!
  60. * Type definition of the data structure for the CKeywords state machine.
  61. * This data structure has to be allocated by the client code.
  62. */
  63. typedef struct
  64. {
  65. CKeywordsStates stateConfVector[CKEYWORDS_MAX_ORTHOGONAL_STATES];
  66. CKeywordsStates historyVector[CKEYWORDS_MAX_HISTORY_STATES];
  67. sc_ushort stateConfVectorPosition;
  68. CKeywordsIface iface;
  69. } CKeywords;
  70. /*! Initializes the CKeywords state machine data structures. Must be called before first usage.*/
  71. extern void cKeywords_init(CKeywords* handle);
  72. /*! Activates the state machine */
  73. extern void cKeywords_enter(CKeywords* handle);
  74. /*! Deactivates the state machine */
  75. extern void cKeywords_exit(CKeywords* handle);
  76. /*! Performs a 'run to completion' step. */
  77. extern void cKeywords_runCycle(CKeywords* handle);
  78. /*! Raises the in event 'auto' that is defined in the default interface scope. */
  79. extern void cKeywordsIface_raise_auto(CKeywords* handle);
  80. /*! Raises the in event 'break' that is defined in the default interface scope. */
  81. extern void cKeywordsIface_raise_break(CKeywords* handle);
  82. /*! Gets the value of the variable 'case' that is defined in the default interface scope. */
  83. extern sc_boolean cKeywordsIface_get_case(const CKeywords* handle);
  84. /*! Sets the value of the variable 'case' that is defined in the default interface scope. */
  85. extern void cKeywordsIface_set_case(CKeywords* handle, sc_boolean value);
  86. /*! Gets the value of the variable 'do' that is defined in the default interface scope. */
  87. extern sc_integer cKeywordsIface_get_do(const CKeywords* handle);
  88. /*! Sets the value of the variable 'do' that is defined in the default interface scope. */
  89. extern void cKeywordsIface_set_do(CKeywords* handle, sc_integer value);
  90. /*! Gets the value of the variable 'continue' that is defined in the default interface scope. */
  91. extern sc_boolean cKeywordsIface_get_continue(const CKeywords* handle);
  92. /*! Sets the value of the variable 'continue' that is defined in the default interface scope. */
  93. extern void cKeywordsIface_set_continue(CKeywords* handle, sc_boolean value);
  94. /*! Gets the value of the variable 'double' that is defined in the default interface scope. */
  95. extern sc_boolean cKeywordsIface_get_double(const CKeywords* handle);
  96. /*! Sets the value of the variable 'double' that is defined in the default interface scope. */
  97. extern void cKeywordsIface_set_double(CKeywords* handle, sc_boolean value);
  98. /*! Gets the value of the variable 'enum' that is defined in the default interface scope. */
  99. extern sc_boolean cKeywordsIface_get_enum(const CKeywords* handle);
  100. /*! Sets the value of the variable 'enum' that is defined in the default interface scope. */
  101. extern void cKeywordsIface_set_enum(CKeywords* handle, sc_boolean value);
  102. /*! Gets the value of the variable 'extern' that is defined in the default interface scope. */
  103. extern sc_boolean cKeywordsIface_get_extern(const CKeywords* handle);
  104. /*! Sets the value of the variable 'extern' that is defined in the default interface scope. */
  105. extern void cKeywordsIface_set_extern(CKeywords* handle, sc_boolean value);
  106. /*! Gets the value of the variable 'float' that is defined in the default interface scope. */
  107. extern sc_boolean cKeywordsIface_get_float(const CKeywords* handle);
  108. /*! Sets the value of the variable 'float' that is defined in the default interface scope. */
  109. extern void cKeywordsIface_set_float(CKeywords* handle, sc_boolean value);
  110. /*! Gets the value of the variable 'for' that is defined in the default interface scope. */
  111. extern sc_boolean cKeywordsIface_get_for(const CKeywords* handle);
  112. /*! Sets the value of the variable 'for' that is defined in the default interface scope. */
  113. extern void cKeywordsIface_set_for(CKeywords* handle, sc_boolean value);
  114. /*! Gets the value of the variable 'goto' that is defined in the default interface scope. */
  115. extern sc_boolean cKeywordsIface_get_goto(const CKeywords* handle);
  116. /*! Sets the value of the variable 'goto' that is defined in the default interface scope. */
  117. extern void cKeywordsIface_set_goto(CKeywords* handle, sc_boolean value);
  118. /*! Gets the value of the variable 'if' that is defined in the default interface scope. */
  119. extern sc_boolean cKeywordsIface_get_if(const CKeywords* handle);
  120. /*! Sets the value of the variable 'if' that is defined in the default interface scope. */
  121. extern void cKeywordsIface_set_if(CKeywords* handle, sc_boolean value);
  122. /*! Gets the value of the variable 'int' that is defined in the default interface scope. */
  123. extern sc_boolean cKeywordsIface_get_int(const CKeywords* handle);
  124. /*! Sets the value of the variable 'int' that is defined in the default interface scope. */
  125. extern void cKeywordsIface_set_int(CKeywords* handle, sc_boolean value);
  126. /*! Gets the value of the variable 'long' that is defined in the default interface scope. */
  127. extern sc_boolean cKeywordsIface_get_long(const CKeywords* handle);
  128. /*! Sets the value of the variable 'long' that is defined in the default interface scope. */
  129. extern void cKeywordsIface_set_long(CKeywords* handle, sc_boolean value);
  130. /*! Gets the value of the variable 'register' that is defined in the default interface scope. */
  131. extern sc_boolean cKeywordsIface_get_register(const CKeywords* handle);
  132. /*! Sets the value of the variable 'register' that is defined in the default interface scope. */
  133. extern void cKeywordsIface_set_register(CKeywords* handle, sc_boolean value);
  134. /*! Gets the value of the variable 'return' that is defined in the default interface scope. */
  135. extern sc_boolean cKeywordsIface_get_return(const CKeywords* handle);
  136. /*! Sets the value of the variable 'return' that is defined in the default interface scope. */
  137. extern void cKeywordsIface_set_return(CKeywords* handle, sc_boolean value);
  138. /*! Gets the value of the variable 'short' that is defined in the default interface scope. */
  139. extern sc_boolean cKeywordsIface_get_short(const CKeywords* handle);
  140. /*! Sets the value of the variable 'short' that is defined in the default interface scope. */
  141. extern void cKeywordsIface_set_short(CKeywords* handle, sc_boolean value);
  142. /*! Gets the value of the variable 'signed' that is defined in the default interface scope. */
  143. extern sc_boolean cKeywordsIface_get_signed(const CKeywords* handle);
  144. /*! Sets the value of the variable 'signed' that is defined in the default interface scope. */
  145. extern void cKeywordsIface_set_signed(CKeywords* handle, sc_boolean value);
  146. /*! Gets the value of the variable 'sizeof' that is defined in the default interface scope. */
  147. extern sc_boolean cKeywordsIface_get_sizeof(const CKeywords* handle);
  148. /*! Sets the value of the variable 'sizeof' that is defined in the default interface scope. */
  149. extern void cKeywordsIface_set_sizeof(CKeywords* handle, sc_boolean value);
  150. /*! Gets the value of the variable 'static' that is defined in the default interface scope. */
  151. extern sc_boolean cKeywordsIface_get_static(const CKeywords* handle);
  152. /*! Sets the value of the variable 'static' that is defined in the default interface scope. */
  153. extern void cKeywordsIface_set_static(CKeywords* handle, sc_boolean value);
  154. /*! Gets the value of the variable 'struct' that is defined in the default interface scope. */
  155. extern sc_boolean cKeywordsIface_get_struct(const CKeywords* handle);
  156. /*! Sets the value of the variable 'struct' that is defined in the default interface scope. */
  157. extern void cKeywordsIface_set_struct(CKeywords* handle, sc_boolean value);
  158. /*! Gets the value of the variable 'switch' that is defined in the default interface scope. */
  159. extern sc_boolean cKeywordsIface_get_switch(const CKeywords* handle);
  160. /*! Sets the value of the variable 'switch' that is defined in the default interface scope. */
  161. extern void cKeywordsIface_set_switch(CKeywords* handle, sc_boolean value);
  162. /*! Gets the value of the variable 'typedef' that is defined in the default interface scope. */
  163. extern sc_boolean cKeywordsIface_get_typedef(const CKeywords* handle);
  164. /*! Sets the value of the variable 'typedef' that is defined in the default interface scope. */
  165. extern void cKeywordsIface_set_typedef(CKeywords* handle, sc_boolean value);
  166. /*! Gets the value of the variable 'union' that is defined in the default interface scope. */
  167. extern sc_boolean cKeywordsIface_get_union(const CKeywords* handle);
  168. /*! Sets the value of the variable 'union' that is defined in the default interface scope. */
  169. extern void cKeywordsIface_set_union(CKeywords* handle, sc_boolean value);
  170. /*! Gets the value of the variable 'unsigned' that is defined in the default interface scope. */
  171. extern sc_boolean cKeywordsIface_get_unsigned(const CKeywords* handle);
  172. /*! Sets the value of the variable 'unsigned' that is defined in the default interface scope. */
  173. extern void cKeywordsIface_set_unsigned(CKeywords* handle, sc_boolean value);
  174. /*! Gets the value of the variable 'void' that is defined in the default interface scope. */
  175. extern sc_boolean cKeywordsIface_get_void(const CKeywords* handle);
  176. /*! Sets the value of the variable 'void' that is defined in the default interface scope. */
  177. extern void cKeywordsIface_set_void(CKeywords* handle, sc_boolean value);
  178. /*! Gets the value of the variable 'volatile' that is defined in the default interface scope. */
  179. extern sc_boolean cKeywordsIface_get_volatile(const CKeywords* handle);
  180. /*! Sets the value of the variable 'volatile' that is defined in the default interface scope. */
  181. extern void cKeywordsIface_set_volatile(CKeywords* handle, sc_boolean value);
  182. /*! Gets the value of the variable 'while' that is defined in the default interface scope. */
  183. extern sc_boolean cKeywordsIface_get_while(const CKeywords* handle);
  184. /*! Sets the value of the variable 'while' that is defined in the default interface scope. */
  185. extern void cKeywordsIface_set_while(CKeywords* handle, sc_boolean value);
  186. /*!
  187. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  188. * 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.
  189. */
  190. extern sc_boolean cKeywords_isActive(const CKeywords* handle);
  191. /*!
  192. * Checks if all active states are final.
  193. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  194. */
  195. extern sc_boolean cKeywords_isFinal(const CKeywords* handle);
  196. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  197. extern sc_boolean cKeywords_isStateActive(const CKeywords* handle, CKeywordsStates state);
  198. #ifdef __cplusplus
  199. }
  200. #endif
  201. #endif /* CKEYWORDS_H_ */