Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen')
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java65
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java22
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java27
3 files changed, 89 insertions, 25 deletions
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
index 6cd31c449..b8aa05711 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
@@ -18,6 +18,7 @@ import org.eclipse.etrice.core.room.RoomClass;
import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
import org.eclipse.etrice.generator.generic.RoomExtensions;
+import org.eclipse.etrice.generator.generic.TypeHelpers;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.util.Pair;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
@@ -30,6 +31,9 @@ public class CExtensions implements ILanguageExtension {
private IDiagnostician diagnostician;
@Inject
+ private TypeHelpers typeHelpers;
+
+ @Inject
private RoomExtensions _roomExtensions;
public String getTypedDataDefinition(final Message m) {
@@ -257,25 +261,66 @@ public class CExtensions implements ILanguageExtension {
if (!_matched) {
if (Objects.equal(_switchValue,"char")) {
_matched=true;
- String _plus = ("\'" + value);
- String _plus_1 = (_plus + "\'");
- _switchResult = _plus_1;
+ String _xifexpression = null;
+ int _length = value.length();
+ boolean _equals = (_length == 1);
+ if (_equals) {
+ String _plus = ("\'" + value);
+ String _plus_1 = (_plus + "\'");
+ _xifexpression = _plus_1;
+ } else {
+ String _plus_2 = ("\"" + value);
+ String _plus_3 = (_plus_2 + "\"");
+ _xifexpression = _plus_3;
+ }
+ _switchResult = _xifexpression;
}
}
if (!_matched) {
if (Objects.equal(_switchValue,"charPtr")) {
_matched=true;
- String _plus_2 = ("\"" + value);
- String _plus_3 = (_plus_2 + "\"");
- _switchResult = _plus_3;
+ String _plus_4 = ("\"" + value);
+ String _plus_5 = (_plus_4 + "\"");
+ _switchResult = _plus_5;
}
}
if (!_matched) {
- if (Objects.equal(_switchValue,"stringPtr")) {
+ boolean _contains = value.contains(",");
+ if (_contains) {
_matched=true;
- String _plus_4 = ("\"" + value);
- String _plus_5 = (_plus_4 + "\"");
- _switchResult = _plus_5;
+ String _xblockexpression = null;
+ {
+ String _replace = value.replace("{", "");
+ String _replace_1 = _replace.replace("}", "");
+ String _trim = _replace_1.trim();
+ String[] singleValues = _trim.split(",");
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("{ ");
+ {
+ boolean _hasElements = false;
+ for(final String v : singleValues) {
+ if (!_hasElements) {
+ _hasElements = true;
+ } else {
+ _builder.appendImmediate(", ", "");
+ }
+ String _trim_1 = v.trim();
+ String _valueLiteral = this.toValueLiteral(type, _trim_1);
+ _builder.append(_valueLiteral, "");
+ }
+ }
+ _builder.append(" }");
+ String _string = _builder.toString();
+ _xblockexpression = (_string);
+ }
+ _switchResult = _xblockexpression;
+ }
+ }
+ if (!_matched) {
+ if (Objects.equal(_switchValue,"boolean")) {
+ _matched=true;
+ String _upperCase = value.toUpperCase();
+ _switchResult = _upperCase;
}
}
if (!_matched) {
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java
index 9af39c776..98fb2a4ad 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java
@@ -85,10 +85,19 @@ public class Initialization {
if (_equals) {
_or = true;
} else {
+ boolean _and = false;
RefableType _refType = a.getRefType();
- DataType _type = _refType.getType();
- boolean _isPrimitive = this._typeHelpers.isPrimitive(_type);
- _or = (_equals || _isPrimitive);
+ boolean _isRef = _refType.isRef();
+ boolean _not = (!_isRef);
+ if (!_not) {
+ _and = false;
+ } else {
+ RefableType _refType_1 = a.getRefType();
+ DataType _type = _refType_1.getType();
+ boolean _isPrimitive = this._typeHelpers.isPrimitive(_type);
+ _and = (_not && _isPrimitive);
+ }
+ _or = (_equals || _and);
}
if (_or) {
String _initAttribute = this.initAttribute(instance, path);
@@ -204,15 +213,16 @@ public class Initialization {
_and_1 = false;
} else {
boolean _isCharacterType = this._typeHelpers.isCharacterType(_primitiveType);
- _and_1 = (_greaterThan && _isCharacterType);
+ boolean _not = (!_isCharacterType);
+ _and_1 = (_greaterThan && _not);
}
if (!_and_1) {
_and = false;
} else {
String _trim = value.trim();
boolean _startsWith = _trim.startsWith("{");
- boolean _not = (!_startsWith);
- _and = (_and_1 && _not);
+ boolean _not_1 = (!_startsWith);
+ _and = (_and_1 && _not_1);
}
if (_and) {
StringConcatenation _builder = new StringConcatenation();
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java
index 83bf8f2d7..1e6792a4f 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java
@@ -776,9 +776,9 @@ public class SubSystemClassGen {
boolean _isConjugated = this.roomExt.isConjugated(pi);
PortClass _portClass = this.roomExt.getPortClass(_protocol, _isConjugated);
EList<Attribute> _attributes = _portClass==null?(EList<Attribute>)null:_portClass.getAttributes();
- boolean _isEmpty_1 = _attributes==null?false:_attributes.isEmpty();
- boolean _not = (!_isEmpty_1);
- if (_not) {
+ int _size = _attributes==null?0:_attributes.size();
+ boolean _greaterThan = (_size > 0);
+ if (_greaterThan) {
_builder.append("static ");
ProtocolClass _protocol_1 = pi.getProtocol();
boolean _isConjugated_1 = this.roomExt.isConjugated(pi);
@@ -794,17 +794,26 @@ public class SubSystemClassGen {
if (_isReplicated) {
_builder.append("[");
EList<InterfaceItemInstance> _peers = pi.getPeers();
- int _size = _peers.size();
- _builder.append(_size, "");
+ int _size_1 = _peers.size();
+ _builder.append(_size_1, "");
_builder.append("]");
}
}
_builder.append("={");
_builder.newLineIfNotEmpty();
{
+ int _xifexpression = (int) 0;
EList<InterfaceItemInstance> _peers_1 = pi.getPeers();
- int _size_1 = _peers_1.size();
- IntegerRange _upTo = new IntegerRange(1, _size_1);
+ int _size_2 = _peers_1.size();
+ boolean _equals = (_size_2 == 0);
+ if (_equals) {
+ _xifexpression = 1;
+ } else {
+ EList<InterfaceItemInstance> _peers_2 = pi.getPeers();
+ int _size_3 = _peers_2.size();
+ _xifexpression = _size_3;
+ }
+ IntegerRange _upTo = new IntegerRange(1, _xifexpression);
boolean _hasElements = false;
for(final Integer i : _upTo) {
if (!_hasElements) {
@@ -845,8 +854,8 @@ public class SubSystemClassGen {
_builder.newLineIfNotEmpty();
{
EList<InterfaceItemInstance> _orderedIfItemInstances_2 = ai_2.getOrderedIfItemInstances();
- boolean _isEmpty_2 = _orderedIfItemInstances_2.isEmpty();
- if (_isEmpty_2) {
+ boolean _isEmpty_1 = _orderedIfItemInstances_2.isEmpty();
+ if (_isEmpty_1) {
_builder.append("/* no ports/saps/services - nothing to initialize statically */");
_builder.newLine();
} else {

Back to the top