Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2012-08-21 22:02:40 +0000
committerJuergen Haug2012-08-21 22:02:40 +0000
commit927c25922c80dc2cca4156194c4da89920fa6f0d (patch)
treed3e0cbc1b8bc0ea6bbef855eb062851d3cf572cd /plugins/org.eclipse.etrice.generator.c
parented265d34bda7e5677e0e3e58de3ff549dd04b05a (diff)
parent537d59a08f64a6c8f053047bff966b770a676084 (diff)
downloadorg.eclipse.etrice-927c25922c80dc2cca4156194c4da89920fa6f0d.tar.gz
org.eclipse.etrice-927c25922c80dc2cca4156194c4da89920fa6f0d.tar.xz
org.eclipse.etrice-927c25922c80dc2cca4156194c4da89920fa6f0d.zip
Merge branch 'change/6958/6'
Conflicts: plugins/org.eclipse.etrice.core.config/src-gen/org/eclipse/etrice/core/serializer/AbstractConfigSemanticSequencer.java plugins/org.eclipse.etrice.core.config/src-gen/org/eclipse/etrice/core/serializer/AbstractConfigSyntacticSequencer.java plugins/org.eclipse.etrice.core.config/src-gen/org/eclipse/etrice/core/services/ConfigGrammarAccess.java plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ConfigExtension.java plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/ChoicePointTest/CPTest_Top.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/ChoicePointTest/CPTester.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/ChoicePointTest/CPUser.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/ConfigTest/AC1_ac.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/ConfigTest/ConfigText_Top_ac.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/ConfigTest/Testee_ac.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/HandlerTest/HandlerTest_Top.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/HandlerTest/HandlerUser.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/HandlerTest/Tester.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTest/MrPingActor.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTest/MrPongActor1.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTest/MrPongActor2.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTest/PingPongTop.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTestReplPort/MrPingActor.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTestReplPort/MrPongActor1.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTestReplPort/PingPongTop.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/MrPing.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/MrPong.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/SendingDataTop.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/tests/App_SubSystemHFSMTest.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/tests/a_HFSM.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/tests/a_HFSM_Tester.java tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/tests/a_HFSM_Tests.java Change-Id: Ied039afea85c6e0735deac864af84d74fafc45a7
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.c')
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java779
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java240
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java247
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java60
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java1185
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java117
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java1679
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemRunnerGen.java171
9 files changed, 4 insertions, 4478 deletions
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 e4afca200..9ab45875c 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
@@ -21,6 +21,7 @@ package org.eclipse.etrice.generator.c.gen
import com.google.inject.Inject
import com.google.inject.Singleton
import org.eclipse.etrice.core.room.Message
+import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.RoomClass
import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.etrice.generator.generic.AbstractTransitionChainGenerator
@@ -153,4 +154,7 @@ class CExtensions implements ILanguageExtension {
override String superCall(String baseClassName, String method, String args) {
""
}
+ override String toValueLiteral(PrimitiveType type, String value){
+ throw new UnsupportedOperationException("TODO Config for C");
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java
deleted file mode 100644
index 5e1afeec5..000000000
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java
+++ /dev/null
@@ -1,779 +0,0 @@
-package org.eclipse.etrice.generator.c.gen;
-
-import com.google.common.base.Objects;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import java.util.HashSet;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.etrice.core.genmodel.base.ILogger;
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.ActorCommunicationType;
-import org.eclipse.etrice.core.room.Annotation;
-import org.eclipse.etrice.core.room.Attribute;
-import org.eclipse.etrice.core.room.CommunicationType;
-import org.eclipse.etrice.core.room.DataClass;
-import org.eclipse.etrice.core.room.GeneralProtocolClass;
-import org.eclipse.etrice.core.room.Port;
-import org.eclipse.etrice.core.room.ProtocolClass;
-import org.eclipse.etrice.core.room.SAPRef;
-import org.eclipse.etrice.core.room.SPPRef;
-import org.eclipse.etrice.core.room.ServiceImplementation;
-import org.eclipse.etrice.core.room.StandardOperation;
-import org.eclipse.etrice.core.room.StateGraph;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.generator.c.gen.CExtensions;
-import org.eclipse.etrice.generator.c.gen.StateMachineGen;
-import org.eclipse.etrice.generator.generic.GenericActorClassGenerator;
-import org.eclipse.etrice.generator.generic.ProcedureHelpers;
-import org.eclipse.etrice.generator.generic.RoomExtensions;
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-
-@Singleton
-@SuppressWarnings("all")
-public class ActorClassGen extends GenericActorClassGenerator {
- @Inject
- private JavaIoFileSystemAccess fileAccess;
-
- @Inject
- private CExtensions _cExtensions;
-
- @Inject
- private RoomExtensions _roomExtensions;
-
- @Inject
- private ProcedureHelpers _procedureHelpers;
-
- @Inject
- private StateMachineGen _stateMachineGen;
-
- @Inject
- private ILogger logger;
-
- public void doGenerate(final Root root) {
- EList<ExpandedActorClass> _xpActorClasses = root.getXpActorClasses();
- for (final ExpandedActorClass xpac : _xpActorClasses) {
- {
- ActorClass _actorClass = xpac.getActorClass();
- String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_actorClass);
- ActorClass _actorClass_1 = xpac.getActorClass();
- String _path = this._roomExtensions.getPath(_actorClass_1);
- String path = (_generationTargetPath + _path);
- ActorClass _actorClass_2 = xpac.getActorClass();
- String _cHeaderFileName = this._cExtensions.getCHeaderFileName(_actorClass_2);
- String _plus = ("generating ActorClass header \'" + _cHeaderFileName);
- 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);
- ActorClass _actorClass_3 = xpac.getActorClass();
- String _cHeaderFileName_1 = this._cExtensions.getCHeaderFileName(_actorClass_3);
- ActorClass _actorClass_4 = xpac.getActorClass();
- CharSequence _generateHeaderFile = this.generateHeaderFile(root, xpac, _actorClass_4);
- this.fileAccess.generateFile(_cHeaderFileName_1, _generateHeaderFile);
- boolean _hasBehaviorAnnotation = this.hasBehaviorAnnotation(xpac, "BehaviorManual");
- if (_hasBehaviorAnnotation) {
- ActorClass _actorClass_5 = xpac.getActorClass();
- String _name = _actorClass_5.getName();
- String _plus_4 = ("omitting ActorClass source for \'" + _name);
- String _plus_5 = (_plus_4 + "\' since @BehaviorManual is specified");
- this.logger.logInfo(_plus_5);
- } else {
- ActorClass _actorClass_6 = xpac.getActorClass();
- String _cSourceFileName = this._cExtensions.getCSourceFileName(_actorClass_6);
- String _plus_6 = ("generating ActorClass source \'" + _cSourceFileName);
- String _plus_7 = (_plus_6 + "\' in \'");
- String _plus_8 = (_plus_7 + path);
- String _plus_9 = (_plus_8 + "\'");
- this.logger.logInfo(_plus_9);
- this.fileAccess.setOutputPath(path);
- ActorClass _actorClass_7 = xpac.getActorClass();
- String _cSourceFileName_1 = this._cExtensions.getCSourceFileName(_actorClass_7);
- ActorClass _actorClass_8 = xpac.getActorClass();
- CharSequence _generateSourceFile = this.generateSourceFile(root, xpac, _actorClass_8);
- this.fileAccess.generateFile(_cSourceFileName_1, _generateSourceFile);
- }
- }
- }
- }
-
- private boolean hasBehaviorAnnotation(final ExpandedActorClass xpac, final String annotation) {
- ActorClass _actorClass = xpac.getActorClass();
- EList<Annotation> _behaviorAnnotations = _actorClass.getBehaviorAnnotations();
- boolean _notEquals = (!Objects.equal(_behaviorAnnotations, null));
- if (_notEquals) {
- ActorClass _actorClass_1 = xpac.getActorClass();
- EList<Annotation> _behaviorAnnotations_1 = _actorClass_1.getBehaviorAnnotations();
- final Function1<Annotation,Boolean> _function = new Function1<Annotation,Boolean>() {
- public Boolean apply(final Annotation e) {
- String _name = e.getName();
- boolean _equals = Objects.equal(_name, annotation);
- return Boolean.valueOf(_equals);
- }
- };
- Annotation _findFirst = IterableExtensions.<Annotation>findFirst(_behaviorAnnotations_1, _function);
- boolean _notEquals_1 = (!Objects.equal(_findFirst, null));
- if (_notEquals_1) {
- return true;
- }
- }
- return false;
- }
-
- private CharSequence generateHeaderFile(final Root root, final ExpandedActorClass xpac, final ActorClass ac) {
- CharSequence _xblockexpression = null;
- {
- List<Port> _allEndPorts = this._roomExtensions.getAllEndPorts(ac);
- final Function1<Port,Boolean> _function = new Function1<Port,Boolean>() {
- public Boolean apply(final Port p) {
- GeneralProtocolClass _protocol = p.getProtocol();
- CommunicationType _commType = ((ProtocolClass) _protocol).getCommType();
- boolean _equals = Objects.equal(_commType, CommunicationType.EVENT_DRIVEN);
- return Boolean.valueOf(_equals);
- }
- };
- Iterable<Port> eventPorts = IterableExtensions.<Port>filter(_allEndPorts, _function);
- List<Port> _allEndPorts_1 = this._roomExtensions.getAllEndPorts(ac);
- final Function1<Port,Boolean> _function_1 = new Function1<Port,Boolean>() {
- public Boolean apply(final Port p) {
- boolean _and = false;
- GeneralProtocolClass _protocol = p.getProtocol();
- CommunicationType _commType = ((ProtocolClass) _protocol).getCommType();
- boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN);
- if (!_equals) {
- _and = false;
- } else {
- boolean _isConjugated = p.isConjugated();
- _and = (_equals && _isConjugated);
- }
- return Boolean.valueOf(_and);
- }
- };
- Iterable<Port> sendPorts = IterableExtensions.<Port>filter(_allEndPorts_1, _function_1);
- List<Port> _allEndPorts_2 = this._roomExtensions.getAllEndPorts(ac);
- final Function1<Port,Boolean> _function_2 = new Function1<Port,Boolean>() {
- public Boolean apply(final Port p) {
- boolean _and = false;
- GeneralProtocolClass _protocol = p.getProtocol();
- CommunicationType _commType = ((ProtocolClass) _protocol).getCommType();
- boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN);
- if (!_equals) {
- _and = false;
- } else {
- boolean _isConjugated = p.isConjugated();
- boolean _not = (!_isConjugated);
- _and = (_equals && _not);
- }
- return Boolean.valueOf(_and);
- }
- };
- Iterable<Port> recvPorts = IterableExtensions.<Port>filter(_allEndPorts_2, _function_2);
- ActorCommunicationType _commType = ac.getCommType();
- boolean dataDriven = Objects.equal(_commType, ActorCommunicationType.DATA_DRIVEN);
- ActorCommunicationType _commType_1 = ac.getCommType();
- boolean async = Objects.equal(_commType_1, ActorCommunicationType.ASYNCHRONOUS);
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* Header File of ActorClass ");
- String _name = ac.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* ");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- String _name_1 = ac.getName();
- CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(_name_1);
- _builder.append(_generateIncludeGuardBegin, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("#include \"etDatatypes.h\"");
- _builder.newLine();
- _builder.append("#include \"messaging/etMessage.h\"");
- _builder.newLine();
- _builder.newLine();
- {
- HashSet<DataClass> _referencedDataClasses = root.getReferencedDataClasses(ac);
- for(final DataClass dataClass : _referencedDataClasses) {
- _builder.append("#include \"");
- String _name_2 = dataClass.getName();
- _builder.append(_name_2, "");
- _builder.append(".h\"");
- _builder.newLineIfNotEmpty();
- }
- }
- {
- EList<ProtocolClass> _referencedProtocolClasses = root.getReferencedProtocolClasses(ac);
- for(final ProtocolClass pc : _referencedProtocolClasses) {
- _builder.append("#include \"");
- String _name_3 = pc.getName();
- _builder.append(_name_3, "");
- _builder.append(".h\"");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- CharSequence _userCode = this._procedureHelpers.userCode(ac, 1);
- _builder.append(_userCode, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("typedef struct ");
- String _name_4 = ac.getName();
- _builder.append(_name_4, "");
- _builder.append(" ");
- String _name_5 = ac.getName();
- _builder.append(_name_5, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/* const part of ActorClass (ROM) */");
- _builder.newLine();
- {
- boolean _and = false;
- boolean _and_1 = false;
- boolean _and_2 = false;
- boolean _isEmpty = IterableExtensions.isEmpty(eventPorts);
- if (!_isEmpty) {
- _and_2 = false;
- } else {
- boolean _isEmpty_1 = IterableExtensions.isEmpty(recvPorts);
- _and_2 = (_isEmpty && _isEmpty_1);
- }
- if (!_and_2) {
- _and_1 = false;
- } else {
- List<SAPRef> _allSAPs = this._roomExtensions.getAllSAPs(ac);
- boolean _isEmpty_2 = _allSAPs.isEmpty();
- _and_1 = (_and_2 && _isEmpty_2);
- }
- if (!_and_1) {
- _and = false;
- } else {
- List<ServiceImplementation> _allServiceImplementations = this._roomExtensions.getAllServiceImplementations(ac);
- boolean _isEmpty_3 = _allServiceImplementations.isEmpty();
- _and = (_and_1 && _isEmpty_3);
- }
- if (_and) {
- _builder.append("/* this actor class has no ports and thus no constant data */");
- _builder.newLine();
- } else {
- _builder.append("typedef struct ");
- String _name_6 = ac.getName();
- _builder.append(_name_6, "");
- _builder.append("_const {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("/* simple ports */");
- _builder.newLine();
- {
- for(final Port ep : eventPorts) {
- {
- int _multiplicity = ep.getMultiplicity();
- boolean _equals = (_multiplicity == 1);
- if (_equals) {
- _builder.append("\t");
- _builder.append("const ");
- String _portClassName = this._roomExtensions.getPortClassName(ep);
- _builder.append(_portClassName, " ");
- _builder.append(" ");
- String _name_7 = ep.getName();
- _builder.append(_name_7, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* data receive ports */");
- _builder.newLine();
- {
- for(final Port ep_1 : recvPorts) {
- {
- int _multiplicity_1 = ep_1.getMultiplicity();
- boolean _equals_1 = (_multiplicity_1 == 1);
- if (_equals_1) {
- _builder.append("\t");
- _builder.append("const ");
- String _portClassName_1 = this._roomExtensions.getPortClassName(ep_1);
- _builder.append(_portClassName_1, " ");
- _builder.append(" ");
- String _name_8 = ep_1.getName();
- _builder.append(_name_8, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* saps */");
- _builder.newLine();
- {
- List<SAPRef> _allSAPs_1 = this._roomExtensions.getAllSAPs(ac);
- for(final SAPRef sap : _allSAPs_1) {
- _builder.append("\t");
- _builder.append("const ");
- String _portClassName_2 = this._roomExtensions.getPortClassName(sap);
- _builder.append(_portClassName_2, " ");
- _builder.append(" ");
- String _name_9 = sap.getName();
- _builder.append(_name_9, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* replicated ports */");
- _builder.newLine();
- {
- List<Port> _allEndPorts_3 = this._roomExtensions.getAllEndPorts(ac);
- for(final Port ep_2 : _allEndPorts_3) {
- {
- int _multiplicity_2 = ep_2.getMultiplicity();
- boolean _notEquals = (_multiplicity_2 != 1);
- if (_notEquals) {
- _builder.append("\t");
- _builder.append("const etReplPort ");
- String _name_10 = ep_2.getName();
- _builder.append(_name_10, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* services */");
- _builder.newLine();
- {
- List<ServiceImplementation> _allServiceImplementations_1 = this._roomExtensions.getAllServiceImplementations(ac);
- for(final ServiceImplementation svc : _allServiceImplementations_1) {
- _builder.append("\t");
- _builder.append("const etReplPort ");
- SPPRef _spp = svc.getSpp();
- String _name_11 = _spp.getName();
- _builder.append(_name_11, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("} ");
- String _name_12 = ac.getName();
- _builder.append(_name_12, "");
- _builder.append("_const;");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- {
- StateGraph _stateMachine = xpac.getStateMachine();
- boolean _isEmpty_4 = RoomHelpers.isEmpty(_stateMachine);
- boolean _not = (!_isEmpty_4);
- if (_not) {
- _builder.newLine();
- CharSequence _genHeaderConstants = this._stateMachineGen.genHeaderConstants(xpac);
- _builder.append(_genHeaderConstants, "");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- _builder.append("/* variable part of ActorClass (RAM) */");
- _builder.newLine();
- _builder.append("struct ");
- String _name_13 = ac.getName();
- _builder.append(_name_13, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- {
- boolean _and_3 = false;
- boolean _and_4 = false;
- boolean _and_5 = false;
- boolean _isEmpty_5 = IterableExtensions.isEmpty(eventPorts);
- if (!_isEmpty_5) {
- _and_5 = false;
- } else {
- boolean _isEmpty_6 = IterableExtensions.isEmpty(recvPorts);
- _and_5 = (_isEmpty_5 && _isEmpty_6);
- }
- if (!_and_5) {
- _and_4 = false;
- } else {
- List<SAPRef> _allSAPs_2 = this._roomExtensions.getAllSAPs(ac);
- boolean _isEmpty_7 = _allSAPs_2.isEmpty();
- _and_4 = (_and_5 && _isEmpty_7);
- }
- if (!_and_4) {
- _and_3 = false;
- } else {
- List<ServiceImplementation> _allServiceImplementations_2 = this._roomExtensions.getAllServiceImplementations(ac);
- boolean _isEmpty_8 = _allServiceImplementations_2.isEmpty();
- _and_3 = (_and_4 && _isEmpty_8);
- }
- boolean _not_1 = (!_and_3);
- if (_not_1) {
- _builder.append("\t");
- _builder.append("const ");
- String _name_14 = ac.getName();
- _builder.append(_name_14, " ");
- _builder.append("_const* const constData;");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.newLine();
- }
- }
- _builder.append("\t");
- _builder.append("/* data send ports */");
- _builder.newLine();
- {
- for(final Port ep_3 : sendPorts) {
- {
- int _multiplicity_3 = ep_3.getMultiplicity();
- boolean _equals_2 = (_multiplicity_3 == 1);
- if (_equals_2) {
- _builder.append("\t");
- String _portClassName_3 = this._roomExtensions.getPortClassName(ep_3);
- _builder.append(_portClassName_3, " ");
- _builder.append(" ");
- String _name_15 = ep_3.getName();
- _builder.append(_name_15, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.newLine();
- _builder.append("\t");
- List<Attribute> _allAttributes = this._roomExtensions.getAllAttributes(ac);
- CharSequence _attributes = this._procedureHelpers.attributes(_allAttributes);
- _builder.append(_attributes, " ");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- {
- List<Attribute> _allAttributes_1 = this._roomExtensions.getAllAttributes(ac);
- for(final Attribute a : _allAttributes_1) {
- {
- String _defaultValueLiteral = a.getDefaultValueLiteral();
- boolean _notEquals_1 = (!Objects.equal(_defaultValueLiteral, null));
- if (_notEquals_1) {
- String _name_16 = ac.getName();
- String _plus = (_name_16 + " ");
- String _name_17 = a.getName();
- String _plus_1 = (_plus + _name_17);
- String _plus_2 = (_plus_1 + ": Attribute initialization not supported in C");
- this.logger.logInfo(_plus_2);
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.append("\t");
- _builder.newLine();
- {
- StateGraph _stateMachine_1 = xpac.getStateMachine();
- boolean _isEmpty_9 = RoomHelpers.isEmpty(_stateMachine_1);
- boolean _not_2 = (!_isEmpty_9);
- if (_not_2) {
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("\t");
- CharSequence _genDataMembers = this._stateMachineGen.genDataMembers(xpac);
- _builder.append(_genDataMembers, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("};");
- _builder.newLine();
- _builder.newLine();
- _builder.append("void ");
- String _name_18 = ac.getName();
- _builder.append(_name_18, "");
- _builder.append("_init(");
- String _name_19 = ac.getName();
- _builder.append(_name_19, "");
- _builder.append("* self);");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("void ");
- String _name_20 = ac.getName();
- _builder.append(_name_20, "");
- _builder.append("_receiveMessage(void* self, void* ifitem, const etMessage* msg);");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- {
- boolean _or = false;
- if (dataDriven) {
- _or = true;
- } else {
- _or = (dataDriven || async);
- }
- if (_or) {
- _builder.append("void ");
- String _name_21 = ac.getName();
- _builder.append(_name_21, "");
- _builder.append("_execute(");
- String _name_22 = ac.getName();
- _builder.append(_name_22, "");
- _builder.append("* self);");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- EList<StandardOperation> _operations = ac.getOperations();
- String _name_23 = ac.getName();
- CharSequence _operationsDeclaration = this._procedureHelpers.operationsDeclaration(_operations, _name_23);
- _builder.append(_operationsDeclaration, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- CharSequence _userCode_1 = this._procedureHelpers.userCode(ac, 2);
- _builder.append(_userCode_1, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- String _name_24 = ac.getName();
- CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(_name_24);
- _builder.append(_generateIncludeGuardEnd, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- private CharSequence generateSourceFile(final Root root, final ExpandedActorClass xpac, final ActorClass ac) {
- CharSequence _xblockexpression = null;
- {
- ActorCommunicationType _commType = ac.getCommType();
- boolean async = Objects.equal(_commType, ActorCommunicationType.ASYNCHRONOUS);
- ActorCommunicationType _commType_1 = ac.getCommType();
- boolean eventDriven = Objects.equal(_commType_1, ActorCommunicationType.EVENT_DRIVEN);
- ActorCommunicationType _commType_2 = ac.getCommType();
- boolean dataDriven = Objects.equal(_commType_2, ActorCommunicationType.DATA_DRIVEN);
- boolean _or = false;
- if (async) {
- _or = true;
- } else {
- _or = (async || eventDriven);
- }
- boolean handleEvents = _or;
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* Source File of ActorClass ");
- String _name = ac.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* ");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- _builder.append("#include \"");
- String _cHeaderFileName = this._cExtensions.getCHeaderFileName(ac);
- _builder.append(_cHeaderFileName, "");
- _builder.append("\"");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("#include \"modelbase/etActor.h\"");
- _builder.newLine();
- _builder.append("#include \"debugging/etLogger.h\"");
- _builder.newLine();
- _builder.append("#include \"debugging/etMSCLogger.h\"");
- _builder.newLine();
- _builder.append("#include \"platform/etMemory.h\"");
- _builder.newLine();
- _builder.newLine();
- {
- EList<ProtocolClass> _referencedProtocolClasses = root.getReferencedProtocolClasses(ac);
- for(final ProtocolClass pc : _referencedProtocolClasses) {
- _builder.append("#include \"");
- String _cHeaderFileName_1 = this._cExtensions.getCHeaderFileName(pc);
- _builder.append(_cHeaderFileName_1, "");
- _builder.append("\"");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- CharSequence _userCode = this._procedureHelpers.userCode(ac, 3);
- _builder.append(_userCode, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/* interface item IDs */");
- _builder.newLine();
- String _genInterfaceItemConstants = this.genInterfaceItemConstants(xpac, ac);
- _builder.append(_genInterfaceItemConstants, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- {
- StateGraph _stateMachine = xpac.getStateMachine();
- boolean _isEmpty = RoomHelpers.isEmpty(_stateMachine);
- boolean _not = (!_isEmpty);
- if (_not) {
- CharSequence _genStateMachine = this._stateMachineGen.genStateMachine(xpac);
- _builder.append(_genStateMachine, "");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- _builder.append("void ");
- String _name_1 = ac.getName();
- _builder.append(_name_1, "");
- _builder.append("_init(");
- String _name_2 = ac.getName();
- _builder.append(_name_2, "");
- _builder.append("* self){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
- String _name_3 = ac.getName();
- _builder.append(_name_3, " ");
- _builder.append("\", \"init\")");
- _builder.newLineIfNotEmpty();
- {
- StateGraph _stateMachine_1 = xpac.getStateMachine();
- boolean _isEmpty_1 = RoomHelpers.isEmpty(_stateMachine_1);
- boolean _not_1 = (!_isEmpty_1);
- if (_not_1) {
- _builder.append("\t");
- CharSequence _genInitialization = this._stateMachineGen.genInitialization(xpac);
- _builder.append(_genInitialization, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- _builder.newLine();
- _builder.append("void ");
- String _name_4 = ac.getName();
- _builder.append(_name_4, "");
- _builder.append("_receiveMessage(void* self, void* ifitem, const etMessage* msg){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
- String _name_5 = ac.getName();
- _builder.append(_name_5, " ");
- _builder.append("\", \"_receiveMessage\")");
- _builder.newLineIfNotEmpty();
- {
- StateGraph _stateMachine_2 = xpac.getStateMachine();
- boolean _isEmpty_2 = RoomHelpers.isEmpty(_stateMachine_2);
- boolean _not_2 = (!_isEmpty_2);
- if (_not_2) {
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("receiveEvent(self");
- {
- if (handleEvents) {
- _builder.append(", (etPort*)ifitem, msg->evtID, (void*)(((char*)msg)+MEM_CEIL(sizeof(etMessage)))");
- }
- }
- _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();
- {
- boolean _or_1 = false;
- if (dataDriven) {
- _or_1 = true;
- } else {
- _or_1 = (dataDriven || async);
- }
- if (_or_1) {
- _builder.append("void ");
- String _name_6 = ac.getName();
- _builder.append(_name_6, "");
- _builder.append("_execute(");
- String _name_7 = ac.getName();
- _builder.append(_name_7, "");
- _builder.append("* self) {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
- String _name_8 = ac.getName();
- _builder.append(_name_8, " ");
- _builder.append("\", \"_execute\")");
- _builder.newLineIfNotEmpty();
- {
- StateGraph _stateMachine_3 = xpac.getStateMachine();
- boolean _isEmpty_3 = RoomHelpers.isEmpty(_stateMachine_3);
- boolean _not_3 = (!_isEmpty_3);
- if (_not_3) {
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("receiveEvent(self");
- {
- if (handleEvents) {
- _builder.append(", NULL, 0, NULL");
- }
- }
- _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();
- CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(ac);
- _builder.append(_operationsImplementation, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-}
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
deleted file mode 100644
index ca33e2853..000000000
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
+++ /dev/null
@@ -1,240 +0,0 @@
-package org.eclipse.etrice.generator.c.gen;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import java.util.List;
-import org.eclipse.etrice.core.room.Message;
-import org.eclipse.etrice.core.room.RoomClass;
-import org.eclipse.etrice.core.room.VarDecl;
-import org.eclipse.etrice.generator.generic.AbstractTransitionChainGenerator;
-import org.eclipse.etrice.generator.generic.ILanguageExtension;
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.util.Pair;
-
-@Singleton
-@SuppressWarnings("all")
-public class CExtensions implements ILanguageExtension {
- @Inject
- private AbstractTransitionChainGenerator chainGenerator;
-
- public String getTypedDataDefinition(final Message m) {
- VarDecl _data = m.getData();
- return this.chainGenerator.generateTypedData(_data);
- }
-
- public String accessLevelPrivate() {
- return "static ";
- }
-
- public String accessLevelProtected() {
- return "static ";
- }
-
- public String accessLevelPublic() {
- return "";
- }
-
- public String memberAccess() {
- return "self->";
- }
-
- public String selfPointer(final String classname, final boolean hasArgs) {
- String _xifexpression = null;
- if (hasArgs) {
- _xifexpression = "* self, ";
- } else {
- _xifexpression = "* self";
- }
- String _plus = (classname + _xifexpression);
- return _plus;
- }
-
- public String selfPointer(final boolean hasArgs) {
- String _xifexpression = null;
- if (hasArgs) {
- _xifexpression = "self, ";
- } else {
- _xifexpression = "self";
- }
- return _xifexpression;
- }
-
- public String operationScope(final String classname, final boolean isDeclaration) {
- String _plus = (classname + "_");
- return _plus;
- }
-
- public String memberInDeclaration(final String namespace, final String member) {
- String _plus = (namespace + "_");
- return (_plus + member);
- }
-
- public String memberInUse(final String namespace, final String member) {
- String _plus = (namespace + "_");
- return (_plus + member);
- }
-
- /**
- * TODO: move specific code elsewhere
- */
- public String getCHeaderFileName(final RoomClass rc) {
- String _name = rc.getName();
- return (_name + ".h");
- }
-
- public String getCSourceFileName(final RoomClass rc) {
- String _name = rc.getName();
- return (_name + ".c");
- }
-
- public String getInstSourceFileName(final RoomClass rc) {
- String _name = rc.getName();
- return (_name + "_Inst.h");
- }
-
- public String getDispSourceFileName(final RoomClass rc) {
- String _name = rc.getName();
- return (_name + "_Disp.h");
- }
-
- public CharSequence getIncludeGuardString(final String filename) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("_");
- String _upperCase = filename.toUpperCase();
- _builder.append(_upperCase, "");
- _builder.append("_H_");
- return _builder;
- }
-
- public CharSequence generateIncludeGuardBegin(final String filename) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("#ifndef ");
- CharSequence _includeGuardString = this.getIncludeGuardString(filename);
- _builder.append(_includeGuardString, "");
- _builder.newLineIfNotEmpty();
- _builder.append("#define ");
- CharSequence _includeGuardString_1 = this.getIncludeGuardString(filename);
- _builder.append(_includeGuardString_1, "");
- _builder.newLineIfNotEmpty();
- return _builder;
- }
-
- public CharSequence generateIncludeGuardEnd(final String filename) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("#endif /* ");
- CharSequence _includeGuardString = this.getIncludeGuardString(filename);
- _builder.append(_includeGuardString, "");
- _builder.append(" */");
- _builder.newLineIfNotEmpty();
- return _builder;
- }
-
- public boolean usesInheritance() {
- return false;
- }
-
- public String genEnumeration(final String name, final List<Pair<String,String>> entries) {
- String _xblockexpression = null;
- {
- boolean _isEmpty = entries.isEmpty();
- if (_isEmpty) {
- return "/* empty enum not generated */";
- }
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("enum ");
- _builder.append(name, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- {
- boolean _hasElements = false;
- for(final Pair<String,String> entry : entries) {
- if (!_hasElements) {
- _hasElements = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- _builder.append("\t");
- String _first = entry.getFirst();
- _builder.append(_first, " ");
- _builder.append(" = ");
- String _second = entry.getSecond();
- _builder.append(_second, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("};");
- _builder.newLine();
- String _string = _builder.toString();
- _xblockexpression = (_string);
- }
- return _xblockexpression;
- }
-
- public String booleanConstant(final boolean b) {
- String _xifexpression = null;
- if (b) {
- _xifexpression = "TRUE";
- } else {
- _xifexpression = "FALSE";
- }
- return _xifexpression;
- }
-
- public String pointerLiteral() {
- return "*";
- }
-
- public String nullPointer() {
- return "NULL";
- }
-
- public String voidPointer() {
- return "void*";
- }
-
- public String arrayDeclaration(final String type, final int size, final String name, final boolean isRef) {
- String _xifexpression = null;
- if (isRef) {
- String _plus = (type + "* ");
- String _plus_1 = (_plus + name);
- String _plus_2 = (_plus_1 + "[");
- String _plus_3 = (_plus_2 + Integer.valueOf(size));
- String _plus_4 = (_plus_3 + "]");
- _xifexpression = _plus_4;
- } else {
- String _plus_5 = (type + " ");
- String _plus_6 = (_plus_5 + name);
- String _plus_7 = (_plus_6 + "[");
- String _plus_8 = (_plus_7 + Integer.valueOf(size));
- String _plus_9 = (_plus_8 + "]");
- _xifexpression = _plus_9;
- }
- return _xifexpression;
- }
-
- public String constructorName(final String cls) {
- return "ctor";
- }
-
- public String destructorName(final String cls) {
- return "dtor";
- }
-
- public String constructorReturnType() {
- return "void";
- }
-
- public String destructorReturnType() {
- return "void";
- }
-
- public String toCharArrayExpr(final String s) {
- String _plus = ("\"" + s);
- String _plus_1 = (_plus + "\"");
- return _plus_1;
- }
-
- public String superCall(final String baseClassName, final String method, final String args) {
- return "";
- }
-}
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java
deleted file mode 100644
index 61236fc9c..000000000
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java
+++ /dev/null
@@ -1,247 +0,0 @@
-package org.eclipse.etrice.generator.c.gen;
-
-import com.google.common.base.Objects;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import java.util.HashSet;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.etrice.core.genmodel.base.ILogger;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.room.Attribute;
-import org.eclipse.etrice.core.room.DataClass;
-import org.eclipse.etrice.core.room.StandardOperation;
-import org.eclipse.etrice.generator.c.gen.CExtensions;
-import org.eclipse.etrice.generator.generic.ProcedureHelpers;
-import org.eclipse.etrice.generator.generic.RoomExtensions;
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
-
-@Singleton
-@SuppressWarnings("all")
-public class DataClassGen {
- @Inject
- private JavaIoFileSystemAccess fileAccess;
-
- @Inject
- private CExtensions _cExtensions;
-
- @Inject
- private RoomExtensions _roomExtensions;
-
- @Inject
- private ProcedureHelpers _procedureHelpers;
-
- @Inject
- private ILogger logger;
-
- public void doGenerate(final Root root) {
- EList<DataClass> _usedDataClasses = root.getUsedDataClasses();
- for (final DataClass dc : _usedDataClasses) {
- {
- String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(dc);
- String _path = this._roomExtensions.getPath(dc);
- String path = (_generationTargetPath + _path);
- String _cHeaderFileName = this._cExtensions.getCHeaderFileName(dc);
- String _plus = ("generating DataClass header \'" + _cHeaderFileName);
- 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);
- String _cHeaderFileName_1 = this._cExtensions.getCHeaderFileName(dc);
- CharSequence _generateHeaderFile = this.generateHeaderFile(root, dc);
- this.fileAccess.generateFile(_cHeaderFileName_1, _generateHeaderFile);
- String _cSourceFileName = this._cExtensions.getCSourceFileName(dc);
- String _plus_4 = ("generating DataClass source \'" + _cSourceFileName);
- 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);
- String _cSourceFileName_1 = this._cExtensions.getCSourceFileName(dc);
- CharSequence _generateSourceFile = this.generateSourceFile(root, dc);
- this.fileAccess.generateFile(_cSourceFileName_1, _generateSourceFile);
- }
- }
- }
-
- public CharSequence generateHeaderFile(final Root root, final DataClass dc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* Header File of DataClass ");
- String _name = dc.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* ");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- String _name_1 = dc.getName();
- CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(_name_1);
- _builder.append(_generateIncludeGuardBegin, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("#include \"etDatatypes.h\"");
- _builder.newLine();
- _builder.newLine();
- {
- HashSet<DataClass> _referencedDataClasses = root.getReferencedDataClasses(dc);
- for(final DataClass dataClass : _referencedDataClasses) {
- _builder.append("#include \"");
- String _name_2 = dataClass.getName();
- _builder.append(_name_2, "");
- _builder.append(".h\"");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- CharSequence _userCode = this._procedureHelpers.userCode(dc, 1);
- _builder.append(_userCode, "");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.newLine();
- _builder.append("typedef struct {");
- _builder.newLine();
- _builder.append("\t");
- List<Attribute> _allAttributes = this._roomExtensions.getAllAttributes(dc);
- CharSequence _attributes = this._procedureHelpers.attributes(_allAttributes);
- _builder.append(_attributes, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("} ");
- String _name_3 = dc.getName();
- _builder.append(_name_3, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- {
- List<Attribute> _allAttributes_1 = this._roomExtensions.getAllAttributes(dc);
- for(final Attribute a : _allAttributes_1) {
- {
- String _defaultValueLiteral = a.getDefaultValueLiteral();
- boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null));
- if (_notEquals) {
- String _name_4 = dc.getName();
- String _plus = (_name_4 + " ");
- String _name_5 = a.getName();
- String _plus_1 = (_plus + _name_5);
- String _plus_2 = (_plus_1 + ": Attribute initialization not supported in C");
- this.logger.logInfo(_plus_2);
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.newLine();
- _builder.newLine();
- EList<StandardOperation> _operations = dc.getOperations();
- String _name_6 = dc.getName();
- CharSequence _operationsDeclaration = this._procedureHelpers.operationsDeclaration(_operations, _name_6);
- _builder.append(_operationsDeclaration, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/* deep copy */");
- _builder.newLine();
- _builder.append("void ");
- String _name_7 = dc.getName();
- _builder.append(_name_7, "");
- _builder.append("_deepCopy(");
- String _name_8 = dc.getName();
- _builder.append(_name_8, "");
- _builder.append("* source, ");
- String _name_9 = dc.getName();
- _builder.append(_name_9, "");
- _builder.append("* target);");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- CharSequence _userCode_1 = this._procedureHelpers.userCode(dc, 2);
- _builder.append(_userCode_1, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- String _name_10 = dc.getName();
- CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(_name_10);
- _builder.append(_generateIncludeGuardEnd, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- return _builder;
- }
-
- public CharSequence generateSourceFile(final Root root, final DataClass dc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* Source File of DataClass ");
- String _name = dc.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* ");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- _builder.append("#include \"");
- String _cHeaderFileName = this._cExtensions.getCHeaderFileName(dc);
- _builder.append(_cHeaderFileName, "");
- _builder.append("\"");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("#include <string.h>");
- _builder.newLine();
- _builder.newLine();
- CharSequence _userCode = this._procedureHelpers.userCode(dc, 3);
- _builder.append(_userCode, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.newLine();
- EList<StandardOperation> _operations = dc.getOperations();
- String _name_1 = dc.getName();
- CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, _name_1);
- _builder.append(_operationsImplementation, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("// deep copy");
- _builder.newLine();
- _builder.append("void ");
- String _name_2 = dc.getName();
- _builder.append(_name_2, "");
- _builder.append("_deepCopy(");
- String _name_3 = dc.getName();
- _builder.append(_name_3, "");
- _builder.append("* source, ");
- String _name_4 = dc.getName();
- _builder.append(_name_4, "");
- _builder.append("* target) {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("memcpy(target, source, sizeof(");
- String _name_5 = dc.getName();
- _builder.append(_name_5, " ");
- _builder.append("));");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- _builder.newLine();
- return _builder;
- }
-}
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
deleted file mode 100644
index 26daa4b46..000000000
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java
+++ /dev/null
@@ -1,60 +0,0 @@
-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 org.eclipse.emf.ecore.EObject;
-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.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;
-
-@Singleton
-@SuppressWarnings("all")
-public class MainGen implements IGenerator {
- @Inject
- private DataClassGen dataClassGen;
-
- @Inject
- private ProtocolClassGen protocolClassGen;
-
- @Inject
- private ActorClassGen actorClassGen;
-
- @Inject
- private SubSystemClassGen subsystemClassGen;
-
- @Inject
- private SubSystemRunnerGen subsystemRunnerGen;
-
- @Inject
- private PrepareFileSystem prepFS;
-
- public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
- this.prepFS.prepare(resource);
- EList<EObject> _contents = resource.getContents();
- for (final EObject e : _contents) {
- if ((e instanceof Root)) {
- this.doGenerate(((Root) e));
- }
- }
- }
-
- public void doGenerate(final Root e) {
- this.dataClassGen.doGenerate(e);
- this.protocolClassGen.doGenerate(e);
- this.actorClassGen.doGenerate(e);
- this.subsystemClassGen.doGenerate(e);
- boolean _isLibrary = e.isLibrary();
- boolean _not = (!_isLibrary);
- if (_not) {
- this.subsystemRunnerGen.doGenerate(e);
- }
- }
-}
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java
deleted file mode 100644
index 91dcd5e39..000000000
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java
+++ /dev/null
@@ -1,1185 +0,0 @@
-package org.eclipse.etrice.generator.c.gen;
-
-import com.google.common.base.Objects;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import java.util.HashSet;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.etrice.core.genmodel.base.ILogger;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.room.Attribute;
-import org.eclipse.etrice.core.room.CommunicationType;
-import org.eclipse.etrice.core.room.DataClass;
-import org.eclipse.etrice.core.room.DataType;
-import org.eclipse.etrice.core.room.DetailCode;
-import org.eclipse.etrice.core.room.Message;
-import org.eclipse.etrice.core.room.MessageHandler;
-import org.eclipse.etrice.core.room.PortClass;
-import org.eclipse.etrice.core.room.PortOperation;
-import org.eclipse.etrice.core.room.PrimitiveType;
-import org.eclipse.etrice.core.room.ProtocolClass;
-import org.eclipse.etrice.core.room.RefableType;
-import org.eclipse.etrice.core.room.VarDecl;
-import org.eclipse.etrice.generator.c.gen.CExtensions;
-import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator;
-import org.eclipse.etrice.generator.generic.ProcedureHelpers;
-import org.eclipse.etrice.generator.generic.RoomExtensions;
-import org.eclipse.etrice.generator.generic.TypeHelpers;
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-
-@Singleton
-@SuppressWarnings("all")
-public class ProtocolClassGen extends GenericProtocolClassGenerator {
- @Inject
- private JavaIoFileSystemAccess fileAccess;
-
- @Inject
- private CExtensions _cExtensions;
-
- @Inject
- private RoomExtensions _roomExtensions;
-
- @Inject
- private ProcedureHelpers _procedureHelpers;
-
- @Inject
- private TypeHelpers _typeHelpers;
-
- @Inject
- private ILogger logger;
-
- public void doGenerate(final Root root) {
- EList<ProtocolClass> _usedProtocolClasses = root.getUsedProtocolClasses();
- for (final ProtocolClass pc : _usedProtocolClasses) {
- {
- String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(pc);
- String _path = this._roomExtensions.getPath(pc);
- String path = (_generationTargetPath + _path);
- String _cHeaderFileName = this._cExtensions.getCHeaderFileName(pc);
- String _plus = ("generating ProtocolClass header \'" + _cHeaderFileName);
- 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);
- String _cHeaderFileName_1 = this._cExtensions.getCHeaderFileName(pc);
- CharSequence _generateHeaderFile = this.generateHeaderFile(root, pc);
- this.fileAccess.generateFile(_cHeaderFileName_1, _generateHeaderFile);
- String _cSourceFileName = this._cExtensions.getCSourceFileName(pc);
- String _plus_4 = ("generating ProtocolClass source \'" + _cSourceFileName);
- 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);
- String _cSourceFileName_1 = this._cExtensions.getCSourceFileName(pc);
- CharSequence _generateSourceFile = this.generateSourceFile(root, pc);
- this.fileAccess.generateFile(_cSourceFileName_1, _generateSourceFile);
- }
- }
- }
-
- private CharSequence generateHeaderFile(final Root root, final ProtocolClass pc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* Header File of ProtocolClass ");
- String _name = pc.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* ");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- String _name_1 = pc.getName();
- CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(_name_1);
- _builder.append(_generateIncludeGuardBegin, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("#include \"etDatatypes.h\"");
- _builder.newLine();
- _builder.append("#include \"modelbase/etPort.h\"");
- _builder.newLine();
- _builder.newLine();
- CharSequence _userCode = this._procedureHelpers.userCode(pc, 1);
- _builder.append(_userCode, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- {
- HashSet<DataClass> _referencedDataClasses = root.getReferencedDataClasses(pc);
- for(final DataClass dataClass : _referencedDataClasses) {
- _builder.append("#include \"");
- String _name_2 = dataClass.getName();
- _builder.append(_name_2, "");
- _builder.append(".h\"");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- {
- CommunicationType _commType = pc.getCommType();
- boolean _equals = Objects.equal(_commType, CommunicationType.EVENT_DRIVEN);
- if (_equals) {
- _builder.newLine();
- _builder.append("/* message IDs */");
- _builder.newLine();
- String _genMessageIDs = this.genMessageIDs(pc);
- _builder.append(_genMessageIDs, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/*--------------------- port structs and methods */");
- _builder.newLine();
- CharSequence _portClassHeader = this.portClassHeader(pc, Boolean.valueOf(false));
- _builder.append(_portClassHeader, "");
- _builder.newLineIfNotEmpty();
- CharSequence _portClassHeader_1 = this.portClassHeader(pc, Boolean.valueOf(true));
- _builder.append(_portClassHeader_1, "");
- _builder.newLineIfNotEmpty();
- } else {
- CommunicationType _commType_1 = pc.getCommType();
- boolean _equals_1 = Objects.equal(_commType_1, CommunicationType.DATA_DRIVEN);
- if (_equals_1) {
- _builder.append("/*--------------------- port structs and methods */");
- _builder.newLine();
- CharSequence _genDataDrivenPortHeaders = this.genDataDrivenPortHeaders(pc);
- _builder.append(_genDataDrivenPortHeaders, "");
- _builder.newLineIfNotEmpty();
- } else {
- CommunicationType _commType_2 = pc.getCommType();
- boolean _equals_2 = Objects.equal(_commType_2, CommunicationType.SYNCHRONOUS);
- if (_equals_2) {
- _builder.append("#error \"synchronoue protocols not implemented yet\"");
- _builder.newLine();
- }
- }
- }
- }
- _builder.newLine();
- _builder.append("/*--------------------- debug helpers */");
- _builder.newLine();
- _builder.newLine();
- _builder.append("/* get message string for message id */");
- _builder.newLine();
- _builder.append("const char* ");
- String _name_3 = pc.getName();
- _builder.append(_name_3, "");
- _builder.append("_getMessageString(int msg_id);");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- CharSequence _userCode_1 = this._procedureHelpers.userCode(pc, 2);
- _builder.append(_userCode_1, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- String _name_4 = pc.getName();
- CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(_name_4);
- _builder.append(_generateIncludeGuardEnd, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- return _builder;
- }
-
- private CharSequence generateSourceFile(final Root root, final ProtocolClass pc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* Source File of ProtocolClass ");
- String _name = pc.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* ");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- _builder.append("#include \"");
- String _cHeaderFileName = this._cExtensions.getCHeaderFileName(pc);
- _builder.append(_cHeaderFileName, "");
- _builder.append("\"");
- _builder.newLineIfNotEmpty();
- _builder.append("#include \"debugging/etMSCLogger.h\"");
- _builder.newLine();
- _builder.newLine();
- CharSequence _userCode = this._procedureHelpers.userCode(pc, 3);
- _builder.append(_userCode, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/*--------------------- port methods */");
- _builder.newLine();
- {
- CommunicationType _commType = pc.getCommType();
- boolean _equals = Objects.equal(_commType, CommunicationType.EVENT_DRIVEN);
- if (_equals) {
- CharSequence _portClassSource = this.portClassSource(pc, Boolean.valueOf(false));
- _builder.append(_portClassSource, "");
- _builder.newLineIfNotEmpty();
- CharSequence _portClassSource_1 = this.portClassSource(pc, Boolean.valueOf(true));
- _builder.append(_portClassSource_1, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/*--------------------- debug helpers */");
- _builder.newLine();
- CharSequence _generateDebugHelpersImplementation = this.generateDebugHelpersImplementation(root, pc);
- _builder.append(_generateDebugHelpersImplementation, "");
- _builder.newLineIfNotEmpty();
- } else {
- CommunicationType _commType_1 = pc.getCommType();
- boolean _equals_1 = Objects.equal(_commType_1, CommunicationType.DATA_DRIVEN);
- if (_equals_1) {
- CharSequence _genDataDrivenPortSources = this.genDataDrivenPortSources(pc);
- _builder.append(_genDataDrivenPortSources, "");
- _builder.newLineIfNotEmpty();
- } else {
- CommunicationType _commType_2 = pc.getCommType();
- boolean _equals_2 = Objects.equal(_commType_2, CommunicationType.SYNCHRONOUS);
- if (_equals_2) {
- _builder.append("#error \"synchronous protocols not implemented yet\"");
- _builder.newLine();
- }
- }
- }
- }
- return _builder;
- }
-
- private CharSequence portClassHeader(final ProtocolClass pc, final Boolean conj) {
- CharSequence _xblockexpression = null;
- {
- String portClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue());
- String replPortClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue(), true);
- List<Message> _xifexpression = null;
- if ((conj).booleanValue()) {
- List<Message> _allIncomingMessages = this._roomExtensions.getAllIncomingMessages(pc);
- _xifexpression = _allIncomingMessages;
- } else {
- List<Message> _allOutgoingMessages = this._roomExtensions.getAllOutgoingMessages(pc);
- _xifexpression = _allOutgoingMessages;
- }
- List<Message> messages = _xifexpression;
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("typedef etPort ");
- _builder.append(portClassName, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("typedef etReplPort ");
- _builder.append(replPortClassName, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- {
- PortClass _portClass = this._roomExtensions.getPortClass(pc, (conj).booleanValue());
- boolean _notEquals = (!Objects.equal(_portClass, null));
- if (_notEquals) {
- {
- PortClass _portClass_1 = this._roomExtensions.getPortClass(pc, (conj).booleanValue());
- EList<Attribute> _attributes = _portClass_1.getAttributes();
- boolean _isEmpty = _attributes.isEmpty();
- boolean _not = (!_isEmpty);
- if (_not) {
- _builder.append("/* variable part of PortClass (RAM) */");
- _builder.newLine();
- _builder.append("typedef struct ");
- _builder.append(portClassName, "");
- _builder.append("_var ");
- _builder.append(portClassName, "");
- _builder.append("_var; ");
- _builder.newLineIfNotEmpty();
- _builder.append("struct ");
- _builder.append(portClassName, "");
- _builder.append("_var {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- PortClass _portClass_2 = this._roomExtensions.getPortClass(pc, (conj).booleanValue());
- EList<Attribute> _attributes_1 = _portClass_2.getAttributes();
- CharSequence _attributes_2 = this._procedureHelpers.attributes(_attributes_1);
- _builder.append(_attributes_2, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("};");
- _builder.newLine();
- {
- PortClass _portClass_3 = this._roomExtensions.getPortClass(pc, (conj).booleanValue());
- EList<Attribute> _attributes_3 = _portClass_3.getAttributes();
- for(final Attribute a : _attributes_3) {
- {
- String _defaultValueLiteral = a.getDefaultValueLiteral();
- boolean _notEquals_1 = (!Objects.equal(_defaultValueLiteral, null));
- if (_notEquals_1) {
- String _plus = (portClassName + " ");
- String _name = a.getName();
- String _plus_1 = (_plus + _name);
- String _plus_2 = (_plus_1 + ": Attribute initialization not supported in C");
- this.logger.logInfo(_plus_2);
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- }
- }
- }
- }
- _builder.newLine();
- {
- for(final Message message : messages) {
- VarDecl _data = message.getData();
- boolean hasData = (!Objects.equal(_data, null));
- _builder.newLineIfNotEmpty();
- String _xifexpression_1 = null;
- if (hasData) {
- VarDecl _data_1 = message.getData();
- RefableType _refType = _data_1.getRefType();
- DataType _type = _refType.getType();
- String _typeName = this._typeHelpers.typeName(_type);
- _xifexpression_1 = _typeName;
- } else {
- _xifexpression_1 = "";
- }
- String typeName = _xifexpression_1;
- _builder.newLineIfNotEmpty();
- String _xifexpression_2 = null;
- boolean _and = false;
- if (!hasData) {
- _and = false;
- } else {
- boolean _or = false;
- VarDecl _data_2 = message.getData();
- RefableType _refType_1 = _data_2.getRefType();
- DataType _type_1 = _refType_1.getType();
- boolean _not_1 = (!(_type_1 instanceof PrimitiveType));
- if (_not_1) {
- _or = true;
- } else {
- VarDecl _data_3 = message.getData();
- RefableType _refType_2 = _data_3.getRefType();
- boolean _isRef = _refType_2.isRef();
- _or = (_not_1 || _isRef);
- }
- _and = (hasData && _or);
- }
- if (_and) {
- _xifexpression_2 = "*";
- } else {
- _xifexpression_2 = "";
- }
- String refp = _xifexpression_2;
- _builder.newLineIfNotEmpty();
- String _xifexpression_3 = null;
- if (hasData) {
- String _plus_3 = (", " + typeName);
- String _plus_4 = (_plus_3 + refp);
- String _plus_5 = (_plus_4 + " data");
- _xifexpression_3 = _plus_5;
- } else {
- _xifexpression_3 = "";
- }
- String data = _xifexpression_3;
- _builder.newLineIfNotEmpty();
- String _name_1 = message.getName();
- String _messageSignature = this.messageSignature(portClassName, _name_1, "", data);
- _builder.append(_messageSignature, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- String _name_2 = message.getName();
- String _messageSignature_1 = this.messageSignature(replPortClassName, _name_2, "_broadcast", data);
- _builder.append(_messageSignature_1, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- String _name_3 = message.getName();
- String _plus_6 = (", int idx" + data);
- String _messageSignature_2 = this.messageSignature(replPortClassName, _name_3, "", _plus_6);
- _builder.append(_messageSignature_2, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- {
- PortClass _portClass_4 = this._roomExtensions.getPortClass(pc, (conj).booleanValue());
- boolean _notEquals_2 = (!Objects.equal(_portClass_4, null));
- if (_notEquals_2) {
- PortClass _portClass_5 = this._roomExtensions.getPortClass(pc, (conj).booleanValue());
- EList<PortOperation> _operations = _portClass_5.getOperations();
- CharSequence _operationsDeclaration = this._procedureHelpers.operationsDeclaration(_operations, portClassName);
- _builder.append(_operationsDeclaration, "");
- _builder.newLineIfNotEmpty();
- PortClass _portClass_6 = this._roomExtensions.getPortClass(pc, (conj).booleanValue());
- EList<PortOperation> _operations_1 = _portClass_6.getOperations();
- CharSequence _operationsDeclaration_1 = this._procedureHelpers.operationsDeclaration(_operations_1, replPortClassName);
- _builder.append(_operationsDeclaration_1, "");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- {
- boolean _handlesReceive = this._roomExtensions.handlesReceive(pc, (conj).booleanValue());
- if (_handlesReceive) {
- {
- List<MessageHandler> _receiveHandlers = this._roomExtensions.getReceiveHandlers(pc, (conj).booleanValue());
- for(final MessageHandler h : _receiveHandlers) {
- _builder.append("void ");
- _builder.append(portClassName, "");
- _builder.append("_");
- Message _msg = h.getMsg();
- String _name_4 = _msg.getName();
- _builder.append(_name_4, "");
- _builder.append("_receiveHandler(");
- _builder.append(portClassName, "");
- _builder.append("* self, const etMessage* msg, void * actor, etActorReceiveMessage receiveMessageFunc);");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.append("etInt32 ");
- _builder.append(replPortClassName, "");
- _builder.append("_getReplication(const ");
- _builder.append(replPortClassName, "");
- _builder.append("* self);");
- _builder.newLineIfNotEmpty();
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- private CharSequence genDataDrivenPortHeaders(final ProtocolClass pc) {
- CharSequence _xblockexpression = null;
- {
- List<Message> _allIncomingMessages = this._roomExtensions.getAllIncomingMessages(pc);
- final Function1<Message,Boolean> _function = new Function1<Message,Boolean>() {
- public Boolean apply(final Message m) {
- VarDecl _data = m.getData();
- boolean _notEquals = (!Objects.equal(_data, null));
- return Boolean.valueOf(_notEquals);
- }
- };
- Iterable<Message> sentMsgs = IterableExtensions.<Message>filter(_allIncomingMessages, _function);
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/* data driven send port (conjugated) */");
- _builder.newLine();
- _builder.append("typedef struct {");
- _builder.newLine();
- {
- for(final Message msg : sentMsgs) {
- _builder.append("\t");
- VarDecl _data = msg.getData();
- RefableType _refType = _data.getRefType();
- DataType _type = _refType.getType();
- String typeName = this._typeHelpers.typeName(_type);
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- String _xifexpression = null;
- VarDecl _data_1 = msg.getData();
- RefableType _refType_1 = _data_1.getRefType();
- boolean _isRef = _refType_1.isRef();
- if (_isRef) {
- _xifexpression = "*";
- } else {
- _xifexpression = "";
- }
- String refp = _xifexpression;
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append(typeName, " ");
- _builder.append(refp, " ");
- _builder.append(" ");
- String _name = msg.getName();
- _builder.append(_name, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("}");
- _builder.newLine();
- String _portClassName = this._roomExtensions.getPortClassName(pc, true);
- _builder.append(_portClassName, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/* data driven receive port (regular) */");
- _builder.newLine();
- _builder.append("typedef struct {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("const ");
- String _portClassName_1 = this._roomExtensions.getPortClassName(pc, true);
- _builder.append(_portClassName_1, " ");
- _builder.append("* peer;");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- String _portClassName_2 = this._roomExtensions.getPortClassName(pc, false);
- _builder.append(_portClassName_2, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- {
- for(final Message message : sentMsgs) {
- VarDecl _data_2 = message.getData();
- boolean hasData = (!Objects.equal(_data_2, null));
- _builder.newLineIfNotEmpty();
- String _xifexpression_1 = null;
- if (hasData) {
- VarDecl _data_3 = message.getData();
- RefableType _refType_2 = _data_3.getRefType();
- DataType _type_1 = _refType_2.getType();
- String _typeName = this._typeHelpers.typeName(_type_1);
- _xifexpression_1 = _typeName;
- } else {
- _xifexpression_1 = "";
- }
- String typeName_1 = _xifexpression_1;
- _builder.newLineIfNotEmpty();
- String _xifexpression_2 = null;
- boolean _and = false;
- if (!hasData) {
- _and = false;
- } else {
- VarDecl _data_4 = message.getData();
- RefableType _refType_3 = _data_4.getRefType();
- DataType _type_2 = _refType_3.getType();
- boolean _not = (!(_type_2 instanceof PrimitiveType));
- _and = (hasData && _not);
- }
- if (_and) {
- _xifexpression_2 = "*";
- } else {
- _xifexpression_2 = "";
- }
- String refp_1 = _xifexpression_2;
- _builder.newLineIfNotEmpty();
- String _xifexpression_3 = null;
- if (hasData) {
- String _plus = (", " + typeName_1);
- String _plus_1 = (_plus + refp_1);
- String _plus_2 = (_plus_1 + " data");
- _xifexpression_3 = _plus_2;
- } else {
- _xifexpression_3 = "";
- }
- String data = _xifexpression_3;
- _builder.newLineIfNotEmpty();
- String _portClassName_3 = this._roomExtensions.getPortClassName(pc, true);
- String _name_1 = message.getName();
- String _messageSetterSignature = this.messageSetterSignature(_portClassName_3, _name_1, data);
- _builder.append(_messageSetterSignature, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- String _portClassName_4 = this._roomExtensions.getPortClassName(pc, false);
- String _name_2 = message.getName();
- String _messageGetterSignature = this.messageGetterSignature(_portClassName_4, _name_2, typeName_1);
- _builder.append(_messageGetterSignature, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- }
- }
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- private CharSequence genDataDrivenPortSources(final ProtocolClass pc) {
- CharSequence _xblockexpression = null;
- {
- List<Message> _allIncomingMessages = this._roomExtensions.getAllIncomingMessages(pc);
- final Function1<Message,Boolean> _function = new Function1<Message,Boolean>() {
- public Boolean apply(final Message m) {
- VarDecl _data = m.getData();
- boolean _notEquals = (!Objects.equal(_data, null));
- return Boolean.valueOf(_notEquals);
- }
- };
- Iterable<Message> messages = IterableExtensions.<Message>filter(_allIncomingMessages, _function);
- StringConcatenation _builder = new StringConcatenation();
- {
- for(final Message message : messages) {
- VarDecl _data = message.getData();
- RefableType _refType = _data.getRefType();
- DataType _type = _refType.getType();
- String typeName = this._typeHelpers.typeName(_type);
- _builder.newLineIfNotEmpty();
- String _xifexpression = null;
- VarDecl _data_1 = message.getData();
- RefableType _refType_1 = _data_1.getRefType();
- DataType _type_1 = _refType_1.getType();
- boolean _not = (!(_type_1 instanceof PrimitiveType));
- if (_not) {
- _xifexpression = "*";
- } else {
- _xifexpression = "";
- }
- String refp = _xifexpression;
- _builder.newLineIfNotEmpty();
- String _plus = (", " + typeName);
- String _plus_1 = (_plus + refp);
- String data = (_plus_1 + " data");
- _builder.newLineIfNotEmpty();
- String _portClassName = this._roomExtensions.getPortClassName(pc, true);
- String _name = message.getName();
- String _messageSetterSignature = this.messageSetterSignature(_portClassName, _name, data);
- _builder.append(_messageSetterSignature, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("self->");
- String _name_1 = message.getName();
- _builder.append(_name_1, " ");
- _builder.append(" = data;");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- String _portClassName_1 = this._roomExtensions.getPortClassName(pc, false);
- String _name_2 = message.getName();
- String _messageGetterSignature = this.messageGetterSignature(_portClassName_1, _name_2, typeName);
- _builder.append(_messageGetterSignature, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("return self->peer->");
- String _name_3 = message.getName();
- _builder.append(_name_3, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- }
- }
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- private CharSequence portClassSource(final ProtocolClass pc, final Boolean conj) {
- CharSequence _xblockexpression = null;
- {
- String portClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue());
- String replPortClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue(), true);
- List<Message> _xifexpression = null;
- if ((conj).booleanValue()) {
- List<Message> _allIncomingMessages = this._roomExtensions.getAllIncomingMessages(pc);
- _xifexpression = _allIncomingMessages;
- } else {
- List<Message> _allOutgoingMessages = this._roomExtensions.getAllOutgoingMessages(pc);
- _xifexpression = _allOutgoingMessages;
- }
- List<Message> messages = _xifexpression;
- String _xifexpression_1 = null;
- if ((conj).booleanValue()) {
- _xifexpression_1 = "IN_";
- } else {
- _xifexpression_1 = "OUT_";
- }
- String dir = _xifexpression_1;
- StringConcatenation _builder = new StringConcatenation();
- {
- for(final Message message : messages) {
- VarDecl _data = message.getData();
- boolean hasData = (!Objects.equal(_data, null));
- _builder.newLineIfNotEmpty();
- String _xifexpression_2 = null;
- if (hasData) {
- VarDecl _data_1 = message.getData();
- RefableType _refType = _data_1.getRefType();
- DataType _type = _refType.getType();
- String _typeName = this._typeHelpers.typeName(_type);
- _xifexpression_2 = _typeName;
- } else {
- _xifexpression_2 = "";
- }
- String typeName = _xifexpression_2;
- _builder.newLineIfNotEmpty();
- String _xifexpression_3 = null;
- boolean _and = false;
- if (!hasData) {
- _and = false;
- } else {
- VarDecl _data_2 = message.getData();
- RefableType _refType_1 = _data_2.getRefType();
- boolean _isRef = _refType_1.isRef();
- _and = (hasData && _isRef);
- }
- if (_and) {
- _xifexpression_3 = "*";
- } else {
- _xifexpression_3 = "";
- }
- String refp = _xifexpression_3;
- _builder.newLineIfNotEmpty();
- String _xifexpression_4 = null;
- boolean _and_1 = false;
- if (!hasData) {
- _and_1 = false;
- } else {
- boolean _or = false;
- VarDecl _data_3 = message.getData();
- RefableType _refType_2 = _data_3.getRefType();
- DataType _type_1 = _refType_2.getType();
- boolean _not = (!(_type_1 instanceof PrimitiveType));
- if (_not) {
- _or = true;
- } else {
- VarDecl _data_4 = message.getData();
- RefableType _refType_3 = _data_4.getRefType();
- boolean _isRef_1 = _refType_3.isRef();
- _or = (_not || _isRef_1);
- }
- _and_1 = (hasData && _or);
- }
- if (_and_1) {
- _xifexpression_4 = "*";
- } else {
- _xifexpression_4 = "";
- }
- String refpd = _xifexpression_4;
- _builder.newLineIfNotEmpty();
- String _xifexpression_5 = null;
- boolean _and_2 = false;
- boolean _and_3 = false;
- if (!hasData) {
- _and_3 = false;
- } else {
- VarDecl _data_5 = message.getData();
- RefableType _refType_4 = _data_5.getRefType();
- DataType _type_2 = _refType_4.getType();
- boolean _not_1 = (!(_type_2 instanceof PrimitiveType));
- _and_3 = (hasData && _not_1);
- }
- if (!_and_3) {
- _and_2 = false;
- } else {
- VarDecl _data_6 = message.getData();
- RefableType _refType_5 = _data_6.getRefType();
- boolean _isRef_2 = _refType_5.isRef();
- boolean _not_2 = (!_isRef_2);
- _and_2 = (_and_3 && _not_2);
- }
- if (_and_2) {
- _xifexpression_5 = "";
- } else {
- _xifexpression_5 = "&";
- }
- String refa = _xifexpression_5;
- _builder.newLineIfNotEmpty();
- String _xifexpression_6 = null;
- if (hasData) {
- String _plus = (", " + typeName);
- String _plus_1 = (_plus + refpd);
- String _plus_2 = (_plus_1 + " data");
- _xifexpression_6 = _plus_2;
- } else {
- _xifexpression_6 = "";
- }
- String data = _xifexpression_6;
- _builder.newLineIfNotEmpty();
- String _xifexpression_7 = null;
- if (hasData) {
- _xifexpression_7 = ", data";
- } else {
- _xifexpression_7 = "";
- }
- String dataCall = _xifexpression_7;
- _builder.newLineIfNotEmpty();
- MessageHandler hdlr = this._roomExtensions.getSendHandler(message, (conj).booleanValue());
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- String _name = message.getName();
- String _messageSignature = this.messageSignature(portClassName, _name, "", data);
- _builder.append(_messageSignature, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- {
- boolean _notEquals = (!Objects.equal(hdlr, null));
- if (_notEquals) {
- _builder.append("\t");
- {
- DetailCode _detailCode = hdlr.getDetailCode();
- EList<String> _commands = _detailCode.getCommands();
- for(final String command : _commands) {
- _builder.append("\t");
- _builder.append(command, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- } else {
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
- _builder.append(portClassName, " ");
- _builder.append("\", \"");
- String _name_1 = message.getName();
- _builder.append(_name_1, " ");
- _builder.append("\")");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("\t");
- String _name_2 = pc.getName();
- String _name_3 = message.getName();
- String _plus_3 = (dir + _name_3);
- String _memberInUse = this._cExtensions.memberInUse(_name_2, _plus_3);
- String _plus_4 = (typeName + refp);
- String _plus_5 = (refa + "data");
- String _sendMessageCall = this.sendMessageCall(hasData, "self", _memberInUse, _plus_4, _plus_5);
- _builder.append(_sendMessageCall, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
- _builder.newLine();
- }
- }
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- String _name_4 = message.getName();
- String _messageSignature_1 = this.messageSignature(replPortClassName, _name_4, "_broadcast", data);
- _builder.append(_messageSignature_1, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- {
- boolean _notEquals_1 = (!Objects.equal(hdlr, null));
- if (_notEquals_1) {
- _builder.append("\t");
- _builder.append("int i;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("for (i=0; i<((etReplPort*)self)->size; ++i) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("\t");
- _builder.append(portClassName, " ");
- _builder.append("_");
- String _name_5 = message.getName();
- _builder.append(_name_5, " ");
- _builder.append("((etPort*)&((etReplPort*)self)->ports[i]");
- _builder.append(dataCall, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("}\t\t\t\t\t");
- _builder.newLine();
- } else {
- _builder.append("\t");
- _builder.append("int i;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
- _builder.append(replPortClassName, " ");
- _builder.append("\", \"");
- String _name_6 = message.getName();
- _builder.append(_name_6, " ");
- _builder.append("\")");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("for (i=0; i<((etReplPort*)self)->size; ++i) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("\t");
- String _name_7 = pc.getName();
- String _name_8 = message.getName();
- String _plus_6 = (dir + _name_8);
- String _memberInUse_1 = this._cExtensions.memberInUse(_name_7, _plus_6);
- String _plus_7 = (typeName + refp);
- String _plus_8 = (refa + "data");
- String _sendMessageCall_1 = this.sendMessageCall(hasData, "((etPort*)&((etReplPort*)self)->ports[i])", _memberInUse_1, _plus_7, _plus_8);
- _builder.append(_sendMessageCall_1, " ");
- _builder.newLineIfNotEmpty();
- _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();
- String _name_9 = message.getName();
- String _plus_9 = (", int idx" + data);
- String _messageSignature_2 = this.messageSignature(replPortClassName, _name_9, "", _plus_9);
- _builder.append(_messageSignature_2, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- {
- boolean _notEquals_2 = (!Objects.equal(hdlr, null));
- if (_notEquals_2) {
- _builder.append("\t");
- _builder.append(portClassName, " ");
- _builder.append("_");
- String _name_10 = message.getName();
- _builder.append(_name_10, " ");
- _builder.append("((etPort*)&((etReplPort*)self)->ports[idx]");
- _builder.append(dataCall, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- } else {
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
- _builder.append(replPortClassName, " ");
- _builder.append("\", \"");
- String _name_11 = message.getName();
- _builder.append(_name_11, " ");
- _builder.append("\")");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("if (0<=idx && idx<((etReplPort*)self)->size) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("\t");
- String _name_12 = pc.getName();
- String _name_13 = message.getName();
- String _plus_10 = (dir + _name_13);
- String _memberInUse_2 = this._cExtensions.memberInUse(_name_12, _plus_10);
- String _plus_11 = (typeName + refp);
- String _plus_12 = (refa + "data");
- String _sendMessageCall_2 = this.sendMessageCall(hasData, "((etPort*)&((etReplPort*)self)->ports[idx])", _memberInUse_2, _plus_11, _plus_12);
- _builder.append(_sendMessageCall_2, " ");
- _builder.newLineIfNotEmpty();
- _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();
- {
- PortClass _portClass = this._roomExtensions.getPortClass(pc, (conj).booleanValue());
- boolean _notEquals_3 = (!Objects.equal(_portClass, null));
- if (_notEquals_3) {
- PortClass _portClass_1 = this._roomExtensions.getPortClass(pc, (conj).booleanValue());
- EList<PortOperation> _operations = _portClass_1.getOperations();
- CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, portClassName);
- _builder.append(_operationsImplementation, "");
- _builder.newLineIfNotEmpty();
- PortClass _portClass_2 = this._roomExtensions.getPortClass(pc, (conj).booleanValue());
- EList<PortOperation> _operations_1 = _portClass_2.getOperations();
- CharSequence _operationsImplementation_1 = this._procedureHelpers.operationsImplementation(_operations_1, replPortClassName);
- _builder.append(_operationsImplementation_1, "");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- _builder.append("// getReplication");
- _builder.newLine();
- _builder.append("etInt32 ");
- _builder.append(replPortClassName, "");
- _builder.append("_getReplication(const ");
- _builder.append(replPortClassName, "");
- _builder.append("* self) {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("return ((etReplPort*)self)->size;");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- {
- boolean _handlesReceive = this._roomExtensions.handlesReceive(pc, (conj).booleanValue());
- if (_handlesReceive) {
- CharSequence _genReceiveHandlers = this.genReceiveHandlers(pc, conj);
- _builder.append(_genReceiveHandlers, "");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- private String sendMessageCall(final boolean hasData, final String self, final String msg, final String typeName, final String data) {
- String _xifexpression = null;
- if (hasData) {
- String _plus = ("etPort_sendMessage(" + self);
- String _plus_1 = (_plus + ", ");
- String _plus_2 = (_plus_1 + msg);
- String _plus_3 = (_plus_2 + ", sizeof(");
- String _plus_4 = (_plus_3 + typeName);
- String _plus_5 = (_plus_4 + "), ");
- String _plus_6 = (_plus_5 + data);
- String _plus_7 = (_plus_6 + ");");
- _xifexpression = _plus_7;
- } else {
- String _plus_8 = ("etPort_sendMessage(" + self);
- String _plus_9 = (_plus_8 + ", ");
- String _plus_10 = (_plus_9 + msg);
- String _plus_11 = (_plus_10 + ", 0, NULL);");
- _xifexpression = _plus_11;
- }
- return _xifexpression;
- }
-
- private String messageSignature(final String className, final String messageName, final String methodSuffix, final String data) {
- String _plus = ("void " + className);
- String _plus_1 = (_plus + "_");
- String _plus_2 = (_plus_1 + messageName);
- String _plus_3 = (_plus_2 + methodSuffix);
- String _plus_4 = (_plus_3 + "(const ");
- String _plus_5 = (_plus_4 + className);
- String _plus_6 = (_plus_5 + "* self");
- String _plus_7 = (_plus_6 + data);
- String _plus_8 = (_plus_7 + ")");
- return _plus_8;
- }
-
- private String messageSetterSignature(final String className, final String messageName, final String data) {
- String _plus = ("void " + className);
- String _plus_1 = (_plus + "_");
- String _plus_2 = (_plus_1 + messageName);
- String _plus_3 = (_plus_2 + "_set(");
- String _plus_4 = (_plus_3 + className);
- String _plus_5 = (_plus_4 + "* self");
- String _plus_6 = (_plus_5 + data);
- String _plus_7 = (_plus_6 + ")");
- return _plus_7;
- }
-
- private String messageGetterSignature(final String className, final String messageName, final String type) {
- String _plus = (type + " ");
- String _plus_1 = (_plus + className);
- String _plus_2 = (_plus_1 + "_");
- String _plus_3 = (_plus_2 + messageName);
- String _plus_4 = (_plus_3 + "_get(const ");
- String _plus_5 = (_plus_4 + className);
- String _plus_6 = (_plus_5 + "* const self)");
- return _plus_6;
- }
-
- private CharSequence genReceiveHandlers(final ProtocolClass pc, final Boolean conj) {
- CharSequence _xblockexpression = null;
- {
- String portClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue());
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/* receiver handlers */");
- _builder.newLine();
- {
- List<MessageHandler> _receiveHandlers = this._roomExtensions.getReceiveHandlers(pc, (conj).booleanValue());
- for(final MessageHandler h : _receiveHandlers) {
- _builder.append("void ");
- _builder.append(portClassName, "");
- _builder.append("_");
- Message _msg = h.getMsg();
- String _name = _msg.getName();
- _builder.append(_name, "");
- _builder.append("_receiveHandler(");
- _builder.append(portClassName, "");
- _builder.append("* self, const etMessage* msg, void * actor, etActorReceiveMessage receiveMessageFunc){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- DetailCode _detailCode = h.getDetailCode();
- CharSequence _userCode = this._procedureHelpers.userCode(_detailCode);
- _builder.append(_userCode, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("/* hand over the message to the actor: */");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* (*receiveMessageFunc)(actor, self, msg); */");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- }
- }
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- private CharSequence generateDebugHelpersImplementation(final Root root, final ProtocolClass pc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.newLine();
- _builder.append("/* message names as strings for debugging (generate MSC) */");
- _builder.newLine();
- _builder.append("static const char* const ");
- String _name = pc.getName();
- _builder.append(_name, "");
- _builder.append("_messageStrings[] = {\"MIN\", ");
- {
- List<Message> _allOutgoingMessages = this._roomExtensions.getAllOutgoingMessages(pc);
- for(final Message m : _allOutgoingMessages) {
- _builder.append("\"");
- String _name_1 = m.getName();
- _builder.append(_name_1, "");
- _builder.append("\",");
- }
- }
- {
- List<Message> _allIncomingMessages = this._roomExtensions.getAllIncomingMessages(pc);
- for(final Message m_1 : _allIncomingMessages) {
- _builder.append("\"");
- String _name_2 = m_1.getName();
- _builder.append(_name_2, "");
- _builder.append("\", ");
- }
- }
- _builder.append("\"MAX\"};");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("const char* ");
- String _name_3 = pc.getName();
- _builder.append(_name_3, "");
- _builder.append("_getMessageString(int msg_id) {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("if (msg_id<");
- String _name_4 = pc.getName();
- _builder.append(_name_4, " ");
- _builder.append("_MSG_MIN || msg_id>");
- String _name_5 = pc.getName();
- _builder.append(_name_5, " ");
- _builder.append("_MSG_MAX+1){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("/* id out of range */");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("return \"Message ID out of range\";");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("else{");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("return ");
- String _name_6 = pc.getName();
- _builder.append(_name_6, " ");
- _builder.append("_messageStrings[msg_id];");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- return _builder;
- }
-}
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
deleted file mode 100644
index de6d18f93..000000000
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.eclipse.etrice.generator.c.gen;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import java.util.List;
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.State;
-import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator;
-import org.eclipse.etrice.generator.generic.RoomExtensions;
-import org.eclipse.xtend2.lib.StringConcatenation;
-
-@Singleton
-@SuppressWarnings("all")
-public class StateMachineGen extends GenericStateMachineGenerator {
- @Inject
- private RoomExtensions _roomExtensions;
-
- public CharSequence genHeaderConstants(final ExpandedActorClass xpac) {
- CharSequence _xblockexpression = null;
- {
- final ActorClass ac = xpac.getActorClass();
- List<State> _allBaseStates = this._roomExtensions.getAllBaseStates(ac);
- int _size = _allBaseStates.size();
- List<State> _allLeafStates = this._roomExtensions.getAllLeafStates(ac);
- int _size_1 = _allLeafStates.size();
- int _minus = (_size - _size_1);
- final int historySize = (_minus + 2);
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/* constant for state machine data */");
- _builder.newLine();
- _builder.append("#define ");
- String _name = ac.getName();
- String _upperCase = _name.toUpperCase();
- _builder.append(_upperCase, "");
- _builder.append("_HISTORY_SIZE ");
- _builder.append(historySize, "");
- _builder.newLineIfNotEmpty();
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- public CharSequence genDataMembers(final ExpandedActorClass xpac) {
- CharSequence _xblockexpression = null;
- {
- final ActorClass ac = xpac.getActorClass();
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/* state machine variables */");
- _builder.newLine();
- _builder.append("etInt16 state;");
- _builder.newLine();
- _builder.append("etInt16 history[");
- String _name = ac.getName();
- String _upperCase = _name.toUpperCase();
- _builder.append(_upperCase, "");
- _builder.append("_HISTORY_SIZE];");
- _builder.newLineIfNotEmpty();
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- public CharSequence genInitialization(final ExpandedActorClass xpac) {
- CharSequence _xblockexpression = null;
- {
- final ActorClass ac = xpac.getActorClass();
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("self->state = STATE_TOP;");
- _builder.newLine();
- _builder.append("{");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("int i;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("for (i=0; i<");
- String _name = ac.getName();
- String _upperCase = _name.toUpperCase();
- _builder.append(_upperCase, " ");
- _builder.append("_HISTORY_SIZE; ++i)");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("self->history[i] = NO_STATE;");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _builder.append("executeInitTransition(self);");
- _builder.newLine();
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- public CharSequence genExtra(final ExpandedActorClass xpac) {
- CharSequence _xblockexpression = null;
- {
- final ActorClass ac = xpac.getActorClass();
- StringConcatenation _builder = new StringConcatenation();
- _builder.newLine();
- String _accessLevelPrivate = this.langExt.accessLevelPrivate();
- _builder.append(_accessLevelPrivate, "");
- _builder.append("void setState(");
- String _name = ac.getName();
- _builder.append(_name, "");
- _builder.append("* self, int new_state) {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("self->state = new_state;");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-}
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/SubSystemClassGen.java
deleted file mode 100644
index ddf22e279..000000000
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java
+++ /dev/null
@@ -1,1679 +0,0 @@
-package org.eclipse.etrice.generator.c.gen;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Iterables;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import java.util.ArrayList;
-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.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.SubSystemInstance;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.ActorCommunicationType;
-import org.eclipse.etrice.core.room.Attribute;
-import org.eclipse.etrice.core.room.CommunicationType;
-import org.eclipse.etrice.core.room.DataType;
-import org.eclipse.etrice.core.room.DetailCode;
-import org.eclipse.etrice.core.room.InterfaceItem;
-import org.eclipse.etrice.core.room.Message;
-import org.eclipse.etrice.core.room.MessageHandler;
-import org.eclipse.etrice.core.room.Port;
-import org.eclipse.etrice.core.room.PortClass;
-import org.eclipse.etrice.core.room.ProtocolClass;
-import org.eclipse.etrice.core.room.RefableType;
-import org.eclipse.etrice.core.room.StandardOperation;
-import org.eclipse.etrice.core.room.SubSystemClass;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.generator.c.gen.CExtensions;
-import org.eclipse.etrice.generator.generic.ILanguageExtension;
-import org.eclipse.etrice.generator.generic.ProcedureHelpers;
-import org.eclipse.etrice.generator.generic.RoomExtensions;
-import org.eclipse.etrice.generator.generic.TypeHelpers;
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.ListExtensions;
-
-@Singleton
-@SuppressWarnings("all")
-public class SubSystemClassGen {
- @Inject
- private JavaIoFileSystemAccess fileAccess;
-
- @Inject
- private CExtensions stdExt;
-
- @Inject
- private RoomExtensions roomExt;
-
- @Inject
- private ProcedureHelpers helpers;
-
- @Inject
- private TypeHelpers _typeHelpers;
-
- @Inject
- private ILanguageExtension languageExt;
-
- @Inject
- 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);
- SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass();
- CharSequence _generateHeaderFile = this.generateHeaderFile(root, ssi, _subSystemClass_3);
- this.fileAccess.generateFile(file, _generateHeaderFile);
- SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass();
- String _cSourceFileName = this.stdExt.getCSourceFileName(_subSystemClass_4);
- 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);
- SubSystemClass _subSystemClass_5 = ssi.getSubSystemClass();
- CharSequence _generateSourceFile = this.generateSourceFile(root, ssi, _subSystemClass_5);
- this.fileAccess.generateFile(file, _generateSourceFile);
- SubSystemClass _subSystemClass_6 = ssi.getSubSystemClass();
- String _instSourceFileName = this.stdExt.getInstSourceFileName(_subSystemClass_6);
- 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);
- SubSystemClass _subSystemClass_7 = ssi.getSubSystemClass();
- CharSequence _generateInstanceFile = this.generateInstanceFile(root, ssi, _subSystemClass_7);
- this.fileAccess.generateFile(file, _generateInstanceFile);
- SubSystemClass _subSystemClass_8 = ssi.getSubSystemClass();
- String _dispSourceFileName = this.stdExt.getDispSourceFileName(_subSystemClass_8);
- 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);
- SubSystemClass _subSystemClass_9 = ssi.getSubSystemClass();
- CharSequence _generateDispatcherFile = this.generateDispatcherFile(root, ssi, _subSystemClass_9);
- this.fileAccess.generateFile(file, _generateDispatcherFile);
- }
- }
- }
-
- private CharSequence generateHeaderFile(final Root root, final SubSystemInstance ssi, final SubSystemClass ssc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* Header File of SubSystemClass ");
- String _name = ssc.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* ");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- String _name_1 = ssc.getName();
- CharSequence _generateIncludeGuardBegin = this.stdExt.generateIncludeGuardBegin(_name_1);
- _builder.append(_generateIncludeGuardBegin, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- DetailCode _userCode1 = ssc.getUserCode1();
- CharSequence _userCode = this.helpers.userCode(_userCode1);
- _builder.append(_userCode, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.newLine();
- _builder.append("/* lifecycle functions");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* init -> start -> run (loop) -> stop -> destroy");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- _builder.append("void ");
- String _name_2 = ssc.getName();
- _builder.append(_name_2, "");
- _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("_start(void);\t/* lifecycle start \t */");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("void ");
- String _name_4 = ssc.getName();
- _builder.append(_name_4, "");
- _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("_stop(void); \t/* lifecycle stop\t */");
- _builder.newLineIfNotEmpty();
- _builder.append("void ");
- String _name_6 = ssc.getName();
- _builder.append(_name_6, "");
- _builder.append("_destroy(void); \t/* lifecycle destroy */");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("void ");
- String _name_7 = ssc.getName();
- _builder.append(_name_7, "");
- _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_8 = ssc.getName();
- CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_8);
- _builder.append(_generateIncludeGuardEnd, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.newLine();
- return _builder;
- }
-
- private CharSequence generateSourceFile(final Root root, final SubSystemInstance ssi, final SubSystemClass ssc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* Source File of SubSystemClass ");
- String _name = ssc.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* ");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- _builder.append("#include \"");
- String _cHeaderFileName = this.stdExt.getCHeaderFileName(ssc);
- _builder.append(_cHeaderFileName, "");
- _builder.append("\"");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/* include instances for all classes */");
- _builder.newLine();
- _builder.append("#include \"");
- String _instSourceFileName = this.stdExt.getInstSourceFileName(ssc);
- _builder.append(_instSourceFileName, "");
- _builder.append("\"");
- _builder.newLineIfNotEmpty();
- _builder.append("#include \"");
- String _dispSourceFileName = this.stdExt.getDispSourceFileName(ssc);
- _builder.append(_dispSourceFileName, "");
- _builder.append("\"");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("#include \"debugging/etLogger.h\"");
- _builder.newLine();
- _builder.append("#include \"debugging/etMSCLogger.h\"");
- _builder.newLine();
- _builder.newLine();
- _builder.append("#include \"platform/etTimer.h\"");
- _builder.newLine();
- _builder.append("#include \"etGlobalFlags.h\"");
- _builder.newLine();
- _builder.newLine();
- DetailCode _userCode3 = ssc.getUserCode3();
- CharSequence _userCode = this.helpers.userCode(_userCode3);
- _builder.append(_userCode, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/* data for SubSysten ");
- String _name_1 = ssc.getName();
- _builder.append(_name_1, "");
- _builder.append(" */");
- _builder.newLineIfNotEmpty();
- _builder.append("typedef struct ");
- String _name_2 = ssc.getName();
- _builder.append(_name_2, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("char *name;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("volatile int shutdownRequest;");
- _builder.newLine();
- _builder.append("} ");
- String _name_3 = ssc.getName();
- _builder.append(_name_3, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("static ");
- String _name_4 = ssc.getName();
- _builder.append(_name_4, "");
- _builder.append(" ");
- String _name_5 = ssc.getName();
- _builder.append(_name_5, "");
- _builder.append("Inst = {\"");
- String _name_6 = ssc.getName();
- _builder.append(_name_6, "");
- _builder.append("\",0};");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("void ");
- String _name_7 = ssc.getName();
- _builder.append(_name_7, "");
- _builder.append("_initActorInstances(void);");
- _builder.newLineIfNotEmpty();
- _builder.append("void ");
- String _name_8 = ssc.getName();
- _builder.append(_name_8, "");
- _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.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.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* construct all actors */");
- _builder.newLine();
- _builder.append("\t");
- String _name_11 = ssc.getName();
- _builder.append(_name_11, " ");
- _builder.append("_constructActorInstances();");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* initialization of all message services */");
- _builder.newLine();
- _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.newLine();
- _builder.append("\t");
- _builder.append("/* init all actors */");
- _builder.newLine();
- _builder.append("\t");
- String _name_12 = ssc.getName();
- _builder.append(_name_12, " ");
- _builder.append("_initActorInstances();");
- _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.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"start\")");
- _builder.newLine();
- _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.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.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"run\")");
- _builder.newLine();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("#ifdef ET_RUNTIME_ENDLESS");
- _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.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.newLineIfNotEmpty();
- _builder.append("\t\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("#else");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("uint32 loopCounter = 0;");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("while(!(");
- String _name_17 = ssc.getName();
- _builder.append(_name_17, " ");
- _builder.append("Inst.shutdownRequest)){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t\t");
- _builder.append("if (etTimer_executeNeeded()){");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("etMessageService_execute(&msgService_Thread1);");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- CharSequence _generateDatadrivenExecutes_1 = this.generateDatadrivenExecutes(root, ssi);
- _builder.append(_generateDatadrivenExecutes_1, " ");
- _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.newLine();
- _builder.append("\t\t\t\t\t");
- _builder.append("break;");
- _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("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("#endif");
- _builder.newLine();
- _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_18 = ssc.getName();
- _builder.append(_name_18, "");
- _builder.append("_stop(void){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"stop\")");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("etLogger_logInfoF(\"%s_stop\", ");
- String _name_19 = ssc.getName();
- _builder.append(_name_19, " ");
- _builder.append("Inst.name);");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- _builder.append("void ");
- String _name_20 = ssc.getName();
- _builder.append(_name_20, "");
- _builder.append("_destroy(void){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"destroy\")");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("etLogger_logInfoF(\"%s_destroy\", ");
- String _name_21 = ssc.getName();
- _builder.append(_name_21, " ");
- _builder.append("Inst.name);");
- _builder.newLineIfNotEmpty();
- {
- EList<ActorInstance> _allContainedInstances = ssi.getAllContainedInstances();
- List<ActorInstance> _reverseView = ListExtensions.<ActorInstance>reverseView(_allContainedInstances);
- for(final ActorInstance ai : _reverseView) {
- {
- ActorClass _actorClass = ai.getActorClass();
- EList<StandardOperation> _operations = _actorClass.getOperations();
- final Function1<StandardOperation,Boolean> _function = new Function1<StandardOperation,Boolean>() {
- public Boolean apply(final StandardOperation op) {
- boolean _isDestructor = op.isDestructor();
- return Boolean.valueOf(_isDestructor);
- }
- };
- Iterable<StandardOperation> _filter = IterableExtensions.<StandardOperation>filter(_operations, _function);
- boolean _isEmpty = IterableExtensions.isEmpty(_filter);
- boolean _not = (!_isEmpty);
- if (_not) {
- _builder.append("\t");
- ActorClass _actorClass_1 = ai.getActorClass();
- String _name_22 = _actorClass_1.getName();
- String _destructorName = this.languageExt.destructorName(_name_22);
- _builder.append(_destructorName, " ");
- _builder.append("(&");
- String _path = ai.getPath();
- String _pathName = this.roomExt.getPathName(_path);
- _builder.append(_pathName, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- _builder.append("void ");
- String _name_23 = ssc.getName();
- _builder.append(_name_23, "");
- _builder.append("_shutdown(void){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"SubSys\", \"shutdown\")");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("etLogger_logInfoF(\"%s_shutdown\", ");
- String _name_24 = ssc.getName();
- _builder.append(_name_24, " ");
- _builder.append("Inst.name);");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- String _name_25 = ssc.getName();
- _builder.append(_name_25, " ");
- _builder.append("Inst.shutdownRequest = 1;");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- _builder.newLine();
- _builder.append("void ");
- String _name_26 = ssc.getName();
- _builder.append(_name_26, "");
- _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("\", \"constructActorInstances\")");
- _builder.newLineIfNotEmpty();
- {
- EList<ActorInstance> _allContainedInstances_1 = ssi.getAllContainedInstances();
- for(final ActorInstance ai_1 : _allContainedInstances_1) {
- {
- ActorClass _actorClass_2 = ai_1.getActorClass();
- EList<StandardOperation> _operations_1 = _actorClass_2.getOperations();
- final Function1<StandardOperation,Boolean> _function_1 = new Function1<StandardOperation,Boolean>() {
- public Boolean apply(final StandardOperation op) {
- boolean _isConstructor = RoomHelpers.isConstructor(op);
- return Boolean.valueOf(_isConstructor);
- }
- };
- Iterable<StandardOperation> _filter_1 = IterableExtensions.<StandardOperation>filter(_operations_1, _function_1);
- boolean _isEmpty_1 = IterableExtensions.isEmpty(_filter_1);
- boolean _not_1 = (!_isEmpty_1);
- if (_not_1) {
- _builder.append("\t");
- ActorClass _actorClass_3 = ai_1.getActorClass();
- String _name_28 = _actorClass_3.getName();
- String _constructorName = this.languageExt.constructorName(_name_28);
- _builder.append(_constructorName, " ");
- _builder.append("(&");
- String _path_1 = ai_1.getPath();
- String _pathName_1 = this.roomExt.getPathName(_path_1);
- _builder.append(_pathName_1, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- _builder.append("void ");
- String _name_29 = ssc.getName();
- _builder.append(_name_29, "");
- _builder.append("_initActorInstances(void){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"");
- String _name_30 = ssc.getName();
- _builder.append(_name_30, " ");
- _builder.append("\", \"initActorInstances\")");
- _builder.newLineIfNotEmpty();
- {
- EList<ActorInstance> _allContainedInstances_2 = ssi.getAllContainedInstances();
- for(final ActorInstance ai_2 : _allContainedInstances_2) {
- _builder.append("\t");
- ActorClass _actorClass_4 = ai_2.getActorClass();
- String _name_31 = _actorClass_4.getName();
- _builder.append(_name_31, " ");
- _builder.append("_init(&");
- String _path_2 = ai_2.getPath();
- String _pathName_2 = this.roomExt.getPathName(_path_2);
- _builder.append(_pathName_2, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_SYNC_EXIT");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- return _builder;
- }
-
- private CharSequence generateInstanceFile(final Root root, final SubSystemInstance ssi, final SubSystemClass ssc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* Instance File of SubSystemClass ");
- String _name = ssc.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* - instantiation of all actor instances and port instances");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* - configuration of data and connection of ports");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- _builder.append("#include \"messaging/etMessageService.h\"");
- _builder.newLine();
- _builder.append("#include \"platform/etMemory.h\"");
- _builder.newLine();
- _builder.newLine();
- _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.newLine();
- _builder.newLine();
- _builder.newLine();
- _builder.append("/* include all used ActorClasses */");
- _builder.newLine();
- {
- EList<ActorClass> _usedActorClasses = root.getUsedActorClasses();
- for(final ActorClass actorClass : _usedActorClasses) {
- _builder.append("#include \"");
- String _name_1 = actorClass.getName();
- _builder.append(_name_1, "");
- _builder.append(".h\"");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- _builder.append("/* include all used ProtcolClasses */");
- _builder.newLine();
- {
- EList<ProtocolClass> _usedProtocolClasses = root.getUsedProtocolClasses();
- for(final ProtocolClass protocolClass : _usedProtocolClasses) {
- _builder.append("#include \"");
- String _name_2 = protocolClass.getName();
- _builder.append(_name_2, "");
- _builder.append(".h\"");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- _builder.newLine();
- _builder.append("/* declarations of all ActorClass instances (const and variable structs) */");
- _builder.newLine();
- _builder.newLine();
- _builder.append("/* forward declaration of variable actor structs */");
- _builder.newLine();
- {
- EList<ActorInstance> _allContainedInstances = ssi.getAllContainedInstances();
- for(final ActorInstance ai : _allContainedInstances) {
- _builder.append("static ");
- ActorClass _actorClass = ai.getActorClass();
- String _name_3 = _actorClass.getName();
- _builder.append(_name_3, "");
- _builder.append(" ");
- String _path = ai.getPath();
- String _pathName = this.roomExt.getPathName(_path);
- _builder.append(_pathName, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- _builder.append("/* forward declaration of variable port structs */\t\t");
- _builder.newLine();
- {
- EList<ActorInstance> _allContainedInstances_1 = ssi.getAllContainedInstances();
- for(final ActorInstance ai_1 : _allContainedInstances_1) {
- {
- EList<InterfaceItemInstance> _orderedIfItemInstances = ai_1.getOrderedIfItemInstances();
- boolean _isEmpty = _orderedIfItemInstances.isEmpty();
- if (_isEmpty) {
- _builder.append("/*nothing to do */");
- _builder.newLine();
- } else {
- {
- EList<InterfaceItemInstance> _orderedIfItemInstances_1 = ai_1.getOrderedIfItemInstances();
- for(final InterfaceItemInstance pi : _orderedIfItemInstances_1) {
- {
- ProtocolClass _protocol = pi.getProtocol();
- boolean _isConjugated = this.roomExt.isConjugated(pi);
- PortClass _portClass = this.roomExt.getPortClass(_protocol, _isConjugated);
- boolean _notEquals = (!Objects.equal(_portClass, null));
- if (_notEquals) {
- {
- ProtocolClass _protocol_1 = pi.getProtocol();
- boolean _isConjugated_1 = this.roomExt.isConjugated(pi);
- PortClass _portClass_1 = this.roomExt.getPortClass(_protocol_1, _isConjugated_1);
- EList<Attribute> _attributes = _portClass_1.getAttributes();
- boolean _isEmpty_1 = _attributes.isEmpty();
- boolean _not = (!_isEmpty_1);
- if (_not) {
- {
- boolean _isReplicated = pi.isReplicated();
- if (_isReplicated) {
- _builder.append("static ");
- ProtocolClass _protocol_2 = pi.getProtocol();
- boolean _isConjugated_2 = this.roomExt.isConjugated(pi);
- String _portClassName = this.roomExt.getPortClassName(_protocol_2, _isConjugated_2);
- _builder.append(_portClassName, "");
- _builder.append("_var ");
- String _path_1 = pi.getPath();
- String _pathName_1 = this.roomExt.getPathName(_path_1);
- _builder.append(_pathName_1, "");
- _builder.append("_var[");
- EList<InterfaceItemInstance> _peers = pi.getPeers();
- int _size = _peers.size();
- _builder.append(_size, "");
- _builder.append("]={");
- String _genReplPortAttributeInitializer = this.genReplPortAttributeInitializer(pi);
- _builder.append(_genReplPortAttributeInitializer, "");
- _builder.append("};");
- _builder.newLineIfNotEmpty();
- } else {
- _builder.append("static ");
- ProtocolClass _protocol_3 = pi.getProtocol();
- boolean _isConjugated_3 = this.roomExt.isConjugated(pi);
- String _portClassName_1 = this.roomExt.getPortClassName(_protocol_3, _isConjugated_3);
- _builder.append(_portClassName_1, "");
- _builder.append("_var ");
- String _path_2 = pi.getPath();
- String _pathName_2 = this.roomExt.getPathName(_path_2);
- _builder.append(_pathName_2, "");
- _builder.append("_var={");
- CharSequence _genPortAttributeInitializer = this.genPortAttributeInitializer(pi);
- _builder.append(_genPortAttributeInitializer, "");
- _builder.append("};");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- _builder.newLine();
- {
- EList<ActorInstance> _allContainedInstances_2 = ssi.getAllContainedInstances();
- for(final ActorInstance ai_2 : _allContainedInstances_2) {
- _builder.newLine();
- _builder.append("/* instance ");
- String _path_3 = ai_2.getPath();
- String _pathName_3 = this.roomExt.getPathName(_path_3);
- _builder.append(_pathName_3, "");
- _builder.append(" */");
- _builder.newLineIfNotEmpty();
- {
- EList<InterfaceItemInstance> _orderedIfItemInstances_2 = ai_2.getOrderedIfItemInstances();
- boolean _isEmpty_2 = _orderedIfItemInstances_2.isEmpty();
- if (_isEmpty_2) {
- _builder.append("/* no ports/saps/services - nothing to initialize statically */");
- _builder.newLine();
- } else {
- CharSequence _genActorInstanceInitializer = this.genActorInstanceInitializer(root, ai_2);
- _builder.append(_genActorInstanceInitializer, "");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.newLine();
- return _builder;
- }
-
- private String genReplPortAttributeInitializer(final InterfaceItemInstance pi) {
- int i = 0;
- String retval = "";
- EList<InterfaceItemInstance> _peers = pi.getPeers();
- int _size = _peers.size();
- i = _size;
- boolean _greaterThan = (i > 0);
- boolean _while = _greaterThan;
- while (_while) {
- {
- String _plus = (retval + "\r\n\t\t\t{");
- CharSequence _genPortAttributeInitializer = this.genPortAttributeInitializer(pi);
- String _plus_1 = (_plus + _genPortAttributeInitializer);
- String _plus_2 = (_plus_1 + "}");
- retval = _plus_2;
- int _minus = (i - 1);
- i = _minus;
- boolean _greaterThan_1 = (i > 0);
- if (_greaterThan_1) {
- String _plus_3 = (retval + ",");
- retval = _plus_3;
- }
- }
- boolean _greaterThan_1 = (i > 0);
- _while = _greaterThan_1;
- }
- return retval;
- }
-
- private CharSequence genPortAttributeInitializer(final InterfaceItemInstance pi) {
- StringConcatenation _builder = new StringConcatenation();
- {
- ProtocolClass _protocol = pi.getProtocol();
- boolean _isConjugated = this.roomExt.isConjugated(pi);
- PortClass _portClass = this.roomExt.getPortClass(_protocol, _isConjugated);
- EList<Attribute> _attributes = _portClass.getAttributes();
- boolean _hasElements = false;
- for(final Attribute attr : _attributes) {
- if (!_hasElements) {
- _hasElements = true;
- } else {
- _builder.appendImmediate(",", "");
- }
- {
- String _defaultValueLiteral = attr.getDefaultValueLiteral();
- boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null));
- if (_notEquals) {
- String _defaultValueLiteral_1 = attr.getDefaultValueLiteral();
- _builder.append(_defaultValueLiteral_1, "");
- } else {
- RefableType _refType = attr.getRefType();
- DataType _type = _refType.getType();
- String _defaultValue = this._typeHelpers.defaultValue(_type);
- _builder.append(_defaultValue, "");
- }
- }
- }
- }
- return _builder;
- }
-
- private CharSequence genActorInstanceInitializer(final Root root, final ActorInstance ai) {
- CharSequence _xblockexpression = null;
- {
- String _path = ai.getPath();
- String instName = this.roomExt.getPathName(_path);
- ArrayList<InterfaceItemInstance> _arrayList = new ArrayList<InterfaceItemInstance>();
- ArrayList<InterfaceItemInstance> replPorts = _arrayList;
- EList<InterfaceItemInstance> _orderedIfItemInstances = ai.getOrderedIfItemInstances();
- final Function1<InterfaceItemInstance,Boolean> _function = new Function1<InterfaceItemInstance,Boolean>() {
- public Boolean apply(final InterfaceItemInstance e) {
- boolean _isReplicated = e.isReplicated();
- return Boolean.valueOf(_isReplicated);
- }
- };
- Iterable<InterfaceItemInstance> _filter = IterableExtensions.<InterfaceItemInstance>filter(_orderedIfItemInstances, _function);
- Iterables.<InterfaceItemInstance>addAll(replPorts, _filter);
- final Function1<InterfaceItemInstance,Boolean> _function_1 = new Function1<InterfaceItemInstance,Boolean>() {
- public Boolean apply(final InterfaceItemInstance e) {
- EList<InterfaceItemInstance> _peers = e.getPeers();
- boolean _isEmpty = _peers.isEmpty();
- boolean _not = (!_isEmpty);
- return Boolean.valueOf(_not);
- }
- };
- InterfaceItemInstance _findFirst = IterableExtensions.<InterfaceItemInstance>findFirst(replPorts, _function_1);
- boolean haveReplSubPorts = (!Objects.equal(_findFirst, null));
- EList<InterfaceItemInstance> _orderedIfItemInstances_1 = ai.getOrderedIfItemInstances();
- final Function1<InterfaceItemInstance,Boolean> _function_2 = new Function1<InterfaceItemInstance,Boolean>() {
- public Boolean apply(final InterfaceItemInstance e) {
- boolean _isSimple = e.isSimple();
- return Boolean.valueOf(_isSimple);
- }
- };
- Iterable<InterfaceItemInstance> simplePorts = IterableExtensions.<InterfaceItemInstance>filter(_orderedIfItemInstances_1, _function_2);
- ArrayList<InterfaceItemInstance> _arrayList_1 = new ArrayList<InterfaceItemInstance>();
- ArrayList<InterfaceItemInstance> eventPorts = _arrayList_1;
- final Function1<InterfaceItemInstance,Boolean> _function_3 = 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_1 = IterableExtensions.<InterfaceItemInstance>filter(simplePorts, _function_3);
- Iterable<InterfaceItemInstance> _union = this.roomExt.<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) {
- ProtocolClass _protocol = p.getProtocol();
- CommunicationType _commType = _protocol.getCommType();
- boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN);
- return Boolean.valueOf(_equals);
- }
- };
- Iterable<InterfaceItemInstance> dataPorts = IterableExtensions.<InterfaceItemInstance>filter(simplePorts, _function_4);
- final Function1<InterfaceItemInstance,Boolean> _function_5 = new Function1<InterfaceItemInstance,Boolean>() {
- public Boolean apply(final InterfaceItemInstance p) {
- boolean _and = false;
- if (!(p instanceof PortInstance)) {
- _and = false;
- } else {
- Port _port = ((PortInstance) p).getPort();
- boolean _isConjugated = _port.isConjugated();
- boolean _not = (!_isConjugated);
- _and = ((p instanceof PortInstance) && _not);
- }
- return Boolean.valueOf(_and);
- }
- };
- Iterable<InterfaceItemInstance> recvPorts = IterableExtensions.<InterfaceItemInstance>filter(dataPorts, _function_5);
- HashMap<InterfaceItemInstance,Integer> _hashMap = new HashMap<InterfaceItemInstance,Integer>();
- HashMap<InterfaceItemInstance,Integer> offsets = _hashMap;
- int offset = 0;
- for (final InterfaceItemInstance p : replPorts) {
- {
- offsets.put(p, Integer.valueOf(offset));
- EList<InterfaceItemInstance> _peers = p.getPeers();
- int _size = _peers.size();
- int _plus = (offset + _size);
- offset = _plus;
- }
- }
- String _xifexpression = null;
- if (haveReplSubPorts) {
- String _plus = (instName + "_repl_sub_ports");
- _xifexpression = _plus;
- } else {
- _xifexpression = "NULL";
- }
- String replSubPortsArray = _xifexpression;
- StringConcatenation _builder = new StringConcatenation();
- {
- if (haveReplSubPorts) {
- _builder.append("static const etReplSubPort ");
- _builder.append(replSubPortsArray, "");
- _builder.append("[");
- _builder.append(offset, "");
- _builder.append("] = {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("/* Replicated Sub Ports: {varData, msgService, peerAddress, localId, index} */");
- _builder.newLine();
- {
- final Function1<InterfaceItemInstance,Boolean> _function_6 = new Function1<InterfaceItemInstance,Boolean>() {
- public Boolean apply(final InterfaceItemInstance e) {
- EList<InterfaceItemInstance> _peers = e.getPeers();
- boolean _isEmpty = _peers.isEmpty();
- boolean _not = (!_isEmpty);
- return Boolean.valueOf(_not);
- }
- };
- Iterable<InterfaceItemInstance> _filter_2 = IterableExtensions.<InterfaceItemInstance>filter(replPorts, _function_6);
- boolean _hasElements = false;
- for(final InterfaceItemInstance pi : _filter_2) {
- if (!_hasElements) {
- _hasElements = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- _builder.append("\t");
- String _genReplSubPortInitializers = this.genReplSubPortInitializers(root, ai, pi);
- _builder.append(_genReplSubPortInitializers, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("};");
- _builder.newLine();
- }
- }
- {
- boolean _and = false;
- boolean _isEmpty = eventPorts.isEmpty();
- if (!_isEmpty) {
- _and = false;
- } else {
- boolean _isEmpty_1 = IterableExtensions.isEmpty(recvPorts);
- _and = (_isEmpty && _isEmpty_1);
- }
- boolean _not = (!_and);
- if (_not) {
- _builder.append("static const ");
- ActorClass _actorClass = ai.getActorClass();
- String _name = _actorClass.getName();
- _builder.append(_name, "");
- _builder.append("_const ");
- _builder.append(instName, "");
- _builder.append("_const = {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("/* Ports: {varData, msgService, peerAddress, localId} */");
- _builder.newLine();
- {
- boolean _hasElements_1 = false;
- for(final InterfaceItemInstance pi_1 : eventPorts) {
- if (!_hasElements_1) {
- _hasElements_1 = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- {
- boolean _isSimple = pi_1.isSimple();
- if (_isSimple) {
- _builder.append("\t");
- String _genPortInitializer = this.genPortInitializer(root, ai, pi_1);
- _builder.append(_genPortInitializer, " ");
- _builder.newLineIfNotEmpty();
- } else {
- _builder.append("\t");
- _builder.append("{");
- EList<InterfaceItemInstance> _peers = pi_1.getPeers();
- int _size = _peers.size();
- _builder.append(_size, " ");
- _builder.append(", ");
- _builder.append(replSubPortsArray, " ");
- _builder.append("+");
- Integer _get = offsets.get(pi_1);
- _builder.append(_get, " ");
- _builder.append("}");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _builder.append("\t");
- {
- boolean _and_1 = false;
- boolean _isEmpty_2 = eventPorts.isEmpty();
- boolean _not_1 = (!_isEmpty_2);
- if (!_not_1) {
- _and_1 = false;
- } else {
- boolean _isEmpty_3 = IterableExtensions.isEmpty(recvPorts);
- boolean _not_2 = (!_isEmpty_3);
- _and_1 = (_not_1 && _not_2);
- }
- if (_and_1) {
- _builder.append(",");
- }
- }
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* data receive ports */");
- _builder.newLine();
- {
- boolean _hasElements_2 = false;
- for(final InterfaceItemInstance pi_2 : recvPorts) {
- if (!_hasElements_2) {
- _hasElements_2 = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- _builder.append("\t");
- String _genRecvPortInitializer = this.genRecvPortInitializer(root, ai, pi_2);
- _builder.append(_genRecvPortInitializer, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("};");
- _builder.newLine();
- _builder.append("static ");
- ActorClass _actorClass_1 = ai.getActorClass();
- String _name_1 = _actorClass_1.getName();
- _builder.append(_name_1, "");
- _builder.append(" ");
- _builder.append(instName, "");
- _builder.append(" = {&");
- _builder.append(instName, "");
- _builder.append("_const};");
- _builder.newLineIfNotEmpty();
- }
- }
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- private String genPortInitializer(final Root root, final ActorInstance ai, final InterfaceItemInstance pi) {
- String _xblockexpression = null;
- {
- int _xifexpression = (int) 0;
- EList<InterfaceItemInstance> _peers = pi.getPeers();
- boolean _isEmpty = _peers.isEmpty();
- if (_isEmpty) {
- _xifexpression = 0;
- } else {
- EList<InterfaceItemInstance> _peers_1 = pi.getPeers();
- InterfaceItemInstance _get = _peers_1.get(0);
- int _objId = _get.getObjId();
- _xifexpression = _objId;
- }
- int objId = _xifexpression;
- int _xifexpression_1 = (int) 0;
- EList<InterfaceItemInstance> _peers_2 = pi.getPeers();
- boolean _isEmpty_1 = _peers_2.isEmpty();
- if (_isEmpty_1) {
- _xifexpression_1 = 0;
- } else {
- EList<InterfaceItemInstance> _peers_3 = pi.getPeers();
- InterfaceItemInstance _get_1 = _peers_3.get(0);
- EList<InterfaceItemInstance> _peers_4 = _get_1.getPeers();
- int _indexOf = _peers_4.indexOf(pi);
- _xifexpression_1 = _indexOf;
- }
- int idx = _xifexpression_1;
- 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 + ", ");
- 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);
- }
- return _xblockexpression;
- }
-
- private String getInterfaceItemInstanceData(final InterfaceItemInstance pi) {
- ProtocolClass _protocol = pi.getProtocol();
- boolean _isConjugated = this.roomExt.isConjugated(pi);
- PortClass _portClass = this.roomExt.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);
- 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 _plus = ("&" + _pathName);
- return (_plus + "_var");
- }
- }
-
- private String genRecvPortInitializer(final Root root, final ActorInstance ai, final InterfaceItemInstance pi) {
- String _xblockexpression = null;
- {
- EList<InterfaceItemInstance> _peers = pi.getPeers();
- boolean _isEmpty = _peers.isEmpty();
- if (_isEmpty) {
- return "{NULL}";
- }
- EList<InterfaceItemInstance> _peers_1 = pi.getPeers();
- InterfaceItemInstance peer = _peers_1.get(0);
- EList<InterfaceItemInstance> _peers_2 = pi.getPeers();
- InterfaceItemInstance _get = _peers_2.get(0);
- EObject _eContainer = _get.eContainer();
- ActorInstance peerInst = ((ActorInstance) _eContainer);
- String _path = peerInst.getPath();
- String instName = this.roomExt.getPathName(_path);
- String _plus = ("{&" + instName);
- String _plus_1 = (_plus + ".");
- String _name = peer.getName();
- String _plus_2 = (_plus_1 + _name);
- String _plus_3 = (_plus_2 + "}");
- _xblockexpression = (_plus_3);
- }
- return _xblockexpression;
- }
-
- private String genReplSubPortInitializers(final Root root, final ActorInstance ai, final InterfaceItemInstance pi) {
- String result = "";
- EList<InterfaceItemInstance> _peers = pi.getPeers();
- for (final InterfaceItemInstance p : _peers) {
- {
- EList<InterfaceItemInstance> _peers_1 = pi.getPeers();
- int idx = _peers_1.indexOf(p);
- String _xifexpression = null;
- EList<InterfaceItemInstance> _peers_2 = pi.getPeers();
- int _size = _peers_2.size();
- int _minus = (_size - 1);
- boolean _lessThan = (idx < _minus);
- if (_lessThan) {
- _xifexpression = ",";
- } else {
- _xifexpression = "";
- }
- String comma = _xifexpression;
- String iiiD = this.getInterfaceItemInstanceData(pi);
- String _xifexpression_1 = null;
- boolean _equals = iiiD.equals("0");
- if (_equals) {
- String _plus = (iiiD + ",");
- _xifexpression_1 = _plus;
- } else {
- String _plus_1 = (iiiD + "[");
- String _plus_2 = (_plus_1 + Integer.valueOf(idx));
- String _plus_3 = (_plus_2 + "],");
- _xifexpression_1 = _plus_3;
- }
- iiiD = _xifexpression_1;
- 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_8 = (_plus_7 + ", ");
- 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 ");
- 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;
- }
- }
- return result;
- }
-
- private CharSequence generateDispatcherFile(final Root root, final SubSystemInstance ssi, final SubSystemClass ssc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* Dispatcher File of SubSystemClass ");
- String _name = ssc.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* - one generated dispatcher for each MessageService (Thread)");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- _builder.append("#include \"messaging/etMessageReceiver.h\"");
- _builder.newLine();
- _builder.append("#include \"debugging/etLogger.h\"");
- _builder.newLine();
- _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(" */");
- _builder.newLineIfNotEmpty();
- {
- 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) {
- {
- 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.roomExt.isConjugated(pi);
- boolean _handlesReceive = this.roomExt.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.roomExt.isConjugated(pi);
- List<MessageHandler> _receiveHandlers = this.roomExt.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_1 = _protocol_2.getName();
- _builder.append(_name_1, " ");
- _builder.append("_");
- Message _msg = h.getMsg();
- String _codeName = this.roomExt.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.roomExt.isConjugated(pi);
- String _portClassName = this.roomExt.getPortClassName(_protocol_3, _isConjugated_2);
- _builder.append(_portClassName, " ");
- _builder.append("_");
- Message _msg_1 = h.getMsg();
- String _name_2 = _msg_1.getName();
- _builder.append(_name_2, " ");
- _builder.append("_receiveHandler((etPort *)&");
- String _path_1 = ai.getPath();
- String _pathName = this.roomExt.getPathName(_path_1);
- _builder.append(_pathName, " ");
- _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, " ");
- _builder.append(",");
- ActorClass _actorClass = ai.getActorClass();
- String _name_4 = _actorClass.getName();
- _builder.append(_name_4, " ");
- _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, " ");
- _builder.append("_receiveMessage((void*)&");
- String _path_3 = ai.getPath();
- String _pathName_2 = this.roomExt.getPathName(_path_3);
- _builder.append(_pathName_2, " ");
- _builder.append(",(etPort*)&");
- String _path_4 = ai.getPath();
- String _pathName_3 = this.roomExt.getPathName(_path_4);
- _builder.append(_pathName_3, " ");
- _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);");
- _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_7 = _actorClass_2.getName();
- _builder.append(_name_7, " ");
- _builder.append("_receiveMessage((void*)&");
- String _path_5 = ai.getPath();
- String _pathName_4 = this.roomExt.getPathName(_path_5);
- _builder.append(_pathName_4, " ");
- _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, " ");
- _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);");
- _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.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();
- return _builder;
- }
-
- private CharSequence generateDatadrivenExecutes(final Root root, final SubSystemInstance ssi) {
- StringConcatenation _builder = new StringConcatenation();
- {
- EList<ActorInstance> _allContainedInstances = ssi.getAllContainedInstances();
- for(final ActorInstance ai : _allContainedInstances) {
- {
- boolean _or = false;
- ActorClass _actorClass = ai.getActorClass();
- ActorCommunicationType _commType = _actorClass.getCommType();
- boolean _equals = Objects.equal(_commType, ActorCommunicationType.ASYNCHRONOUS);
- if (_equals) {
- _or = true;
- } else {
- ActorClass _actorClass_1 = ai.getActorClass();
- ActorCommunicationType _commType_1 = _actorClass_1.getCommType();
- boolean _equals_1 = Objects.equal(_commType_1, ActorCommunicationType.DATA_DRIVEN);
- _or = (_equals || _equals_1);
- }
- if (_or) {
- ActorClass _actorClass_2 = ai.getActorClass();
- String _name = _actorClass_2.getName();
- _builder.append(_name, "");
- _builder.append("_execute(&");
- String _path = ai.getPath();
- String _pathName = this.roomExt.getPathName(_path);
- _builder.append(_pathName, "");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- return _builder;
- }
-}
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/SubSystemRunnerGen.java
deleted file mode 100644
index a1a5d02f7..000000000
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemRunnerGen.java
+++ /dev/null
@@ -1,171 +0,0 @@
-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 org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
-import org.eclipse.etrice.core.room.SubSystemClass;
-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 {
- @Inject
- private JavaIoFileSystemAccess fileAccess;
-
- @Inject
- private RoomExtensions roomExt;
-
- 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);
- String _name = sc.getName();
- String _plus_1 = (_name + "_Runner.c");
- SubSystemClass _subSystemClass_2 = sc.getSubSystemClass();
- CharSequence _generateSourceFile = this.generateSourceFile(root, sc, _subSystemClass_2);
- this.fileAccess.generateFile(_plus_1, _generateSourceFile);
- }
- }
- }
-
- public CharSequence generateSourceFile(final Root root, final SubSystemInstance ssi, final SubSystemClass ssc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* @author generated by eTrice");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* this class contains the main function running component ");
- String _name = ssi.getName();
- _builder.append(_name, " ");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("* it instantiates ");
- String _name_1 = ssi.getName();
- _builder.append(_name_1, " ");
- _builder.append(" and starts and ends the lifecycle");
- _builder.newLineIfNotEmpty();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- _builder.newLine();
- _builder.append("#include \"");
- String _name_2 = ssi.getName();
- _builder.append(_name_2, "");
- _builder.append(".h\"");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("#include \"debugging/etLogger.h\"");
- _builder.newLine();
- _builder.append("#include \"debugging/etMSCLogger.h\"");
- _builder.newLine();
- _builder.append("#include \"platform/etPlatform.h\"");
- _builder.newLine();
- _builder.newLine();
- _builder.newLine();
- _builder.append("/**");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* main function");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("* creates component and starts and stops the lifecycle");
- _builder.newLine();
- _builder.append(" ");
- _builder.append("*/");
- _builder.newLine();
- _builder.newLine();
- _builder.append("int main(void) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("etUserEntry(); /* platform specific */");
- _builder.newLine();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("etLogger_logInfo(\"*** T H E B E G I N ***\");");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_OPEN(\"main\");");
- _builder.newLine();
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* startup sequence of lifecycle */");
- _builder.newLine();
- _builder.append("\t");
- String _name_3 = ssi.getName();
- _builder.append(_name_3, " ");
- _builder.append("_init(); \t\t/* lifecycle init */");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- String _name_4 = ssi.getName();
- _builder.append(_name_4, " ");
- _builder.append("_start(); \t/* lifecycle start */");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("\t");
- _builder.append("etUserPreRun(); /* platform specific */");
- _builder.newLine();
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* run Scheduler */");
- _builder.newLine();
- _builder.append("\t");
- String _name_5 = ssi.getName();
- _builder.append(_name_5, " ");
- _builder.append("_run();");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("\t");
- _builder.append("etUserPostRun(); /* platform specific */");
- _builder.newLine();
- _builder.newLine();
- _builder.append("\t");
- _builder.append("/* shutdown sequence of lifecycle */");
- _builder.newLine();
- _builder.append("\t");
- String _name_6 = ssi.getName();
- _builder.append(_name_6, " ");
- _builder.append("_stop(); \t\t/* lifecycle stop */");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- String _name_7 = ssi.getName();
- _builder.append(_name_7, " ");
- _builder.append("_destroy(); \t/* lifecycle destroy */");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("\t");
- _builder.append("ET_MSC_LOGGER_CLOSE");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("etLogger_logInfo(\"*** T H E E N D ***\");");
- _builder.newLine();
- _builder.newLine();
- _builder.append("\t");
- _builder.append("etUserExit(); /* platform specific */");
- _builder.newLine();
- _builder.newLine();
- _builder.append("\t");
- _builder.append("return 0;");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- return _builder;
- }
-}

Back to the top