Parcourir la source

#266: Add support for optional generation of tracing callbacks.

- Add Tracing generator feature with parameters to trigger generation of
state-enter and state-exit callbacks.
- Enhanced C code generator to generate callbacks to required header and
respective calls based on corresponding trace steps.
- Ensure that ADD_TRACES option is enabled for C code generator in case
Tracing feature is enabled. Ensured its disabled for all other
generators by default. Had to change contract of
GenericDomainInjectorProvider to accept an overriding module, and
replaced child injector usage in code generators with an overriding
module instead.
anyssen il y a 10 ans
Parent
commit
628fb1b868
43 fichiers modifiés avec 328 ajouts et 178 suppressions
  1. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/IStatemachine.class
  2. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/ITimer.class
  3. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/ITimerCallback.class
  4. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/RuntimeService$StatemachineTimerTask.class
  5. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/RuntimeService.class
  6. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/TimerService$TimeEventTask.class
  7. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/TimerService.class
  8. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficLightWaitingStatemachine$SCIPedestrian.class
  9. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficLightWaitingStatemachine$SCITrafficLight.class
  10. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficLightWaitingStatemachine$SCInterface.class
  11. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficLightWaitingStatemachine.class
  12. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine$SCIPedestrianImpl.class
  13. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine$SCITrafficLightImpl.class
  14. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine$SCInterfaceImpl.class
  15. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine$State.class
  16. BIN
      examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine.class
  17. BIN
      examples/org.yakindu.sct.ui.examples/bin/org/yakindu/sct/ui/examples/Activator.class
  18. 18 0
      plugins/org.yakindu.sct.doc.user/help/05_reference/reference.textile
  19. 10 3
      plugins/org.yakindu.sct.domain.generic/src/org/yakindu/sct/domain/generic/extension/GenericDomainInjectorProvider.java
  20. 2 2
      plugins/org.yakindu.sct.domain.generic/src/org/yakindu/sct/domain/generic/modules/GenericSequencerModule.java
  21. 9 2
      plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/IDomainInjectorProvider.java
  22. 2 1
      plugins/org.yakindu.sct.generator.c/META-INF/MANIFEST.MF
  23. 13 0
      plugins/org.yakindu.sct.generator.c/library/FeatureTypeLibrary.xmi
  24. 37 10
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/CCodeGenerator.java
  25. 7 14
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/CSCTGenerator.xtend
  26. 22 0
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/FlowCode.xtend
  27. 27 6
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/GenmodelEntries.xtend
  28. 4 4
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/Statemachine.xtend
  29. 20 4
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/StatemachineRequired.xtend
  30. 4 4
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/StatemachineC.xtend
  31. 32 28
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/features/CDefaultFeatureValueProvider.java
  32. 0 31
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/features/CFeatureConstants.java
  33. 45 0
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/features/ICFeatureConstants.java
  34. 2 1
      plugins/org.yakindu.sct.generator.core/META-INF/MANIFEST.MF
  35. 38 33
      plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/impl/AbstractSExecModelGenerator.java
  36. 8 7
      plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/impl/AbstractSGraphModelGenerator.java
  37. 3 3
      plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/impl/GenericJavaBasedGenerator.java
  38. 2 2
      plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/CppCodeGenerator.java
  39. 4 5
      plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/StatemachineHeader.xtend
  40. 8 8
      plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/features/CPPDefaultFeatureValueProvider.java
  41. 2 2
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaCodeGenerator.java
  42. 6 6
      plugins/org.yakindu.sct.model.sexec/META-INF/MANIFEST.MF
  43. 3 2
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.xtend

BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/IStatemachine.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/ITimer.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/ITimerCallback.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/RuntimeService$StatemachineTimerTask.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/RuntimeService.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/TimerService$TimeEventTask.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/TimerService.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficLightWaitingStatemachine$SCIPedestrian.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficLightWaitingStatemachine$SCITrafficLight.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficLightWaitingStatemachine$SCInterface.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficLightWaitingStatemachine.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine$SCIPedestrianImpl.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine$SCITrafficLightImpl.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine$SCInterfaceImpl.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine$State.class


BIN
examples/org.yakindu.sct.examples.trafficlight/bin/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine.class


BIN
examples/org.yakindu.sct.ui.examples/bin/org/yakindu/sct/ui/examples/Activator.class


+ 18 - 0
plugins/org.yakindu.sct.doc.user/help/05_reference/reference.textile

@@ -644,6 +644,24 @@ feature IdentifierSettings {
 }
 p. ==<!-- End sgen_feature_identifiersettings -->==
 
+==<!-- Start sgen_feature_tracing -->==
+
+h4. Tracing
+
+The *Tracing* feature allows to enable generation of tracing callback functions:
+
+# __enterState__ (Boolean, optional): whether to generate a callback that is used to notify about 'state enter' events.
+# __exitState__ (Boolean, optional): whether to generate a callback that is used to notify about 'state exit' events.
+
+Sample configuration:
+
+bc(prettyprint).. 
+feature Tracing {
+	enterState = true 
+	exitState  = true
+}
+p. ==<!-- End sgen_feature_tracing -->==
+
 ==<!-- Start sgen_feature_generatoroptions -->==
 
 h4. GeneratorOptions

+ 10 - 3
plugins/org.yakindu.sct.domain.generic/src/org/yakindu/sct/domain/generic/extension/GenericDomainInjectorProvider.java

@@ -82,7 +82,6 @@ public class GenericDomainInjectorProvider implements IDomainInjectorProvider {
 		return new GenericSequencerModule();
 	}
 
