Bladeren bron

Added sequence addition to template code

jos.itemis@gmail.com 13 jaren geleden
bovenliggende
commit
5174ede543

+ 38 - 0
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/templates/CustomStatemachineC.xpt

@@ -149,6 +149,40 @@ void 
 «ENDIF»
 «ENDDEFINE»
 
+
+
+«DEFINE EnterSequenceProto FOR ExecutionState»
+«IF this.enterSequence != null -»
+static void «this.enterSequence.enterSequenceFunctionName()»(«StName()»* handle);
+«ENDIF -»
+«ENDDEFINE»
+
+«DEFINE EnterSequenceImplement FOR ExecutionState»
+«IF this.enterSequence != null»
+void «this.enterSequence.enterSequenceFunctionName()»(«StName()»* handle)
+{
+«EXPAND ActionCode FOR this.enterSequence»
+}
+«ENDIF»
+«ENDDEFINE»
+
+«DEFINE ExitSequenceProto FOR ExecutionState»
+«IF this.exitSequence != null -»
+static void «this.exitSequence.exitSequenceFunctionName()»(«StName()»* handle);
+«ENDIF -»
+«ENDDEFINE»
+
+«DEFINE ExitSequenceImplement FOR ExecutionState»
+«IF this.exitSequence != null»
+void «this.exitSequence.exitSequenceFunctionName()»(«StName()»* handle)
+{
+«EXPAND ActionCode FOR this.exitSequence»
+}
+«ENDIF»
+«ENDDEFINE»
+
+
+
 «DEFINE file FOR ExecutionFlow»
 «FILE StName()+'.c'»
 #include "«StName()».h"
@@ -158,12 +192,16 @@ void 
 «EXPAND CycleMethodsProto FOREACH this.states»
 «EXPAND EnterMethodProto FOREACH this.states»
 «EXPAND ExitMethodProto FOREACH this.states»
+«EXPAND EnterSequenceProto FOREACH this.states»
+«EXPAND ExitSequenceProto FOREACH this.states»
 
 «EXPAND ConditionMethodsImplement FOREACH this.states»
 «EXPAND StatementMethodsImplement FOREACH this.states»
 «EXPAND CycleMethodsImplement FOREACH this.states»
 «EXPAND EnterMethodImplement FOREACH this.states»
 «EXPAND ExitMethodImplement FOREACH this.states»
+«EXPAND EnterSequenceImplement FOREACH this.states»
+«EXPAND ExitSequenceImplement FOREACH this.states»
 
 void «stName()»_init(«StName()»* handle, Timer* timer, EventPool* eventPool)
 {

+ 2 - 2
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/templates/EventSetC.xpt

@@ -19,7 +19,7 @@ Templates for the main statechart c file.
 
 void eventSet_init(EventSet* handle, const uint32_t _maxEvents) {
 
-	int i;
+	uint32_t i;
 
 	handle->isStaticData = bool_false;
 	handle->maxEvents = _maxEvents;
@@ -35,7 +35,7 @@ void eventSet_init(EventSet* handle, const uint32_t _maxEvents) {
 
 void eventSet_init_staticData(EventSet* handle, const uint32_t _maxEvents,
 		boolean* _dataSet, EventType* _eventTypes) {
-	int i;
+	uint32_t i;
 
 	handle->isStaticData = bool_true;
 	handle->maxEvents = _maxEvents;

+ 1 - 1
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/templates/definitionH.xpt

@@ -28,7 +28,7 @@ typedef short int16_t;
 
 typedef int32_t integer; 
 typedef enum { bool_false = 0, bool_true = 1 } boolean;
-typedef float real;
+typedef double real;
 //typedef string char*;
  
 #endif /* DEFINITION_H_ */