Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-01-15 18:38:24 +0000
committerHenrik Rentz-Reichert2013-01-15 18:38:24 +0000
commit671466144e9be57d51cb050d332940bfa49f4e28 (patch)
tree082f39e1686320d514af7c03de223a308dd000b7
parentcf1bf7dbca7e7da16d1280490b7d2b0adcabd795 (diff)
downloadorg.eclipse.etrice-671466144e9be57d51cb050d332940bfa49f4e28.tar.gz
org.eclipse.etrice-671466144e9be57d51cb050d332940bfa49f4e28.tar.xz
org.eclipse.etrice-671466144e9be57d51cb050d332940bfa49f4e28.zip
[generator.c] generation of physical model
-rw-r--r--plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java33
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore3
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/Root.java8
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java3
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/RootImpl.java46
-rw-r--r--plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java8
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend19
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend (renamed from plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.xtend)369
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend (renamed from plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemRunnerGen.xtend)43
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java34
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java8
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java (renamed from plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java)1271
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java (renamed from plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemRunnerGen.java)109
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java2
17 files changed, 1228 insertions, 742 deletions
diff --git a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java
index ee5b85e44..57a6c4c1c 100644
--- a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java
+++ b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java
@@ -13,8 +13,11 @@
package org.eclipse.etrice.core.etmap.util;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.resource.Resource;
@@ -44,16 +47,40 @@ public class ETMapUtil {
@SuppressWarnings("serial")
private static class PathToPThread extends HashMap<String, PhysicalThread> {}
+
@SuppressWarnings("serial")
private static class PathToNodeRef extends HashMap<String, NodeRef> {}
+
@SuppressWarnings("serial")
private static class LThreadToPThread extends HashMap<LogicalThread, PhysicalThread> {}
+ @SuppressWarnings("serial")
+ private static class NodeRefToSubSysInstances extends HashMap<NodeRef, List<String>> {
+ void put(NodeRef nr, String path) {
+ List<String> list = get(nr);
+ if (list==null) {
+ list = new ArrayList<String>();
+ put(nr, list);
+ }
+ list.add(path);
+ }
+ }
+
private static PathToPThread path2pthread = new PathToPThread();
private static PathToNodeRef path2ndref = new PathToNodeRef();
+ private static NodeRefToSubSysInstances ndref2ssipaths = new NodeRefToSubSysInstances();
+ private static HashSet<NodeRef> noderefs = new HashSet<NodeRef>();
- public static NodeRef getNodeRef(ActorInstance ai) {
- String path = ai.getPath();
+ public static Collection<NodeRef> getNodeRefs() {
+ return noderefs;
+ }
+
+ public static List<String> getSubSystemInstancePaths(NodeRef nr) {
+ return ndref2ssipaths.get(nr);
+ }
+
+ public static NodeRef getNodeRef(StructureInstance si) {
+ String path = si.getPath();
NodeRef nodeRef = path2ndref.get(path);
return nodeRef;
}
@@ -98,6 +125,8 @@ public class ETMapUtil {
+InstanceBase.pathDelim+ssmp.getLogicalSubSys().getName();
path2ndref.put(path, ssmp.getNode());
+ ndref2ssipaths.put(ssmp.getNode(), path);
+ noderefs.add(ssmp.getNode());
LThreadToPThread lthread2pthread = new LThreadToPThread();
for (ThreadMapping tmp : ssmp.getThreadMappings()) {
diff --git a/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore b/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore
index cd46381ce..41a9ee253 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore
+++ b/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore
@@ -11,6 +11,9 @@
<eOperations name="getExpandedActorClass" eType="#//ExpandedActorClass">
<eParameters name="ai" eType="#//ActorInstance"/>
</eOperations>
+ <eOperations name="getInstance" eType="#//StructureInstance">
+ <eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="library" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="systemInstances" upperBound="-1"
eType="#//SystemInstance" containment="true"/>
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/Root.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/Root.java
index 114fc9906..a9a4e540a 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/Root.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/Root.java
@@ -261,6 +261,14 @@ public interface Root extends EObject {
*/
ExpandedActorClass getExpandedActorClass(ActorInstance ai);
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ StructureInstance getInstance(String path);
+
// TODO: is this the right place ?
HashSet<DataClass> getReferencedDataClasses(DataClass cls);
HashSet<DataClass> getReferencedDataClasses(ActorClass cls);
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java
index 502f8ca63..7e5934c1a 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java
@@ -1170,6 +1170,9 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
op = addEOperation(rootEClass, this.getExpandedActorClass(), "getExpandedActorClass", 0, 1, IS_UNIQUE, IS_ORDERED);
addEParameter(op, this.getActorInstance(), "ai", 0, 1, IS_UNIQUE, IS_ORDERED);
+ op = addEOperation(rootEClass, this.getStructureInstance(), "getInstance", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, ecorePackage.getEString(), "path", 0, 1, IS_UNIQUE, IS_ORDERED);
+
initEClass(instanceBaseEClass, InstanceBase.class, "InstanceBase", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getInstanceBase_Name(), ecorePackage.getEString(), "name", null, 0, 1, InstanceBase.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getInstanceBase_Path(), ecorePackage.getEString(), "path", null, 0, 1, InstanceBase.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/RootImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/RootImpl.java
index d04ef6212..90b2a629c 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/RootImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/RootImpl.java
@@ -40,7 +40,9 @@ import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance;
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.SystemInstance;
@@ -436,6 +438,50 @@ public class RootImpl extends EObjectImpl implements Root {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public StructureInstance getInstance(String path) {
+ if (!path.startsWith(Character.toString(InstanceBase.pathDelim)))
+ return null;
+
+ path = path.substring(1);
+ String[] segments = path.split(Character.toString(InstanceBase.pathDelim));
+ if (segments.length<=1)
+ return null;
+
+ String seg = segments[0];
+ for (SystemInstance si : getSystemInstances()) {
+ if (si.getName().equals(seg)) {
+ seg = segments[1];
+ for (SubSystemInstance ssi : si.getInstances()) {
+ if (ssi.getName().equals(seg)) {
+ StructureInstance inst = ssi;
+ int i = 2;
+ while (i<segments.length && inst!=null) {
+ boolean found = false;
+ for (ActorInstance ai : inst.getInstances()) {
+ if (ai.getName().equals(segments[i])) {
+ inst = ai;
+ ++i;
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ return null;
+ }
+ return inst;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
@Override
diff --git a/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF
index f91e8ba53..c5fba5cd1 100644
--- a/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF
@@ -9,14 +9,16 @@ Require-Bundle: org.eclipse.etrice.core.room.ui;bundle-version="0.3.0",
org.eclipse.etrice.core.genmodel;bundle-version="0.3.0",
org.eclipse.etrice.generator;bundle-version="0.3.0",
org.eclipse.etrice.generator.doc;bundle-version="0.3.0",
+ org.eclipse.etrice.generator.config;bundle-version="0.3.0",
+ org.eclipse.etrice.core.etmap;bundle-version="0.3.0",
+ org.eclipse.etrice.core.etphys;bundle-version="0.3.0",
org.eclipse.core.resources;bundle-version="3.6.0",
org.eclipse.core.runtime;bundle-version="3.6.0",
org.eclipse.ui;bundle-version="3.7.0",
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.xtend.lib;bundle-version="2.3.0",
org.eclipse.xtext.generator;bundle-version="2.1.1",
- org.eclipse.xtext.util;bundle-version="2.1.1",
- org.eclipse.etrice.generator.config;bundle-version="0.2.0"
+ org.eclipse.xtext.util;bundle-version="2.1.1"
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.etrice.generator.c
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java
index b53b5cf1b..812a3c0ba 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java
@@ -15,6 +15,7 @@ package org.eclipse.etrice.generator.c;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.etrice.core.etmap.util.ETMapUtil;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.IDataConfiguration;
@@ -120,6 +121,13 @@ public class Main extends AbstractGenerator {
if (!validator.validate(genModel))
return false;
+ ETMapUtil.processModels(genModel, getResourceSet());
+// if (debug) {
+// logger.logInfo("-- begin dump of mappings");
+// logger.logInfo(ETMapUtil.dumpMappings());
+// logger.logInfo("-- end dump of mappings");
+// }
+
logger.logInfo("-- starting code generation");
fileAccess.setOutputPath("src-gen/");
mainGenerator.doGenerate(genModel.eResource(), fileAccess);
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
index a22a032ba..934109190 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
@@ -34,6 +34,8 @@ import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.VarDecl
import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.generator.generic.RoomExtensions
+import org.eclipse.etrice.core.etphys.eTPhys.NodeRef
+import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
@Singleton
class CExtensions implements ILanguageExtension {
@@ -91,6 +93,23 @@ class CExtensions implements ILanguageExtension {
def String getDispSourceFileName(RoomClass rc) {
return rc.name+"_Disp.h";
}
+
+ // used
+ def String getCHeaderFileName(NodeRef nr, SubSystemInstance ssi) {
+ return nr.name+"_"+ssi.name+".h";
+ }
+
+ def String getCSourceFileName(NodeRef nr, SubSystemInstance ssi) {
+ return nr.name+"_"+ssi.name+".c";
+ }
+
+ def String getInstSourceFileName(NodeRef nr, SubSystemInstance ssi) {
+ return nr.name+"_"+ssi.name+"_Inst.h";
+ }
+
+ def String getDispSourceFileName(NodeRef nr, SubSystemInstance ssi) {
+ return nr.name+"_"+ssi.name+"_Disp.h";
+ }
def getIncludeGuardString(String filename){
'''_«filename.toUpperCase»_H_'''
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend
index 7a8a45971..29df48d56 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend
@@ -20,7 +20,7 @@ import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.xtext.generator.IFileSystemAccess
import org.eclipse.xtext.generator.IGenerator
import org.eclipse.etrice.generator.generic.PrepareFileSystem
-import org.eclipse.etrice.generator.c.gen.SubSystemClassGen
+import org.eclipse.etrice.generator.c.gen.NodeGen
@Singleton
class MainGen implements IGenerator {
@@ -28,8 +28,8 @@ class MainGen implements IGenerator {
@Inject DataClassGen dataClassGen
@Inject ProtocolClassGen protocolClassGen
@Inject ActorClassGen actorClassGen
- @Inject SubSystemClassGen subsystemClassGen
- @Inject SubSystemRunnerGen subsystemRunnerGen
+ @Inject NodeGen subsystemClassGen
+ @Inject NodeRunnerGen subsystemRunnerGen
@Inject PrepareFileSystem prepFS
override void doGenerate(Resource resource, IFileSystemAccess fsa) {
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
index 7f45539c0..44d57d551 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
@@ -26,6 +26,7 @@ import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
import org.eclipse.etrice.core.room.ActorCommunicationType
import org.eclipse.etrice.core.room.CommunicationType
import org.eclipse.etrice.core.room.ProtocolClass
+import org.eclipse.etrice.core.etmap.util.ETMapUtil
import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
@@ -34,53 +35,59 @@ import org.eclipse.xtext.generator.JavaIoFileSystemAccess
import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
@Singleton
-class SubSystemClassGen {
+class NodeGen {
@Inject extension JavaIoFileSystemAccess fileAccess
- @Inject extension CExtensions stdExt
- @Inject extension RoomExtensions roomExt
+ @Inject extension CExtensions
+ @Inject extension RoomExtensions
@Inject extension ProcedureHelpers helpers
@Inject Initialization attrInitGenAddon
@Inject ILanguageExtension languageExt
@Inject ILogger logger
def doGenerate(Root root) {
- for (ssi: root.subSystemInstances) {
- var path = ssi.subSystemClass.generationTargetPath+ssi.subSystemClass.getPath
- var file = ssi.subSystemClass.getCHeaderFileName
- logger.logInfo("generating SubSystemClass declaration: '"+file+"' in '"+path+"'")
- fileAccess.setOutputPath(path)
- fileAccess.generateFile(file, root.generateHeaderFile(ssi))
-
- file = ssi.subSystemClass.getCSourceFileName
- logger.logInfo("generating SubSystemClass implementation: '"+file+"' in '"+path+"'")
- fileAccess.setOutputPath(path)
- fileAccess.generateFile(file, root.generateSourceFile(ssi))
-
- file = ssi.subSystemClass.getInstSourceFileName
- logger.logInfo("generating SubSystemClass instance file: '"+file+"' in '"+path+"'")
- fileAccess.setOutputPath(path)
- fileAccess.generateFile(file, root.generateInstanceFile(ssi))
-
- file = ssi.subSystemClass.getDispSourceFileName
- logger.logInfo("generating SubSystemClass dispatcher file: '"+file+"' in '"+path+"'")
- fileAccess.setOutputPath(path)
- fileAccess.generateFile(file, root.generateDispatcherFile(ssi))
+ for (nr : ETMapUtil::getNodeRefs()) {
+ for (instpath : ETMapUtil::getSubSystemInstancePaths(nr)) {
+ val ssi = root.getInstance(instpath) as SubSystemInstance
+ var filepath = ssi.subSystemClass.generationTargetPath+ssi.subSystemClass.getPath
+ var file = nr.getCHeaderFileName(ssi)
+ logger.logInfo("generating Node declaration: '"+file+"' in '"+filepath+"'")
+ fileAccess.setOutputPath(filepath)
+ fileAccess.generateFile(file, root.generateHeaderFile(ssi))
+
+ file = nr.getCSourceFileName(ssi)
+ logger.logInfo("generating Node implementation: '"+file+"' in '"+filepath+"'")
+ fileAccess.setOutputPath(filepath)
+ fileAccess.generateFile(file, root.generateSourceFile(ssi))
+
+ file = nr.getInstSourceFileName(ssi)
+ logger.logInfo("generating Node instance file: '"+file+"' in '"+filepath+"'")
+ fileAccess.setOutputPath(filepath)
+ fileAccess.generateFile(file, root.generateInstanceFile(ssi))
+
+ file = nr.getDispSourceFileName(ssi)
+ logger.logInfo("generating Node dispatcher file: '"+file+"' in '"+filepath+"'")
+ fileAccess.setOutputPath(filepath)
+ fileAccess.generateFile(file, root.generateDispatcherFile(ssi))
+ }
}
}
def private generateHeaderFile(Root root, SubSystemInstance ssi) {
+ val nr = ETMapUtil::getNodeRef(ssi)
val ssc = ssi.subSystemClass
+ val clsname = nr.name+"_"+ssi.name
'''
/**
* @author generated by eTrice
*
- * Header File of SubSystemClass «ssc.name»
+ * Header File of Node «nr.name» with SubSystem «ssi.name»
*
*/
- «generateIncludeGuardBegin(ssc.name)»
+ «generateIncludeGuardBegin(clsname)»
+««« TODOCGENPHYS: user code?
«helpers.userCode(ssc.userCode1)»
@@ -88,39 +95,42 @@ class SubSystemClassGen {
* init -> start -> run (loop) -> stop -> destroy
*/
- void «ssc.name»_init(void); /* lifecycle init */
- void «ssc.name»_start(void); /* lifecycle start */
+ void «clsname»_init(void); /* lifecycle init */
+ void «clsname»_start(void); /* lifecycle start */
- void «ssc.name»_run(void); /* lifecycle run */
+ void «clsname»_run(void); /* lifecycle run */
- void «ssc.name»_stop(void); /* lifecycle stop */
- void «ssc.name»_destroy(void); /* lifecycle destroy */
+ void «clsname»_stop(void); /* lifecycle stop */
+ void «clsname»_destroy(void); /* lifecycle destroy */
- void SubSysClass_shutdown(void); /* shutdown the dispatcher loop */
+ void «clsname»_shutdown(void); /* shutdown the dispatcher loop */
+««« TODOCGENPHYS: user code?
«helpers.userCode(ssc.userCode2)»
- «generateIncludeGuardEnd(ssc.name)»
+ «generateIncludeGuardEnd(clsname)»
'''
}
def private generateSourceFile(Root root, SubSystemInstance ssi) {
+ val nr = ETMapUtil::getNodeRef(ssi)
val ssc = ssi.subSystemClass
+ val clsname = nr.name+"_"+ssi.name
'''
/**
* @author generated by eTrice
*
- * Source File of SubSystemClass «ssc.name»
+ * Source File of Node «nr.name» with SubSystem «ssi.name»
*
*/
- #include "«ssc.getCHeaderFileName»"
+ #include "«nr.getCHeaderFileName(ssi)»"
/* include instances for all classes */
- #include "«ssc.getInstSourceFileName»"
- #include "«ssc.getDispSourceFileName»"
+ #include "«nr.getInstSourceFileName(ssi)»"
+ #include "«nr.getDispSourceFileName(ssi)»"
#include "debugging/etLogger.h"
#include "debugging/etMSCLogger.h"
@@ -128,95 +138,158 @@ class SubSystemClassGen {
#include "platform/etTimer.h"
#include "etRuntimeConfig.h"
+««« TODOCGENPHYS: user code?
«helpers.userCode(ssc.userCode3)»
- /* data for SubSysten «ssc.name» */
- typedef struct «ssc.name» {
+ /* data for Node «nr.name» with SubSytsem «ssi.name» */
+ typedef struct «clsname» {
char *name;
volatile int shutdownRequest;
- } «ssc.name»;
+ } «clsname»;
- static «ssc.name» «ssc.name»Inst = {"«ssc.name»",0};
+ static «clsname» «clsname»Inst = {"«clsname»", 0};
- void «ssc.name»_initActorInstances(void);
- void «ssc.name»_constructActorInstances(void);
+ void «clsname»_initActorInstances(void);
+ void «clsname»_constructActorInstances(void);
- void «ssc.name»_init(void){
- ET_MSC_LOGGER_SYNC_ENTRY("SubSys", "init")
- etLogger_logInfoF("%s_init", «ssc.name»Inst.name);
+ static void «clsname»_initMessageServices(void) {
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "initMessageServices")
+
+ /* filling all message service threads with data */
+ «FOR thread: nr.type.threads»
+ msgService_«thread.name».thread.stacksize = «thread.stacksize»;
+ msgService_«thread.name».thread.priority = «thread.prio»;
+ msgService_«thread.name».thread.threadName = "«thread.name»";
+ msgService_«thread.name».thread.threadFunction = (etThreadFunction) etMessageService_execute;
+ msgService_«thread.name».thread.threadFunctionData = &msgService_«thread.name»;
+ «ENDFOR»
+
+ /* initialization of all message services */
+ «FOR thread: nr.type.threads»
+ etMessageService_init(&msgService_«thread.name», &msgBuffer_«thread.name», MESSAGE_POOL_MAX, MESSAGE_BLOCK_SIZE, MsgDispatcher_«thread.name»_receiveMessage);
+ «ENDFOR»
+
+ ET_MSC_LOGGER_SYNC_EXIT
+ }
+
+ static void «clsname»_startMessageServices(void) {
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "startMessageServices")
+
+ «FOR thread: nr.type.threads»
+ etMessageService_start(&msgService_«thread.name»);
+ «ENDFOR»
+
+ ET_MSC_LOGGER_SYNC_EXIT
+ }
+
+ static void «clsname»_stopMessageServices(void) {
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "stopMessageServices")
+
+ «FOR thread: nr.type.threads»
+ etMessageService_stop(&msgService_«thread.name»);
+ «ENDFOR»
+
+ ET_MSC_LOGGER_SYNC_EXIT
+ }
+
+ static void «clsname»_destroyMessageServices(void) {
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "destroyMessageServices")
+
+ «FOR thread: nr.type.threads»
+ etMessageService_destroy(&msgService_«thread.name»);
+ «ENDFOR»
+
+ ET_MSC_LOGGER_SYNC_EXIT
+ }
+
+ void «clsname»_init(void) {
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "init")
+ etLogger_logInfoF("%s_init", «clsname»Inst.name);
/* construct all actors */
- «ssc.name»_constructActorInstances();
+ «clsname»_constructActorInstances();
/* initialization of all message services */
- etMessageService_init(&msgService_Thread1, msgBuffer_Thread1, MESSAGE_POOL_MAX, MESSAGE_BLOCK_SIZE, MsgDispatcher_Thread1_receiveMessage);
+ «clsname»_initMessageServices();
/* init all actors */
- «ssc.name»_initActorInstances();
+ «clsname»_initActorInstances();
ET_MSC_LOGGER_SYNC_EXIT
}
- void «ssc.name»_start(void){
- ET_MSC_LOGGER_SYNC_ENTRY("SubSys", "start")
- etLogger_logInfoF("%s_start", «ssc.name»Inst.name);
+ void «clsname»_start(void) {
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "start")
+ etLogger_logInfoF("%s_start", «clsname»Inst.name);
+ «clsname»_startMessageServices();
ET_MSC_LOGGER_SYNC_EXIT
}
- void «ssc.name»_run(void){
- ET_MSC_LOGGER_SYNC_ENTRY("SubSys", "run")
+ void «clsname»_run(void) {
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "run")
- #ifdef ET_RUNTIME_ENDLESS
- while(!(«ssc.name»Inst.shutdownRequest)){
- if (etTimer_executeNeeded()){
- etMessageService_execute(&msgService_Thread1);
- «generateDatadrivenExecutes(root, ssi)»
- }
- }
- #else
- uint32 loopCounter = 0;
- while(!(«ssc.name»Inst.shutdownRequest)){
- if (etTimer_executeNeeded()){
- etMessageService_execute(&msgService_Thread1);
- «generateDatadrivenExecutes(root, ssi)»
- etLogger_logInfo("Execute");
- if (loopCounter++ > ET_RUNTIME_MAXLOOP){
- break;
- }
- }
- }
- #endif
+««« TODOCGENPHYS: main loop
+ etThread_sleep(1000);
+
+««« #ifdef ET_RUNTIME_ENDLESS
+««« while(!(«ssc.name»Inst.shutdownRequest)){
+««« if (etTimer_executeNeeded()){
+««« etMessageService_execute(&msgService_Thread1);
+««« «generateDatadrivenExecutes(root, ssi)»
+««« }
+««« }
+««« #else
+««« uint32 loopCounter = 0;
+««« while(!(«ssc.name»Inst.shutdownRequest)){
+««« if (etTimer_executeNeeded()){
+««« etMessageService_execute(&msgService_Thread1);
+««« «generateDatadrivenExecutes(root, ssi)»
+««« etLogger_logInfo("Execute");
+««« if (loopCounter++ > ET_RUNTIME_MAXLOOP){
+««« break;
+««« }
+««« }
+««« }
+««« #endif
ET_MSC_LOGGER_SYNC_EXIT
}
- void «ssc.name»_stop(void){
- ET_MSC_LOGGER_SYNC_ENTRY("SubSys", "stop")
- etLogger_logInfoF("%s_stop", «ssc.name»Inst.name);
+ void «clsname»_stop(void){
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "stop")
+ etLogger_logInfoF("%s_stop", «clsname»Inst.name);
+
+ «clsname»_stopMessageServices();
+
ET_MSC_LOGGER_SYNC_EXIT
}
- void «ssc.name»_destroy(void){
- ET_MSC_LOGGER_SYNC_ENTRY("SubSys", "destroy")
- etLogger_logInfoF("%s_destroy", «ssc.name»Inst.name);
+ void «clsname»_destroy(void){
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "destroy")
+ etLogger_logInfoF("%s_destroy", «clsname»Inst.name);
«FOR ai : ssi.allContainedInstances.reverseView»
«IF !ai.actorClass.operations.filter(op|op.destructor).empty»
«languageExt.memberInUse(ai.actorClass.name, languageExt.destructorName(ai.actorClass.name))»(&«ai.path.getPathName()»);
«ENDIF»
«ENDFOR»
+
+ «clsname»_destroyMessageServices();
+
ET_MSC_LOGGER_SYNC_EXIT
}
- void SubSysClass_shutdown(void){
- ET_MSC_LOGGER_SYNC_ENTRY("SubSys", "shutdown")
- etLogger_logInfoF("%s_shutdown", «ssc.name»Inst.name);
- «ssc.name»Inst.shutdownRequest = 1;
+ void «clsname»_shutdown(void){
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "shutdown")
+ etLogger_logInfoF("%s_shutdown", «clsname»Inst.name);
+
+ «clsname»Inst.shutdownRequest = 1;
+
ET_MSC_LOGGER_SYNC_EXIT
}
- void «ssc.name»_constructActorInstances(void){
- ET_MSC_LOGGER_SYNC_ENTRY("«ssc.name»", "constructActorInstances")
+ void «clsname»_constructActorInstances(void){
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "constructActorInstances")
«FOR ai : ssi.allContainedInstances»
«IF !ai.actorClass.operations.filter(op|op.constructor).empty»
«languageExt.memberInUse(ai.actorClass.name, languageExt.constructorName(ai.actorClass.name))»(&«ai.path.getPathName()»);
@@ -225,8 +298,8 @@ class SubSystemClassGen {
ET_MSC_LOGGER_SYNC_EXIT
}
- void «ssc.name»_initActorInstances(void){
- ET_MSC_LOGGER_SYNC_ENTRY("«ssc.name»", "initActorInstances")
+ void «clsname»_initActorInstances(void){
+ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "initActorInstances")
«FOR ai : ssi.allContainedInstances»
«ai.actorClass.name»_init(&«ai.path.getPathName()»);
«ENDFOR»
@@ -237,12 +310,12 @@ class SubSystemClassGen {
}
def private generateInstanceFile(Root root, SubSystemInstance ssi) {
- val ssc = ssi.subSystemClass
+ val nr = ETMapUtil::getNodeRef(ssi)
'''
/**
* @author generated by eTrice
*
- * Instance File of SubSystemClass «ssc.name»
+ * Instance File of Node «nr.name» with SubSystem «ssi.name»
* - instantiation of all actor instances and port instances
* - configuration of data and connection of ports
*/
@@ -252,9 +325,11 @@ class SubSystemClassGen {
/* instantiation of message services */
- /* MessageService for Thread1 */
- static uint8 msgBuffer_Thread1[MESSAGE_POOL_MAX*MESSAGE_BLOCK_SIZE];
- static etMessageService msgService_Thread1;
+ /* MessageServices */
+ «FOR thread: nr.type.threads»
+ static uint8 msgBuffer_«thread.name»;
+ static etMessageService msgService_«thread.name»;
+ «ENDFOR»
/* include all used ActorClasses */
@@ -375,11 +450,12 @@ class SubSystemClassGen {
'''}
def private String genPortInitializer(Root root, ActorInstance ai, InterfaceItemInstance pi) {
- var objId = if (pi.peers.empty) 0 else pi.peers.get(0).objId
- var idx = if (pi.peers.empty) 0 else pi.peers.get(0).peers.indexOf(pi)
+ val objId = if (pi.peers.empty) 0 else pi.peers.get(0).objId
+ val idx = if (pi.peers.empty) 0 else pi.peers.get(0).peers.indexOf(pi)
+ val msgSvc = if (pi.peers.empty) "NULL" else "&msgService_"+ETMapUtil::getPhysicalThread(pi.peers.get(0).eContainer as ActorInstance).name
"{"+getInterfaceItemInstanceData(pi)+","
- +"&msgService_Thread1, "
+ +msgSvc+", "
+(objId+idx)+", "
+(root.getExpandedActorClass(ai).getInterfaceItemLocalId(pi.interfaceItem)+1)
+"} /* Port "+pi.name+" */"
@@ -422,13 +498,14 @@ class SubSystemClassGen {
var result = ""
for (p: pi.peers) {
- var idx = pi.peers.indexOf(p)
- var comma = if (idx<pi.peers.size-1) "," else ""
+ val idx = pi.peers.indexOf(p)
+ val comma = if (idx<pi.peers.size-1) "," else ""
+ val thread = ETMapUtil::getPhysicalThread(p.eContainer as ActorInstance).name
var iiiD = getInterfaceItemInstanceData(pi)
iiiD = if (iiiD.equals("0")) iiiD+"," else iiiD+"["+idx+"],"
result = result +
"{"+iiiD
- +"&msgService_Thread1, "
+ +"&msgService_"+thread+", "
+p.objId+", "
+(root.getExpandedActorClass(ai).getInterfaceItemLocalId(pi.interfaceItem)+1)+", "
+idx
@@ -439,70 +516,72 @@ class SubSystemClassGen {
}
def private generateDispatcherFile(Root root, SubSystemInstance ssi) {
- val ssc = ssi.subSystemClass
+ val nr = ETMapUtil::getNodeRef(ssi)
'''
/**
* @author generated by eTrice
*
- * Dispatcher File of SubSystemClass «ssc.name»
+ * Dispatcher File of Node «nr.name» with SubSystem «ssi.name»
* - one generated dispatcher for each MessageService (Thread)
*/
-
+
#include "messaging/etMessageReceiver.h"
#include "debugging/etLogger.h"
#include "debugging/etMSCLogger.h"
- static void MsgDispatcher_Thread1_receiveMessage(const etMessage* msg){
- ET_MSC_LOGGER_SYNC_ENTRY("MsgDispatcher_Thread1", "receiveMessage")
- switch(msg->address){
-
- «FOR ai : ssi.allContainedInstances»
- /* interface items of «ai.path» */
- «FOR pi : ai. orderedIfItemInstances.filter(p|p.protocol.commType==CommunicationType::EVENT_DRIVEN)»
- «IF pi.replicated»
- «FOR peer: pi.peers»
- case «pi.objId+pi.peers.indexOf(peer)»:
- «IF (pi.protocol.handlesReceive(pi.isConjugated()))»
- switch (msg->evtID){
- «FOR h:getReceiveHandlers(pi.protocol,pi.isConjugated())»
- case «pi.protocol.name»_«h.msg.codeName»:
- «pi.protocol.getPortClassName(pi.isConjugated)»_«h.msg.name»_receiveHandler((etPort *)&«ai.path.pathName»_const.«pi.name».ports[«pi.peers.indexOf(peer)»],msg,(void*)&«ai.path.pathName»,«ai.actorClass.name»_receiveMessage);
+ «FOR thread: nr.type.threads»
+ static void MsgDispatcher_«thread.name»_receiveMessage(const etMessage* msg){
+ ET_MSC_LOGGER_SYNC_ENTRY("MsgDispatcher_«thread.name»", "receiveMessage")
+ switch(msg->address){
+
+ «FOR ai : ssi.allContainedInstances»
+ /* interface items of «ai.path» */
+ «FOR pi : ai. orderedIfItemInstances.filter(p|p.protocol.commType==CommunicationType::EVENT_DRIVEN)»
+ «IF pi.replicated»
+ «FOR peer: pi.peers»
+ case «pi.objId+pi.peers.indexOf(peer)»:
+ «IF (pi.protocol.handlesReceive(pi.isConjugated()))»
+ switch (msg->evtID){
+ «FOR h:getReceiveHandlers(pi.protocol,pi.isConjugated())»
+ case «pi.protocol.name»_«h.msg.codeName»:
+ «pi.protocol.getPortClassName(pi.isConjugated)»_«h.msg.name»_receiveHandler((etPort *)&«ai.path.pathName»_const.«pi.name».ports[«pi.peers.indexOf(peer)»],msg,(void*)&«ai.path.pathName»,«ai.actorClass.name»_receiveMessage);
+ break;
+ «ENDFOR»
+ default: «ai.actorClass.name»_receiveMessage((void*)&«ai.path.pathName»,(etPort*)&«ai.path.pathName»_const.«pi.name».ports[«pi.peers.indexOf(peer)»], msg);
break;
- «ENDFOR»
- default: «ai.actorClass.name»_receiveMessage((void*)&«ai.path.pathName»,(etPort*)&«ai.path.pathName»_const.«pi.name».ports[«pi.peers.indexOf(peer)»], msg);
+ }
+ «ELSE»
+ «ai.actorClass.name»_receiveMessage((void*)&«ai.path.pathName»,(etPort*)&«ai.path.pathName»_const.«pi.name».ports[«pi.peers.indexOf(peer)»], msg);
+ «ENDIF»
+ break;
+ «ENDFOR»
+ «ELSE»
+ case «pi.objId»:
+ «IF (pi.protocol.handlesReceive(pi.isConjugated()))»
+ switch (msg->evtID){
+ «FOR h:getReceiveHandlers(pi.protocol,pi.isConjugated())»
+ case «pi.protocol.name»_«h.msg.codeName»:
+ «pi.protocol.getPortClassName(pi.isConjugated)»_«h.msg.name»_receiveHandler((etPort *)&«ai.path.pathName»_const.«pi.name»,msg,(void*)&«ai.path.pathName»,«ai.actorClass.name»_receiveMessage);
break;
- }
+ «ENDFOR»
+ default: «ai.actorClass.name»_receiveMessage((void*)&«ai.path.pathName»,(etPort*)&«ai.path.pathName»_const.«pi.name», msg);
+ break;
+ }
«ELSE»
- «ai.actorClass.name»_receiveMessage((void*)&«ai.path.pathName»,(etPort*)&«ai.path.pathName»_const.«pi.name».ports[«pi.peers.indexOf(peer)»], msg);
+ «ai.actorClass.name»_receiveMessage((void*)&«ai.path.pathName»,(etPort*)&«ai.path.pathName»_const.«pi.name», msg);
«ENDIF»
break;
- «ENDFOR»
- «ELSE»
- case «pi.objId»:
- «IF (pi.protocol.handlesReceive(pi.isConjugated()))»
- switch (msg->evtID){
- «FOR h:getReceiveHandlers(pi.protocol,pi.isConjugated())»
- case «pi.protocol.name»_«h.msg.codeName»:
- «pi.protocol.getPortClassName(pi.isConjugated)»_«h.msg.name»_receiveHandler((etPort *)&«ai.path.pathName»_const.«pi.name»,msg,(void*)&«ai.path.pathName»,«ai.actorClass.name»_receiveMessage);
- break;
- «ENDFOR»
- default: «ai.actorClass.name»_receiveMessage((void*)&«ai.path.pathName»,(etPort*)&«ai.path.pathName»_const.«pi.name», msg);
- break;
- }
- «ELSE»
- «ai.actorClass.name»_receiveMessage((void*)&«ai.path.pathName»,(etPort*)&«ai.path.pathName»_const.«pi.name», msg);
«ENDIF»
- break;
- «ENDIF»
+ «ENDFOR»
«ENDFOR»
- «ENDFOR»
-
- default:
- etLogger_logErrorF("MessageService_Thread1_receiveMessage: address %d does not exist ", msg->address);
- break;
+
+ default:
+ etLogger_logErrorF("MessageService_«thread.name»_receiveMessage: address %d does not exist ", msg->address);
+ break;
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
}
- ET_MSC_LOGGER_SYNC_EXIT
- }
+ «ENDFOR»
'''
}
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemRunnerGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend
index 18dd17143..099b075f5 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemRunnerGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend
@@ -19,32 +19,41 @@ import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
import org.eclipse.xtext.generator.JavaIoFileSystemAccess
import org.eclipse.etrice.generator.generic.RoomExtensions
+import org.eclipse.etrice.core.etmap.util.ETMapUtil
@Singleton
-class SubSystemRunnerGen {
+class NodeRunnerGen {
@Inject extension JavaIoFileSystemAccess fileAccess
- @Inject extension RoomExtensions roomExt
+ @Inject extension CExtensions
+ @Inject extension RoomExtensions
def doGenerate(Root root) {
- for (sc: root.subSystemInstances) {
- fileAccess.setOutputPath(sc.subSystemClass.generationTargetPath+sc.subSystemClass.getPath)
- fileAccess.generateFile( sc.subSystemClass.name+"_Runner.c", root.generateSourceFile(sc))
+ var first = true
+ for (nr : ETMapUtil::getNodeRefs()) {
+ for (instpath : ETMapUtil::getSubSystemInstancePaths(nr)) {
+ val ssi = root.getInstance(instpath) as SubSystemInstance
+ val clsname = nr.name+"_"+ssi.name
+ fileAccess.setOutputPath(ssi.subSystemClass.generationTargetPath+ssi.subSystemClass.getPath)
+ fileAccess.generateFile( clsname+"_Runner.c", root.generateSourceFile(ssi, first))
+ first = false
+ }
}
}
- def generateSourceFile(Root root, SubSystemInstance ssi) {
- val ssc = ssi.subSystemClass
+ def generateSourceFile(Root root, SubSystemInstance ssi, boolean first) {
+ val nr = ETMapUtil::getNodeRef(ssi)
+ val clsname = nr.name+"_"+ssi.name
'''
/**
* @author generated by eTrice
*
- * this class contains the main function running component «ssi.name»
- * it instantiates «ssi.name» and starts and ends the lifecycle
+ * this class contains the main function running Node «nr.name» with SubSystem «ssi.name»
+ * it instantiates Node «nr.name» with SubSystem «ssi.name» and starts and ends the lifecycle
*/
- #include "«ssc.name».h"
+ #include "«nr.getCHeaderFileName(ssi)»"
#include "debugging/etLogger.h"
#include "debugging/etMSCLogger.h"
@@ -56,26 +65,30 @@ class SubSystemRunnerGen {
* creates component and starts and stops the lifecycle
*/
+ «IF first»
int main(void) {
+ «ELSE»
+ static int main_unused(void) {
+ «ENDIF»
etUserEntry(); /* platform specific */
etLogger_logInfo("*** T H E B E G I N ***");
ET_MSC_LOGGER_OPEN("main");
/* startup sequence of lifecycle */
- «ssc.name»_init(); /* lifecycle init */
- «ssc.name»_start(); /* lifecycle start */
+ «clsname»_init(); /* lifecycle init */
+ «clsname»_start(); /* lifecycle start */
etUserPreRun(); /* platform specific */
/* run Scheduler */
- «ssc.name»_run();
+ «clsname»_run();
etUserPostRun(); /* platform specific */
/* shutdown sequence of lifecycle */
- «ssc.name»_stop(); /* lifecycle stop */
- «ssc.name»_destroy(); /* lifecycle destroy */
+ «clsname»_stop(); /* lifecycle stop */
+ «clsname»_destroy(); /* lifecycle destroy */
ET_MSC_LOGGER_CLOSE
etLogger_logInfo("*** T H E E N D ***");
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
index 00384db6e..a4f62aa9d 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
@@ -58,7 +58,7 @@ class StateMachineGen extends GenericStateMachineGenerator {
'''
«langExt.accessLevelPrivate»void setState(«ac.name»* self, int new_state) {
- self->state = new_state;
+ self->state = (etInt16) new_state;
}
«langExt.accessLevelPrivate»int getState(«ac.name»* self) {
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
index 892b86f47..c9cca287c 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
@@ -6,7 +6,9 @@ import com.google.inject.Singleton;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.etrice.core.etphys.eTPhys.NodeRef;
import org.eclipse.etrice.core.genmodel.etricegen.IDiagnostician;
+import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.DataType;
@@ -115,6 +117,38 @@ public class CExtensions implements ILanguageExtension {
return (_name + "_Disp.h");
}
+ public String getCHeaderFileName(final NodeRef nr, final SubSystemInstance ssi) {
+ String _name = nr.getName();
+ String _plus = (_name + "_");
+ String _name_1 = ssi.getName();
+ String _plus_1 = (_plus + _name_1);
+ return (_plus_1 + ".h");
+ }
+
+ public String getCSourceFileName(final NodeRef nr, final SubSystemInstance ssi) {
+ String _name = nr.getName();
+ String _plus = (_name + "_");
+ String _name_1 = ssi.getName();
+ String _plus_1 = (_plus + _name_1);
+ return (_plus_1 + ".c");
+ }
+
+ public String getInstSourceFileName(final NodeRef nr, final SubSystemInstance ssi) {
+ String _name = nr.getName();
+ String _plus = (_name + "_");
+ String _name_1 = ssi.getName();
+ String _plus_1 = (_plus + _name_1);
+ return (_plus_1 + "_Inst.h");
+ }
+
+ public String getDispSourceFileName(final NodeRef nr, final SubSystemInstance ssi) {
+ String _name = nr.getName();
+ String _plus = (_name + "_");
+ String _name_1 = ssi.getName();
+ String _plus_1 = (_plus + _name_1);
+ return (_plus_1 + "_Disp.h");
+ }
+
public CharSequence getIncludeGuardString(final String filename) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("_");
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java
index 26daa4b46..fcd44dd9a 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java
@@ -8,9 +8,9 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.generator.c.gen.ActorClassGen;
import org.eclipse.etrice.generator.c.gen.DataClassGen;
+import org.eclipse.etrice.generator.c.gen.NodeGen;
+import org.eclipse.etrice.generator.c.gen.NodeRunnerGen;
import org.eclipse.etrice.generator.c.gen.ProtocolClassGen;
-import org.eclipse.etrice.generator.c.gen.SubSystemClassGen;
-import org.eclipse.etrice.generator.c.gen.SubSystemRunnerGen;
import org.eclipse.etrice.generator.generic.PrepareFileSystem;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IGenerator;
@@ -28,10 +28,10 @@ public class MainGen implements IGenerator {
private ActorClassGen actorClassGen;
@Inject
- private SubSystemClassGen subsystemClassGen;
+ private NodeGen subsystemClassGen;
@Inject
- private SubSystemRunnerGen subsystemRunnerGen;
+ private NodeRunnerGen subsystemRunnerGen;
@Inject
private PrepareFileSystem prepFS;
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java
index 1e6792a4f..3417e9ed5 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java
@@ -5,16 +5,22 @@ import com.google.common.collect.Iterables;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.etmap.util.ETMapUtil;
+import org.eclipse.etrice.core.etphys.eTPhys.NodeClass;
+import org.eclipse.etrice.core.etphys.eTPhys.NodeRef;
+import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread;
import org.eclipse.etrice.core.genmodel.base.ILogger;
import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance;
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ActorCommunicationType;
@@ -48,15 +54,15 @@ import org.eclipse.xtext.xbase.lib.ListExtensions;
@Singleton
@SuppressWarnings("all")
-public class SubSystemClassGen {
+public class NodeGen {
@Inject
private JavaIoFileSystemAccess fileAccess;
@Inject
- private CExtensions stdExt;
+ private CExtensions _cExtensions;
@Inject
- private RoomExtensions roomExt;
+ private RoomExtensions _roomExtensions;
@Inject
private ProcedureHelpers helpers;
@@ -71,57 +77,58 @@ public class SubSystemClassGen {
private ILogger logger;
public void doGenerate(final Root root) {
- EList<SubSystemInstance> _subSystemInstances = root.getSubSystemInstances();
- for (final SubSystemInstance ssi : _subSystemInstances) {
- {
- SubSystemClass _subSystemClass = ssi.getSubSystemClass();
- String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass);
- SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass();
- String _path = this.roomExt.getPath(_subSystemClass_1);
- String path = (_generationTargetPath + _path);
- SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass();
- String file = this.stdExt.getCHeaderFileName(_subSystemClass_2);
- String _plus = ("generating SubSystemClass declaration: \'" + file);
- String _plus_1 = (_plus + "\' in \'");
- String _plus_2 = (_plus_1 + path);
- String _plus_3 = (_plus_2 + "\'");
- this.logger.logInfo(_plus_3);
- this.fileAccess.setOutputPath(path);
- CharSequence _generateHeaderFile = this.generateHeaderFile(root, ssi);
- this.fileAccess.generateFile(file, _generateHeaderFile);
- SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass();
- String _cSourceFileName = this.stdExt.getCSourceFileName(_subSystemClass_3);
- file = _cSourceFileName;
- String _plus_4 = ("generating SubSystemClass implementation: \'" + file);
- String _plus_5 = (_plus_4 + "\' in \'");
- String _plus_6 = (_plus_5 + path);
- String _plus_7 = (_plus_6 + "\'");
- this.logger.logInfo(_plus_7);
- this.fileAccess.setOutputPath(path);
- CharSequence _generateSourceFile = this.generateSourceFile(root, ssi);
- this.fileAccess.generateFile(file, _generateSourceFile);
- SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass();
- String _instSourceFileName = this.stdExt.getInstSourceFileName(_subSystemClass_4);
- file = _instSourceFileName;
- String _plus_8 = ("generating SubSystemClass instance file: \'" + file);
- String _plus_9 = (_plus_8 + "\' in \'");
- String _plus_10 = (_plus_9 + path);
- String _plus_11 = (_plus_10 + "\'");
- this.logger.logInfo(_plus_11);
- this.fileAccess.setOutputPath(path);
- CharSequence _generateInstanceFile = this.generateInstanceFile(root, ssi);
- this.fileAccess.generateFile(file, _generateInstanceFile);
- SubSystemClass _subSystemClass_5 = ssi.getSubSystemClass();
- String _dispSourceFileName = this.stdExt.getDispSourceFileName(_subSystemClass_5);
- file = _dispSourceFileName;
- String _plus_12 = ("generating SubSystemClass dispatcher file: \'" + file);
- String _plus_13 = (_plus_12 + "\' in \'");
- String _plus_14 = (_plus_13 + path);
- String _plus_15 = (_plus_14 + "\'");
- this.logger.logInfo(_plus_15);
- this.fileAccess.setOutputPath(path);
- CharSequence _generateDispatcherFile = this.generateDispatcherFile(root, ssi);
- this.fileAccess.generateFile(file, _generateDispatcherFile);
+ Collection<NodeRef> _nodeRefs = ETMapUtil.getNodeRefs();
+ for (final NodeRef nr : _nodeRefs) {
+ List<String> _subSystemInstancePaths = ETMapUtil.getSubSystemInstancePaths(nr);
+ for (final String instpath : _subSystemInstancePaths) {
+ {
+ StructureInstance _instance = root.getInstance(instpath);
+ final SubSystemInstance ssi = ((SubSystemInstance) _instance);
+ SubSystemClass _subSystemClass = ssi.getSubSystemClass();
+ String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass);
+ SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass();
+ String _path = this._roomExtensions.getPath(_subSystemClass_1);
+ String filepath = (_generationTargetPath + _path);
+ String file = this._cExtensions.getCHeaderFileName(nr, ssi);
+ String _plus = ("generating Node declaration: \'" + file);
+ String _plus_1 = (_plus + "\' in \'");
+ String _plus_2 = (_plus_1 + filepath);
+ String _plus_3 = (_plus_2 + "\'");
+ this.logger.logInfo(_plus_3);
+ this.fileAccess.setOutputPath(filepath);
+ CharSequence _generateHeaderFile = this.generateHeaderFile(root, ssi);
+ this.fileAccess.generateFile(file, _generateHeaderFile);
+ String _cSourceFileName = this._cExtensions.getCSourceFileName(nr, ssi);
+ file = _cSourceFileName;
+ String _plus_4 = ("generating Node implementation: \'" + file);
+ String _plus_5 = (_plus_4 + "\' in \'");
+ String _plus_6 = (_plus_5 + filepath);
+ String _plus_7 = (_plus_6 + "\'");
+ this.logger.logInfo(_plus_7);
+ this.fileAccess.setOutputPath(filepath);
+ CharSequence _generateSourceFile = this.generateSourceFile(root, ssi);
+ this.fileAccess.generateFile(file, _generateSourceFile);
+ String _instSourceFileName = this._cExtensions.getInstSourceFileName(nr, ssi);
+ file = _instSourceFileName;
+ String _plus_8 = ("generating Node instance file: \'" + file);
+ String _plus_9 = (_plus_8 + "\' in \'");
+ String _plus_10 = (_plus_9 + filepath);
+ String _plus_11 = (_plus_10 + "\'");
+ this.logger.logInfo(_plus_11);
+ this.fileAccess.setOutputPath(filepath);
+ CharSequence _generateInstanceFile = this.generateInstanceFile(root, ssi);
+ this.fileAccess.generateFile(file, _generateInstanceFile);
+ String _dispSourceFileName = this._cExtensions.getDispSourceFileName(nr, ssi);
+ file = _dispSourceFileName;
+ String _plus_12 = ("generating Node dispatcher file: \'" + file);
+ String _plus_13 = (_plus_12 + "\' in \'");
+ String _plus_14 = (_plus_13 + filepath);
+ String _plus_15 = (_plus_14 + "\'");
+ this.logger.logInfo(_plus_15);
+ this.fileAccess.setOutputPath(filepath);
+ CharSequence _generateDispatcherFile = this.generateDispatcherFile(root, ssi);
+ this.fileAccess.generateFile(file, _generateDispatcherFile);
+ }
}
}
}
@@ -129,7 +136,12 @@ public class SubSystemClassGen {
private CharSequence generateHeaderFile(final Root root, final SubSystemInstance ssi) {
CharSequence _xblockexpression = null;
{
+ final NodeRef nr = ETMapUtil.getNodeRef(ssi);
final SubSystemClass ssc = ssi.getSubSystemClass();
+ String _name = nr.getName();
+ String _plus = (_name + "_");
+ String _name_1 = ssi.getName();
+ final String clsname = (_plus + _name_1);
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
@@ -140,9 +152,12 @@ public class SubSystemClassGen {
_builder.append("*");
_builder.newLine();
_builder.append(" ");
- _builder.append("* Header File of SubSystemClass ");
- String _name = ssc.getName();
- _builder.append(_name, " ");
+ _builder.append("* Header File of Node ");
+ String _name_2 = nr.getName();
+ _builder.append(_name_2, " ");
+ _builder.append(" with SubSystem ");
+ String _name_3 = ssi.getName();
+ _builder.append(_name_3, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("* ");
@@ -151,8 +166,7 @@ public class SubSystemClassGen {
_builder.append("*/");
_builder.newLine();
_builder.newLine();
- String _name_1 = ssc.getName();
- CharSequence _generateIncludeGuardBegin = this.stdExt.generateIncludeGuardBegin(_name_1);
+ CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(clsname);
_builder.append(_generateIncludeGuardBegin, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
@@ -172,43 +186,39 @@ public class SubSystemClassGen {
_builder.newLine();
_builder.newLine();
_builder.append("void ");
- String _name_2 = ssc.getName();
- _builder.append(_name_2, "");
+ _builder.append(clsname, "");
_builder.append("_init(void);\t\t/* lifecycle init \t */");
_builder.newLineIfNotEmpty();
_builder.append("void ");
- String _name_3 = ssc.getName();
- _builder.append(_name_3, "");
+ _builder.append(clsname, "");
_builder.append("_start(void);\t/* lifecycle start \t */");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("void ");
- String _name_4 = ssc.getName();
- _builder.append(_name_4, "");
+ _builder.append(clsname, "");
_builder.append("_run(void);\t\t/* lifecycle run \t */");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("void ");
- String _name_5 = ssc.getName();
- _builder.append(_name_5, "");
+ _builder.append(clsname, "");
_builder.append("_stop(void); \t/* lifecycle stop\t */");
_builder.newLineIfNotEmpty();
_builder.append("void ");
- String _name_6 = ssc.getName();
- _builder.append(_name_6, "");
+ _builder.append(clsname, "");
_builder.append("_destroy(void); \t/* lifecycle destroy */");
_builder.newLineIfNotEmpty();
_builder.newLine();
- _builder.append("void SubSysClass_shutdown(void); /* shutdown the dispatcher loop */");
- _builder.newLine();
+ _builder.append("void ");
+ _builder.append(clsname, "");
+ _builder.append("_shutdown(void); /* shutdown the dispatcher loop */");
+ _builder.newLineIfNotEmpty();
_builder.newLine();
DetailCode _userCode2 = ssc.getUserCode2();
CharSequence _userCode_1 = this.helpers.userCode(_userCode2);
_builder.append(_userCode_1, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
- String _name_7 = ssc.getName();
- CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_7);
+ CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(clsname);
_builder.append(_generateIncludeGuardEnd, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
@@ -221,7 +231,12 @@ public class SubSystemClassGen {
private CharSequence generateSourceFile(final Root root, final SubSystemInstance ssi) {
CharSequence _xblockexpression = null;
{
+ final NodeRef nr = ETMapUtil.getNodeRef(ssi);
final SubSystemClass ssc = ssi.getSubSystemClass();
+ String _name = nr.getName();
+ String _plus = (_name + "_");
+ String _name_1 = ssi.getName();
+ final String clsname = (_plus + _name_1);
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
@@ -232,9 +247,12 @@ public class SubSystemClassGen {
_builder.append("*");
_builder.newLine();
_builder.append(" ");
- _builder.append("* Source File of SubSystemClass ");
- String _name = ssc.getName();
- _builder.append(_name, " ");
+ _builder.append("* Source File of Node ");
+ String _name_2 = nr.getName();
+ _builder.append(_name_2, " ");
+ _builder.append(" with SubSystem ");
+ String _name_3 = ssi.getName();
+ _builder.append(_name_3, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("* ");
@@ -244,7 +262,7 @@ public class SubSystemClassGen {
_builder.newLine();
_builder.newLine();
_builder.append("#include \"");
- String _cHeaderFileName = this.stdExt.getCHeaderFileName(ssc);
+ String _cHeaderFileName = this._cExtensions.getCHeaderFileName(nr, ssi);
_builder.append(_cHeaderFileName, "");
_builder.append("\"");
_builder.newLineIfNotEmpty();
@@ -252,12 +270,12 @@ public class SubSystemClassGen {
_builder.append("/* include instances for all classes */");
_builder.newLine();
_builder.append("#include \"");
- String _instSourceFileName = this.stdExt.getInstSourceFileName(ssc);
+ String _instSourceFileName = this._cExtensions.getInstSourceFileName(nr, ssi);
_builder.append(_instSourceFileName, "");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("#include \"");
- String _dispSourceFileName = this.stdExt.getDispSourceFileName(ssc);
+ String _dispSourceFileName = this._cExtensions.getDispSourceFileName(nr, ssi);
_builder.append(_dispSourceFileName, "");
_builder.append("\"");
_builder.newLineIfNotEmpty();
@@ -277,14 +295,16 @@ public class SubSystemClassGen {
_builder.append(_userCode, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
- _builder.append("/* data for SubSysten ");
- String _name_1 = ssc.getName();
- _builder.append(_name_1, "");
+ _builder.append("/* data for Node ");
+ String _name_4 = nr.getName();
+ _builder.append(_name_4, "");
+ _builder.append(" with SubSytsem ");
+ String _name_5 = ssi.getName();
+ _builder.append(_name_5, "");
_builder.append(" */");
_builder.newLineIfNotEmpty();
_builder.append("typedef struct ");
- String _name_2 = ssc.getName();
- _builder.append(_name_2, "");
+ _builder.append(clsname, "");
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
@@ -294,181 +314,302 @@ public class SubSystemClassGen {
_builder.append("volatile int shutdownRequest;");
_builder.newLine();
_builder.append("} ");
- String _name_3 = ssc.getName();
- _builder.append(_name_3, "");
+ _builder.append(clsname, "");
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("static ");
- String _name_4 = ssc.getName();
- _builder.append(_name_4, "");
+ _builder.append(clsname, "");
_builder.append(" ");
- String _name_5 = ssc.getName();
- _builder.append(_name_5, "");
+ _builder.append(clsname, "");
_builder.append("Inst = {\"");
- String _name_6 = ssc.getName();
- _builder.append(_name_6, "");
- _builder.append("\",0};");
+ _builder.append(clsname, "");
+ _builder.append("\", 0};");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("void ");
- String _name_7 = ssc.getName();
- _builder.append(_name_7, "");
+ _builder.append(clsname, "");
_builder.append("_initActorInstances(void);");
_builder.newLineIfNotEmpty();
_builder.append("void ");
- String _name_8 = ssc.getName();
- _builder.append(_name_8, "");
+ _builder.append(clsname, "");
_builder.append("_constructActorInstances(void);");
_builder.newLineIfNotEmpty();
_builder.newLine();
- _builder.append("void ");
- String _name_9 = ssc.getName();
- _builder.append(_name_9, "");
- _builder.append("_init(void){");
+ _builder.append("static void ");
+ _builder.append(clsname, "");
+ _builder.append("_initMessageServices(void) {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"init\")");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("etLogger_logInfoF(\"%s_init\", ");
- String _name_10 = ssc.getName();
- _builder.append(_name_10, " ");
- _builder.append("Inst.name);");
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
+ _builder.append(clsname, " ");
+ _builder.append("\", \"initMessageServices\")");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
- _builder.append("/* construct all actors */");
+ _builder.append("/* filling all message service threads with data */");
_builder.newLine();
- _builder.append("\t");
- String _name_11 = ssc.getName();
- _builder.append(_name_11, " ");
- _builder.append("_constructActorInstances();");
- _builder.newLineIfNotEmpty();
+ {
+ NodeClass _type = nr.getType();
+ EList<PhysicalThread> _threads = _type.getThreads();
+ for(final PhysicalThread thread : _threads) {
+ _builder.append("\t");
+ _builder.append("msgService_");
+ String _name_6 = thread.getName();
+ _builder.append(_name_6, " ");
+ _builder.append(".thread.stacksize = ");
+ int _stacksize = thread.getStacksize();
+ _builder.append(_stacksize, " ");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("msgService_");
+ String _name_7 = thread.getName();
+ _builder.append(_name_7, " ");
+ _builder.append(".thread.priority = ");
+ int _prio = thread.getPrio();
+ _builder.append(_prio, " ");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("msgService_");
+ String _name_8 = thread.getName();
+ _builder.append(_name_8, " ");
+ _builder.append(".thread.threadName = \"");
+ String _name_9 = thread.getName();
+ _builder.append(_name_9, " ");
+ _builder.append("\";");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("msgService_");
+ String _name_10 = thread.getName();
+ _builder.append(_name_10, " ");
+ _builder.append(".thread.threadFunction = (etThreadFunction) etMessageService_execute;");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("msgService_");
+ String _name_11 = thread.getName();
+ _builder.append(_name_11, " ");
+ _builder.append(".thread.threadFunctionData = &msgService_");
+ String _name_12 = thread.getName();
+ _builder.append(_name_12, " ");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ }
+ }
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("/* initialization of all message services */");
_builder.newLine();
+ {
+ NodeClass _type_1 = nr.getType();
+ EList<PhysicalThread> _threads_1 = _type_1.getThreads();
+ for(final PhysicalThread thread_1 : _threads_1) {
+ _builder.append("\t");
+ _builder.append("etMessageService_init(&msgService_");
+ String _name_13 = thread_1.getName();
+ _builder.append(_name_13, " ");
+ _builder.append(", &msgBuffer_");
+ String _name_14 = thread_1.getName();
+ _builder.append(_name_14, " ");
+ _builder.append(", MESSAGE_POOL_MAX, MESSAGE_BLOCK_SIZE, MsgDispatcher_");
+ String _name_15 = thread_1.getName();
+ _builder.append(_name_15, " ");
+ _builder.append("_receiveMessage);");
+ _builder.newLineIfNotEmpty();
+ }
+ }
_builder.append("\t");
- _builder.append("etMessageService_init(&msgService_Thread1, msgBuffer_Thread1, MESSAGE_POOL_MAX, MESSAGE_BLOCK_SIZE, MsgDispatcher_Thread1_receiveMessage);");
_builder.newLine();
_builder.append("\t");
+ _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
_builder.newLine();
- _builder.append("\t");
- _builder.append("/* init all actors */");
+ _builder.append("}");
_builder.newLine();
+ _builder.newLine();
+ _builder.append("static void ");
+ _builder.append(clsname, "");
+ _builder.append("_startMessageServices(void) {");
+ _builder.newLineIfNotEmpty();
_builder.append("\t");
- String _name_12 = ssc.getName();
- _builder.append(_name_12, " ");
- _builder.append("_initActorInstances();");
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
+ _builder.append(clsname, " ");
+ _builder.append("\", \"startMessageServices\")");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.newLine();
+ {
+ NodeClass _type_2 = nr.getType();
+ EList<PhysicalThread> _threads_2 = _type_2.getThreads();
+ for(final PhysicalThread thread_2 : _threads_2) {
+ _builder.append("\t");
+ _builder.append("etMessageService_start(&msgService_");
+ String _name_16 = thread_2.getName();
+ _builder.append(_name_16, " ");
+ _builder.append(");");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ _builder.append("\t");
+ _builder.newLine();
_builder.append("\t");
_builder.append("ET_MSC_LOGGER_SYNC_EXIT");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
- _builder.append("void ");
- String _name_13 = ssc.getName();
- _builder.append(_name_13, "");
- _builder.append("_start(void){");
+ _builder.append("static void ");
+ _builder.append(clsname, "");
+ _builder.append("_stopMessageServices(void) {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
+ _builder.append(clsname, " ");
+ _builder.append("\", \"stopMessageServices\")");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"start\")");
_builder.newLine();
+ {
+ NodeClass _type_3 = nr.getType();
+ EList<PhysicalThread> _threads_3 = _type_3.getThreads();
+ for(final PhysicalThread thread_3 : _threads_3) {
+ _builder.append("\t");
+ _builder.append("etMessageService_stop(&msgService_");
+ String _name_17 = thread_3.getName();
+ _builder.append(_name_17, " ");
+ _builder.append(");");
+ _builder.newLineIfNotEmpty();
+ }
+ }
_builder.append("\t");
- _builder.append("etLogger_logInfoF(\"%s_start\", ");
- String _name_14 = ssc.getName();
- _builder.append(_name_14, " ");
- _builder.append("Inst.name);");
- _builder.newLineIfNotEmpty();
+ _builder.newLine();
_builder.append("\t");
_builder.append("ET_MSC_LOGGER_SYNC_EXIT");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
- _builder.append("void ");
- String _name_15 = ssc.getName();
- _builder.append(_name_15, "");
- _builder.append("_run(void){");
+ _builder.append("static void ");
+ _builder.append(clsname, "");
+ _builder.append("_destroyMessageServices(void) {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
+ _builder.append(clsname, " ");
+ _builder.append("\", \"destroyMessageServices\")");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"run\")");
_builder.newLine();
+ {
+ NodeClass _type_4 = nr.getType();
+ EList<PhysicalThread> _threads_4 = _type_4.getThreads();
+ for(final PhysicalThread thread_4 : _threads_4) {
+ _builder.append("\t");
+ _builder.append("etMessageService_destroy(&msgService_");
+ String _name_18 = thread_4.getName();
+ _builder.append(_name_18, " ");
+ _builder.append(");");
+ _builder.newLineIfNotEmpty();
+ }
+ }
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
- _builder.append("#ifdef ET_RUNTIME_ENDLESS");
+ _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
_builder.newLine();
- _builder.append("\t\t");
- _builder.append("while(!(");
- String _name_16 = ssc.getName();
- _builder.append(_name_16, " ");
- _builder.append("Inst.shutdownRequest)){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t\t");
- _builder.append("if (etTimer_executeNeeded()){");
+ _builder.append("}");
_builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("etMessageService_execute(&msgService_Thread1);");
_builder.newLine();
- _builder.append("\t\t\t\t");
- CharSequence _generateDatadrivenExecutes = this.generateDatadrivenExecutes(root, ssi);
- _builder.append(_generateDatadrivenExecutes, " ");
+ _builder.append("void ");
+ _builder.append(clsname, "");
+ _builder.append("_init(void) {");
_builder.newLineIfNotEmpty();
- _builder.append("\t\t\t");
- _builder.append("}");
+ _builder.append("\t");
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
+ _builder.append(clsname, " ");
+ _builder.append("\", \"init\")");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("etLogger_logInfoF(\"%s_init\", ");
+ _builder.append(clsname, " ");
+ _builder.append("Inst.name);");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
_builder.newLine();
- _builder.append("\t\t");
- _builder.append("}");
+ _builder.append("\t");
+ _builder.append("/* construct all actors */");
_builder.newLine();
_builder.append("\t");
- _builder.append("#else");
+ _builder.append(clsname, " ");
+ _builder.append("_constructActorInstances();");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
_builder.newLine();
- _builder.append("\t\t");
- _builder.append("uint32 loopCounter = 0;");
+ _builder.append("\t");
+ _builder.append("/* initialization of all message services */");
_builder.newLine();
- _builder.append("\t\t");
- _builder.append("while(!(");
- String _name_17 = ssc.getName();
- _builder.append(_name_17, " ");
- _builder.append("Inst.shutdownRequest)){");
+ _builder.append("\t");
+ _builder.append(clsname, " ");
+ _builder.append("_initMessageServices();");
_builder.newLineIfNotEmpty();
- _builder.append("\t\t\t");
- _builder.append("if (etTimer_executeNeeded()){");
+ _builder.append("\t");
_builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("etMessageService_execute(&msgService_Thread1);");
+ _builder.append("\t");
+ _builder.append("/* init all actors */");
_builder.newLine();
- _builder.append("\t\t\t\t");
- CharSequence _generateDatadrivenExecutes_1 = this.generateDatadrivenExecutes(root, ssi);
- _builder.append(_generateDatadrivenExecutes_1, " ");
+ _builder.append("\t");
+ _builder.append(clsname, " ");
+ _builder.append("_initActorInstances();");
_builder.newLineIfNotEmpty();
- _builder.append("\t\t\t\t");
- _builder.append("etLogger_logInfo(\"Execute\");");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("if (loopCounter++ > ET_RUNTIME_MAXLOOP){");
+ _builder.append("\t");
_builder.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("break;");
+ _builder.append("\t");
+ _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
_builder.newLine();
- _builder.append("\t\t\t\t");
_builder.append("}");
_builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("}");
_builder.newLine();
- _builder.append("\t\t");
+ _builder.append("void ");
+ _builder.append(clsname, "");
+ _builder.append("_start(void) {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
+ _builder.append(clsname, " ");
+ _builder.append("\", \"start\")");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("etLogger_logInfoF(\"%s_start\", ");
+ _builder.append(clsname, " ");
+ _builder.append("Inst.name);");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append(clsname, " ");
+ _builder.append("_startMessageServices();");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
+ _builder.newLine();
_builder.append("}");
_builder.newLine();
+ _builder.newLine();
+ _builder.append("void ");
+ _builder.append(clsname, "");
+ _builder.append("_run(void) {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
+ _builder.append(clsname, " ");
+ _builder.append("\", \"run\")");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("etThread_sleep(1000);");
+ _builder.newLine();
_builder.append("\t");
- _builder.append("#endif");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
@@ -479,19 +620,26 @@ public class SubSystemClassGen {
_builder.newLine();
_builder.newLine();
_builder.append("void ");
- String _name_18 = ssc.getName();
- _builder.append(_name_18, "");
+ _builder.append(clsname, "");
_builder.append("_stop(void){");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"stop\")");
- _builder.newLine();
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
+ _builder.append(clsname, " ");
+ _builder.append("\", \"stop\")");
+ _builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("etLogger_logInfoF(\"%s_stop\", ");
- String _name_19 = ssc.getName();
- _builder.append(_name_19, " ");
+ _builder.append(clsname, " ");
_builder.append("Inst.name);");
_builder.newLineIfNotEmpty();
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append(clsname, " ");
+ _builder.append("_stopMessageServices();");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.newLine();
_builder.append("\t");
_builder.append("ET_MSC_LOGGER_SYNC_EXIT");
_builder.newLine();
@@ -499,17 +647,17 @@ public class SubSystemClassGen {
_builder.newLine();
_builder.newLine();
_builder.append("void ");
- String _name_20 = ssc.getName();
- _builder.append(_name_20, "");
+ _builder.append(clsname, "");
_builder.append("_destroy(void){");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"destroy\")");
- _builder.newLine();
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
+ _builder.append(clsname, " ");
+ _builder.append("\", \"destroy\")");
+ _builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("etLogger_logInfoF(\"%s_destroy\", ");
- String _name_21 = ssc.getName();
- _builder.append(_name_21, " ");
+ _builder.append(clsname, " ");
_builder.append("Inst.name);");
_builder.newLineIfNotEmpty();
{
@@ -531,15 +679,15 @@ public class SubSystemClassGen {
if (_not) {
_builder.append("\t");
ActorClass _actorClass_1 = ai.getActorClass();
- String _name_22 = _actorClass_1.getName();
+ String _name_19 = _actorClass_1.getName();
ActorClass _actorClass_2 = ai.getActorClass();
- String _name_23 = _actorClass_2.getName();
- String _destructorName = this.languageExt.destructorName(_name_23);
- String _memberInUse = this.languageExt.memberInUse(_name_22, _destructorName);
+ String _name_20 = _actorClass_2.getName();
+ String _destructorName = this.languageExt.destructorName(_name_20);
+ String _memberInUse = this.languageExt.memberInUse(_name_19, _destructorName);
_builder.append(_memberInUse, " ");
_builder.append("(&");
String _path = ai.getPath();
- String _pathName = this.roomExt.getPathName(_path);
+ String _pathName = this._roomExtensions.getPathName(_path);
_builder.append(_pathName, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
@@ -548,28 +696,42 @@ public class SubSystemClassGen {
}
}
_builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append(clsname, " ");
+ _builder.append("_destroyMessageServices();");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
_builder.append("ET_MSC_LOGGER_SYNC_EXIT");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
- _builder.append("void SubSysClass_shutdown(void){");
- _builder.newLine();
+ _builder.append("void ");
+ _builder.append(clsname, "");
+ _builder.append("_shutdown(void){");
+ _builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"shutdown\")");
- _builder.newLine();
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
+ _builder.append(clsname, " ");
+ _builder.append("\", \"shutdown\")");
+ _builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("etLogger_logInfoF(\"%s_shutdown\", ");
- String _name_24 = ssc.getName();
- _builder.append(_name_24, " ");
+ _builder.append(clsname, " ");
_builder.append("Inst.name);");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- String _name_25 = ssc.getName();
- _builder.append(_name_25, " ");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append(clsname, " ");
_builder.append("Inst.shutdownRequest = 1;");
_builder.newLineIfNotEmpty();
_builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
_builder.append("ET_MSC_LOGGER_SYNC_EXIT");
_builder.newLine();
_builder.append("}");
@@ -577,14 +739,12 @@ public class SubSystemClassGen {
_builder.newLine();
_builder.newLine();
_builder.append("void ");
- String _name_26 = ssc.getName();
- _builder.append(_name_26, "");
+ _builder.append(clsname, "");
_builder.append("_constructActorInstances(void){");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
- String _name_27 = ssc.getName();
- _builder.append(_name_27, " ");
+ _builder.append(clsname, " ");
_builder.append("\", \"constructActorInstances\")");
_builder.newLineIfNotEmpty();
{
@@ -605,15 +765,15 @@ public class SubSystemClassGen {
if (_not_1) {
_builder.append("\t");
ActorClass _actorClass_4 = ai_1.getActorClass();
- String _name_28 = _actorClass_4.getName();
+ String _name_21 = _actorClass_4.getName();
ActorClass _actorClass_5 = ai_1.getActorClass();
- String _name_29 = _actorClass_5.getName();
- String _constructorName = this.languageExt.constructorName(_name_29);
- String _memberInUse_1 = this.languageExt.memberInUse(_name_28, _constructorName);
+ String _name_22 = _actorClass_5.getName();
+ String _constructorName = this.languageExt.constructorName(_name_22);
+ String _memberInUse_1 = this.languageExt.memberInUse(_name_21, _constructorName);
_builder.append(_memberInUse_1, " ");
_builder.append("(&");
String _path_1 = ai_1.getPath();
- String _pathName_1 = this.roomExt.getPathName(_path_1);
+ String _pathName_1 = this._roomExtensions.getPathName(_path_1);
_builder.append(_pathName_1, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
@@ -628,14 +788,12 @@ public class SubSystemClassGen {
_builder.newLine();
_builder.newLine();
_builder.append("void ");
- String _name_30 = ssc.getName();
- _builder.append(_name_30, "");
+ _builder.append(clsname, "");
_builder.append("_initActorInstances(void){");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
- String _name_31 = ssc.getName();
- _builder.append(_name_31, " ");
+ _builder.append(clsname, " ");
_builder.append("\", \"initActorInstances\")");
_builder.newLineIfNotEmpty();
{
@@ -643,11 +801,11 @@ public class SubSystemClassGen {
for(final ActorInstance ai_2 : _allContainedInstances_2) {
_builder.append("\t");
ActorClass _actorClass_6 = ai_2.getActorClass();
- String _name_32 = _actorClass_6.getName();
- _builder.append(_name_32, " ");
+ String _name_23 = _actorClass_6.getName();
+ _builder.append(_name_23, " ");
_builder.append("_init(&");
String _path_2 = ai_2.getPath();
- String _pathName_2 = this.roomExt.getPathName(_path_2);
+ String _pathName_2 = this._roomExtensions.getPathName(_path_2);
_builder.append(_pathName_2, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
@@ -667,7 +825,7 @@ public class SubSystemClassGen {
private CharSequence generateInstanceFile(final Root root, final SubSystemInstance ssi) {
CharSequence _xblockexpression = null;
{
- final SubSystemClass ssc = ssi.getSubSystemClass();
+ final NodeRef nr = ETMapUtil.getNodeRef(ssi);
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
@@ -678,9 +836,12 @@ public class SubSystemClassGen {
_builder.append("*");
_builder.newLine();
_builder.append(" ");
- _builder.append("* Instance File of SubSystemClass ");
- String _name = ssc.getName();
+ _builder.append("* Instance File of Node ");
+ String _name = nr.getName();
_builder.append(_name, " ");
+ _builder.append(" with SubSystem ");
+ String _name_1 = ssi.getName();
+ _builder.append(_name_1, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("* - instantiation of all actor instances and port instances");
@@ -700,12 +861,24 @@ public class SubSystemClassGen {
_builder.append("/* instantiation of message services */");
_builder.newLine();
_builder.newLine();
- _builder.append("/* MessageService for Thread1 */");
- _builder.newLine();
- _builder.append("static uint8 msgBuffer_Thread1[MESSAGE_POOL_MAX*MESSAGE_BLOCK_SIZE];");
- _builder.newLine();
- _builder.append("static etMessageService msgService_Thread1;");
+ _builder.append("/* MessageServices */");
_builder.newLine();
+ {
+ NodeClass _type = nr.getType();
+ EList<PhysicalThread> _threads = _type.getThreads();
+ for(final PhysicalThread thread : _threads) {
+ _builder.append("static uint8 msgBuffer_");
+ String _name_2 = thread.getName();
+ _builder.append(_name_2, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ _builder.append("static etMessageService msgService_");
+ String _name_3 = thread.getName();
+ _builder.append(_name_3, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ }
+ }
_builder.newLine();
_builder.newLine();
_builder.append("/* include all used ActorClasses */");
@@ -714,8 +887,8 @@ public class SubSystemClassGen {
EList<ActorClass> _usedActorClasses = root.getUsedActorClasses();
for(final ActorClass actorClass : _usedActorClasses) {
_builder.append("#include \"");
- String _name_1 = actorClass.getName();
- _builder.append(_name_1, "");
+ String _name_4 = actorClass.getName();
+ _builder.append(_name_4, "");
_builder.append(".h\"");
_builder.newLineIfNotEmpty();
}
@@ -727,8 +900,8 @@ public class SubSystemClassGen {
EList<ProtocolClass> _usedProtocolClasses = root.getUsedProtocolClasses();
for(final ProtocolClass protocolClass : _usedProtocolClasses) {
_builder.append("#include \"");
- String _name_2 = protocolClass.getName();
- _builder.append(_name_2, "");
+ String _name_5 = protocolClass.getName();
+ _builder.append(_name_5, "");
_builder.append(".h\"");
_builder.newLineIfNotEmpty();
}
@@ -745,11 +918,11 @@ public class SubSystemClassGen {
for(final ActorInstance ai : _allContainedInstances) {
_builder.append("static ");
ActorClass _actorClass = ai.getActorClass();
- String _name_3 = _actorClass.getName();
- _builder.append(_name_3, "");
+ String _name_6 = _actorClass.getName();
+ _builder.append(_name_6, "");
_builder.append(" ");
String _path = ai.getPath();
- String _pathName = this.roomExt.getPathName(_path);
+ String _pathName = this._roomExtensions.getPathName(_path);
_builder.append(_pathName, "");
_builder.append(";");
_builder.newLineIfNotEmpty();
@@ -773,20 +946,20 @@ public class SubSystemClassGen {
for(final InterfaceItemInstance pi : _orderedIfItemInstances_1) {
{
ProtocolClass _protocol = pi.getProtocol();
- boolean _isConjugated = this.roomExt.isConjugated(pi);
- PortClass _portClass = this.roomExt.getPortClass(_protocol, _isConjugated);
+ boolean _isConjugated = this._roomExtensions.isConjugated(pi);
+ PortClass _portClass = this._roomExtensions.getPortClass(_protocol, _isConjugated);
EList<Attribute> _attributes = _portClass==null?(EList<Attribute>)null:_portClass.getAttributes();
int _size = _attributes==null?0:_attributes.size();
boolean _greaterThan = (_size > 0);
if (_greaterThan) {
_builder.append("static ");
ProtocolClass _protocol_1 = pi.getProtocol();
- boolean _isConjugated_1 = this.roomExt.isConjugated(pi);
- String _portClassName = this.roomExt.getPortClassName(_protocol_1, _isConjugated_1);
+ boolean _isConjugated_1 = this._roomExtensions.isConjugated(pi);
+ String _portClassName = this._roomExtensions.getPortClassName(_protocol_1, _isConjugated_1);
_builder.append(_portClassName, "");
_builder.append("_var ");
String _path_1 = pi.getPath();
- String _pathName_1 = this.roomExt.getPathName(_path_1);
+ String _pathName_1 = this._roomExtensions.getPathName(_path_1);
_builder.append(_pathName_1, "");
_builder.append("_var");
{
@@ -848,7 +1021,7 @@ public class SubSystemClassGen {
_builder.newLine();
_builder.append("/* instance ");
String _path_2 = ai_2.getPath();
- String _pathName_2 = this.roomExt.getPathName(_path_2);
+ String _pathName_2 = this._roomExtensions.getPathName(_path_2);
_builder.append(_pathName_2, "");
_builder.append(" */");
_builder.newLineIfNotEmpty();
@@ -876,7 +1049,7 @@ public class SubSystemClassGen {
CharSequence _xblockexpression = null;
{
String _path = ai.getPath();
- String instName = this.roomExt.getPathName(_path);
+ String instName = this._roomExtensions.getPathName(_path);
ArrayList<InterfaceItemInstance> _arrayList = new ArrayList<InterfaceItemInstance>();
ArrayList<InterfaceItemInstance> replPorts = _arrayList;
EList<InterfaceItemInstance> _orderedIfItemInstances = ai.getOrderedIfItemInstances();
@@ -917,7 +1090,7 @@ public class SubSystemClassGen {
}
};
Iterable<InterfaceItemInstance> _filter_1 = IterableExtensions.<InterfaceItemInstance>filter(simplePorts, _function_3);
- Iterable<InterfaceItemInstance> _union = this.roomExt.<InterfaceItemInstance>union(_filter_1, replPorts);
+ Iterable<InterfaceItemInstance> _union = this._roomExtensions.<InterfaceItemInstance>union(_filter_1, replPorts);
Iterables.<InterfaceItemInstance>addAll(eventPorts, _union);
final Function1<InterfaceItemInstance,Boolean> _function_4 = new Function1<InterfaceItemInstance,Boolean>() {
public Boolean apply(final InterfaceItemInstance p) {
@@ -1142,7 +1315,7 @@ public class SubSystemClassGen {
_builder.newLine();
_builder.append("\t");
ActorClass _actorClass_2 = ai.getActorClass();
- List<Attribute> _allAttributes = this.roomExt.getAllAttributes(_actorClass_2);
+ List<Attribute> _allAttributes = this._roomExtensions.getAllAttributes(_actorClass_2);
CharSequence _generateAttributeInit = this.attrInitGenAddon.generateAttributeInit(ai, _allAttributes);
_builder.append(_generateAttributeInit, " ");
_builder.newLineIfNotEmpty();
@@ -1174,7 +1347,7 @@ public class SubSystemClassGen {
int _objId = _get.getObjId();
_xifexpression = _objId;
}
- int objId = _xifexpression;
+ final int objId = _xifexpression;
int _xifexpression_1 = (int) 0;
EList<InterfaceItemInstance> _peers_2 = pi.getPeers();
boolean _isEmpty_1 = _peers_2.isEmpty();
@@ -1187,24 +1360,40 @@ public class SubSystemClassGen {
int _indexOf = _peers_4.indexOf(pi);
_xifexpression_1 = _indexOf;
}
- int idx = _xifexpression_1;
+ final int idx = _xifexpression_1;
+ String _xifexpression_2 = null;
+ EList<InterfaceItemInstance> _peers_5 = pi.getPeers();
+ boolean _isEmpty_2 = _peers_5.isEmpty();
+ if (_isEmpty_2) {
+ _xifexpression_2 = "NULL";
+ } else {
+ EList<InterfaceItemInstance> _peers_6 = pi.getPeers();
+ InterfaceItemInstance _get_2 = _peers_6.get(0);
+ EObject _eContainer = _get_2.eContainer();
+ PhysicalThread _physicalThread = ETMapUtil.getPhysicalThread(((ActorInstance) _eContainer));
+ String _name = _physicalThread.getName();
+ String _plus = ("&msgService_" + _name);
+ _xifexpression_2 = _plus;
+ }
+ final String msgSvc = _xifexpression_2;
String _interfaceItemInstanceData = this.getInterfaceItemInstanceData(pi);
- String _plus = ("{" + _interfaceItemInstanceData);
- String _plus_1 = (_plus + ",");
- String _plus_2 = (_plus_1 + "&msgService_Thread1, ");
- int _plus_3 = (objId + idx);
- String _plus_4 = (_plus_2 + Integer.valueOf(_plus_3));
- String _plus_5 = (_plus_4 + ", ");
+ String _plus_1 = ("{" + _interfaceItemInstanceData);
+ String _plus_2 = (_plus_1 + ",");
+ String _plus_3 = (_plus_2 + msgSvc);
+ String _plus_4 = (_plus_3 + ", ");
+ int _plus_5 = (objId + idx);
+ String _plus_6 = (_plus_4 + Integer.valueOf(_plus_5));
+ String _plus_7 = (_plus_6 + ", ");
ExpandedActorClass _expandedActorClass = root.getExpandedActorClass(ai);
InterfaceItem _interfaceItem = pi.getInterfaceItem();
int _interfaceItemLocalId = _expandedActorClass.getInterfaceItemLocalId(_interfaceItem);
- int _plus_6 = (_interfaceItemLocalId + 1);
- String _plus_7 = (_plus_5 + Integer.valueOf(_plus_6));
- String _plus_8 = (_plus_7 + "} /* Port ");
- String _name = pi.getName();
- String _plus_9 = (_plus_8 + _name);
- String _plus_10 = (_plus_9 + " */");
- _xblockexpression = (_plus_10);
+ int _plus_8 = (_interfaceItemLocalId + 1);
+ String _plus_9 = (_plus_7 + Integer.valueOf(_plus_8));
+ String _plus_10 = (_plus_9 + "} /* Port ");
+ String _name_1 = pi.getName();
+ String _plus_11 = (_plus_10 + _name_1);
+ String _plus_12 = (_plus_11 + " */");
+ _xblockexpression = (_plus_12);
}
return _xblockexpression;
}
@@ -1231,7 +1420,7 @@ public class SubSystemClassGen {
VarDecl _data = m.getData();
RefableType _refType = _data.getRefType();
DataType _type = _refType.getType();
- String _defaultValue = this.stdExt.defaultValue(_type);
+ String _defaultValue = this._cExtensions.defaultValue(_type);
_builder.append(_defaultValue, " ");
_builder.newLineIfNotEmpty();
}
@@ -1245,22 +1434,22 @@ public class SubSystemClassGen {
private String getInterfaceItemInstanceData(final InterfaceItemInstance pi) {
ProtocolClass _protocol = pi.getProtocol();
- boolean _isConjugated = this.roomExt.isConjugated(pi);
- PortClass _portClass = this.roomExt.getPortClass(_protocol, _isConjugated);
+ boolean _isConjugated = this._roomExtensions.isConjugated(pi);
+ PortClass _portClass = this._roomExtensions.getPortClass(_protocol, _isConjugated);
boolean _equals = Objects.equal(_portClass, null);
if (_equals) {
return "0";
}
ProtocolClass _protocol_1 = pi.getProtocol();
- boolean _isConjugated_1 = this.roomExt.isConjugated(pi);
- PortClass _portClass_1 = this.roomExt.getPortClass(_protocol_1, _isConjugated_1);
+ boolean _isConjugated_1 = this._roomExtensions.isConjugated(pi);
+ PortClass _portClass_1 = this._roomExtensions.getPortClass(_protocol_1, _isConjugated_1);
EList<Attribute> _attributes = _portClass_1.getAttributes();
boolean _isEmpty = _attributes.isEmpty();
if (_isEmpty) {
return "0";
} else {
String _path = pi.getPath();
- String _pathName = this.roomExt.getPathName(_path);
+ String _pathName = this._roomExtensions.getPathName(_path);
String _plus = ("&" + _pathName);
return (_plus + "_var");
}
@@ -1281,7 +1470,7 @@ public class SubSystemClassGen {
EObject _eContainer = _get.eContainer();
ActorInstance peerInst = ((ActorInstance) _eContainer);
String _path = peerInst.getPath();
- String instName = this.roomExt.getPathName(_path);
+ String instName = this._roomExtensions.getPathName(_path);
String _plus = ("{&" + instName);
String _plus_1 = (_plus + ".");
String _name = peer.getName();
@@ -1298,7 +1487,7 @@ public class SubSystemClassGen {
for (final InterfaceItemInstance p : _peers) {
{
EList<InterfaceItemInstance> _peers_1 = pi.getPeers();
- int idx = _peers_1.indexOf(p);
+ final int idx = _peers_1.indexOf(p);
String _xifexpression = null;
EList<InterfaceItemInstance> _peers_2 = pi.getPeers();
int _size = _peers_2.size();
@@ -1309,7 +1498,10 @@ public class SubSystemClassGen {
} else {
_xifexpression = "";
}
- String comma = _xifexpression;
+ final String comma = _xifexpression;
+ EObject _eContainer = p.eContainer();
+ PhysicalThread _physicalThread = ETMapUtil.getPhysicalThread(((ActorInstance) _eContainer));
+ final String thread = _physicalThread.getName();
String iiiD = this.getInterfaceItemInstanceData(pi);
String _xifexpression_1 = null;
boolean _equals = iiiD.equals("0");
@@ -1326,26 +1518,28 @@ public class SubSystemClassGen {
String _plus_4 = (result +
"{");
String _plus_5 = (_plus_4 + iiiD);
- String _plus_6 = (_plus_5 + "&msgService_Thread1, ");
- int _objId = p.getObjId();
- String _plus_7 = (_plus_6 + Integer.valueOf(_objId));
+ String _plus_6 = (_plus_5 + "&msgService_");
+ String _plus_7 = (_plus_6 + thread);
String _plus_8 = (_plus_7 + ", ");
+ int _objId = p.getObjId();
+ String _plus_9 = (_plus_8 + Integer.valueOf(_objId));
+ String _plus_10 = (_plus_9 + ", ");
ExpandedActorClass _expandedActorClass = root.getExpandedActorClass(ai);
InterfaceItem _interfaceItem = pi.getInterfaceItem();
int _interfaceItemLocalId = _expandedActorClass.getInterfaceItemLocalId(_interfaceItem);
- int _plus_9 = (_interfaceItemLocalId + 1);
- String _plus_10 = (_plus_8 + Integer.valueOf(_plus_9));
- String _plus_11 = (_plus_10 + ", ");
- String _plus_12 = (_plus_11 + Integer.valueOf(idx));
- String _plus_13 = (_plus_12 + "}");
- String _plus_14 = (_plus_13 + comma);
- String _plus_15 = (_plus_14 + " /* Repl Sub Port ");
+ int _plus_11 = (_interfaceItemLocalId + 1);
+ String _plus_12 = (_plus_10 + Integer.valueOf(_plus_11));
+ String _plus_13 = (_plus_12 + ", ");
+ String _plus_14 = (_plus_13 + Integer.valueOf(idx));
+ String _plus_15 = (_plus_14 + "}");
+ String _plus_16 = (_plus_15 + comma);
+ String _plus_17 = (_plus_16 + " /* Repl Sub Port ");
String _name = pi.getName();
- String _plus_16 = (_plus_15 + _name);
- String _plus_17 = (_plus_16 + " idx +");
- String _plus_18 = (_plus_17 + Integer.valueOf(idx));
- String _plus_19 = (_plus_18 + "*/\n");
- result = _plus_19;
+ String _plus_18 = (_plus_17 + _name);
+ String _plus_19 = (_plus_18 + " idx +");
+ String _plus_20 = (_plus_19 + Integer.valueOf(idx));
+ String _plus_21 = (_plus_20 + "*/\n");
+ result = _plus_21;
}
}
return result;
@@ -1354,7 +1548,7 @@ public class SubSystemClassGen {
private CharSequence generateDispatcherFile(final Root root, final SubSystemInstance ssi) {
CharSequence _xblockexpression = null;
{
- final SubSystemClass ssc = ssi.getSubSystemClass();
+ final NodeRef nr = ETMapUtil.getNodeRef(ssi);
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
@@ -1365,9 +1559,12 @@ public class SubSystemClassGen {
_builder.append("*");
_builder.newLine();
_builder.append(" ");
- _builder.append("* Dispatcher File of SubSystemClass ");
- String _name = ssc.getName();
+ _builder.append("* Dispatcher File of Node ");
+ String _name = nr.getName();
_builder.append(_name, " ");
+ _builder.append(" with SubSystem ");
+ String _name_1 = ssi.getName();
+ _builder.append(_name_1, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("* - one generated dispatcher for each MessageService (Thread)");
@@ -1383,309 +1580,325 @@ public class SubSystemClassGen {
_builder.append("#include \"debugging/etMSCLogger.h\"");
_builder.newLine();
_builder.newLine();
- _builder.append("static void MsgDispatcher_Thread1_receiveMessage(const etMessage* msg){");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"MsgDispatcher_Thread1\", \"receiveMessage\")");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("switch(msg->address){");
- _builder.newLine();
- _builder.append("\t");
- _builder.newLine();
{
- EList<ActorInstance> _allContainedInstances = ssi.getAllContainedInstances();
- for(final ActorInstance ai : _allContainedInstances) {
- _builder.append("\t\t");
- _builder.append("/* interface items of ");
- String _path = ai.getPath();
- _builder.append(_path, " ");
- _builder.append(" */");
+ NodeClass _type = nr.getType();
+ EList<PhysicalThread> _threads = _type.getThreads();
+ for(final PhysicalThread thread : _threads) {
+ _builder.append("static void MsgDispatcher_");
+ String _name_2 = thread.getName();
+ _builder.append(_name_2, "");
+ _builder.append("_receiveMessage(const etMessage* msg){");
_builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"MsgDispatcher_");
+ String _name_3 = thread.getName();
+ _builder.append(_name_3, " ");
+ _builder.append("\", \"receiveMessage\")");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("switch(msg->address){");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.newLine();
{
- EList<InterfaceItemInstance> _orderedIfItemInstances = ai.getOrderedIfItemInstances();
- final Function1<InterfaceItemInstance,Boolean> _function = new Function1<InterfaceItemInstance,Boolean>() {
- public Boolean apply(final InterfaceItemInstance p) {
- ProtocolClass _protocol = p.getProtocol();
- CommunicationType _commType = _protocol.getCommType();
- boolean _equals = Objects.equal(_commType, CommunicationType.EVENT_DRIVEN);
- return Boolean.valueOf(_equals);
- }
- };
- Iterable<InterfaceItemInstance> _filter = IterableExtensions.<InterfaceItemInstance>filter(_orderedIfItemInstances, _function);
- for(final InterfaceItemInstance pi : _filter) {
+ EList<ActorInstance> _allContainedInstances = ssi.getAllContainedInstances();
+ for(final ActorInstance ai : _allContainedInstances) {
+ _builder.append("\t\t");
+ _builder.append("/* interface items of ");
+ String _path = ai.getPath();
+ _builder.append(_path, " ");
+ _builder.append(" */");
+ _builder.newLineIfNotEmpty();
{
- boolean _isReplicated = pi.isReplicated();
- if (_isReplicated) {
+ EList<InterfaceItemInstance> _orderedIfItemInstances = ai.getOrderedIfItemInstances();
+ final Function1<InterfaceItemInstance,Boolean> _function = new Function1<InterfaceItemInstance,Boolean>() {
+ public Boolean apply(final InterfaceItemInstance p) {
+ ProtocolClass _protocol = p.getProtocol();
+ CommunicationType _commType = _protocol.getCommType();
+ boolean _equals = Objects.equal(_commType, CommunicationType.EVENT_DRIVEN);
+ return Boolean.valueOf(_equals);
+ }
+ };
+ Iterable<InterfaceItemInstance> _filter = IterableExtensions.<InterfaceItemInstance>filter(_orderedIfItemInstances, _function);
+ for(final InterfaceItemInstance pi : _filter) {
{
- EList<InterfaceItemInstance> _peers = pi.getPeers();
- for(final InterfaceItemInstance peer : _peers) {
+ boolean _isReplicated = pi.isReplicated();
+ if (_isReplicated) {
+ {
+ EList<InterfaceItemInstance> _peers = pi.getPeers();
+ for(final InterfaceItemInstance peer : _peers) {
+ _builder.append("\t\t");
+ _builder.append("case ");
+ int _objId = pi.getObjId();
+ EList<InterfaceItemInstance> _peers_1 = pi.getPeers();
+ int _indexOf = _peers_1.indexOf(peer);
+ int _plus = (_objId + _indexOf);
+ _builder.append(_plus, " ");
+ _builder.append(":");
+ _builder.newLineIfNotEmpty();
+ {
+ ProtocolClass _protocol = pi.getProtocol();
+ boolean _isConjugated = this._roomExtensions.isConjugated(pi);
+ boolean _handlesReceive = this._roomExtensions.handlesReceive(_protocol, _isConjugated);
+ if (_handlesReceive) {
+ _builder.append("\t\t");
+ _builder.append("switch (msg->evtID){");
+ _builder.newLine();
+ {
+ ProtocolClass _protocol_1 = pi.getProtocol();
+ boolean _isConjugated_1 = this._roomExtensions.isConjugated(pi);
+ List<MessageHandler> _receiveHandlers = this._roomExtensions.getReceiveHandlers(_protocol_1, _isConjugated_1);
+ for(final MessageHandler h : _receiveHandlers) {
+ _builder.append("\t\t");
+ _builder.append("\t");
+ _builder.append("case ");
+ ProtocolClass _protocol_2 = pi.getProtocol();
+ String _name_4 = _protocol_2.getName();
+ _builder.append(_name_4, " ");
+ _builder.append("_");
+ Message _msg = h.getMsg();
+ String _codeName = this._roomExtensions.getCodeName(_msg);
+ _builder.append(_codeName, " ");
+ _builder.append(":");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("\t");
+ _builder.append("\t");
+ ProtocolClass _protocol_3 = pi.getProtocol();
+ boolean _isConjugated_2 = this._roomExtensions.isConjugated(pi);
+ String _portClassName = this._roomExtensions.getPortClassName(_protocol_3, _isConjugated_2);
+ _builder.append(_portClassName, " ");
+ _builder.append("_");
+ Message _msg_1 = h.getMsg();
+ String _name_5 = _msg_1.getName();
+ _builder.append(_name_5, " ");
+ _builder.append("_receiveHandler((etPort *)&");
+ String _path_1 = ai.getPath();
+ String _pathName = this._roomExtensions.getPathName(_path_1);
+ _builder.append(_pathName, " ");
+ _builder.append("_const.");
+ String _name_6 = pi.getName();
+ _builder.append(_name_6, " ");
+ _builder.append(".ports[");
+ EList<InterfaceItemInstance> _peers_2 = pi.getPeers();
+ int _indexOf_1 = _peers_2.indexOf(peer);
+ _builder.append(_indexOf_1, " ");
+ _builder.append("],msg,(void*)&");
+ String _path_2 = ai.getPath();
+ String _pathName_1 = this._roomExtensions.getPathName(_path_2);
+ _builder.append(_pathName_1, " ");
+ _builder.append(",");
+ ActorClass _actorClass = ai.getActorClass();
+ String _name_7 = _actorClass.getName();
+ _builder.append(_name_7, " ");
+ _builder.append("_receiveMessage);");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("\t");
+ _builder.append("break;");
+ _builder.newLine();
+ }
+ }
+ _builder.append("\t\t");
+ _builder.append("\t");
+ _builder.append("default: ");
+ ActorClass _actorClass_1 = ai.getActorClass();
+ String _name_8 = _actorClass_1.getName();
+ _builder.append(_name_8, " ");
+ _builder.append("_receiveMessage((void*)&");
+ String _path_3 = ai.getPath();
+ String _pathName_2 = this._roomExtensions.getPathName(_path_3);
+ _builder.append(_pathName_2, " ");
+ _builder.append(",(etPort*)&");
+ String _path_4 = ai.getPath();
+ String _pathName_3 = this._roomExtensions.getPathName(_path_4);
+ _builder.append(_pathName_3, " ");
+ _builder.append("_const.");
+ String _name_9 = pi.getName();
+ _builder.append(_name_9, " ");
+ _builder.append(".ports[");
+ EList<InterfaceItemInstance> _peers_3 = pi.getPeers();
+ int _indexOf_2 = _peers_3.indexOf(peer);
+ _builder.append(_indexOf_2, " ");
+ _builder.append("], msg);");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("\t");
+ _builder.append("break;");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("\t");
+ _builder.append("}\t\t\t\t\t\t\t\t\t\t");
+ _builder.newLine();
+ } else {
+ _builder.append("\t\t");
+ ActorClass _actorClass_2 = ai.getActorClass();
+ String _name_10 = _actorClass_2.getName();
+ _builder.append(_name_10, " ");
+ _builder.append("_receiveMessage((void*)&");
+ String _path_5 = ai.getPath();
+ String _pathName_4 = this._roomExtensions.getPathName(_path_5);
+ _builder.append(_pathName_4, " ");
+ _builder.append(",(etPort*)&");
+ String _path_6 = ai.getPath();
+ String _pathName_5 = this._roomExtensions.getPathName(_path_6);
+ _builder.append(_pathName_5, " ");
+ _builder.append("_const.");
+ String _name_11 = pi.getName();
+ _builder.append(_name_11, " ");
+ _builder.append(".ports[");
+ EList<InterfaceItemInstance> _peers_4 = pi.getPeers();
+ int _indexOf_3 = _peers_4.indexOf(peer);
+ _builder.append(_indexOf_3, " ");
+ _builder.append("], msg);");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ _builder.append("\t\t");
+ _builder.append("break;");
+ _builder.newLine();
+ }
+ }
+ } else {
_builder.append("\t\t");
_builder.append("case ");
- int _objId = pi.getObjId();
- EList<InterfaceItemInstance> _peers_1 = pi.getPeers();
- int _indexOf = _peers_1.indexOf(peer);
- int _plus = (_objId + _indexOf);
- _builder.append(_plus, " ");
+ int _objId_1 = pi.getObjId();
+ _builder.append(_objId_1, " ");
_builder.append(":");
_builder.newLineIfNotEmpty();
{
- ProtocolClass _protocol = pi.getProtocol();
- boolean _isConjugated = this.roomExt.isConjugated(pi);
- boolean _handlesReceive = this.roomExt.handlesReceive(_protocol, _isConjugated);
- if (_handlesReceive) {
+ ProtocolClass _protocol_4 = pi.getProtocol();
+ boolean _isConjugated_3 = this._roomExtensions.isConjugated(pi);
+ boolean _handlesReceive_1 = this._roomExtensions.handlesReceive(_protocol_4, _isConjugated_3);
+ if (_handlesReceive_1) {
_builder.append("\t\t");
_builder.append("switch (msg->evtID){");
_builder.newLine();
{
- ProtocolClass _protocol_1 = pi.getProtocol();
- boolean _isConjugated_1 = this.roomExt.isConjugated(pi);
- List<MessageHandler> _receiveHandlers = this.roomExt.getReceiveHandlers(_protocol_1, _isConjugated_1);
- for(final MessageHandler h : _receiveHandlers) {
+ ProtocolClass _protocol_5 = pi.getProtocol();
+ boolean _isConjugated_4 = this._roomExtensions.isConjugated(pi);
+ List<MessageHandler> _receiveHandlers_1 = this._roomExtensions.getReceiveHandlers(_protocol_5, _isConjugated_4);
+ for(final MessageHandler h_1 : _receiveHandlers_1) {
_builder.append("\t\t");
- _builder.append("\t");
_builder.append("case ");
- ProtocolClass _protocol_2 = pi.getProtocol();
- String _name_1 = _protocol_2.getName();
- _builder.append(_name_1, " ");
+ ProtocolClass _protocol_6 = pi.getProtocol();
+ String _name_12 = _protocol_6.getName();
+ _builder.append(_name_12, " ");
_builder.append("_");
- Message _msg = h.getMsg();
- String _codeName = this.roomExt.getCodeName(_msg);
- _builder.append(_codeName, " ");
+ Message _msg_2 = h_1.getMsg();
+ String _codeName_1 = this._roomExtensions.getCodeName(_msg_2);
+ _builder.append(_codeName_1, " ");
_builder.append(":");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t");
- _builder.append("\t");
- ProtocolClass _protocol_3 = pi.getProtocol();
- boolean _isConjugated_2 = this.roomExt.isConjugated(pi);
- String _portClassName = this.roomExt.getPortClassName(_protocol_3, _isConjugated_2);
- _builder.append(_portClassName, " ");
+ ProtocolClass _protocol_7 = pi.getProtocol();
+ boolean _isConjugated_5 = this._roomExtensions.isConjugated(pi);
+ String _portClassName_1 = this._roomExtensions.getPortClassName(_protocol_7, _isConjugated_5);
+ _builder.append(_portClassName_1, " ");
_builder.append("_");
- Message _msg_1 = h.getMsg();
- String _name_2 = _msg_1.getName();
- _builder.append(_name_2, " ");
+ Message _msg_3 = h_1.getMsg();
+ String _name_13 = _msg_3.getName();
+ _builder.append(_name_13, " ");
_builder.append("_receiveHandler((etPort *)&");
- String _path_1 = ai.getPath();
- String _pathName = this.roomExt.getPathName(_path_1);
- _builder.append(_pathName, " ");
+ String _path_7 = ai.getPath();
+ String _pathName_6 = this._roomExtensions.getPathName(_path_7);
+ _builder.append(_pathName_6, " ");
_builder.append("_const.");
- String _name_3 = pi.getName();
- _builder.append(_name_3, " ");
- _builder.append(".ports[");
- EList<InterfaceItemInstance> _peers_2 = pi.getPeers();
- int _indexOf_1 = _peers_2.indexOf(peer);
- _builder.append(_indexOf_1, " ");
- _builder.append("],msg,(void*)&");
- String _path_2 = ai.getPath();
- String _pathName_1 = this.roomExt.getPathName(_path_2);
- _builder.append(_pathName_1, " ");
+ String _name_14 = pi.getName();
+ _builder.append(_name_14, " ");
+ _builder.append(",msg,(void*)&");
+ String _path_8 = ai.getPath();
+ String _pathName_7 = this._roomExtensions.getPathName(_path_8);
+ _builder.append(_pathName_7, " ");
_builder.append(",");
- ActorClass _actorClass = ai.getActorClass();
- String _name_4 = _actorClass.getName();
- _builder.append(_name_4, " ");
+ ActorClass _actorClass_3 = ai.getActorClass();
+ String _name_15 = _actorClass_3.getName();
+ _builder.append(_name_15, " ");
_builder.append("_receiveMessage);");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
- _builder.append("\t");
_builder.append("break;");
_builder.newLine();
}
}
_builder.append("\t\t");
- _builder.append("\t");
_builder.append("default: ");
- ActorClass _actorClass_1 = ai.getActorClass();
- String _name_5 = _actorClass_1.getName();
- _builder.append(_name_5, " ");
+ ActorClass _actorClass_4 = ai.getActorClass();
+ String _name_16 = _actorClass_4.getName();
+ _builder.append(_name_16, " ");
_builder.append("_receiveMessage((void*)&");
- String _path_3 = ai.getPath();
- String _pathName_2 = this.roomExt.getPathName(_path_3);
- _builder.append(_pathName_2, " ");
+ String _path_9 = ai.getPath();
+ String _pathName_8 = this._roomExtensions.getPathName(_path_9);
+ _builder.append(_pathName_8, " ");
_builder.append(",(etPort*)&");
- String _path_4 = ai.getPath();
- String _pathName_3 = this.roomExt.getPathName(_path_4);
- _builder.append(_pathName_3, " ");
+ String _path_10 = ai.getPath();
+ String _pathName_9 = this._roomExtensions.getPathName(_path_10);
+ _builder.append(_pathName_9, " ");
_builder.append("_const.");
- String _name_6 = pi.getName();
- _builder.append(_name_6, " ");
- _builder.append(".ports[");
- EList<InterfaceItemInstance> _peers_3 = pi.getPeers();
- int _indexOf_2 = _peers_3.indexOf(peer);
- _builder.append(_indexOf_2, " ");
- _builder.append("], msg);");
+ String _name_17 = pi.getName();
+ _builder.append(_name_17, " ");
+ _builder.append(", msg);");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
- _builder.append("\t");
_builder.append("break;");
_builder.newLine();
_builder.append("\t\t");
- _builder.append("\t");
- _builder.append("}\t\t\t\t\t\t\t\t\t\t");
+ _builder.append("}");
_builder.newLine();
} else {
_builder.append("\t\t");
- ActorClass _actorClass_2 = ai.getActorClass();
- String _name_7 = _actorClass_2.getName();
- _builder.append(_name_7, " ");
+ ActorClass _actorClass_5 = ai.getActorClass();
+ String _name_18 = _actorClass_5.getName();
+ _builder.append(_name_18, " ");
_builder.append("_receiveMessage((void*)&");
- String _path_5 = ai.getPath();
- String _pathName_4 = this.roomExt.getPathName(_path_5);
- _builder.append(_pathName_4, " ");
+ String _path_11 = ai.getPath();
+ String _pathName_10 = this._roomExtensions.getPathName(_path_11);
+ _builder.append(_pathName_10, " ");
_builder.append(",(etPort*)&");
- String _path_6 = ai.getPath();
- String _pathName_5 = this.roomExt.getPathName(_path_6);
- _builder.append(_pathName_5, " ");
- _builder.append("_const.");
- String _name_8 = pi.getName();
- _builder.append(_name_8, " ");
- _builder.append(".ports[");
- EList<InterfaceItemInstance> _peers_4 = pi.getPeers();
- int _indexOf_3 = _peers_4.indexOf(peer);
- _builder.append(_indexOf_3, " ");
- _builder.append("], msg);");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t\t");
- _builder.append("break;");
- _builder.newLine();
- }
- }
- } else {
- _builder.append("\t\t");
- _builder.append("case ");
- int _objId_1 = pi.getObjId();
- _builder.append(_objId_1, " ");
- _builder.append(":");
- _builder.newLineIfNotEmpty();
- {
- ProtocolClass _protocol_4 = pi.getProtocol();
- boolean _isConjugated_3 = this.roomExt.isConjugated(pi);
- boolean _handlesReceive_1 = this.roomExt.handlesReceive(_protocol_4, _isConjugated_3);
- if (_handlesReceive_1) {
- _builder.append("\t\t");
- _builder.append("switch (msg->evtID){");
- _builder.newLine();
- {
- ProtocolClass _protocol_5 = pi.getProtocol();
- boolean _isConjugated_4 = this.roomExt.isConjugated(pi);
- List<MessageHandler> _receiveHandlers_1 = this.roomExt.getReceiveHandlers(_protocol_5, _isConjugated_4);
- for(final MessageHandler h_1 : _receiveHandlers_1) {
- _builder.append("\t\t");
- _builder.append("case ");
- ProtocolClass _protocol_6 = pi.getProtocol();
- String _name_9 = _protocol_6.getName();
- _builder.append(_name_9, " ");
- _builder.append("_");
- Message _msg_2 = h_1.getMsg();
- String _codeName_1 = this.roomExt.getCodeName(_msg_2);
- _builder.append(_codeName_1, " ");
- _builder.append(":");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- ProtocolClass _protocol_7 = pi.getProtocol();
- boolean _isConjugated_5 = this.roomExt.isConjugated(pi);
- String _portClassName_1 = this.roomExt.getPortClassName(_protocol_7, _isConjugated_5);
- _builder.append(_portClassName_1, " ");
- _builder.append("_");
- Message _msg_3 = h_1.getMsg();
- String _name_10 = _msg_3.getName();
- _builder.append(_name_10, " ");
- _builder.append("_receiveHandler((etPort *)&");
- String _path_7 = ai.getPath();
- String _pathName_6 = this.roomExt.getPathName(_path_7);
- _builder.append(_pathName_6, " ");
+ String _path_12 = ai.getPath();
+ String _pathName_11 = this._roomExtensions.getPathName(_path_12);
+ _builder.append(_pathName_11, " ");
_builder.append("_const.");
- String _name_11 = pi.getName();
- _builder.append(_name_11, " ");
- _builder.append(",msg,(void*)&");
- String _path_8 = ai.getPath();
- String _pathName_7 = this.roomExt.getPathName(_path_8);
- _builder.append(_pathName_7, " ");
- _builder.append(",");
- ActorClass _actorClass_3 = ai.getActorClass();
- String _name_12 = _actorClass_3.getName();
- _builder.append(_name_12, " ");
- _builder.append("_receiveMessage);");
+ String _name_19 = pi.getName();
+ _builder.append(_name_19, " ");
+ _builder.append(", msg);");
_builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("break;");
- _builder.newLine();
}
}
_builder.append("\t\t");
- _builder.append("default: ");
- ActorClass _actorClass_4 = ai.getActorClass();
- String _name_13 = _actorClass_4.getName();
- _builder.append(_name_13, " ");
- _builder.append("_receiveMessage((void*)&");
- String _path_9 = ai.getPath();
- String _pathName_8 = this.roomExt.getPathName(_path_9);
- _builder.append(_pathName_8, " ");
- _builder.append(",(etPort*)&");
- String _path_10 = ai.getPath();
- String _pathName_9 = this.roomExt.getPathName(_path_10);
- _builder.append(_pathName_9, " ");
- _builder.append("_const.");
- String _name_14 = pi.getName();
- _builder.append(_name_14, " ");
- _builder.append(", msg);");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
_builder.append("break;");
_builder.newLine();
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- } else {
- _builder.append("\t\t");
- ActorClass _actorClass_5 = ai.getActorClass();
- String _name_15 = _actorClass_5.getName();
- _builder.append(_name_15, " ");
- _builder.append("_receiveMessage((void*)&");
- String _path_11 = ai.getPath();
- String _pathName_10 = this.roomExt.getPathName(_path_11);
- _builder.append(_pathName_10, " ");
- _builder.append(",(etPort*)&");
- String _path_12 = ai.getPath();
- String _pathName_11 = this.roomExt.getPathName(_path_12);
- _builder.append(_pathName_11, " ");
- _builder.append("_const.");
- String _name_16 = pi.getName();
- _builder.append(_name_16, " ");
- _builder.append(", msg);");
- _builder.newLineIfNotEmpty();
}
}
- _builder.append("\t\t");
- _builder.append("break;");
- _builder.newLine();
}
}
}
}
+ _builder.append("\t\t");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("default:");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("etLogger_logErrorF(\"MessageService_");
+ String _name_20 = thread.getName();
+ _builder.append(_name_20, " ");
+ _builder.append("_receiveMessage: address %d does not exist \", msg->address);");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("break;");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
}
}
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("default:");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("etLogger_logErrorF(\"MessageService_Thread1_receiveMessage: address %d does not exist \", msg->address);");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("break;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
_xblockexpression = (_builder);
}
return _xblockexpression;
@@ -1715,7 +1928,7 @@ public class SubSystemClassGen {
_builder.append(_name, "");
_builder.append("_execute(&");
String _path = ai.getPath();
- String _pathName = this.roomExt.getPathName(_path);
+ String _pathName = this._roomExtensions.getPathName(_path);
_builder.append(_pathName, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemRunnerGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java
index 033adcbd2..098b60adb 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemRunnerGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java
@@ -2,46 +2,67 @@ package org.eclipse.etrice.generator.c.gen;
import com.google.inject.Inject;
import com.google.inject.Singleton;
-import org.eclipse.emf.common.util.EList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.etrice.core.etmap.util.ETMapUtil;
+import org.eclipse.etrice.core.etphys.eTPhys.NodeRef;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance;
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
import org.eclipse.etrice.core.room.SubSystemClass;
+import org.eclipse.etrice.generator.c.gen.CExtensions;
import org.eclipse.etrice.generator.generic.RoomExtensions;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
@Singleton
@SuppressWarnings("all")
-public class SubSystemRunnerGen {
+public class NodeRunnerGen {
@Inject
private JavaIoFileSystemAccess fileAccess;
@Inject
- private RoomExtensions roomExt;
+ private CExtensions _cExtensions;
+
+ @Inject
+ private RoomExtensions _roomExtensions;
public void doGenerate(final Root root) {
- EList<SubSystemInstance> _subSystemInstances = root.getSubSystemInstances();
- for (final SubSystemInstance sc : _subSystemInstances) {
- {
- SubSystemClass _subSystemClass = sc.getSubSystemClass();
- String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass);
- SubSystemClass _subSystemClass_1 = sc.getSubSystemClass();
- String _path = this.roomExt.getPath(_subSystemClass_1);
- String _plus = (_generationTargetPath + _path);
- this.fileAccess.setOutputPath(_plus);
- SubSystemClass _subSystemClass_2 = sc.getSubSystemClass();
- String _name = _subSystemClass_2.getName();
- String _plus_1 = (_name + "_Runner.c");
- CharSequence _generateSourceFile = this.generateSourceFile(root, sc);
- this.fileAccess.generateFile(_plus_1, _generateSourceFile);
+ boolean first = true;
+ Collection<NodeRef> _nodeRefs = ETMapUtil.getNodeRefs();
+ for (final NodeRef nr : _nodeRefs) {
+ List<String> _subSystemInstancePaths = ETMapUtil.getSubSystemInstancePaths(nr);
+ for (final String instpath : _subSystemInstancePaths) {
+ {
+ StructureInstance _instance = root.getInstance(instpath);
+ final SubSystemInstance ssi = ((SubSystemInstance) _instance);
+ String _name = nr.getName();
+ String _plus = (_name + "_");
+ String _name_1 = ssi.getName();
+ final String clsname = (_plus + _name_1);
+ SubSystemClass _subSystemClass = ssi.getSubSystemClass();
+ String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass);
+ SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass();
+ String _path = this._roomExtensions.getPath(_subSystemClass_1);
+ String _plus_1 = (_generationTargetPath + _path);
+ this.fileAccess.setOutputPath(_plus_1);
+ String _plus_2 = (clsname + "_Runner.c");
+ CharSequence _generateSourceFile = this.generateSourceFile(root, ssi, first);
+ this.fileAccess.generateFile(_plus_2, _generateSourceFile);
+ first = false;
+ }
}
}
}
- public CharSequence generateSourceFile(final Root root, final SubSystemInstance ssi) {
+ public CharSequence generateSourceFile(final Root root, final SubSystemInstance ssi, final boolean first) {
CharSequence _xblockexpression = null;
{
- final SubSystemClass ssc = ssi.getSubSystemClass();
+ final NodeRef nr = ETMapUtil.getNodeRef(ssi);
+ String _name = nr.getName();
+ String _plus = (_name + "_");
+ String _name_1 = ssi.getName();
+ final String clsname = (_plus + _name_1);
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
@@ -52,14 +73,20 @@ public class SubSystemRunnerGen {
_builder.append("*");
_builder.newLine();
_builder.append(" ");
- _builder.append("* this class contains the main function running component ");
- String _name = ssi.getName();
- _builder.append(_name, " ");
+ _builder.append("* this class contains the main function running Node ");
+ String _name_2 = nr.getName();
+ _builder.append(_name_2, " ");
+ _builder.append(" with SubSystem ");
+ String _name_3 = ssi.getName();
+ _builder.append(_name_3, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
- _builder.append("* it instantiates ");
- String _name_1 = ssi.getName();
- _builder.append(_name_1, " ");
+ _builder.append("* it instantiates Node ");
+ String _name_4 = nr.getName();
+ _builder.append(_name_4, " ");
+ _builder.append(" with SubSystem ");
+ String _name_5 = ssi.getName();
+ _builder.append(_name_5, " ");
_builder.append(" and starts and ends the lifecycle");
_builder.newLineIfNotEmpty();
_builder.append(" ");
@@ -68,9 +95,9 @@ public class SubSystemRunnerGen {
_builder.newLine();
_builder.newLine();
_builder.append("#include \"");
- String _name_2 = ssc.getName();
- _builder.append(_name_2, "");
- _builder.append(".h\"");
+ String _cHeaderFileName = this._cExtensions.getCHeaderFileName(nr, ssi);
+ _builder.append(_cHeaderFileName, "");
+ _builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("#include \"debugging/etLogger.h\"");
@@ -93,8 +120,15 @@ public class SubSystemRunnerGen {
_builder.append("*/");
_builder.newLine();
_builder.newLine();
- _builder.append("int main(void) {");
- _builder.newLine();
+ {
+ if (first) {
+ _builder.append("int main(void) {");
+ _builder.newLine();
+ } else {
+ _builder.append("static int main_unused(void) {");
+ _builder.newLine();
+ }
+ }
_builder.append("\t");
_builder.append("etUserEntry(); /* platform specific */");
_builder.newLine();
@@ -111,13 +145,11 @@ public class SubSystemRunnerGen {
_builder.append("/* startup sequence of lifecycle */");
_builder.newLine();
_builder.append("\t");
- String _name_3 = ssc.getName();
- _builder.append(_name_3, " ");
+ _builder.append(clsname, " ");
_builder.append("_init(); \t\t/* lifecycle init */");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- String _name_4 = ssc.getName();
- _builder.append(_name_4, " ");
+ _builder.append(clsname, " ");
_builder.append("_start(); \t/* lifecycle start */");
_builder.newLineIfNotEmpty();
_builder.newLine();
@@ -129,8 +161,7 @@ public class SubSystemRunnerGen {
_builder.append("/* run Scheduler */");
_builder.newLine();
_builder.append("\t");
- String _name_5 = ssc.getName();
- _builder.append(_name_5, " ");
+ _builder.append(clsname, " ");
_builder.append("_run();");
_builder.newLineIfNotEmpty();
_builder.newLine();
@@ -142,13 +173,11 @@ public class SubSystemRunnerGen {
_builder.append("/* shutdown sequence of lifecycle */");
_builder.newLine();
_builder.append("\t");
- String _name_6 = ssc.getName();
- _builder.append(_name_6, " ");
+ _builder.append(clsname, " ");
_builder.append("_stop(); \t\t/* lifecycle stop */");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- String _name_7 = ssc.getName();
- _builder.append(_name_7, " ");
+ _builder.append(clsname, " ");
_builder.append("_destroy(); \t/* lifecycle destroy */");
_builder.newLineIfNotEmpty();
_builder.newLine();
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java
index aeb1f86f4..cc91d9405 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java
@@ -109,7 +109,7 @@ public class StateMachineGen extends GenericStateMachineGenerator {
_builder.append("* self, int new_state) {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("self->state = new_state;");
+ _builder.append("self->state = (etInt16) new_state;");
_builder.newLine();
_builder.append("}");
_builder.newLine();

Back to the top