Parenthesis.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef PARENTHESIS_H_
  2. #define PARENTHESIS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'Parenthesis'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. Parenthesis_last_state,
  13. Parenthesis_mainRegion_A
  14. } ParenthesisStates;
  15. /*! Type definition of the data structure for the ParenthesisIface interface scope. */
  16. typedef struct
  17. {
  18. sc_integer erg;
  19. } ParenthesisIface;
  20. /*! Define dimension of the state configuration vector for orthogonal states. */
  21. #define PARENTHESIS_MAX_ORTHOGONAL_STATES 1
  22. /*! Define indices of states in the StateConfVector */
  23. #define SCVI_PARENTHESIS_MAINREGION_A 0
  24. /*!
  25. * Type definition of the data structure for the Parenthesis state machine.
  26. * This data structure has to be allocated by the client code.
  27. */
  28. typedef struct
  29. {
  30. ParenthesisStates stateConfVector[PARENTHESIS_MAX_ORTHOGONAL_STATES];
  31. sc_ushort stateConfVectorPosition;
  32. ParenthesisIface iface;
  33. } Parenthesis;
  34. /*! Initializes the Parenthesis state machine data structures. Must be called before first usage.*/
  35. extern void parenthesis_init(Parenthesis* handle);
  36. /*! Activates the state machine */
  37. extern void parenthesis_enter(Parenthesis* handle);
  38. /*! Deactivates the state machine */
  39. extern void parenthesis_exit(Parenthesis* handle);
  40. /*! Performs a 'run to completion' step. */
  41. extern void parenthesis_runCycle(Parenthesis* handle);
  42. /*! Gets the value of the variable 'erg' that is defined in the default interface scope. */
  43. extern sc_integer parenthesisIface_get_erg(const Parenthesis* handle);
  44. /*! Sets the value of the variable 'erg' that is defined in the default interface scope. */
  45. extern void parenthesisIface_set_erg(Parenthesis* handle, sc_integer value);
  46. /*!
  47. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  48. * 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.
  49. */
  50. extern sc_boolean parenthesis_isActive(const Parenthesis* handle);
  51. /*!
  52. * Checks if all active states are final.
  53. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  54. */
  55. extern sc_boolean parenthesis_isFinal(const Parenthesis* handle);
  56. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  57. extern sc_boolean parenthesis_isStateActive(const Parenthesis* handle, ParenthesisStates state);
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif /* PARENTHESIS_H_ */