summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjung2012-04-27 15:48:36 (EDT)
committertjung2012-04-27 15:48:36 (EDT)
commit78a58db65bdc2f03548a5987a0db32e93bd57a98 (patch)
tree2b9931e66f84f2826f09962b90dabac8db499fce
parent0bd09dc1dc8cb0643fcfc39d4abe9fb47d89b409 (diff)
downloadorg.eclipse.etrice-78a58db65bdc2f03548a5987a0db32e93bd57a98.zip
org.eclipse.etrice-78a58db65bdc2f03548a5987a0db32e93bd57a98.tar.gz
org.eclipse.etrice-78a58db65bdc2f03548a5987a0db32e93bd57a98.tar.bz2
gerrit bypass enabled
-rw-r--r--gerritKeys30
-rw-r--r--gerritKeys.pub1
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend16
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java2458
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java1410
5 files changed, 1971 insertions, 1944 deletions
diff --git a/gerritKeys b/gerritKeys
new file mode 100644
index 0000000..59db139
--- /dev/null
+++ b/gerritKeys
@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,CEF20592097C4125
+
+xI5lJO/5sDRE2QVgmVDrcru/fKR6fSg/puFOYDert2hBkMK9s1DSLXq4RwFqql4R
+RZSZgq1DX9MMFKPY18W5Vy4laW2hgZmOG5E+9bbY9T0gdsH5nrbNnkxXXE9qFdEs
+8jhBKNzpowYc8jlK0KdA2yQJ7tPIL2jGsUIbUBaUhGFKxK5bh8Vm3d8viyGQKR16
+44ysLHx3cEONeaDTDcyb/BA6gipGymsIm9WazQqC0x3WKGktjB7bLQXnnsQR8vFE
+11sKTwXzUM4up79BAnNAJWwg6CvCVGgPJ6dbDnLiWSN7rwIQdtVAZR/ngwlCsjuO
+H4ocwtbU/SVTfG9/4c47XuGrYft+Iul36ut66P5jLEAwfRk6UoS+4nVKmSTce4Ze
+JHXicxEUOwXfX+e3/nXS3fvV0VBMEIBSC8GhU9aDH4hjOA/g85c0bBOqnSaq5e1L
+7iBSDAODAX0SN+3ElLIxonCNo0+M8YPaBbIhN4iSt6XmG/TP6mmvINvgDQ5z7QL0
+i0WoIvimQxw1CTGbSUHEdlzhQHMWw8B7qcsMyS48NF+z4QGT+W3+E9EdkBW+7KdD
+8r3xuC1rrGbbYZX2YRkc33sRX81VZ6Y5hctjsP6um4ebJrOHgGhfW7HIIGbIMDWE
+WDhQsUAw0Zz6NMN5O1ZtS3X5+fYJBRElYy+/ooTLthpRL/wmUalR/vWHBxaiDiyG
+SboWqN2yeZH3DUDJS2qG7S2lcmIVUJoPC+PF3Q4Ski2EJqQA7lO7KR+H2zgKbDvJ
+cxydFZIHwq6eiTQA+85OOKziRQUVH1wWnvliXbbfbc3g9U8V/LAeITlrxkSfG6Rp
+IV2cppKvDzxOkkPqhbqUJOMyAXpEqFyeBtEzvXq+jbckb9jMQZdfLIq0ApCThX1I
+hG1JxbkEqR0xHjv3+FNN6VIBBqs1OxxYuSGqb2XgzHGbMxu8GvsLa2AZRYk4ui/d
+piUPGDvCrD5TL9/jrvX/yzWgWRRRmXOjA357QjUR9hcwLhT/8K/tL9clPTZYIDEg
+OyDUaJInK9GMAmtt6FA76Ab5TFwm1x9IpItTD4yq/QpeMGQpnoQNp98n/bEawHBZ
+zkPCFLu2XBcoupCbZJT2Y6bdvEx5Spq02gVojHpdNuMUSQ4M8Fi+7uyKtdVBvCrD
+SJcp1mwomvQ7ksaJ2WqxfjmN0mJGyJU60OiwCTHcLakPyQfq+OHMN6/t1dYBRHpZ
+YMJmOMA7upTlywtLhVZsR+SjMaaWbCQpRwBYQKHJOO+dWPU67+vL7KjvNLaNaObU
+1x9x9TA6kVF91lUtsYXnocFYHmtBqrDi6LblIEKN2cXrKRlcGtdmGi0ZTM/2jnLM
+8WuxXRmB4DvIEkxMFQS3V+dWo6B6jm8HnEKlzvJAt6X+5yFsix4YsiEfpo2epj+7
+9Db60SAfZx4QrT5frkQgYo3g8WaQqeXiooRC5FUu6JU0W8AbsIjSmPk78illr+HL
+JIUqVKAIy6o56qyfgLS/uqgHHoscwXBLyifVbGkNOrbOnj6+tNtd9wVP6haUVQmi
+PURYXrEkI+vwqhj034jpbdV3mS6VaQqqDi6rNDnLZaPx7uezgDkgZg==
+-----END RSA PRIVATE KEY-----
diff --git a/gerritKeys.pub b/gerritKeys.pub
new file mode 100644
index 0000000..b24b6a1
--- /dev/null
+++ b/gerritKeys.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuBcuKvdgGQse39VkA5FbVWtzm312qrCnZE+4SjnoZe+qm1JR8gIM+9xKRAkTn1z/ZX2vxYq2IcAS0IX+fp5KpH6q1CUV2WcaP7AQ7QtabjsHRbYnpqH+Ep9Ej/GYW9BbQpDCQp/D72M11b2JzoMYzJJbPrpwx464GFydIOJKt2my4BNAf/HQG7zk74pvYae4hbZOm1Ssum5DAEtbk0kPSSaOiphy0BpmakcofB3UVxQfOXl6pqnDYBnFhbmqdAKY+y4mbnVunJqRZ/jThB5vO/HLLurasRUkAJBUzmecBkC+dvVLisCj1zD87lxm8pnTVp/+CjrUUy1R52iieK1vEw== thomas.jung@tieto.com
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
index b9058d5..f60f551 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
@@ -259,14 +259,14 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
«messageSignature(replPortClassName, message.name, "_broadcast", data)» {
«IF hdlr != null»
int i;
- for (i=0; i<self->size; ++i) {
- «portClassName»_«message.name»((«portClassName»*)&self->ports[i]«data»);
+ for (i=0; i<((etReplPort*)self)->size; ++i) {
+ «portClassName»_«message.name»((etPort*)&((etReplPort*)self)->ports[i]«data»);
}
«ELSE»
int i;
ET_MSC_LOGGER_SYNC_ENTRY("«replPortClassName»", "«message.name»")
- for (i=0; i<self->size; ++i) {
- «sendMessageCall(hasData, "(etPort*)(&self->ports[i])", memberInUse(pc.name, dir+message.name), typeName+refp, refa+"data")»
+ for (i=0; i<((etReplPort*)self)->size; ++i) {
+ «sendMessageCall(hasData, "((etPort*)&((etReplPort*)self)->ports[i])", memberInUse(pc.name, dir+message.name), typeName+refp, refa+"data")»
}
ET_MSC_LOGGER_SYNC_EXIT
«ENDIF»
@@ -274,11 +274,11 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
«messageSignature(replPortClassName, message.name, "", ", int idx"+data)» {
«IF hdlr != null»
- «portClassName»_«message.name»((«portClassName»*)&self->ports[idx]«data»);
+ «portClassName»_«message.name»((etPort*)&((etReplPort*)self)->ports[idx]«data»);
«ELSE»
ET_MSC_LOGGER_SYNC_ENTRY("«replPortClassName»", "«message.name»")
- if (0<=idx && idx<self->size) {
- «sendMessageCall(hasData, "(etPort*)(&self->ports[idx])", memberInUse(pc.name, dir+message.name), typeName+refp, refa+"data")»
+ if (0<=idx && idx<((etReplPort*)self)->size) {
+ «sendMessageCall(hasData, "((etPort*)&((etReplPort*)self)->ports[idx])", memberInUse(pc.name, dir+message.name), typeName+refp, refa+"data")»
}
ET_MSC_LOGGER_SYNC_EXIT
«ENDIF»
@@ -292,7 +292,7 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
// getReplication
etInt32 «replPortClassName»_getReplication(const «replPortClassName»* self) {
- return self->size;
+ return ((etReplPort*)self)->size;
}
«IF pc.handlesReceive(conj)»
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
index b611b8f..ed950f7 100644
--- 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
@@ -1,1231 +1,1227 @@
-package org.eclipse.etrice.generator.c.gen;
-
-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.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.base.ILogger;
-import org.eclipse.etrice.generator.c.gen.CExtensions;
-import org.eclipse.etrice.generator.etricegen.Root;
-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.xtext.generator.JavaIoFileSystemAccess;
-import org.eclipse.xtext.xbase.lib.BooleanExtensions;
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.ObjectExtensions;
-import org.eclipse.xtext.xbase.lib.StringExtensions;
-import org.eclipse.xtext.xtend2.lib.StringConcatenation;
-
-@SuppressWarnings("all")
-@Singleton
-public class ProtocolClassGen extends GenericProtocolClassGenerator {
- @Inject
- private JavaIoFileSystemAccess fileAccess;
-
- @Inject
- private CExtensions stdExt;
-
- @Inject
- private RoomExtensions roomExt;
-
- @Inject
- private ProcedureHelpers helpers;
-
- @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.roomExt.getGenerationTargetPath(pc);
- String _path = this.roomExt.getPath(pc);
- String _operator_plus = StringExtensions.operator_plus(_generationTargetPath, _path);
- String path = _operator_plus;
- String _cHeaderFileName = this.stdExt.getCHeaderFileName(pc);
- String _operator_plus_1 = StringExtensions.operator_plus("generating ProtocolClass header \'", _cHeaderFileName);
- String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, "\' in \'");
- String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, path);
- String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, "\'");
- this.logger.logInfo(_operator_plus_4);
- this.fileAccess.setOutputPath(path);
- String _cHeaderFileName_1 = this.stdExt.getCHeaderFileName(pc);
- StringConcatenation _generateHeaderFile = this.generateHeaderFile(root, pc);
- this.fileAccess.generateFile(_cHeaderFileName_1, _generateHeaderFile);
- String _cSourceFileName = this.stdExt.getCSourceFileName(pc);
- String _operator_plus_5 = StringExtensions.operator_plus("generating ProtocolClass source \'", _cSourceFileName);
- String _operator_plus_6 = StringExtensions.operator_plus(_operator_plus_5, "\' in \'");
- String _operator_plus_7 = StringExtensions.operator_plus(_operator_plus_6, path);
- String _operator_plus_8 = StringExtensions.operator_plus(_operator_plus_7, "\'");
- this.logger.logInfo(_operator_plus_8);
- this.fileAccess.setOutputPath(path);
- String _cSourceFileName_1 = this.stdExt.getCSourceFileName(pc);
- StringConcatenation _generateSourceFile = this.generateSourceFile(root, pc);
- this.fileAccess.generateFile(_cSourceFileName_1, _generateSourceFile);
- }
- }
- }
-
- private StringConcatenation 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();
- StringConcatenation _generateIncludeGuardBegin = this.stdExt.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();
- DetailCode _userCode1 = pc.getUserCode1();
- StringConcatenation _userCode = this.helpers.userCode(_userCode1);
- _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 _operator_equals = ObjectExtensions.operator_equals(_commType, CommunicationType.EVENT_DRIVEN);
- if (_operator_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();
- StringConcatenation _portClassHeader = this.portClassHeader(pc, ((Boolean)false));
- _builder.append(_portClassHeader, "");
- _builder.newLineIfNotEmpty();
- StringConcatenation _portClassHeader_1 = this.portClassHeader(pc, ((Boolean)true));
- _builder.append(_portClassHeader_1, "");
- _builder.newLineIfNotEmpty();
- } else {
- CommunicationType _commType_1 = pc.getCommType();
- boolean _operator_equals_1 = ObjectExtensions.operator_equals(_commType_1, CommunicationType.DATA_DRIVEN);
- if (_operator_equals_1) {
- _builder.append("/*--------------------- port structs and methods */");
- _builder.newLine();
- StringConcatenation _genDataDrivenPortHeaders = this.genDataDrivenPortHeaders(pc);
- _builder.append(_genDataDrivenPortHeaders, "");
- _builder.newLineIfNotEmpty();
- } else {
- CommunicationType _commType_2 = pc.getCommType();
- boolean _operator_equals_2 = ObjectExtensions.operator_equals(_commType_2, CommunicationType.SYNCHRONOUS);
- if (_operator_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();
- DetailCode _userCode2 = pc.getUserCode2();
- StringConcatenation _userCode_1 = this.helpers.userCode(_userCode2);
- _builder.append(_userCode_1, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- String _name_4 = pc.getName();
- StringConcatenation _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_4);
- _builder.append(_generateIncludeGuardEnd, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- return _builder;
- }
-
- private StringConcatenation 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.stdExt.getCHeaderFileName(pc);
- _builder.append(_cHeaderFileName, "");
- _builder.append("\"");
- _builder.newLineIfNotEmpty();
- _builder.append("#include \"debugging/etMSCLogger.h\"");
- _builder.newLine();
- _builder.newLine();
- DetailCode _userCode3 = pc.getUserCode3();
- StringConcatenation _userCode = this.helpers.userCode(_userCode3);
- _builder.append(_userCode, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/*--------------------- port methods */");
- _builder.newLine();
- {
- CommunicationType _commType = pc.getCommType();
- boolean _operator_equals = ObjectExtensions.operator_equals(_commType, CommunicationType.EVENT_DRIVEN);
- if (_operator_equals) {
- StringConcatenation _portClassSource = this.portClassSource(pc, ((Boolean)false));
- _builder.append(_portClassSource, "");
- _builder.newLineIfNotEmpty();
- StringConcatenation _portClassSource_1 = this.portClassSource(pc, ((Boolean)true));
- _builder.append(_portClassSource_1, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("/*--------------------- debug helpers */");
- _builder.newLine();
- StringConcatenation _generateDebugHelpersImplementation = this.generateDebugHelpersImplementation(root, pc);
- _builder.append(_generateDebugHelpersImplementation, "");
- _builder.newLineIfNotEmpty();
- } else {
- CommunicationType _commType_1 = pc.getCommType();
- boolean _operator_equals_1 = ObjectExtensions.operator_equals(_commType_1, CommunicationType.DATA_DRIVEN);
- if (_operator_equals_1) {
- StringConcatenation _genDataDrivenPortSources = this.genDataDrivenPortSources(pc);
- _builder.append(_genDataDrivenPortSources, "");
- _builder.newLineIfNotEmpty();
- } else {
- CommunicationType _commType_2 = pc.getCommType();
- boolean _operator_equals_2 = ObjectExtensions.operator_equals(_commType_2, CommunicationType.SYNCHRONOUS);
- if (_operator_equals_2) {
- _builder.append("#error \"synchronoue protocols not implemented yet\"");
- _builder.newLine();
- }
- }
- }
- }
- return _builder;
- }
-
- private StringConcatenation portClassHeader(final ProtocolClass pc, final Boolean conj) {
- StringConcatenation _xblockexpression = null;
- {
- String _portClassName = this.roomExt.getPortClassName(pc, conj);
- String portClassName = _portClassName;
- String _portClassName_1 = this.roomExt.getPortClassName(pc, conj, true);
- String replPortClassName = _portClassName_1;
- List<Message> _xifexpression = null;
- if (conj) {
- List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
- _xifexpression = _allIncomingMessages;
- } else {
- List<Message> _allOutgoingMessages = this.roomExt.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.roomExt.getPortClass(pc, conj);
- boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_portClass, null);
- if (_operator_notEquals) {
- {
- PortClass _portClass_1 = this.roomExt.getPortClass(pc, conj);
- EList<Attribute> _attributes = _portClass_1.getAttributes();
- boolean _isEmpty = _attributes.isEmpty();
- boolean _operator_not = BooleanExtensions.operator_not(_isEmpty);
- if (_operator_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.roomExt.getPortClass(pc, conj);
- EList<Attribute> _attributes_1 = _portClass_2.getAttributes();
- StringConcatenation _attributes_2 = this.helpers.attributes(_attributes_1);
- _builder.append(_attributes_2, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("};");
- _builder.newLine();
- {
- PortClass _portClass_3 = this.roomExt.getPortClass(pc, conj);
- EList<Attribute> _attributes_3 = _portClass_3.getAttributes();
- for(final Attribute a : _attributes_3) {
- {
- String _defaultValueLiteral = a.getDefaultValueLiteral();
- boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(_defaultValueLiteral, null);
- if (_operator_notEquals_1) {
- _builder.append("\t\t\t\t");
- String _operator_plus = StringExtensions.operator_plus(portClassName, " ");
- String _name = a.getName();
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, _name);
- String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, ": Attribute initialization not supported in C");
- this.logger.logInfo(_operator_plus_2);
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- }
- }
- }
- }
- _builder.append("\t");
- _builder.newLine();
- {
- for(final Message message : messages) {
- VarDecl _data = message.getData();
- boolean _operator_notEquals_2 = ObjectExtensions.operator_notEquals(_data, null);
- boolean hasData = _operator_notEquals_2;
- _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 _operator_and = false;
- if (!hasData) {
- _operator_and = false;
- } else {
- boolean _operator_or = false;
- VarDecl _data_2 = message.getData();
- RefableType _refType_1 = _data_2.getRefType();
- DataType _type_1 = _refType_1.getType();
- boolean _operator_not_1 = BooleanExtensions.operator_not((_type_1 instanceof PrimitiveType));
- if (_operator_not_1) {
- _operator_or = true;
- } else {
- VarDecl _data_3 = message.getData();
- RefableType _refType_2 = _data_3.getRefType();
- boolean _isRef = _refType_2.isRef();
- _operator_or = BooleanExtensions.operator_or(_operator_not_1, _isRef);
- }
- _operator_and = BooleanExtensions.operator_and(hasData, _operator_or);
- }
- if (_operator_and) {
- _xifexpression_2 = "*";
- } else {
- _xifexpression_2 = "";
- }
- String refp = _xifexpression_2;
- _builder.newLineIfNotEmpty();
- String _xifexpression_3 = null;
- if (hasData) {
- String _operator_plus_3 = StringExtensions.operator_plus(", ", typeName);
- String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, refp);
- String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, " data");
- _xifexpression_3 = _operator_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 _operator_plus_6 = StringExtensions.operator_plus(", int idx", data);
- String _messageSignature_2 = this.messageSignature(replPortClassName, _name_3, "", _operator_plus_6);
- _builder.append(_messageSignature_2, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t");
- _builder.newLine();
- {
- PortClass _portClass_4 = this.roomExt.getPortClass(pc, conj);
- boolean _operator_notEquals_3 = ObjectExtensions.operator_notEquals(_portClass_4, null);
- if (_operator_notEquals_3) {
- PortClass _portClass_5 = this.roomExt.getPortClass(pc, conj);
- EList<PortOperation> _operations = _portClass_5.getOperations();
- StringConcatenation _operationsDeclaration = this.helpers.operationsDeclaration(_operations, portClassName);
- _builder.append(_operationsDeclaration, "");
- _builder.newLineIfNotEmpty();
- PortClass _portClass_6 = this.roomExt.getPortClass(pc, conj);
- EList<PortOperation> _operations_1 = _portClass_6.getOperations();
- StringConcatenation _operationsDeclaration_1 = this.helpers.operationsDeclaration(_operations_1, replPortClassName);
- _builder.append(_operationsDeclaration_1, "");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.newLine();
- {
- boolean _handlesReceive = this.roomExt.handlesReceive(pc, conj);
- if (_handlesReceive) {
- {
- List<MessageHandler> _receiveHandlers = this.roomExt.getReceiveHandlers(pc, conj);
- 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();
- }
- }
- }
- }
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- private StringConcatenation genDataDrivenPortHeaders(final ProtocolClass pc) {
- StringConcatenation _xblockexpression = null;
- {
- List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
- final Function1<Message,Boolean> _function = new Function1<Message,Boolean>() {
- public Boolean apply(final Message m) {
- VarDecl _data = m.getData();
- boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_data, null);
- return ((Boolean)_operator_notEquals);
- }
- };
- Iterable<Message> _filter = IterableExtensions.<Message>filter(_allIncomingMessages, _function);
- Iterable<Message> sentMsgs = _filter;
- 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);
- String typeName = _typeName;
- _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.roomExt.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.roomExt.getPortClassName(pc, true);
- _builder.append(_portClassName_1, " ");
- _builder.append("* peer;");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- String _portClassName_2 = this.roomExt.getPortClassName(pc, false);
- _builder.append(_portClassName_2, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- {
- for(final Message message : sentMsgs) {
- VarDecl _data_2 = message.getData();
- boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_data_2, null);
- boolean hasData = _operator_notEquals;
- _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_1 = this._typeHelpers.typeName(_type_1);
- _xifexpression_1 = _typeName_1;
- } else {
- _xifexpression_1 = "";
- }
- String typeName_1 = _xifexpression_1;
- _builder.newLineIfNotEmpty();
- String _xifexpression_2 = null;
- boolean _operator_and = false;
- if (!hasData) {
- _operator_and = false;
- } else {
- VarDecl _data_4 = message.getData();
- RefableType _refType_3 = _data_4.getRefType();
- DataType _type_2 = _refType_3.getType();
- boolean _operator_not = BooleanExtensions.operator_not((_type_2 instanceof PrimitiveType));
- _operator_and = BooleanExtensions.operator_and(hasData, _operator_not);
- }
- if (_operator_and) {
- _xifexpression_2 = "*";
- } else {
- _xifexpression_2 = "";
- }
- String refp_1 = _xifexpression_2;
- _builder.newLineIfNotEmpty();
- String _xifexpression_3 = null;
- if (hasData) {
- String _operator_plus = StringExtensions.operator_plus(", ", typeName_1);
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, refp_1);
- String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, " data");
- _xifexpression_3 = _operator_plus_2;
- } else {
- _xifexpression_3 = "";
- }
- String data = _xifexpression_3;
- _builder.newLineIfNotEmpty();
- String _portClassName_3 = this.roomExt.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.roomExt.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 StringConcatenation genDataDrivenPortSources(final ProtocolClass pc) {
- StringConcatenation _xblockexpression = null;
- {
- List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
- final Function1<Message,Boolean> _function = new Function1<Message,Boolean>() {
- public Boolean apply(final Message m) {
- VarDecl _data = m.getData();
- boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_data, null);
- return ((Boolean)_operator_notEquals);
- }
- };
- Iterable<Message> _filter = IterableExtensions.<Message>filter(_allIncomingMessages, _function);
- Iterable<Message> messages = _filter;
- 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);
- String typeName = _typeName;
- _builder.newLineIfNotEmpty();
- String _xifexpression = null;
- VarDecl _data_1 = message.getData();
- RefableType _refType_1 = _data_1.getRefType();
- DataType _type_1 = _refType_1.getType();
- boolean _operator_not = BooleanExtensions.operator_not((_type_1 instanceof PrimitiveType));
- if (_operator_not) {
- _xifexpression = "*";
- } else {
- _xifexpression = "";
- }
- String refp = _xifexpression;
- _builder.newLineIfNotEmpty();
- String _xifexpression_1 = null;
- VarDecl _data_2 = message.getData();
- RefableType _refType_2 = _data_2.getRefType();
- DataType _type_2 = _refType_2.getType();
- if ((_type_2 instanceof PrimitiveType)) {
- _xifexpression_1 = "&";
- } else {
- _xifexpression_1 = "";
- }
- String refa = _xifexpression_1;
- _builder.newLineIfNotEmpty();
- String _operator_plus = StringExtensions.operator_plus(", ", typeName);
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, refp);
- String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, " data");
- String data = _operator_plus_2;
- _builder.newLineIfNotEmpty();
- String _portClassName = this.roomExt.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.roomExt.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 StringConcatenation portClassSource(final ProtocolClass pc, final Boolean conj) {
- StringConcatenation _xblockexpression = null;
- {
- String _portClassName = this.roomExt.getPortClassName(pc, conj);
- String portClassName = _portClassName;
- String _portClassName_1 = this.roomExt.getPortClassName(pc, conj, true);
- String replPortClassName = _portClassName_1;
- List<Message> _xifexpression = null;
- if (conj) {
- List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
- _xifexpression = _allIncomingMessages;
- } else {
- List<Message> _allOutgoingMessages = this.roomExt.getAllOutgoingMessages(pc);
- _xifexpression = _allOutgoingMessages;
- }
- List<Message> messages = _xifexpression;
- String _xifexpression_1 = null;
- if (conj) {
- _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 _operator_notEquals = ObjectExtensions.operator_notEquals(_data, null);
- boolean hasData = _operator_notEquals;
- _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 _operator_and = false;
- if (!hasData) {
- _operator_and = false;
- } else {
- VarDecl _data_2 = message.getData();
- RefableType _refType_1 = _data_2.getRefType();
- boolean _isRef = _refType_1.isRef();
- _operator_and = BooleanExtensions.operator_and(hasData, _isRef);
- }
- if (_operator_and) {
- _xifexpression_3 = "*";
- } else {
- _xifexpression_3 = "";
- }
- String refp = _xifexpression_3;
- _builder.newLineIfNotEmpty();
- String _xifexpression_4 = null;
- boolean _operator_and_1 = false;
- if (!hasData) {
- _operator_and_1 = false;
- } else {
- boolean _operator_or = false;
- VarDecl _data_3 = message.getData();
- RefableType _refType_2 = _data_3.getRefType();
- DataType _type_1 = _refType_2.getType();
- boolean _operator_not = BooleanExtensions.operator_not((_type_1 instanceof PrimitiveType));
- if (_operator_not) {
- _operator_or = true;
- } else {
- VarDecl _data_4 = message.getData();
- RefableType _refType_3 = _data_4.getRefType();
- boolean _isRef_1 = _refType_3.isRef();
- _operator_or = BooleanExtensions.operator_or(_operator_not, _isRef_1);
- }
- _operator_and_1 = BooleanExtensions.operator_and(hasData, _operator_or);
- }
- if (_operator_and_1) {
- _xifexpression_4 = "*";
- } else {
- _xifexpression_4 = "";
- }
- String refpd = _xifexpression_4;
- _builder.newLineIfNotEmpty();
- String _xifexpression_5 = null;
- boolean _operator_and_2 = false;
- boolean _operator_and_3 = false;
- if (!hasData) {
- _operator_and_3 = false;
- } else {
- VarDecl _data_5 = message.getData();
- RefableType _refType_4 = _data_5.getRefType();
- DataType _type_2 = _refType_4.getType();
- boolean _operator_not_1 = BooleanExtensions.operator_not((_type_2 instanceof PrimitiveType));
- _operator_and_3 = BooleanExtensions.operator_and(hasData, _operator_not_1);
- }
- if (!_operator_and_3) {
- _operator_and_2 = false;
- } else {
- VarDecl _data_6 = message.getData();
- RefableType _refType_5 = _data_6.getRefType();
- boolean _isRef_2 = _refType_5.isRef();
- boolean _operator_not_2 = BooleanExtensions.operator_not(_isRef_2);
- _operator_and_2 = BooleanExtensions.operator_and(_operator_and_3, _operator_not_2);
- }
- if (_operator_and_2) {
- _xifexpression_5 = "";
- } else {
- _xifexpression_5 = "&";
- }
- String refa = _xifexpression_5;
- _builder.newLineIfNotEmpty();
- String _xifexpression_6 = null;
- if (hasData) {
- String _operator_plus = StringExtensions.operator_plus(", ", typeName);
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, refpd);
- String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, " data");
- _xifexpression_6 = _operator_plus_2;
- } else {
- _xifexpression_6 = "";
- }
- String data = _xifexpression_6;
- _builder.newLineIfNotEmpty();
- MessageHandler _sendHandler = this.roomExt.getSendHandler(message, conj);
- MessageHandler hdlr = _sendHandler;
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- String _name = message.getName();
- String _messageSignature = this.messageSignature(portClassName, _name, "", data);
- _builder.append(_messageSignature, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- {
- boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(hdlr, null);
- if (_operator_notEquals_1) {
- _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 _operator_plus_3 = StringExtensions.operator_plus(dir, _name_3);
- String _memberInUse = this.stdExt.memberInUse(_name_2, _operator_plus_3);
- String _operator_plus_4 = StringExtensions.operator_plus(typeName, refp);
- String _operator_plus_5 = StringExtensions.operator_plus(refa, "data");
- String _sendMessageCall = this.sendMessageCall(hasData, "self", _memberInUse, _operator_plus_4, _operator_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 _operator_notEquals_2 = ObjectExtensions.operator_notEquals(hdlr, null);
- if (_operator_notEquals_2) {
- _builder.append("\t");
- _builder.append("int i;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("for (i=0; i<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("((");
- _builder.append(portClassName, " ");
- _builder.append("*)&self->ports[i]");
- _builder.append(data, " ");
- _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<self->size; ++i) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("\t");
- String _name_7 = pc.getName();
- String _name_8 = message.getName();
- String _operator_plus_6 = StringExtensions.operator_plus(dir, _name_8);
- String _memberInUse_1 = this.stdExt.memberInUse(_name_7, _operator_plus_6);
- String _operator_plus_7 = StringExtensions.operator_plus(typeName, refp);
- String _operator_plus_8 = StringExtensions.operator_plus(refa, "data");
- String _sendMessageCall_1 = this.sendMessageCall(hasData, "(etPort*)(&self->ports[i])", _memberInUse_1, _operator_plus_7, _operator_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 _operator_plus_9 = StringExtensions.operator_plus(", int idx", data);
- String _messageSignature_2 = this.messageSignature(replPortClassName, _name_9, "", _operator_plus_9);
- _builder.append(_messageSignature_2, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- {
- boolean _operator_notEquals_3 = ObjectExtensions.operator_notEquals(hdlr, null);
- if (_operator_notEquals_3) {
- _builder.append("\t");
- _builder.append(portClassName, " ");
- _builder.append("_");
- String _name_10 = message.getName();
- _builder.append(_name_10, " ");
- _builder.append("((");
- _builder.append(portClassName, " ");
- _builder.append("*)&self->ports[idx]");
- _builder.append(data, " ");
- _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<self->size) {");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("\t");
- String _name_12 = pc.getName();
- String _name_13 = message.getName();
- String _operator_plus_10 = StringExtensions.operator_plus(dir, _name_13);
- String _memberInUse_2 = this.stdExt.memberInUse(_name_12, _operator_plus_10);
- String _operator_plus_11 = StringExtensions.operator_plus(typeName, refp);
- String _operator_plus_12 = StringExtensions.operator_plus(refa, "data");
- String _sendMessageCall_2 = this.sendMessageCall(hasData, "(etPort*)(&self->ports[idx])", _memberInUse_2, _operator_plus_11, _operator_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.roomExt.getPortClass(pc, conj);
- boolean _operator_notEquals_4 = ObjectExtensions.operator_notEquals(_portClass, null);
- if (_operator_notEquals_4) {
- PortClass _portClass_1 = this.roomExt.getPortClass(pc, conj);
- EList<PortOperation> _operations = _portClass_1.getOperations();
- StringConcatenation _operationsImplementation = this.helpers.operationsImplementation(_operations, portClassName);
- _builder.append(_operationsImplementation, "");
- _builder.newLineIfNotEmpty();
- PortClass _portClass_2 = this.roomExt.getPortClass(pc, conj);
- EList<PortOperation> _operations_1 = _portClass_2.getOperations();
- StringConcatenation _operationsImplementation_1 = this.helpers.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 self->size;");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- _builder.newLine();
- {
- boolean _handlesReceive = this.roomExt.handlesReceive(pc, conj);
- if (_handlesReceive) {
- StringConcatenation _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 _operator_plus = StringExtensions.operator_plus("etPort_sendMessage(", self);
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, ", ");
- String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, msg);
- String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, ", sizeof(");
- String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, typeName);
- String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, "), ");
- String _operator_plus_6 = StringExtensions.operator_plus(_operator_plus_5, data);
- String _operator_plus_7 = StringExtensions.operator_plus(_operator_plus_6, ");");
- _xifexpression = _operator_plus_7;
- } else {
- String _operator_plus_8 = StringExtensions.operator_plus("etPort_sendMessage(", self);
- String _operator_plus_9 = StringExtensions.operator_plus(_operator_plus_8, ", ");
- String _operator_plus_10 = StringExtensions.operator_plus(_operator_plus_9, msg);
- String _operator_plus_11 = StringExtensions.operator_plus(_operator_plus_10, ", 0, NULL);");
- _xifexpression = _operator_plus_11;
- }
- return _xifexpression;
- }
-
- private String messageSignature(final String className, final String messageName, final String methodSuffix, final String data) {
- String _operator_plus = StringExtensions.operator_plus("void ", className);
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "_");
- String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, messageName);
- String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, methodSuffix);
- String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, "(const ");
- String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, className);
- String _operator_plus_6 = StringExtensions.operator_plus(_operator_plus_5, "* self");
- String _operator_plus_7 = StringExtensions.operator_plus(_operator_plus_6, data);
- String _operator_plus_8 = StringExtensions.operator_plus(_operator_plus_7, ")");
- return _operator_plus_8;
- }
-
- private String messageSetterSignature(final String className, final String messageName, final String data) {
- String _operator_plus = StringExtensions.operator_plus("void ", className);
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "_");
- String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, messageName);
- String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, "_set(");
- String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, className);
- String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, "* self");
- String _operator_plus_6 = StringExtensions.operator_plus(_operator_plus_5, data);
- String _operator_plus_7 = StringExtensions.operator_plus(_operator_plus_6, ")");
- return _operator_plus_7;
- }
-
- private String messageGetterSignature(final String className, final String messageName, final String type) {
- String _operator_plus = StringExtensions.operator_plus(type, " ");
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, className);
- String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, "_");
- String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, messageName);
- String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, "_get(const ");
- String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, className);
- String _operator_plus_6 = StringExtensions.operator_plus(_operator_plus_5, "* const self)");
- return _operator_plus_6;
- }
-
- private StringConcatenation messageCall(final Message m) {
- StringConcatenation _builder = new StringConcatenation();
- String _name = m.getName();
- _builder.append(_name, "");
- _builder.append("(");
- {
- VarDecl _data = m.getData();
- boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_data, null);
- if (_operator_notEquals) {
- _builder.append(" ");
- VarDecl _data_1 = m.getData();
- String _name_1 = _data_1.getName();
- _builder.append(_name_1, "");
- }
- }
- _builder.append(")");
- _builder.newLineIfNotEmpty();
- return _builder;
- }
-
- private StringConcatenation genReceiveHandlers(final ProtocolClass pc, final Boolean conj) {
- StringConcatenation _xblockexpression = null;
- {
- String _portClassName = this.roomExt.getPortClassName(pc, conj);
- String portClassName = _portClassName;
- String _portClassName_1 = this.roomExt.getPortClassName(pc, conj, true);
- String replPortClassName = _portClassName_1;
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/* receiver handlers */");
- _builder.newLine();
- {
- List<MessageHandler> _receiveHandlers = this.roomExt.getReceiveHandlers(pc, conj);
- 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();
- StringConcatenation _userCode = this.helpers.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 StringConcatenation 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* ");
- String _name = pc.getName();
- _builder.append(_name, "");
- _builder.append("_messageStrings[] = {\"MIN\", ");
- {
- List<Message> _allOutgoingMessages = this.roomExt.getAllOutgoingMessages(pc);
- for(final Message m : _allOutgoingMessages) {
- _builder.append("\"");
- String _name_1 = m.getName();
- _builder.append(_name_1, "");
- _builder.append("\",");
- }
- }
- {
- List<Message> _allIncomingMessages = this.roomExt.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;
- }
-}
+package org.eclipse.etrice.generator.c.gen;
+
+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.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.base.ILogger;
+import org.eclipse.etrice.generator.c.gen.CExtensions;
+import org.eclipse.etrice.generator.etricegen.Root;
+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.xtext.generator.JavaIoFileSystemAccess;
+import org.eclipse.xtext.xbase.lib.BooleanExtensions;
+import org.eclipse.xtext.xbase.lib.Functions.Function1;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.eclipse.xtext.xbase.lib.ObjectExtensions;
+import org.eclipse.xtext.xbase.lib.StringExtensions;
+import org.eclipse.xtext.xtend2.lib.StringConcatenation;
+
+@SuppressWarnings("all")
+@Singleton
+public class ProtocolClassGen extends GenericProtocolClassGenerator {
+ @Inject
+ private JavaIoFileSystemAccess fileAccess;
+
+ @Inject
+ private CExtensions stdExt;
+
+ @Inject
+ private RoomExtensions roomExt;
+
+ @Inject
+ private ProcedureHelpers helpers;
+
+ @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.roomExt.getGenerationTargetPath(pc);
+ String _path = this.roomExt.getPath(pc);
+ String _operator_plus = StringExtensions.operator_plus(_generationTargetPath, _path);
+ String path = _operator_plus;
+ String _cHeaderFileName = this.stdExt.getCHeaderFileName(pc);
+ String _operator_plus_1 = StringExtensions.operator_plus("generating ProtocolClass header \'", _cHeaderFileName);
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, "\' in \'");
+ String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, path);
+ String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, "\'");
+ this.logger.logInfo(_operator_plus_4);
+ this.fileAccess.setOutputPath(path);
+ String _cHeaderFileName_1 = this.stdExt.getCHeaderFileName(pc);
+ StringConcatenation _generateHeaderFile = this.generateHeaderFile(root, pc);
+ this.fileAccess.generateFile(_cHeaderFileName_1, _generateHeaderFile);
+ String _cSourceFileName = this.stdExt.getCSourceFileName(pc);
+ String _operator_plus_5 = StringExtensions.operator_plus("generating ProtocolClass source \'", _cSourceFileName);
+ String _operator_plus_6 = StringExtensions.operator_plus(_operator_plus_5, "\' in \'");
+ String _operator_plus_7 = StringExtensions.operator_plus(_operator_plus_6, path);
+ String _operator_plus_8 = StringExtensions.operator_plus(_operator_plus_7, "\'");
+ this.logger.logInfo(_operator_plus_8);
+ this.fileAccess.setOutputPath(path);
+ String _cSourceFileName_1 = this.stdExt.getCSourceFileName(pc);
+ StringConcatenation _generateSourceFile = this.generateSourceFile(root, pc);
+ this.fileAccess.generateFile(_cSourceFileName_1, _generateSourceFile);
+ }
+ }
+ }
+
+ private StringConcatenation 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();
+ StringConcatenation _generateIncludeGuardBegin = this.stdExt.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();
+ DetailCode _userCode1 = pc.getUserCode1();
+ StringConcatenation _userCode = this.helpers.userCode(_userCode1);
+ _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 _operator_equals = ObjectExtensions.operator_equals(_commType, CommunicationType.EVENT_DRIVEN);
+ if (_operator_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();
+ StringConcatenation _portClassHeader = this.portClassHeader(pc, ((Boolean)false));
+ _builder.append(_portClassHeader, "");
+ _builder.newLineIfNotEmpty();
+ StringConcatenation _portClassHeader_1 = this.portClassHeader(pc, ((Boolean)true));
+ _builder.append(_portClassHeader_1, "");
+ _builder.newLineIfNotEmpty();
+ } else {
+ CommunicationType _commType_1 = pc.getCommType();
+ boolean _operator_equals_1 = ObjectExtensions.operator_equals(_commType_1, CommunicationType.DATA_DRIVEN);
+ if (_operator_equals_1) {
+ _builder.append("/*--------------------- port structs and methods */");
+ _builder.newLine();
+ StringConcatenation _genDataDrivenPortHeaders = this.genDataDrivenPortHeaders(pc);
+ _builder.append(_genDataDrivenPortHeaders, "");
+ _builder.newLineIfNotEmpty();
+ } else {
+ CommunicationType _commType_2 = pc.getCommType();
+ boolean _operator_equals_2 = ObjectExtensions.operator_equals(_commType_2, CommunicationType.SYNCHRONOUS);
+ if (_operator_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();
+ DetailCode _userCode2 = pc.getUserCode2();
+ StringConcatenation _userCode_1 = this.helpers.userCode(_userCode2);
+ _builder.append(_userCode_1, "");
+ _builder.newLineIfNotEmpty();
+ _builder.newLine();
+ String _name_4 = pc.getName();
+ StringConcatenation _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_4);
+ _builder.append(_generateIncludeGuardEnd, "");
+ _builder.newLineIfNotEmpty();
+ _builder.newLine();
+ return _builder;
+ }
+
+ private StringConcatenation 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.stdExt.getCHeaderFileName(pc);
+ _builder.append(_cHeaderFileName, "");
+ _builder.append("\"");
+ _builder.newLineIfNotEmpty();
+ _builder.append("#include \"debugging/etMSCLogger.h\"");
+ _builder.newLine();
+ _builder.newLine();
+ DetailCode _userCode3 = pc.getUserCode3();
+ StringConcatenation _userCode = this.helpers.userCode(_userCode3);
+ _builder.append(_userCode, "");
+ _builder.newLineIfNotEmpty();
+ _builder.newLine();
+ _builder.append("/*--------------------- port methods */");
+ _builder.newLine();
+ {
+ CommunicationType _commType = pc.getCommType();
+ boolean _operator_equals = ObjectExtensions.operator_equals(_commType, CommunicationType.EVENT_DRIVEN);
+ if (_operator_equals) {
+ StringConcatenation _portClassSource = this.portClassSource(pc, ((Boolean)false));
+ _builder.append(_portClassSource, "");
+ _builder.newLineIfNotEmpty();
+ StringConcatenation _portClassSource_1 = this.portClassSource(pc, ((Boolean)true));
+ _builder.append(_portClassSource_1, "");
+ _builder.newLineIfNotEmpty();
+ _builder.newLine();
+ _builder.append("/*--------------------- debug helpers */");
+ _builder.newLine();
+ StringConcatenation _generateDebugHelpersImplementation = this.generateDebugHelpersImplementation(root, pc);
+ _builder.append(_generateDebugHelpersImplementation, "");
+ _builder.newLineIfNotEmpty();
+ } else {
+ CommunicationType _commType_1 = pc.getCommType();
+ boolean _operator_equals_1 = ObjectExtensions.operator_equals(_commType_1, CommunicationType.DATA_DRIVEN);
+ if (_operator_equals_1) {
+ StringConcatenation _genDataDrivenPortSources = this.genDataDrivenPortSources(pc);
+ _builder.append(_genDataDrivenPortSources, "");
+ _builder.newLineIfNotEmpty();
+ } else {
+ CommunicationType _commType_2 = pc.getCommType();
+ boolean _operator_equals_2 = ObjectExtensions.operator_equals(_commType_2, CommunicationType.SYNCHRONOUS);
+ if (_operator_equals_2) {
+ _builder.append("#error \"synchronoue protocols not implemented yet\"");
+ _builder.newLine();
+ }
+ }
+ }
+ }
+ return _builder;
+ }
+
+ private StringConcatenation portClassHeader(final ProtocolClass pc, final Boolean conj) {
+ StringConcatenation _xblockexpression = null;
+ {
+ String _portClassName = this.roomExt.getPortClassName(pc, conj);
+ String portClassName = _portClassName;
+ String _portClassName_1 = this.roomExt.getPortClassName(pc, conj, true);
+ String replPortClassName = _portClassName_1;
+ List<Message> _xifexpression = null;
+ if (conj) {
+ List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
+ _xifexpression = _allIncomingMessages;
+ } else {
+ List<Message> _allOutgoingMessages = this.roomExt.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.roomExt.getPortClass(pc, conj);
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_portClass, null);
+ if (_operator_notEquals) {
+ {
+ PortClass _portClass_1 = this.roomExt.getPortClass(pc, conj);
+ EList<Attribute> _attributes = _portClass_1.getAttributes();
+ boolean _isEmpty = _attributes.isEmpty();
+ boolean _operator_not = BooleanExtensions.operator_not(_isEmpty);
+ if (_operator_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.roomExt.getPortClass(pc, conj);
+ EList<Attribute> _attributes_1 = _portClass_2.getAttributes();
+ StringConcatenation _attributes_2 = this.helpers.attributes(_attributes_1);
+ _builder.append(_attributes_2, " ");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("};");
+ _builder.newLine();
+ {
+ PortClass _portClass_3 = this.roomExt.getPortClass(pc, conj);
+ EList<Attribute> _attributes_3 = _portClass_3.getAttributes();
+ for(final Attribute a : _attributes_3) {
+ {
+ String _defaultValueLiteral = a.getDefaultValueLiteral();
+ boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(_defaultValueLiteral, null);
+ if (_operator_notEquals_1) {
+ _builder.append("\t\t\t\t");
+ String _operator_plus = StringExtensions.operator_plus(portClassName, " ");
+ String _name = a.getName();
+ String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, _name);
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, ": Attribute initialization not supported in C");
+ this.logger.logInfo(_operator_plus_2);
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ _builder.append("\t");
+ _builder.newLine();
+ {
+ for(final Message message : messages) {
+ VarDecl _data = message.getData();
+ boolean _operator_notEquals_2 = ObjectExtensions.operator_notEquals(_data, null);
+ boolean hasData = _operator_notEquals_2;
+ _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 _operator_and = false;
+ if (!hasData) {
+ _operator_and = false;
+ } else {
+ boolean _operator_or = false;
+ VarDecl _data_2 = message.getData();
+ RefableType _refType_1 = _data_2.getRefType();
+ DataType _type_1 = _refType_1.getType();
+ boolean _operator_not_1 = BooleanExtensions.operator_not((_type_1 instanceof PrimitiveType));
+ if (_operator_not_1) {
+ _operator_or = true;
+ } else {
+ VarDecl _data_3 = message.getData();
+ RefableType _refType_2 = _data_3.getRefType();
+ boolean _isRef = _refType_2.isRef();
+ _operator_or = BooleanExtensions.operator_or(_operator_not_1, _isRef);
+ }
+ _operator_and = BooleanExtensions.operator_and(hasData, _operator_or);
+ }
+ if (_operator_and) {
+ _xifexpression_2 = "*";
+ } else {
+ _xifexpression_2 = "";
+ }
+ String refp = _xifexpression_2;
+ _builder.newLineIfNotEmpty();
+ String _xifexpression_3 = null;
+ if (hasData) {
+ String _operator_plus_3 = StringExtensions.operator_plus(", ", typeName);
+ String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, refp);
+ String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, " data");
+ _xifexpression_3 = _operator_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 _operator_plus_6 = StringExtensions.operator_plus(", int idx", data);
+ String _messageSignature_2 = this.messageSignature(replPortClassName, _name_3, "", _operator_plus_6);
+ _builder.append(_messageSignature_2, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ _builder.append("\t");
+ _builder.newLine();
+ {
+ PortClass _portClass_4 = this.roomExt.getPortClass(pc, conj);
+ boolean _operator_notEquals_3 = ObjectExtensions.operator_notEquals(_portClass_4, null);
+ if (_operator_notEquals_3) {
+ PortClass _portClass_5 = this.roomExt.getPortClass(pc, conj);
+ EList<PortOperation> _operations = _portClass_5.getOperations();
+ StringConcatenation _operationsDeclaration = this.helpers.operationsDeclaration(_operations, portClassName);
+ _builder.append(_operationsDeclaration, "");
+ _builder.newLineIfNotEmpty();
+ PortClass _portClass_6 = this.roomExt.getPortClass(pc, conj);
+ EList<PortOperation> _operations_1 = _portClass_6.getOperations();
+ StringConcatenation _operationsDeclaration_1 = this.helpers.operationsDeclaration(_operations_1, replPortClassName);
+ _builder.append(_operationsDeclaration_1, "");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ _builder.newLine();
+ {
+ boolean _handlesReceive = this.roomExt.handlesReceive(pc, conj);
+ if (_handlesReceive) {
+ {
+ List<MessageHandler> _receiveHandlers = this.roomExt.getReceiveHandlers(pc, conj);
+ 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();
+ }
+ }
+ }
+ }
+ _xblockexpression = (_builder);
+ }
+ return _xblockexpression;
+ }
+
+ private StringConcatenation genDataDrivenPortHeaders(final ProtocolClass pc) {
+ StringConcatenation _xblockexpression = null;
+ {
+ List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
+ final Function1<Message,Boolean> _function = new Function1<Message,Boolean>() {
+ public Boolean apply(final Message m) {
+ VarDecl _data = m.getData();
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_data, null);
+ return ((Boolean)_operator_notEquals);
+ }
+ };
+ Iterable<Message> _filter = IterableExtensions.<Message>filter(_allIncomingMessages, _function);
+ Iterable<Message> sentMsgs = _filter;
+ 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);
+ String typeName = _typeName;
+ _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.roomExt.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.roomExt.getPortClassName(pc, true);
+ _builder.append(_portClassName_1, " ");
+ _builder.append("* peer;");
+ _builder.newLineIfNotEmpty();
+ _builder.append("}");
+ _builder.newLine();
+ String _portClassName_2 = this.roomExt.getPortClassName(pc, false);
+ _builder.append(_portClassName_2, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ _builder.newLine();
+ {
+ for(final Message message : sentMsgs) {
+ VarDecl _data_2 = message.getData();
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_data_2, null);
+ boolean hasData = _operator_notEquals;
+ _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_1 = this._typeHelpers.typeName(_type_1);
+ _xifexpression_1 = _typeName_1;
+ } else {
+ _xifexpression_1 = "";
+ }
+ String typeName_1 = _xifexpression_1;
+ _builder.newLineIfNotEmpty();
+ String _xifexpression_2 = null;
+ boolean _operator_and = false;
+ if (!hasData) {
+ _operator_and = false;
+ } else {
+ VarDecl _data_4 = message.getData();
+ RefableType _refType_3 = _data_4.getRefType();
+ DataType _type_2 = _refType_3.getType();
+ boolean _operator_not = BooleanExtensions.operator_not((_type_2 instanceof PrimitiveType));
+ _operator_and = BooleanExtensions.operator_and(hasData, _operator_not);
+ }
+ if (_operator_and) {
+ _xifexpression_2 = "*";
+ } else {
+ _xifexpression_2 = "";
+ }
+ String refp_1 = _xifexpression_2;
+ _builder.newLineIfNotEmpty();
+ String _xifexpression_3 = null;
+ if (hasData) {
+ String _operator_plus = StringExtensions.operator_plus(", ", typeName_1);
+ String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, refp_1);
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, " data");
+ _xifexpression_3 = _operator_plus_2;
+ } else {
+ _xifexpression_3 = "";
+ }
+ String data = _xifexpression_3;
+ _builder.newLineIfNotEmpty();
+ String _portClassName_3 = this.roomExt.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.roomExt.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 StringConcatenation genDataDrivenPortSources(final ProtocolClass pc) {
+ StringConcatenation _xblockexpression = null;
+ {
+ List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
+ final Function1<Message,Boolean> _function = new Function1<Message,Boolean>() {
+ public Boolean apply(final Message m) {
+ VarDecl _data = m.getData();
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_data, null);
+ return ((Boolean)_operator_notEquals);
+ }
+ };
+ Iterable<Message> _filter = IterableExtensions.<Message>filter(_allIncomingMessages, _function);
+ Iterable<Message> messages = _filter;
+ 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);
+ String typeName = _typeName;
+ _builder.newLineIfNotEmpty();
+ String _xifexpression = null;
+ VarDecl _data_1 = message.getData();
+ RefableType _refType_1 = _data_1.getRefType();
+ DataType _type_1 = _refType_1.getType();
+ boolean _operator_not = BooleanExtensions.operator_not((_type_1 instanceof PrimitiveType));
+ if (_operator_not) {
+ _xifexpression = "*";
+ } else {
+ _xifexpression = "";
+ }
+ String refp = _xifexpression;
+ _builder.newLineIfNotEmpty();
+ String _xifexpression_1 = null;
+ VarDecl _data_2 = message.getData();
+ RefableType _refType_2 = _data_2.getRefType();
+ DataType _type_2 = _refType_2.getType();
+ if ((_type_2 instanceof PrimitiveType)) {
+ _xifexpression_1 = "&";
+ } else {
+ _xifexpression_1 = "";
+ }
+ String refa = _xifexpression_1;
+ _builder.newLineIfNotEmpty();
+ String _operator_plus = StringExtensions.operator_plus(", ", typeName);
+ String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, refp);
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, " data");
+ String data = _operator_plus_2;
+ _builder.newLineIfNotEmpty();
+ String _portClassName = this.roomExt.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.roomExt.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 StringConcatenation portClassSource(final ProtocolClass pc, final Boolean conj) {
+ StringConcatenation _xblockexpression = null;
+ {
+ String _portClassName = this.roomExt.getPortClassName(pc, conj);
+ String portClassName = _portClassName;
+ String _portClassName_1 = this.roomExt.getPortClassName(pc, conj, true);
+ String replPortClassName = _portClassName_1;
+ List<Message> _xifexpression = null;
+ if (conj) {
+ List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
+ _xifexpression = _allIncomingMessages;
+ } else {
+ List<Message> _allOutgoingMessages = this.roomExt.getAllOutgoingMessages(pc);
+ _xifexpression = _allOutgoingMessages;
+ }
+ List<Message> messages = _xifexpression;
+ String _xifexpression_1 = null;
+ if (conj) {
+ _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 _operator_notEquals = ObjectExtensions.operator_notEquals(_data, null);
+ boolean hasData = _operator_notEquals;
+ _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 _operator_and = false;
+ if (!hasData) {
+ _operator_and = false;
+ } else {
+ VarDecl _data_2 = message.getData();
+ RefableType _refType_1 = _data_2.getRefType();
+ boolean _isRef = _refType_1.isRef();
+ _operator_and = BooleanExtensions.operator_and(hasData, _isRef);
+ }
+ if (_operator_and) {
+ _xifexpression_3 = "*";
+ } else {
+ _xifexpression_3 = "";
+ }
+ String refp = _xifexpression_3;
+ _builder.newLineIfNotEmpty();
+ String _xifexpression_4 = null;
+ boolean _operator_and_1 = false;
+ if (!hasData) {
+ _operator_and_1 = false;
+ } else {
+ boolean _operator_or = false;
+ VarDecl _data_3 = message.getData();
+ RefableType _refType_2 = _data_3.getRefType();
+ DataType _type_1 = _refType_2.getType();
+ boolean _operator_not = BooleanExtensions.operator_not((_type_1 instanceof PrimitiveType));
+ if (_operator_not) {
+ _operator_or = true;
+ } else {
+ VarDecl _data_4 = message.getData();
+ RefableType _refType_3 = _data_4.getRefType();
+ boolean _isRef_1 = _refType_3.isRef();
+ _operator_or = BooleanExtensions.operator_or(_operator_not, _isRef_1);
+ }
+ _operator_and_1 = BooleanExtensions.operator_and(hasData, _operator_or);
+ }
+ if (_operator_and_1) {
+ _xifexpression_4 = "*";
+ } else {
+ _xifexpression_4 = "";
+ }
+ String refpd = _xifexpression_4;
+ _builder.newLineIfNotEmpty();
+ String _xifexpression_5 = null;
+ boolean _operator_and_2 = false;
+ boolean _operator_and_3 = false;
+ if (!hasData) {
+ _operator_and_3 = false;
+ } else {
+ VarDecl _data_5 = message.getData();
+ RefableType _refType_4 = _data_5.getRefType();
+ DataType _type_2 = _refType_4.getType();
+ boolean _operator_not_1 = BooleanExtensions.operator_not((_type_2 instanceof PrimitiveType));
+ _operator_and_3 = BooleanExtensions.operator_and(hasData, _operator_not_1);
+ }
+ if (!_operator_and_3) {
+ _operator_and_2 = false;
+ } else {
+ VarDecl _data_6 = message.getData();
+ RefableType _refType_5 = _data_6.getRefType();
+ boolean _isRef_2 = _refType_5.isRef();
+ boolean _operator_not_2 = BooleanExtensions.operator_not(_isRef_2);
+ _operator_and_2 = BooleanExtensions.operator_and(_operator_and_3, _operator_not_2);
+ }
+ if (_operator_and_2) {
+ _xifexpression_5 = "";
+ } else {
+ _xifexpression_5 = "&";
+ }
+ String refa = _xifexpression_5;
+ _builder.newLineIfNotEmpty();
+ String _xifexpression_6 = null;
+ if (hasData) {
+ String _operator_plus = StringExtensions.operator_plus(", ", typeName);
+ String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, refpd);
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, " data");
+ _xifexpression_6 = _operator_plus_2;
+ } else {
+ _xifexpression_6 = "";
+ }
+ String data = _xifexpression_6;
+ _builder.newLineIfNotEmpty();
+ MessageHandler _sendHandler = this.roomExt.getSendHandler(message, conj);
+ MessageHandler hdlr = _sendHandler;
+ _builder.newLineIfNotEmpty();
+ _builder.newLine();
+ String _name = message.getName();
+ String _messageSignature = this.messageSignature(portClassName, _name, "", data);
+ _builder.append(_messageSignature, "");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ {
+ boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(hdlr, null);
+ if (_operator_notEquals_1) {
+ _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 _operator_plus_3 = StringExtensions.operator_plus(dir, _name_3);
+ String _memberInUse = this.stdExt.memberInUse(_name_2, _operator_plus_3);
+ String _operator_plus_4 = StringExtensions.operator_plus(typeName, refp);
+ String _operator_plus_5 = StringExtensions.operator_plus(refa, "data");
+ String _sendMessageCall = this.sendMessageCall(hasData, "self", _memberInUse, _operator_plus_4, _operator_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 _operator_notEquals_2 = ObjectExtensions.operator_notEquals(hdlr, null);
+ if (_operator_notEquals_2) {
+ _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(data, " ");
+ _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 _operator_plus_6 = StringExtensions.operator_plus(dir, _name_8);
+ String _memberInUse_1 = this.stdExt.memberInUse(_name_7, _operator_plus_6);
+ String _operator_plus_7 = StringExtensions.operator_plus(typeName, refp);
+ String _operator_plus_8 = StringExtensions.operator_plus(refa, "data");
+ String _sendMessageCall_1 = this.sendMessageCall(hasData, "((etPort*)&((etReplPort*)self)->ports[i])", _memberInUse_1, _operator_plus_7, _operator_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 _operator_plus_9 = StringExtensions.operator_plus(", int idx", data);
+ String _messageSignature_2 = this.messageSignature(replPortClassName, _name_9, "", _operator_plus_9);
+ _builder.append(_messageSignature_2, "");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ {
+ boolean _operator_notEquals_3 = ObjectExtensions.operator_notEquals(hdlr, null);
+ if (_operator_notEquals_3) {
+ _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(data, " ");
+ _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 _operator_plus_10 = StringExtensions.operator_plus(dir, _name_13);
+ String _memberInUse_2 = this.stdExt.memberInUse(_name_12, _operator_plus_10);
+ String _operator_plus_11 = StringExtensions.operator_plus(typeName, refp);
+ String _operator_plus_12 = StringExtensions.operator_plus(refa, "data");
+ String _sendMessageCall_2 = this.sendMessageCall(hasData, "((etPort*)&((etReplPort*)self)->ports[idx])", _memberInUse_2, _operator_plus_11, _operator_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.roomExt.getPortClass(pc, conj);
+ boolean _operator_notEquals_4 = ObjectExtensions.operator_notEquals(_portClass, null);
+ if (_operator_notEquals_4) {
+ PortClass _portClass_1 = this.roomExt.getPortClass(pc, conj);
+ EList<PortOperation> _operations = _portClass_1.getOperations();
+ StringConcatenation _operationsImplementation = this.helpers.operationsImplementation(_operations, portClassName);
+ _builder.append(_operationsImplementation, "");
+ _builder.newLineIfNotEmpty();
+ PortClass _portClass_2 = this.roomExt.getPortClass(pc, conj);
+ EList<PortOperation> _operations_1 = _portClass_2.getOperations();
+ StringConcatenation _operationsImplementation_1 = this.helpers.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.roomExt.handlesReceive(pc, conj);
+ if (_handlesReceive) {
+ StringConcatenation _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 _operator_plus = StringExtensions.operator_plus("etPort_sendMessage(", self);
+ String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, ", ");
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, msg);
+ String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, ", sizeof(");
+ String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, typeName);
+ String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, "), ");
+ String _operator_plus_6 = StringExtensions.operator_plus(_operator_plus_5, data);
+ String _operator_plus_7 = StringExtensions.operator_plus(_operator_plus_6, ");");
+ _xifexpression = _operator_plus_7;
+ } else {
+ String _operator_plus_8 = StringExtensions.operator_plus("etPort_sendMessage(", self);
+ String _operator_plus_9 = StringExtensions.operator_plus(_operator_plus_8, ", ");
+ String _operator_plus_10 = StringExtensions.operator_plus(_operator_plus_9, msg);
+ String _operator_plus_11 = StringExtensions.operator_plus(_operator_plus_10, ", 0, NULL);");
+ _xifexpression = _operator_plus_11;
+ }
+ return _xifexpression;
+ }
+
+ private String messageSignature(final String className, final String messageName, final String methodSuffix, final String data) {
+ String _operator_plus = StringExtensions.operator_plus("void ", className);
+ String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "_");
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, messageName);
+ String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, methodSuffix);
+ String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, "(const ");
+ String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, className);
+ String _operator_plus_6 = StringExtensions.operator_plus(_operator_plus_5, "* self");
+ String _operator_plus_7 = StringExtensions.operator_plus(_operator_plus_6, data);
+ String _operator_plus_8 = StringExtensions.operator_plus(_operator_plus_7, ")");
+ return _operator_plus_8;
+ }
+
+ private String messageSetterSignature(final String className, final String messageName, final String data) {
+ String _operator_plus = StringExtensions.operator_plus("void ", className);
+ String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "_");
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, messageName);
+ String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, "_set(");
+ String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, className);
+ String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, "* self");
+ String _operator_plus_6 = StringExtensions.operator_plus(_operator_plus_5, data);
+ String _operator_plus_7 = StringExtensions.operator_plus(_operator_plus_6, ")");
+ return _operator_plus_7;
+ }
+
+ private String messageGetterSignature(final String className, final String messageName, final String type) {
+ String _operator_plus = StringExtensions.operator_plus(type, " ");
+ String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, className);
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, "_");
+ String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, messageName);
+ String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, "_get(const ");
+ String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, className);
+ String _operator_plus_6 = StringExtensions.operator_plus(_operator_plus_5, "* const self)");
+ return _operator_plus_6;
+ }
+
+ private StringConcatenation messageCall(final Message m) {
+ StringConcatenation _builder = new StringConcatenation();
+ String _name = m.getName();
+ _builder.append(_name, "");
+ _builder.append("(");
+ {
+ VarDecl _data = m.getData();
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_data, null);
+ if (_operator_notEquals) {
+ _builder.append(" ");
+ VarDecl _data_1 = m.getData();
+ String _name_1 = _data_1.getName();
+ _builder.append(_name_1, "");
+ }
+ }
+ _builder.append(")");
+ _builder.newLineIfNotEmpty();
+ return _builder;
+ }
+
+ private StringConcatenation genReceiveHandlers(final ProtocolClass pc, final Boolean conj) {
+ StringConcatenation _xblockexpression = null;
+ {
+ String _portClassName = this.roomExt.getPortClassName(pc, conj);
+ String portClassName = _portClassName;
+ String _portClassName_1 = this.roomExt.getPortClassName(pc, conj, true);
+ String replPortClassName = _portClassName_1;
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("/* receiver handlers */");
+ _builder.newLine();
+ {
+ List<MessageHandler> _receiveHandlers = this.roomExt.getReceiveHandlers(pc, conj);
+ 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();
+ StringConcatenation _userCode = this.helpers.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 StringConcatenation 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* ");
+ String _name = pc.getName();
+ _builder.append(_name, "");
+ _builder.append("_messageStrings[] = {\"MIN\", ");
+ {
+ List<Message> _allOutgoingMessages = this.roomExt.getAllOutgoingMessages(pc);
+ for(final Message m : _allOutgoingMessages) {
+ _builder.append("\"");
+ String _name_1 = m.getName();
+ _builder.append(_name_1, "");
+ _builder.append("\",");
+ }
+ }
+ {
+ List<Message> _allIncomingMessages = this.roomExt.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/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java
index 60a0a18..ce168bb 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java
@@ -1,705 +1,705 @@
-package org.eclipse.etrice.generator.generic;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.Attribute;
-import org.eclipse.etrice.core.room.ComplexType;
-import org.eclipse.etrice.core.room.DataType;
-import org.eclipse.etrice.core.room.DetailCode;
-import org.eclipse.etrice.core.room.Operation;
-import org.eclipse.etrice.core.room.RefableType;
-import org.eclipse.etrice.core.room.StandardOperation;
-import org.eclipse.etrice.core.room.VarDecl;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.generator.base.DetailCodeTranslator;
-import org.eclipse.etrice.generator.base.ILogger;
-import org.eclipse.etrice.generator.base.ITranslationProvider;
-import org.eclipse.etrice.generator.generic.ILanguageExtension;
-import org.eclipse.etrice.generator.generic.TypeHelpers;
-import org.eclipse.xtext.xbase.lib.BooleanExtensions;
-import org.eclipse.xtext.xbase.lib.ComparableExtensions;
-import org.eclipse.xtext.xbase.lib.Conversions;
-import org.eclipse.xtext.xbase.lib.IntegerExtensions;
-import org.eclipse.xtext.xbase.lib.ObjectExtensions;
-import org.eclipse.xtext.xbase.lib.StringExtensions;
-import org.eclipse.xtext.xtend2.lib.StringConcatenation;
-
-@SuppressWarnings("all")
-@Singleton
-public class ProcedureHelpers {
- @Inject
- private ILanguageExtension languageExt;
-
- @Inject
- public ITranslationProvider translator;
-
- @Inject
- private TypeHelpers _typeHelpers;
-
- @Inject
- private ILogger logger;
-
- public StringConcatenation userCode(final DetailCode dc) {
- StringConcatenation _builder = new StringConcatenation();
- {
- boolean _operator_notEquals = ObjectExtensions.operator_notEquals(dc, null);
- if (_operator_notEquals) {
- _builder.append("/*--------------------- begin user code ---------------------*/");
- _builder.newLine();
- {
- EList<String> _commands = dc.getCommands();
- for(final String command : _commands) {
- _builder.append("\t");
- _builder.append(command, "");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("/*--------------------- end user code ---------------------*/");
- _builder.newLine();
- }
- }
- return _builder;
- }
-
- /**
- * TODO: add ref type
- */
- public StringConcatenation attributes(final List<Attribute> attribs) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/*--------------------- attributes ---------------------*/");
- _builder.newLine();
- {
- for(final Attribute attribute : attribs) {
- {
- int _size = attribute.getSize();
- boolean _operator_equals = ObjectExtensions.operator_equals(((Integer)_size), ((Integer)0));
- if (_operator_equals) {
- RefableType _refType = attribute.getRefType();
- DataType _type = _refType.getType();
- String _typeName = this._typeHelpers.typeName(_type);
- _builder.append(_typeName, "");
- {
- RefableType _refType_1 = attribute.getRefType();
- boolean _isRef = _refType_1.isRef();
- if (_isRef) {
- String _pointerLiteral = this.languageExt.pointerLiteral();
- _builder.append(_pointerLiteral, "");
- }
- }
- _builder.append(" ");
- String _name = attribute.getName();
- _builder.append(_name, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- } else {
- RefableType _refType_2 = attribute.getRefType();
- DataType _type_1 = _refType_2.getType();
- String _typeName_1 = this._typeHelpers.typeName(_type_1);
- int _size_1 = attribute.getSize();
- String _name_1 = attribute.getName();
- RefableType _refType_3 = attribute.getRefType();
- boolean _isRef_1 = _refType_3.isRef();
- String _arrayDeclaration = this.languageExt.arrayDeclaration(_typeName_1, _size_1, _name_1, _isRef_1);
- _builder.append(_arrayDeclaration, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- return _builder;
- }
-
- public String arrayInitializer(final Attribute att) {
- String _xifexpression = null;
- String _defaultValueLiteral = att.getDefaultValueLiteral();
- boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_defaultValueLiteral, null);
- if (_operator_notEquals) {
- String _defaultValueLiteral_1 = att.getDefaultValueLiteral();
- _xifexpression = _defaultValueLiteral_1;
- } else {
- RefableType _refType = att.getRefType();
- DataType _type = _refType.getType();
- String _defaultValue = this._typeHelpers.defaultValue(_type);
- _xifexpression = _defaultValue;
- }
- String dflt = _xifexpression;
- boolean _startsWith = dflt.startsWith("{");
- if (_startsWith) {
- {
- String[] _split = dflt.split(",");
- int _size = ((List<String>)Conversions.doWrapArray(_split)).size();
- int _size_1 = att.getSize();
- boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(((Integer)_size), ((Integer)_size_1));
- if (_operator_notEquals_1) {
- String _name = att.getName();
- String _operator_plus = StringExtensions.operator_plus("WARNING: array size determined by initializer differs from attribute size (", _name);
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "[");
- int _size_2 = att.getSize();
- String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, ((Integer)_size_2));
- String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, "] <-> ");
- String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, dflt);
- String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, ")");
- this.logger.logInfo(_operator_plus_5);
- }
- return dflt;
- }
- }
- String result = "{";
- int i = 0;
- int _size_3 = att.getSize();
- boolean _operator_lessThan = ComparableExtensions.<Integer>operator_lessThan(((Integer)i), ((Integer)_size_3));
- Boolean _xwhileexpression = _operator_lessThan;
- while (_xwhileexpression) {
- {
- String _operator_plus_6 = StringExtensions.operator_plus(result, dflt);
- result = _operator_plus_6;
- int _operator_plus_7 = IntegerExtensions.operator_plus(((Integer)i), ((Integer)1));
- i = _operator_plus_7;
- int _size_4 = att.getSize();
- boolean _operator_lessThan_1 = ComparableExtensions.<Integer>operator_lessThan(((Integer)i), ((Integer)_size_4));
- if (_operator_lessThan_1) {
- String _operator_plus_8 = StringExtensions.operator_plus(result, ", ");
- result = _operator_plus_8;
- }
- }
- int _size_5 = att.getSize();
- boolean _operator_lessThan_2 = ComparableExtensions.<Integer>operator_lessThan(((Integer)i), ((Integer)_size_5));
- _xwhileexpression = _operator_lessThan_2;
- }
- String _operator_plus_9 = StringExtensions.operator_plus(result, "}");
- return _operator_plus_9;
- }
-
- public StringConcatenation attributeInitialization(final List<Attribute> attribs, final boolean useClassDefaultsOnly) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("// initialize attributes");
- _builder.newLine();
- {
- for(final Attribute a : attribs) {
- {
- String _defaultValueLiteral = a.getDefaultValueLiteral();
- boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_defaultValueLiteral, null);
- if (_operator_notEquals) {
- {
- int _size = a.getSize();
- boolean _operator_equals = ObjectExtensions.operator_equals(((Integer)_size), ((Integer)0));
- if (_operator_equals) {
- String _name = a.getName();
- _builder.append(_name, "");
- _builder.append(" = ");
- String _defaultValueLiteral_1 = a.getDefaultValueLiteral();
- _builder.append(_defaultValueLiteral_1, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- } else {
- String _defaultValueLiteral_2 = a.getDefaultValueLiteral();
- boolean _startsWith = _defaultValueLiteral_2.startsWith("{");
- if (_startsWith) {
- String _name_1 = a.getName();
- _builder.append(_name_1, "");
- _builder.append(" = new ");
- RefableType _refType = a.getRefType();
- DataType _type = _refType.getType();
- String _typeName = this._typeHelpers.typeName(_type);
- _builder.append(_typeName, "");
- _builder.append("[] ");
- String _defaultValueLiteral_3 = a.getDefaultValueLiteral();
- _builder.append(_defaultValueLiteral_3, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- } else {
- String _name_2 = a.getName();
- _builder.append(_name_2, "");
- _builder.append(" = new ");
- RefableType _refType_1 = a.getRefType();
- DataType _type_1 = _refType_1.getType();
- String _typeName_1 = this._typeHelpers.typeName(_type_1);
- _builder.append(_typeName_1, "");
- _builder.append("[");
- int _size_1 = a.getSize();
- _builder.append(_size_1, "");
- _builder.append("];");
- _builder.newLineIfNotEmpty();
- _builder.append("for (int i=0;i<");
- int _size_2 = a.getSize();
- _builder.append(_size_2, "");
- _builder.append(";i++){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- String _name_3 = a.getName();
- _builder.append(_name_3, " ");
- _builder.append("[i] = ");
- String _defaultValueLiteral_4 = a.getDefaultValueLiteral();
- _builder.append(_defaultValueLiteral_4, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- }
- }
- }
- } else {
- boolean _operator_or = false;
- boolean _operator_or_1 = false;
- RefableType _refType_2 = a.getRefType();
- DataType _type_2 = _refType_2.getType();
- if ((_type_2 instanceof ComplexType)) {
- _operator_or_1 = true;
- } else {
- int _size_3 = a.getSize();
- boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size_3), ((Integer)1));
- _operator_or_1 = BooleanExtensions.operator_or((_type_2 instanceof ComplexType), _operator_greaterThan);
- }
- if (_operator_or_1) {
- _operator_or = true;
- } else {
- boolean _operator_not = BooleanExtensions.operator_not(useClassDefaultsOnly);
- _operator_or = BooleanExtensions.operator_or(_operator_or_1, _operator_not);
- }
- if (_operator_or) {
- {
- int _size_4 = a.getSize();
- boolean _operator_equals_1 = ObjectExtensions.operator_equals(((Integer)_size_4), ((Integer)0));
- if (_operator_equals_1) {
- {
- RefableType _refType_3 = a.getRefType();
- boolean _isRef = _refType_3.isRef();
- if (_isRef) {
- String _name_4 = a.getName();
- _builder.append(_name_4, "");
- _builder.append(" = ");
- String _nullPointer = this.languageExt.nullPointer();
- _builder.append(_nullPointer, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- } else {
- String _name_5 = a.getName();
- _builder.append(_name_5, "");
- _builder.append(" = ");
- RefableType _refType_4 = a.getRefType();
- DataType _type_3 = _refType_4.getType();
- String _defaultValue = this._typeHelpers.defaultValue(_type_3);
- _builder.append(_defaultValue, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- } else {
- String _name_6 = a.getName();
- _builder.append(_name_6, "");
- _builder.append(" = new ");
- RefableType _refType_5 = a.getRefType();
- DataType _type_4 = _refType_5.getType();
- String _typeName_2 = this._typeHelpers.typeName(_type_4);
- _builder.append(_typeName_2, "");
- _builder.append("[");
- int _size_5 = a.getSize();
- _builder.append(_size_5, "");
- _builder.append("];");
- _builder.newLineIfNotEmpty();
- {
- boolean _operator_not_1 = BooleanExtensions.operator_not(useClassDefaultsOnly);
- if (_operator_not_1) {
- _builder.append("for (int i=0;i<");
- int _size_6 = a.getSize();
- _builder.append(_size_6, "");
- _builder.append(";i++){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- String _name_7 = a.getName();
- _builder.append(_name_7, " ");
- _builder.append("[i] = ");
- {
- RefableType _refType_6 = a.getRefType();
- boolean _isRef_1 = _refType_6.isRef();
- if (_isRef_1) {
- String _nullPointer_1 = this.languageExt.nullPointer();
- _builder.append(_nullPointer_1, " ");
- } else {
- RefableType _refType_7 = a.getRefType();
- DataType _type_5 = _refType_7.getType();
- String _defaultValue_1 = this._typeHelpers.defaultValue(_type_5);
- _builder.append(_defaultValue_1, " ");
- }
- }
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return _builder;
- }
-
- public StringConcatenation attributeSettersGettersDeclaration(final List<Attribute> attribs, final String classname) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("//--------------------- attribute setters and getters");
- _builder.newLine();
- {
- for(final Attribute attribute : attribs) {
- StringConcatenation _setterHeader = this.setterHeader(attribute, classname);
- _builder.append(_setterHeader, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- StringConcatenation _terHeader = this.getterHeader(attribute, classname);
- _builder.append(_terHeader, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- return _builder;
- }
-
- public StringConcatenation attributeSettersGettersImplementation(final List<Attribute> attribs, final String classname) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("//--------------------- attribute setters and getters");
- _builder.newLine();
- {
- for(final Attribute attribute : attribs) {
- StringConcatenation _setterHeader = this.setterHeader(attribute, classname);
- _builder.append(_setterHeader, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t ");
- String _memberAccess = this.languageExt.memberAccess();
- _builder.append(_memberAccess, " ");
- String _name = attribute.getName();
- _builder.append(_name, " ");
- _builder.append(" = ");
- String _name_1 = attribute.getName();
- _builder.append(_name_1, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- StringConcatenation _terHeader = this.getterHeader(attribute, classname);
- _builder.append(_terHeader, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("return ");
- String _memberAccess_1 = this.languageExt.memberAccess();
- _builder.append(_memberAccess_1, " ");
- String _name_2 = attribute.getName();
- _builder.append(_name_2, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- }
- }
- return _builder;
- }
-
- private StringConcatenation setterHeader(final Attribute attribute, final String classname) {
- StringConcatenation _builder = new StringConcatenation();
- String _accessLevelPublic = this.languageExt.accessLevelPublic();
- _builder.append(_accessLevelPublic, "");
- _builder.append("void set");
- String _name = attribute.getName();
- String _firstUpper = StringExtensions.toFirstUpper(_name);
- _builder.append(_firstUpper, "");
- _builder.append(" (");
- String _selfPointer = this.languageExt.selfPointer(classname, true);
- _builder.append(_selfPointer, "");
- RefableType _refType = attribute.getRefType();
- DataType _type = _refType.getType();
- String _typeName = this._typeHelpers.typeName(_type);
- _builder.append(_typeName, "");
- {
- int _size = attribute.getSize();
- boolean _operator_notEquals = ObjectExtensions.operator_notEquals(((Integer)_size), ((Integer)0));
- if (_operator_notEquals) {
- _builder.append("[]");
- }
- }
- _builder.append(" ");
- String _name_1 = attribute.getName();
- _builder.append(_name_1, "");
- _builder.append(")");
- return _builder;
- }
-
- private StringConcatenation getterHeader(final Attribute attribute, final String classname) {
- StringConcatenation _builder = new StringConcatenation();
- String _accessLevelPublic = this.languageExt.accessLevelPublic();
- _builder.append(_accessLevelPublic, "");
- RefableType _refType = attribute.getRefType();
- DataType _type = _refType.getType();
- String _typeName = this._typeHelpers.typeName(_type);
- _builder.append(_typeName, "");
- {
- int _size = attribute.getSize();
- boolean _operator_notEquals = ObjectExtensions.operator_notEquals(((Integer)_size), ((Integer)0));
- if (_operator_notEquals) {
- _builder.append("[]");
- }
- }
- _builder.append(" get");
- String _name = attribute.getName();
- String _firstUpper = StringExtensions.toFirstUpper(_name);
- _builder.append(_firstUpper, "");
- _builder.append(" (");
- String _selfPointer = this.languageExt.selfPointer(classname, false);
- _builder.append(_selfPointer, "");
- _builder.append(")");
- return _builder;
- }
-
- public StringConcatenation argList(final List<Attribute> attributes) {
- StringConcatenation _builder = new StringConcatenation();
- {
- boolean hasAnyElements = false;
- for(final Attribute a : attributes) {
- if (!hasAnyElements) {
- hasAnyElements = true;
- } else {
- _builder.appendImmediate(", ", "");
- }
- RefableType _refType = a.getRefType();
- DataType _type = _refType.getType();
- String _typeName = this._typeHelpers.typeName(_type);
- _builder.append(_typeName, "");
- {
- int _size = a.getSize();
- boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size), ((Integer)1));
- if (_operator_greaterThan) {
- _builder.append("[]");
- }
- }
- _builder.append(" ");
- String _name = a.getName();
- _builder.append(_name, "");
- }
- }
- return _builder;
- }
-
- public StringConcatenation operationsDeclaration(final List<? extends Operation> operations, final String classname) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/*--------------------- operations ---------------------*/");
- _builder.newLine();
- {
- for(final Operation operation : operations) {
- {
- boolean _operator_and = false;
- boolean _usesInheritance = this.languageExt.usesInheritance();
- if (!_usesInheritance) {
- _operator_and = false;
- } else {
- boolean _isConstructor = RoomHelpers.isConstructor(operation);
- _operator_and = BooleanExtensions.operator_and(_usesInheritance, _isConstructor);
- }
- boolean _operator_not = BooleanExtensions.operator_not(_operator_and);
- if (_operator_not) {
- StringConcatenation _operationSignature = this.operationSignature(operation, classname, true);
- _builder.append(_operationSignature, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- return _builder;
- }
-
- public StringConcatenation operationsImplementation(final List<? extends Operation> operations, final String classname) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/*--------------------- operations ---------------------*/");
- _builder.newLine();
- {
- for(final Operation operation : operations) {
- {
- boolean _operator_and = false;
- boolean _usesInheritance = this.languageExt.usesInheritance();
- if (!_usesInheritance) {
- _operator_and = false;
- } else {
- boolean _isConstructor = RoomHelpers.isConstructor(operation);
- _operator_and = BooleanExtensions.operator_and(_usesInheritance, _isConstructor);
- }
- boolean _operator_not = BooleanExtensions.operator_not(_operator_and);
- if (_operator_not) {
- StringConcatenation _operationSignature = this.operationSignature(operation, classname, false);
- _builder.append(_operationSignature, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- {
- DetailCode _detailCode = operation.getDetailCode();
- EList<String> _commands = _detailCode.getCommands();
- for(final String command : _commands) {
- _builder.append("\t");
- _builder.append(command, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("}");
- _builder.newLine();
- }
- }
- }
- }
- return _builder;
- }
-
- public StringConcatenation operationsImplementation(final ActorClass ac) {
- StringConcatenation _xblockexpression = null;
- {
- this.translator.setActorClass(ac);
- DetailCodeTranslator _detailCodeTranslator = new DetailCodeTranslator(ac, this.translator);
- DetailCodeTranslator dct = _detailCodeTranslator;
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/*--------------------- operations ---------------------*/");
- _builder.newLine();
- {
- EList<StandardOperation> _operations = ac.getOperations();
- for(final StandardOperation operation : _operations) {
- {
- boolean _operator_and = false;
- boolean _usesInheritance = this.languageExt.usesInheritance();
- if (!_usesInheritance) {
- _operator_and = false;
- } else {
- boolean _isConstructor = RoomHelpers.isConstructor(operation);
- _operator_and = BooleanExtensions.operator_and(_usesInheritance, _isConstructor);
- }
- boolean _operator_not = BooleanExtensions.operator_not(_operator_and);
- if (_operator_not) {
- String _name = ac.getName();
- StringConcatenation _operationSignature = this.operationSignature(operation, _name, false);
- _builder.append(_operationSignature, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- DetailCode _detailCode = operation.getDetailCode();
- String _translateDetailCode = dct.translateDetailCode(_detailCode);
- _builder.append(_translateDetailCode, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- }
- }
- }
- }
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- private StringConcatenation operationSignature(final Operation operation, final String classname, final boolean isDeclaration) {
- StringConcatenation _xifexpression = null;
- boolean _isConstructor = RoomHelpers.isConstructor(operation);
- if (_isConstructor) {
- String _constructorName = this.languageExt.constructorName(classname);
- String _constructorReturnType = this.languageExt.constructorReturnType();
- StringConcatenation _classOperationSignature = this.classOperationSignature(classname, _constructorName, "", _constructorReturnType, isDeclaration);
- _xifexpression = _classOperationSignature;
- } else {
- StringConcatenation _xifexpression_1 = null;
- boolean _isDestructor = RoomHelpers.isDestructor(operation);
- if (_isDestructor) {
- String _destructorName = this.languageExt.destructorName(classname);
- String _destructorReturnType = this.languageExt.destructorReturnType();
- StringConcatenation _classOperationSignature_1 = this.classOperationSignature(classname, _destructorName, "", _destructorReturnType, isDeclaration);
- _xifexpression_1 = _classOperationSignature_1;
- } else {
- String _name = operation.getName();
- EList<VarDecl> _arguments = operation.getArguments();
- StringConcatenation _BuildArgumentList = this.BuildArgumentList(_arguments);
- String _string = _BuildArgumentList.toString();
- RefableType _returntype = operation.getReturntype();
- String _dataTypeToString = this.dataTypeToString(_returntype);
- StringConcatenation _classOperationSignature_2 = this.classOperationSignature(classname, _name, _string, _dataTypeToString, isDeclaration);
- _xifexpression_1 = _classOperationSignature_2;
- }
- _xifexpression = _xifexpression_1;
- }
- return _xifexpression;
- }
-
- private String dataTypeToString(final RefableType type) {
- String _xifexpression = null;
- boolean _operator_equals = ObjectExtensions.operator_equals(type, null);
- if (_operator_equals) {
- _xifexpression = "void";
- } else {
- String _xifexpression_1 = null;
- boolean _isRef = type.isRef();
- if (_isRef) {
- DataType _type = type.getType();
- String _typeName = this._typeHelpers.typeName(_type);
- String _pointerLiteral = this.languageExt.pointerLiteral();
- String _operator_plus = StringExtensions.operator_plus(_typeName, _pointerLiteral);
- _xifexpression_1 = _operator_plus;
- } else {
- DataType _type_1 = type.getType();
- String _typeName_1 = this._typeHelpers.typeName(_type_1);
- _xifexpression_1 = _typeName_1;
- }
- _xifexpression = _xifexpression_1;
- }
- return _xifexpression;
- }
-
- /**
- * builds comma separated argument list as string from EList<VarDecl> arguments
- */
- private StringConcatenation BuildArgumentList(final EList<VarDecl> arguments) {
- StringConcatenation _builder = new StringConcatenation();
- {
- boolean hasAnyElements = false;
- for(final VarDecl argument : arguments) {
- if (!hasAnyElements) {
- hasAnyElements = true;
- } else {
- _builder.appendImmediate(", ", "");
- }
- RefableType _refType = argument.getRefType();
- DataType _type = _refType.getType();
- String _typeName = this._typeHelpers.typeName(_type);
- _builder.append(_typeName, "");
- {
- RefableType _refType_1 = argument.getRefType();
- boolean _isRef = _refType_1.isRef();
- if (_isRef) {
- String _pointerLiteral = this.languageExt.pointerLiteral();
- _builder.append(_pointerLiteral, "");
- }
- }
- _builder.append(" ");
- String _name = argument.getName();
- _builder.append(_name, "");
- }
- }
- return _builder;
- }
-
- private StringConcatenation classOperationSignature(final String classname, final String operationname, final String argumentList, final String returnType, final boolean isDeclaration) {
- StringConcatenation _builder = new StringConcatenation();
- String _accessLevelPublic = this.languageExt.accessLevelPublic();
- _builder.append(_accessLevelPublic, "");
- _builder.append(returnType, "");
- _builder.append(" ");
- String _memberInDeclaration = this.languageExt.memberInDeclaration(classname, operationname);
- _builder.append(_memberInDeclaration, "");
- _builder.append("(");
- boolean _isEmpty = argumentList.isEmpty();
- boolean _operator_not = BooleanExtensions.operator_not(_isEmpty);
- String _selfPointer = this.languageExt.selfPointer(classname, _operator_not);
- _builder.append(_selfPointer, "");
- _builder.append(argumentList, "");
- _builder.append(")");
- return _builder;
- }
-}
+package org.eclipse.etrice.generator.generic;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.Attribute;
+import org.eclipse.etrice.core.room.ComplexType;
+import org.eclipse.etrice.core.room.DataType;
+import org.eclipse.etrice.core.room.DetailCode;
+import org.eclipse.etrice.core.room.Operation;
+import org.eclipse.etrice.core.room.RefableType;
+import org.eclipse.etrice.core.room.StandardOperation;
+import org.eclipse.etrice.core.room.VarDecl;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.eclipse.etrice.generator.base.DetailCodeTranslator;
+import org.eclipse.etrice.generator.base.ILogger;
+import org.eclipse.etrice.generator.base.ITranslationProvider;
+import org.eclipse.etrice.generator.generic.ILanguageExtension;
+import org.eclipse.etrice.generator.generic.TypeHelpers;
+import org.eclipse.xtext.xbase.lib.BooleanExtensions;
+import org.eclipse.xtext.xbase.lib.ComparableExtensions;
+import org.eclipse.xtext.xbase.lib.Conversions;
+import org.eclipse.xtext.xbase.lib.IntegerExtensions;
+import org.eclipse.xtext.xbase.lib.ObjectExtensions;
+import org.eclipse.xtext.xbase.lib.StringExtensions;
+import org.eclipse.xtext.xtend2.lib.StringConcatenation;
+
+@SuppressWarnings("all")
+@Singleton
+public class ProcedureHelpers {
+ @Inject
+ private ILanguageExtension languageExt;
+
+ @Inject
+ public ITranslationProvider translator;
+
+ @Inject
+ private TypeHelpers _typeHelpers;
+
+ @Inject
+ private ILogger logger;
+
+ public StringConcatenation userCode(final DetailCode dc) {
+ StringConcatenation _builder = new StringConcatenation();
+ {
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(dc, null);
+ if (_operator_notEquals) {
+ _builder.append("/*--------------------- begin user code ---------------------*/");
+ _builder.newLine();
+ {
+ EList<String> _commands = dc.getCommands();
+ for(final String command : _commands) {
+ _builder.append("\t");
+ _builder.append(command, "");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ _builder.append("/*--------------------- end user code ---------------------*/");
+ _builder.newLine();
+ }
+ }
+ return _builder;
+ }
+
+ /**
+ * TODO: add ref type
+ */
+ public StringConcatenation attributes(final List<Attribute> attribs) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("/*--------------------- attributes ---------------------*/");
+ _builder.newLine();
+ {
+ for(final Attribute attribute : attribs) {
+ {
+ int _size = attribute.getSize();
+ boolean _operator_equals = ObjectExtensions.operator_equals(((Integer)_size), ((Integer)0));
+ if (_operator_equals) {
+ RefableType _refType = attribute.getRefType();
+ DataType _type = _refType.getType();
+ String _typeName = this._typeHelpers.typeName(_type);
+ _builder.append(_typeName, "");
+ {
+ RefableType _refType_1 = attribute.getRefType();
+ boolean _isRef = _refType_1.isRef();
+ if (_isRef) {
+ String _pointerLiteral = this.languageExt.pointerLiteral();
+ _builder.append(_pointerLiteral, "");
+ }
+ }
+ _builder.append(" ");
+ String _name = attribute.getName();
+ _builder.append(_name, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ } else {
+ RefableType _refType_2 = attribute.getRefType();
+ DataType _type_1 = _refType_2.getType();
+ String _typeName_1 = this._typeHelpers.typeName(_type_1);
+ int _size_1 = attribute.getSize();
+ String _name_1 = attribute.getName();
+ RefableType _refType_3 = attribute.getRefType();
+ boolean _isRef_1 = _refType_3.isRef();
+ String _arrayDeclaration = this.languageExt.arrayDeclaration(_typeName_1, _size_1, _name_1, _isRef_1);
+ _builder.append(_arrayDeclaration, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ }
+ }
+ return _builder;
+ }
+
+ public String arrayInitializer(final Attribute att) {
+ String _xifexpression = null;
+ String _defaultValueLiteral = att.getDefaultValueLiteral();
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_defaultValueLiteral, null);
+ if (_operator_notEquals) {
+ String _defaultValueLiteral_1 = att.getDefaultValueLiteral();
+ _xifexpression = _defaultValueLiteral_1;
+ } else {
+ RefableType _refType = att.getRefType();
+ DataType _type = _refType.getType();
+ String _defaultValue = this._typeHelpers.defaultValue(_type);
+ _xifexpression = _defaultValue;
+ }
+ String dflt = _xifexpression;
+ boolean _startsWith = dflt.startsWith("{");
+ if (_startsWith) {
+ {
+ String[] _split = dflt.split(",");
+ int _size = ((List<String>)Conversions.doWrapArray(_split)).size();
+ int _size_1 = att.getSize();
+ boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(((Integer)_size), ((Integer)_size_1));
+ if (_operator_notEquals_1) {
+ String _name = att.getName();
+ String _operator_plus = StringExtensions.operator_plus("WARNING: array size determined by initializer differs from attribute size (", _name);
+ String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "[");
+ int _size_2 = att.getSize();
+ String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, ((Integer)_size_2));
+ String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, "] <-> ");
+ String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, dflt);
+ String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, ")");
+ this.logger.logInfo(_operator_plus_5);
+ }
+ return dflt;
+ }
+ }
+ String result = "{";
+ int i = 0;
+ int _size_3 = att.getSize();
+ boolean _operator_lessThan = ComparableExtensions.<Integer>operator_lessThan(((Integer)i), ((Integer)_size_3));
+ Boolean _xwhileexpression = _operator_lessThan;
+ while (_xwhileexpression) {
+ {
+ String _operator_plus_6 = StringExtensions.operator_plus(result, dflt);
+ result = _operator_plus_6;
+ int _operator_plus_7 = IntegerExtensions.operator_plus(((Integer)i), ((Integer)1));
+ i = _operator_plus_7;
+ int _size_4 = att.getSize();
+ boolean _operator_lessThan_1 = ComparableExtensions.<Integer>operator_lessThan(((Integer)i), ((Integer)_size_4));
+ if (_operator_lessThan_1) {
+ String _operator_plus_8 = StringExtensions.operator_plus(result, ", ");
+ result = _operator_plus_8;
+ }
+ }
+ int _size_5 = att.getSize();
+ boolean _operator_lessThan_2 = ComparableExtensions.<Integer>operator_lessThan(((Integer)i), ((Integer)_size_5));
+ _xwhileexpression = _operator_lessThan_2;
+ }
+ String _operator_plus_9 = StringExtensions.operator_plus(result, "}");
+ return _operator_plus_9;
+ }
+
+ public StringConcatenation attributeInitialization(final List<Attribute> attribs, final boolean useClassDefaultsOnly) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("// initialize attributes");
+ _builder.newLine();
+ {
+ for(final Attribute a : attribs) {
+ {
+ String _defaultValueLiteral = a.getDefaultValueLiteral();
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_defaultValueLiteral, null);
+ if (_operator_notEquals) {
+ {
+ int _size = a.getSize();
+ boolean _operator_equals = ObjectExtensions.operator_equals(((Integer)_size), ((Integer)0));
+ if (_operator_equals) {
+ String _name = a.getName();
+ _builder.append(_name, "");
+ _builder.append(" = ");
+ String _defaultValueLiteral_1 = a.getDefaultValueLiteral();
+ _builder.append(_defaultValueLiteral_1, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ } else {
+ String _defaultValueLiteral_2 = a.getDefaultValueLiteral();
+ boolean _startsWith = _defaultValueLiteral_2.startsWith("{");
+ if (_startsWith) {
+ String _name_1 = a.getName();
+ _builder.append(_name_1, "");
+ _builder.append(" = new ");
+ RefableType _refType = a.getRefType();
+ DataType _type = _refType.getType();
+ String _typeName = this._typeHelpers.typeName(_type);
+ _builder.append(_typeName, "");
+ _builder.append("[] ");
+ String _defaultValueLiteral_3 = a.getDefaultValueLiteral();
+ _builder.append(_defaultValueLiteral_3, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ } else {
+ String _name_2 = a.getName();
+ _builder.append(_name_2, "");
+ _builder.append(" = new ");
+ RefableType _refType_1 = a.getRefType();
+ DataType _type_1 = _refType_1.getType();
+ String _typeName_1 = this._typeHelpers.typeName(_type_1);
+ _builder.append(_typeName_1, "");
+ _builder.append("[");
+ int _size_1 = a.getSize();
+ _builder.append(_size_1, "");
+ _builder.append("];");
+ _builder.newLineIfNotEmpty();
+ _builder.append("for (int i=0;i<");
+ int _size_2 = a.getSize();
+ _builder.append(_size_2, "");
+ _builder.append(";i++){");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ String _name_3 = a.getName();
+ _builder.append(_name_3, " ");
+ _builder.append("[i] = ");
+ String _defaultValueLiteral_4 = a.getDefaultValueLiteral();
+ _builder.append(_defaultValueLiteral_4, " ");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
+ }
+ } else {
+ boolean _operator_or = false;
+ boolean _operator_or_1 = false;
+ RefableType _refType_2 = a.getRefType();
+ DataType _type_2 = _refType_2.getType();
+ if ((_type_2 instanceof ComplexType)) {
+ _operator_or_1 = true;
+ } else {
+ int _size_3 = a.getSize();
+ boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size_3), ((Integer)1));
+ _operator_or_1 = BooleanExtensions.operator_or((_type_2 instanceof ComplexType), _operator_greaterThan);
+ }
+ if (_operator_or_1) {
+ _operator_or = true;
+ } else {
+ boolean _operator_not = BooleanExtensions.operator_not(useClassDefaultsOnly);
+ _operator_or = BooleanExtensions.operator_or(_operator_or_1, _operator_not);
+ }
+ if (_operator_or) {
+ {
+ int _size_4 = a.getSize();
+ boolean _operator_equals_1 = ObjectExtensions.operator_equals(((Integer)_size_4), ((Integer)0));
+ if (_operator_equals_1) {
+ {
+ RefableType _refType_3 = a.getRefType();
+ boolean _isRef = _refType_3.isRef();
+ if (_isRef) {
+ String _name_4 = a.getName();
+ _builder.append(_name_4, "");
+ _builder.append(" = ");
+ String _nullPointer = this.languageExt.nullPointer();
+ _builder.append(_nullPointer, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ } else {
+ String _name_5 = a.getName();
+ _builder.append(_name_5, "");
+ _builder.append(" = ");
+ RefableType _refType_4 = a.getRefType();
+ DataType _type_3 = _refType_4.getType();
+ String _defaultValue = this._typeHelpers.defaultValue(_type_3);
+ _builder.append(_defaultValue, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ } else {
+ String _name_6 = a.getName();
+ _builder.append(_name_6, "");
+ _builder.append(" = new ");
+ RefableType _refType_5 = a.getRefType();
+ DataType _type_4 = _refType_5.getType();
+ String _typeName_2 = this._typeHelpers.typeName(_type_4);
+ _builder.append(_typeName_2, "");
+ _builder.append("[");
+ int _size_5 = a.getSize();
+ _builder.append(_size_5, "");
+ _builder.append("];");
+ _builder.newLineIfNotEmpty();
+ {
+ boolean _operator_not_1 = BooleanExtensions.operator_not(useClassDefaultsOnly);
+ if (_operator_not_1) {
+ _builder.append("for (int i=0;i<");
+ int _size_6 = a.getSize();
+ _builder.append(_size_6, "");
+ _builder.append(";i++){");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ String _name_7 = a.getName();
+ _builder.append(_name_7, " ");
+ _builder.append("[i] = ");
+ {
+ RefableType _refType_6 = a.getRefType();
+ boolean _isRef_1 = _refType_6.isRef();
+ if (_isRef_1) {
+ String _nullPointer_1 = this.languageExt.nullPointer();
+ _builder.append(_nullPointer_1, " ");
+ } else {
+ RefableType _refType_7 = a.getRefType();
+ DataType _type_5 = _refType_7.getType();
+ String _defaultValue_1 = this._typeHelpers.defaultValue(_type_5);
+ _builder.append(_defaultValue_1, " ");
+ }
+ }
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return _builder;
+ }
+
+ public StringConcatenation attributeSettersGettersDeclaration(final List<Attribute> attribs, final String classname) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("//--------------------- attribute setters and getters");
+ _builder.newLine();
+ {
+ for(final Attribute attribute : attribs) {
+ StringConcatenation _setterHeader = this.setterHeader(attribute, classname);
+ _builder.append(_setterHeader, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ StringConcatenation _terHeader = this.getterHeader(attribute, classname);
+ _builder.append(_terHeader, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ return _builder;
+ }
+
+ public StringConcatenation attributeSettersGettersImplementation(final List<Attribute> attribs, final String classname) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("//--------------------- attribute setters and getters");
+ _builder.newLine();
+ {
+ for(final Attribute attribute : attribs) {
+ StringConcatenation _setterHeader = this.setterHeader(attribute, classname);
+ _builder.append(_setterHeader, "");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t ");
+ String _memberAccess = this.languageExt.memberAccess();
+ _builder.append(_memberAccess, " ");
+ String _name = attribute.getName();
+ _builder.append(_name, " ");
+ _builder.append(" = ");
+ String _name_1 = attribute.getName();
+ _builder.append(_name_1, " ");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ _builder.append("}");
+ _builder.newLine();
+ StringConcatenation _terHeader = this.getterHeader(attribute, classname);
+ _builder.append(_terHeader, "");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("return ");
+ String _memberAccess_1 = this.languageExt.memberAccess();
+ _builder.append(_memberAccess_1, " ");
+ String _name_2 = attribute.getName();
+ _builder.append(_name_2, " ");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
+ return _builder;
+ }
+
+ private StringConcatenation setterHeader(final Attribute attribute, final String classname) {
+ StringConcatenation _builder = new StringConcatenation();
+ String _accessLevelPublic = this.languageExt.accessLevelPublic();
+ _builder.append(_accessLevelPublic, "");
+ _builder.append("void set");
+ String _name = attribute.getName();
+ String _firstUpper = StringExtensions.toFirstUpper(_name);
+ _builder.append(_firstUpper, "");
+ _builder.append(" (");
+ String _selfPointer = this.languageExt.selfPointer(classname, true);
+ _builder.append(_selfPointer, "");
+ RefableType _refType = attribute.getRefType();
+ DataType _type = _refType.getType();
+ String _typeName = this._typeHelpers.typeName(_type);
+ _builder.append(_typeName, "");
+ {
+ int _size = attribute.getSize();
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(((Integer)_size), ((Integer)0));
+ if (_operator_notEquals) {
+ _builder.append("[]");
+ }
+ }
+ _builder.append(" ");
+ String _name_1 = attribute.getName();
+ _builder.append(_name_1, "");
+ _builder.append(")");
+ return _builder;
+ }
+
+ private StringConcatenation getterHeader(final Attribute attribute, final String classname) {
+ StringConcatenation _builder = new StringConcatenation();
+ String _accessLevelPublic = this.languageExt.accessLevelPublic();
+ _builder.append(_accessLevelPublic, "");
+ RefableType _refType = attribute.getRefType();
+ DataType _type = _refType.getType();
+ String _typeName = this._typeHelpers.typeName(_type);
+ _builder.append(_typeName, "");
+ {
+ int _size = attribute.getSize();
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(((Integer)_size), ((Integer)0));
+ if (_operator_notEquals) {
+ _builder.append("[]");
+ }
+ }
+ _builder.append(" get");
+ String _name = attribute.getName();
+ String _firstUpper = StringExtensions.toFirstUpper(_name);
+ _builder.append(_firstUpper, "");
+ _builder.append(" (");
+ String _selfPointer = this.languageExt.selfPointer(classname, false);
+ _builder.append(_selfPointer, "");
+ _builder.append(")");
+ return _builder;
+ }
+
+ public StringConcatenation argList(final List<Attribute> attributes) {
+ StringConcatenation _builder = new StringConcatenation();
+ {
+ boolean hasAnyElements = false;
+ for(final Attribute a : attributes) {
+ if (!hasAnyElements) {
+ hasAnyElements = true;
+ } else {
+ _builder.appendImmediate(", ", "");
+ }
+ RefableType _refType = a.getRefType();
+ DataType _type = _refType.getType();
+ String _typeName = this._typeHelpers.typeName(_type);
+ _builder.append(_typeName, "");
+ {
+ int _size = a.getSize();
+ boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size), ((Integer)1));
+ if (_operator_greaterThan) {
+ _builder.append("[]");
+ }
+ }
+ _builder.append(" ");
+ String _name = a.getName();
+ _builder.append(_name, "");
+ }
+ }
+ return _builder;
+ }
+
+ public StringConcatenation operationsDeclaration(final List<? extends Operation> operations, final String classname) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("/*--------------------- operations ---------------------*/");
+ _builder.newLine();
+ {
+ for(final Operation operation : operations) {
+ {
+ boolean _operator_and = false;
+ boolean _usesInheritance = this.languageExt.usesInheritance();
+ if (!_usesInheritance) {
+ _operator_and = false;
+ } else {
+ boolean _isConstructor = RoomHelpers.isConstructor(operation);
+ _operator_and = BooleanExtensions.operator_and(_usesInheritance, _isConstructor);
+ }
+ boolean _operator_not = BooleanExtensions.operator_not(_operator_and);
+ if (_operator_not) {
+ StringConcatenation _operationSignature = this.operationSignature(operation, classname, true);
+ _builder.append(_operationSignature, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ }
+ }
+ return _builder;
+ }
+
+ public StringConcatenation operationsImplementation(final List<? extends Operation> operations, final String classname) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("/*--------------------- operations ---------------------*/");
+ _builder.newLine();
+ {
+ for(final Operation operation : operations) {
+ {
+ boolean _operator_and = false;
+ boolean _usesInheritance = this.languageExt.usesInheritance();
+ if (!_usesInheritance) {
+ _operator_and = false;
+ } else {
+ boolean _isConstructor = RoomHelpers.isConstructor(operation);
+ _operator_and = BooleanExtensions.operator_and(_usesInheritance, _isConstructor);
+ }
+ boolean _operator_not = BooleanExtensions.operator_not(_operator_and);
+ if (_operator_not) {
+ StringConcatenation _operationSignature = this.operationSignature(operation, classname, false);
+ _builder.append(_operationSignature, "");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ {
+ DetailCode _detailCode = operation.getDetailCode();
+ EList<String> _commands = _detailCode.getCommands();
+ for(final String command : _commands) {
+ _builder.append("\t");
+ _builder.append(command, " ");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
+ }
+ }
+ return _builder;
+ }
+
+ public StringConcatenation operationsImplementation(final ActorClass ac) {
+ StringConcatenation _xblockexpression = null;
+ {
+ this.translator.setActorClass(ac);
+ DetailCodeTranslator _detailCodeTranslator = new DetailCodeTranslator(ac, this.translator);
+ DetailCodeTranslator dct = _detailCodeTranslator;
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("/*--------------------- operations ---------------------*/");
+ _builder.newLine();
+ {
+ EList<StandardOperation> _operations = ac.getOperations();
+ for(final StandardOperation operation : _operations) {
+ {
+ boolean _operator_and = false;
+ boolean _usesInheritance = this.languageExt.usesInheritance();
+ if (!_usesInheritance) {
+ _operator_and = false;
+ } else {
+ boolean _isConstructor = RoomHelpers.isConstructor(operation);
+ _operator_and = BooleanExtensions.operator_and(_usesInheritance, _isConstructor);
+ }
+ boolean _operator_not = BooleanExtensions.operator_not(_operator_and);
+ if (_operator_not) {
+ String _name = ac.getName();
+ StringConcatenation _operationSignature = this.operationSignature(operation, _name, false);
+ _builder.append(_operationSignature, "");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ DetailCode _detailCode = operation.getDetailCode();
+ String _translateDetailCode = dct.translateDetailCode(_detailCode);
+ _builder.append(_translateDetailCode, " ");
+ _builder.newLineIfNotEmpty();
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
+ }
+ }
+ _xblockexpression = (_builder);
+ }
+ return _xblockexpression;
+ }
+
+ private StringConcatenation operationSignature(final Operation operation, final String classname, final boolean isDeclaration) {
+ StringConcatenation _xifexpression = null;
+ boolean _isConstructor = RoomHelpers.isConstructor(operation);
+ if (_isConstructor) {
+ String _constructorName = this.languageExt.constructorName(classname);
+ String _constructorReturnType = this.languageExt.constructorReturnType();
+ StringConcatenation _classOperationSignature = this.classOperationSignature(classname, _constructorName, "", _constructorReturnType, isDeclaration);
+ _xifexpression = _classOperationSignature;
+ } else {
+ StringConcatenation _xifexpression_1 = null;
+ boolean _isDestructor = RoomHelpers.isDestructor(operation);
+ if (_isDestructor) {
+ String _destructorName = this.languageExt.destructorName(classname);
+ String _destructorReturnType = this.languageExt.destructorReturnType();
+ StringConcatenation _classOperationSignature_1 = this.classOperationSignature(classname, _destructorName, "", _destructorReturnType, isDeclaration);
+ _xifexpression_1 = _classOperationSignature_1;
+ } else {
+ String _name = operation.getName();
+ EList<VarDecl> _arguments = operation.getArguments();
+ StringConcatenation _BuildArgumentList = this.BuildArgumentList(_arguments);
+ String _string = _BuildArgumentList.toString();
+ RefableType _returntype = operation.getReturntype();
+ String _dataTypeToString = this.dataTypeToString(_returntype);
+ StringConcatenation _classOperationSignature_2 = this.classOperationSignature(classname, _name, _string, _dataTypeToString, isDeclaration);
+ _xifexpression_1 = _classOperationSignature_2;
+ }
+ _xifexpression = _xifexpression_1;
+ }
+ return _xifexpression;
+ }
+
+ private String dataTypeToString(final RefableType type) {
+ String _xifexpression = null;
+ boolean _operator_equals = ObjectExtensions.operator_equals(type, null);
+ if (_operator_equals) {
+ _xifexpression = "void";
+ } else {
+ String _xifexpression_1 = null;
+ boolean _isRef = type.isRef();
+ if (_isRef) {
+ DataType _type = type.getType();
+ String _typeName = this._typeHelpers.typeName(_type);
+ String _pointerLiteral = this.languageExt.pointerLiteral();
+ String _operator_plus = StringExtensions.operator_plus(_typeName, _pointerLiteral);
+ _xifexpression_1 = _operator_plus;
+ } else {
+ DataType _type_1 = type.getType();
+ String _typeName_1 = this._typeHelpers.typeName(_type_1);
+ _xifexpression_1 = _typeName_1;
+ }
+ _xifexpression = _xifexpression_1;
+ }
+ return _xifexpression;
+ }
+
+ /**
+ * builds comma separated argument list as string from EList<VarDecl> arguments
+ */
+ private StringConcatenation BuildArgumentList(final EList<VarDecl> arguments) {
+ StringConcatenation _builder = new StringConcatenation();
+ {
+ boolean hasAnyElements = false;
+ for(final VarDecl argument : arguments) {
+ if (!hasAnyElements) {
+ hasAnyElements = true;
+ } else {
+ _builder.appendImmediate(", ", "");
+ }
+ RefableType _refType = argument.getRefType();
+ DataType _type = _refType.getType();
+ String _typeName = this._typeHelpers.typeName(_type);
+ _builder.append(_typeName, "");
+ {
+ RefableType _refType_1 = argument.getRefType();
+ boolean _isRef = _refType_1.isRef();
+ if (_isRef) {
+ String _pointerLiteral = this.languageExt.pointerLiteral();
+ _builder.append(_pointerLiteral, "");
+ }
+ }
+ _builder.append(" ");
+ String _name = argument.getName();
+ _builder.append(_name, "");
+ }
+ }
+ return _builder;
+ }
+
+ private StringConcatenation classOperationSignature(final String classname, final String operationname, final String argumentList, final String returnType, final boolean isDeclaration) {
+ StringConcatenation _builder = new StringConcatenation();
+ String _accessLevelPublic = this.languageExt.accessLevelPublic();
+ _builder.append(_accessLevelPublic, "");
+ _builder.append(returnType, "");
+ _builder.append(" ");
+ String _memberInDeclaration = this.languageExt.memberInDeclaration(classname, operationname);
+ _builder.append(_memberInDeclaration, "");
+ _builder.append("(");
+ boolean _isEmpty = argumentList.isEmpty();
+ boolean _operator_not = BooleanExtensions.operator_not(_isEmpty);
+ String _selfPointer = this.languageExt.selfPointer(classname, _operator_not);
+ _builder.append(_selfPointer, "");
+ _builder.append(argumentList, "");
+ _builder.append(")");
+ return _builder;
+ }
+}