-	
 	protected Module getResourceModule() {
 		Module uiModule = Modules.override(getLanguageRuntimeModule()).with(getLanguageUIModule());
 		Module result = Modules.override(uiModule).with(getSharedStateModule());
@@ -117,14 +116,22 @@ public class GenericDomainInjectorProvider implements IDomainInjectorProvider {
 	public Injector getSimulationInjector() {
 		return Guice.createInjector(getSimulationModule());
 	}
-
+	
 	@Override
 	public Injector getSequencerInjector() {
 		return Guice.createInjector(getSequencerModule());
 	}
+	
+	@Override
+	public Injector getSequencerInjector(Module overrides) {
+		if(overrides != null) {
+			return Guice.createInjector(Modules.override(getSequencerModule()).with(overrides));
+		}
+		return getSequencerInjector();
+	}
 
 	@Override
 	public Injector getEditorInjector() {
-		return Guice.createInjector(new GenericEditorModule());	
+		return Guice.createInjector(new GenericEditorModule());
 	}
 }

+ 2 - 2
plugins/org.yakindu.sct.domain.generic/src/org/yakindu/sct/domain/generic/modules/GenericSequencerModule.java

@@ -52,8 +52,8 @@ public class GenericSequencerModule extends AbstractGenericModule {
 	public Class<? extends ITypeSystemInferrer> bindITypeSystemInferrer() {
 		return STextTypeInferrer.class;
 	}
-	
-	public Class<? extends ITypeSystem> bindITypesystem(){
+
+	public Class<? extends ITypeSystem> bindITypesystem() {
 		return GenericTypeSystem.class;
 	}
 

+ 9 - 2
plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/IDomainInjectorProvider.java

@@ -13,6 +13,7 @@ package org.yakindu.sct.domain.extension;
 import org.yakindu.sct.model.sgraph.resource.AbstractSCTResource;
 
 import com.google.inject.Injector;
+import com.google.inject.Module;
 
 /**
  * @author andreas muelder - Initial contribution and API
@@ -33,10 +34,17 @@ public interface IDomainInjectorProvider {
 	public Injector getSimulationInjector();
 
 	/**
-	 * Returns the Injector for the model sequencing
+	 * Returns the Injector for the model sequencing without overriding existing
+	 * bindings.
 	 */
 	public Injector getSequencerInjector();
 
+	/**
+	 * Returns the Injector for the model sequencing, giving precedence to those
+	 * bindings in the overrides module.
+	 */
+	public Injector getSequencerInjector(Module overrides);
+
 	/**
 	 * Injector used to create the embedded in-diagram Xtext Editor
 	 * 
@@ -46,7 +54,6 @@ public interface IDomainInjectorProvider {
 	 */
 	public Injector getEmbeddedEditorInjector(String elementKey);
 
-	
 	/**
 	 * Returns an injector for all editor and UI related stuff.
 	 */

+ 2 - 1
plugins/org.yakindu.sct.generator.c/META-INF/MANIFEST.MF

@@ -20,7 +20,8 @@ Require-Bundle: org.yakindu.sct.model.sexec,
  org.yakindu.sct.generator.genmodel;bundle-version="1.0.0",
  org.yakindu.base.types;bundle-version="1.0.0",
  org.eclipse.xtext.xbase.lib;bundle-version="2.3.0",
- org.eclipse.xtext.builder;bundle-version="2.3.0"
+ org.eclipse.xtext.builder;bundle-version="2.3.0",
+ org.yakindu.sct.domain.generic
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Export-Package: org.yakindu.sct.generator.c,
  org.yakindu.sct.generator.c.features,

+ 13 - 0
plugins/org.yakindu.sct.generator.c/library/FeatureTypeLibrary.xmi

@@ -22,4 +22,17 @@
         name="separator"
         optional="true"/>
   </types>
+  <types name="Tracing"
+      comment="Enables generation of tracing callbacks."
+      optional="true">
+    <parameters
+        name="enterState"
+        comment="Whether to generate a callback that is used when a state is entered."
+        optional="true"
+        parameterType="BOOLEAN"/>
+    <parameters
+        name="exitState"
+        comment="Whether to generate a callback that is used when a state is entered."
+        parameterType="BOOLEAN"/>
+  </types>
 </sgen:FeatureTypeLibrary>

+ 37 - 10
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/CCodeGenerator.java

@@ -1,40 +1,47 @@
 /**
- * Copyright (c) 2012 committers of YAKINDU and others.
+ * Copyright (c) 2012, 2015 Committers of YAKINDU and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  * Contributors:
- * 	committers of YAKINDU - initial API and implementation
+ * 	
+ * Andreas Mülder  - Initial API and implementation
+ * Alexander Nyßen - Support for 'Tracing' feature
  * 
  */
 package org.yakindu.sct.generator.c;
 
 import static org.yakindu.sct.generator.core.util.GeneratorUtils.isDumpSexec;
 
+import org.yakindu.sct.domain.generic.modules.GenericSequencerModule;
+import org.yakindu.sct.generator.c.features.ICFeatureConstants;
 import org.yakindu.sct.generator.c.types.CTypeSystemAccess;
 import org.yakindu.sct.generator.core.impl.GenericJavaBasedGenerator;
 import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess;
 import org.yakindu.sct.model.sexec.ExecutionFlow;
 import org.yakindu.sct.model.sexec.naming.INamingService;
+import org.yakindu.sct.model.sgen.FeatureConfiguration;
 import org.yakindu.sct.model.sgen.GeneratorEntry;
 import org.yakindu.sct.model.sgraph.Statechart;
 
 import com.google.inject.Binder;
 import com.google.inject.Module;
+import com.google.inject.name.Names;
 import com.google.inject.util.Modules;
 
 /**
+ * Provides a C code generator implementation that is based on SExec.
  * 
- * @author andreas muelder
+ * @author Andreas Mülder
+ * @author Alexander Nyßen
  * 
  */
 public class CCodeGenerator extends GenericJavaBasedGenerator {
 
 	@Override
 	public void runGenerator(Statechart statechart, GeneratorEntry entry) {
-		CSCTGenerator delegate = getInjector(entry).getInstance(
-				CSCTGenerator.class);
+		CGenerator delegate = getInjector(entry).getInstance(CGenerator.class);
 		ExecutionFlow flow = createExecutionFlow(statechart, entry);
 		if (isDumpSexec(entry)) {
 			dumpSexec(entry, flow);
@@ -43,14 +50,34 @@ public class CCodeGenerator extends GenericJavaBasedGenerator {
 	}
 
 	@Override
-	protected Module getChildInjectorModule(final GeneratorEntry entry) {
-		Module module = super.getChildInjectorModule(entry);
+	protected Module getOverridesModule(final GeneratorEntry entry) {
+		Module module = super.getOverridesModule(entry);
+
 		return Modules.override(module).with(new Module() {
 			public void configure(Binder binder) {
-				binder.bind(ICodegenTypeSystemAccess.class)
-						.to(CTypeSystemAccess.class);
-				binder.bind(INamingService.class).to(CNamingService.class);
+
 				binder.bind(GeneratorEntry.class).toInstance(entry);
+				binder.bind(INamingService.class).to(CNamingService.class);
+				binder.bind(ICodegenTypeSystemAccess.class).to(CTypeSystemAccess.class);
+
+				// Enable generation of trace steps in case the Tracing feature
+				// is specified and at least one of enter/exit states is
+				// enabled.
+				FeatureConfiguration tracingFeatureConfiguration = entry
+						.getFeatureConfiguration(ICFeatureConstants.FEATURE_TRACING);
+				if (tracingFeatureConfiguration != null && ((tracingFeatureConfiguration
+						.getParameterValue(ICFeatureConstants.PARAMETER_TRACING_ENTER_STATE) != null
+						&& tracingFeatureConfiguration
+								.getParameterValue(ICFeatureConstants.PARAMETER_TRACING_ENTER_STATE)
+								.getBooleanValue() == true)
+						|| (tracingFeatureConfiguration
+								.getParameterValue(ICFeatureConstants.PARAMETER_TRACING_EXIT_STATE) != null
+								&& tracingFeatureConfiguration
+										.getParameterValue(ICFeatureConstants.PARAMETER_TRACING_EXIT_STATE)
+										.getBooleanValue() == true))) {
+					binder.bind(Boolean.class).annotatedWith(Names.named(GenericSequencerModule.ADD_TRACES))
+							.toInstance(Boolean.TRUE);
+				}
 			}
 		});
 	}

+ 7 - 14
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/CSCTGenerator.xtend

@@ -22,27 +22,20 @@ import org.yakindu.sct.model.sgraph.Statechart
  * 
  * @author Axel Terfloth
  */
-class CSCTGenerator implements IExecutionFlowGenerator {
+class CGenerator implements IExecutionFlowGenerator {
 	 
 	@Inject extension Types
-	@Inject extension Statemachine
-	@Inject extension StatemachineC
-	@Inject extension StatemachineRequired
+	@Inject extension StatemachineHeader
+	@Inject extension StatemachineSource
+	@Inject extension StatemachineRequiredHeader
 	@Inject extension Navigation
 	
 	override generate(ExecutionFlow flow, GeneratorEntry entry, IFileSystemAccess fsa) {
-
 		flow.generateTypesH(flow.sourceElement as Statechart, fsa, entry)
-		
-		flow.generateStatemachineH(flow.sourceElement as Statechart, fsa, entry)
-		
+		flow.generateStatemachineHeader(flow.sourceElement as Statechart, fsa, entry)
 		if (flow.timed || !flow.operations.empty) {
-			flow.generateStatemachineClientH(flow.sourceElement as Statechart, fsa, entry)
+			flow.generateStatemachineRequiredHeader(flow.sourceElement as Statechart, fsa, entry)
 		}
-
-		flow.generateStatemachineC(flow.sourceElement as Statechart, fsa, entry)
-
+		flow.generateStatemachineSource(flow.sourceElement as Statechart, fsa, entry)
 	}
-
-	
 }

+ 22 - 0
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/FlowCode.xtend

@@ -24,8 +24,12 @@ import org.yakindu.sct.model.sexec.ScheduleTimeEvent
 import org.yakindu.sct.model.sexec.Sequence
 import org.yakindu.sct.model.sexec.StateSwitch
 import org.yakindu.sct.model.sexec.Step
+import org.yakindu.sct.model.sexec.Trace
+import org.yakindu.sct.model.sexec.TraceStateEntered
+import org.yakindu.sct.model.sexec.TraceStateExited
 import org.yakindu.sct.model.sexec.UnscheduleTimeEvent
 import org.yakindu.sct.model.sexec.naming.INamingService
+import org.yakindu.sct.model.sgen.GeneratorEntry
 
 class FlowCode {
 	
@@ -33,6 +37,9 @@ class FlowCode {
 	@Inject extension Navigation
 	@Inject extension ExpressionCode
 	@Inject extension INamingService
+	@Inject extension GenmodelEntries
+ 
+ 	@Inject GeneratorEntry entry
  
 	def stepComment(Step it) '''
 		«IF !comment.nullOrEmpty»
@@ -43,6 +50,21 @@ class FlowCode {
 	def dispatch CharSequence code(Step it) '''
 		#error ActionCode for Step '«getClass().name»' not defined
 	'''
+	
+// ignore all trace steps not explicitly supported
+	def dispatch CharSequence code(Trace it)''''''
+	
+	def dispatch CharSequence code(TraceStateEntered it) '''
+		«IF entry.tracingEnterState»
+		stateEntered(«it.state.shortName»);
+		«ENDIF»
+	'''
+	
+	def dispatch CharSequence code(TraceStateExited it) '''
+		«IF entry.tracingExitState»
+		stateExited(«it.state.shortName»);
+		«ENDIF»
+	'''
 
 	def dispatch CharSequence code(SaveHistory it) '''
 		«stepComment»

+ 27 - 6
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/GenmodelEntries.xtend

@@ -12,7 +12,7 @@ package org.yakindu.sct.generator.c
 import org.yakindu.sct.generator.core.features.ICoreFeatureConstants
 import org.yakindu.sct.model.sgen.FeatureParameterValue
 import org.yakindu.sct.model.sgen.GeneratorEntry
-import org.yakindu.sct.generator.c.features.CFeatureConstants
+import org.yakindu.sct.generator.c.features.ICFeatureConstants
 
 class GenmodelEntries {
 	
@@ -32,11 +32,11 @@ class GenmodelEntries {
 	}
 	
 	def private getIdentifierSettingsFeature(GeneratorEntry it) {
-		getFeatureConfiguration(CFeatureConstants::FEATURE_IDENTIFIER_SETTINGS)
+		getFeatureConfiguration(ICFeatureConstants::FEATURE_NAMING)
 	}
 	
 	def private FeatureParameterValue getMaxIdentifierLengthParameter(GeneratorEntry it) {
-		identifierSettingsFeature?.getParameterValue(CFeatureConstants::PARAMETER_MAX_IDENTIFIER_LENGTH)
+		identifierSettingsFeature?.getParameterValue(ICFeatureConstants::PARAMETER_NAMING_MAX_IDENTIFIER_LENGTH)
 	}
 	
 	def getIdentifierLength(GeneratorEntry it) {
@@ -52,7 +52,7 @@ class GenmodelEntries {
 	}
 	
 	def private FeatureParameterValue getSeparatorParameter(GeneratorEntry it) {
-		identifierSettingsFeature?.getParameterValue(CFeatureConstants::PARAMETER_SEPARATOR)
+		identifierSettingsFeature?.getParameterValue(ICFeatureConstants::PARAMETER_NAMING_SEPARATOR)
 	}
 	
 	def getSeparator(GeneratorEntry it) {
@@ -60,7 +60,7 @@ class GenmodelEntries {
 	}
 	
 	def private FeatureParameterValue getStatemachinePrefixParameter(GeneratorEntry it) {
-		identifierSettingsFeature?.getParameterValue(CFeatureConstants::PARAMETER_STATEMACHINE_PREFIX)
+		identifierSettingsFeature?.getParameterValue(ICFeatureConstants::PARAMETER_NAMING_STATEMACHINE_PREFIX)
 	}
 	
 	def getStatemachinePrefix(GeneratorEntry it) {
@@ -68,10 +68,31 @@ class GenmodelEntries {
 	}
 	
 	def private FeatureParameterValue getModuleNameParameter(GeneratorEntry it) {
-		identifierSettingsFeature?.getParameterValue(CFeatureConstants::PARAMETER_MODULE_NAME)
+		identifierSettingsFeature?.getParameterValue(ICFeatureConstants::PARAMETER_NAMING_MODULE_NAME)
 	}
 	
 	def getModuleName(GeneratorEntry it) {
 		return moduleNameParameter?.stringValue
 	}
+	
+	
+	def private getTracingFeature(GeneratorEntry it) {
+		getFeatureConfiguration(ICFeatureConstants::FEATURE_TRACING)
+	}
+	
+	def getTracingEnterState(GeneratorEntry it){
+		val enterStateParameter = tracingFeature?.getParameterValue(ICFeatureConstants::PARAMETER_TRACING_ENTER_STATE)
+		if (enterStateParameter != null) {
+			return enterStateParameter.booleanValue
+		}
+		return false
+	}
+	
+	def getTracingExitState(GeneratorEntry it){
+		val exitStateParameter = tracingFeature?.getParameterValue(ICFeatureConstants::PARAMETER_TRACING_EXIT_STATE)
+		if (exitStateParameter != null) {
+			return exitStateParameter.booleanValue
+		}
+		return false
+	}
 }

+ 4 - 4
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/Statemachine.xtend

@@ -29,7 +29,7 @@ import org.yakindu.sct.model.stext.stext.VariableDefinition
 
 import static org.eclipse.xtext.util.Strings.*
 
-class Statemachine {
+class StatemachineHeader {
 
 	@Inject extension Naming cNaming
 	@Inject extension Navigation
@@ -37,12 +37,12 @@ class Statemachine {
 	@Inject extension GenmodelEntries
 	@Inject extension INamingService
 
-	def generateStatemachineH(ExecutionFlow flow, Statechart sc, IFileSystemAccess fsa, GeneratorEntry entry) {
+	def generateStatemachineHeader(ExecutionFlow flow, Statechart sc, IFileSystemAccess fsa, GeneratorEntry entry) {
 		flow.initializeNamingService
-		fsa.generateFile(flow.module.h, flow.statemachineHContent(entry))
+		fsa.generateFile(flow.module.h, flow.generateStatemachineHeaderContents(entry))
 	}
 
-	def statemachineHContent(ExecutionFlow it, GeneratorEntry entry) '''
+	def generateStatemachineHeaderContents(ExecutionFlow it, GeneratorEntry entry) '''
 		«entry.licenseText»
 		
 		#ifndef «module.define»_H_

+ 20 - 4
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/StatemachineRequired.xtend

@@ -21,7 +21,7 @@ import org.yakindu.sct.model.sgraph.Statechart
 import org.yakindu.sct.model.stext.stext.OperationDefinition
 import org.yakindu.sct.model.stext.stext.StatechartScope
 
-class StatemachineRequired {
+class StatemachineRequiredHeader {
 
 	@Inject extension Naming cNaming
 	@Inject extension Navigation
@@ -29,11 +29,11 @@ class StatemachineRequired {
 	@Inject extension GenmodelEntries
 	@Inject extension INamingService
 	
-	def generateStatemachineClientH(ExecutionFlow flow, Statechart sc, IFileSystemAccess fsa, GeneratorEntry entry) {
-		 fsa.generateFile(flow.module.client.h, flow.statemachineClientHContent(entry) )
+	def generateStatemachineRequiredHeader(ExecutionFlow flow, Statechart sc, IFileSystemAccess fsa, GeneratorEntry entry) {
+		 fsa.generateFile(flow.module.client.h, flow.statemachineRequiredHeaderContents(entry) )
 	}
 	
-	def statemachineClientHContent(ExecutionFlow it, GeneratorEntry entry) '''
+	def statemachineRequiredHeaderContents(ExecutionFlow it, GeneratorEntry entry) '''
 			«entry.licenseText»
 			
 			#ifndef «module.client.define»_H_
@@ -95,6 +95,22 @@ class StatemachineRequired {
 			extern void «type.toFirstLower»_unsetTimer(«scHandleDecl», const sc_eventid evid);
 			«ENDIF»
 			
+			
+			«IF entry.tracingEnterState || entry.tracingExitState»
+			/*!
+			 * Tracing callback functions
+			 */
+			«IF entry.tracingEnterState»
+				/*! This function is called when a state is entered. */
+				extern void stateEntered(const SCTStates state);
+			«ENDIF»
+			
+			«IF entry.tracingExitState»
+				/*! This function is called when a state is exited. */
+				extern void stateExited(const SCTStates state);
+			«ENDIF»
+			«ENDIF»
+			
 			#ifdef __cplusplus
 			}
 			#endif 

+ 4 - 4
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/StatemachineC.xtend

@@ -25,7 +25,7 @@ import org.yakindu.sct.model.stext.stext.VariableDefinition
 import org.yakindu.sct.model.stext.stext.StatechartScope
 import org.eclipse.xtext.util.Strings
 
-class StatemachineC {
+class StatemachineSource {
 	
 	@Inject extension Naming
 	@Inject extension GenmodelEntries
@@ -36,14 +36,14 @@ class StatemachineC {
 	@Inject extension ConstantInitializationResolver
 	@Inject protected extension StateVectorExtensions
 	
-	def generateStatemachineC(ExecutionFlow flow, Statechart sc, IFileSystemAccess fsa, GeneratorEntry entry) {
+	def generateStatemachineSource(ExecutionFlow flow, Statechart sc, IFileSystemAccess fsa, GeneratorEntry entry) {
 		flow.initializeNamingService
-		var content = flow.statemachineCContent(entry)
+		var content = flow.generateStatemachineSourceContents(entry)
 		var target = flow.module.c
 		fsa.generateFile(target , content)
 	}
 	
-	def statemachineCContent(ExecutionFlow it, GeneratorEntry entry) '''
+	def generateStatemachineSourceContents(ExecutionFlow it, GeneratorEntry entry) '''
 		«entry.licenseText»
 		
 		#include <stdlib.h>

+ 32 - 28
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/features/CDefaultFeatureValueProvider.java

@@ -1,12 +1,14 @@
 /**
- * Copyright (c) 2011 committers of YAKINDU and others.
+ * Copyright (c) 2011, 2015 Committers of YAKINDU and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
  * 
+ * Contributors:
+ * 	Andreas Mülder    - Initial contribution and API
+ *  Markus Mühlbrandt - Added support for 'IdentifierSettings' feature
+ *  Alexander Nyßen   - Added support for 'Tracing' feature; general refactorings
  */
 package org.yakindu.sct.generator.c.features;
 
@@ -21,63 +23,65 @@ import org.yakindu.sct.model.sgen.GeneratorEntry;
 import org.yakindu.sct.model.sgraph.Statechart;
 
 /**
- * Feature value provider for c code generator.
- * 
- * @author andreas muelder - Initial contribution and API
- * @author Markus Mühlbrandt - Added additional features
+ * Provides default values and support for validating parameter values of C code
+ * generator generator model.
  * 
+ * @author Andreas Mülder
+ * @author Markus Mühlbrandt
+ * @author Alexander Nyßen
  */
-public class CDefaultFeatureValueProvider extends
-		AbstractDefaultFeatureValueProvider {
+public class CDefaultFeatureValueProvider extends AbstractDefaultFeatureValueProvider {
 
 	private static final String INVALID_IDENTIFIER_REGEX = "[^a-z&&[^A-Z&&[^0-9]]]";
 	private static final String VALID_IDENTIFIER_REGEX = "[_a-zA-Z][_a-zA-Z0-9]*";
 
+	@Override
 	public boolean isProviderFor(FeatureTypeLibrary library) {
-		return CFeatureConstants.LIBRARY_NAME.equals(library.getName());
+		return ICFeatureConstants.LIBRARY_NAME.equals(library.getName());
 	}
 
 	@Override
-	protected void setDefaultValue(FeatureParameterValue parameterValue,
-			EObject contextElement) {
+	protected void setDefaultValue(FeatureParameterValue parameterValue, EObject contextElement) {
 
 		GeneratorEntry entry = (GeneratorEntry) contextElement;
 		Statechart statechart = (Statechart) entry.getElementRef();
+		String parameterName = parameterValue.getParameter().getName();
 
-		if (parameterValue.getParameter().getName()
-				.equals(CFeatureConstants.PARAMETER_MODULE_NAME)) {
+		if (ICFeatureConstants.PARAMETER_NAMING_MODULE_NAME.equals(parameterName)) {
 			parameterValue.setValue(asIdentifier(statechart.getName(), "_"));
-		} else if (parameterValue.getParameter().getName()
-				.equals(CFeatureConstants.PARAMETER_STATEMACHINE_PREFIX)) {
-			parameterValue.setValue(StringExtensions.toFirstLower(asIdentifier(
-					statechart.getName(), "_")));
-		} else if (parameterValue.getParameter().getName()
-				.equals(CFeatureConstants.PARAMETER_MAX_IDENTIFIER_LENGTH)) {
+		} else if (ICFeatureConstants.PARAMETER_NAMING_STATEMACHINE_PREFIX.equals(parameterName)) {
+			parameterValue.setValue(StringExtensions.toFirstLower(asIdentifier(statechart.getName(), "_")));
+		} else if (ICFeatureConstants.PARAMETER_NAMING_MAX_IDENTIFIER_LENGTH.equals(parameterName)) {
 			parameterValue.setValue("31");
-		} else if (parameterValue.getParameter().getName()
-				.equals(CFeatureConstants.PARAMETER_SEPARATOR)) {
+		} else if (ICFeatureConstants.PARAMETER_NAMING_SEPARATOR.equals(parameterName)) {
 			parameterValue.setValue("_");
+		} else if (ICFeatureConstants.PARAMETER_TRACING_ENTER_STATE.equals(parameterName)) {
+			parameterValue.setValue(true);
+		} else if (ICFeatureConstants.PARAMETER_TRACING_EXIT_STATE.equals(parameterName)) {
+			parameterValue.setValue(true);
+		} else {
+			throw new IllegalArgumentException("Unsupported parameter '" + parameterName + "'.");
 		}
 	}
 
-	/**
-	 * Executes some validations on the given {@link FeatureParameterValue}
-	 */
+	@Override
 	public IStatus validateParameterValue(FeatureParameterValue parameter) {
 		String parameterName = parameter.getParameter().getName();
-		if (CFeatureConstants.PARAMETER_MODULE_NAME.equals(parameterName)) {
+		if (ICFeatureConstants.PARAMETER_NAMING_MODULE_NAME.equals(parameterName)) {
 			if (!parameter.getStringValue().matches(VALID_IDENTIFIER_REGEX)) {
 				return error("Invalid module name");
 			}
-		} else if (CFeatureConstants.PARAMETER_STATEMACHINE_PREFIX.equals(parameterName)) {
+		} else if (ICFeatureConstants.PARAMETER_NAMING_STATEMACHINE_PREFIX.equals(parameterName)) {
 			if (!parameter.getStringValue().matches(VALID_IDENTIFIER_REGEX)) {
 				return error("Invalid function prefix name");
 			}
-		} else if (CFeatureConstants.PARAMETER_SEPARATOR.equals(parameterName)) {
+		} else if (ICFeatureConstants.PARAMETER_NAMING_SEPARATOR.equals(parameterName)) {
 			if (!parameter.getStringValue().matches(VALID_IDENTIFIER_REGEX)) {
 				return error("Invalid separator");
 			}
 		}
+		// No specific validation is required for 'enterState' and 'exitState'
+		// parameters of 'Tracing' feature, as they are boolean.
 		return Status.OK_STATUS;
 	}
 

+ 0 - 31
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/features/CFeatureConstants.java

@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.generator.c.features;
-
-/**
- * 
- * @author holger willebrandt - Initial contribution and API
- * @author Markus Mühlbrandt - Additional feature identifiers
- * 
- */
-public interface CFeatureConstants {
-	public static final String LIBRARY_NAME = "C Generator";
-	
-	public static final String FEATURE_IDENTIFIER_SETTINGS = "IdentifierSettings";
-	
-	public static final String PARAMETER_MODULE_NAME = "moduleName";
-	
-	public static final String PARAMETER_STATEMACHINE_PREFIX = "statemachinePrefix";
-	
-	public static final String PARAMETER_MAX_IDENTIFIER_LENGTH = "maxIdentifierLength";
-	
-	public static final String PARAMETER_SEPARATOR = "separator";
-}

+ 45 - 0
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/features/ICFeatureConstants.java

@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011, 2015 Committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ * 	Holger Willebrandt - Initial API and implementation
+ *  Markus Mühlbrandt  - Added 'IdentifierSettings' feature and related parameters
+ *  Alexander Nyßen    - Added 'Tracing' feature and renamed constants
+ * 
+ */
+package org.yakindu.sct.generator.c.features;
+
+/**
+ * Defines constants to refer to features and parameters within C code generator
+ * generator model.
+ * 
+ * @author Holger Willebrandt
+ * @author Markus Mühlbrandt
+ * @author Alexander Nyßen
+ */
+public interface ICFeatureConstants {
+
+	public static final String LIBRARY_NAME = "C Generator";
+
+	// TODO: Change value of FEATURE_NAMING to 'Naming' and extract it to a
+	// general code generator feature (see issue #267).
+	public static final String FEATURE_NAMING = "IdentifierSettings";
+
+	public static final String PARAMETER_NAMING_MODULE_NAME = "moduleName";
+
+	public static final String PARAMETER_NAMING_STATEMACHINE_PREFIX = "statemachinePrefix";
+
+	public static final String PARAMETER_NAMING_MAX_IDENTIFIER_LENGTH = "maxIdentifierLength";
+
+	public static final String PARAMETER_NAMING_SEPARATOR = "separator";
+
+	public static final String FEATURE_TRACING = "Tracing";
+
+	public static final String PARAMETER_TRACING_ENTER_STATE = "enterState";
+	
+	public static final String PARAMETER_TRACING_EXIT_STATE = "exitState";
+}

+ 2 - 1
plugins/org.yakindu.sct.generator.core/META-INF/MANIFEST.MF

@@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.ui,
  org.yakindu.base.types;bundle-version="1.0.0",
  org.eclipse.xtext.builder;bundle-version="2.3.0",
  org.yakindu.sct.commons;bundle-version="1.0.0",
- org.yakindu.sct.domain;bundle-version="2.4.1"
+ org.yakindu.sct.domain;bundle-version="2.4.1",
+ org.yakindu.sct.domain.generic;bundle-version="2.5.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Bundle-ActivationPolicy: lazy
 Export-Package: org.yakindu.sct.builder.nature,

+ 38 - 33
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/impl/AbstractSExecModelGenerator.java

@@ -31,6 +31,7 @@ import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
 import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+import org.yakindu.sct.domain.generic.modules.GenericSequencerModule;
 import org.yakindu.sct.model.sexec.ExecutionFlow;
 import org.yakindu.sct.model.sexec.transformation.FlowOptimizer;
 import org.yakindu.sct.model.sexec.transformation.IModelSequencer;
@@ -38,7 +39,11 @@ import org.yakindu.sct.model.sgen.FeatureConfiguration;
 import org.yakindu.sct.model.sgen.GeneratorEntry;
 import org.yakindu.sct.model.sgraph.Statechart;
 
+import com.google.inject.Binder;
 import com.google.inject.Injector;
+import com.google.inject.Module;
+import com.google.inject.name.Names;
+import com.google.inject.util.Modules;
 
 /**
  * abstract base class for all code generators that want to generate code based
@@ -47,8 +52,7 @@ import com.google.inject.Injector;
  * @author andreas muelder - Initial contribution and API
  * 
  */
-public abstract class AbstractSExecModelGenerator extends
-		AbstractSGraphModelGenerator {
+public abstract class AbstractSExecModelGenerator extends AbstractSGraphModelGenerator {
 
 	private static final String SEXEC_FILE_EXTENSION = "sexec";
 
@@ -60,45 +64,49 @@ public abstract class AbstractSExecModelGenerator extends
 	protected void runGenerator(Statechart statechart, GeneratorEntry entry) {
 		if (this instanceof IExecutionFlowGenerator) {
 			IExecutionFlowGenerator flowGenerator = (IExecutionFlowGenerator) this;
-			flowGenerator.generate(createExecutionFlow(statechart, entry),
-					entry, null);
+			flowGenerator.generate(createExecutionFlow(statechart, entry), entry, null);
 		}
 		super.runGenerator(statechart, entry);
 	}
 
+	@Override
+	protected Module getOverridesModule(GeneratorEntry entry) {
+		Module module = super.getOverridesModule(entry);
+
+		return Modules.override(module).with(new Module() {
+			public void configure(Binder binder) {
+				// by default, traces should not be generated
+				binder.bind(Boolean.class).annotatedWith(Names.named(GenericSequencerModule.ADD_TRACES))
+						.toInstance(Boolean.FALSE);
+			}
+		});
+	}
+
 	/**
 	 * Transforms the {@link Statechart} model to a {@link ExecutionFlow} model
 	 */
-	protected ExecutionFlow createExecutionFlow(Statechart statechart,
-			GeneratorEntry entry) {
+	protected ExecutionFlow createExecutionFlow(Statechart statechart, GeneratorEntry entry) {
 		Injector injector = getInjector(entry);
 		IModelSequencer sequencer = injector.getInstance(IModelSequencer.class);
 		ExecutionFlow flow = sequencer.transform(statechart);
 		Assert.isNotNull(flow, "Error creation ExecutionFlow");
 
-		FeatureConfiguration optimizeConfig = entry
-				.getFeatureConfiguration(FUNCTION_INLINING_FEATURE);
+		FeatureConfiguration optimizeConfig = entry.getFeatureConfiguration(FUNCTION_INLINING_FEATURE);
 
 		FlowOptimizer optimizer = injector.getInstance(FlowOptimizer.class);
 
-		optimizer.inlineReactions(getBoolValue(optimizeConfig,
-				FUNCTION_INLINING_FEATURE_INLINE_REACTIONS, false));
-		optimizer.inlineExitActions(getBoolValue(optimizeConfig,
-				FUNCTION_INLINING_FEATURE_INLINE_EXIT_ACTIONS, false));
-		optimizer.inlineEntryActions(getBoolValue(optimizeConfig,
-				FUNCTION_INLINING_FEATURE_INLINE_ENTRY_ACTIONS, false));
-		optimizer.inlineEnterSequences(getBoolValue(optimizeConfig,
-				FUNCTION_INLINING_FEATURE_INLINE_ENTER_SEQUENCES, false));
-		optimizer.inlineExitSequences(getBoolValue(optimizeConfig,
-				FUNCTION_INLINING_FEATURE_INLINE_EXIT_SEQUENCES, false));
-		optimizer.inlineChoices(getBoolValue(optimizeConfig,
-				FUNCTION_INLINING_FEATURE_INLINE_CHOICES, false));
-		optimizer.inlineEntries(getBoolValue(optimizeConfig,
-				FUNCTION_INLINING_FEATURE_INLINE_ENTRIES, false));
-		optimizer.inlineEnterRegion(getBoolValue(optimizeConfig,
-				FUNCTION_INLINING_FEATURE_INLINE_ENTER_REGION, false));
-		optimizer.inlineExitRegion(getBoolValue(optimizeConfig,
-				FUNCTION_INLINING_FEATURE_INLINE_EXIT_REGION, false));
+		optimizer.inlineReactions(getBoolValue(optimizeConfig, FUNCTION_INLINING_FEATURE_INLINE_REACTIONS, false));
+		optimizer.inlineExitActions(getBoolValue(optimizeConfig, FUNCTION_INLINING_FEATURE_INLINE_EXIT_ACTIONS, false));
+		optimizer.inlineEntryActions(
+				getBoolValue(optimizeConfig, FUNCTION_INLINING_FEATURE_INLINE_ENTRY_ACTIONS, false));
+		optimizer.inlineEnterSequences(
+				getBoolValue(optimizeConfig, FUNCTION_INLINING_FEATURE_INLINE_ENTER_SEQUENCES, false));
+		optimizer.inlineExitSequences(
+				getBoolValue(optimizeConfig, FUNCTION_INLINING_FEATURE_INLINE_EXIT_SEQUENCES, false));
+		optimizer.inlineChoices(getBoolValue(optimizeConfig, FUNCTION_INLINING_FEATURE_INLINE_CHOICES, false));
+		optimizer.inlineEntries(getBoolValue(optimizeConfig, FUNCTION_INLINING_FEATURE_INLINE_ENTRIES, false));
+		optimizer.inlineEnterRegion(getBoolValue(optimizeConfig, FUNCTION_INLINING_FEATURE_INLINE_ENTER_REGION, false));
+		optimizer.inlineExitRegion(getBoolValue(optimizeConfig, FUNCTION_INLINING_FEATURE_INLINE_EXIT_REGION, false));
 
 		flow = optimizer.transform(flow);
 
@@ -107,13 +115,10 @@ public abstract class AbstractSExecModelGenerator extends
 
 	protected void dumpSexec(GeneratorEntry entry, ExecutionFlow flow) {
 		ResourceSet resourceSet = new ResourceSetImpl();
-		resourceSet
-				.getResourceFactoryRegistry()
-				.getExtensionToFactoryMap()
-				.put(Resource.Factory.Registry.DEFAULT_EXTENSION,
-						new XMIResourceFactoryImpl());
-		URI fileURI = entry.getElementRef().eResource().getURI()
-				.trimFileExtension().appendFileExtension(SEXEC_FILE_EXTENSION);
+		resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
+				.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
+		URI fileURI = entry.getElementRef().eResource().getURI().trimFileExtension()
+				.appendFileExtension(SEXEC_FILE_EXTENSION);
 		Resource resource = resourceSet.createResource(fileURI);
 		resource.getContents().add(flow);
 		try {

+ 8 - 7
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/impl/AbstractSGraphModelGenerator.java

@@ -6,7 +6,8 @@
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *     committers of YAKINDU - initial API and implementation
+ *     Andreas Mülder - Initial API and implementation
+ *     Alexaner Nyßen - Refactored to use overriding module instead of child injector
  */
 package org.yakindu.sct.generator.core.impl;
 
@@ -38,7 +39,7 @@ import com.google.inject.Module;
  * abstract base class for all code generators that want to generate code based
  * on the {@link ExecutionFlow}
  * 
- * @author andreas muelder - Initial contribution and API
+ * @author Andreas Mülder - Initial contribution and API
  * 
  */
 public abstract class AbstractSGraphModelGenerator implements ISCTGenerator {
@@ -73,7 +74,7 @@ public abstract class AbstractSGraphModelGenerator implements ISCTGenerator {
 		public File getTargetFolder(GeneratorEntry entry) {
 			return GeneratorUtils.getTargetFolder(entry);
 		}
-		
+
 		public File getLibraryTargetFolder(GeneratorEntry entry) {
 			return GeneratorUtils.getLibraryTargetFolder(entry);
 		}
@@ -137,11 +138,11 @@ public abstract class AbstractSGraphModelGenerator implements ISCTGenerator {
 	private Injector injector;
 
 	protected Injector createInjector(GeneratorEntry entry) {
-		Injector sequencerInjector = DomainRegistry.getDomainDescriptor(entry.getElementRef()).getDomainInjectorProvider().getSequencerInjector();
-		return sequencerInjector.createChildInjector(getChildInjectorModule(entry));
+		return DomainRegistry.getDomainDescriptor(entry.getElementRef()).getDomainInjectorProvider()
+				.getSequencerInjector(getOverridesModule(entry));
 	}
 
-	protected Module getChildInjectorModule(GeneratorEntry entry) {
+	protected Module getOverridesModule(GeneratorEntry entry) {
 		Module bridgeModule = new Module() {
 			public void configure(Binder binder) {
 				binder.bind(IGeneratorBridge.class).toInstance(bridge);
@@ -180,7 +181,7 @@ public abstract class AbstractSGraphModelGenerator implements ISCTGenerator {
 			}
 		}
 		MessageConsole myConsole = new MessageConsole(SCT_GENERATOR_CONSOLE, null);
-		conMan.addConsoles(new IConsole[] { myConsole });
+		conMan.addConsoles(new IConsole[]{myConsole});
 		return myConsole;
 	}
 

+ 3 - 3
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/impl/GenericJavaBasedGenerator.java

@@ -10,8 +10,8 @@
  */
 package org.yakindu.sct.generator.core.impl;
 
-import static org.yakindu.sct.generator.core.features.ICoreFeatureConstants.OUTLET_FEATURE_TARGET_FOLDER;
 import static org.yakindu.sct.generator.core.features.ICoreFeatureConstants.OUTLET_FEATURE_LIBRARY_TARGET_FOLDER;
+import static org.yakindu.sct.generator.core.features.ICoreFeatureConstants.OUTLET_FEATURE_TARGET_FOLDER;
 import static org.yakindu.sct.generator.core.features.impl.IGenericJavaFeatureConstants.CONFIGURATION_MODULE;
 import static org.yakindu.sct.generator.core.features.impl.IGenericJavaFeatureConstants.GENERATOR_CLASS;
 import static org.yakindu.sct.generator.core.features.impl.IGenericJavaFeatureConstants.GENERATOR_PROJECT;
@@ -45,8 +45,8 @@ import com.google.inject.util.Modules;
 public class GenericJavaBasedGenerator extends AbstractSExecModelGenerator {
 
 	@Override
-	protected Module getChildInjectorModule(final GeneratorEntry entry) {
-		Module defaultModule = super.getChildInjectorModule(entry);
+	protected Module getOverridesModule(final GeneratorEntry entry) {
+		Module defaultModule = super.getOverridesModule(entry);
 
 		String overridingModuleClass = null;
 		FeatureConfiguration featureConfiguration = entry.getFeatureConfiguration(TEMPLATE_FEATURE);

+ 2 - 2
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/CppCodeGenerator.java

@@ -43,8 +43,8 @@ public class CppCodeGenerator extends GenericJavaBasedGenerator {
 	}
 
 	@Override
-	protected Module getChildInjectorModule(final GeneratorEntry entry) {
-		Module module = super.getChildInjectorModule(entry);
+	protected Module getOverridesModule(final GeneratorEntry entry) {
+		Module module = super.getOverridesModule(entry);
 		return Modules.override(module).with(new Module() {
 			public void configure(Binder binder) {
 				binder.bind(ICodegenTypeSystemAccess.class).to(

+ 4 - 5
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/StatemachineHeader.xtend

@@ -15,7 +15,6 @@ import java.util.List
 import org.eclipse.xtend2.lib.StringConcatenation
 import org.eclipse.xtext.generator.IFileSystemAccess
 import org.yakindu.base.types.Direction
-import org.yakindu.sct.generator.c.Statemachine
 import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
 import org.yakindu.sct.generator.cpp.features.GenmodelEntriesExtension
 import org.yakindu.sct.model.sexec.Check
@@ -31,7 +30,7 @@ import org.yakindu.sct.model.stext.stext.InternalScope
 import org.yakindu.sct.model.stext.stext.StatechartScope
 import org.yakindu.sct.model.stext.stext.VariableDefinition
 
-class StatemachineHeader extends Statemachine {
+class StatemachineHeader extends org.yakindu.sct.generator.c.StatemachineHeader {
 
 	@Inject extension Naming
 	@Inject extension Navigation
@@ -41,12 +40,12 @@ class StatemachineHeader extends Statemachine {
 
 	protected GeneratorEntry entry
 
-	def generateStatemachineHeader(ExecutionFlow flow, Statechart sc, IFileSystemAccess fsa, GeneratorEntry entry) {
+	override generateStatemachineHeader(ExecutionFlow flow, Statechart sc, IFileSystemAccess fsa, GeneratorEntry entry) {
 		this.entry = entry
-		fsa.generateFile(flow.module().h, flow.statemachineHContent(entry))
+		fsa.generateFile(flow.module().h, flow.generateStatemachineHeaderContents(entry))
 	}
 
-	override statemachineHContent(ExecutionFlow it, GeneratorEntry entry) '''
+	override generateStatemachineHeaderContents(ExecutionFlow it, GeneratorEntry entry) '''
 		«entry.licenseText»
 		
 		#ifndef «module().define»_H_

+ 8 - 8
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/features/CPPDefaultFeatureValueProvider.java

@@ -16,7 +16,7 @@ import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.xtext.xbase.lib.StringExtensions;
-import org.yakindu.sct.generator.c.features.CFeatureConstants;
+import org.yakindu.sct.generator.c.features.ICFeatureConstants;
 import org.yakindu.sct.generator.core.features.AbstractDefaultFeatureValueProvider;
 import org.yakindu.sct.generator.cpp.features.CPPFeatureConstants.Visibility;
 import org.yakindu.sct.model.sgen.FeatureParameterValue;
@@ -46,17 +46,17 @@ public class CPPDefaultFeatureValueProvider extends
 		Statechart statechart = (Statechart) entry.getElementRef();
 
 		if (parameterValue.getParameter().getName()
-				.equals(CFeatureConstants.PARAMETER_MODULE_NAME)) {
+				.equals(ICFeatureConstants.PARAMETER_NAMING_MODULE_NAME)) {
 			parameterValue.setValue(asIdentifier(statechart.getName(), "_"));
 		} else if (parameterValue.getParameter().getName()
-				.equals(CFeatureConstants.PARAMETER_STATEMACHINE_PREFIX)) {
+				.equals(ICFeatureConstants.PARAMETER_NAMING_STATEMACHINE_PREFIX)) {
 			parameterValue.setValue(StringExtensions.toFirstLower(asIdentifier(
 					statechart.getName(), "_")));
 		} else if (parameterValue.getParameter().getName()
-				.equals(CFeatureConstants.PARAMETER_MAX_IDENTIFIER_LENGTH)) {
+				.equals(ICFeatureConstants.PARAMETER_NAMING_MAX_IDENTIFIER_LENGTH)) {
 			parameterValue.setValue("31");
 		} else if (parameterValue.getParameter().getName()
-				.equals(CFeatureConstants.PARAMETER_SEPARATOR)) {
+				.equals(ICFeatureConstants.PARAMETER_NAMING_SEPARATOR)) {
 			parameterValue.setValue("_");
 		} else if (parameterValue
 				.getParameter()
@@ -71,16 +71,16 @@ public class CPPDefaultFeatureValueProvider extends
 
 	public IStatus validateParameterValue(FeatureParameterValue parameter) {
 		String parameterName = parameter.getParameter().getName();
-		if (CFeatureConstants.PARAMETER_MODULE_NAME.equals(parameterName)) {
+		if (ICFeatureConstants.PARAMETER_NAMING_MODULE_NAME.equals(parameterName)) {
 			if (!parameter.getStringValue().matches(VALID_IDENTIFIER_REGEX)) {
 				return error("Invalid module name");
 			}
-		} else if (CFeatureConstants.PARAMETER_STATEMACHINE_PREFIX
+		} else if (ICFeatureConstants.PARAMETER_NAMING_STATEMACHINE_PREFIX
 				.equals(parameterName)) {
 			if (!parameter.getStringValue().matches(VALID_IDENTIFIER_REGEX)) {
 				return error("Invalid function prefix name");
 			}
-		} else if (CFeatureConstants.PARAMETER_SEPARATOR.equals(parameterName)) {
+		} else if (ICFeatureConstants.PARAMETER_NAMING_SEPARATOR.equals(parameterName)) {
 			if (!parameter.getStringValue().matches(VALID_IDENTIFIER_REGEX)) {
 				return error("Invalid separator");
 			}

+ 2 - 2
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaCodeGenerator.java

@@ -41,8 +41,8 @@ public class JavaCodeGenerator extends AbstractJavaCodeGenerator {
 	}
 
 	@Override
-	protected Module getChildInjectorModule(final GeneratorEntry entry) {
-		Module module = super.getChildInjectorModule(entry);
+	protected Module getOverridesModule(final GeneratorEntry entry) {
+		Module module = super.getOverridesModule(entry);
 		final GenmodelEntries entries = new GenmodelEntries();
 		return Modules.override(module).with(new Module() {
 			public void configure(Binder binder) {

+ 6 - 6
plugins/org.yakindu.sct.model.sexec/META-INF/MANIFEST.MF

@@ -13,14 +13,14 @@ Export-Package: org.yakindu.sct.model.sexec,
  org.yakindu.sct.model.sexec.naming,
  org.yakindu.sct.model.sexec.transformation,
  org.yakindu.sct.model.sexec.util
-Require-Bundle: org.eclipse.core.runtime,
+Require-Bundle: com.google.inject,
+ org.eclipse.core.runtime,
  org.eclipse.emf.ecore;visibility:=reexport,
- org.yakindu.sct.model.sgraph;visibility:=reexport,
- org.yakindu.base.types;visibility:=reexport,
- org.yakindu.base.expressions;visibility:=reexport,
- com.google.inject,
  org.eclipse.xtext.xbase.lib,
+ org.eclipse.xtend.lib;bundle-version="2.3.0",
  org.eclipse.xtext,
+ org.yakindu.base.types;visibility:=reexport,
+ org.yakindu.base.expressions;visibility:=reexport,
  org.yakindu.sct.model.stext,
- org.eclipse.xtend.lib;bundle-version="2.3.0"
+ org.yakindu.sct.model.sgraph;visibility:=reexport
 Bundle-ActivationPolicy: lazy

+ 3 - 2
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.xtend

@@ -18,6 +18,7 @@ import org.yakindu.base.expressions.expressions.BoolLiteral
 import org.yakindu.base.expressions.expressions.DoubleLiteral
 import org.yakindu.base.expressions.expressions.Expression
 import org.yakindu.base.expressions.expressions.ExpressionsFactory
+import org.yakindu.base.expressions.expressions.FloatLiteral
 import org.yakindu.base.expressions.expressions.IntLiteral
 import org.yakindu.base.expressions.expressions.MultiplicativeOperator
 import org.yakindu.base.expressions.expressions.NumericalMultiplyDivideExpression
@@ -41,7 +42,6 @@ import org.yakindu.sct.model.stext.stext.TimeUnit
 import org.yakindu.sct.model.stext.stext.VariableDefinition
 
 import static extension org.eclipse.emf.ecore.util.EcoreUtil.*
-import org.yakindu.base.expressions.expressions.FloatLiteral
 
 class SequenceBuilder {
 
@@ -53,7 +53,8 @@ class SequenceBuilder {
 
 	@Inject extension ITypeValueProvider 
 
-	@Inject @Named("ADD_TRACES")
+	@Inject
+	@Named("ADD_TRACES")
 	boolean _addTraceSteps
 
 	static String DEFAULT_SEQUENCE_NAME = "default"