summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjung2012-05-31 10:01:18 (EDT)
committertjung2012-05-31 10:01:18 (EDT)
commit5112716c93ab686c7822293e596c9baff18aab0e (patch)
tree70b365105e0dd9d88bbcfdfe4e2853dd6caf9770
parent8bcbb35b6ac5cb478fc60e4b0d9e5d1ab78a2bd5 (diff)
downloadorg.eclipse.etrice-5112716c93ab686c7822293e596c9baff18aab0e.zip
org.eclipse.etrice-5112716c93ab686c7822293e596c9baff18aab0e.tar.gz
org.eclipse.etrice-5112716c93ab686c7822293e596c9baff18aab0e.tar.bz2
[generator.c] getReplication prototype in port header added (bug fix)
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java37
2 files changed, 30 insertions, 10 deletions
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 4313fa4..9e89a0d 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
@@ -72,7 +72,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«FOR dataClass : root.getReferencedDataClasses(pc)»
#include "«dataClass.name».h"
«ENDFOR»
-
+
«IF pc.commType==CommunicationType::EVENT_DRIVEN»
/* message IDs */
@@ -174,6 +174,7 @@ struct «portClassName»_var {
void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const etMessage* msg, void * actor, etActorReceiveMessage receiveMessageFunc);
«ENDFOR»
«ENDIF»
+etInt32 «replPortClassName»_getReplication(const «replPortClassName»* self);
'''
}
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 d77449e..ac6dbaa 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
@@ -287,14 +287,17 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
}
List<Message> messages = _xifexpression;
StringConcatenation _builder = new StringConcatenation();
+ _builder.append("\t\t");
_builder.append("typedef etPort ");
- _builder.append(portClassName, "");
+ _builder.append(portClassName, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
_builder.append("typedef etReplPort ");
- _builder.append(replPortClassName, "");
+ _builder.append(replPortClassName, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
_builder.newLine();
{
PortClass _portClass = this.roomExt.getPortClass(pc, conj);
@@ -350,14 +353,16 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
}
}
}
- _builder.append("\t");
+ _builder.append("\t\t\t");
_builder.newLine();
{
for(final Message message : messages) {
+ _builder.append("\t\t");
VarDecl _data = message.getData();
boolean _operator_notEquals_2 = ObjectExtensions.operator_notEquals(_data, null);
boolean hasData = _operator_notEquals_2;
_builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
String _xifexpression_1 = null;
if (hasData) {
VarDecl _data_1 = message.getData();
@@ -370,6 +375,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
}
String typeName = _xifexpression_1;
_builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
String _xifexpression_2 = null;
boolean _operator_and = false;
if (!hasData) {
@@ -397,6 +403,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
}
String refp = _xifexpression_2;
_builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
String _xifexpression_3 = null;
if (hasData) {
String _operator_plus_3 = StringExtensions.operator_plus(", ", typeName);
@@ -408,42 +415,48 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
}
String data = _xifexpression_3;
_builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
String _name_1 = message.getName();
String _messageSignature = this.messageSignature(portClassName, _name_1, "", data);
- _builder.append(_messageSignature, "");
+ _builder.append(_messageSignature, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
String _name_2 = message.getName();
String _messageSignature_1 = this.messageSignature(replPortClassName, _name_2, "_broadcast", data);
- _builder.append(_messageSignature_1, "");
+ _builder.append(_messageSignature_1, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
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(_messageSignature_2, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
}
}
- _builder.append("\t");
+ _builder.append("\t\t\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) {
+ _builder.append("\t\t");
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.append(_operationsDeclaration, " ");
_builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
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.append(_operationsDeclaration_1, " ");
_builder.newLineIfNotEmpty();
}
}
+ _builder.append("\t\t");
_builder.newLine();
{
boolean _handlesReceive = this.roomExt.handlesReceive(pc, conj);
@@ -465,6 +478,12 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
}
}
}
+ _builder.append("etInt32 ");
+ _builder.append(replPortClassName, "");
+ _builder.append("_getReplication(const ");
+ _builder.append(replPortClassName, "");
+ _builder.append("* self);");
+ _builder.newLineIfNotEmpty();
_xblockexpression = (_builder);
}
return _xblockexpression;