Parenthesis.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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_mainRegion_A,
  13. Parenthesis_last_state
  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. /*!
  23. * Type definition of the data structure for the Parenthesis state machine.
  24. * This data structure has to be allocated by the client code.
  25. */
  26. typedef struct
  27. {
  28. ParenthesisStates stateConfVector[PARENTHESIS_MAX_ORTHOGONAL_STATES];
  29. sc_ushort stateConfVectorPosition;
  30. ParenthesisIface iface;
  31. } Parenthesis;
  32. /*! Initializes the Parenthesis state machine data structures. Must be called before first usage.*/
  33. extern void parenthesis_init(Parenthesis* handle);
  34. /*! Activates the state machine */
  35. extern void parenthesis_enter(Parenthesis* handle);
  36. /*! Deactivates the state machine */
  37. extern void parenthesis_exit(Parenthesis* handle);
  38. /*! Performs a 'run to completion' step. */
  39. extern void parenthesis_runCycle(Parenthesis* handle);
  40. /*! Gets the value of the variable 'erg' that is defined in the default interface scope. */
  41. extern sc_integer parenthesisIface_get_erg(const Parenthesis* handle);
  42. /*! Sets the value of the variable 'erg' that is defined in the default interface scope. */
  43. extern void parenthesisIface_set_erg(Parenthesis* handle, sc_integer value);
  44. /*!
  45. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  46. * 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.
  47. */
  48. extern sc_boolean parenthesis_isActive(const Parenthesis* handle);
  49. /*!
  50. * Checks if all active states are final.
  51. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  52. */
  53. extern sc_boolean parenthesis_isFinal(const Parenthesis* handle);
  54. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  55. extern sc_boolean parenthesis_isStateActive(const Parenthesis* handle, ParenthesisStates state);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* PARENTHESIS_H_ */