|
|
@@ -16,7 +16,6 @@ import org.yakindu.sct.generator.core.impl.IExecutionFlowGenerator
|
|
|
import org.yakindu.sct.model.sexec.ExecutionFlow
|
|
|
import org.yakindu.sct.model.sgen.GeneratorEntry
|
|
|
import org.yakindu.sct.model.sgraph.Statechart
|
|
|
-import org.yakindu.sct.generator.core.filesystem.ISCTFileSystemAccess
|
|
|
|
|
|
/**
|
|
|
* This is the C code generators main class.
|
|
|
@@ -31,35 +30,34 @@ class CGenerator implements IExecutionFlowGenerator {
|
|
|
@Inject extension StatemachineRequiredHeader
|
|
|
@Inject extension Navigation
|
|
|
@Inject extension GenmodelEntries
|
|
|
-
|
|
|
@Inject extension Naming
|
|
|
|
|
|
+ /**
|
|
|
+ * @Deprecated use {@link #generate(ExecutionFlow, GeneratorEntry, IFileSystemAccess, ArtifactLocationProvider)} instead
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
override generate(ExecutionFlow flow, GeneratorEntry entry, IFileSystemAccess fsa) {
|
|
|
-// flow.generateTypesH(flow.sourceElement as Statechart, fsa, entry)
|
|
|
-// flow.generateStatemachineHeader(flow.sourceElement as Statechart, fsa, entry)
|
|
|
-// if (flow.timed || !flow.operations.empty || entry.tracingEnterState || entry.tracingExitState) {
|
|
|
-// flow.generateStatemachineRequiredHeader(flow.sourceElement as Statechart, fsa, entry)
|
|
|
-// }
|
|
|
-// flow.generateStatemachineSource(flow.sourceElement as Statechart, fsa, entry)
|
|
|
+ generate(flow, entry, fsa, new ArtifactLocationProvider())
|
|
|
+ }
|
|
|
+
|
|
|
+ def generate(ExecutionFlow flow, GeneratorEntry entry, IFileSystemAccess fsa, ArtifactLocationProvider locations) {
|
|
|
+ initArtifactLocations(flow, entry, locations)
|
|
|
+
|
|
|
+ flow.generateTypesH(flow.sourceElement as Statechart, fsa, entry)
|
|
|
+ flow.generateStatemachineHeader(flow.sourceElement as Statechart, fsa, entry, locations)
|
|
|
+ if (flow.timed || !flow.operations.empty || entry.tracingEnterState || entry.tracingExitState) {
|
|
|
+ flow.generateStatemachineRequiredHeader(flow.sourceElement as Statechart, fsa, entry)
|
|
|
+ }
|
|
|
+ flow.generateStatemachineSource(flow.sourceElement as Statechart, fsa, entry)
|
|
|
}
|
|
|
|
|
|
- def generate(ExecutionFlow flow, GeneratorEntry entry, ISCTFileSystemAccess sctFsa) {
|
|
|
- // initialize generation artifacts and their locations
|
|
|
- val locations = new ArtifactLocationProvider(sctFsa)
|
|
|
+ def protected initArtifactLocations(ExecutionFlow flow, GeneratorEntry entry, ArtifactLocationProvider locations) {
|
|
|
locations.addArtifact(flow.typesModule.h, IExecutionFlowGenerator.LIBRARY_TARGET_FOLDER_OUTPUT)
|
|
|
locations.addArtifact(flow.module.h, IExecutionFlowGenerator.TARGET_FOLDER_OUTPUT)
|
|
|
locations.addArtifact(flow.module.c, IExecutionFlowGenerator.TARGET_FOLDER_OUTPUT)
|
|
|
if (flow.timed || !flow.operations.empty || entry.tracingEnterState || entry.tracingExitState) {
|
|
|
locations.addArtifact(flow.module.client.h, IExecutionFlowGenerator.TARGET_FOLDER_OUTPUT)
|
|
|
}
|
|
|
-
|
|
|
- // perform generation
|
|
|
- flow.generateTypesH(flow.sourceElement as Statechart, sctFsa.IFileSystemAccess, entry)
|
|
|
- flow.generateStatemachineHeader(flow.sourceElement as Statechart, sctFsa.IFileSystemAccess, entry, locations)
|
|
|
- if (flow.timed || !flow.operations.empty || entry.tracingEnterState || entry.tracingExitState) {
|
|
|
- flow.generateStatemachineRequiredHeader(flow.sourceElement as Statechart, sctFsa.IFileSystemAccess, entry)
|
|
|
- }
|
|
|
- flow.generateStatemachineSource(flow.sourceElement as Statechart, sctFsa.IFileSystemAccess, entry)
|
|
|
}
|
|
|
|
|
|
}
|