|
@@ -7,7 +7,6 @@ import org.yakindu.sct.model.sgraph.Statechart
|
|
|
import org.yakindu.sct.model.stext.stext.InterfaceScope
|
|
|
import org.yakindu.sct.model.stext.stext.EventDefinition
|
|
|
import org.yakindu.sct.model.stext.stext.VariableDefinition
|
|
|
-import org.yakindu.sct.model.stext.stext.InternalScope
|
|
|
import org.yakindu.sct.model.sgraph.Declaration
|
|
|
import org.yakindu.sct.model.sgraph.Scope
|
|
|
import org.yakindu.sct.model.stext.stext.StatechartScope
|
|
@@ -31,33 +30,40 @@ class Statemachine {
|
|
|
#define «module.define»_H_
|
|
|
|
|
|
#include "«typesModule.h»"
|
|
|
- #include "«timerModule.h»"
|
|
|
-
|
|
|
+
|
|
|
#ifdef __cplusplus
|
|
|
- extern "C" {
|
|
|
+ extern "C" {
|
|
|
#endif
|
|
|
|
|
|
+ /*! \file Header of the state machine '«name»'.
|
|
|
+ */
|
|
|
+
|
|
|
«statesEnumDecl»
|
|
|
|
|
|
«FOR s : it.scopes»«s.scopeTypeDecl»«ENDFOR»
|
|
|
|
|
|
«statemachineTypeDecl»
|
|
|
|
|
|
- /* Initializes the «type» state machine data structures. Must be called before first usage.*/
|
|
|
- extern void «type.toFirstLower»_init(«type»* handle «IF timed», «timerType»* timer«ENDIF»);
|
|
|
+ /*! Initializes the «type» state machine data structures. Must be called before first usage.*/
|
|
|
+ extern void «type.toFirstLower»_init(«type»* handle);
|
|
|
|
|
|
- /* Activates the state machine */
|
|
|
+ /*! Activates the state machine */
|
|
|
extern void «type.toFirstLower»_enter(«type»* handle);
|
|
|
|
|
|
- /* Deactivates the state machine */
|
|
|
+ /*! Deactivates the state machine */
|
|
|
extern void «type.toFirstLower»_exit(«type»* handle);
|
|
|
|
|
|
- /* Performs a 'run to completion' step. */
|
|
|
+ /*! Performs a 'run to completion' step. */
|
|
|
extern void «type.toFirstLower»_runCycle(«type»* handle);
|
|
|
|
|
|
- «FOR s : it.scopes.filter( typeof(InterfaceScope) )»
|
|
|
- «s.scopeFunctionPrototypes»
|
|
|
+ «IF timed»
|
|
|
+ /*! Raises a time event. */
|
|
|
+ extern void «type.toFirstLower»_raiseTimeEvent(«type»* handle, sc_eventid evid);
|
|
|
+ «ENDIF»
|
|
|
|
|
|
+ «FOR s : it.scopes.filter( typeof(InterfaceScope) )»
|
|
|
+ «s.scopeFunctionPrototypes»
|
|
|
+
|
|
|
«ENDFOR»
|
|
|
|
|
|
#ifdef __cplusplus
|
|
@@ -68,7 +74,7 @@ class Statemachine {
|
|
|
'''
|
|
|
|
|
|
def statesEnumDecl(ExecutionFlow it) '''
|
|
|
- // enumeration of all states
|
|
|
+ //! enumeration of all states
|
|
|
typedef enum {
|
|
|
«FOR state : states »
|
|
|
«state.name.asIdentifier» ,
|
|
@@ -95,7 +101,7 @@ class Statemachine {
|
|
|
|
|
|
|
|
|
def dispatch scopeTypeDecl(Scope it) '''
|
|
|
- // Type definition of the data structure for the «it.type» interface scope.
|
|
|
+ //! Type definition of the data structure for the «it.type» interface scope.
|
|
|
typedef struct {
|
|
|
«FOR d : declarations »
|
|
|
«d.structDeclaration »
|
|
@@ -107,24 +113,22 @@ class Statemachine {
|
|
|
// def dispatch scopeTypeDecl(Scope it) ''''''
|
|
|
|
|
|
def statemachineTypeDecl(ExecutionFlow it) '''
|
|
|
- // the maximum number of orthogonal states defines the dimension of the state configuration vector.
|
|
|
- #define MAX_ORTHOGONAL_STATES «stateVector.size»
|
|
|
+ //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
|
|
|
+ #define «type.toUpperCase»_MAX_ORTHOGONAL_STATES «stateVector.size»
|
|
|
«IF ! historyVector.empty»
|
|
|
- // dimension of the state configuration vector for history states
|
|
|
- #define MAX_HISTORY_STATES «historyVector.size»«ENDIF»
|
|
|
+ //! dimension of the state configuration vector for history states
|
|
|
+ #define «type.toUpperCase»_MAX_HISTORY_STATES «historyVector.size»«ENDIF»
|
|
|
|
|
|
- // Type definition of the data structure for the «type» state machine.
|
|
|
- // This data structure has to be allocated by the client code.
|
|
|
+ /*! Type definition of the data structure for the «type» state machine.
|
|
|
+ This data structure has to be allocated by the client code. */
|
|
|
typedef struct {
|
|
|
- «statesEnumType» stateConfVector[MAX_ORTHOGONAL_STATES];
|
|
|
- «IF ! historyVector.empty»«statesEnumType» historyVector[MAX_HISTORY_STATES];«ENDIF»
|
|
|
+ «statesEnumType» stateConfVector[«type.toUpperCase»_MAX_ORTHOGONAL_STATES];
|
|
|
+ «IF ! historyVector.empty»«statesEnumType» historyVector[«type.toUpperCase»_MAX_HISTORY_STATES];«ENDIF»
|
|
|
sc_ushort stateConfVectorPosition;
|
|
|
|
|
|
«FOR iScope : scopes »
|
|
|
«iScope.type» «iScope.instance»;
|
|
|
- «ENDFOR»
|
|
|
-
|
|
|
- «IF timed»SCTimer* timer;«ENDIF»
|
|
|
+ «ENDFOR»
|
|
|
} «type»;
|
|
|
'''
|
|
|
|
|
@@ -142,16 +146,28 @@ class Statemachine {
|
|
|
|
|
|
def dispatch functionPrototypes(EventDefinition it) '''
|
|
|
«IF direction == Direction::IN»
|
|
|
+ /*! Raises the in event '«name»' that is defined in the «scope.scopeDescription». */
|
|
|
extern «type.cPrimitive» «asRaiser»(«it.flow.type»* handle«valueParams»);
|
|
|
+
|
|
|
«ELSE»
|
|
|
- extern sc_boolean «asRaised»(«it.flow.type»* handle);
|
|
|
- extern «type.cPrimitive» «asGetter»(«it.flow.type»* handle);
|
|
|
+ /*! Checks if the out event '«name»' that is defined in the «scope.scopeDescription» has been raised. */
|
|
|
+ extern sc_boolean «asRaised»(«it.flow.type»* handle);
|
|
|
+
|
|
|
+ «IF hasValue»
|
|
|
+ /*! Gets the value of the out event '«name»' that is defined in the «scope.scopeDescription». */
|
|
|
+ extern «type.cPrimitive» «asGetter»(«it.flow.type»* handle);
|
|
|
+
|
|
|
+ «ENDIF»
|
|
|
«ENDIF»
|
|
|
'''
|
|
|
|
|
|
def dispatch functionPrototypes(VariableDefinition it) '''
|
|
|
+ /*! Gets the value of the variable '«name»' that is defined in the «scope.scopeDescription». */
|
|
|
extern «type.cPrimitive» «it.asGetter»(«it.flow.type»* handle);
|
|
|
- «IF ! readonly »extern void «asSetter»(«it.flow.type»* handle, «type.cPrimitive» value);«ENDIF»
|
|
|
+ «IF ! readonly »
|
|
|
+ /*! Sets the value of the variable '«name»' that is defined in the «scope.scopeDescription». */
|
|
|
+ extern void «asSetter»(«it.flow.type»* handle, «type.cPrimitive» value);
|
|
|
+ «ENDIF»
|
|
|
'''
|
|
|
|
|
|
def valueParams(EventDefinition it) {
|