diff options
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java')
-rw-r--r-- | plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java | 406 |
1 files changed, 203 insertions, 203 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 98bee5eaf..b8917e980 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 @@ -1,203 +1,203 @@ -package org.eclipse.etrice.generator.c.gen;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import java.util.List;
-import org.eclipse.etrice.core.room.Message;
-import org.eclipse.etrice.core.room.RoomClass;
-import org.eclipse.etrice.generator.etricegen.ExpandedActorClass;
-import org.eclipse.etrice.generator.etricegen.TransitionChain;
-import org.eclipse.etrice.generator.generic.ILanguageExtension;
-import org.eclipse.etrice.generator.generic.LanguageGenerator;
-import org.eclipse.xtext.util.Pair;
-import org.eclipse.xtext.xbase.lib.StringExtensions;
-import org.eclipse.xtext.xtend2.lib.StringConcatenation;
-
-@SuppressWarnings("all")
-@Singleton
-public class CExtensions implements ILanguageExtension {
- @Inject
- private LanguageGenerator languageGen;
-
- public String getTypedDataDefinition(final Message m) {
- String _typedData = this.languageGen.getTypedData(m);
- return _typedData;
- }
-
- public String accessLevelPrivate() {
- return "static ";
- }
-
- public String accessLevelProtected() {
- return "static ";
- }
-
- public String accessLevelPublic() {
- return "";
- }
-
- public String memberAccess() {
- return "self->";
- }
-
- public String selfPointer(final String classname, final boolean hasArgs) {
- String _xifexpression = null;
- if (hasArgs) {
- _xifexpression = "* self, ";
- } else {
- _xifexpression = "* self";
- }
- String _operator_plus = StringExtensions.operator_plus(classname, _xifexpression);
- return _operator_plus;
- }
-
- public String selfPointer(final boolean hasArgs) {
- String _xifexpression = null;
- if (hasArgs) {
- _xifexpression = "self, ";
- } else {
- _xifexpression = "self";
- }
- return _xifexpression;
- }
-
- public String operationScope(final String classname, final boolean isDeclaration) {
- String _operator_plus = StringExtensions.operator_plus(classname, "_");
- return _operator_plus;
- }
-
- public String memberInDeclaration(final String namespace, final String member) {
- String _operator_plus = StringExtensions.operator_plus(namespace, "_");
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, member);
- return _operator_plus_1;
- }
-
- public String memberInUse(final String namespace, final String member) {
- String _operator_plus = StringExtensions.operator_plus(namespace, "_");
- String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, member);
- return _operator_plus_1;
- }
-
- /**
- * TODO: move specific code elsewhere
- */
- public String getCHeaderFileName(final RoomClass rc) {
- String _name = rc.getName();
- String _operator_plus = StringExtensions.operator_plus(_name, ".h");
- return _operator_plus;
- }
-
- public String getCSourceFileName(final RoomClass rc) {
- String _name = rc.getName();
- String _operator_plus = StringExtensions.operator_plus(_name, ".c");
- return _operator_plus;
- }
-
- public String getInstSourceFileName(final RoomClass rc) {
- String _name = rc.getName();
- String _operator_plus = StringExtensions.operator_plus(_name, "_Inst.h");
- return _operator_plus;
- }
-
- public String getDispSourceFileName(final RoomClass rc) {
- String _name = rc.getName();
- String _operator_plus = StringExtensions.operator_plus(_name, "_Disp.h");
- return _operator_plus;
- }
-
- public StringConcatenation getIncludeGuardString(final String filename) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("_");
- String _upperCase = filename.toUpperCase();
- _builder.append(_upperCase, "");
- _builder.append("_H_");
- return _builder;
- }
-
- public StringConcatenation generateIncludeGuardBegin(final String filename) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("#ifndef ");
- StringConcatenation _includeGuardString = this.getIncludeGuardString(filename);
- _builder.append(_includeGuardString, "");
- _builder.newLineIfNotEmpty();
- _builder.append("#define ");
- StringConcatenation _includeGuardString_1 = this.getIncludeGuardString(filename);
- _builder.append(_includeGuardString_1, "");
- _builder.newLineIfNotEmpty();
- return _builder;
- }
-
- public StringConcatenation generateIncludeGuardEnd(final String filename) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("#endif /* ");
- StringConcatenation _includeGuardString = this.getIncludeGuardString(filename);
- _builder.append(_includeGuardString, "");
- _builder.append(" */");
- _builder.newLineIfNotEmpty();
- return _builder;
- }
-
- public boolean usesInheritance() {
- return false;
- }
-
- public String genEnumeration(final String name, final List<Pair<String,String>> entries) {
- String _xblockexpression = null;
- {
- boolean _isEmpty = entries.isEmpty();
- if (_isEmpty) {
- return "/* empty enum not generated */";
- }
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("enum ");
- _builder.append(name, "");
- _builder.append(" {");
- _builder.newLineIfNotEmpty();
- {
- boolean hasAnyElements = false;
- for(final Pair<String,String> entry : entries) {
- if (!hasAnyElements) {
- hasAnyElements = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- _builder.append("\t");
- String _first = entry.getFirst();
- _builder.append(_first, " ");
- _builder.append(" = ");
- String _second = entry.getSecond();
- _builder.append(_second, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("};");
- _builder.newLine();
- String _string = _builder.toString();
- _xblockexpression = (_string);
- }
- return _xblockexpression;
- }
-
- public String booleanConstant(final boolean b) {
- String _xifexpression = null;
- if (b) {
- _xifexpression = "TRUE";
- } else {
- _xifexpression = "FALSE";
- }
- return _xifexpression;
- }
-
- public String nullPointer() {
- return "NULL";
- }
-
- public String voidPointer() {
- return "void*";
- }
-
- public String getExecuteChainCode(final ExpandedActorClass ac, final TransitionChain tc) {
- String _executeChain = this.languageGen.getExecuteChain(ac, tc);
- return _executeChain;
- }
-}
+package org.eclipse.etrice.generator.c.gen; + +import com.google.inject.Inject; +import com.google.inject.Singleton; +import java.util.List; +import org.eclipse.etrice.core.room.Message; +import org.eclipse.etrice.core.room.RoomClass; +import org.eclipse.etrice.generator.etricegen.ExpandedActorClass; +import org.eclipse.etrice.generator.etricegen.TransitionChain; +import org.eclipse.etrice.generator.generic.ILanguageExtension; +import org.eclipse.etrice.generator.generic.LanguageGenerator; +import org.eclipse.xtext.util.Pair; +import org.eclipse.xtext.xbase.lib.StringExtensions; +import org.eclipse.xtext.xtend2.lib.StringConcatenation; + +@SuppressWarnings("all") +@Singleton +public class CExtensions implements ILanguageExtension { + @Inject + private LanguageGenerator languageGen; + + public String getTypedDataDefinition(final Message m) { + String _typedData = this.languageGen.getTypedData(m); + return _typedData; + } + + public String accessLevelPrivate() { + return "static "; + } + + public String accessLevelProtected() { + return "static "; + } + + public String accessLevelPublic() { + return ""; + } + + public String memberAccess() { + return "self->"; + } + + public String selfPointer(final String classname, final boolean hasArgs) { + String _xifexpression = null; + if (hasArgs) { + _xifexpression = "* self, "; + } else { + _xifexpression = "* self"; + } + String _operator_plus = StringExtensions.operator_plus(classname, _xifexpression); + return _operator_plus; + } + + public String selfPointer(final boolean hasArgs) { + String _xifexpression = null; + if (hasArgs) { + _xifexpression = "self, "; + } else { + _xifexpression = "self"; + } + return _xifexpression; + } + + public String operationScope(final String classname, final boolean isDeclaration) { + String _operator_plus = StringExtensions.operator_plus(classname, "_"); + return _operator_plus; + } + + public String memberInDeclaration(final String namespace, final String member) { + String _operator_plus = StringExtensions.operator_plus(namespace, "_"); + String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, member); + return _operator_plus_1; + } + + public String memberInUse(final String namespace, final String member) { + String _operator_plus = StringExtensions.operator_plus(namespace, "_"); + String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, member); + return _operator_plus_1; + } + + /** + * TODO: move specific code elsewhere + */ + public String getCHeaderFileName(final RoomClass rc) { + String _name = rc.getName(); + String _operator_plus = StringExtensions.operator_plus(_name, ".h"); + return _operator_plus; + } + + public String getCSourceFileName(final RoomClass rc) { + String _name = rc.getName(); + String _operator_plus = StringExtensions.operator_plus(_name, ".c"); + return _operator_plus; + } + + public String getInstSourceFileName(final RoomClass rc) { + String _name = rc.getName(); + String _operator_plus = StringExtensions.operator_plus(_name, "_Inst.h"); + return _operator_plus; + } + + public String getDispSourceFileName(final RoomClass rc) { + String _name = rc.getName(); + String _operator_plus = StringExtensions.operator_plus(_name, "_Disp.h"); + return _operator_plus; + } + + public StringConcatenation getIncludeGuardString(final String filename) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("_"); + String _upperCase = filename.toUpperCase(); + _builder.append(_upperCase, ""); + _builder.append("_H_"); + return _builder; + } + + public StringConcatenation generateIncludeGuardBegin(final String filename) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("#ifndef "); + StringConcatenation _includeGuardString = this.getIncludeGuardString(filename); + _builder.append(_includeGuardString, ""); + _builder.newLineIfNotEmpty(); + _builder.append("#define "); + StringConcatenation _includeGuardString_1 = this.getIncludeGuardString(filename); + _builder.append(_includeGuardString_1, ""); + _builder.newLineIfNotEmpty(); + return _builder; + } + + public StringConcatenation generateIncludeGuardEnd(final String filename) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("#endif /* "); + StringConcatenation _includeGuardString = this.getIncludeGuardString(filename); + _builder.append(_includeGuardString, ""); + _builder.append(" */"); + _builder.newLineIfNotEmpty(); + return _builder; + } + + public boolean usesInheritance() { + return false; + } + + public String genEnumeration(final String name, final List<Pair<String,String>> entries) { + String _xblockexpression = null; + { + boolean _isEmpty = entries.isEmpty(); + if (_isEmpty) { + return "/* empty enum not generated */"; + } + StringConcatenation _builder = new StringConcatenation(); + _builder.append("enum "); + _builder.append(name, ""); + _builder.append(" {"); + _builder.newLineIfNotEmpty(); + { + boolean hasAnyElements = false; + for(final Pair<String,String> entry : entries) { + if (!hasAnyElements) { + hasAnyElements = true; + } else { + _builder.appendImmediate(",", " "); + } + _builder.append("\t"); + String _first = entry.getFirst(); + _builder.append(_first, " "); + _builder.append(" = "); + String _second = entry.getSecond(); + _builder.append(_second, " "); + _builder.newLineIfNotEmpty(); + } + } + _builder.append("};"); + _builder.newLine(); + String _string = _builder.toString(); + _xblockexpression = (_string); + } + return _xblockexpression; + } + + public String booleanConstant(final boolean b) { + String _xifexpression = null; + if (b) { + _xifexpression = "TRUE"; + } else { + _xifexpression = "FALSE"; + } + return _xifexpression; + } + + public String nullPointer() { + return "NULL"; + } + + public String voidPointer() { + return "void*"; + } + + public String getExecuteChainCode(final ExpandedActorClass ac, final TransitionChain tc) { + String _executeChain = this.languageGen.getExecuteChain(ac, tc); + return _executeChain; + } +} |