Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2019-01-12 11:29:57 +0000
committerJuergen Haug2019-01-12 11:30:29 +0000
commit8d023fb6af978b7da56d7f39376699d417279e9e (patch)
tree887f0c30577b1c260254b492becf59cde3de7ee6 /plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c
parent322931d01d3fdf0411b2756f5aad5f582eddeed0 (diff)
downloadorg.eclipse.etrice-8d023fb6af978b7da56d7f39376699d417279e9e.tar.gz
org.eclipse.etrice-8d023fb6af978b7da56d7f39376699d417279e9e.tar.xz
org.eclipse.etrice-8d023fb6af978b7da56d7f39376699d417279e9e.zip
Bug 540562 - Support var args for operations
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c')
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend26
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
index 43f124459..79502585c 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
@@ -44,6 +44,8 @@ import org.eclipse.etrice.generator.c.Main
import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.xtext.util.Pair
+import org.eclipse.etrice.core.room.VarDecl
+import org.eclipse.etrice.core.room.RefableType
@Singleton
class CExtensions implements ILanguageExtension {
@@ -393,5 +395,29 @@ class CExtensions implements ILanguageExtension {
// not possible for C: empty string
""
}
+
+ override String getTypeSignature(RefableType type) {
+ switch it : type {
+ case null: 'void'
+ case isRef: type.type.dataTypeName + pointerLiteral
+ default: type.type.dataTypeName
+ }
+ }
+
+ override String getDataTypeName(DataType it) {
+ switch it {
+ PrimitiveType: targetName
+ EnumerationType: targetType
+ ExternalType: targetName
+ default: name
+ }
+ }
+
+ override toParameterDecl(VarDecl it) {
+ switch it {
+ case varargs : '...'
+ default: refType.typeSignature + ' ' + name
+ }
+ }
}

Back to the top