From 2b3ac6e99310df76f704e7231748bcc236e708a6 Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Thu, 31 Aug 2017 16:47:34 +0200 Subject: Bug 521698 - Tycho build maven tycho build for plugins, plugin tests, features, update site Change-Id: Ic16d1fee6913a4b31c69c2d865b62931a421abfe --- .gitignore | 1 + .mvn/extensions.xml | 8 + .../build.properties | 1 - .../org.eclipse.etrice.feature/build.properties | 1 - .../build.properties | 7 +- .../org.eclipse.etrice.tests.feature/feature.xml | 27 +- features/pom.xml | 16 + plugins/org.eclipse.etrice.core.common/pom.xml | 16 - plugins/org.eclipse.etrice.core.config/pom.xml | 16 - plugins/org.eclipse.etrice.core.etmap/pom.xml | 15 - plugins/org.eclipse.etrice.core.etphys/pom.xml | 15 - plugins/org.eclipse.etrice.core.fsm/pom.xml | 15 - .../org.eclipse.etrice.core.genmodel.fsm/pom.xml | 15 - plugins/org.eclipse.etrice.core.genmodel/pom.xml | 15 - .../build.properties | 1 - .../META-INF/MANIFEST.MF | 1 + plugins/org.eclipse.etrice.core.room/plugin.xml | 4 - plugins/org.eclipse.etrice.core.room/pom.xml | 15 - .../META-INF/MANIFEST.MF | 4 +- .../build.properties | 1 - .../org.eclipse.etrice.generator.config/pom.xml | 15 - .../build.properties | 1 - plugins/org.eclipse.etrice.generator.doc/pom.xml | 15 - plugins/org.eclipse.etrice.generator.fsm/pom.xml | 15 - .../build.properties | 1 - plugins/org.eclipse.etrice.generator.java/pom.xml | 15 - plugins/org.eclipse.etrice.generator/pom.xml | 15 - plugins/pom.xml | 16 + releng/org.eclipse.etrice.parent/pom.xml | 425 ++++++--------------- releng/org.eclipse.etrice.site/category.xml | 7 +- releng/org.eclipse.etrice.site/pom.xml | 15 + .../build.properties | 3 +- tests/org.eclipse.etrice.ui.base.tests/.classpath | 7 + tests/org.eclipse.etrice.ui.base.tests/.gitignore | 1 + tests/org.eclipse.etrice.ui.base.tests/.project | 34 ++ .../META-INF/MANIFEST.MF | 20 + tests/org.eclipse.etrice.ui.base.tests/about.html | 28 ++ .../build.properties | 4 + .../org/eclipse/etrice/tests/base/TestBase.java | 89 +++++ .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- tests/org.eclipse.etrice.ui.tests.base/.classpath | 7 - tests/org.eclipse.etrice.ui.tests.base/.gitignore | 1 - tests/org.eclipse.etrice.ui.tests.base/.project | 34 -- .../META-INF/MANIFEST.MF | 20 - tests/org.eclipse.etrice.ui.tests.base/about.html | 28 -- .../build.properties | 4 - .../org/eclipse/etrice/tests/base/TestBase.java | 89 ----- tests/pom.xml | 29 ++ 49 files changed, 403 insertions(+), 733 deletions(-) create mode 100644 .mvn/extensions.xml create mode 100644 features/pom.xml delete mode 100644 plugins/org.eclipse.etrice.core.common/pom.xml delete mode 100644 plugins/org.eclipse.etrice.core.config/pom.xml delete mode 100644 plugins/org.eclipse.etrice.core.etmap/pom.xml delete mode 100644 plugins/org.eclipse.etrice.core.etphys/pom.xml delete mode 100644 plugins/org.eclipse.etrice.core.fsm/pom.xml delete mode 100644 plugins/org.eclipse.etrice.core.genmodel.fsm/pom.xml delete mode 100644 plugins/org.eclipse.etrice.core.genmodel/pom.xml delete mode 100644 plugins/org.eclipse.etrice.core.room/pom.xml delete mode 100644 plugins/org.eclipse.etrice.generator.config/pom.xml delete mode 100644 plugins/org.eclipse.etrice.generator.doc/pom.xml delete mode 100644 plugins/org.eclipse.etrice.generator.fsm/pom.xml delete mode 100644 plugins/org.eclipse.etrice.generator.java/pom.xml delete mode 100644 plugins/org.eclipse.etrice.generator/pom.xml create mode 100644 plugins/pom.xml create mode 100644 releng/org.eclipse.etrice.site/pom.xml create mode 100644 tests/org.eclipse.etrice.ui.base.tests/.classpath create mode 100644 tests/org.eclipse.etrice.ui.base.tests/.gitignore create mode 100644 tests/org.eclipse.etrice.ui.base.tests/.project create mode 100644 tests/org.eclipse.etrice.ui.base.tests/META-INF/MANIFEST.MF create mode 100644 tests/org.eclipse.etrice.ui.base.tests/about.html create mode 100644 tests/org.eclipse.etrice.ui.base.tests/build.properties create mode 100644 tests/org.eclipse.etrice.ui.base.tests/src/org/eclipse/etrice/tests/base/TestBase.java delete mode 100644 tests/org.eclipse.etrice.ui.tests.base/.classpath delete mode 100644 tests/org.eclipse.etrice.ui.tests.base/.gitignore delete mode 100644 tests/org.eclipse.etrice.ui.tests.base/.project delete mode 100644 tests/org.eclipse.etrice.ui.tests.base/META-INF/MANIFEST.MF delete mode 100644 tests/org.eclipse.etrice.ui.tests.base/about.html delete mode 100644 tests/org.eclipse.etrice.ui.tests.base/build.properties delete mode 100644 tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java create mode 100644 tests/pom.xml diff --git a/.gitignore b/.gitignore index 6dda95abc..cb6f85480 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ gerritKeys.pub *._trace *.xtendbin language.settings.xml +target/ \ No newline at end of file diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 000000000..f62dee9d1 --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,8 @@ + + + org.eclipse.tycho.extras + tycho-pomless + 1.0.0 + + + diff --git a/features/org.eclipse.etrice.cdt-integration.feature/build.properties b/features/org.eclipse.etrice.cdt-integration.feature/build.properties index 724093182..6f1a9556b 100644 --- a/features/org.eclipse.etrice.cdt-integration.feature/build.properties +++ b/features/org.eclipse.etrice.cdt-integration.feature/build.properties @@ -5,5 +5,4 @@ bin.includes = feature.xml,\ about.properties,\ build.properties,\ feature.properties,\ - modeling32.png,\ eTrice32.png diff --git a/features/org.eclipse.etrice.feature/build.properties b/features/org.eclipse.etrice.feature/build.properties index bc3cc5571..a259f22bb 100644 --- a/features/org.eclipse.etrice.feature/build.properties +++ b/features/org.eclipse.etrice.feature/build.properties @@ -5,6 +5,5 @@ bin.includes = about.html,\ about.properties,\ feature.xml,\ feature.properties,\ - modeling32.png,\ eTrice32.png sourcePlugin = true diff --git a/features/org.eclipse.etrice.tests.feature/build.properties b/features/org.eclipse.etrice.tests.feature/build.properties index bfd6aa0c4..818b4b15e 100644 --- a/features/org.eclipse.etrice.tests.feature/build.properties +++ b/features/org.eclipse.etrice.tests.feature/build.properties @@ -1,13 +1,8 @@ # NLS_MESSAGEFORMAT_VAR -bin.includes = plugin.xml,\ - plugin.properties,\ - about.html,\ +bin.includes = about.html,\ about.ini,\ about.mappings,\ about.properties,\ - modeling32.png,\ - src/,\ - META-INF/,\ feature.xml,\ epl-v10.html,\ license.html,\ diff --git a/features/org.eclipse.etrice.tests.feature/feature.xml b/features/org.eclipse.etrice.tests.feature/feature.xml index 729dbbd88..80e0a9f0c 100644 --- a/features/org.eclipse.etrice.tests.feature/feature.xml +++ b/features/org.eclipse.etrice.tests.feature/feature.xml @@ -27,18 +27,17 @@ http://www.eclipse.org/legal/epl-v10.html + - - @@ -48,7 +47,6 @@ http://www.eclipse.org/legal/epl-v10.html - @@ -65,7 +63,14 @@ http://www.eclipse.org/legal/epl-v10.html - + + + + + + + + - - + + diff --git a/features/pom.xml b/features/pom.xml new file mode 100644 index 000000000..70f4af747 --- /dev/null +++ b/features/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + org.eclipse.etrice + org.eclipse.etrice.parent + 1.0.0-SNAPSHOT + ../releng/org.eclipse.etrice.parent + + org.eclipse.etrice + org.eclipse.etrice.features + 1.0.0-SNAPSHOT + pom + \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.common/pom.xml b/plugins/org.eclipse.etrice.core.common/pom.xml deleted file mode 100644 index f029dc758..000000000 --- a/plugins/org.eclipse.etrice.core.common/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.core.common - eclipse-plugin - - diff --git a/plugins/org.eclipse.etrice.core.config/pom.xml b/plugins/org.eclipse.etrice.core.config/pom.xml deleted file mode 100644 index 9d9923952..000000000 --- a/plugins/org.eclipse.etrice.core.config/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.core.config - eclipse-plugin - - diff --git a/plugins/org.eclipse.etrice.core.etmap/pom.xml b/plugins/org.eclipse.etrice.core.etmap/pom.xml deleted file mode 100644 index af56e61d7..000000000 --- a/plugins/org.eclipse.etrice.core.etmap/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.core.etmap - eclipse-plugin - diff --git a/plugins/org.eclipse.etrice.core.etphys/pom.xml b/plugins/org.eclipse.etrice.core.etphys/pom.xml deleted file mode 100644 index 82d2536df..000000000 --- a/plugins/org.eclipse.etrice.core.etphys/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.core.etphys - eclipse-plugin - diff --git a/plugins/org.eclipse.etrice.core.fsm/pom.xml b/plugins/org.eclipse.etrice.core.fsm/pom.xml deleted file mode 100644 index 712b74627..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.core.fsm - eclipse-plugin - diff --git a/plugins/org.eclipse.etrice.core.genmodel.fsm/pom.xml b/plugins/org.eclipse.etrice.core.genmodel.fsm/pom.xml deleted file mode 100644 index 0895761d6..000000000 --- a/plugins/org.eclipse.etrice.core.genmodel.fsm/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.core.genmodel.fsm - eclipse-plugin - diff --git a/plugins/org.eclipse.etrice.core.genmodel/pom.xml b/plugins/org.eclipse.etrice.core.genmodel/pom.xml deleted file mode 100644 index 572e2f0d0..000000000 --- a/plugins/org.eclipse.etrice.core.genmodel/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.core.genmodel - eclipse-plugin - diff --git a/plugins/org.eclipse.etrice.core.room.ui/build.properties b/plugins/org.eclipse.etrice.core.room.ui/build.properties index 437fbd8b2..2d720f777 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/build.properties +++ b/plugins/org.eclipse.etrice.core.room.ui/build.properties @@ -6,6 +6,5 @@ bin.includes = META-INF/,\ plugin.xml,\ icons/,\ templates/,\ - eTriceKeywordHoverStyle.css,\ css/ diff --git a/plugins/org.eclipse.etrice.core.room/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.core.room/META-INF/MANIFEST.MF index d5c06ad3f..d8f6d3100 100644 --- a/plugins/org.eclipse.etrice.core.room/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.core.room/META-INF/MANIFEST.MF @@ -10,6 +10,7 @@ Require-Bundle: org.eclipse.etrice.core.common;bundle-version="1.1.1", org.eclipse.xtext;bundle-version="2.6.0", org.eclipse.xtext.generator;bundle-version="2.6.0";resolution:=optional, org.eclipse.xtext.util;bundle-version="2.6.0", + org.eclipse.xtext.xbase.lib, org.apache.commons.logging;bundle-version="1.0.4";resolution:=optional, org.eclipse.emf.codegen.ecore;bundle-version="[2.6.0,3.0.0)";resolution:=optional, org.eclipse.emf.mwe.utils;bundle-version="1.0.1";resolution:=optional, diff --git a/plugins/org.eclipse.etrice.core.room/plugin.xml b/plugins/org.eclipse.etrice.core.room/plugin.xml index 7d8870dd5..ddb11311d 100644 --- a/plugins/org.eclipse.etrice.core.room/plugin.xml +++ b/plugins/org.eclipse.etrice.core.room/plugin.xml @@ -12,8 +12,4 @@ - - - - diff --git a/plugins/org.eclipse.etrice.core.room/pom.xml b/plugins/org.eclipse.etrice.core.room/pom.xml deleted file mode 100644 index 9d047ead4..000000000 --- a/plugins/org.eclipse.etrice.core.room/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.core.room - eclipse-plugin - diff --git a/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF index e6340905d..d075329b9 100644 --- a/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF @@ -12,10 +12,10 @@ Require-Bundle: org.eclipse.etrice.core.genmodel;bundle-version="1.1.1", org.eclipse.etrice.generator;bundle-version="1.1.1", org.eclipse.etrice.generator.config;bundle-version="1.1.1", org.eclipse.etrice.generator.doc;bundle-version="1.1.1", - org.eclipse.etrice.generator.gnuplot;bundle-version="1.1.1", org.eclipse.xtend.lib;bundle-version="2.6.0", org.eclipse.xtext.generator;bundle-version="2.6.0", - org.eclipse.xtext.util;bundle-version="2.6.0" + org.eclipse.xtext.util;bundle-version="2.6.0", + org.eclipse.etrice.generator.gnuplot;bundle-version="1.1.1" Import-Package: org.apache.log4j Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.eclipse.etrice.generator.c, diff --git a/plugins/org.eclipse.etrice.generator.c/build.properties b/plugins/org.eclipse.etrice.generator.c/build.properties index 56a059e42..7738abf49 100644 --- a/plugins/org.eclipse.etrice.generator.c/build.properties +++ b/plugins/org.eclipse.etrice.generator.c/build.properties @@ -3,4 +3,3 @@ source.. = src/,\ bin.includes = META-INF/,\ .,\ icons/ -jre.compilation.profile = JavaSE-1.6 diff --git a/plugins/org.eclipse.etrice.generator.config/pom.xml b/plugins/org.eclipse.etrice.generator.config/pom.xml deleted file mode 100644 index a03704eae..000000000 --- a/plugins/org.eclipse.etrice.generator.config/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.generator.config - eclipse-plugin - diff --git a/plugins/org.eclipse.etrice.generator.doc/build.properties b/plugins/org.eclipse.etrice.generator.doc/build.properties index 56a059e42..7738abf49 100644 --- a/plugins/org.eclipse.etrice.generator.doc/build.properties +++ b/plugins/org.eclipse.etrice.generator.doc/build.properties @@ -3,4 +3,3 @@ source.. = src/,\ bin.includes = META-INF/,\ .,\ icons/ -jre.compilation.profile = JavaSE-1.6 diff --git a/plugins/org.eclipse.etrice.generator.doc/pom.xml b/plugins/org.eclipse.etrice.generator.doc/pom.xml deleted file mode 100644 index 263ba6cec..000000000 --- a/plugins/org.eclipse.etrice.generator.doc/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.generator.doc - eclipse-plugin - diff --git a/plugins/org.eclipse.etrice.generator.fsm/pom.xml b/plugins/org.eclipse.etrice.generator.fsm/pom.xml deleted file mode 100644 index 94e44bdd0..000000000 --- a/plugins/org.eclipse.etrice.generator.fsm/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.generator.fsm - eclipse-plugin - diff --git a/plugins/org.eclipse.etrice.generator.java/build.properties b/plugins/org.eclipse.etrice.generator.java/build.properties index 8519769ca..ea832598c 100644 --- a/plugins/org.eclipse.etrice.generator.java/build.properties +++ b/plugins/org.eclipse.etrice.generator.java/build.properties @@ -2,4 +2,3 @@ source.. = src/,\ xtend-gen/ bin.includes = META-INF/,\ . -jre.compilation.profile = JavaSE-1.6 diff --git a/plugins/org.eclipse.etrice.generator.java/pom.xml b/plugins/org.eclipse.etrice.generator.java/pom.xml deleted file mode 100644 index a0500296e..000000000 --- a/plugins/org.eclipse.etrice.generator.java/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.generator.java - eclipse-plugin - diff --git a/plugins/org.eclipse.etrice.generator/pom.xml b/plugins/org.eclipse.etrice.generator/pom.xml deleted file mode 100644 index a18e1880b..000000000 --- a/plugins/org.eclipse.etrice.generator/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - - org.eclipse.etrice.generator - eclipse-plugin - diff --git a/plugins/pom.xml b/plugins/pom.xml new file mode 100644 index 000000000..cd18cfb23 --- /dev/null +++ b/plugins/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + org.eclipse.etrice + org.eclipse.etrice.parent + 1.0.0-SNAPSHOT + ../releng/org.eclipse.etrice.parent + + org.eclipse.etrice + org.eclipse.etrice.plugins + 1.0.0-SNAPSHOT + pom + \ No newline at end of file diff --git a/releng/org.eclipse.etrice.parent/pom.xml b/releng/org.eclipse.etrice.parent/pom.xml index 8b1646af9..da916c785 100644 --- a/releng/org.eclipse.etrice.parent/pom.xml +++ b/releng/org.eclipse.etrice.parent/pom.xml @@ -3,196 +3,111 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - - - 3.0 - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT + org.eclipse.etrice.parent + 1.0.0-SNAPSHOT pom - eTrice Java generator - - code generator from ROOM (Real-Time Object Oriented Modeling) - models to the Java target language - http://eclipse.org/etrice - 2010 - + + + ../../plugins/org.eclipse.etrice.abstractexec.behavior + ../../plugins/org.eclipse.etrice.core.common + ../../plugins/org.eclipse.etrice.core.common.ui + ../../plugins/org.eclipse.etrice.core.config + ../../plugins/org.eclipse.etrice.core.config.ui + ../../plugins/org.eclipse.etrice.core.etmap + ../../plugins/org.eclipse.etrice.core.etmap.ui + ../../plugins/org.eclipse.etrice.core.etphys + ../../plugins/org.eclipse.etrice.core.etphys.ui + ../../plugins/org.eclipse.etrice.core.fsm + ../../plugins/org.eclipse.etrice.core.fsm.ui + ../../plugins/org.eclipse.etrice.core.genmodel + ../../plugins/org.eclipse.etrice.core.genmodel.fsm + ../../plugins/org.eclipse.etrice.core.room + ../../plugins/org.eclipse.etrice.core.room.ui + ../../plugins/org.eclipse.etrice.doc + ../../plugins/org.eclipse.etrice.etunit.converter + ../../plugins/org.eclipse.etrice.expressions.ui + ../../plugins/org.eclipse.etrice.generator + ../../plugins/org.eclipse.etrice.generator.c + ../../plugins/org.eclipse.etrice.generator.config + ../../plugins/org.eclipse.etrice.generator.cpp + ../../plugins/org.eclipse.etrice.generator.doc + ../../plugins/org.eclipse.etrice.generator.fsm + ../../plugins/org.eclipse.etrice.generator.fsmtest + ../../plugins/org.eclipse.etrice.generator.fsmtest.ui + ../../plugins/org.eclipse.etrice.generator.gnuplot + ../../plugins/org.eclipse.etrice.generator.java + ../../plugins/org.eclipse.etrice.generator.launch + ../../plugins/org.eclipse.etrice.generator.launch.c + ../../plugins/org.eclipse.etrice.generator.launch.cpp + ../../plugins/org.eclipse.etrice.generator.launch.java + ../../plugins/org.eclipse.etrice.generator.ui + ../../plugins/org.eclipse.etrice.generator.ui.cdt + ../../plugins/org.eclipse.etrice.logging + ../../plugins/org.eclipse.etrice.ui.behavior + ../../plugins/org.eclipse.etrice.ui.behavior.actioneditor + ../../plugins/org.eclipse.etrice.ui.behavior.fsm + ../../plugins/org.eclipse.etrice.ui.commands + ../../plugins/org.eclipse.etrice.ui.common + ../../plugins/org.eclipse.etrice.ui.common.base + ../../plugins/org.eclipse.etrice.ui.runtime + ../../plugins/org.eclipse.etrice.ui.structure + + + ../../tests/org.eclipse.etrice.abstractexec.behavior.tests + ../../tests/org.eclipse.etrice.core.common.tests + ../../tests/org.eclipse.etrice.core.config.tests + ../../tests/org.eclipse.etrice.core.etmap.tests + ../../tests/org.eclipse.etrice.core.etphys.tests + ../../tests/org.eclipse.etrice.core.fsm.tests + ../../tests/org.eclipse.etrice.core.genmodel.tests + ../../tests/org.eclipse.etrice.core.room.tests + ../../tests/org.eclipse.etrice.etunit.converter.tests + ../../tests/org.eclipse.etrice.generator.fsmtest.tests + ../../tests/org.eclipse.etrice.generator.tests + ../../tests/org.eclipse.etrice.ui.base.tests + ../../tests/org.eclipse.etrice.ui.behavior.tests + ../../tests/org.eclipse.etrice.ui.structure.tests + + + ../../features/org.eclipse.etrice.cdt-integration.feature + ../../features/org.eclipse.etrice.feature + ../../features/org.eclipse.etrice.fsm.feature + ../../features/org.eclipse.etrice.tests.feature + + + ../../releng/org.eclipse.etrice.site + + + - Cp1252 - - ${project.version} - - 0.19.0 - ${tycho.version} - - - http://download.eclipse.org/releases/luna - - http://download.eclipse.org/tools/orbit/downloads/drops/R20130118183705/repository + 2.10.0 + 1.0.0 + + http://download.eclipse.org/releases/oxygen + http://download.eclipse.org/cbi/updates/license + http://download.eclipse.org/tools/orbit/R-builds/R20170516192513/repository - - - Protos Software GmbH - http://www.protos.de - - - - - Eclipse Public License - v 1.0 - http://www.eclipse.org/legal/epl-v10.html - - - - - Bugzilla - https://bugs.eclipse.org/bugs/enter_bug.cgi?product=eTrice - - - Hudson - https://hudson.eclipse.org/etrice/job/etrice-maven3/ - - - - http://git.eclipse.org/c/etrice/org.eclipse.etrice.git/ - http://git.eclipse.org/gitroot/etrice/org.eclipse.etrice.git - ssh://userid@git.eclipse.org/gitroot/etrice/org.eclipse.etrice.git - - - - - Thomas Schuetz - - - Henrik Rentz-Reichert - - - Thomas Jung - - - Juergen Haug - - - Eyrak Paen - - - Peter Karlitschek - - - eclipse + ${eclipse.url} p2 - ${eclipse-repo.url} - orbit + license + ${license.url} p2 - ${orbit-site} - repository.jboss.org-public - JBoss.org Maven repository - https://repository.jboss.org/nexus/content/groups/public + orbit + ${orbit.url} + p2 - - - - repo.eclipse.org.cbi-releases - https://repo.eclipse.org/content/repositories/cbi-releases/ - - - - - ../../plugins/org.eclipse.etrice.core.common - ../../plugins/org.eclipse.etrice.core.fsm - ../../plugins/org.eclipse.etrice.core.room - ../../plugins/org.eclipse.etrice.core.config - ../../plugins/org.eclipse.etrice.core.etphys - ../../plugins/org.eclipse.etrice.core.etmap - ../../plugins/org.eclipse.etrice.core.genmodel.fsm - ../../plugins/org.eclipse.etrice.core.genmodel - ../../plugins/org.eclipse.etrice.generator.fsm - ../../plugins/org.eclipse.etrice.generator - ../../plugins/org.eclipse.etrice.generator.config - ../../plugins/org.eclipse.etrice.generator.doc - ../../plugins/org.eclipse.etrice.generator.java - ../../plugins/org.eclipse.etrice.generator.java.mvn - ../../runtime/org.eclipse.etrice.modellib.java - ../../runtime/org.eclipse.etrice.runtime.java - - - - - fast - - true - - - - full - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - - generated - a - Generated: - - - ordered - X - Ordered: - - - model - X - Model: - - - parameter - X - Parameter: - - - - - - attach-javadocs - - jar - - - - - - - - - + @@ -201,148 +116,26 @@ ${tycho.version} true + - - - - maven-compiler-plugin - 3.1 - - 1.6 - 1.6 - - - - org.eclipse.tycho - target-platform-configuration - ${tycho.version} - - - org.eclipse.tycho - tycho-compiler-plugin - ${tycho.version} - - - - **/*.ecore - - - - ISO-8859-1 - - - - - org.eclipse.tycho - tycho-packaging-plugin - ${tycho.version} - - - org.eclipse.tycho.extras - tycho-buildtimestamp-jgit - ${tycho-extras.version} - - - - false - 'v'yyyyMMdd-HHmm - jgit - - - - - - org.eclipse.tycho - tycho-p2-director-plugin - ${tycho.version} - - - org.eclipse.tycho - tycho-p2-repository-plugin - ${tycho.version} - - - org.eclipse.tycho - tycho-p2-plugin - ${tycho.version} - - warn - none - - - http://download.eclipse.org/eclipse/updates/4.2 - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.eclipse.tycho - - - tycho-packaging-plugin - - - [0.19.0,) - - - validate-id - validate-version - build-qualifier - - - - - - - - - - org.eclipse.tycho - - - tycho-compiler-plugin - - - [0.19.0,) - - - compile - - - - - - - - - - - - - - - - - repo.eclipse.org - eTrice Repository - Releases - https://repo.eclipse.org/content/repositories/etrice-releases/ - - - repo.eclipse.org - eTrice Repository - Snapshots - https://repo.eclipse.org/content/repositories/etrice-snapshots/ - true - - + diff --git a/releng/org.eclipse.etrice.site/category.xml b/releng/org.eclipse.etrice.site/category.xml index 54ec264e2..b09fe076d 100644 --- a/releng/org.eclipse.etrice.site/category.xml +++ b/releng/org.eclipse.etrice.site/category.xml @@ -1,12 +1,9 @@ - + - - - - + diff --git a/releng/org.eclipse.etrice.site/pom.xml b/releng/org.eclipse.etrice.site/pom.xml new file mode 100644 index 000000000..77bcbfd22 --- /dev/null +++ b/releng/org.eclipse.etrice.site/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + org.eclipse.etrice + org.eclipse.etrice.parent + 1.0.0-SNAPSHOT + ../../releng/org.eclipse.etrice.parent/pom.xml + + org.eclipse.etrice + org.eclipse.etrice.site + 1.0.0-SNAPSHOT + eclipse-repository + diff --git a/tests/org.eclipse.etrice.core.room.tests/build.properties b/tests/org.eclipse.etrice.core.room.tests/build.properties index 774ee5239..bd036ffc6 100644 --- a/tests/org.eclipse.etrice.core.room.tests/build.properties +++ b/tests/org.eclipse.etrice.core.room.tests/build.properties @@ -1,5 +1,6 @@ source.. = src/,\ - xtend-gen/ + xtend-gen/,\ + src-gen/ output.. = bin/ bin.includes = META-INF/,\ .,\ diff --git a/tests/org.eclipse.etrice.ui.base.tests/.classpath b/tests/org.eclipse.etrice.ui.base.tests/.classpath new file mode 100644 index 000000000..1fa3e6803 --- /dev/null +++ b/tests/org.eclipse.etrice.ui.base.tests/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/org.eclipse.etrice.ui.base.tests/.gitignore b/tests/org.eclipse.etrice.ui.base.tests/.gitignore new file mode 100644 index 000000000..ba077a403 --- /dev/null +++ b/tests/org.eclipse.etrice.ui.base.tests/.gitignore @@ -0,0 +1 @@ +bin diff --git a/tests/org.eclipse.etrice.ui.base.tests/.project b/tests/org.eclipse.etrice.ui.base.tests/.project new file mode 100644 index 000000000..0d2614b47 --- /dev/null +++ b/tests/org.eclipse.etrice.ui.base.tests/.project @@ -0,0 +1,34 @@ + + + org.eclipse.etrice.ui.base.tests + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + org.eclipse.xtext.ui.shared.xtextNature + + diff --git a/tests/org.eclipse.etrice.ui.base.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.ui.base.tests/META-INF/MANIFEST.MF new file mode 100644 index 000000000..edc780d96 --- /dev/null +++ b/tests/org.eclipse.etrice.ui.base.tests/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: eTrice Diagram Test Base Classes +Bundle-SymbolicName: org.eclipse.etrice.ui.base.tests +Bundle-Version: 1.1.1.qualifier +Require-Bundle: org.junit;bundle-version="4.8.1", + org.eclipse.core.runtime, + org.eclipse.etrice.core.room;bundle-version="1.1.1", + org.eclipse.etrice.ui.structure;bundle-version="1.1.1", + org.eclipse.xtext;bundle-version="2.6.0", + org.eclipse.graphiti;bundle-version="0.8.0", + org.eclipse.etrice.ui.common.base, + com.google.guava, + org.eclipse.xtext.xbase.lib, + org.eclipse.xtend.lib, + org.eclipse.xtend.lib.macro +Bundle-Vendor: Eclipse eTrice +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Export-Package: org.eclipse.etrice.tests.base + diff --git a/tests/org.eclipse.etrice.ui.base.tests/about.html b/tests/org.eclipse.etrice.ui.base.tests/about.html new file mode 100644 index 000000000..c258ef55d --- /dev/null +++ b/tests/org.eclipse.etrice.ui.base.tests/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2006

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/tests/org.eclipse.etrice.ui.base.tests/build.properties b/tests/org.eclipse.etrice.ui.base.tests/build.properties new file mode 100644 index 000000000..34d2e4d2d --- /dev/null +++ b/tests/org.eclipse.etrice.ui.base.tests/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/tests/org.eclipse.etrice.ui.base.tests/src/org/eclipse/etrice/tests/base/TestBase.java b/tests/org.eclipse.etrice.ui.base.tests/src/org/eclipse/etrice/tests/base/TestBase.java new file mode 100644 index 000000000..73a95af74 --- /dev/null +++ b/tests/org.eclipse.etrice.ui.base.tests/src/org/eclipse/etrice/tests/base/TestBase.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2010 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.tests.base; + +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.LinkedList; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.etrice.core.room.RoomModel; +import org.eclipse.graphiti.mm.algorithms.styles.Color; +import org.eclipse.graphiti.util.IColorConstant; +import org.eclipse.xtext.resource.XtextResource; +import org.eclipse.xtext.resource.XtextResourceSet; + +public abstract class TestBase { + + private String basePath; + private LinkedList models = new LinkedList(); + + protected void loadModelFile() { + try { + URL modelsDir = getModelsDirectoy(); + URL fileURL = FileLocator.toFileURL(modelsDir); + basePath = fileURL.getFile(); + } catch (IOException e) { + e.printStackTrace(); + } + + loadModels(getModelFileName()); + } + + protected void removeDiagramsDirectory() { + File diagDir = new File(basePath+File.separator+"diagrams"); + if (diagDir.isDirectory()) { + File[] files = diagDir.listFiles(); + if (files!=null) + for (int i = 0; i < files.length; i++) { + files[i].delete(); + } + diagDir.delete(); + } + } + + private void loadModels(String modelName) { + XtextResourceSet rs = new XtextResourceSet(); + rs.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE); + String path = basePath + modelName; + URI uri = URI.createFileURI(path); + Resource resource = rs.getResource(uri, true); + Object root = resource.getContents().get(0); + if (root instanceof RoomModel) + models.add((RoomModel) root); + else + fail("File contains no RoomModel as root object"); + } + + public LinkedList getModels() { + return models; + } + + protected abstract String getModelFileName(); + protected abstract URL getModelsDirectoy(); + + protected boolean isEqual(Color c, IColorConstant cc) { + if (c.getRed()!=cc.getRed()) + return false; + if (c.getGreen()!=cc.getGreen()) + return false; + if (c.getBlue()!=cc.getBlue()) + return false; + return true; + } +} diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF index b82c1517a..1ac3fd4e5 100644 --- a/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.etrice.core.fsm;bundle-version="1.1.1", org.eclipse.etrice.ui.behavior.fsm;bundle-version="1.1.1", org.eclipse.etrice.ui.common;bundle-version="1.1.1", org.eclipse.etrice.ui.common.base;bundle-version="1.1.1", - org.eclipse.etrice.ui.tests.base;bundle-version="1.1.1", + org.eclipse.etrice.ui.base.tests;bundle-version="1.1.1", org.eclipse.ui, org.eclipse.core.runtime, org.junit;bundle-version="4.8.1", diff --git a/tests/org.eclipse.etrice.ui.structure.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.ui.structure.tests/META-INF/MANIFEST.MF index 64de37617..6ab01c2a4 100644 --- a/tests/org.eclipse.etrice.ui.structure.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.etrice.ui.structure.tests/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Require-Bundle: org.eclipse.etrice.core.fsm;bundle-version="1.1.1", org.eclipse.etrice.ui.structure;bundle-version="1.1.1", org.eclipse.etrice.ui.common;bundle-version="1.1.1", org.eclipse.etrice.ui.common.base;bundle-version="1.1.1", - org.eclipse.etrice.ui.tests.base;bundle-version="1.1.1", + org.eclipse.etrice.ui.base.tests;bundle-version="1.1.1", org.eclipse.ui, org.eclipse.core.runtime, org.junit;bundle-version="4.8.1", diff --git a/tests/org.eclipse.etrice.ui.tests.base/.classpath b/tests/org.eclipse.etrice.ui.tests.base/.classpath deleted file mode 100644 index 1fa3e6803..000000000 --- a/tests/org.eclipse.etrice.ui.tests.base/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/tests/org.eclipse.etrice.ui.tests.base/.gitignore b/tests/org.eclipse.etrice.ui.tests.base/.gitignore deleted file mode 100644 index ba077a403..000000000 --- a/tests/org.eclipse.etrice.ui.tests.base/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/tests/org.eclipse.etrice.ui.tests.base/.project b/tests/org.eclipse.etrice.ui.tests.base/.project deleted file mode 100644 index a9cfde5ad..000000000 --- a/tests/org.eclipse.etrice.ui.tests.base/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - org.eclipse.etrice.ui.tests.base - - - - - - org.eclipse.xtext.ui.shared.xtextBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.eclipse.xtext.ui.shared.xtextNature - - diff --git a/tests/org.eclipse.etrice.ui.tests.base/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.ui.tests.base/META-INF/MANIFEST.MF deleted file mode 100644 index 20e03aaaa..000000000 --- a/tests/org.eclipse.etrice.ui.tests.base/META-INF/MANIFEST.MF +++ /dev/null @@ -1,20 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: eTrice Diagram Test Base Classes -Bundle-SymbolicName: org.eclipse.etrice.ui.tests.base -Bundle-Version: 1.1.1.qualifier -Require-Bundle: org.junit;bundle-version="4.8.1", - org.eclipse.core.runtime, - org.eclipse.etrice.core.room;bundle-version="1.1.1", - org.eclipse.etrice.ui.structure;bundle-version="1.1.1", - org.eclipse.xtext;bundle-version="2.6.0", - org.eclipse.graphiti;bundle-version="0.8.0", - org.eclipse.etrice.ui.common.base, - com.google.guava, - org.eclipse.xtext.xbase.lib, - org.eclipse.xtend.lib, - org.eclipse.xtend.lib.macro -Bundle-Vendor: Eclipse eTrice -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: org.eclipse.etrice.tests.base - diff --git a/tests/org.eclipse.etrice.ui.tests.base/about.html b/tests/org.eclipse.etrice.ui.tests.base/about.html deleted file mode 100644 index c258ef55d..000000000 --- a/tests/org.eclipse.etrice.ui.tests.base/about.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - -About - - -

About This Content

- -

June 5, 2006

-

License

- -

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at http://www.eclipse.org.

- - - \ No newline at end of file diff --git a/tests/org.eclipse.etrice.ui.tests.base/build.properties b/tests/org.eclipse.etrice.ui.tests.base/build.properties deleted file mode 100644 index 34d2e4d2d..000000000 --- a/tests/org.eclipse.etrice.ui.tests.base/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - . diff --git a/tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java b/tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java deleted file mode 100644 index 73a95af74..000000000 --- a/tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.tests.base; - -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.LinkedList; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.graphiti.mm.algorithms.styles.Color; -import org.eclipse.graphiti.util.IColorConstant; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.resource.XtextResourceSet; - -public abstract class TestBase { - - private String basePath; - private LinkedList models = new LinkedList(); - - protected void loadModelFile() { - try { - URL modelsDir = getModelsDirectoy(); - URL fileURL = FileLocator.toFileURL(modelsDir); - basePath = fileURL.getFile(); - } catch (IOException e) { - e.printStackTrace(); - } - - loadModels(getModelFileName()); - } - - protected void removeDiagramsDirectory() { - File diagDir = new File(basePath+File.separator+"diagrams"); - if (diagDir.isDirectory()) { - File[] files = diagDir.listFiles(); - if (files!=null) - for (int i = 0; i < files.length; i++) { - files[i].delete(); - } - diagDir.delete(); - } - } - - private void loadModels(String modelName) { - XtextResourceSet rs = new XtextResourceSet(); - rs.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE); - String path = basePath + modelName; - URI uri = URI.createFileURI(path); - Resource resource = rs.getResource(uri, true); - Object root = resource.getContents().get(0); - if (root instanceof RoomModel) - models.add((RoomModel) root); - else - fail("File contains no RoomModel as root object"); - } - - public LinkedList getModels() { - return models; - } - - protected abstract String getModelFileName(); - protected abstract URL getModelsDirectoy(); - - protected boolean isEqual(Color c, IColorConstant cc) { - if (c.getRed()!=cc.getRed()) - return false; - if (c.getGreen()!=cc.getGreen()) - return false; - if (c.getBlue()!=cc.getBlue()) - return false; - return true; - } -} diff --git a/tests/pom.xml b/tests/pom.xml new file mode 100644 index 000000000..2614046e0 --- /dev/null +++ b/tests/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + org.eclipse.etrice + org.eclipse.etrice.parent + 1.0.0-SNAPSHOT + ../releng/org.eclipse.etrice.parent + + org.eclipse.etrice + org.eclipse.etrice.tests + 1.0.0-SNAPSHOT + pom + + + + + org.eclipse.tycho + tycho-surefire-plugin + ${tycho.version} + + false + + + + + \ No newline at end of file -- cgit v1.2.3 From 2312786d9c8b27fe97fd361e0aeeef99fe0e67de Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Thu, 31 Aug 2017 18:06:02 +0200 Subject: Bug 521698 - Tycho build generate xtend files Change-Id: Ifc0808742d7f72da305cb0879384af6f7da85581 --- .gitignore | 3 +- .../model/BaseTokenTypeToPartitionMapper.java | 30 - .../ui/labeling/BaseDescriptionLabelProvider.java | 22 - .../core/common/ui/labeling/BaseLabelProvider.java | 95 - .../common/ui/outline/BaseOutlineTreeProvider.java | 22 - .../common/ui/quickfix/BaseQuickfixProvider.java | 22 - .../core/common/converter/CCStringIndentation.java | 403 --- .../core/common/formatting2/BaseFormatter.java | 251 -- .../core/common/formatting2/CCStringReplacer.java | 70 - .../core/common/generator/BaseGenerator.java | 27 - .../common/postprocessing/DocuPostprocessor.java | 227 -- .../postprocessing/PostprocessingHelpers.java | 100 - .../core/common/scoping/BaseScopeProvider.java | 23 - .../core/common/scoping/BaseTestScopeProvider.java | 22 - .../core/common/validation/ValidationHelpers.java | 136 - .../etrice/core/generator/ConfigGenerator.java | 15 - .../core/postprocessing/DocuPostprocessor.java | 423 --- .../core/postprocessing/ImplPostProcessing.java | 108 - .../core/etmap/generator/ETMapGenerator.java | 15 - .../etmap/postprocessing/DocuPostprocessor.java | 112 - .../core/etphys/generator/ETPhysGenerator.java | 15 - .../etphys/postprocessing/DocuPostprocessor.java | 200 -- .../fsm/ui/contentassist/FSMProposalProvider.java | 13 - .../ui/labeling/FSMDescriptionLabelProvider.java | 15 - .../core/fsm/ui/labeling/FSMLabelProvider.java | 62 - .../fsm/ui/outline/FSMOutlineTreeProvider.java | 15 - .../core/fsm/ui/quickfix/FSMQuickfixProvider.java | 74 - .../etrice/core/fsm/formatting2/FSMFormatter.java | 270 -- .../etrice/core/fsm/generator/FSMGenerator.java | 20 - .../core/fsm/postprocessing/DocuPostprocessor.java | 697 ----- .../core/fsm/postprocessing/ImplPostprocessor.java | 82 - .../etrice/core/fsm/scoping/FSMScopeProvider.java | 341 --- .../fsm/validation/FSMValidationUtilXtend.java | 157 -- .../etrice/core/ui/hover/RoomHoverProvider.java | 45 - .../core/ui/quickfix/DetailCodeIndentHelper.java | 105 - .../etrice/core/formatting2/RoomFormatter.java | 349 --- .../core/postprocessing/DocuPostprocessor.java | 1504 ----------- .../core/postprocessing/ImplPostprocessor.java | 246 -- .../DefaultDetailExpressionProvider.java | 209 -- .../detailcode/DetailExpressionAssistParser.java | 221 -- .../detailcode/GuardDetailExpressionProvider.java | 248 -- .../detailcode/IDetailExpressionProvider.java | 96 - .../RuntimeDetailExpressionProvider.java | 67 - .../expressions/ui/DetailExpressionUIProvider.java | 324 --- .../etrice/expressions/ui/HighlightConstants.java | 32 - .../ui/contentassist/RoomExpressionProposals.java | 153 -- .../ui/highlight/RoomExpressionHighlighter.java | 65 - .../etrice/generator/c/gen/ActorClassGen.java | 1287 --------- .../etrice/generator/c/gen/CExtensions.java | 816 ------ .../etrice/generator/c/gen/DataClassGen.java | 398 --- .../etrice/generator/c/gen/EnumerationTypeGen.java | 234 -- .../etrice/generator/c/gen/Initialization.java | 308 --- .../eclipse/etrice/generator/c/gen/MainGen.java | 74 - .../eclipse/etrice/generator/c/gen/NodeGen.java | 2751 -------------------- .../etrice/generator/c/gen/NodeRunnerGen.java | 273 -- .../etrice/generator/c/gen/ProtocolClassGen.java | 1532 ----------- .../etrice/generator/c/gen/StateMachineGen.java | 222 -- .../etrice/generator/config/DataConfiguration.java | 458 ---- .../etrice/generator/cpp/gen/ActorClassGen.java | 1157 -------- .../etrice/generator/cpp/gen/ConfigGenAddon.java | 570 ---- .../etrice/generator/cpp/gen/CppExtensions.java | 614 ----- .../generator/cpp/gen/CppProcedureHelpers.java | 116 - .../etrice/generator/cpp/gen/DataClassGen.java | 662 ----- .../etrice/generator/cpp/gen/Initialization.java | 173 -- .../eclipse/etrice/generator/cpp/gen/MainGen.java | 69 - .../eclipse/etrice/generator/cpp/gen/NodeGen.java | 902 ------- .../etrice/generator/cpp/gen/NodeRunnerGen.java | 301 --- .../etrice/generator/cpp/gen/ProtocolClassGen.java | 1616 ------------ .../etrice/generator/cpp/gen/StateMachineGen.java | 171 -- .../eclipse/etrice/generator/doc/gen/DocGen.java | 1625 ------------ .../generator/doc/gen/InstanceDiagramGen.java | 276 -- .../eclipse/etrice/generator/doc/gen/MainGen.java | 49 - .../fsm/generic/AbstractStateMachineGenerator.java | 1765 ------------- .../generator/fsm/generic/FSMExtensions.java | 213 -- .../generator/generator/FSMtestGenerator.java | 15 - .../.settings/org.eclipse.core.resources.prefs | 2 - .../generator/gnuplot/GnuplotScriptGenerator.xtend | 28 +- .../generator/gnuplot/GnuplotScriptGenerator.java | 415 --- .../generator/java/gen/ActorClassDataGen.java | 236 -- .../etrice/generator/java/gen/ActorClassGen.java | 1772 ------------- .../etrice/generator/java/gen/ConfigGenAddon.java | 478 ---- .../etrice/generator/java/gen/DataClassGen.java | 442 ---- .../generator/java/gen/EnumerationTypeGen.java | 106 - .../etrice/generator/java/gen/Initialization.java | 361 --- .../etrice/generator/java/gen/JavaExtensions.java | 597 ----- .../eclipse/etrice/generator/java/gen/MainGen.java | 94 - .../eclipse/etrice/generator/java/gen/NodeGen.java | 844 ------ .../etrice/generator/java/gen/NodeRunnerGen.java | 183 -- .../java/gen/OptionalActorFactoryGen.java | 231 -- .../java/gen/OptionalActorInterfaceGen.java | 235 -- .../generator/java/gen/ProtocolClassGen.java | 1079 -------- .../etrice/generator/java/gen/StateMachineGen.java | 157 -- .../generator/java/gen/VariableServiceGen.java | 954 ------- .../generator/ui/wizard/ProjectFileFragments.java | 977 ------- .../generator/base/GlobalGeneratorSettings.java | 127 - .../generic/GenericActorClassGenerator.java | 132 - .../generic/GenericProtocolClassGenerator.java | 155 -- .../generic/GenericStateMachineGenerator.java | 441 ---- .../generator/generic/PrepareFileSystem.java | 132 - .../etrice/generator/generic/ProcedureHelpers.java | 912 ------- .../etrice/generator/generic/RoomExtensions.java | 646 ----- .../generator/generic/TestInstanceCreator.java | 291 --- .../etrice/generator/generic/TypeHelpers.java | 198 -- .../sourceviewer/CustomCompletionProposal.java | 67 - .../sourceviewer/DetailExpressionAssistParser.java | 206 -- .../sourceviewer/DetailExpressionUIProvider.java | 374 --- releng/org.eclipse.etrice.parent/pom.xml | 6 +- .../core/common/tests/DetailCodeParseTest.java | 325 --- .../core/common/tests/RelativeFileURITest.java | 122 - .../genmodel/fsm/tests/TestHierInheritedFSM.java | 115 - .../org/eclipse/etrice/core/FormatterTest.java | 161 -- .../org/eclipse/etrice/core/TestNames.java | 179 -- 112 files changed, 20 insertions(+), 40158 deletions(-) delete mode 100644 plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/editor/model/BaseTokenTypeToPartitionMapper.java delete mode 100644 plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/labeling/BaseDescriptionLabelProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/labeling/BaseLabelProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/outline/BaseOutlineTreeProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/quickfix/BaseQuickfixProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/converter/CCStringIndentation.java delete mode 100644 plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting2/BaseFormatter.java delete mode 100644 plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting2/CCStringReplacer.java delete mode 100644 plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/generator/BaseGenerator.java delete mode 100644 plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/DocuPostprocessor.java delete mode 100644 plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java delete mode 100644 plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/scoping/BaseScopeProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/scoping/BaseTestScopeProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/validation/ValidationHelpers.java delete mode 100644 plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/generator/ConfigGenerator.java delete mode 100644 plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.java delete mode 100644 plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostProcessing.java delete mode 100644 plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/generator/ETMapGenerator.java delete mode 100644 plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/postprocessing/DocuPostprocessor.java delete mode 100644 plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/generator/ETPhysGenerator.java delete mode 100644 plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/postprocessing/DocuPostprocessor.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/contentassist/FSMProposalProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/labeling/FSMDescriptionLabelProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/labeling/FSMLabelProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/outline/FSMOutlineTreeProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/quickfix/FSMQuickfixProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/DocuPostprocessor.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java delete mode 100644 plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/hover/RoomHoverProvider.java delete mode 100644 plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/quickfix/DetailCodeIndentHelper.java delete mode 100644 plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/formatting2/RoomFormatter.java delete mode 100644 plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.java delete mode 100644 plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java delete mode 100644 plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/DefaultDetailExpressionProvider.java delete mode 100644 plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/DetailExpressionAssistParser.java delete mode 100644 plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/GuardDetailExpressionProvider.java delete mode 100644 plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/IDetailExpressionProvider.java delete mode 100644 plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/RuntimeDetailExpressionProvider.java delete mode 100644 plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/DetailExpressionUIProvider.java delete mode 100644 plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/HighlightConstants.java delete mode 100644 plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/contentassist/RoomExpressionProposals.java delete mode 100644 plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/highlight/RoomExpressionHighlighter.java delete mode 100644 plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java delete mode 100644 plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/EnumerationTypeGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java delete mode 100644 plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppProcedureHelpers.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/Initialization.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/MainGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java delete mode 100644 plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/FSMExtensions.java delete mode 100644 plugins/org.eclipse.etrice.generator.fsmtest/xtend-gen/org/eclipse/etrice/generator/generator/FSMtestGenerator.java delete mode 100644 plugins/org.eclipse.etrice.generator.gnuplot/.settings/org.eclipse.core.resources.prefs delete mode 100644 plugins/org.eclipse.etrice.generator.gnuplot/xtend-gen/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/MainGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java delete mode 100644 plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java delete mode 100644 plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.java delete mode 100644 plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java delete mode 100644 plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java delete mode 100644 plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java delete mode 100644 plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/PrepareFileSystem.java delete mode 100644 plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java delete mode 100644 plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java delete mode 100644 plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TestInstanceCreator.java delete mode 100644 plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java delete mode 100644 plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/CustomCompletionProposal.java delete mode 100644 plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionAssistParser.java delete mode 100644 plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionUIProvider.java delete mode 100644 tests/org.eclipse.etrice.core.common.tests/xtend-gen/org/eclipse/etrice/core/common/tests/DetailCodeParseTest.java delete mode 100644 tests/org.eclipse.etrice.core.common.tests/xtend-gen/org/eclipse/etrice/core/common/tests/RelativeFileURITest.java delete mode 100644 tests/org.eclipse.etrice.core.genmodel.fsm.tests/xtend-gen/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierInheritedFSM.java delete mode 100644 tests/org.eclipse.etrice.core.room.tests/xtend-gen/org/eclipse/etrice/core/FormatterTest.java delete mode 100644 tests/org.eclipse.etrice.core.room.tests/xtend-gen/org/eclipse/etrice/core/TestNames.java diff --git a/.gitignore b/.gitignore index cb6f85480..5899d5def 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ gerritKeys.pub *._trace *.xtendbin language.settings.xml -target/ \ No newline at end of file +target/ +xtend-gen/ \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/editor/model/BaseTokenTypeToPartitionMapper.java b/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/editor/model/BaseTokenTypeToPartitionMapper.java deleted file mode 100644 index f3a151c15..000000000 --- a/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/editor/model/BaseTokenTypeToPartitionMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.common.ui.editor.model; - -import org.eclipse.xtext.ui.editor.model.TerminalsTokenTypeToPartitionMapper; - -@SuppressWarnings("all") -public class BaseTokenTypeToPartitionMapper extends TerminalsTokenTypeToPartitionMapper { - @Override - protected String calculateId(final String tokenName, final int tokenType) { - String _switchResult = null; - switch (tokenName) { - case "RULE_CC_STRING": - _switchResult = TerminalsTokenTypeToPartitionMapper.STRING_LITERAL_PARTITION; - break; - default: - _switchResult = super.calculateId(tokenName, tokenType); - break; - } - return _switchResult; - } -} diff --git a/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/labeling/BaseDescriptionLabelProvider.java b/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/labeling/BaseDescriptionLabelProvider.java deleted file mode 100644 index 884ec5eae..000000000 --- a/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/labeling/BaseDescriptionLabelProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Eyrak Paen (initial contribution) - */ -package org.eclipse.etrice.core.common.ui.labeling; - -import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider; - -/** - * Provides labels for a IEObjectDescriptions and IResourceDescriptions. - * - * see http://www.eclipse.org/Xtext/documentation.html#labelProvider - */ -@SuppressWarnings("all") -public class BaseDescriptionLabelProvider extends DefaultDescriptionLabelProvider { -} diff --git a/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/labeling/BaseLabelProvider.java b/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/labeling/BaseLabelProvider.java deleted file mode 100644 index c805788d2..000000000 --- a/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/labeling/BaseLabelProvider.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Eyrak Paen (initial contribution) - */ -package org.eclipse.etrice.core.common.ui.labeling; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.etrice.core.common.base.Import; -import org.eclipse.jface.resource.ColorRegistry; -import org.eclipse.jface.resource.FontDescriptor; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider; -import org.eclipse.xtext.ui.label.StylerFactory; - -/** - * Provides labels for a EObjects. - * - * see http://www.eclipse.org/Xtext/documentation.html#labelProvider - */ -@SuppressWarnings("all") -public class BaseLabelProvider extends DefaultEObjectLabelProvider { - protected final static String KEYWORD_COLOR = "KEYWORD_COLOR"; - - @Inject - protected StylerFactory stylerFactory; - - protected StyledString.Styler keywordStyler = null; - - protected StyledString.Styler typeStyler = null; - - @Inject - public BaseLabelProvider(final AdapterFactoryLabelProvider delegate) { - super(delegate); - ColorRegistry _colorRegistry = JFaceResources.getColorRegistry(); - RGB _rGB = new RGB(50, 50, 50); - _colorRegistry.put(BaseLabelProvider.KEYWORD_COLOR, _rGB); - } - - public String image(final Import mdl) { - return null; - } - - public StyledString text(final Import im) { - String _importedNamespace = im.getImportedNamespace(); - boolean _equals = Objects.equal(_importedNamespace, null); - if (_equals) { - String _importURI = im.getImportURI(); - String _plus = ("import model " + _importURI); - StyledString txt = new StyledString(_plus); - StyledString.Styler _keywordStyler = this.getKeywordStyler(); - txt.setStyle(0, 12, _keywordStyler); - return txt; - } else { - String _importedNamespace_1 = im.getImportedNamespace(); - String _plus_1 = ("import ns " + _importedNamespace_1); - StyledString txt_1 = new StyledString(_plus_1); - StyledString.Styler _keywordStyler_1 = this.getKeywordStyler(); - txt_1.setStyle(0, 9, _keywordStyler_1); - return txt_1; - } - } - - protected StyledString.Styler getKeywordStyler() { - boolean _equals = Objects.equal(this.keywordStyler, null); - if (_equals) { - FontDescriptor font = JFaceResources.getFontDescriptor(JFaceResources.TEXT_FONT); - FontDescriptor boldFont = font.setStyle(SWT.BOLD); - StyledString.Styler _createStyler = this.stylerFactory.createStyler(boldFont, BaseLabelProvider.KEYWORD_COLOR, null); - this.keywordStyler = _createStyler; - } - return this.keywordStyler; - } - - protected StyledString.Styler getTypeStyler() { - boolean _equals = Objects.equal(this.typeStyler, null); - if (_equals) { - FontDescriptor font = JFaceResources.getFontDescriptor(JFaceResources.TEXT_FONT); - FontDescriptor italicFont = font.setStyle(SWT.ITALIC); - StyledString.Styler _createStyler = this.stylerFactory.createStyler(italicFont, null, null); - this.typeStyler = _createStyler; - } - return this.typeStyler; - } -} diff --git a/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/outline/BaseOutlineTreeProvider.java b/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/outline/BaseOutlineTreeProvider.java deleted file mode 100644 index 99fbc0dec..000000000 --- a/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/outline/BaseOutlineTreeProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Eyrak Paen (initial contribution) - */ -package org.eclipse.etrice.core.common.ui.outline; - -import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider; - -/** - * Customization of the default outline structure. - * - * see http://www.eclipse.org/Xtext/documentation.html#outline - */ -@SuppressWarnings("all") -public class BaseOutlineTreeProvider extends DefaultOutlineTreeProvider { -} diff --git a/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/quickfix/BaseQuickfixProvider.java b/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/quickfix/BaseQuickfixProvider.java deleted file mode 100644 index 12517532d..000000000 --- a/plugins/org.eclipse.etrice.core.common.ui/xtend-gen/org/eclipse/etrice/core/common/ui/quickfix/BaseQuickfixProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Eyrak Paen (initial contribution) - */ -package org.eclipse.etrice.core.common.ui.quickfix; - -import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider; - -/** - * Custom quickfixes. - * - * see http://www.eclipse.org/Xtext/documentation.html#quickfixes - */ -@SuppressWarnings("all") -public class BaseQuickfixProvider extends DefaultQuickfixProvider { -} diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/converter/CCStringIndentation.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/converter/CCStringIndentation.java deleted file mode 100644 index 2f771fd7f..000000000 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/converter/CCStringIndentation.java +++ /dev/null @@ -1,403 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.common.converter; - -import com.google.common.collect.ImmutableList; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.eclipse.xtend.lib.annotations.AccessorType; -import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.Functions.Function2; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; -import org.eclipse.xtext.xbase.lib.ObjectExtensions; -import org.eclipse.xtext.xbase.lib.Pair; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; -import org.eclipse.xtext.xbase.lib.Pure; - -/** - * TODO: Handling mixed line endings - * - * Improvement: Too much strings matching => use token scanner - */ -@SuppressWarnings("all") -public class CCStringIndentation { - private final static String JAVA_NL = Strings.newLine(); - - private final static String CRLF = "\r\n"; - - private final static String LF = "\n"; - - private final static String CR = "\r"; - - public static boolean hasLineBreak(final String nodeText) { - int _countLineBreaks = Strings.countLineBreaks(nodeText); - return (_countLineBreaks > 0); - } - - public static String getLineEnding(final String it) { - String _switchResult = null; - boolean _matched = false; - int _indexOf = it.indexOf(CCStringIndentation.CRLF); - boolean _greaterEqualsThan = (_indexOf >= 0); - if (_greaterEqualsThan) { - _matched=true; - _switchResult = CCStringIndentation.CRLF; - } - if (!_matched) { - int _indexOf_1 = it.indexOf(CCStringIndentation.LF); - boolean _greaterEqualsThan_1 = (_indexOf_1 >= 0); - if (_greaterEqualsThan_1) { - _matched=true; - _switchResult = CCStringIndentation.LF; - } - } - if (!_matched) { - int _indexOf_2 = it.indexOf(CCStringIndentation.CR); - boolean _greaterEqualsThan_2 = (_indexOf_2 >= 0); - if (_greaterEqualsThan_2) { - _matched=true; - _switchResult = CCStringIndentation.CR; - } - } - if (!_matched) { - _switchResult = CCStringIndentation.JAVA_NL; - } - return _switchResult; - } - - private final String ccString; - - private final String lineEnding; - - @Accessors(AccessorType.PUBLIC_GETTER) - private final ImmutableList splittedLines; - - @Accessors(AccessorType.PUBLIC_GETTER) - private final boolean ignoreFirst; - - @Accessors(AccessorType.PUBLIC_GETTER) - private final boolean ignoreLast; - - /** - * CCString without delimiters. Caller should handle their own delims. - */ - public CCStringIndentation(final String ccString) { - this.ccString = ccString; - String _lineEnding = CCStringIndentation.getLineEnding(ccString); - this.lineEnding = _lineEnding; - ArrayList _newArrayList = CollectionLiterals.newArrayList(); - final Procedure1> _function = (ArrayList lines) -> { - Pattern _compile = Pattern.compile(this.lineEnding); - final Matcher matcher = _compile.matcher(ccString); - int lastOffset = 0; - while (matcher.find()) { - { - int _start = matcher.start(); - String _substring = ccString.substring(lastOffset, _start); - lines.add(_substring); - int _end = matcher.end(); - lastOffset = _end; - } - } - int _length = ccString.length(); - boolean _lessThan = (lastOffset < _length); - if (_lessThan) { - String _substring = ccString.substring(lastOffset); - lines.add(_substring); - } else { - boolean _endsWith = ccString.endsWith(this.lineEnding); - if (_endsWith) { - lines.add(""); - } - } - }; - ArrayList _doubleArrow = ObjectExtensions.>operator_doubleArrow(_newArrayList, _function); - ImmutableList _copyOf = ImmutableList.copyOf(_doubleArrow); - this.splittedLines = _copyOf; - this.ignoreFirst = ((this.splittedLines.size() >= 2) && IterableExtensions.head(this.splittedLines).trim().isEmpty()); - this.ignoreLast = ((this.splittedLines.size() >= 2) && IterableExtensions.last(this.splittedLines).trim().isEmpty()); - } - - /** - * Returns ccString without editor white space and delims. - * - * @see #highlight() - */ - public String removeEditorWhiteSpace() { - return this.removeEditorWhiteSpace(""); - } - - protected String removeEditorWhiteSpace(final String indent) { - List> _highlight = this.highlight(); - final Function2, String> _function = (String lines, Pair offsetLength) -> { - Integer _key = offsetLength.getKey(); - Integer _key_1 = offsetLength.getKey(); - Integer _value = offsetLength.getValue(); - int _plus = ((_key_1).intValue() + (_value).intValue()); - String _substring = this.ccString.substring((_key).intValue(), _plus); - return ((lines + indent) + _substring); - }; - return IterableExtensions., String>fold(_highlight, "", _function); - } - - /** - * Returns whether editor indentation can be removed safely. - */ - public boolean canRemoveEditorIndentation() { - return (((this.splittedLines.size() >= 2) && this.ignoreFirst) && this.hasConsistentIndentation()); - } - - /** - * Returns ccString replaced with given indentation if possible. Ignored lines are trimmed. No delims included. - * - * @see #highlight() - */ - public String replaceEditorIndentation(final String indentation) { - String _xblockexpression = null; - { - String _xifexpression = null; - if ((indentation == null)) { - _xifexpression = ""; - } else { - _xifexpression = indentation; - } - final String indent = _xifexpression; - String _xifexpression_1 = null; - boolean _canRemoveEditorIndentation = this.canRemoveEditorIndentation(); - if (_canRemoveEditorIndentation) { - String _xifexpression_2 = null; - if ((this.ignoreFirst && (this.splittedLines.size() == 2))) { - _xifexpression_2 = this.removeEditorWhiteSpace(""); - } else { - String _xifexpression_3 = null; - if (this.ignoreFirst) { - _xifexpression_3 = this.lineEnding; - } else { - _xifexpression_3 = ""; - } - String _removeEditorWhiteSpace = this.removeEditorWhiteSpace(indent); - _xifexpression_2 = (_xifexpression_3 + _removeEditorWhiteSpace); - } - _xifexpression_1 = _xifexpression_2; - } else { - String _xblockexpression_1 = null; - { - LinkedList _newLinkedList = CollectionLiterals.newLinkedList(((String[])Conversions.unwrapArray(this.splittedLines, String.class))); - final Procedure1> _function = (LinkedList it) -> { - if (this.ignoreFirst) { - it.set(0, ""); - } - if (this.ignoreLast) { - int _size = it.size(); - int _minus = (_size - 1); - it.set(_minus, ""); - } - }; - final LinkedList lines = ObjectExtensions.>operator_doubleArrow(_newLinkedList, _function); - _xblockexpression_1 = IterableExtensions.join(lines, this.lineEnding); - } - _xifexpression_1 = _xblockexpression_1; - } - _xblockexpression = _xifexpression_1; - } - return _xblockexpression; - } - - /** - * Returns highlighted positions without editor's indentation.
- * Positions are pairs of (offset, length) relative to {@link #CCStringIndentation(String)} - * - * @see #removeEditorWhiteSpace() - */ - public List> highlight() { - final ArrayList> offsetLengthLines = CollectionLiterals.>newArrayList(); - final String editorIndent = this.computeEditorIndent(false); - final int skip = editorIndent.length(); - int offset = 0; - for (int i = 0; (i < ((Object[])Conversions.unwrapArray(this.splittedLines, Object.class)).length); i++) { - { - final String line = this.splittedLines.get(i); - if (((i == 0) && this.ignoreFirst)) { - int _offset = offset; - int _length = line.length(); - int _length_1 = this.lineEnding.length(); - int _plus = (_length + _length_1); - offset = (_offset + _plus); - } else { - if (((i == (this.splittedLines.size() - 1)) && this.ignoreLast)) { - } else { - Pair _xblockexpression = null; - { - int _xifexpression = (int) 0; - int _size = this.splittedLines.size(); - int _minus = (_size - 1); - boolean _lessThan = (i < _minus); - if (_lessThan) { - _xifexpression = this.lineEnding.length(); - } else { - _xifexpression = 0; - } - final int NL = _xifexpression; - Pair _xifexpression_1 = null; - boolean _startsWith = line.startsWith(editorIndent); - if (_startsWith) { - int _length_2 = line.length(); - int _minus_1 = (_length_2 - skip); - int _plus_1 = (_minus_1 + NL); - _xifexpression_1 = Pair.of(Integer.valueOf((offset + skip)), Integer.valueOf(_plus_1)); - } else { - int _length_3 = line.length(); - int _plus_2 = (_length_3 + NL); - _xifexpression_1 = Pair.of(Integer.valueOf(offset), Integer.valueOf(_plus_2)); - } - _xblockexpression = _xifexpression_1; - } - offsetLengthLines.add(_xblockexpression); - int _offset_1 = offset; - int _length_2 = line.length(); - int _length_3 = this.lineEnding.length(); - int _plus_1 = (_length_2 + _length_3); - offset = (_offset_1 + _plus_1); - } - } - } - } - return offsetLengthLines; - } - - /** - * Check consistent indentation - */ - public boolean hasConsistentIndentation() { - String _computeEditorIndent = this.computeEditorIndent(true); - return (_computeEditorIndent != null); - } - - protected String computeEditorIndent(final boolean consistentOnly) { - String _xblockexpression = null; - { - if (((this.splittedLines.size() <= 1) || (!this.ignoreFirst))) { - return ""; - } - List> _xblockexpression_1 = null; - { - int _xifexpression = (int) 0; - if (this.ignoreFirst) { - _xifexpression = 1; - } else { - _xifexpression = 0; - } - final int begin = _xifexpression; - int _size = this.splittedLines.size(); - int _xifexpression_1 = (int) 0; - if (this.ignoreLast) { - _xifexpression_1 = 1; - } else { - _xifexpression_1 = 0; - } - final int end = (_size - _xifexpression_1); - ImmutableList _subList = this.splittedLines.subList(begin, end); - final Function1> _function = (String line) -> { - String _leadingWhiteSpace = Strings.getLeadingWhiteSpace(line); - return Pair.of(_leadingWhiteSpace, line); - }; - List> _map = ListExtensions.>map(_subList, _function); - _xblockexpression_1 = IterableExtensions.>toList(_map); - } - final List> wsLinePairs = _xblockexpression_1; - final Function1, String> _function = (Iterable it) -> { - String _xifexpression = null; - boolean _isEmpty = IterableExtensions.isEmpty(it); - if (_isEmpty) { - _xifexpression = ""; - } else { - _xifexpression = IterableExtensions.min(it); - } - return _xifexpression; - }; - final Function1, ? extends String> minWSComputor = _function; - final Function1, Boolean> _function_1 = (Pair it) -> { - String _value = it.getValue(); - String _trim = _value.trim(); - boolean _isEmpty = _trim.isEmpty(); - return Boolean.valueOf((!_isEmpty)); - }; - Iterable> _filter = IterableExtensions.>filter(wsLinePairs, _function_1); - final Function1, String> _function_2 = (Pair it) -> { - return it.getKey(); - }; - Iterable _map = IterableExtensions., String>map(_filter, _function_2); - final String textIndent = minWSComputor.apply(_map); - final Function1, String> _function_3 = (Pair it) -> { - return it.getKey(); - }; - List _map_1 = ListExtensions., String>map(wsLinePairs, _function_3); - final Function1 _function_4 = (String it) -> { - boolean _isEmpty = it.isEmpty(); - return Boolean.valueOf((!_isEmpty)); - }; - Iterable _filter_1 = IterableExtensions.filter(_map_1, _function_4); - final Function1 _function_5 = (String nonEmptyIndent) -> { - return Boolean.valueOf(nonEmptyIndent.startsWith(textIndent)); - }; - final boolean consistent = IterableExtensions.forall(_filter_1, _function_5); - String _switchResult = null; - boolean _matched = false; - if (consistent) { - _matched=true; - _switchResult = textIndent; - } - if (!_matched) { - if (consistentOnly) { - _matched=true; - _switchResult = null; - } - } - if (!_matched) { - final Function1, String> _function_6 = (Pair it) -> { - return it.getKey(); - }; - List _map_2 = ListExtensions., String>map(wsLinePairs, _function_6); - final Function1 _function_7 = (String it) -> { - boolean _isEmpty = it.isEmpty(); - return Boolean.valueOf((!_isEmpty)); - }; - Iterable _filter_2 = IterableExtensions.filter(_map_2, _function_7); - _switchResult = minWSComputor.apply(_filter_2); - } - _xblockexpression = _switchResult; - } - return _xblockexpression; - } - - @Pure - public ImmutableList getSplittedLines() { - return this.splittedLines; - } - - @Pure - public boolean isIgnoreFirst() { - return this.ignoreFirst; - } - - @Pure - public boolean isIgnoreLast() { - return this.ignoreLast; - } -} diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting2/BaseFormatter.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting2/BaseFormatter.java deleted file mode 100644 index 1294b1e2e..000000000 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting2/BaseFormatter.java +++ /dev/null @@ -1,251 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.common.formatting2; - -import com.google.inject.Inject; -import java.util.Arrays; -import java.util.List; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.common.base.Annotation; -import org.eclipse.etrice.core.common.base.AnnotationAttribute; -import org.eclipse.etrice.core.common.base.AnnotationType; -import org.eclipse.etrice.core.common.base.Documentation; -import org.eclipse.etrice.core.common.base.Import; -import org.eclipse.etrice.core.common.base.KeyValue; -import org.eclipse.etrice.core.common.services.BaseGrammarAccess; -import org.eclipse.xtext.Keyword; -import org.eclipse.xtext.formatting2.AbstractFormatter2; -import org.eclipse.xtext.formatting2.IFormattableDocument; -import org.eclipse.xtext.formatting2.IHiddenRegionFormatter; -import org.eclipse.xtext.formatting2.regionaccess.IHiddenRegion; -import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion; -import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Pair; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; - -@SuppressWarnings("all") -public class BaseFormatter extends AbstractFormatter2 { - @Inject - @Extension - private BaseGrammarAccess _baseGrammarAccess; - - /** - * recursive keyword formatting - */ - protected void formatAllByKeywords(final EObject it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _allRegionsFor = this.textRegionExtensions.allRegionsFor(it); - List> _keywordPairs = _allRegionsFor.keywordPairs("{", "}"); - final Consumer> _function = (Pair it_1) -> { - ISemanticRegion _key = it_1.getKey(); - final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.prepend(_key, _function_1); - final Procedure1 _function_2 = (IHiddenRegionFormatter it_2) -> { - it_2.indent(); - }; - document.interior(it_1, _function_2); - ISemanticRegion _value = it_1.getValue(); - final Procedure1 _function_3 = (IHiddenRegionFormatter it_2) -> { - it_2.newLine(); - }; - document.prepend(_value, _function_3); - }; - _keywordPairs.forEach(_function); - ISemanticRegionsFinder _allRegionsFor_1 = this.textRegionExtensions.allRegionsFor(it); - List> _keywordPairs_1 = _allRegionsFor_1.keywordPairs("(", ")"); - final Consumer> _function_1 = (Pair it_1) -> { - final Procedure1 _function_2 = (IHiddenRegionFormatter it_2) -> { - it_2.noSpace(); - }; - document.interior(it_1, _function_2); - }; - _keywordPairs_1.forEach(_function_1); - ISemanticRegionsFinder _allRegionsFor_2 = this.textRegionExtensions.allRegionsFor(it); - ISemanticRegion _keyword = _allRegionsFor_2.keyword("("); - final Procedure1 _function_2 = (IHiddenRegionFormatter it_1) -> { - it_1.noSpace(); - it_1.lowPriority(); - }; - document.prepend(_keyword, _function_2); - ISemanticRegionsFinder _allRegionsFor_3 = this.textRegionExtensions.allRegionsFor(it); - List _keywords = _allRegionsFor_3.keywords(","); - final Consumer _function_3 = (ISemanticRegion it_1) -> { - final Procedure1 _function_4 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.append(it_1, _function_4); - }; - _keywords.forEach(_function_3); - ISemanticRegionsFinder _allRegionsFor_4 = this.textRegionExtensions.allRegionsFor(it); - List _keywords_1 = _allRegionsFor_4.keywords("."); - final Consumer _function_4 = (ISemanticRegion it_1) -> { - final Procedure1 _function_5 = (IHiddenRegionFormatter it_2) -> { - it_2.noSpace(); - }; - document.surround(it_1, _function_5); - }; - _keywords_1.forEach(_function_4); - ISemanticRegionsFinder _allRegionsFor_5 = this.textRegionExtensions.allRegionsFor(it); - List _keywords_2 = _allRegionsFor_5.keywords(":"); - final Consumer _function_5 = (ISemanticRegion it_1) -> { - final Procedure1 _function_6 = (IHiddenRegionFormatter it_2) -> { - it_2.noSpace(); - }; - document.prepend(it_1, _function_6); - final Procedure1 _function_7 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.append(it_1, _function_7); - }; - _keywords_2.forEach(_function_5); - ISemanticRegionsFinder _allRegionsFor_6 = this.textRegionExtensions.allRegionsFor(it); - BaseGrammarAccess.TIMEElements _tIMEAccess = this._baseGrammarAccess.getTIMEAccess(); - Keyword _sKeyword_0_1 = _tIMEAccess.getSKeyword_0_1(); - BaseGrammarAccess.TIMEElements _tIMEAccess_1 = this._baseGrammarAccess.getTIMEAccess(); - Keyword _msKeyword_1_1 = _tIMEAccess_1.getMsKeyword_1_1(); - BaseGrammarAccess.TIMEElements _tIMEAccess_2 = this._baseGrammarAccess.getTIMEAccess(); - Keyword _usKeyword_2_1 = _tIMEAccess_2.getUsKeyword_2_1(); - BaseGrammarAccess.TIMEElements _tIMEAccess_3 = this._baseGrammarAccess.getTIMEAccess(); - Keyword _nsKeyword_3_1 = _tIMEAccess_3.getNsKeyword_3_1(); - List _keywords_3 = _allRegionsFor_6.keywords(_sKeyword_0_1, _msKeyword_1_1, _usKeyword_2_1, _nsKeyword_3_1); - final Consumer _function_6 = (ISemanticRegion it_1) -> { - IHiddenRegion _previousHiddenRegion = it_1.getPreviousHiddenRegion(); - int _length = _previousHiddenRegion.getLength(); - boolean _greaterThan = (_length > 1); - if (_greaterThan) { - final Procedure1 _function_7 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.prepend(it_1, _function_7); - } else { - final Procedure1 _function_8 = (IHiddenRegionFormatter it_2) -> { - it_2.noSpace(); - }; - document.prepend(it_1, _function_8); - } - final Procedure1 _function_9 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - it_2.lowPriority(); - }; - document.append(it_1, _function_9); - }; - _keywords_3.forEach(_function_6); - } - - protected void _format(final Documentation it, @Extension final IFormattableDocument document) { - } - - protected void _format(final Import it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - BaseGrammarAccess.ImportElements _importAccess = this._baseGrammarAccess.getImportAccess(); - Keyword _importKeyword_0 = _importAccess.getImportKeyword_0(); - BaseGrammarAccess.ImportElements _importAccess_1 = this._baseGrammarAccess.getImportAccess(); - Keyword _modelKeyword_1_1 = _importAccess_1.getModelKeyword_1_1(); - List _keywords = _regionFor.keywords(_importKeyword_0, _modelKeyword_1_1); - final Consumer _function = (ISemanticRegion it_1) -> { - final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.append(it_1, _function_1); - }; - _keywords.forEach(_function); - ISemanticRegionsFinder _regionFor_1 = this.textRegionExtensions.regionFor(it); - BaseGrammarAccess.ImportElements _importAccess_2 = this._baseGrammarAccess.getImportAccess(); - Keyword _fromKeyword_1_0_1 = _importAccess_2.getFromKeyword_1_0_1(); - ISemanticRegion _keyword = _regionFor_1.keyword(_fromKeyword_1_0_1); - final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { - it_1.oneSpace(); - }; - document.surround(_keyword, _function_1); - } - - protected void _format(final AnnotationType it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - BaseGrammarAccess.AnnotationTypeElements _annotationTypeAccess = this._baseGrammarAccess.getAnnotationTypeAccess(); - Keyword _annotationTypeKeyword_0 = _annotationTypeAccess.getAnnotationTypeKeyword_0(); - ISemanticRegion _keyword = _regionFor.keyword(_annotationTypeKeyword_0); - final Procedure1 _function = (IHiddenRegionFormatter it_1) -> { - it_1.oneSpace(); - }; - document.append(_keyword, _function); - ISemanticRegionsFinder _regionFor_1 = this.textRegionExtensions.regionFor(it); - BaseGrammarAccess.AnnotationTypeElements _annotationTypeAccess_1 = this._baseGrammarAccess.getAnnotationTypeAccess(); - Keyword _targetKeyword_4 = _annotationTypeAccess_1.getTargetKeyword_4(); - ISemanticRegion _keyword_1 = _regionFor_1.keyword(_targetKeyword_4); - final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { - it_1.newLine(); - }; - document.prepend(_keyword_1, _function_1); - EList _attributes = it.getAttributes(); - final Consumer _function_2 = (AnnotationAttribute it_1) -> { - final Procedure1 _function_3 = (IHiddenRegionFormatter it_2) -> { - it_2.newLine(); - }; - document.prepend(it_1, _function_3); - }; - _attributes.forEach(_function_2); - } - - protected void _format(final Annotation it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - BaseGrammarAccess.AnnotationElements _annotationAccess = this._baseGrammarAccess.getAnnotationAccess(); - Keyword _commercialAtKeyword_0 = _annotationAccess.getCommercialAtKeyword_0(); - ISemanticRegion _keyword = _regionFor.keyword(_commercialAtKeyword_0); - final Procedure1 _function = (IHiddenRegionFormatter it_1) -> { - it_1.noSpace(); - }; - document.append(_keyword, _function); - EList _attributes = it.getAttributes(); - final Consumer _function_1 = (KeyValue it_1) -> { - final Procedure1 _function_2 = (IHiddenRegionFormatter it_2) -> { - it_2.newLine(); - }; - document.prepend(it_1, _function_2); - }; - _attributes.forEach(_function_1); - } - - public void format(final Object it, final IFormattableDocument document) { - if (it instanceof XtextResource) { - _format((XtextResource)it, document); - return; - } else if (it instanceof Annotation) { - _format((Annotation)it, document); - return; - } else if (it instanceof AnnotationType) { - _format((AnnotationType)it, document); - return; - } else if (it instanceof Documentation) { - _format((Documentation)it, document); - return; - } else if (it instanceof Import) { - _format((Import)it, document); - return; - } else if (it instanceof EObject) { - _format((EObject)it, document); - return; - } else if (it == null) { - _format((Void)null, document); - return; - } else if (it != null) { - _format(it, document); - return; - } else { - throw new IllegalArgumentException("Unhandled parameter types: " + - Arrays.asList(it, document).toString()); - } - } -} diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting2/CCStringReplacer.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting2/CCStringReplacer.java deleted file mode 100644 index 87dba2255..000000000 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/formatting2/CCStringReplacer.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.common.formatting2; - -import org.eclipse.etrice.core.common.converter.CCStringConverter; -import org.eclipse.etrice.core.common.converter.CCStringIndentation; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; -import org.eclipse.xtext.formatting2.IFormattableDocument; -import org.eclipse.xtext.formatting2.ITextReplacerContext; -import org.eclipse.xtext.formatting2.internal.AbstractTextReplacer; -import org.eclipse.xtext.formatting2.regionaccess.ITextReplacement; -import org.eclipse.xtext.formatting2.regionaccess.ITextSegment; -import org.eclipse.xtext.xbase.lib.ObjectExtensions; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; - -@FinalFieldsConstructor -@SuppressWarnings("all") -public class CCStringReplacer extends AbstractTextReplacer { - private final CCStringConverter converter; - - @Override - public ITextReplacerContext createReplacements(final ITextReplacerContext context) { - ITextSegment _region = this.getRegion(); - boolean _isMultiline = _region.isMultiline(); - if (_isMultiline) { - ITextSegment _region_1 = this.getRegion(); - String _text = _region_1.getText(); - String _trim = _text.trim(); - String _stripDelim = this.converter.stripDelim(_trim); - final CCStringIndentation ccIndent = new CCStringIndentation(_stripDelim); - String _xifexpression = null; - boolean _isIgnoreLast = ccIndent.isIgnoreLast(); - if (_isIgnoreLast) { - _xifexpression = context.getIndentationString(); - } else { - _xifexpression = ""; - } - final String endIndent = _xifexpression; - int _indentation = context.getIndentation(); - int _plus = (_indentation + 1); - String _indentationString = context.getIndentationString(_plus); - String _replaceEditorIndentation = ccIndent.replaceEditorIndentation(_indentationString); - final String replacement = (_replaceEditorIndentation + endIndent); - final Procedure1 _function = (ITextReplacerContext it) -> { - ITextSegment _region_2 = this.getRegion(); - String _delim = this.converter.getDelim(); - String _plus_1 = (_delim + replacement); - String _delim_1 = this.converter.getDelim(); - String _plus_2 = (_plus_1 + _delim_1); - ITextReplacement _replaceWith = _region_2.replaceWith(_plus_2); - it.addReplacement(_replaceWith); - }; - ObjectExtensions.operator_doubleArrow(context, _function); - } - return context; - } - - public CCStringReplacer(final IFormattableDocument document, final ITextSegment region, final CCStringConverter converter) { - super(document, region); - this.converter = converter; - } -} diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/generator/BaseGenerator.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/generator/BaseGenerator.java deleted file mode 100644 index c3ecaf691..000000000 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/generator/BaseGenerator.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Eyrak Paen (initial contribution) - */ -package org.eclipse.etrice.core.common.generator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.xtext.generator.IFileSystemAccess; -import org.eclipse.xtext.generator.IGenerator; - -/** - * Generates code from your model files on save. - * - * see http://www.eclipse.org/Xtext/documentation.html#TutorialCodeGeneration - */ -@SuppressWarnings("all") -public class BaseGenerator implements IGenerator { - @Override - public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { - } -} diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/DocuPostprocessor.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/DocuPostprocessor.java deleted file mode 100644 index c9d45f6da..000000000 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/DocuPostprocessor.java +++ /dev/null @@ -1,227 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - * Eyrak Paen - */ -package org.eclipse.etrice.core.common.postprocessing; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -@SuppressWarnings("all") -public class DocuPostprocessor { - public void process(final GeneratedMetamodel metamodel) { - final EPackage pckg = metamodel.getEPackage(); - EClass cls = PostprocessingHelpers.getClass(pckg, "Import"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("The import declares an imported {@link org.eclipse.etrice.core.room.RoomModel room model} (given as a URI) and"); - _builder.newLine(); - _builder.append("an optional imported namespace."); - _builder.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder.toString()); - EAttribute _attribute = PostprocessingHelpers.getAttribute(cls, "importedNamespace"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("The imported name space has to be a dot separated qualified name followed by .*."); - _builder_1.newLine(); - _builder_1.append("Example: my.namespace.*"); - _builder_1.newLine(); - PostprocessingHelpers.setDocumentation(_attribute, _builder_1.toString()); - EAttribute _attribute_1 = PostprocessingHelpers.getAttribute(cls, "importURI"); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("The import URI can be a relative or absolute file system path."); - _builder_2.newLine(); - _builder_2.append("It may contain environment variables in ${} which will be expanded."); - _builder_2.newLine(); - _builder_2.append("

"); - _builder_2.newLine(); - _builder_2.append("Examples:"); - _builder_2.newLine(); - _builder_2.append("

    "); - _builder_2.newLine(); - _builder_2.append(" "); - _builder_2.append("
  • import model \"AnotherModel.room\"
  • "); - _builder_2.newLine(); - _builder_2.append(" "); - _builder_2.append("
  • import my.namespace.* from \"AnotherModel.room\"
  • "); - _builder_2.newLine(); - _builder_2.append(" "); - _builder_2.append("
  • import my.namespace.* from \"../../AnotherProject/models/AnotherModel.room\"
  • "); - _builder_2.newLine(); - _builder_2.append(" "); - _builder_2.append("
  • import my.namespace.* from \"/${ROOM_MODELS}/SomeModel.room\"
  • "); - _builder_2.newLine(); - _builder_2.append("
"); - _builder_2.newLine(); - _builder_2.append("

"); - _builder_2.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_1, _builder_2.toString()); - EClass _class = PostprocessingHelpers.getClass(pckg, "LiteralArray"); - cls = _class; - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("Aggregates one or more {@link Literal literals}.\t\t"); - _builder_3.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_3.toString()); - EReference _reference = PostprocessingHelpers.getReference(cls, "literals"); - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("This is a list of literals."); - _builder_4.newLine(); - PostprocessingHelpers.setDocumentation(_reference, _builder_4.toString()); - EClass _class_1 = PostprocessingHelpers.getClass(pckg, "Literal"); - cls = _class_1; - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("It is the super class of"); - _builder_5.newLine(); - _builder_5.append("
    "); - _builder_5.newLine(); - _builder_5.append("\t"); - _builder_5.append("
  • {@link BooleanLiteral}
  • "); - _builder_5.newLine(); - _builder_5.append("\t"); - _builder_5.append("
  • {@link NumberLiteral}
  • "); - _builder_5.newLine(); - _builder_5.append("\t"); - _builder_5.append("
  • {@link StringLiteral}
  • "); - _builder_5.newLine(); - _builder_5.append("
"); - _builder_5.newLine(); - _builder_5.append("that represents a primitive value."); - _builder_5.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_5.toString()); - EClass _class_2 = PostprocessingHelpers.getClass(pckg, "Documentation"); - cls = _class_2; - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("A piece of documentation that can be optionally attached at"); - _builder_6.newLine(); - _builder_6.append("certain places in the model."); - _builder_6.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_6.toString()); - EAttribute _attribute_2 = PostprocessingHelpers.getAttribute(cls, "lines"); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("This is the documentation\'s contents."); - _builder_7.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_2, _builder_7.toString()); - EClass _class_3 = PostprocessingHelpers.getClass(pckg, "Annotation"); - cls = _class_3; - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("An annotation similar to Java annotations that can be used"); - _builder_8.newLine(); - _builder_8.append("to add {@link KeyValue} pairs to certain model items. The structure "); - _builder_8.newLine(); - _builder_8.append("of Annotations are defined by {@link AnnotationType}s."); - _builder_8.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_8.toString()); - EReference _reference_1 = PostprocessingHelpers.getReference(cls, "type"); - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append("The {@link AnnotationType} that defines the structure of "); - _builder_9.newLine(); - _builder_9.append("the annotation."); - _builder_9.newLine(); - PostprocessingHelpers.setDocumentation(_reference_1, _builder_9.toString()); - EReference _reference_2 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_10 = new StringConcatenation(); - _builder_10.append("This is a list of key/value pairs."); - _builder_10.newLine(); - PostprocessingHelpers.setDocumentation(_reference_2, _builder_10.toString()); - EClass _class_4 = PostprocessingHelpers.getClass(pckg, "KeyValue"); - cls = _class_4; - StringConcatenation _builder_11 = new StringConcatenation(); - _builder_11.append("A key/value pair."); - _builder_11.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_11.toString()); - EAttribute _attribute_3 = PostprocessingHelpers.getAttribute(cls, "key"); - StringConcatenation _builder_12 = new StringConcatenation(); - _builder_12.append("This is the key of the pair."); - _builder_12.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_3, _builder_12.toString()); - EReference _reference_3 = PostprocessingHelpers.getReference(cls, "value"); - StringConcatenation _builder_13 = new StringConcatenation(); - _builder_13.append("This is the value of the pair."); - _builder_13.newLine(); - PostprocessingHelpers.setDocumentation(_reference_3, _builder_13.toString()); - EClass _class_5 = PostprocessingHelpers.getClass(pckg, "AnnotationType"); - cls = _class_5; - StringConcatenation _builder_14 = new StringConcatenation(); - _builder_14.append("Defines the structure of {@link Annotation}s."); - PostprocessingHelpers.setDocumentation(cls, _builder_14.toString()); - EAttribute _attribute_4 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_15 = new StringConcatenation(); - _builder_15.append("The name of the AnnotationType"); - PostprocessingHelpers.setDocumentation(_attribute_4, _builder_15.toString()); - EAttribute _attribute_5 = PostprocessingHelpers.getAttribute(cls, "targets"); - StringConcatenation _builder_16 = new StringConcatenation(); - _builder_16.append("A list of names representing the locations in which "); - _builder_16.newLine(); - _builder_16.append("\t\t\t"); - _builder_16.append("{@link Annotation}s of this AnnotationType can occur"); - PostprocessingHelpers.setDocumentation(_attribute_5, _builder_16.toString()); - EReference _reference_4 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_17 = new StringConcatenation(); - _builder_17.append("Optional model-level documentation"); - PostprocessingHelpers.setDocumentation(_reference_4, _builder_17.toString()); - EReference _reference_5 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_18 = new StringConcatenation(); - _builder_18.append("Defines the {@link AnnotationAttribute}s that are required or allowed in "); - _builder_18.newLine(); - _builder_18.append("\t\t\t"); - _builder_18.append("{@link Annotation} instances of this AnnotationType"); - PostprocessingHelpers.setDocumentation(_reference_5, _builder_18.toString()); - EClass _class_6 = PostprocessingHelpers.getClass(pckg, "AnnotationAttribute"); - cls = _class_6; - StringConcatenation _builder_19 = new StringConcatenation(); - _builder_19.append("Defines an attribute in an {@link AnnotationType}. This attribute "); - _builder_19.newLine(); - _builder_19.append("\t\t\t"); - _builder_19.append("can then be declared in respective {@link Annotation} instances."); - PostprocessingHelpers.setDocumentation(cls, _builder_19.toString()); - EAttribute _attribute_6 = PostprocessingHelpers.getAttribute(cls, "optional"); - StringConcatenation _builder_20 = new StringConcatenation(); - _builder_20.append("Specifies whether the attribute should be optional or not. If the "); - _builder_20.newLine(); - _builder_20.append("\t\t\t"); - _builder_20.append("attribute is optional, it can be omitted by {@link Annotation}s of "); - _builder_20.newLine(); - _builder_20.append("\t\t\t"); - _builder_20.append("the same {@link AnnotationType}."); - _builder_20.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_6, _builder_20.toString()); - EAttribute _attribute_7 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_21 = new StringConcatenation(); - _builder_21.append("The name of the attribute"); - PostprocessingHelpers.setDocumentation(_attribute_7, _builder_21.toString()); - EClass _class_7 = PostprocessingHelpers.getClass(pckg, "SimpleAnnotationAttribute"); - cls = _class_7; - StringConcatenation _builder_22 = new StringConcatenation(); - _builder_22.append("An {@link AnnotationAttribute} that is associated with a "); - _builder_22.newLine(); - _builder_22.append("\t\t\t"); - _builder_22.append("{@link LiteralType}."); - PostprocessingHelpers.setDocumentation(cls, _builder_22.toString()); - EAttribute _attribute_8 = PostprocessingHelpers.getAttribute(cls, "type"); - StringConcatenation _builder_23 = new StringConcatenation(); - _builder_23.append("The type of the attribute"); - PostprocessingHelpers.setDocumentation(_attribute_8, _builder_23.toString()); - EClass _class_8 = PostprocessingHelpers.getClass(pckg, "EnumAnnotationAttribute"); - cls = _class_8; - StringConcatenation _builder_24 = new StringConcatenation(); - _builder_24.append("An {@link AnnotationAttribute} whose possible values are defined "); - _builder_24.newLine(); - _builder_24.append("\t\t\t"); - _builder_24.append("by a list of String values."); - PostprocessingHelpers.setDocumentation(cls, _builder_24.toString()); - EAttribute _attribute_9 = PostprocessingHelpers.getAttribute(cls, "values"); - StringConcatenation _builder_25 = new StringConcatenation(); - _builder_25.append("A list of values that define the enumeration"); - PostprocessingHelpers.setDocumentation(_attribute_9, _builder_25.toString()); - } -} diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java deleted file mode 100644 index 6281fdc5d..000000000 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug - */ -package org.eclipse.etrice.core.common.postprocessing; - -import com.google.common.base.Objects; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.EMap; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EModelElement; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@SuppressWarnings("all") -public class PostprocessingHelpers { - public static int UNBOUNDED_MULTIPLICITY = ETypedElement.UNBOUNDED_MULTIPLICITY; - - public static String JAVADOC_NEWLINE = "
"; - - public static EClass getClass(final EPackage pckg, final String name) { - EClassifier _eClassifier = pckg.getEClassifier(name); - return ((EClass) _eClassifier); - } - - public static void setDocumentation(final EModelElement eModelElement, final String documentation) { - EcoreUtil.setDocumentation(eModelElement, (PostprocessingHelpers.JAVADOC_NEWLINE + documentation)); - } - - public static EAttribute getAttribute(final EClass cls, final String name) { - EList _eAllAttributes = cls.getEAllAttributes(); - final Function1 _function = (EAttribute a) -> { - String _name = a.getName(); - return Boolean.valueOf(_name.equals(name)); - }; - return IterableExtensions.findFirst(_eAllAttributes, _function); - } - - public static EReference getReference(final EClass cls, final String name) { - EList _eAllReferences = cls.getEAllReferences(); - final Function1 _function = (EReference a) -> { - String _name = a.getName(); - return Boolean.valueOf(_name.equals(name)); - }; - return IterableExtensions.findFirst(_eAllReferences, _function); - } - - public static boolean addOperation(final EClass owner, final String name, final EClassifier type) { - return PostprocessingHelpers.addOperation(owner, name, type, Integer.valueOf(1), null); - } - - public static boolean addOperation(final EClass owner, final String name, final EClassifier type, final String body) { - return PostprocessingHelpers.addOperation(owner, name, type, Integer.valueOf(1), body); - } - - public static boolean addOperation(final EClass owner, final String name, final EClassifier type, final Integer upperBound, final String body) { - boolean _xblockexpression = false; - { - final EOperation op = EcoreFactory.eINSTANCE.createEOperation(); - op.setName(name); - op.setEType(type); - op.setUpperBound((upperBound).intValue()); - boolean _notEquals = (!Objects.equal(body, null)); - if (_notEquals) { - final EAnnotation anno = EcoreFactory.eINSTANCE.createEAnnotation(); - anno.setSource("http://www.eclipse.org/emf/2002/GenModel"); - EMap _details = anno.getDetails(); - _details.put("body", body); - EList _eAnnotations = op.getEAnnotations(); - _eAnnotations.add(anno); - } - EList _eOperations = owner.getEOperations(); - _xblockexpression = _eOperations.add(op); - } - return _xblockexpression; - } - - public static EClass addClass(final EPackage pck, final String name) { - final EClass cls = EcoreFactory.eINSTANCE.createEClass(); - cls.setName(name); - EList _eClassifiers = pck.getEClassifiers(); - _eClassifiers.add(cls); - return cls; - } -} diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/scoping/BaseScopeProvider.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/scoping/BaseScopeProvider.java deleted file mode 100644 index 84b499b84..000000000 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/scoping/BaseScopeProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Eyrak Paen (initial contribution) - */ -package org.eclipse.etrice.core.common.scoping; - -import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; - -/** - * This class contains custom scoping description. - * - * see : http://www.eclipse.org/Xtext/documentation.html#scoping - * on how and when to use it - */ -@SuppressWarnings("all") -public class BaseScopeProvider extends AbstractDeclarativeScopeProvider { -} diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/scoping/BaseTestScopeProvider.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/scoping/BaseTestScopeProvider.java deleted file mode 100644 index 0f423f1cf..000000000 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/scoping/BaseTestScopeProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * generated by Xtext - */ -package org.eclipse.etrice.core.common.scoping; - -import org.eclipse.etrice.core.common.scoping.BaseScopeProvider; - -/** - * This class contains custom scoping description. - * - * see : http://www.eclipse.org/Xtext/documentation.html#scoping - * on how and when to use it - */ -@SuppressWarnings("all") -public class BaseTestScopeProvider extends BaseScopeProvider { -} diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/validation/ValidationHelpers.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/validation/ValidationHelpers.java deleted file mode 100644 index 7510e4031..000000000 --- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/validation/ValidationHelpers.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright (c) 2014 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * hrentz (initial contribution) - */ -package org.eclipse.etrice.core.common.validation; - -import com.google.common.base.Function; -import com.google.common.base.Objects; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.function.Consumer; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.xtend.lib.Property; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.Pure; - -/** - * @author hrentz - */ -@SuppressWarnings("all") -public class ValidationHelpers { - public static class NamedObject { - @Property - private String _name; - - @Property - private EObject _obj; - - @Property - private EStructuralFeature _feature; - - public NamedObject(final String name, final EObject obj, final EStructuralFeature feature) { - this.setName(name); - this.setObj(obj); - this.setFeature(feature); - } - - @Pure - public String getName() { - return this._name; - } - - public void setName(final String name) { - this._name = name; - } - - @Pure - public EObject getObj() { - return this._obj; - } - - public void setObj(final EObject obj) { - this._obj = obj; - } - - @Pure - public EStructuralFeature getFeature() { - return this._feature; - } - - public void setFeature(final EStructuralFeature feature) { - this._feature = feature; - } - } - - public static class NamedObjectList extends ArrayList { - public void addAll(final List items, final EStructuralFeature feature) { - final Consumer _function = (EObject it) -> { - Object _eGet = it.eGet(feature); - ValidationHelpers.NamedObject _namedObject = new ValidationHelpers.NamedObject(((String) _eGet), it, feature); - this.add(_namedObject); - }; - items.forEach(_function); - } - } - - public static Iterable removeUniques(final List items) { - Iterable _xblockexpression = null; - { - final Set allOfName = CollectionLiterals.newHashSet(); - final Set duplicateNames = CollectionLiterals.newHashSet(); - for (final ValidationHelpers.NamedObject i : items) { - String _name = i.getName(); - boolean _contains = allOfName.contains(_name); - if (_contains) { - String _name_1 = i.getName(); - duplicateNames.add(_name_1); - } else { - String _name_2 = i.getName(); - allOfName.add(_name_2); - } - } - final Function1 _function = (ValidationHelpers.NamedObject i_1) -> { - String _name_3 = i_1.getName(); - return Boolean.valueOf(duplicateNames.contains(_name_3)); - }; - _xblockexpression = IterableExtensions.filter(items, _function); - } - return _xblockexpression; - } - - public static Iterable inSameResource(final Iterable items, final Resource resource) { - final Function1 _function = (ValidationHelpers.NamedObject i) -> { - EObject _obj = i.getObj(); - Resource _eResource = _obj.eResource(); - return Boolean.valueOf(Objects.equal(_eResource, resource)); - }; - return IterableExtensions.filter(items, _function); - } - - /** - * Visitor for inheritance, safeguards from null, eProxy and circular issues. - * - * @param start EObject, may be null - * @param function return null to exit - */ - public static void saveRecursiveVisitor(final E start, final Function function) { - final Set visited = CollectionLiterals.newHashSet(); - E next = start; - while ((((!Objects.equal(next, null)) && (!next.eIsProxy())) && visited.add(next))) { - E _apply = function.apply(next); - next = _apply; - } - } -} diff --git a/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/generator/ConfigGenerator.java b/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/generator/ConfigGenerator.java deleted file mode 100644 index 9a5cd6ec6..000000000 --- a/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/generator/ConfigGenerator.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.generator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.xtext.generator.IFileSystemAccess; -import org.eclipse.xtext.generator.IGenerator; - -@SuppressWarnings("all") -public class ConfigGenerator implements IGenerator { - @Override - public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { - } -} diff --git a/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.java b/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.java deleted file mode 100644 index 0de457200..000000000 --- a/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.java +++ /dev/null @@ -1,423 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.postprocessing; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -@SuppressWarnings("all") -public class DocuPostprocessor { - public void process(final GeneratedMetamodel metamodel) { - final EPackage pckg = metamodel.getEPackage(); - EClass cls = PostprocessingHelpers.getClass(pckg, "ConfigModel"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("The root object for the ROOM Config model. It gives access to"); - _builder.newLine(); - _builder.append("the {@link SubSystemConfig sub system class},"); - _builder.newLine(); - _builder.append("{@link ActorClassConfig actor class}, {@link ProtocolClassConfig protocol class} and"); - _builder.newLine(); - _builder.append("{@link ActorInstanceConfig actor instance} configurations and the room model {@link Import imports}."); - _builder.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder.toString()); - EAttribute _attribute = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("The model name is a dot separated fully qualified name and is"); - _builder_1.newLine(); - _builder_1.append("used to provide a name space."); - _builder_1.newLine(); - PostprocessingHelpers.setDocumentation(_attribute, _builder_1.toString()); - EReference _reference = PostprocessingHelpers.getReference(cls, "imports"); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("This is a list of all imported room models. The config elements reference these imports."); - _builder_2.newLine(); - PostprocessingHelpers.setDocumentation(_reference, _builder_2.toString()); - EReference _reference_1 = PostprocessingHelpers.getReference(cls, "configElements"); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("This is a list of all top level config elements"); - _builder_3.newLine(); - PostprocessingHelpers.setDocumentation(_reference_1, _builder_3.toString()); - EClass _class = PostprocessingHelpers.getClass(pckg, "ConfigElement"); - cls = _class; - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("This is the super class of the top level config elements"); - _builder_4.newLine(); - _builder_4.append("
    "); - _builder_4.newLine(); - _builder_4.append("\t"); - _builder_4.append("
  • {@link SubSystemConfig}
  • "); - _builder_4.newLine(); - _builder_4.append("\t"); - _builder_4.append("
  • {@link ActorClassConfig}
  • "); - _builder_4.newLine(); - _builder_4.append("\t"); - _builder_4.append("
  • {@link ActorInstanceConfig}
  • "); - _builder_4.newLine(); - _builder_4.append("\t"); - _builder_4.append("
  • {@link ProtocolClassConfig}
  • "); - _builder_4.newLine(); - _builder_4.append("
"); - _builder_4.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_4.toString()); - EClass _class_1 = PostprocessingHelpers.getClass(pckg, "SubSystemConfig"); - cls = _class_1; - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("This class defines settings with a sub system scope."); - _builder_5.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_5.toString()); - EReference _reference_2 = PostprocessingHelpers.getReference(cls, "root"); - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("This is the logical system that contains the {@link org.eclipse.etrice.core.room.SubSystemRef sub system reference}."); - _builder_6.newLine(); - PostprocessingHelpers.setDocumentation(_reference_2, _builder_6.toString()); - EReference _reference_3 = PostprocessingHelpers.getReference(cls, "subSystem"); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("This is the sub system reference."); - _builder_7.newLine(); - PostprocessingHelpers.setDocumentation(_reference_3, _builder_7.toString()); - EReference _reference_4 = PostprocessingHelpers.getReference(cls, "dynConfig"); - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("This is the dynamic configuration. It is available within the {@link #getSubSystem sub system}."); - _builder_8.newLine(); - PostprocessingHelpers.setDocumentation(_reference_4, _builder_8.toString()); - EClass _class_2 = PostprocessingHelpers.getClass(pckg, "DynamicConfig"); - cls = _class_2; - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append("The dynamic configuration provides a configuration at runtime."); - _builder_9.newLine(); - _builder_9.append("The source of the configuration is abstracted by an interface."); - _builder_9.newLine(); - _builder_9.append("
"); - _builder_9.newLine(); - _builder_9.append("This feature is experimental and implemented for target language java only."); - _builder_9.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_9.toString()); - EAttribute _attribute_1 = PostprocessingHelpers.getAttribute(cls, "filePath"); - StringConcatenation _builder_10 = new StringConcatenation(); - _builder_10.append("This is the file path of the configuration. In this case the source of the configuration is a simple file."); - _builder_10.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_1, _builder_10.toString()); - EAttribute _attribute_2 = PostprocessingHelpers.getAttribute(cls, "userCode1"); - StringConcatenation _builder_11 = new StringConcatenation(); - _builder_11.append("Defines the import statement for the implemenation of the configuration source."); - _builder_11.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_2, _builder_11.toString()); - EAttribute _attribute_3 = PostprocessingHelpers.getAttribute(cls, "userCode2"); - StringConcatenation _builder_12 = new StringConcatenation(); - _builder_12.append("This is the constructor statement for the implemenation of the configuration source."); - _builder_12.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_3, _builder_12.toString()); - EAttribute _attribute_4 = PostprocessingHelpers.getAttribute(cls, "polling"); - StringConcatenation _builder_13 = new StringConcatenation(); - _builder_13.append("Defines the time interval in milliseconds to query changes from the configuration source."); - _builder_13.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_4, _builder_13.toString()); - EClass _class_3 = PostprocessingHelpers.getClass(pckg, "ActorClassConfig"); - cls = _class_3; - StringConcatenation _builder_14 = new StringConcatenation(); - _builder_14.append("This class models a configuration for an {@link org.eclipse.etrice.core.room.ActorClass actor class}."); - _builder_14.newLine(); - _builder_14.append("The configuration defines the default values for all instances of the {@link #getActor actor}."); - _builder_14.newLine(); - _builder_14.append("The values are applied at generation time."); - _builder_14.newLine(); - _builder_14.append("The config sub elements are:"); - _builder_14.newLine(); - _builder_14.append("
    "); - _builder_14.newLine(); - _builder_14.append("\t"); - _builder_14.append("
  • {@link AttrClassConfig attribute class config}
  • "); - _builder_14.newLine(); - _builder_14.append("
\t\t\t\t"); - _builder_14.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_14.toString()); - EReference _reference_5 = PostprocessingHelpers.getReference(cls, "actor"); - StringConcatenation _builder_15 = new StringConcatenation(); - _builder_15.append("This is the actor class."); - _builder_15.newLine(); - PostprocessingHelpers.setDocumentation(_reference_5, _builder_15.toString()); - EReference _reference_6 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_16 = new StringConcatenation(); - _builder_16.append("This is a list of all attribute configurations."); - _builder_16.newLine(); - PostprocessingHelpers.setDocumentation(_reference_6, _builder_16.toString()); - EClass _class_4 = PostprocessingHelpers.getClass(pckg, "ProtocolClassConfig"); - cls = _class_4; - StringConcatenation _builder_17 = new StringConcatenation(); - _builder_17.append("This class models a configuration for an {@link org.eclipse.etrice.core.room.ProtocolClass protocol class}."); - _builder_17.newLine(); - _builder_17.append("The config sub elements are:"); - _builder_17.newLine(); - _builder_17.append("
    "); - _builder_17.newLine(); - _builder_17.append("\t"); - _builder_17.append("
  • a {@link PortClassConfig port class config} for the regular port class
  • "); - _builder_17.newLine(); - _builder_17.append("\t"); - _builder_17.append("
  • a {@link PortClassConfig port class config} for the conjugate port class
  • "); - _builder_17.newLine(); - _builder_17.append("
"); - _builder_17.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_17.toString()); - EReference _reference_7 = PostprocessingHelpers.getReference(cls, "protocol"); - StringConcatenation _builder_18 = new StringConcatenation(); - _builder_18.append("This is the protocol class."); - _builder_18.newLine(); - PostprocessingHelpers.setDocumentation(_reference_7, _builder_18.toString()); - EReference _reference_8 = PostprocessingHelpers.getReference(cls, "regular"); - StringConcatenation _builder_19 = new StringConcatenation(); - _builder_19.append("This is the configuration for the regular part of the protocol."); - _builder_19.newLine(); - PostprocessingHelpers.setDocumentation(_reference_8, _builder_19.toString()); - EReference _reference_9 = PostprocessingHelpers.getReference(cls, "conjugated"); - StringConcatenation _builder_20 = new StringConcatenation(); - _builder_20.append("This is the configuration for the conjugated part of the protocol."); - _builder_20.newLine(); - PostprocessingHelpers.setDocumentation(_reference_9, _builder_20.toString()); - EClass _class_5 = PostprocessingHelpers.getClass(pckg, "PortClassConfig"); - cls = _class_5; - StringConcatenation _builder_21 = new StringConcatenation(); - _builder_21.append("This class models a configuration for an {@link org.eclipse.etrice.core.room.PortClass port class}."); - _builder_21.newLine(); - _builder_21.append("The configuration defines the default values for all instances of the port."); - _builder_21.newLine(); - _builder_21.append("The values are applied at generation time."); - _builder_21.newLine(); - _builder_21.append("The config sub elements are:"); - _builder_21.newLine(); - _builder_21.append("
    "); - _builder_21.newLine(); - _builder_21.append("\t"); - _builder_21.append("
  • {@link AttrClassConfig attribute class config}
  • "); - _builder_21.newLine(); - _builder_21.append("
"); - _builder_21.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_21.toString()); - EReference _reference_10 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_22 = new StringConcatenation(); - _builder_22.append("This is a list of all attribute configurations."); - _builder_22.newLine(); - PostprocessingHelpers.setDocumentation(_reference_10, _builder_22.toString()); - EClass _class_6 = PostprocessingHelpers.getClass(pckg, "ActorInstanceConfig"); - cls = _class_6; - StringConcatenation _builder_23 = new StringConcatenation(); - _builder_23.append("This class models a configuration for an {@link org.eclipse.etrice.core.room.ActorRef actor instance}."); - _builder_23.newLine(); - _builder_23.append("The configuration defines values for this actor instance and overrides the default values from the corresponding class config."); - _builder_23.newLine(); - _builder_23.append("The values are applied at generation time."); - _builder_23.newLine(); - _builder_23.append("The config sub elements are:"); - _builder_23.newLine(); - _builder_23.append("
    "); - _builder_23.newLine(); - _builder_23.append("\t"); - _builder_23.append("
  • {@link AttrInstanceConfig attribute instance config}
  • "); - _builder_23.newLine(); - _builder_23.append("
\t\t\t\t"); - _builder_23.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_23.toString()); - EReference _reference_11 = PostprocessingHelpers.getReference(cls, "root"); - StringConcatenation _builder_24 = new StringConcatenation(); - _builder_24.append("This is the logical system that contains the {@link #getSubSystem sub system}."); - _builder_24.newLine(); - PostprocessingHelpers.setDocumentation(_reference_11, _builder_24.toString()); - EReference _reference_12 = PostprocessingHelpers.getReference(cls, "subSystem"); - StringConcatenation _builder_25 = new StringConcatenation(); - _builder_25.append("This is the sub system that contains the {@link #getPath actor instance}."); - _builder_25.newLine(); - PostprocessingHelpers.setDocumentation(_reference_12, _builder_25.toString()); - EReference _reference_13 = PostprocessingHelpers.getReference(cls, "path"); - StringConcatenation _builder_26 = new StringConcatenation(); - _builder_26.append("This is the path of the actor instance relative to the {@link #getSubSystem sub system}."); - _builder_26.newLine(); - PostprocessingHelpers.setDocumentation(_reference_13, _builder_26.toString()); - EReference _reference_14 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_27 = new StringConcatenation(); - _builder_27.append("This is a list of all attribute configurations."); - _builder_27.newLine(); - PostprocessingHelpers.setDocumentation(_reference_14, _builder_27.toString()); - EReference _reference_15 = PostprocessingHelpers.getReference(cls, "ports"); - StringConcatenation _builder_28 = new StringConcatenation(); - _builder_28.append("This is a list of all port configurations."); - _builder_28.newLine(); - PostprocessingHelpers.setDocumentation(_reference_15, _builder_28.toString()); - EClass _class_7 = PostprocessingHelpers.getClass(pckg, "PortInstanceConfig"); - cls = _class_7; - StringConcatenation _builder_29 = new StringConcatenation(); - _builder_29.append("This class models a configuration for an {@link org.eclipse.etrice.core.room.InterfaceItem interface item} (e.g. port instance)."); - _builder_29.newLine(); - _builder_29.append("The configuration defines values for this interface item and overrides the default values from the corresponding class config."); - _builder_29.newLine(); - _builder_29.append("The values are applied at generation time."); - _builder_29.newLine(); - _builder_29.append("The config sub elements are:"); - _builder_29.newLine(); - _builder_29.append("
    "); - _builder_29.newLine(); - _builder_29.append("\t"); - _builder_29.append("
  • {@link AttrInstanceConfig attribute instance config}
  • "); - _builder_29.newLine(); - _builder_29.append("
\t\t\t\t"); - _builder_29.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_29.toString()); - EReference _reference_16 = PostprocessingHelpers.getReference(cls, "item"); - StringConcatenation _builder_30 = new StringConcatenation(); - _builder_30.append("This is the interface item."); - _builder_30.newLine(); - PostprocessingHelpers.setDocumentation(_reference_16, _builder_30.toString()); - EReference _reference_17 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_31 = new StringConcatenation(); - _builder_31.append("This is a list of all attribute configurations."); - _builder_31.newLine(); - PostprocessingHelpers.setDocumentation(_reference_17, _builder_31.toString()); - EClass _class_8 = PostprocessingHelpers.getClass(pckg, "AttrConfig"); - cls = _class_8; - StringConcatenation _builder_32 = new StringConcatenation(); - _builder_32.append("It is the super class of"); - _builder_32.newLine(); - _builder_32.append("
    "); - _builder_32.newLine(); - _builder_32.append("\t"); - _builder_32.append("
  • {@link AttrClassConfig}
  • "); - _builder_32.newLine(); - _builder_32.append("\t"); - _builder_32.append("
  • {@link AttrInstanceConfig}
  • "); - _builder_32.newLine(); - _builder_32.append("
\t\t\t\t"); - _builder_32.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_32.toString()); - EReference _reference_18 = PostprocessingHelpers.getReference(cls, "attribute"); - StringConcatenation _builder_33 = new StringConcatenation(); - _builder_33.append("This is the attribute."); - _builder_33.newLine(); - PostprocessingHelpers.setDocumentation(_reference_18, _builder_33.toString()); - EReference _reference_19 = PostprocessingHelpers.getReference(cls, "value"); - StringConcatenation _builder_34 = new StringConcatenation(); - _builder_34.append("This is the value of {@link #getAttribute attribute}."); - _builder_34.newLine(); - PostprocessingHelpers.setDocumentation(_reference_19, _builder_34.toString()); - EClass _class_9 = PostprocessingHelpers.getClass(pckg, "AttrClassConfig"); - cls = _class_9; - StringConcatenation _builder_35 = new StringConcatenation(); - _builder_35.append("This class models a configuration for an {@link org.eclipse.etrice.core.room.Attribute attribute}."); - _builder_35.newLine(); - _builder_35.append("The configuration defines a default value for all instances of the attribute."); - _builder_35.newLine(); - _builder_35.append("The values are applied at generation time."); - _builder_35.newLine(); - _builder_35.append("
If the type of the given {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is"); - _builder_35.newLine(); - _builder_35.append("
    "); - _builder_35.newLine(); - _builder_35.append("\t"); - _builder_35.append("
  • primitive, then a {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} might exist and {@link #getAttributes attributes} is empty
  • "); - _builder_35.newLine(); - _builder_35.append("\t"); - _builder_35.append("
  • compound attribute (e.g. {@link org.eclipse.etrice.core.room.DataClass data class}), then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is null and configurations for children {@link #getAttributes attributes} might exist
  • "); - _builder_35.newLine(); - _builder_35.append("
\t\t\t\t"); - _builder_35.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_35.toString()); - EReference _reference_20 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_36 = new StringConcatenation(); - _builder_36.append("This is a list of attribute configurations of children attributes, in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is compound."); - _builder_36.newLine(); - PostprocessingHelpers.setDocumentation(_reference_20, _builder_36.toString()); - EReference _reference_21 = PostprocessingHelpers.getReference(cls, "min"); - StringConcatenation _builder_37 = new StringConcatenation(); - _builder_37.append("This is the lower bound of {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} , in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} has a numerical value."); - _builder_37.newLine(); - PostprocessingHelpers.setDocumentation(_reference_21, _builder_37.toString()); - EReference _reference_22 = PostprocessingHelpers.getReference(cls, "max"); - StringConcatenation _builder_38 = new StringConcatenation(); - _builder_38.append("This is the upper bound of {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} , in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} has a numerical value."); - _builder_38.newLine(); - PostprocessingHelpers.setDocumentation(_reference_22, _builder_38.toString()); - EClass _class_10 = PostprocessingHelpers.getClass(pckg, "AttrInstanceConfig"); - cls = _class_10; - StringConcatenation _builder_39 = new StringConcatenation(); - _builder_39.append("This class models a configuration for an {@link org.eclipse.etrice.core.room.Attribute attribute}."); - _builder_39.newLine(); - _builder_39.append("The configuration defines values for this attribute instance and overrides the default values from the corresponding class config."); - _builder_39.newLine(); - _builder_39.append("The values are applied at generation time."); - _builder_39.newLine(); - _builder_39.append("
If the type of the given {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is"); - _builder_39.newLine(); - _builder_39.append("
    "); - _builder_39.newLine(); - _builder_39.append("\t"); - _builder_39.append("
  • primitive, then a {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} might exist and {@link #getAttributes attributes} is empty
  • "); - _builder_39.newLine(); - _builder_39.append("\t"); - _builder_39.append("
  • compound attribute (e.g. {@link org.eclipse.etrice.core.room.DataClass data class}), then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is null and configurations for children {@link #getAttributes attributes} might exist
  • "); - _builder_39.newLine(); - _builder_39.append("
\t\t\t\t"); - _builder_39.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_39.toString()); - EReference _reference_23 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_40 = new StringConcatenation(); - _builder_40.append("This is a list of attribute configurations of children attributes, in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is compound."); - _builder_40.newLine(); - PostprocessingHelpers.setDocumentation(_reference_23, _builder_40.toString()); - EAttribute _attribute_5 = PostprocessingHelpers.getAttribute(cls, "dynConfig"); - StringConcatenation _builder_41 = new StringConcatenation(); - _builder_41.append("If the dynamic configuration options is activated for this attribute, then the values are set at runtime by the means of the {@link DynamicConfig dynamic config}."); - _builder_41.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_5, _builder_41.toString()); - EAttribute _attribute_6 = PostprocessingHelpers.getAttribute(cls, "readOnly"); - StringConcatenation _builder_42 = new StringConcatenation(); - _builder_42.append("Controls the behavior of the dynamic configuration. If set to false, then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is updated (overwritten) if changes occur in the external configuration, "); - _builder_42.newLine(); - _builder_42.append("otherwise set to true, then changes in {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} (that occur from within the system) are recorded to the external configuration."); - _builder_42.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_6, _builder_42.toString()); - EClass _class_11 = PostprocessingHelpers.getClass(pckg, "RefPath"); - cls = _class_11; - StringConcatenation _builder_43 = new StringConcatenation(); - _builder_43.append("A path of strings that are interpreted as {@link org.eclipse.etrice.core.room.ActorRef}s starting at a {@link org.eclipse.etrice.core.room.SubSystemClass}."); - _builder_43.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_43.toString()); - EReference _reference_24 = PostprocessingHelpers.getReference(cls, "refs"); - StringConcatenation _builder_44 = new StringConcatenation(); - _builder_44.append("This is a path in the instance tree where each segment corresponds to the name of the"); - _builder_44.newLine(); - _builder_44.append("corresponding {@link {@link org.eclipse.etrice.core.room.ActorContainerRef}}."); - _builder_44.newLine(); - PostprocessingHelpers.setDocumentation(_reference_24, _builder_44.toString()); - EClass _class_12 = PostprocessingHelpers.getClass(pckg, "RefSegment"); - cls = _class_12; - StringConcatenation _builder_45 = new StringConcatenation(); - _builder_45.append("A segment of a {@link RefPath}. It consists of a name and an optional index."); - _builder_45.newLine(); - _builder_45.append("If the index is not set it will be {@code -1}."); - _builder_45.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_45.toString()); - EAttribute _attribute_7 = PostprocessingHelpers.getAttribute(cls, "ref"); - StringConcatenation _builder_46 = new StringConcatenation(); - _builder_46.append("The segment name corresponding to an actor reference."); - _builder_46.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_7, _builder_46.toString()); - EAttribute _attribute_8 = PostprocessingHelpers.getAttribute(cls, "idx"); - StringConcatenation _builder_47 = new StringConcatenation(); - _builder_47.append("The optional index of the reference (for replicated actors)."); - _builder_47.newLine(); - _builder_47.append("If not set the index is {@code -1}."); - _builder_47.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_8, _builder_47.toString()); - } -} diff --git a/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostProcessing.java b/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostProcessing.java deleted file mode 100644 index be12d889f..000000000 --- a/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostProcessing.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug - */ -package org.eclipse.etrice.core.postprocessing; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -@SuppressWarnings("all") -public class ImplPostProcessing { - public boolean process(final GeneratedMetamodel metamodel) { - boolean _xblockexpression = false; - { - final EPackage configPackage = metamodel.getEPackage(); - final EClass configModel = PostprocessingHelpers.getClass(configPackage, "ConfigModel"); - EClassifier _eClassifier = configPackage.getEClassifier("ActorClassConfig"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("EList list = new org.eclipse.emf.common.util.BasicEList();"); - _builder.newLine(); - _builder.append("for(ConfigElement element : this.getConfigElements())"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("if(element instanceof ActorClassConfig)"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("list.add((ActorClassConfig) element);"); - _builder.newLine(); - _builder.append("return list;"); - _builder.newLine(); - PostprocessingHelpers.addOperation(configModel, - "getActorClassConfigs", _eClassifier, - Integer.valueOf(PostprocessingHelpers.UNBOUNDED_MULTIPLICITY), _builder.toString()); - EClassifier _eClassifier_1 = configPackage.getEClassifier("ActorInstanceConfig"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("EList list = new org.eclipse.emf.common.util.BasicEList();"); - _builder_1.newLine(); - _builder_1.append("for(ConfigElement element : this.getConfigElements())"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("if(element instanceof ActorInstanceConfig)"); - _builder_1.newLine(); - _builder_1.append("\t\t"); - _builder_1.append("list.add((ActorInstanceConfig) element);"); - _builder_1.newLine(); - _builder_1.append("return list;"); - PostprocessingHelpers.addOperation(configModel, - "getActorInstanceConfigs", _eClassifier_1, - Integer.valueOf(PostprocessingHelpers.UNBOUNDED_MULTIPLICITY), _builder_1.toString()); - EClassifier _eClassifier_2 = configPackage.getEClassifier("ProtocolClassConfig"); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("EList list = new org.eclipse.emf.common.util.BasicEList();"); - _builder_2.newLine(); - _builder_2.append("for(ConfigElement element : this.getConfigElements())"); - _builder_2.newLine(); - _builder_2.append("\t"); - _builder_2.append("if(element instanceof ProtocolClassConfig)"); - _builder_2.newLine(); - _builder_2.append("\t\t"); - _builder_2.append("list.add((ProtocolClassConfig) element);"); - _builder_2.newLine(); - _builder_2.append("return list;"); - _builder_2.newLine(); - PostprocessingHelpers.addOperation(configModel, - "getProtocolClassConfigs", _eClassifier_2, - Integer.valueOf(PostprocessingHelpers.UNBOUNDED_MULTIPLICITY), _builder_2.toString()); - EClassifier _eClassifier_3 = configPackage.getEClassifier("SubSystemConfig"); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("EList list = new org.eclipse.emf.common.util.BasicEList();"); - _builder_3.newLine(); - _builder_3.append("for(ConfigElement element : this.getConfigElements())"); - _builder_3.newLine(); - _builder_3.append("\t"); - _builder_3.append("if(element instanceof SubSystemConfig)"); - _builder_3.newLine(); - _builder_3.append("\t\t"); - _builder_3.append("list.add((SubSystemConfig) element);"); - _builder_3.newLine(); - _builder_3.append("return list;"); - PostprocessingHelpers.addOperation(configModel, - "getSubSystemConfigs", _eClassifier_3, - Integer.valueOf(PostprocessingHelpers.UNBOUNDED_MULTIPLICITY), _builder_3.toString()); - final EClass refSeg = PostprocessingHelpers.getClass(configPackage, "RefSegment"); - EAttribute _attribute = PostprocessingHelpers.getAttribute(refSeg, "idx"); - _attribute.setDefaultValueLiteral("-1"); - EClassifier _eClassifier_4 = EcorePackage.eINSTANCE.getEClassifier("EString"); - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("return getRef() + ((getIdx()>=0)? \":\"+getIdx() : \"\");"); - _builder_4.newLine(); - _xblockexpression = PostprocessingHelpers.addOperation(refSeg, - "toString", _eClassifier_4, - Integer.valueOf(1), _builder_4.toString()); - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/generator/ETMapGenerator.java b/plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/generator/ETMapGenerator.java deleted file mode 100644 index 4239a3a4f..000000000 --- a/plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/generator/ETMapGenerator.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.etmap.generator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.xtext.generator.IFileSystemAccess; -import org.eclipse.xtext.generator.IGenerator; - -@SuppressWarnings("all") -public class ETMapGenerator implements IGenerator { - @Override - public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { - } -} diff --git a/plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/postprocessing/DocuPostprocessor.java b/plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/postprocessing/DocuPostprocessor.java deleted file mode 100644 index e26d66fff..000000000 --- a/plugins/org.eclipse.etrice.core.etmap/xtend-gen/org/eclipse/etrice/core/etmap/postprocessing/DocuPostprocessor.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.etmap.postprocessing; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -@SuppressWarnings("all") -public class DocuPostprocessor { - public void process(final GeneratedMetamodel metamodel) { - final EPackage pckg = metamodel.getEPackage(); - EClass cls = PostprocessingHelpers.getClass(pckg, "MappingModel"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("The root object for the mapping model. It gives access to the mappings defined."); - _builder.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder.toString()); - EAttribute _attribute = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("The model name is a dot separated fully qualified name and is"); - _builder_1.newLine(); - _builder_1.append("used to provide a name space."); - _builder_1.newLine(); - PostprocessingHelpers.setDocumentation(_attribute, _builder_1.toString()); - EReference _reference = PostprocessingHelpers.getReference(cls, "imports"); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("A list of all imported models."); - _builder_2.newLine(); - PostprocessingHelpers.setDocumentation(_reference, _builder_2.toString()); - EReference _reference_1 = PostprocessingHelpers.getReference(cls, "mappings"); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("A list of all defined mappings."); - _builder_3.newLine(); - PostprocessingHelpers.setDocumentation(_reference_1, _builder_3.toString()); - EClass _class = PostprocessingHelpers.getClass(pckg, "Mapping"); - cls = _class; - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("This is the mapping of a logical system (defined in a ROOM model) to a"); - _builder_4.newLine(); - _builder_4.append("physical system (defined in a physical model)."); - _builder_4.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_4.toString()); - EReference _reference_2 = PostprocessingHelpers.getReference(cls, "logicalSys"); - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("This is the logical system being mapped."); - _builder_5.newLine(); - PostprocessingHelpers.setDocumentation(_reference_2, _builder_5.toString()); - EReference _reference_3 = PostprocessingHelpers.getReference(cls, "physicalSys"); - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("This is the physical system being mapped to."); - _builder_6.newLine(); - PostprocessingHelpers.setDocumentation(_reference_3, _builder_6.toString()); - EReference _reference_4 = PostprocessingHelpers.getReference(cls, "subsysMappings"); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("This is a list of nested mappings of the sub systems of this system."); - _builder_7.newLine(); - PostprocessingHelpers.setDocumentation(_reference_4, _builder_7.toString()); - EClass _class_1 = PostprocessingHelpers.getClass(pckg, "SubSystemMapping"); - cls = _class_1; - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("This is the mapping of a sub system (defined in a ROOM model) to a"); - _builder_8.newLine(); - _builder_8.append("node (defined in a physical model)."); - _builder_8.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_8.toString()); - EReference _reference_5 = PostprocessingHelpers.getReference(cls, "logicalSubSys"); - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append("This is the logical sub system being mapped."); - _builder_9.newLine(); - PostprocessingHelpers.setDocumentation(_reference_5, _builder_9.toString()); - EReference _reference_6 = PostprocessingHelpers.getReference(cls, "node"); - StringConcatenation _builder_10 = new StringConcatenation(); - _builder_10.append("This is the node being mapped to."); - _builder_10.newLine(); - PostprocessingHelpers.setDocumentation(_reference_6, _builder_10.toString()); - EReference _reference_7 = PostprocessingHelpers.getReference(cls, "threadMappings"); - StringConcatenation _builder_11 = new StringConcatenation(); - _builder_11.append("This is a list of nested mappings of logical to physical threads."); - _builder_11.newLine(); - PostprocessingHelpers.setDocumentation(_reference_7, _builder_11.toString()); - EClass _class_2 = PostprocessingHelpers.getClass(pckg, "ThreadMapping"); - cls = _class_2; - StringConcatenation _builder_12 = new StringConcatenation(); - _builder_12.append("This is the mapping of a logical thread (defined in a ROOM model) to a"); - _builder_12.newLine(); - _builder_12.append("physical thread (defined in a physical model)."); - _builder_12.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_12.toString()); - EReference _reference_8 = PostprocessingHelpers.getReference(cls, "logicalThread"); - StringConcatenation _builder_13 = new StringConcatenation(); - _builder_13.append("This is the logical thread being mapped."); - _builder_13.newLine(); - PostprocessingHelpers.setDocumentation(_reference_8, _builder_13.toString()); - EReference _reference_9 = PostprocessingHelpers.getReference(cls, "physicalThread"); - StringConcatenation _builder_14 = new StringConcatenation(); - _builder_14.append("This is the physical thread being mapped to."); - _builder_14.newLine(); - PostprocessingHelpers.setDocumentation(_reference_9, _builder_14.toString()); - } -} diff --git a/plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/generator/ETPhysGenerator.java b/plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/generator/ETPhysGenerator.java deleted file mode 100644 index b0e8640b9..000000000 --- a/plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/generator/ETPhysGenerator.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.etphys.generator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.xtext.generator.IFileSystemAccess; -import org.eclipse.xtext.generator.IGenerator; - -@SuppressWarnings("all") -public class ETPhysGenerator implements IGenerator { - @Override - public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { - } -} diff --git a/plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/postprocessing/DocuPostprocessor.java b/plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/postprocessing/DocuPostprocessor.java deleted file mode 100644 index 0efefbd53..000000000 --- a/plugins/org.eclipse.etrice.core.etphys/xtend-gen/org/eclipse/etrice/core/etphys/postprocessing/DocuPostprocessor.java +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.etphys.postprocessing; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -@SuppressWarnings("all") -public class DocuPostprocessor { - public void process(final GeneratedMetamodel metamodel) { - final EPackage pckg = metamodel.getEPackage(); - EClass cls = PostprocessingHelpers.getClass(pckg, "PhysicalModel"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("The root object for the physical model. It gives access to the systems, node classes"); - _builder.newLine(); - _builder.append("and runtimes defined."); - _builder.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder.toString()); - EAttribute _attribute = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("The model name is a dot separated fully qualified name and is"); - _builder_1.newLine(); - _builder_1.append("used to provide a name space."); - _builder_1.newLine(); - PostprocessingHelpers.setDocumentation(_attribute, _builder_1.toString()); - EReference _reference = PostprocessingHelpers.getReference(cls, "imports"); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("A list of all imported models."); - _builder_2.newLine(); - PostprocessingHelpers.setDocumentation(_reference, _builder_2.toString()); - EReference _reference_1 = PostprocessingHelpers.getReference(cls, "systems"); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("A list of all defined physical systems."); - _builder_3.newLine(); - PostprocessingHelpers.setDocumentation(_reference_1, _builder_3.toString()); - EReference _reference_2 = PostprocessingHelpers.getReference(cls, "nodeClasses"); - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("A list of all defined node classes."); - _builder_4.newLine(); - PostprocessingHelpers.setDocumentation(_reference_2, _builder_4.toString()); - EReference _reference_3 = PostprocessingHelpers.getReference(cls, "runtimeClasses"); - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("A list of all defined runtime classes."); - _builder_5.newLine(); - PostprocessingHelpers.setDocumentation(_reference_3, _builder_5.toString()); - EClass _class = PostprocessingHelpers.getClass(pckg, "PhysicalSystem"); - cls = _class; - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("This model object represents a complete physical system."); - _builder_6.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_6.toString()); - EAttribute _attribute_1 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("The name of the physical system by which it is referred to in the model."); - _builder_7.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_1, _builder_7.toString()); - EReference _reference_4 = PostprocessingHelpers.getReference(cls, "nodeRefs"); - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("A list of referenced nodes."); - _builder_8.newLine(); - PostprocessingHelpers.setDocumentation(_reference_4, _builder_8.toString()); - EReference _reference_5 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append("This is an optional documentation."); - _builder_9.newLine(); - PostprocessingHelpers.setDocumentation(_reference_5, _builder_9.toString()); - EClass _class_1 = PostprocessingHelpers.getClass(pckg, "NodeRef"); - cls = _class_1; - StringConcatenation _builder_10 = new StringConcatenation(); - _builder_10.append("This stands for a node instance in a specific role."); - _builder_10.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_10.toString()); - EAttribute _attribute_2 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_11 = new StringConcatenation(); - _builder_11.append("The name of the reference by which it is referred to in the model."); - _builder_11.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_2, _builder_11.toString()); - EReference _reference_6 = PostprocessingHelpers.getReference(cls, "type"); - StringConcatenation _builder_12 = new StringConcatenation(); - _builder_12.append("The node class of this reference."); - _builder_12.newLine(); - PostprocessingHelpers.setDocumentation(_reference_6, _builder_12.toString()); - EReference _reference_7 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_13 = new StringConcatenation(); - _builder_13.append("This is an optional documentation."); - _builder_13.newLine(); - PostprocessingHelpers.setDocumentation(_reference_7, _builder_13.toString()); - EClass _class_2 = PostprocessingHelpers.getClass(pckg, "NodeClass"); - cls = _class_2; - StringConcatenation _builder_14 = new StringConcatenation(); - _builder_14.append("This defines a node class."); - _builder_14.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_14.toString()); - EAttribute _attribute_3 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_15 = new StringConcatenation(); - _builder_15.append("The name of the node class by which it is referred to in the model."); - _builder_15.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_3, _builder_15.toString()); - EReference _reference_8 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_16 = new StringConcatenation(); - _builder_16.append("This is an optional documentation."); - _builder_16.newLine(); - PostprocessingHelpers.setDocumentation(_reference_8, _builder_16.toString()); - EReference _reference_9 = PostprocessingHelpers.getReference(cls, "runtime"); - StringConcatenation _builder_17 = new StringConcatenation(); - _builder_17.append("This is the associated runtime class."); - _builder_17.newLine(); - PostprocessingHelpers.setDocumentation(_reference_9, _builder_17.toString()); - EAttribute _attribute_4 = PostprocessingHelpers.getAttribute(cls, "priomin"); - StringConcatenation _builder_18 = new StringConcatenation(); - _builder_18.append("This is the minimal thread priority for this node type."); - _builder_18.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_4, _builder_18.toString()); - EAttribute _attribute_5 = PostprocessingHelpers.getAttribute(cls, "priomax"); - StringConcatenation _builder_19 = new StringConcatenation(); - _builder_19.append("This is the maximum thread priority for this node type."); - _builder_19.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_5, _builder_19.toString()); - EReference _reference_10 = PostprocessingHelpers.getReference(cls, "threads"); - StringConcatenation _builder_20 = new StringConcatenation(); - _builder_20.append("This is a list of all threads defined for this node."); - _builder_20.newLine(); - PostprocessingHelpers.setDocumentation(_reference_10, _builder_20.toString()); - EClass _class_3 = PostprocessingHelpers.getClass(pckg, "PhysicalThread"); - cls = _class_3; - StringConcatenation _builder_21 = new StringConcatenation(); - _builder_21.append("This defines a physical thread running in a node."); - _builder_21.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_21.toString()); - EAttribute _attribute_6 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_22 = new StringConcatenation(); - _builder_22.append("The name of the thread by which it is referred to in the model."); - _builder_22.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_6, _builder_22.toString()); - EAttribute _attribute_7 = PostprocessingHelpers.getAttribute(cls, "default"); - StringConcatenation _builder_23 = new StringConcatenation(); - _builder_23.append("If this is {@code true} then this is the default thread."); - _builder_23.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_7, _builder_23.toString()); - EAttribute _attribute_8 = PostprocessingHelpers.getAttribute(cls, "execmode"); - StringConcatenation _builder_24 = new StringConcatenation(); - _builder_24.append("This is the execution mode of the thread."); - _builder_24.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_8, _builder_24.toString()); - EAttribute _attribute_9 = PostprocessingHelpers.getAttribute(cls, "prio"); - StringConcatenation _builder_25 = new StringConcatenation(); - _builder_25.append("This is the priority of the thread."); - _builder_25.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_9, _builder_25.toString()); - EAttribute _attribute_10 = PostprocessingHelpers.getAttribute(cls, "stacksize"); - StringConcatenation _builder_26 = new StringConcatenation(); - _builder_26.append("This is the stacksize of the thread."); - _builder_26.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_10, _builder_26.toString()); - EAttribute _attribute_11 = PostprocessingHelpers.getAttribute(cls, "msgblocksize"); - StringConcatenation _builder_27 = new StringConcatenation(); - _builder_27.append("This is the msgblocksize of the thread."); - _builder_27.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_11, _builder_27.toString()); - EAttribute _attribute_12 = PostprocessingHelpers.getAttribute(cls, "msgpoolsize"); - StringConcatenation _builder_28 = new StringConcatenation(); - _builder_28.append("This is the msgpoolsize of the thread."); - _builder_28.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_12, _builder_28.toString()); - EClass _class_4 = PostprocessingHelpers.getClass(pckg, "RuntimeClass"); - cls = _class_4; - StringConcatenation _builder_29 = new StringConcatenation(); - _builder_29.append("This defines a runtime class."); - _builder_29.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_29.toString()); - EAttribute _attribute_13 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_30 = new StringConcatenation(); - _builder_30.append("The name of the runtime class by which it is referred to in the model."); - _builder_30.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_13, _builder_30.toString()); - EReference _reference_11 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_31 = new StringConcatenation(); - _builder_31.append("This is an optional documentation."); - _builder_31.newLine(); - PostprocessingHelpers.setDocumentation(_reference_11, _builder_31.toString()); - EAttribute _attribute_14 = PostprocessingHelpers.getAttribute(cls, "threadModel"); - StringConcatenation _builder_32 = new StringConcatenation(); - _builder_32.append("This distinguishes single and multi threaded."); - _builder_32.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_14, _builder_32.toString()); - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/contentassist/FSMProposalProvider.java b/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/contentassist/FSMProposalProvider.java deleted file mode 100644 index cc5aa2625..000000000 --- a/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/contentassist/FSMProposalProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.fsm.ui.contentassist; - -import org.eclipse.etrice.core.fsm.ui.contentassist.AbstractFSMProposalProvider; - -/** - * see http://www.eclipse.org/Xtext/documentation.html#contentAssist on how to customize content assistant - */ -@SuppressWarnings("all") -public class FSMProposalProvider extends AbstractFSMProposalProvider { -} diff --git a/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/labeling/FSMDescriptionLabelProvider.java b/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/labeling/FSMDescriptionLabelProvider.java deleted file mode 100644 index 761a61041..000000000 --- a/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/labeling/FSMDescriptionLabelProvider.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.fsm.ui.labeling; - -import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider; - -/** - * Provides labels for a IEObjectDescriptions and IResourceDescriptions. - * - * see http://www.eclipse.org/Xtext/documentation.html#labelProvider - */ -@SuppressWarnings("all") -public class FSMDescriptionLabelProvider extends DefaultDescriptionLabelProvider { -} diff --git a/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/labeling/FSMLabelProvider.java b/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/labeling/FSMLabelProvider.java deleted file mode 100644 index f51ce9bad..000000000 --- a/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/labeling/FSMLabelProvider.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.fsm.ui.labeling; - -import com.google.inject.Inject; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.etrice.core.common.ui.labeling.BaseLabelProvider; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; -import org.eclipse.etrice.core.fsm.fSM.RefinedState; -import org.eclipse.etrice.core.fsm.fSM.SimpleState; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.fSM.Trigger; - -/** - * Provides labels for a EObjects. - * - * see http://www.eclipse.org/Xtext/documentation.html#labelProvider - */ -@SuppressWarnings("all") -public class FSMLabelProvider extends BaseLabelProvider { - @Inject - public FSMLabelProvider(final AdapterFactoryLabelProvider delegate) { - super(delegate); - } - - public String image(final SimpleState state) { - return "State.gif"; - } - - public String image(final RefinedState state) { - return "RefinedState.gif"; - } - - public String text(final State s) { - String _name = s.getName(); - return ("state " + _name); - } - - public String text(final Transition trans) { - String _name = trans.getName(); - return ("transition " + _name); - } - - public String text(final Trigger tr) { - return "trigger"; - } - - public String text(final StateGraph sm) { - String _xifexpression = null; - EObject _eContainer = sm.eContainer(); - if ((_eContainer instanceof ModelComponent)) { - _xifexpression = "state machine"; - } else { - _xifexpression = "state graph"; - } - return _xifexpression; - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/outline/FSMOutlineTreeProvider.java b/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/outline/FSMOutlineTreeProvider.java deleted file mode 100644 index 4f50df02f..000000000 --- a/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/outline/FSMOutlineTreeProvider.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.fsm.ui.outline; - -import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider; - -/** - * Customization of the default outline structure. - * - * see http://www.eclipse.org/Xtext/documentation.html#outline - */ -@SuppressWarnings("all") -public class FSMOutlineTreeProvider extends DefaultOutlineTreeProvider { -} diff --git a/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/quickfix/FSMQuickfixProvider.java b/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/quickfix/FSMQuickfixProvider.java deleted file mode 100644 index 44856ab8e..000000000 --- a/plugins/org.eclipse.etrice.core.fsm.ui/xtend-gen/org/eclipse/etrice/core/fsm/ui/quickfix/FSMQuickfixProvider.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.fsm.ui.quickfix; - -import com.google.inject.Inject; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.etrice.core.common.converter.BaseConverterService; -import org.eclipse.etrice.core.common.converter.CCStringConverter; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.fsm.validation.FSMJavaValidator; -import org.eclipse.xtext.formatting.ILineSeparatorInformation; -import org.eclipse.xtext.formatting.IWhitespaceInformationProvider; -import org.eclipse.xtext.nodemodel.ICompositeNode; -import org.eclipse.xtext.nodemodel.util.NodeModelUtils; -import org.eclipse.xtext.ui.editor.model.IXtextDocument; -import org.eclipse.xtext.ui.editor.model.edit.IModificationContext; -import org.eclipse.xtext.ui.editor.model.edit.ISemanticModification; -import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider; -import org.eclipse.xtext.ui.editor.quickfix.Fix; -import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionAcceptor; -import org.eclipse.xtext.validation.Issue; -import org.eclipse.xtext.xbase.lib.Exceptions; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ObjectExtensions; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; - -/** - * Custom quickfixes. - * - * see http://www.eclipse.org/Xtext/documentation.html#quickfixes - */ -@SuppressWarnings("all") -public class FSMQuickfixProvider extends DefaultQuickfixProvider { - @Inject - private BaseConverterService converterService; - - @Inject - private IWhitespaceInformationProvider whitespaceProvider; - - @Fix(FSMJavaValidator.PLAIN_STRING_DETAILCODE) - public void fixMultiLineDetailCode(final Issue issue, final IssueResolutionAcceptor acceptor) { - final ISemanticModification _function = (EObject element, IModificationContext context) -> { - final Procedure1 _function_1 = (DetailCode it) -> { - EList _lines = it.getLines(); - Resource _eResource = it.eResource(); - URI _uRI = _eResource.getURI(); - ILineSeparatorInformation _lineSeparatorInformation = this.whitespaceProvider.getLineSeparatorInformation(_uRI); - String _lineSeparator = _lineSeparatorInformation.getLineSeparator(); - final String ccString = IterableExtensions.join(_lines, _lineSeparator); - ICompositeNode _findActualNodeFor = NodeModelUtils.findActualNodeFor(it); - final Procedure1 _function_2 = (ICompositeNode it_1) -> { - try { - IXtextDocument _xtextDocument = context.getXtextDocument(); - int _offset = it_1.getOffset(); - int _length = it_1.getLength(); - CCStringConverter _cC_StringConverter = this.converterService.getCC_StringConverter(); - String _addDelim = _cC_StringConverter.addDelim(ccString); - _xtextDocument.replace(_offset, _length, _addDelim); - } catch (Throwable _e) { - throw Exceptions.sneakyThrow(_e); - } - }; - ObjectExtensions.operator_doubleArrow(_findActualNodeFor, _function_2); - }; - ObjectExtensions.operator_doubleArrow( - ((DetailCode) element), _function_1); - }; - acceptor.accept(issue, "Convert to smart string", "", "correction_change.gif", _function); - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.java deleted file mode 100644 index be1448dbb..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.java +++ /dev/null @@ -1,270 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.fsm.formatting2; - -import com.google.inject.Inject; -import java.util.Arrays; -import java.util.List; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.common.base.Annotation; -import org.eclipse.etrice.core.common.base.AnnotationType; -import org.eclipse.etrice.core.common.base.Documentation; -import org.eclipse.etrice.core.common.base.Import; -import org.eclipse.etrice.core.common.converter.BaseConverterService; -import org.eclipse.etrice.core.common.converter.CCStringConverter; -import org.eclipse.etrice.core.common.formatting2.BaseFormatter; -import org.eclipse.etrice.core.common.formatting2.CCStringReplacer; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.fsm.fSM.ProtocolSemantics; -import org.eclipse.etrice.core.fsm.fSM.SemanticsRule; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.fSM.Trigger; -import org.eclipse.etrice.core.fsm.fSM.TriggeredTransition; -import org.eclipse.etrice.core.fsm.services.FSMGrammarAccess; -import org.eclipse.xtext.Assignment; -import org.eclipse.xtext.formatting2.IFormattableDocument; -import org.eclipse.xtext.formatting2.IHiddenRegionFormatter; -import org.eclipse.xtext.formatting2.regionaccess.IHiddenRegion; -import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion; -import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.Pair; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; - -@SuppressWarnings("all") -public class FSMFormatter extends BaseFormatter { - @Inject - @Extension - private FSMGrammarAccess _fSMGrammarAccess; - - @Override - public void formatAllByKeywords(final EObject it, @Extension final IFormattableDocument document) { - super.formatAllByKeywords(it, document); - ISemanticRegionsFinder _allRegionsFor = this.textRegionExtensions.allRegionsFor(it); - List _keywords = _allRegionsFor.keywords("->", "extends", "=", "or", "|"); - final Consumer _function = (ISemanticRegion it_1) -> { - final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.surround(it_1, _function_1); - }; - _keywords.forEach(_function); - } - - protected EObject prependDefaultNewLines(final EObject it, @Extension final IFormattableDocument document) { - EObject _xifexpression = null; - if (((this.textRegionExtensions.previousHiddenRegion(it) != null) && (this.textRegionExtensions.previousHiddenRegion(it).getLineCount() > 2))) { - final Procedure1 _function = (IHiddenRegionFormatter it_1) -> { - it_1.setNewLines(2); - }; - _xifexpression = document.prepend(it, _function); - } else { - final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { - it_1.newLine(); - }; - _xifexpression = document.prepend(it, _function_1); - } - return _xifexpression; - } - - protected ISemanticRegion prependDefaultNewLines(final ISemanticRegion it, @Extension final IFormattableDocument document) { - ISemanticRegion _xifexpression = null; - IHiddenRegion _previousHiddenRegion = it.getPreviousHiddenRegion(); - int _lineCount = _previousHiddenRegion.getLineCount(); - boolean _greaterThan = (_lineCount > 2); - if (_greaterThan) { - final Procedure1 _function = (IHiddenRegionFormatter it_1) -> { - it_1.setNewLines(2); - }; - _xifexpression = document.prepend(it, _function); - } else { - final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { - it_1.newLine(); - }; - _xifexpression = document.prepend(it, _function_1); - } - return _xifexpression; - } - - protected void _format(final StateGraph it, @Extension final IFormattableDocument document) { - EList _eContents = it.eContents(); - final Consumer _function = (EObject it_1) -> { - this.prependDefaultNewLines(it_1, document); - }; - _eContents.forEach(_function); - } - - protected void _format(final State it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - List _keywords = _regionFor.keywords("entry", "exit", "do", "subgraph"); - final Consumer _function = (ISemanticRegion it_1) -> { - this.prependDefaultNewLines(it_1, document); - final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.append(it_1, _function_1); - }; - _keywords.forEach(_function); - } - - protected void _format(final Transition it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - List _keywords = _regionFor.keywords("action", "guard", "cond"); - final Consumer _function = (ISemanticRegion it_1) -> { - this.prependDefaultNewLines(it_1, document); - final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.append(it_1, _function_1); - }; - _keywords.forEach(_function); - } - - protected void _format(final TriggeredTransition it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - List _keywords = _regionFor.keywords("action", "guard", "cond", "triggers"); - final Consumer _function = (ISemanticRegion it_1) -> { - this.prependDefaultNewLines(it_1, document); - final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.append(it_1, _function_1); - }; - _keywords.forEach(_function); - EList _triggers = it.getTriggers(); - Trigger _head = IterableExtensions.head(_triggers); - final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { - it_1.newLine(); - }; - document.prepend(_head, _function_1); - EList _triggers_1 = it.getTriggers(); - Iterable _tail = IterableExtensions.tail(_triggers_1); - final Consumer _function_2 = (Trigger it_1) -> { - final Procedure1 _function_3 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.prepend(it_1, _function_3); - }; - _tail.forEach(_function_2); - } - - protected void _format(final Trigger it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - List> _keywordPairs = _regionFor.keywordPairs("<", ">"); - final Consumer> _function = (Pair it_1) -> { - final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { - it_2.noSpace(); - }; - document.interior(it_1, _function_1); - }; - _keywordPairs.forEach(_function); - } - - protected void _format(final ProtocolSemantics it, @Extension final IFormattableDocument document) { - EList _rules = it.getRules(); - final Consumer _function = (SemanticsRule it_1) -> { - this.prependDefaultNewLines(it_1, document); - }; - _rules.forEach(_function); - } - - @Inject - private BaseConverterService converterService; - - protected void _format(final DetailCode detailcode, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(detailcode); - FSMGrammarAccess.DetailCodeElements _detailCodeAccess = this._fSMGrammarAccess.getDetailCodeAccess(); - Assignment _linesAssignment_0_1 = _detailCodeAccess.getLinesAssignment_0_1(); - final ISemanticRegion ccRegion = _regionFor.assignment(_linesAssignment_0_1); - if ((ccRegion != null)) { - final Procedure1 _function = (IHiddenRegionFormatter it) -> { - it.oneSpace(); - }; - document.prepend(detailcode, _function); - boolean _isMultiline = this.textRegionExtensions.isMultiline(detailcode); - if (_isMultiline) { - CCStringConverter _cC_StringConverter = this.converterService.getCC_StringConverter(); - CCStringReplacer _cCStringReplacer = new CCStringReplacer(document, ccRegion, _cC_StringConverter); - document.addReplacer(_cCStringReplacer); - } - } else { - ISemanticRegionsFinder _regionFor_1 = this.textRegionExtensions.regionFor(detailcode); - FSMGrammarAccess.DetailCodeElements _detailCodeAccess_1 = this._fSMGrammarAccess.getDetailCodeAccess(); - Assignment _linesAssignment_1_1 = _detailCodeAccess_1.getLinesAssignment_1_1(); - List _assignments = _regionFor_1.assignments(_linesAssignment_1_1); - final Consumer _function_1 = (ISemanticRegion it) -> { - final Procedure1 _function_2 = (IHiddenRegionFormatter it_1) -> { - it_1.newLine(); - }; - document.prepend(it, _function_2); - }; - _assignments.forEach(_function_1); - } - } - - public void format(final Object it, final IFormattableDocument document) { - if (it instanceof TriggeredTransition) { - _format((TriggeredTransition)it, document); - return; - } else if (it instanceof State) { - _format((State)it, document); - return; - } else if (it instanceof XtextResource) { - _format((XtextResource)it, document); - return; - } else if (it instanceof Transition) { - _format((Transition)it, document); - return; - } else if (it instanceof Annotation) { - _format((Annotation)it, document); - return; - } else if (it instanceof AnnotationType) { - _format((AnnotationType)it, document); - return; - } else if (it instanceof Documentation) { - _format((Documentation)it, document); - return; - } else if (it instanceof Import) { - _format((Import)it, document); - return; - } else if (it instanceof DetailCode) { - _format((DetailCode)it, document); - return; - } else if (it instanceof ProtocolSemantics) { - _format((ProtocolSemantics)it, document); - return; - } else if (it instanceof StateGraph) { - _format((StateGraph)it, document); - return; - } else if (it instanceof Trigger) { - _format((Trigger)it, document); - return; - } else if (it instanceof EObject) { - _format((EObject)it, document); - return; - } else if (it == null) { - _format((Void)null, document); - return; - } else if (it != null) { - _format(it, document); - return; - } else { - throw new IllegalArgumentException("Unhandled parameter types: " + - Arrays.asList(it, document).toString()); - } - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java deleted file mode 100644 index 5c2dbb93f..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.fsm.generator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.xtext.generator.IFileSystemAccess; -import org.eclipse.xtext.generator.IGenerator; - -/** - * Generates code from your model files on save. - * - * see http://www.eclipse.org/Xtext/documentation.html#TutorialCodeGeneration - */ -@SuppressWarnings("all") -public class FSMGenerator implements IGenerator { - @Override - public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/DocuPostprocessor.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/DocuPostprocessor.java deleted file mode 100644 index b4dcb88ad..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/DocuPostprocessor.java +++ /dev/null @@ -1,697 +0,0 @@ -/** - * Copyright (c) 2014 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert - */ -package org.eclipse.etrice.core.fsm.postprocessing; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -/** - * This post processor adds documentation to the generated EMF model. - * By intention no {@code null} checks are performed. This way developers - * find easier if the referenced class, attribute or reference isn't found. - */ -@SuppressWarnings("all") -public class DocuPostprocessor { - public void process(final GeneratedMetamodel metamodel) { - final EPackage pckg = metamodel.getEPackage(); - EClass cls = PostprocessingHelpers.getClass(pckg, "AbstractInterfaceItem"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("An abstract interface item to be overridden in derived grammars."); - _builder.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder.toString()); - EAttribute _attribute = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("By this name the interface item is referred to in the model."); - _builder_1.newLine(); - PostprocessingHelpers.setDocumentation(_attribute, _builder_1.toString()); - EClass _class = PostprocessingHelpers.getClass(pckg, "StateGraphNode"); - cls = _class; - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("The super class of"); - _builder_2.newLine(); - _builder_2.append("
    "); - _builder_2.newLine(); - _builder_2.append(" "); - _builder_2.append("
  • {@link State}
  • "); - _builder_2.newLine(); - _builder_2.append(" "); - _builder_2.append("
  • {@link ChoicePoint}
  • "); - _builder_2.newLine(); - _builder_2.append(" "); - _builder_2.append("
  • {@link TrPoint}
  • "); - _builder_2.newLine(); - _builder_2.append("
"); - _builder_2.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_2.toString()); - EClass _class_1 = PostprocessingHelpers.getClass(pckg, "StateGraphItem"); - cls = _class_1; - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("The super class of"); - _builder_3.newLine(); - _builder_3.append("
    "); - _builder_3.newLine(); - _builder_3.append(" "); - _builder_3.append("
  • {@link StateGraphNode}
  • "); - _builder_3.newLine(); - _builder_3.append(" "); - _builder_3.append("
  • {@link Transition}
  • "); - _builder_3.newLine(); - _builder_3.append("
"); - _builder_3.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_3.toString()); - EClass _class_2 = PostprocessingHelpers.getClass(pckg, "State"); - cls = _class_2; - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("The super class of"); - _builder_4.newLine(); - _builder_4.append("
    "); - _builder_4.newLine(); - _builder_4.append(" "); - _builder_4.append("
  • {@link SimpleState}
  • "); - _builder_4.newLine(); - _builder_4.append(" "); - _builder_4.append("
  • {@link RefinedState}
  • "); - _builder_4.newLine(); - _builder_4.append("
"); - _builder_4.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_4.toString()); - EReference _reference = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("This is an optional documentation."); - _builder_5.newLine(); - PostprocessingHelpers.setDocumentation(_reference, _builder_5.toString()); - EReference _reference_1 = PostprocessingHelpers.getReference(cls, "entryCode"); - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("This is an optional entry code written in the code generator\'s target language."); - _builder_6.newLine(); - _builder_6.append("It is executed when the state is entered."); - _builder_6.newLine(); - PostprocessingHelpers.setDocumentation(_reference_1, _builder_6.toString()); - EReference _reference_2 = PostprocessingHelpers.getReference(cls, "exitCode"); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("This is an optional entry code written in the code generator\'s target language."); - _builder_7.newLine(); - _builder_7.append("It is executed when the state is left."); - _builder_7.newLine(); - PostprocessingHelpers.setDocumentation(_reference_2, _builder_7.toString()); - EReference _reference_3 = PostprocessingHelpers.getReference(cls, "doCode"); - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("This is an optional do code written in the code generator\'s target language."); - _builder_8.newLine(); - _builder_8.append("It is executed whenever the actor instance is polled (applies only to"); - _builder_8.newLine(); - _builder_8.append("data driven and sync actor classes)."); - _builder_8.newLine(); - PostprocessingHelpers.setDocumentation(_reference_3, _builder_8.toString()); - EReference _reference_4 = PostprocessingHelpers.getReference(cls, "subgraph"); - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append("This is an optional sub state graph of this state."); - _builder_9.newLine(); - PostprocessingHelpers.setDocumentation(_reference_4, _builder_9.toString()); - EClass _class_3 = PostprocessingHelpers.getClass(pckg, "StateGraph"); - cls = _class_3; - StringConcatenation _builder_10 = new StringConcatenation(); - _builder_10.append("A state graph is a directed graph composed of"); - _builder_10.newLine(); - _builder_10.append("{@link StateGraphNode}s as nodes and {@link Transition}s as edges."); - _builder_10.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_10.toString()); - EReference _reference_5 = PostprocessingHelpers.getReference(cls, "states"); - StringConcatenation _builder_11 = new StringConcatenation(); - _builder_11.append("This is a list of all states of this state graph."); - _builder_11.newLine(); - PostprocessingHelpers.setDocumentation(_reference_5, _builder_11.toString()); - EReference _reference_6 = PostprocessingHelpers.getReference(cls, "trPoints"); - StringConcatenation _builder_12 = new StringConcatenation(); - _builder_12.append("This is a list of all transition, entry and exit points of this state graph."); - _builder_12.newLine(); - PostprocessingHelpers.setDocumentation(_reference_6, _builder_12.toString()); - EReference _reference_7 = PostprocessingHelpers.getReference(cls, "chPoints"); - StringConcatenation _builder_13 = new StringConcatenation(); - _builder_13.append("This is a list of all choice points of this state graph."); - _builder_13.newLine(); - PostprocessingHelpers.setDocumentation(_reference_7, _builder_13.toString()); - EReference _reference_8 = PostprocessingHelpers.getReference(cls, "transitions"); - StringConcatenation _builder_14 = new StringConcatenation(); - _builder_14.append("This is a list of all transitions of this state graph."); - _builder_14.newLine(); - PostprocessingHelpers.setDocumentation(_reference_8, _builder_14.toString()); - EReference _reference_9 = PostprocessingHelpers.getReference(cls, "refinedTransitions"); - StringConcatenation _builder_15 = new StringConcatenation(); - _builder_15.append("This is a list of all refined transitions of this state graph."); - _builder_15.newLine(); - PostprocessingHelpers.setDocumentation(_reference_9, _builder_15.toString()); - EClass _class_4 = PostprocessingHelpers.getClass(pckg, "SimpleState"); - cls = _class_4; - StringConcatenation _builder_16 = new StringConcatenation(); - _builder_16.append("A simple state is the standard case of a @link State}."); - _builder_16.newLine(); - _builder_16.append("It comprises and entry, exit and do code"); - _builder_16.newLine(); - _builder_16.append("and it can contain another {@link StateGraph} as sub state"); - _builder_16.newLine(); - _builder_16.append("graph."); - _builder_16.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_16.toString()); - EAttribute _attribute_1 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_17 = new StringConcatenation(); - _builder_17.append("By this name the state is referred to in the model."); - _builder_17.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_1, _builder_17.toString()); - EClass _class_5 = PostprocessingHelpers.getClass(pckg, "RefinedState"); - cls = _class_5; - StringConcatenation _builder_18 = new StringConcatenation(); - _builder_18.append("A refined state can be used only in a derived {@link ActorClass}."); - _builder_18.newLine(); - _builder_18.append("It refers to a {@link State} in the inherited state machine"); - _builder_18.newLine(); - _builder_18.append("which is refined by adding detail code and/or"); - _builder_18.newLine(); - _builder_18.append("{@link StateGraphItem}s in the sub state graph."); - _builder_18.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_18.toString()); - EReference _reference_10 = PostprocessingHelpers.getReference(cls, "target"); - StringConcatenation _builder_19 = new StringConcatenation(); - _builder_19.append("This is the referenced state in the base class state machine."); - _builder_19.newLine(); - PostprocessingHelpers.setDocumentation(_reference_10, _builder_19.toString()); - EClass _class_6 = PostprocessingHelpers.getClass(pckg, "DetailCode"); - cls = _class_6; - StringConcatenation _builder_20 = new StringConcatenation(); - _builder_20.append("The detail code contains a list of strings which"); - _builder_20.newLine(); - _builder_20.append("are considered verbatim code of the code generator"); - _builder_20.newLine(); - _builder_20.append("target language."); - _builder_20.newLine(); - _builder_20.newLine(); - _builder_20.append("

"); - _builder_20.newLine(); - _builder_20.append("The detail code is parsed by the {@link org.eclipse.etrice.generator.base.DetailCodeTranslator}"); - _builder_20.newLine(); - _builder_20.append("which replaces certain frequent constructs like access of members"); - _builder_20.newLine(); - _builder_20.append("and sending a message via a port by target language specific code."); - _builder_20.newLine(); - _builder_20.append("

"); - _builder_20.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_20.toString()); - EAttribute _attribute_2 = PostprocessingHelpers.getAttribute(cls, "lines"); - StringConcatenation _builder_21 = new StringConcatenation(); - _builder_21.append("This is a list of commands in the code generator\'s target language."); - _builder_21.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_2, _builder_21.toString()); - EClass _class_7 = PostprocessingHelpers.getClass(pckg, "TrPoint"); - cls = _class_7; - StringConcatenation _builder_22 = new StringConcatenation(); - _builder_22.append("The super class of"); - _builder_22.newLine(); - _builder_22.append("
    "); - _builder_22.newLine(); - _builder_22.append(" "); - _builder_22.append("
  • {@link TransitionPoint}
  • "); - _builder_22.newLine(); - _builder_22.append(" "); - _builder_22.append("
  • {@link EntryPoint}
  • "); - _builder_22.newLine(); - _builder_22.append(" "); - _builder_22.append("
  • {@link ExitPoint}
  • "); - _builder_22.newLine(); - _builder_22.append("
"); - _builder_22.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_22.toString()); - EAttribute _attribute_3 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_23 = new StringConcatenation(); - _builder_23.append("By this name the transition, entry or exit point is referred to in the model."); - _builder_23.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_3, _builder_23.toString()); - EClass _class_8 = PostprocessingHelpers.getClass(pckg, "TransitionPoint"); - cls = _class_8; - StringConcatenation _builder_24 = new StringConcatenation(); - _builder_24.append("A transition point is located at the border of a {@link State}"); - _builder_24.newLine(); - _builder_24.append("and is not visible or accessible outside. It is used"); - _builder_24.newLine(); - _builder_24.append("to globally handle messages. If a {@link Transition} starting"); - _builder_24.newLine(); - _builder_24.append("at a transition point triggers then exit and entry codes"); - _builder_24.newLine(); - _builder_24.append("are executed as usual as long as the handler flag of the"); - _builder_24.newLine(); - _builder_24.append("transition point isn\'t set."); - _builder_24.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_24.toString()); - EAttribute _attribute_4 = PostprocessingHelpers.getAttribute(cls, "handler"); - StringConcatenation _builder_25 = new StringConcatenation(); - _builder_25.append("If this flag is {@code true} then for a transition triggerd from this point"); - _builder_25.newLine(); - _builder_25.append("no exit and entry codes of the states left and entered are executed."); - _builder_25.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_4, _builder_25.toString()); - EClass _class_9 = PostprocessingHelpers.getClass(pckg, "EntryPoint"); - cls = _class_9; - StringConcatenation _builder_26 = new StringConcatenation(); - _builder_26.append("An entry point is located at the border of a {@link State}"); - _builder_26.newLine(); - _builder_26.append("and is visible and accessible outside. Outside"); - _builder_26.newLine(); - _builder_26.append("it can be the target of a {@link Transition} and inside the source."); - _builder_26.newLine(); - _builder_26.append("If it is not connected in the interior then it is a"); - _builder_26.newLine(); - _builder_26.append("transition to history."); - _builder_26.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_26.toString()); - EClass _class_10 = PostprocessingHelpers.getClass(pckg, "ExitPoint"); - cls = _class_10; - StringConcatenation _builder_27 = new StringConcatenation(); - _builder_27.append("An exit point is located at the border of a {@link State}"); - _builder_27.newLine(); - _builder_27.append("and is visible and accessible outside. Outside"); - _builder_27.newLine(); - _builder_27.append("it can be the source of a {@link Transition} and inside the target."); - _builder_27.newLine(); - _builder_27.append("If it is not connected in the interior then it is a"); - _builder_27.newLine(); - _builder_27.append("group transition."); - _builder_27.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_27.toString()); - EClass _class_11 = PostprocessingHelpers.getClass(pckg, "ChoicePoint"); - cls = _class_11; - StringConcatenation _builder_28 = new StringConcatenation(); - _builder_28.append("A choice point corresponds to an {@code if else} construct."); - _builder_28.newLine(); - _builder_28.append("It is the target of one or more {@link Transition}s and the"); - _builder_28.newLine(); - _builder_28.append("source of several {@link Transition}s."); - _builder_28.newLine(); - _builder_28.append("One outgoing transitions must be a {@link ContinuationTransition}"); - _builder_28.newLine(); - _builder_28.append("and corresponds to the final else. It is called the"); - _builder_28.newLine(); - _builder_28.append("default branch of the choice point."); - _builder_28.newLine(); - _builder_28.append("All other outgoing transitions have to be {@link CPBranchTransition}s."); - _builder_28.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_28.toString()); - EAttribute _attribute_5 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_29 = new StringConcatenation(); - _builder_29.append("By this name the choice point is referred to in the model."); - _builder_29.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_5, _builder_29.toString()); - EReference _reference_11 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_30 = new StringConcatenation(); - _builder_30.append("This is an optional documentation."); - _builder_30.newLine(); - PostprocessingHelpers.setDocumentation(_reference_11, _builder_30.toString()); - EClass _class_12 = PostprocessingHelpers.getClass(pckg, "Transition"); - cls = _class_12; - StringConcatenation _builder_31 = new StringConcatenation(); - _builder_31.append("The super class of"); - _builder_31.newLine(); - _builder_31.append("
    "); - _builder_31.newLine(); - _builder_31.append(" "); - _builder_31.append("
  • {@link InitialTransition}
  • "); - _builder_31.newLine(); - _builder_31.append(" "); - _builder_31.append("
  • {@link NonInitialTransition}
  • "); - _builder_31.newLine(); - _builder_31.append("
"); - _builder_31.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_31.toString()); - EAttribute _attribute_6 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_32 = new StringConcatenation(); - _builder_32.append("This is an optional name of the transition."); - _builder_32.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_6, _builder_32.toString()); - EReference _reference_12 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_33 = new StringConcatenation(); - _builder_33.append("This is an optional documentation."); - _builder_33.newLine(); - PostprocessingHelpers.setDocumentation(_reference_12, _builder_33.toString()); - EReference _reference_13 = PostprocessingHelpers.getReference(cls, "to"); - StringConcatenation _builder_34 = new StringConcatenation(); - _builder_34.append("This is the target node of the transition."); - _builder_34.newLine(); - PostprocessingHelpers.setDocumentation(_reference_13, _builder_34.toString()); - EReference _reference_14 = PostprocessingHelpers.getReference(cls, "action"); - StringConcatenation _builder_35 = new StringConcatenation(); - _builder_35.append("This is an optional code in the code generator\'s target language."); - _builder_35.newLine(); - _builder_35.append("It is execute when the transition fires."); - _builder_35.newLine(); - PostprocessingHelpers.setDocumentation(_reference_14, _builder_35.toString()); - EClass _class_13 = PostprocessingHelpers.getClass(pckg, "NonInitialTransition"); - cls = _class_13; - StringConcatenation _builder_36 = new StringConcatenation(); - _builder_36.append("The super class of"); - _builder_36.newLine(); - _builder_36.append("
    "); - _builder_36.newLine(); - _builder_36.append(" "); - _builder_36.append("
  • {@link TransitionChainStartTransition}
  • "); - _builder_36.newLine(); - _builder_36.append(" "); - _builder_36.append("
  • {@link ContinuationTransition}
  • "); - _builder_36.newLine(); - _builder_36.append(" "); - _builder_36.append("
  • {@link CPBranchTransition}
  • "); - _builder_36.newLine(); - _builder_36.append("
"); - _builder_36.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_36.toString()); - EReference _reference_15 = PostprocessingHelpers.getReference(cls, "from"); - StringConcatenation _builder_37 = new StringConcatenation(); - _builder_37.append("This is the source node of the transition."); - _builder_37.newLine(); - PostprocessingHelpers.setDocumentation(_reference_15, _builder_37.toString()); - EClass _class_14 = PostprocessingHelpers.getClass(pckg, "TransitionChainStartTransition"); - cls = _class_14; - StringConcatenation _builder_38 = new StringConcatenation(); - _builder_38.append("The super class of"); - _builder_38.newLine(); - _builder_38.append("
    "); - _builder_38.newLine(); - _builder_38.append(" "); - _builder_38.append("
  • {@link TriggeredTransition}
  • "); - _builder_38.newLine(); - _builder_38.append(" "); - _builder_38.append("
  • {@link GuardedTransition}
  • "); - _builder_38.newLine(); - _builder_38.append("
"); - _builder_38.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_38.toString()); - EClass _class_15 = PostprocessingHelpers.getClass(pckg, "InitialTransition"); - cls = _class_15; - StringConcatenation _builder_39 = new StringConcatenation(); - _builder_39.append("There can be at most one initial transition in a {@link StateGraph}."); - _builder_39.newLine(); - _builder_39.append("It defines the starting point of the state graph and is traversed"); - _builder_39.newLine(); - _builder_39.append("exactly once when the state graph is accessed for the first time."); - _builder_39.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_39.toString()); - EClass _class_16 = PostprocessingHelpers.getClass(pckg, "ContinuationTransition"); - cls = _class_16; - StringConcatenation _builder_40 = new StringConcatenation(); - _builder_40.append("Continuation transitions start at entry or exit points"); - _builder_40.newLine(); - _builder_40.append("({@link EntryPoint}s or {@link ExitPoint}s) or form"); - _builder_40.newLine(); - _builder_40.append("the default branch of a {@link ChoicePoint}."); - _builder_40.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_40.toString()); - EClass _class_17 = PostprocessingHelpers.getClass(pckg, "TriggeredTransition"); - cls = _class_17; - StringConcatenation _builder_41 = new StringConcatenation(); - _builder_41.append("Triggered transitions start at a {@link State} or a {@link TransitionPoint}."); - _builder_41.newLine(); - _builder_41.append("It defines a list of {@link Trigger}s that specify the conditions"); - _builder_41.newLine(); - _builder_41.append("when the transition fires and is traversed. This kind of"); - _builder_41.newLine(); - _builder_41.append("transition is only allowed in event driven and mixed (async) state"); - _builder_41.newLine(); - _builder_41.append("machines."); - _builder_41.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_41.toString()); - EReference _reference_16 = PostprocessingHelpers.getReference(cls, "triggers"); - StringConcatenation _builder_42 = new StringConcatenation(); - _builder_42.append("This is a list of all triggers of the transition."); - _builder_42.newLine(); - PostprocessingHelpers.setDocumentation(_reference_16, _builder_42.toString()); - EClass _class_18 = PostprocessingHelpers.getClass(pckg, "GuardedTransition"); - cls = _class_18; - StringConcatenation _builder_43 = new StringConcatenation(); - _builder_43.append("A guarded transition is very similar to a {@link CPBranchTransition}."); - _builder_43.newLine(); - _builder_43.append("It defines a guard condition which lets the transition fire if"); - _builder_43.newLine(); - _builder_43.append("evaluated to {@code true}. This kind of transition is only"); - _builder_43.newLine(); - _builder_43.append("allowed in data driven or moixed (async) state machines."); - _builder_43.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_43.toString()); - EReference _reference_17 = PostprocessingHelpers.getReference(cls, "guard"); - StringConcatenation _builder_44 = new StringConcatenation(); - _builder_44.append("This is the guard condition of the transition specified in the code generator\'s target language."); - _builder_44.newLine(); - _builder_44.append("It has to evaluate to a boolean value."); - _builder_44.newLine(); - PostprocessingHelpers.setDocumentation(_reference_17, _builder_44.toString()); - EClass _class_19 = PostprocessingHelpers.getClass(pckg, "CPBranchTransition"); - cls = _class_19; - StringConcatenation _builder_45 = new StringConcatenation(); - _builder_45.append("The choice point branch transitions is allowed only as outgoing"); - _builder_45.newLine(); - _builder_45.append("transition of {@link ChoicePoint}s."); - _builder_45.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_45.toString()); - EReference _reference_18 = PostprocessingHelpers.getReference(cls, "condition"); - StringConcatenation _builder_46 = new StringConcatenation(); - _builder_46.append("This is the condition of the choice point branch specified in the code generator\'s target language."); - _builder_46.newLine(); - _builder_46.append("It has to evaluate to a boolean value."); - _builder_46.newLine(); - PostprocessingHelpers.setDocumentation(_reference_18, _builder_46.toString()); - EClass _class_20 = PostprocessingHelpers.getClass(pckg, "RefinedTransition"); - cls = _class_20; - StringConcatenation _builder_47 = new StringConcatenation(); - _builder_47.append("The refined transition is only allowed in {@link StateGraph}s"); - _builder_47.newLine(); - _builder_47.append("of derived {@link ActorClass}es. It targets a {@link Transition}"); - _builder_47.newLine(); - _builder_47.append("of the base class state machine."); - _builder_47.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_47.toString()); - EReference _reference_19 = PostprocessingHelpers.getReference(cls, "action"); - StringConcatenation _builder_48 = new StringConcatenation(); - _builder_48.append("This is an optional code in the code generator\'s target language."); - _builder_48.newLine(); - _builder_48.append("It is execute when the transition fires."); - _builder_48.newLine(); - PostprocessingHelpers.setDocumentation(_reference_19, _builder_48.toString()); - EReference _reference_20 = PostprocessingHelpers.getReference(cls, "target"); - StringConcatenation _builder_49 = new StringConcatenation(); - _builder_49.append("This is the referenced transition in the base class state machine."); - _builder_49.newLine(); - PostprocessingHelpers.setDocumentation(_reference_20, _builder_49.toString()); - EReference _reference_21 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_50 = new StringConcatenation(); - _builder_50.append("This is an optional documentation."); - _builder_50.newLine(); - PostprocessingHelpers.setDocumentation(_reference_21, _builder_50.toString()); - EClass _class_21 = PostprocessingHelpers.getClass(pckg, "TransitionTerminal"); - cls = _class_21; - StringConcatenation _builder_51 = new StringConcatenation(); - _builder_51.append("The super class of"); - _builder_51.newLine(); - _builder_51.append("
    "); - _builder_51.newLine(); - _builder_51.append(" "); - _builder_51.append("
  • {@link StateTerminal}
  • "); - _builder_51.newLine(); - _builder_51.append(" "); - _builder_51.append("
  • {@link TrPointTerminal}
  • "); - _builder_51.newLine(); - _builder_51.append(" "); - _builder_51.append("
  • {@link SubStateTrPointTerminal}
  • "); - _builder_51.newLine(); - _builder_51.append(" "); - _builder_51.append("
  • {@link ChoicepointTerminal}
  • "); - _builder_51.newLine(); - _builder_51.append("
"); - _builder_51.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_51.toString()); - EClass _class_22 = PostprocessingHelpers.getClass(pckg, "StateTerminal"); - cls = _class_22; - StringConcatenation _builder_52 = new StringConcatenation(); - _builder_52.append("The terminal point (source or target) of a transition ending"); - _builder_52.newLine(); - _builder_52.append("at a {@link State}."); - _builder_52.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_52.toString()); - EReference _reference_22 = PostprocessingHelpers.getReference(cls, "state"); - StringConcatenation _builder_53 = new StringConcatenation(); - _builder_53.append("This is the target state."); - _builder_53.newLine(); - PostprocessingHelpers.setDocumentation(_reference_22, _builder_53.toString()); - EClass _class_23 = PostprocessingHelpers.getClass(pckg, "TrPointTerminal"); - cls = _class_23; - StringConcatenation _builder_54 = new StringConcatenation(); - _builder_54.append("The terminal point (source or target) of a transition ending"); - _builder_54.newLine(); - _builder_54.append("at a local {@link TrPoint}."); - _builder_54.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_54.toString()); - EReference _reference_23 = PostprocessingHelpers.getReference(cls, "trPoint"); - StringConcatenation _builder_55 = new StringConcatenation(); - _builder_55.append("This is the target transition, entry or exit point."); - _builder_55.newLine(); - PostprocessingHelpers.setDocumentation(_reference_23, _builder_55.toString()); - EClass _class_24 = PostprocessingHelpers.getClass(pckg, "SubStateTrPointTerminal"); - cls = _class_24; - StringConcatenation _builder_56 = new StringConcatenation(); - _builder_56.append("The terminal point (source or target) of a transition ending"); - _builder_56.newLine(); - _builder_56.append("at a {@link TrPoint} of a sub {@link State}."); - _builder_56.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_56.toString()); - EReference _reference_24 = PostprocessingHelpers.getReference(cls, "state"); - StringConcatenation _builder_57 = new StringConcatenation(); - _builder_57.append("This is the target state."); - _builder_57.newLine(); - PostprocessingHelpers.setDocumentation(_reference_24, _builder_57.toString()); - EReference _reference_25 = PostprocessingHelpers.getReference(cls, "trPoint"); - StringConcatenation _builder_58 = new StringConcatenation(); - _builder_58.append("This is the target entry or exit point contained in the target state."); - _builder_58.newLine(); - PostprocessingHelpers.setDocumentation(_reference_25, _builder_58.toString()); - EClass _class_25 = PostprocessingHelpers.getClass(pckg, "ChoicepointTerminal"); - cls = _class_25; - StringConcatenation _builder_59 = new StringConcatenation(); - _builder_59.append("The terminal point (source or target) of a transition ending"); - _builder_59.newLine(); - _builder_59.append("at a {@link ChoicepointTerminal}."); - _builder_59.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_59.toString()); - EReference _reference_26 = PostprocessingHelpers.getReference(cls, "cp"); - StringConcatenation _builder_60 = new StringConcatenation(); - _builder_60.append("This is the target choice point."); - _builder_60.newLine(); - PostprocessingHelpers.setDocumentation(_reference_26, _builder_60.toString()); - EClass _class_26 = PostprocessingHelpers.getClass(pckg, "Trigger"); - cls = _class_26; - StringConcatenation _builder_61 = new StringConcatenation(); - _builder_61.append("A transition trigger is a list of {@link MessageFromIf} pairs"); - _builder_61.newLine(); - _builder_61.append("and an optional {@link Guard}."); - _builder_61.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_61.toString()); - EReference _reference_27 = PostprocessingHelpers.getReference(cls, "msgFromIfPairs"); - StringConcatenation _builder_62 = new StringConcatenation(); - _builder_62.append("This is a list of message/interface item pairs."); - _builder_62.newLine(); - PostprocessingHelpers.setDocumentation(_reference_27, _builder_62.toString()); - EReference _reference_28 = PostprocessingHelpers.getReference(cls, "guard"); - StringConcatenation _builder_63 = new StringConcatenation(); - _builder_63.append("This is an optional guard condition of the trigger specified in the code generator\'s target language."); - _builder_63.newLine(); - _builder_63.append("It has to evaluate to a boolean value."); - _builder_63.newLine(); - PostprocessingHelpers.setDocumentation(_reference_28, _builder_63.toString()); - EClass _class_27 = PostprocessingHelpers.getClass(pckg, "MessageFromIf"); - cls = _class_27; - StringConcatenation _builder_64 = new StringConcatenation(); - _builder_64.append("A pair consisting of a {@link Message} arising from an"); - _builder_64.newLine(); - _builder_64.append("{@link InterfaceItem}."); - _builder_64.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_64.toString()); - EReference _reference_29 = PostprocessingHelpers.getReference(cls, "message"); - StringConcatenation _builder_65 = new StringConcatenation(); - _builder_65.append("This is the triggerering message (or event)."); - _builder_65.newLine(); - PostprocessingHelpers.setDocumentation(_reference_29, _builder_65.toString()); - EReference _reference_30 = PostprocessingHelpers.getReference(cls, "from"); - StringConcatenation _builder_66 = new StringConcatenation(); - _builder_66.append("This is the interface item where the message occurred."); - _builder_66.newLine(); - PostprocessingHelpers.setDocumentation(_reference_30, _builder_66.toString()); - EClass _class_28 = PostprocessingHelpers.getClass(pckg, "Guard"); - cls = _class_28; - StringConcatenation _builder_67 = new StringConcatenation(); - _builder_67.append("A detail code that evaluates to a boolean in the target"); - _builder_67.newLine(); - _builder_67.append("language."); - _builder_67.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_67.toString()); - EReference _reference_31 = PostprocessingHelpers.getReference(cls, "guard"); - StringConcatenation _builder_68 = new StringConcatenation(); - _builder_68.append("This is a guard condition specified in the code generator\'s target language."); - _builder_68.newLine(); - _builder_68.append("It has to evaluate to a boolean value."); - _builder_68.newLine(); - PostprocessingHelpers.setDocumentation(_reference_31, _builder_68.toString()); - EClass _class_29 = PostprocessingHelpers.getClass(pckg, "ProtocolSemantics"); - cls = _class_29; - StringConcatenation _builder_69 = new StringConcatenation(); - _builder_69.append("An optional semantics specification as part of a {@link ProtocolClass}."); - _builder_69.newLine(); - _builder_69.append("The semantic is defined as a legal execution tree."); - _builder_69.newLine(); - _builder_69.append("This tree is composed of incoming and outgoing messages and each path through"); - _builder_69.newLine(); - _builder_69.append("this tree is a valid sequence of messages exchanged through a port instance."); - _builder_69.newLine(); - _builder_69.newLine(); - _builder_69.append("

"); - _builder_69.newLine(); - _builder_69.append("The semantics are composed using {@link SemanticsRule}s."); - _builder_69.newLine(); - _builder_69.append("

"); - _builder_69.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_69.toString()); - EReference _reference_32 = PostprocessingHelpers.getReference(cls, "rules"); - StringConcatenation _builder_70 = new StringConcatenation(); - _builder_70.append("This is a list of semantic rules."); - _builder_70.newLine(); - PostprocessingHelpers.setDocumentation(_reference_32, _builder_70.toString()); - EClass _class_30 = PostprocessingHelpers.getClass(pckg, "SemanticsRule"); - cls = _class_30; - StringConcatenation _builder_71 = new StringConcatenation(); - _builder_71.append("The super class of"); - _builder_71.newLine(); - _builder_71.append("
    "); - _builder_71.newLine(); - _builder_71.append(" "); - _builder_71.append("
  • {@link InSemanticsRule}
  • "); - _builder_71.newLine(); - _builder_71.append(" "); - _builder_71.append("
  • {@link OutSemanticsRule}
  • "); - _builder_71.newLine(); - _builder_71.append("
"); - _builder_71.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_71.toString()); - EReference _reference_33 = PostprocessingHelpers.getReference(cls, "msg"); - StringConcatenation _builder_72 = new StringConcatenation(); - _builder_72.append("The message to which this rule applies."); - _builder_72.newLine(); - PostprocessingHelpers.setDocumentation(_reference_33, _builder_72.toString()); - EReference _reference_34 = PostprocessingHelpers.getReference(cls, "followUps"); - StringConcatenation _builder_73 = new StringConcatenation(); - _builder_73.append("The possible follow up rules."); - _builder_73.newLine(); - PostprocessingHelpers.setDocumentation(_reference_34, _builder_73.toString()); - EClass _class_31 = PostprocessingHelpers.getClass(pckg, "InSemanticsRule"); - cls = _class_31; - StringConcatenation _builder_74 = new StringConcatenation(); - _builder_74.append("A {@link SemanticsRule} for incoming messages."); - _builder_74.newLine(); - _builder_74.append("The rule points to an incoming messages and allows follow-up rules."); - _builder_74.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_74.toString()); - EClass _class_32 = PostprocessingHelpers.getClass(pckg, "OutSemanticsRule"); - cls = _class_32; - StringConcatenation _builder_75 = new StringConcatenation(); - _builder_75.append("A {@link SemanticsRule} for outgoing messages."); - _builder_75.newLine(); - _builder_75.append("The rule points to an outgoing messages and allows follow-up rules."); - _builder_75.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_75.toString()); - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java deleted file mode 100644 index 3c6306ffc..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) 2014 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert - */ -package org.eclipse.etrice.core.fsm.postprocessing; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -@SuppressWarnings("all") -public class ImplPostprocessor { - public boolean process(final GeneratedMetamodel metamodel) { - boolean _xblockexpression = false; - { - final EPackage fsmPackage = metamodel.getEPackage(); - final EClass state = PostprocessingHelpers.getClass(fsmPackage, "State"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("return (this instanceof <%org.eclipse.etrice.core.fsm.fSM.SimpleState%>)? ((SimpleState)this).getName() :(this instanceof <%org.eclipse.etrice.core.fsm.fSM.RefinedState%>)? (((RefinedState)this).getTarget()==null? \"\":((RefinedState)this).getTarget().getName()) :\"\";"); - PostprocessingHelpers.addOperation(state, "getName", EcorePackage.Literals.ESTRING, Integer.valueOf(1), _builder.toString()); - final EClass stateGraphItem = PostprocessingHelpers.getClass(fsmPackage, "StateGraphItem"); - EClassifier _eClassifier = EcorePackage.eINSTANCE.getEClassifier("EString"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("if (this instanceof <%org.eclipse.etrice.core.fsm.fSM.State%>) "); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((State)this).getName();"); - _builder_1.newLine(); - _builder_1.append("else if (this instanceof <%org.eclipse.etrice.core.fsm.fSM.TrPoint%>)"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((TrPoint)this).getName();"); - _builder_1.newLine(); - _builder_1.append("else if (this instanceof <%org.eclipse.etrice.core.fsm.fSM.ChoicePoint%>)"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((ChoicePoint)this).getName();"); - _builder_1.newLine(); - _builder_1.append("else if (this instanceof <%org.eclipse.etrice.core.fsm.fSM.Transition%>)"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((Transition)this).getName();"); - _builder_1.newLine(); - _builder_1.append("return \"\";"); - _builder_1.newLine(); - PostprocessingHelpers.addOperation(stateGraphItem, "getName", _eClassifier, Integer.valueOf(1), _builder_1.toString()); - final EClass ifItem = PostprocessingHelpers.getClass(fsmPackage, "AbstractInterfaceItem"); - EClassifier _eClassifier_1 = EcorePackage.eINSTANCE.getEClassifier("EString"); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("return getName();"); - _builder_2.newLine(); - PostprocessingHelpers.addOperation(ifItem, "getDisplayName", _eClassifier_1, Integer.valueOf(1), _builder_2.toString()); - EClassifier _eClassifier_2 = fsmPackage.getEClassifier("ProtocolSemantics"); - PostprocessingHelpers.addOperation(ifItem, "getSemantics", _eClassifier_2); - PostprocessingHelpers.addOperation(ifItem, "getAllIncomingAbstractMessages", EcorePackage.Literals.EOBJECT, Integer.valueOf((-1)), null); - PostprocessingHelpers.addOperation(ifItem, "getAllOutgoingAbstractMessages", EcorePackage.Literals.EOBJECT, Integer.valueOf((-1)), null); - PostprocessingHelpers.addOperation(ifItem, "isEventDriven", EcorePackage.Literals.EBOOLEAN, Integer.valueOf(1), "return true;"); - final EClass itemOwner = PostprocessingHelpers.addClass(fsmPackage, "IInterfaceItemOwner"); - itemOwner.setAbstract(true); - itemOwner.setInterface(true); - EClassifier _eClassifier_3 = fsmPackage.getEClassifier("AbstractInterfaceItem"); - PostprocessingHelpers.addOperation(itemOwner, "getAbstractInterfaceItems", _eClassifier_3, Integer.valueOf((-1)), null); - EClassifier _eClassifier_4 = fsmPackage.getEClassifier("AbstractInterfaceItem"); - PostprocessingHelpers.addOperation(itemOwner, "getAllAbstractInterfaceItems", _eClassifier_4, Integer.valueOf((-1)), null); - final EClass comp = PostprocessingHelpers.getClass(fsmPackage, "ModelComponent"); - EList _eSuperTypes = comp.getESuperTypes(); - _xblockexpression = _eSuperTypes.add(itemOwner); - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java deleted file mode 100644 index fe823650a..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java +++ /dev/null @@ -1,341 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.fsm.scoping; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.etrice.core.fsm.fSM.ChoicePoint; -import org.eclipse.etrice.core.fsm.fSM.ChoicepointTerminal; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; -import org.eclipse.etrice.core.fsm.fSM.RefinedState; -import org.eclipse.etrice.core.fsm.fSM.RefinedTransition; -import org.eclipse.etrice.core.fsm.fSM.SimpleState; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.StateTerminal; -import org.eclipse.etrice.core.fsm.fSM.SubStateTrPointTerminal; -import org.eclipse.etrice.core.fsm.fSM.TrPoint; -import org.eclipse.etrice.core.fsm.fSM.TrPointTerminal; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.util.FSMHelpers; -import org.eclipse.xtext.naming.IQualifiedNameProvider; -import org.eclipse.xtext.naming.QualifiedName; -import org.eclipse.xtext.resource.EObjectDescription; -import org.eclipse.xtext.resource.IEObjectDescription; -import org.eclipse.xtext.scoping.IScope; -import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; -import org.eclipse.xtext.scoping.impl.SimpleScope; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; - -/** - * This class contains custom scoping description. - * - * see : http://www.eclipse.org/Xtext/documentation.html#scoping - * on how and when to use it - */ -@SuppressWarnings("all") -public class FSMScopeProvider extends AbstractDeclarativeScopeProvider { - @Inject - @Extension - private FSMHelpers _fSMHelpers; - - @Inject - @Extension - private IQualifiedNameProvider _iQualifiedNameProvider; - - /** - * returns a flat list of State scopes for a {@link StateTerminal} - * @param st - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_StateTerminal_state(final StateTerminal st, final EReference ref) { - final List scopes = CollectionLiterals.newArrayList(); - final StateGraph parent = this.getStateGraph(st); - this.getStateScopes(parent, scopes); - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of TransitionPoint scopes for a {@link TrPointTerminal} - * @param ep - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_TrPointTerminal_trPoint(final TrPointTerminal ep, final EReference ref) { - final List scopes = CollectionLiterals.newArrayList(); - final StateGraph parent = this.getStateGraph(ep); - final List tps = this._fSMHelpers.getAllTrPoints(parent); - for (final TrPoint tp : tps) { - String _name = tp.getName(); - IEObjectDescription _create = EObjectDescription.create(_name, tp); - scopes.add(_create); - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of TransitionPoint scopes for a {@link SubStateTrPointTerminal} - * @param ep - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_SubStateTrPointTerminal_trPoint(final SubStateTrPointTerminal ep, final EReference ref) { - final List scopes = CollectionLiterals.newArrayList(); - final StateGraph parent = this.getStateGraph(ep); - State _state = ep.getState(); - boolean _notEquals = (!Objects.equal(_state, null)); - if (_notEquals) { - State epState = ep.getState(); - State _refinedStateFor = this._fSMHelpers.getRefinedStateFor(parent, epState); - epState = _refinedStateFor; - StateGraph _subgraph = epState.getSubgraph(); - boolean _notEquals_1 = (!Objects.equal(_subgraph, null)); - if (_notEquals_1) { - StateGraph _subgraph_1 = epState.getSubgraph(); - final List tps = this._fSMHelpers.getAllTrPoints(_subgraph_1); - for (final TrPoint tp : tps) { - String _name = tp.getName(); - IEObjectDescription _create = EObjectDescription.create(_name, tp); - scopes.add(_create); - } - } - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of State scopes for a {@link SubStateTrPointTerminal} - * @param st - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_SubStateTrPointTerminal_state(final SubStateTrPointTerminal st, final EReference ref) { - final List scopes = CollectionLiterals.newArrayList(); - final StateGraph parent = this.getStateGraph(st); - this.getStateScopes(parent, scopes); - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of Choicepoint scopes for a {@link SubStateTrPointTerminal} - * @param ct - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_ChoicepointTerminal_cp(final ChoicepointTerminal ct, final EReference ref) { - final List scopes = CollectionLiterals.newArrayList(); - final StateGraph parent = this.getStateGraph(ct); - final List choicePoints = this._fSMHelpers.getAllChoicePoints(parent); - for (final ChoicePoint cp : choicePoints) { - String _name = cp.getName(); - IEObjectDescription _create = EObjectDescription.create(_name, cp); - scopes.add(_create); - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of BaseState scopes for a {@link RefinedState} - * @param rs - the refined state - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_RefinedState_target(final RefinedState rs, final EReference ref) { - final List scopes = CollectionLiterals.newArrayList(); - StateGraph sg = this.getStateGraph(rs); - EObject _eContainer = sg.eContainer(); - if ((_eContainer instanceof ModelComponent)) { - EObject _eContainer_1 = sg.eContainer(); - ModelComponent comp = ((ModelComponent) _eContainer_1); - if (((!Objects.equal(comp.getBase(), null)) && (!this._fSMHelpers.isCircularClassHierarchy(comp)))) { - ModelComponent _base = comp.getBase(); - comp = _base; - final HashSet covered = CollectionLiterals.newHashSet(); - final ArrayList states = CollectionLiterals.newArrayList(); - while ((!Objects.equal(comp, null))) { - { - StateGraph _stateMachine = comp.getStateMachine(); - this.recursivelyAddStates(_stateMachine, covered, states); - ModelComponent _base_1 = comp.getBase(); - comp = _base_1; - } - } - for (final State s : states) { - QualifiedName _statePath = this.getStatePath(s); - IEObjectDescription _create = EObjectDescription.create(_statePath, s); - scopes.add(_create); - } - } - } else { - EObject _eContainer_2 = sg.eContainer(); - if ((_eContainer_2 instanceof RefinedState)) { - EObject _eContainer_3 = sg.eContainer(); - State _target = ((RefinedState) _eContainer_3).getTarget(); - StateGraph _subgraph = _target.getSubgraph(); - sg = _subgraph; - boolean _notEquals = (!Objects.equal(sg, null)); - if (_notEquals) { - EList _states = sg.getStates(); - for (final State s_1 : _states) { - String _name = s_1.getName(); - IEObjectDescription _create_1 = EObjectDescription.create(_name, s_1); - scopes.add(_create_1); - } - } - } - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of Transition scopes for a {@link RefinedTransition} - * @param trans - the refined transition - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_RefinedTransition_target(final RefinedTransition trans, final EReference ref) { - final List scopes = CollectionLiterals.newArrayList(); - EObject _eContainer = trans.eContainer(); - EObject _eContainer_1 = _eContainer.eContainer(); - ModelComponent comp = ((ModelComponent) _eContainer_1); - boolean _isCircularClassHierarchy = this._fSMHelpers.isCircularClassHierarchy(comp); - boolean _not = (!_isCircularClassHierarchy); - if (_not) { - ModelComponent _base = comp.getBase(); - comp = _base; - while ((!Objects.equal(comp, null))) { - { - StateGraph _stateMachine = comp.getStateMachine(); - boolean _notEquals = (!Objects.equal(_stateMachine, null)); - if (_notEquals) { - QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(comp); - final int acNameSegments = _fullyQualifiedName.getSegmentCount(); - StateGraph _stateMachine_1 = comp.getStateMachine(); - final TreeIterator iter = _stateMachine_1.eAllContents(); - while (iter.hasNext()) { - { - final EObject obj = iter.next(); - if ((obj instanceof Transition)) { - QualifiedName _fullyQualifiedName_1 = this._iQualifiedNameProvider.getFullyQualifiedName(obj); - QualifiedName _skipFirst = _fullyQualifiedName_1.skipFirst((acNameSegments + 1)); - IEObjectDescription _create = EObjectDescription.create(_skipFirst, obj); - scopes.add(_create); - } - } - } - } - ModelComponent _base_1 = comp.getBase(); - comp = _base_1; - } - } - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * @param sg - * @param covered - * @param states - */ - private void recursivelyAddStates(final StateGraph sg, final HashSet covered, final ArrayList states) { - EList _states = sg.getStates(); - for (final State s : _states) { - if (((s instanceof SimpleState) && (!covered.contains(s)))) { - states.add(s); - } else { - if (((s instanceof RefinedState) && (!covered.contains(s)))) { - states.add(s); - State _target = ((RefinedState) s).getTarget(); - covered.add(_target); - } - } - } - EList _states_1 = sg.getStates(); - for (final State s_1 : _states_1) { - StateGraph _subgraph = s_1.getSubgraph(); - boolean _notEquals = (!Objects.equal(_subgraph, null)); - if (_notEquals) { - StateGraph _subgraph_1 = s_1.getSubgraph(); - this.recursivelyAddStates(_subgraph_1, covered, states); - } - } - } - - /** - * first container of type {@link StateGraph} ({@link State}, {@link StateMachine}) - * @param obj - * @return StateGraph Container - */ - private StateGraph getStateGraph(final EObject obj) { - EObject ctx = obj.eContainer(); - while (((!(ctx instanceof StateGraph)) && (!Objects.equal(ctx.eContainer(), null)))) { - EObject _eContainer = ctx.eContainer(); - ctx = _eContainer; - } - if ((ctx instanceof StateGraph)) { - return ((StateGraph)ctx); - } - return null; - } - - /** - * compute the path of a {@link BaseState} - * @param bs - * @return the path - */ - private QualifiedName getStatePath(final State bs) { - EObject _eContainer = bs.eContainer(); - final EObject parent = _eContainer.eContainer(); - if ((parent instanceof SimpleState)) { - QualifiedName _statePath = this.getStatePath(((SimpleState) parent)); - String _name = bs.getName(); - return _statePath.append(_name); - } else { - if ((parent instanceof RefinedState)) { - final State target = ((RefinedState) parent).getTarget(); - boolean _notEquals = (!Objects.equal(target, null)); - if (_notEquals) { - QualifiedName _statePath_1 = this.getStatePath(target); - String _name_1 = bs.getName(); - return _statePath_1.append(_name_1); - } - } - } - String _name_2 = bs.getName(); - return QualifiedName.create(_name_2); - } - - /** - * @param parent - * @param scopes - */ - private void getStateScopes(final StateGraph parent, final List scopes) { - final List states = this._fSMHelpers.getAllStates(parent); - final HashMap name2state = CollectionLiterals.newHashMap(); - for (final State s : states) { - String _name = s.getName(); - SimpleState _baseState = this._fSMHelpers.getBaseState(s); - name2state.put(_name, _baseState); - } - Set> _entrySet = name2state.entrySet(); - for (final Map.Entry entry : _entrySet) { - String _key = entry.getKey(); - SimpleState _value = entry.getValue(); - IEObjectDescription _create = EObjectDescription.create(_key, _value); - scopes.add(_create); - } - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java deleted file mode 100644 index 543e0a6b7..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Copyright (c) 2014 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Mirza Klimenta (initial contribution) - */ -package org.eclipse.etrice.core.fsm.validation; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.HashMap; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem; -import org.eclipse.etrice.core.fsm.fSM.FSMPackage; -import org.eclipse.etrice.core.fsm.fSM.Guard; -import org.eclipse.etrice.core.fsm.fSM.MessageFromIf; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.StateTerminal; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.fSM.Trigger; -import org.eclipse.etrice.core.fsm.fSM.TriggeredTransition; -import org.eclipse.etrice.core.fsm.naming.FSMNameProvider; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@SuppressWarnings("all") -public class FSMValidationUtilXtend { - public static class Result { - private boolean ok; - - private String msg; - - private EObject source; - - private EStructuralFeature feature; - - private int index; - - public static FSMValidationUtilXtend.Result ok() { - return new FSMValidationUtilXtend.Result(true, "", null, null, 0); - } - - public static FSMValidationUtilXtend.Result error(final String msg) { - return new FSMValidationUtilXtend.Result(false, msg, null, null, (-1)); - } - - public static FSMValidationUtilXtend.Result error(final String msg, final EObject source, final EStructuralFeature feature) { - return new FSMValidationUtilXtend.Result(false, msg, source, feature, (-1)); - } - - public static FSMValidationUtilXtend.Result error(final String msg, final EObject source, final EStructuralFeature feature, final int index) { - return new FSMValidationUtilXtend.Result(false, msg, source, feature, index); - } - - public Result(final boolean ok, final String msg, final EObject source, final EStructuralFeature feature, final int index) { - this.ok = ok; - this.msg = msg; - this.source = source; - this.feature = feature; - this.index = index; - } - - public boolean isOk() { - return this.ok; - } - - public String getMsg() { - return this.msg; - } - - public EObject getSource() { - return this.source; - } - - public EStructuralFeature getFeature() { - return this.feature; - } - - public int getIndex() { - return this.index; - } - } - - @Inject - @Extension - private FSMNameProvider _fSMNameProvider; - - public ArrayList uniqueOriginTriggers(final State myState) { - final StateGraph parent = this.getStateGraph(myState); - final HashMap trig2trans = CollectionLiterals.newHashMap(); - final ArrayList result = CollectionLiterals.newArrayList(); - EList _transitions = parent.getTransitions(); - final Function1 _function = (Transition t) -> { - return Boolean.valueOf((((t instanceof TriggeredTransition) && (((TriggeredTransition) t).getFrom() instanceof StateTerminal)) && Objects.equal(myState, ((StateTerminal) ((TriggeredTransition) t).getFrom()).getState()))); - }; - Iterable _filter = IterableExtensions.filter(_transitions, _function); - for (final Transition t : _filter) { - EList _triggers = ((TriggeredTransition) t).getTriggers(); - final Function1 _function_1 = (Trigger k) -> { - Guard _guard = k.getGuard(); - return Boolean.valueOf(Objects.equal(_guard, null)); - }; - Iterable _filter_1 = IterableExtensions.filter(_triggers, _function_1); - for (final Trigger k : _filter_1) { - EList _msgFromIfPairs = k.getMsgFromIfPairs(); - for (final MessageFromIf specMethod : _msgFromIfPairs) { - { - final String triggerName = this.getTriggerName(specMethod); - boolean _containsKey = trig2trans.containsKey(triggerName); - if (_containsKey) { - final TriggeredTransition ot = trig2trans.get(triggerName); - FSMValidationUtilXtend.Result _error = FSMValidationUtilXtend.Result.error("Triggers originating from a state should be unique.", t, FSMPackage.Literals.TRIGGERED_TRANSITION__TRIGGERS); - result.add(_error); - FSMValidationUtilXtend.Result _error_1 = FSMValidationUtilXtend.Result.error("Triggers originating from a state should be unique.", ot, FSMPackage.Literals.TRIGGERED_TRANSITION__TRIGGERS); - result.add(_error_1); - } - trig2trans.put(triggerName, ((TriggeredTransition) t)); - } - } - } - } - return result; - } - - private String getTriggerName(final MessageFromIf mif) { - AbstractInterfaceItem _from = mif.getFrom(); - String _name = _from.getName(); - String _plus = (_name + "#"); - EObject _message = mif.getMessage(); - String _messageName = this._fSMNameProvider.getMessageName(_message); - return (_plus + _messageName); - } - - public StateGraph getStateGraph(final EObject obj) { - EObject parent = obj.eContainer(); - while ((!Objects.equal(parent, null))) { - { - if ((parent instanceof StateGraph)) { - return ((StateGraph) parent); - } - EObject _eContainer = parent.eContainer(); - parent = _eContainer; - } - } - return null; - } -} diff --git a/plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/hover/RoomHoverProvider.java b/plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/hover/RoomHoverProvider.java deleted file mode 100644 index 04fbae275..000000000 --- a/plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/hover/RoomHoverProvider.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.ui.hover; - -import com.google.inject.Inject; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.common.ui.hover.KeywordEObjectTextHover; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.services.RoomGrammarAccess; -import org.eclipse.jface.text.IRegion; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.util.Pair; - -@SuppressWarnings("all") -public class RoomHoverProvider extends KeywordEObjectTextHover { - @Inject - private RoomGrammarAccess grammar; - - @Override - protected Pair getXtextElementAt(final XtextResource resource, final int offset) { - return super.getXtextElementAt(resource, offset); - } - - private ActorClass findActorClass(final EObject model) { - EObject parent = model; - while ((parent != null)) { - { - if ((parent instanceof ActorClass)) { - return ((ActorClass) parent); - } - EObject _eContainer = parent.eContainer(); - parent = _eContainer; - } - } - return null; - } -} diff --git a/plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/quickfix/DetailCodeIndentHelper.java b/plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/quickfix/DetailCodeIndentHelper.java deleted file mode 100644 index 8d0443612..000000000 --- a/plugins/org.eclipse.etrice.core.room.ui/xtend-gen/org/eclipse/etrice/core/ui/quickfix/DetailCodeIndentHelper.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.eclipse.etrice.core.ui.quickfix; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.jface.text.IRegion; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.ui.editor.model.IXtextDocument; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.validation.Issue; -import org.eclipse.xtext.xbase.lib.Exceptions; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IntegerRange; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure2; - -@SuppressWarnings("all") -public class DetailCodeIndentHelper { - /** - * Converts the issued multi line string to single line strings - * - line with least indentation is adjusted to first line - * - lines are enclosed with " or ' - * - lines get editor indentation of first line - * - - */ - public static String convertToSingleLines(final IXtextDocument document, final Issue issue) { - try { - Integer _offset = issue.getOffset(); - final IRegion issuedRegion = document.getLineInformationOfOffset((_offset).intValue()); - int _offset_1 = issuedRegion.getOffset(); - int _length = issuedRegion.getLength(); - final String firstEditorLine = document.get(_offset_1, _length); - final String editorIndent = Strings.getLeadingWhiteSpace(firstEditorLine); - Integer _offset_2 = issue.getOffset(); - Integer _length_1 = issue.getLength(); - final String editorString = document.get((_offset_2).intValue(), (_length_1).intValue()); - char _charAt = editorString.charAt(0); - final String mark = Character.valueOf(_charAt).toString(); - String _newLine = Strings.newLine(); - final List editorLines = Strings.split(editorString, _newLine); - int _size = editorLines.size(); - boolean _lessEqualsThan = (_size <= 1); - if (_lessEqualsThan) { - return editorString; - } - Iterable _tail = IterableExtensions.tail(editorLines); - final Function1 _function = (String it) -> { - return Integer.valueOf(DetailCodeIndentHelper.countIndent(it)); - }; - List _sortBy = IterableExtensions.sortBy(_tail, _function); - String _head = IterableExtensions.head(_sortBy); - final int minIndent = DetailCodeIndentHelper.countIndent(_head); - final ArrayList newEditorLines = new ArrayList(); - final Procedure2 _function_1 = (String line, Integer lineCount) -> { - String _xifexpression = null; - if (((lineCount).intValue() != 0)) { - _xifexpression = (editorIndent + mark); - } - String front = _xifexpression; - int _countIndent = DetailCodeIndentHelper.countIndent(line); - int indentCount = (_countIndent - minIndent); - String _xifexpression_1 = null; - if ((((lineCount).intValue() != 0) && (indentCount > 0))) { - StringConcatenation _builder = new StringConcatenation(); - { - IntegerRange _upTo = new IntegerRange(1, indentCount); - for(final Integer i : _upTo) { - _builder.append("\t"); - } - } - _xifexpression_1 = _builder.toString(); - } - String indent = _xifexpression_1; - String noneWSLine = Strings.removeLeadingWhitespace(line); - String _xifexpression_2 = null; - int _size_1 = editorLines.size(); - int _minus = (_size_1 - 1); - boolean _notEquals = ((lineCount).intValue() != _minus); - if (_notEquals) { - _xifexpression_2 = mark; - } - String end = _xifexpression_2; - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append(front, ""); - _builder_1.append(indent, ""); - _builder_1.append(noneWSLine, ""); - _builder_1.append(end, ""); - String newEditorLine = _builder_1.toString(); - newEditorLines.add(newEditorLine); - }; - IterableExtensions.forEach(editorLines, _function_1); - String _newLine_1 = Strings.newLine(); - return Strings.concat(_newLine_1, newEditorLines); - } catch (Throwable _e) { - throw Exceptions.sneakyThrow(_e); - } - } - - private static int countIndent(final String line) { - String _leadingWhiteSpace = Strings.getLeadingWhiteSpace(line); - String _replace = _leadingWhiteSpace.replace("\t", " "); - String _replace_1 = _replace.replace(" ", "\t"); - String _replaceAll = _replace_1.replaceAll("!\\t", ""); - return _replaceAll.length(); - } -} diff --git a/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/formatting2/RoomFormatter.java b/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/formatting2/RoomFormatter.java deleted file mode 100644 index 83b7bc5e6..000000000 --- a/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/formatting2/RoomFormatter.java +++ /dev/null @@ -1,349 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.formatting2; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.common.collect.Iterators; -import com.google.inject.Inject; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.common.base.Annotation; -import org.eclipse.etrice.core.common.base.AnnotationType; -import org.eclipse.etrice.core.common.base.Documentation; -import org.eclipse.etrice.core.common.base.Import; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.fsm.fSM.ProtocolSemantics; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.fSM.Trigger; -import org.eclipse.etrice.core.fsm.fSM.TriggeredTransition; -import org.eclipse.etrice.core.fsm.formatting2.FSMFormatter; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.ExternalType; -import org.eclipse.etrice.core.room.GeneralProtocolClass; -import org.eclipse.etrice.core.room.Operation; -import org.eclipse.etrice.core.room.PortClass; -import org.eclipse.etrice.core.room.PrimitiveType; -import org.eclipse.etrice.core.room.RoomClass; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.core.services.RoomGrammarAccess; -import org.eclipse.xtext.AbstractRule; -import org.eclipse.xtext.Grammar; -import org.eclipse.xtext.GrammarUtil; -import org.eclipse.xtext.Keyword; -import org.eclipse.xtext.formatting2.IFormattableDocument; -import org.eclipse.xtext.formatting2.IHiddenRegionFormatter; -import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion; -import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.IteratorExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; -import org.eclipse.xtext.xbase.lib.Pair; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; - -@SuppressWarnings("all") -public class RoomFormatter extends FSMFormatter { - @Inject - @Extension - private RoomGrammarAccess _roomGrammarAccess; - - @Override - public void formatAllByKeywords(final EObject it, @Extension final IFormattableDocument document) { - super.formatAllByKeywords(it, document); - ISemanticRegionsFinder _allRegionsFor = this.textRegionExtensions.allRegionsFor(it); - List _keywords = _allRegionsFor.keywords("default", "void", "sends", "sub", "of", "and", "satisfied_by"); - final Consumer _function = (ISemanticRegion it_1) -> { - final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.surround(it_1, _function_1); - }; - _keywords.forEach(_function); - ISemanticRegionsFinder _allRegionsFor_1 = this.textRegionExtensions.allRegionsFor(it); - List _keywords_1 = _allRegionsFor_1.keywords("/"); - final Consumer _function_1 = (ISemanticRegion it_1) -> { - final Procedure1 _function_2 = (IHiddenRegionFormatter it_2) -> { - it_2.noSpace(); - }; - document.surround(it_1, _function_2); - }; - _keywords_1.forEach(_function_1); - Grammar _grammar = this._roomGrammarAccess.getGrammar(); - List _allRules = GrammarUtil.allRules(_grammar); - final Function1> _function_2 = (AbstractRule it_1) -> { - TreeIterator _eAllContents = it_1.eAllContents(); - Iterator _filter = Iterators.filter(_eAllContents, Keyword.class); - final Function1 _function_3 = (Keyword it_2) -> { - String _value = it_2.getValue(); - return Boolean.valueOf((!Objects.equal(_value, "ref"))); - }; - Iterator _filter_1 = IteratorExtensions.filter(_filter, _function_3); - final Function1 _function_4 = (Keyword it_2) -> { - String _value = it_2.getValue(); - char[] _charArray = _value.toCharArray(); - final Function1 _function_5 = (Character it_3) -> { - return Boolean.valueOf(Character.isLetter((it_3).charValue())); - }; - return Boolean.valueOf(IterableExtensions.forall(((Iterable)Conversions.doWrapArray(_charArray)), _function_5)); - }; - Iterator _filter_2 = IteratorExtensions.filter(_filter_1, _function_4); - return IteratorExtensions.toIterable(_filter_2); - }; - List> _map = ListExtensions.>map(_allRules, _function_2); - final Iterable textKeywords = Iterables.concat(_map); - ISemanticRegionsFinder _allRegionsFor_2 = this.textRegionExtensions.allRegionsFor(it); - List _keywords_2 = _allRegionsFor_2.keywords(((Keyword[])Conversions.unwrapArray(textKeywords, Keyword.class))); - final Consumer _function_3 = (ISemanticRegion it_1) -> { - final Procedure1 _function_4 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.append(it_1, _function_4); - }; - _keywords_2.forEach(_function_3); - } - - protected void _format(final RoomModel it, @Extension final IFormattableDocument document) { - this.formatAllByKeywords(it, document); - EList _eContents = it.eContents(); - EObject _head = IterableExtensions.head(_eContents); - final Procedure1 _function = (IHiddenRegionFormatter it_1) -> { - it_1.setNewLines(2); - }; - document.prepend(_head, _function); - EList _eContents_1 = it.eContents(); - Iterable _tail = IterableExtensions.tail(_eContents_1); - Iterable _filter = Iterables.filter(_tail, DataClass.class); - final Consumer _function_1 = (DataClass it_1) -> { - final Procedure1 _function_2 = (IHiddenRegionFormatter it_2) -> { - it_2.setNewLines(2); - }; - document.prepend(it_1, _function_2); - }; - _filter.forEach(_function_1); - EList _eContents_2 = it.eContents(); - Iterable _tail_1 = IterableExtensions.tail(_eContents_2); - Iterable _filter_1 = Iterables.filter(_tail_1, GeneralProtocolClass.class); - final Consumer _function_2 = (GeneralProtocolClass it_1) -> { - final Procedure1 _function_3 = (IHiddenRegionFormatter it_2) -> { - it_2.setNewLines(2); - }; - document.prepend(it_1, _function_3); - }; - _filter_1.forEach(_function_2); - EList _eContents_3 = it.eContents(); - Iterable _tail_2 = IterableExtensions.tail(_eContents_3); - Iterable _filter_2 = Iterables.filter(_tail_2, ActorClass.class); - final Consumer _function_3 = (ActorClass it_1) -> { - final Procedure1 _function_4 = (IHiddenRegionFormatter it_2) -> { - it_2.setNewLines(2); - }; - document.prepend(it_1, _function_4); - }; - _filter_2.forEach(_function_3); - EList _eContents_4 = it.eContents(); - Iterable _tail_3 = IterableExtensions.tail(_eContents_4); - Iterable _filter_3 = Iterables.filter(_tail_3, SubSystemClass.class); - final Consumer _function_4 = (SubSystemClass it_1) -> { - final Procedure1 _function_5 = (IHiddenRegionFormatter it_2) -> { - it_2.setNewLines(2); - }; - document.prepend(it_1, _function_5); - }; - _filter_3.forEach(_function_4); - EList _eContents_5 = it.eContents(); - Iterable _tail_4 = IterableExtensions.tail(_eContents_5); - Iterable _filter_4 = Iterables.filter(_tail_4, AnnotationType.class); - final Consumer _function_5 = (AnnotationType it_1) -> { - final Procedure1 _function_6 = (IHiddenRegionFormatter it_2) -> { - it_2.setNewLines(2); - }; - document.prepend(it_1, _function_6); - }; - _filter_4.forEach(_function_5); - EList _eContents_6 = it.eContents(); - Iterable _tail_5 = IterableExtensions.tail(_eContents_6); - Iterable _filter_5 = Iterables.filter(_tail_5, AnnotationType.class); - final Consumer _function_6 = (AnnotationType it_1) -> { - final Procedure1 _function_7 = (IHiddenRegionFormatter it_2) -> { - it_2.setNewLines(2); - }; - document.prepend(it_1, _function_7); - }; - _filter_5.forEach(_function_6); - EList _eContents_7 = it.eContents(); - Iterable _tail_6 = IterableExtensions.tail(_eContents_7); - Iterable _filter_6 = Iterables.filter(_tail_6, Import.class); - final Consumer _function_7 = (Import it_1) -> { - this.prependDefaultNewLines(it_1, document); - }; - _filter_6.forEach(_function_7); - EList _eContents_8 = it.eContents(); - Iterable _tail_7 = IterableExtensions.tail(_eContents_8); - Iterable _filter_7 = Iterables.filter(_tail_7, PrimitiveType.class); - final Consumer _function_8 = (PrimitiveType it_1) -> { - this.prependDefaultNewLines(it_1, document); - }; - _filter_7.forEach(_function_8); - EList _eContents_9 = it.eContents(); - Iterable _tail_8 = IterableExtensions.tail(_eContents_9); - Iterable _filter_8 = Iterables.filter(_tail_8, EnumerationType.class); - final Consumer _function_9 = (EnumerationType it_1) -> { - this.prependDefaultNewLines(it_1, document); - }; - _filter_8.forEach(_function_9); - EList _eContents_10 = it.eContents(); - Iterable _tail_9 = IterableExtensions.tail(_eContents_10); - Iterable _filter_9 = Iterables.filter(_tail_9, ExternalType.class); - final Consumer _function_10 = (ExternalType it_1) -> { - this.prependDefaultNewLines(it_1, document); - }; - _filter_9.forEach(_function_10); - TreeIterator _eAllContents = it.eAllContents(); - final Procedure1 _function_11 = (EObject it_1) -> { - document.format(it_1); - }; - IteratorExtensions.forEach(_eAllContents, _function_11); - } - - protected void _format(final RoomClass it, @Extension final IFormattableDocument document) { - EList _eContents = it.eContents(); - final Function1 _function = (EObject it_1) -> { - return Boolean.valueOf((!((it_1 instanceof DetailCode) || (it_1 instanceof Documentation)))); - }; - Iterable _filter = IterableExtensions.filter(_eContents, _function); - final Consumer _function_1 = (EObject it_1) -> { - this.prependDefaultNewLines(it_1, document); - }; - _filter.forEach(_function_1); - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - List _keywords = _regionFor.keywords("usercode1", "usercode2", "usercode3", "incoming", "outgoing", "regular", "conjugated", "Interface", "Structure", "Behavior"); - final Consumer _function_2 = (ISemanticRegion it_1) -> { - this.prependDefaultNewLines(it_1, document); - }; - _keywords.forEach(_function_2); - } - - protected void _format(final PortClass it, @Extension final IFormattableDocument document) { - EList _eContents = it.eContents(); - final Function1 _function = (EObject it_1) -> { - return Boolean.valueOf((!((it_1 instanceof DetailCode) || (it_1 instanceof Documentation)))); - }; - Iterable _filter = IterableExtensions.filter(_eContents, _function); - final Consumer _function_1 = (EObject it_1) -> { - this.prependDefaultNewLines(it_1, document); - }; - _filter.forEach(_function_1); - } - - protected void _format(final Operation it, @Extension final IFormattableDocument document) { - EList _arguments = it.getArguments(); - final Consumer _function = (VarDecl it_1) -> { - final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { - it_2.noSpace(); - }; - document.append(it_1, _function_1); - }; - _arguments.forEach(_function); - } - - protected void _format(final Attribute it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - List> _keywordPairs = _regionFor.keywordPairs("[", "]"); - final Consumer> _function = (Pair it_1) -> { - ISemanticRegion _key = it_1.getKey(); - final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { - it_2.oneSpace(); - }; - document.prepend(_key, _function_1); - final Procedure1 _function_2 = (IHiddenRegionFormatter it_2) -> { - it_2.noSpace(); - }; - document.interior(it_1, _function_2); - }; - _keywordPairs.forEach(_function); - } - - public void format(final Object it, final IFormattableDocument document) { - if (it instanceof TriggeredTransition) { - _format((TriggeredTransition)it, document); - return; - } else if (it instanceof State) { - _format((State)it, document); - return; - } else if (it instanceof XtextResource) { - _format((XtextResource)it, document); - return; - } else if (it instanceof Transition) { - _format((Transition)it, document); - return; - } else if (it instanceof Annotation) { - _format((Annotation)it, document); - return; - } else if (it instanceof AnnotationType) { - _format((AnnotationType)it, document); - return; - } else if (it instanceof Documentation) { - _format((Documentation)it, document); - return; - } else if (it instanceof Import) { - _format((Import)it, document); - return; - } else if (it instanceof DetailCode) { - _format((DetailCode)it, document); - return; - } else if (it instanceof ProtocolSemantics) { - _format((ProtocolSemantics)it, document); - return; - } else if (it instanceof StateGraph) { - _format((StateGraph)it, document); - return; - } else if (it instanceof Trigger) { - _format((Trigger)it, document); - return; - } else if (it instanceof Attribute) { - _format((Attribute)it, document); - return; - } else if (it instanceof Operation) { - _format((Operation)it, document); - return; - } else if (it instanceof PortClass) { - _format((PortClass)it, document); - return; - } else if (it instanceof RoomClass) { - _format((RoomClass)it, document); - return; - } else if (it instanceof RoomModel) { - _format((RoomModel)it, document); - return; - } else if (it instanceof EObject) { - _format((EObject)it, document); - return; - } else if (it == null) { - _format((Void)null, document); - return; - } else if (it != null) { - _format(it, document); - return; - } else { - throw new IllegalArgumentException("Unhandled parameter types: " + - Arrays.asList(it, document).toString()); - } - } -} diff --git a/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.java b/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.java deleted file mode 100644 index f5fc88d6e..000000000 --- a/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.java +++ /dev/null @@ -1,1504 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.postprocessing; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -/** - * This post processor adds documentation to the generated EMF model. - * By intention no {@code null} checks are performed. This way developers - * find easier if the referenced class, attribute or reference isn't found. - */ -@SuppressWarnings("all") -public class DocuPostprocessor { - public void process(final GeneratedMetamodel metamodel) { - final EPackage pckg = metamodel.getEPackage(); - EClass cls = PostprocessingHelpers.getClass(pckg, "RoomModel"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("The root object for the ROOM model. It gives access to {@link Import imports} and"); - _builder.newLine(); - _builder.append("the {@link SubSystemClass sub system},"); - _builder.newLine(); - _builder.append("{@link ActorClass actor}, {@link ProtocolClass protocol} and"); - _builder.newLine(); - _builder.append("{@link DataClass data} classes defined."); - _builder.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder.toString()); - EAttribute _attribute = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("The model name is a dot separated fully qualified name and is"); - _builder_1.newLine(); - _builder_1.append("used to provide a name space. The generators may use that also"); - _builder_1.newLine(); - _builder_1.append("to place the generated code into separate directories."); - _builder_1.newLine(); - PostprocessingHelpers.setDocumentation(_attribute, _builder_1.toString()); - EReference _reference = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("This is an optional documentation."); - _builder_2.newLine(); - PostprocessingHelpers.setDocumentation(_reference, _builder_2.toString()); - EReference _reference_1 = PostprocessingHelpers.getReference(cls, "imports"); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("This is a list of all imported models."); - _builder_3.newLine(); - PostprocessingHelpers.setDocumentation(_reference_1, _builder_3.toString()); - EReference _reference_2 = PostprocessingHelpers.getReference(cls, "primitiveTypes"); - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("This is a list of all primitive types defined by this model."); - _builder_4.newLine(); - PostprocessingHelpers.setDocumentation(_reference_2, _builder_4.toString()); - EReference _reference_3 = PostprocessingHelpers.getReference(cls, "externalTypes"); - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("This is a list of all external types defined by this model."); - _builder_5.newLine(); - PostprocessingHelpers.setDocumentation(_reference_3, _builder_5.toString()); - EReference _reference_4 = PostprocessingHelpers.getReference(cls, "dataClasses"); - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("This is a list of all data classes defined by this model."); - _builder_6.newLine(); - PostprocessingHelpers.setDocumentation(_reference_4, _builder_6.toString()); - EReference _reference_5 = PostprocessingHelpers.getReference(cls, "protocolClasses"); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("This is a list of all protocol classes defined by this model."); - _builder_7.newLine(); - PostprocessingHelpers.setDocumentation(_reference_5, _builder_7.toString()); - EReference _reference_6 = PostprocessingHelpers.getReference(cls, "actorClasses"); - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("This is a list of all actor classes defined by this model."); - _builder_8.newLine(); - PostprocessingHelpers.setDocumentation(_reference_6, _builder_8.toString()); - EReference _reference_7 = PostprocessingHelpers.getReference(cls, "subSystemClasses"); - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append("This is a list of all sub system classes defined by this model."); - _builder_9.newLine(); - PostprocessingHelpers.setDocumentation(_reference_7, _builder_9.toString()); - EReference _reference_8 = PostprocessingHelpers.getReference(cls, "systems"); - StringConcatenation _builder_10 = new StringConcatenation(); - _builder_10.append("This is a list of all logical systems defined by this model."); - _builder_10.newLine(); - PostprocessingHelpers.setDocumentation(_reference_8, _builder_10.toString()); - EClass _class = PostprocessingHelpers.getClass(pckg, "RoomClass"); - cls = _class; - StringConcatenation _builder_11 = new StringConcatenation(); - _builder_11.append("This class is the super class of all classes"); - _builder_11.newLine(); - _builder_11.append("of the ROOM class model:"); - _builder_11.newLine(); - _builder_11.append("
    "); - _builder_11.newLine(); - _builder_11.append(" "); - _builder_11.append("
  • {@link DataType}
  • "); - _builder_11.newLine(); - _builder_11.append(" "); - _builder_11.append("
  • {@link GeneralProtocolClass}
  • "); - _builder_11.newLine(); - _builder_11.append(" "); - _builder_11.append("
  • {@link StructureClass}
  • "); - _builder_11.newLine(); - _builder_11.append("
"); - _builder_11.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_11.toString()); - EReference _reference_9 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_12 = new StringConcatenation(); - _builder_12.append("This is an optional documentation."); - _builder_12.newLine(); - PostprocessingHelpers.setDocumentation(_reference_9, _builder_12.toString()); - EClass _class_1 = PostprocessingHelpers.getClass(pckg, "StructureClass"); - cls = _class_1; - StringConcatenation _builder_13 = new StringConcatenation(); - _builder_13.append("This class is the super class of the structural classes"); - _builder_13.newLine(); - _builder_13.append("
    "); - _builder_13.newLine(); - _builder_13.append(" "); - _builder_13.append("
  • {@link ActorContainerClass}
  • "); - _builder_13.newLine(); - _builder_13.append(" "); - _builder_13.append("
  • {@link LogicalSystem}
  • "); - _builder_13.newLine(); - _builder_13.append("
"); - _builder_13.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_13.toString()); - EReference _reference_10 = PostprocessingHelpers.getReference(cls, "annotations"); - StringConcatenation _builder_14 = new StringConcatenation(); - _builder_14.append("This is a list of structure class annotations."); - _builder_14.newLine(); - PostprocessingHelpers.setDocumentation(_reference_10, _builder_14.toString()); - EReference _reference_11 = PostprocessingHelpers.getReference(cls, "bindings"); - StringConcatenation _builder_15 = new StringConcatenation(); - _builder_15.append("This is a list of structure class bindings."); - _builder_15.newLine(); - PostprocessingHelpers.setDocumentation(_reference_11, _builder_15.toString()); - EReference _reference_12 = PostprocessingHelpers.getReference(cls, "connections"); - StringConcatenation _builder_16 = new StringConcatenation(); - _builder_16.append("This is a list of structure class connections."); - _builder_16.newLine(); - PostprocessingHelpers.setDocumentation(_reference_12, _builder_16.toString()); - EClass _class_2 = PostprocessingHelpers.getClass(pckg, "ActorContainerClass"); - cls = _class_2; - StringConcatenation _builder_17 = new StringConcatenation(); - _builder_17.append("This class is the super class of the structural classes"); - _builder_17.newLine(); - _builder_17.append("
    "); - _builder_17.newLine(); - _builder_17.append(" "); - _builder_17.append("
  • {@link ActorClass}
  • "); - _builder_17.newLine(); - _builder_17.append(" "); - _builder_17.append("
  • {@link SubSystemClass}
  • "); - _builder_17.newLine(); - _builder_17.append("
"); - _builder_17.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_17.toString()); - EReference _reference_13 = PostprocessingHelpers.getReference(cls, "serviceProvisionPoints"); - StringConcatenation _builder_18 = new StringConcatenation(); - _builder_18.append("This is a list of all interface SPPs."); - _builder_18.newLine(); - PostprocessingHelpers.setDocumentation(_reference_13, _builder_18.toString()); - EReference _reference_14 = PostprocessingHelpers.getReference(cls, "actorRefs"); - StringConcatenation _builder_19 = new StringConcatenation(); - _builder_19.append("This is a list of all actor refs."); - _builder_19.newLine(); - PostprocessingHelpers.setDocumentation(_reference_14, _builder_19.toString()); - EReference _reference_15 = PostprocessingHelpers.getReference(cls, "userCode1"); - StringConcatenation _builder_20 = new StringConcatenation(); - _builder_20.append("The user code is treated in a generator dependent way."); - _builder_20.newLine(); - PostprocessingHelpers.setDocumentation(_reference_15, _builder_20.toString()); - EReference _reference_16 = PostprocessingHelpers.getReference(cls, "userCode2"); - StringConcatenation _builder_21 = new StringConcatenation(); - _builder_21.append("The user code is treated in a generator dependent way."); - _builder_21.newLine(); - PostprocessingHelpers.setDocumentation(_reference_16, _builder_21.toString()); - EReference _reference_17 = PostprocessingHelpers.getReference(cls, "userCode3"); - StringConcatenation _builder_22 = new StringConcatenation(); - _builder_22.append("The user code is treated in a generator dependent way."); - _builder_22.newLine(); - PostprocessingHelpers.setDocumentation(_reference_17, _builder_22.toString()); - EClass _class_3 = PostprocessingHelpers.getClass(pckg, "VarDecl"); - cls = _class_3; - StringConcatenation _builder_23 = new StringConcatenation(); - _builder_23.append("A variable declaration consists of a name and a type."); - _builder_23.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_23.toString()); - EAttribute _attribute_1 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_24 = new StringConcatenation(); - _builder_24.append("By this name the variable is referred to in the model."); - _builder_24.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_1, _builder_24.toString()); - EReference _reference_18 = PostprocessingHelpers.getReference(cls, "refType"); - StringConcatenation _builder_25 = new StringConcatenation(); - _builder_25.append("This is the data type of the variable."); - _builder_25.newLine(); - PostprocessingHelpers.setDocumentation(_reference_18, _builder_25.toString()); - EClass _class_4 = PostprocessingHelpers.getClass(pckg, "RefableType"); - cls = _class_4; - StringConcatenation _builder_26 = new StringConcatenation(); - _builder_26.append("This is a type with an optional reference attribute."); - _builder_26.newLine(); - _builder_26.append("If \'ref\' is {@code true} then by reference semantic is chosen."); - _builder_26.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_26.toString()); - EReference _reference_19 = PostprocessingHelpers.getReference(cls, "type"); - StringConcatenation _builder_27 = new StringConcatenation(); - _builder_27.append("This is the data type."); - _builder_27.newLine(); - PostprocessingHelpers.setDocumentation(_reference_19, _builder_27.toString()); - EAttribute _attribute_2 = PostprocessingHelpers.getAttribute(cls, "ref"); - StringConcatenation _builder_28 = new StringConcatenation(); - _builder_28.append("If {@code true} then by reference semantics is chosen, by value semantics else."); - _builder_28.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_2, _builder_28.toString()); - EClass _class_5 = PostprocessingHelpers.getClass(pckg, "DataType"); - cls = _class_5; - StringConcatenation _builder_29 = new StringConcatenation(); - _builder_29.append("The super class of"); - _builder_29.newLine(); - _builder_29.append("
    "); - _builder_29.newLine(); - _builder_29.append(" "); - _builder_29.append("
  • {@link PrimitiveType}
  • "); - _builder_29.newLine(); - _builder_29.append(" "); - _builder_29.append("
  • {@link EnumerationType}
  • "); - _builder_29.newLine(); - _builder_29.append(" "); - _builder_29.append("
  • {@link ComplexType}
  • "); - _builder_29.newLine(); - _builder_29.append("
"); - _builder_29.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_29.toString()); - EClass _class_6 = PostprocessingHelpers.getClass(pckg, "EnumerationType"); - cls = _class_6; - StringConcatenation _builder_30 = new StringConcatenation(); - _builder_30.append("A sub type of {@link DataType} for enumerations."); - _builder_30.newLine(); - _builder_30.append("The EnumerationType can be associated with a {@link PrimitiveType} as value type for"); - _builder_30.newLine(); - _builder_30.append("the {@link EnumLiteral}s. It has to contain at least one literal."); - _builder_30.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_30.toString()); - EReference _reference_20 = PostprocessingHelpers.getReference(cls, "primitiveType"); - StringConcatenation _builder_31 = new StringConcatenation(); - _builder_31.append("The value type of the literals."); - _builder_31.newLine(); - PostprocessingHelpers.setDocumentation(_reference_20, _builder_31.toString()); - EClass _class_7 = PostprocessingHelpers.getClass(pckg, "EnumLiteral"); - cls = _class_7; - StringConcatenation _builder_32 = new StringConcatenation(); - _builder_32.append("A literal value of the enumeration."); - _builder_32.newLine(); - _builder_32.append("It can have a value associated."); - _builder_32.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_32.toString()); - EAttribute _attribute_3 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_33 = new StringConcatenation(); - _builder_33.append("The name of the literal."); - _builder_33.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_3, _builder_33.toString()); - EReference _reference_21 = PostprocessingHelpers.getReference(cls, "literal"); - StringConcatenation _builder_34 = new StringConcatenation(); - _builder_34.append("The value of the literal. It is associated with a target type which defaults to"); - _builder_34.newLine(); - _builder_34.append("{@code int} and can be set explicitly using the {@link EnumerationType#getPrimitiveType()}"); - _builder_34.newLine(); - PostprocessingHelpers.setDocumentation(_reference_21, _builder_34.toString()); - EClass _class_8 = PostprocessingHelpers.getClass(pckg, "ComplexType"); - cls = _class_8; - StringConcatenation _builder_35 = new StringConcatenation(); - _builder_35.append("The super class of"); - _builder_35.newLine(); - _builder_35.append("
    "); - _builder_35.newLine(); - _builder_35.append(" "); - _builder_35.append("
  • {@link DataClass}
  • "); - _builder_35.newLine(); - _builder_35.append(" "); - _builder_35.append("
  • {@link ExternalType}
  • "); - _builder_35.newLine(); - _builder_35.append("
"); - _builder_35.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_35.toString()); - EClass _class_9 = PostprocessingHelpers.getClass(pckg, "PrimitiveType"); - cls = _class_9; - StringConcatenation _builder_36 = new StringConcatenation(); - _builder_36.append("A primitive type describes a type like int, char, float"); - _builder_36.newLine(); - _builder_36.append("and can represent the type with a certain precision"); - _builder_36.newLine(); - _builder_36.append("in the target language"); - _builder_36.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_36.toString()); - EAttribute _attribute_4 = PostprocessingHelpers.getAttribute(cls, "type"); - StringConcatenation _builder_37 = new StringConcatenation(); - _builder_37.append("This is one of the basic variable types."); - _builder_37.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_4, _builder_37.toString()); - EAttribute _attribute_5 = PostprocessingHelpers.getAttribute(cls, "targetName"); - StringConcatenation _builder_38 = new StringConcatenation(); - _builder_38.append("This is the type name in the target language."); - _builder_38.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_5, _builder_38.toString()); - EAttribute _attribute_6 = PostprocessingHelpers.getAttribute(cls, "castName"); - StringConcatenation _builder_39 = new StringConcatenation(); - _builder_39.append("This (optional) name is used for casts to this type."); - _builder_39.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_6, _builder_39.toString()); - EAttribute _attribute_7 = PostprocessingHelpers.getAttribute(cls, "defaultValueLiteral"); - StringConcatenation _builder_40 = new StringConcatenation(); - _builder_40.append("This is an optional default value literal."); - _builder_40.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_7, _builder_40.toString()); - EClass _class_10 = PostprocessingHelpers.getClass(pckg, "ExternalType"); - cls = _class_10; - StringConcatenation _builder_41 = new StringConcatenation(); - _builder_41.append("An external type is not defined in the ROOM model"); - _builder_41.newLine(); - _builder_41.append("but only referenced. It can not be instantiated."); - _builder_41.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_41.toString()); - EAttribute _attribute_8 = PostprocessingHelpers.getAttribute(cls, "targetName"); - StringConcatenation _builder_42 = new StringConcatenation(); - _builder_42.append("This is the type name in the target language."); - _builder_42.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_8, _builder_42.toString()); - EAttribute _attribute_9 = PostprocessingHelpers.getAttribute(cls, "defaultValueLiteral"); - StringConcatenation _builder_43 = new StringConcatenation(); - _builder_43.append("This is an optional default value literal."); - _builder_43.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_9, _builder_43.toString()); - EClass _class_11 = PostprocessingHelpers.getClass(pckg, "DataClass"); - cls = _class_11; - StringConcatenation _builder_44 = new StringConcatenation(); - _builder_44.append("Together with {@link ProtocolClass} and {@link ActorClass} one of"); - _builder_44.newLine(); - _builder_44.append("the main class types of the ROOM language."); - _builder_44.newLine(); - _builder_44.newLine(); - _builder_44.append("

"); - _builder_44.newLine(); - _builder_44.append("In ROOM this is the equivalent to a class in Java or C++."); - _builder_44.newLine(); - _builder_44.append("A data class can be derived from a base class (single"); - _builder_44.newLine(); - _builder_44.append("inheritance), has {@link Attribute}s and {@link Operation}s."); - _builder_44.newLine(); - _builder_44.append("

"); - _builder_44.newLine(); - _builder_44.newLine(); - _builder_44.append("

"); - _builder_44.newLine(); - _builder_44.append("Additionally it can be annotated with generator specific"); - _builder_44.newLine(); - _builder_44.append("meaning and user ocde can be added in several places"); - _builder_44.newLine(); - _builder_44.append("(again generator specific)."); - _builder_44.newLine(); - _builder_44.append("

"); - _builder_44.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_44.toString()); - EAttribute _attribute_10 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_45 = new StringConcatenation(); - _builder_45.append("The name of the data class by which it is referred to in the model."); - _builder_45.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_10, _builder_45.toString()); - EReference _reference_22 = PostprocessingHelpers.getReference(cls, "base"); - StringConcatenation _builder_46 = new StringConcatenation(); - _builder_46.append("The base class from which all attributes and operations are inherited."); - _builder_46.newLine(); - PostprocessingHelpers.setDocumentation(_reference_22, _builder_46.toString()); - EReference _reference_23 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_47 = new StringConcatenation(); - _builder_47.append("Attributes are the data members of the data class."); - _builder_47.newLine(); - PostprocessingHelpers.setDocumentation(_reference_23, _builder_47.toString()); - EReference _reference_24 = PostprocessingHelpers.getReference(cls, "operations"); - StringConcatenation _builder_48 = new StringConcatenation(); - _builder_48.append("Operations are the methods of the data class."); - _builder_48.newLine(); - PostprocessingHelpers.setDocumentation(_reference_24, _builder_48.toString()); - EReference _reference_25 = PostprocessingHelpers.getReference(cls, "annotations"); - StringConcatenation _builder_49 = new StringConcatenation(); - _builder_49.append("This is a list of data class annotations."); - _builder_49.newLine(); - PostprocessingHelpers.setDocumentation(_reference_25, _builder_49.toString()); - EReference _reference_26 = PostprocessingHelpers.getReference(cls, "userCode1"); - StringConcatenation _builder_50 = new StringConcatenation(); - _builder_50.append("The user code is treated in a generator dependent way."); - _builder_50.newLine(); - PostprocessingHelpers.setDocumentation(_reference_26, _builder_50.toString()); - EReference _reference_27 = PostprocessingHelpers.getReference(cls, "userCode2"); - StringConcatenation _builder_51 = new StringConcatenation(); - _builder_51.append("The user code is treated in a generator dependent way."); - _builder_51.newLine(); - PostprocessingHelpers.setDocumentation(_reference_27, _builder_51.toString()); - EReference _reference_28 = PostprocessingHelpers.getReference(cls, "userCode3"); - StringConcatenation _builder_52 = new StringConcatenation(); - _builder_52.append("The user code is treated in a generator dependent way."); - _builder_52.newLine(); - PostprocessingHelpers.setDocumentation(_reference_28, _builder_52.toString()); - EClass _class_12 = PostprocessingHelpers.getClass(pckg, "Attribute"); - cls = _class_12; - StringConcatenation _builder_53 = new StringConcatenation(); - _builder_53.append("An attribute is a named member of a"); - _builder_53.newLine(); - _builder_53.append("
    "); - _builder_53.newLine(); - _builder_53.append(" "); - _builder_53.append("
  • {@link DataClass}
  • "); - _builder_53.newLine(); - _builder_53.append(" "); - _builder_53.append("
  • {@link ActorClass}
  • "); - _builder_53.newLine(); - _builder_53.append(" "); - _builder_53.append("
  • {@link PortClass}
  • "); - _builder_53.newLine(); - _builder_53.append("
"); - _builder_53.newLine(); - _builder_53.append("

"); - _builder_53.newLine(); - _builder_53.append("It can be of scalar or array type and is of a {@link RefableType}."); - _builder_53.newLine(); - _builder_53.append("It is possible to assign a default value literal."); - _builder_53.newLine(); - _builder_53.append("

"); - _builder_53.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_53.toString()); - EAttribute _attribute_11 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_54 = new StringConcatenation(); - _builder_54.append("The name of the attribute by which it is referred to in the model."); - _builder_54.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_11, _builder_54.toString()); - EAttribute _attribute_12 = PostprocessingHelpers.getAttribute(cls, "size"); - StringConcatenation _builder_55 = new StringConcatenation(); - _builder_55.append("The default is scalar ({@code size=1}), values {@code >1} indicate an array."); - _builder_55.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_12, _builder_55.toString()); - EReference _reference_29 = PostprocessingHelpers.getReference(cls, "type"); - StringConcatenation _builder_56 = new StringConcatenation(); - _builder_56.append("This is the attribute\'s type."); - _builder_56.newLine(); - PostprocessingHelpers.setDocumentation(_reference_29, _builder_56.toString()); - EAttribute _attribute_13 = PostprocessingHelpers.getAttribute(cls, "defaultValueLiteral"); - StringConcatenation _builder_57 = new StringConcatenation(); - _builder_57.append("This is an optional default value literal."); - _builder_57.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_13, _builder_57.toString()); - EReference _reference_30 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_58 = new StringConcatenation(); - _builder_58.append("This is an optional documentation."); - _builder_58.newLine(); - PostprocessingHelpers.setDocumentation(_reference_30, _builder_58.toString()); - EClass _class_13 = PostprocessingHelpers.getClass(pckg, "Operation"); - cls = _class_13; - StringConcatenation _builder_59 = new StringConcatenation(); - _builder_59.append("The super class of"); - _builder_59.newLine(); - _builder_59.append("
    "); - _builder_59.newLine(); - _builder_59.append(" "); - _builder_59.append("
  • {@link StandardOperation}
  • "); - _builder_59.newLine(); - _builder_59.append(" "); - _builder_59.append("
  • {@link PortOperation}
  • "); - _builder_59.newLine(); - _builder_59.append("
"); - _builder_59.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_59.toString()); - EAttribute _attribute_14 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_60 = new StringConcatenation(); - _builder_60.append("The name of the operation by which it is referred to in the model."); - _builder_60.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_14, _builder_60.toString()); - EReference _reference_31 = PostprocessingHelpers.getReference(cls, "arguments"); - StringConcatenation _builder_61 = new StringConcatenation(); - _builder_61.append("This is a list of arguments for the operation."); - _builder_61.newLine(); - PostprocessingHelpers.setDocumentation(_reference_31, _builder_61.toString()); - EReference _reference_32 = PostprocessingHelpers.getReference(cls, "returnType"); - StringConcatenation _builder_62 = new StringConcatenation(); - _builder_62.append("This is an optional return type of the operation."); - _builder_62.newLine(); - PostprocessingHelpers.setDocumentation(_reference_32, _builder_62.toString()); - EReference _reference_33 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_63 = new StringConcatenation(); - _builder_63.append("This is an optional documentation."); - _builder_63.newLine(); - PostprocessingHelpers.setDocumentation(_reference_33, _builder_63.toString()); - EReference _reference_34 = PostprocessingHelpers.getReference(cls, "detailCode"); - StringConcatenation _builder_64 = new StringConcatenation(); - _builder_64.append("This is the operation body written in code generator target language."); - _builder_64.newLine(); - PostprocessingHelpers.setDocumentation(_reference_34, _builder_64.toString()); - EClass _class_14 = PostprocessingHelpers.getClass(pckg, "StandardOperation"); - cls = _class_14; - StringConcatenation _builder_65 = new StringConcatenation(); - _builder_65.append("The standard form of an operation as used by"); - _builder_65.newLine(); - _builder_65.append("{@link ActorClass} and {@link DataClass}."); - _builder_65.newLine(); - _builder_65.append("

"); - _builder_65.newLine(); - _builder_65.append("The operation has a list of {@link VarDecl} arguments, an"); - _builder_65.newLine(); - _builder_65.append("optional return {@link RefableType} and a body (specified"); - _builder_65.newLine(); - _builder_65.append("as {@link DetailCode})."); - _builder_65.newLine(); - _builder_65.append("

"); - _builder_65.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_65.toString()); - EClass _class_15 = PostprocessingHelpers.getClass(pckg, "PortOperation"); - cls = _class_15; - StringConcatenation _builder_66 = new StringConcatenation(); - _builder_66.append("The port operation is very similar to the {@link StandardOperation}"); - _builder_66.newLine(); - _builder_66.append("and is used in the {@link PortClass}."); - _builder_66.newLine(); - _builder_66.append("

"); - _builder_66.newLine(); - _builder_66.append("Optionally a {@link Message} can be specified which is sent"); - _builder_66.newLine(); - _builder_66.append("when the method is invoked. For this reason these operations"); - _builder_66.newLine(); - _builder_66.append("are also shown in the \'messages\' dialog of the behavior editor."); - _builder_66.newLine(); - _builder_66.append("

"); - _builder_66.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_66.toString()); - EReference _reference_35 = PostprocessingHelpers.getReference(cls, "sendsMsg"); - StringConcatenation _builder_67 = new StringConcatenation(); - _builder_67.append("This optional reference to a message means that the operation sends a message."); - _builder_67.newLine(); - PostprocessingHelpers.setDocumentation(_reference_35, _builder_67.toString()); - EClass _class_16 = PostprocessingHelpers.getClass(pckg, "ClassStructor"); - cls = _class_16; - StringConcatenation _builder_68 = new StringConcatenation(); - _builder_68.append("Represents either the constructor (ctor) or destructor (dtor) of a ROOM class."); - _builder_68.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_68.toString()); - EClass _class_17 = PostprocessingHelpers.getClass(pckg, "GeneralProtocolClass"); - cls = _class_17; - StringConcatenation _builder_69 = new StringConcatenation(); - _builder_69.append("The super class of"); - _builder_69.newLine(); - _builder_69.append("
    "); - _builder_69.newLine(); - _builder_69.append(" "); - _builder_69.append("
  • {@link ProtocolClass}
  • "); - _builder_69.newLine(); - _builder_69.append(" "); - _builder_69.append("
  • {@link CompoundProtocolClass}
  • "); - _builder_69.newLine(); - _builder_69.append("
"); - _builder_69.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_69.toString()); - EReference _reference_36 = PostprocessingHelpers.getReference(cls, "annotations"); - StringConcatenation _builder_70 = new StringConcatenation(); - _builder_70.append("This is a list of protocol class annotations."); - _builder_70.newLine(); - PostprocessingHelpers.setDocumentation(_reference_36, _builder_70.toString()); - EClass _class_18 = PostprocessingHelpers.getClass(pckg, "ProtocolClass"); - cls = _class_18; - StringConcatenation _builder_71 = new StringConcatenation(); - _builder_71.append("Together with {@link ActorClass} and {@link DataClass} one of"); - _builder_71.newLine(); - _builder_71.append("the main class types of the ROOM language."); - _builder_71.newLine(); - _builder_71.append("

"); - _builder_71.newLine(); - _builder_71.append("A protocol class specifies a directed {@link Port} interface"); - _builder_71.newLine(); - _builder_71.append("by two sets of {@link Message}s: incoming and outgoing."); - _builder_71.newLine(); - _builder_71.append("

"); - _builder_71.newLine(); - _builder_71.append("

"); - _builder_71.newLine(); - _builder_71.append("A protocol class can derive from a base class (single inheritance)."); - _builder_71.newLine(); - _builder_71.append("In this case it must only extend one of the message sets:"); - _builder_71.newLine(); - _builder_71.append("incoming or outgoing."); - _builder_71.newLine(); - _builder_71.append("

"); - _builder_71.newLine(); - _builder_71.append("

"); - _builder_71.newLine(); - _builder_71.append("Optionally {@link PortClass}es may be defined for regular and"); - _builder_71.newLine(); - _builder_71.append("conjugate {@link Port}s. These classes can be used to add specific"); - _builder_71.newLine(); - _builder_71.append("behavior e.g. by adding message handlers. This kind of felxibility"); - _builder_71.newLine(); - _builder_71.append("can be used in particular for the efficient implementation of"); - _builder_71.newLine(); - _builder_71.append("services (SAPs and SPPs)."); - _builder_71.newLine(); - _builder_71.append("

"); - _builder_71.newLine(); - _builder_71.append("

"); - _builder_71.newLine(); - _builder_71.append("Last not least a so called \'legal execution tree\' can be specified"); - _builder_71.newLine(); - _builder_71.append("using {@link ProtocolSemantics}."); - _builder_71.newLine(); - _builder_71.append("

"); - _builder_71.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_71.toString()); - EAttribute _attribute_15 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_72 = new StringConcatenation(); - _builder_72.append("The name of the protocol class by which it is referred to in the model."); - _builder_72.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_15, _builder_72.toString()); - EReference _reference_37 = PostprocessingHelpers.getReference(cls, "base"); - StringConcatenation _builder_73 = new StringConcatenation(); - _builder_73.append("The base class from which all messages are inherited."); - _builder_73.newLine(); - _builder_73.append("The port classes and the semantics are not inherited."); - _builder_73.newLine(); - PostprocessingHelpers.setDocumentation(_reference_37, _builder_73.toString()); - EAttribute _attribute_16 = PostprocessingHelpers.getAttribute(cls, "commType"); - StringConcatenation _builder_74 = new StringConcatenation(); - _builder_74.append("This is the communication type of the protocol."); - _builder_74.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_16, _builder_74.toString()); - EReference _reference_38 = PostprocessingHelpers.getReference(cls, "userCode1"); - StringConcatenation _builder_75 = new StringConcatenation(); - _builder_75.append("The user code is treated in a generator dependent way."); - _builder_75.newLine(); - PostprocessingHelpers.setDocumentation(_reference_38, _builder_75.toString()); - EReference _reference_39 = PostprocessingHelpers.getReference(cls, "userCode2"); - StringConcatenation _builder_76 = new StringConcatenation(); - _builder_76.append("The user code is treated in a generator dependent way."); - _builder_76.newLine(); - PostprocessingHelpers.setDocumentation(_reference_39, _builder_76.toString()); - EReference _reference_40 = PostprocessingHelpers.getReference(cls, "userCode3"); - StringConcatenation _builder_77 = new StringConcatenation(); - _builder_77.append("The user code is treated in a generator dependent way."); - _builder_77.newLine(); - PostprocessingHelpers.setDocumentation(_reference_40, _builder_77.toString()); - EReference _reference_41 = PostprocessingHelpers.getReference(cls, "incomingMessages"); - StringConcatenation _builder_78 = new StringConcatenation(); - _builder_78.append("This is the set of incoming messages of this protocol."); - _builder_78.newLine(); - PostprocessingHelpers.setDocumentation(_reference_41, _builder_78.toString()); - EReference _reference_42 = PostprocessingHelpers.getReference(cls, "outgoingMessages"); - StringConcatenation _builder_79 = new StringConcatenation(); - _builder_79.append("This is the set of outgoing messages of this protocol."); - _builder_79.newLine(); - PostprocessingHelpers.setDocumentation(_reference_42, _builder_79.toString()); - EReference _reference_43 = PostprocessingHelpers.getReference(cls, "regular"); - StringConcatenation _builder_80 = new StringConcatenation(); - _builder_80.append("This is the optional regular port class specification."); - _builder_80.newLine(); - PostprocessingHelpers.setDocumentation(_reference_43, _builder_80.toString()); - EReference _reference_44 = PostprocessingHelpers.getReference(cls, "conjugated"); - StringConcatenation _builder_81 = new StringConcatenation(); - _builder_81.append("This is the optional conjugate port class specification."); - _builder_81.newLine(); - PostprocessingHelpers.setDocumentation(_reference_44, _builder_81.toString()); - EReference _reference_45 = PostprocessingHelpers.getReference(cls, "semantics"); - StringConcatenation _builder_82 = new StringConcatenation(); - _builder_82.append("This is the optional semantics specification for this protocol."); - _builder_82.newLine(); - PostprocessingHelpers.setDocumentation(_reference_45, _builder_82.toString()); - EClass _class_19 = PostprocessingHelpers.getClass(pckg, "CompoundProtocolClass"); - cls = _class_19; - StringConcatenation _builder_83 = new StringConcatenation(); - _builder_83.append("This special protocol class is used to bundle several protocols"); - _builder_83.newLine(); - _builder_83.append("in relay ports. This can be useful to avoid parallel chains"); - _builder_83.newLine(); - _builder_83.append("of {@link Binding}s traversing the structural hierarchy."); - _builder_83.newLine(); - _builder_83.append("

"); - _builder_83.newLine(); - _builder_83.append("The compound protocol class consists of several {@link SubProtocol}s."); - _builder_83.newLine(); - _builder_83.append("

"); - _builder_83.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_83.toString()); - EReference _reference_46 = PostprocessingHelpers.getReference(cls, "subProtocols"); - StringConcatenation _builder_84 = new StringConcatenation(); - _builder_84.append("This is a list of sub protocols."); - _builder_84.newLine(); - PostprocessingHelpers.setDocumentation(_reference_46, _builder_84.toString()); - EClass _class_20 = PostprocessingHelpers.getClass(pckg, "SubProtocol"); - cls = _class_20; - StringConcatenation _builder_85 = new StringConcatenation(); - _builder_85.append("The sub protocol is part of the {@link CompoundProtocolClass} and defines"); - _builder_85.newLine(); - _builder_85.append("kind of a named channel for messages. The sub protocols are used to associate an"); - _builder_85.newLine(); - _builder_85.append("end port with a particular channel."); - _builder_85.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_85.toString()); - EAttribute _attribute_17 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_86 = new StringConcatenation(); - _builder_86.append("By this name the sub protocols or channels are distinguished."); - _builder_86.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_17, _builder_86.toString()); - EReference _reference_47 = PostprocessingHelpers.getReference(cls, "protocol"); - StringConcatenation _builder_87 = new StringConcatenation(); - _builder_87.append("This is the protocol of this channel."); - _builder_87.newLine(); - PostprocessingHelpers.setDocumentation(_reference_47, _builder_87.toString()); - EClass _class_21 = PostprocessingHelpers.getClass(pckg, "Message"); - cls = _class_21; - StringConcatenation _builder_88 = new StringConcatenation(); - _builder_88.append("This is a concrete sub class of an {@link AbstractMessage}."); - _builder_88.newLine(); - _builder_88.append("A message in ROOM is part of a {@link ProtocolClass}. Messages are exchanged via {@link Port}s."); - _builder_88.newLine(); - _builder_88.append("For event driven protocols the message is an object that is deliverd using a message"); - _builder_88.newLine(); - _builder_88.append("service of the runtime. For data driven systems only messages holding data are valid. In this"); - _builder_88.newLine(); - _builder_88.append("case the conjugate port is the one holding (and writing) the data and the regular port is"); - _builder_88.newLine(); - _builder_88.append("reading the data."); - _builder_88.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_88.toString()); - EAttribute _attribute_18 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_89 = new StringConcatenation(); - _builder_89.append("By this name the message is referred to in the model."); - _builder_89.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_18, _builder_89.toString()); - EAttribute _attribute_19 = PostprocessingHelpers.getAttribute(cls, "priv"); - StringConcatenation _builder_90 = new StringConcatenation(); - _builder_90.append("If this flag is {@code true} then the message is treated as private for this protocol"); - _builder_90.newLine(); - _builder_90.append("and can only be sent by a PortClass."); - _builder_90.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_19, _builder_90.toString()); - EReference _reference_48 = PostprocessingHelpers.getReference(cls, "data"); - StringConcatenation _builder_91 = new StringConcatenation(); - _builder_91.append("This is a reference to optional message data."); - _builder_91.newLine(); - PostprocessingHelpers.setDocumentation(_reference_48, _builder_91.toString()); - EReference _reference_49 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_92 = new StringConcatenation(); - _builder_92.append("This is an optional documentation."); - _builder_92.newLine(); - PostprocessingHelpers.setDocumentation(_reference_49, _builder_92.toString()); - EClass _class_22 = PostprocessingHelpers.getClass(pckg, "PortClass"); - cls = _class_22; - StringConcatenation _builder_93 = new StringConcatenation(); - _builder_93.append("A port class can be specified to customize the behavior of a {@link ProtocolClass}."); - _builder_93.newLine(); - _builder_93.append("There can be one for regular ports and another one for conjugate ports independently."); - _builder_93.newLine(); - _builder_93.newLine(); - _builder_93.append("

"); - _builder_93.newLine(); - _builder_93.append("Port classes can be used to define attributes and operations and message handlers"); - _builder_93.newLine(); - _builder_93.append("(or interceptors)."); - _builder_93.newLine(); - _builder_93.append("

"); - _builder_93.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_93.toString()); - EReference _reference_50 = PostprocessingHelpers.getReference(cls, "operations"); - StringConcatenation _builder_94 = new StringConcatenation(); - _builder_94.append("This is a list of operations of this nested class."); - _builder_94.newLine(); - PostprocessingHelpers.setDocumentation(_reference_50, _builder_94.toString()); - EReference _reference_51 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_95 = new StringConcatenation(); - _builder_95.append("This is a list of attributes of this nested class."); - _builder_95.newLine(); - PostprocessingHelpers.setDocumentation(_reference_51, _builder_95.toString()); - EReference _reference_52 = PostprocessingHelpers.getReference(cls, "userCode"); - StringConcatenation _builder_96 = new StringConcatenation(); - _builder_96.append("The user code is treated in a generator dependent way."); - _builder_96.newLine(); - PostprocessingHelpers.setDocumentation(_reference_52, _builder_96.toString()); - EReference _reference_53 = PostprocessingHelpers.getReference(cls, "msgHandlers"); - StringConcatenation _builder_97 = new StringConcatenation(); - _builder_97.append("This is a list of message handlers."); - _builder_97.newLine(); - PostprocessingHelpers.setDocumentation(_reference_53, _builder_97.toString()); - EClass _class_23 = PostprocessingHelpers.getClass(pckg, "MessageHandler"); - cls = _class_23; - StringConcatenation _builder_98 = new StringConcatenation(); - _builder_98.append("The super class of"); - _builder_98.newLine(); - _builder_98.append("
    "); - _builder_98.newLine(); - _builder_98.append(" "); - _builder_98.append("
  • {@link InMessageHandler}
  • "); - _builder_98.newLine(); - _builder_98.append(" "); - _builder_98.append("
  • {@link OutMessageHandler}
  • "); - _builder_98.newLine(); - _builder_98.append("
"); - _builder_98.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_98.toString()); - EReference _reference_54 = PostprocessingHelpers.getReference(cls, "msg"); - StringConcatenation _builder_99 = new StringConcatenation(); - _builder_99.append("This is the message that is handled."); - _builder_99.newLine(); - PostprocessingHelpers.setDocumentation(_reference_54, _builder_99.toString()); - EReference _reference_55 = PostprocessingHelpers.getReference(cls, "detailCode"); - StringConcatenation _builder_100 = new StringConcatenation(); - _builder_100.append("This is the handler code written in code generator target language."); - _builder_100.newLine(); - PostprocessingHelpers.setDocumentation(_reference_55, _builder_100.toString()); - EClass _class_24 = PostprocessingHelpers.getClass(pckg, "InMessageHandler"); - cls = _class_24; - StringConcatenation _builder_101 = new StringConcatenation(); - _builder_101.append("Is a handler (or interceptor) for incoming messages. In the generated code the"); - _builder_101.newLine(); - _builder_101.append("message is available. It is derived from {@link MessageHandler}."); - _builder_101.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_101.toString()); - EClass _class_25 = PostprocessingHelpers.getClass(pckg, "OutMessageHandler"); - cls = _class_25; - StringConcatenation _builder_102 = new StringConcatenation(); - _builder_102.append("Is a handler (or interceptor) for outgoing messages. In the generated code the"); - _builder_102.newLine(); - _builder_102.append("message is available. It is derived from {@link MessageHandler}."); - _builder_102.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_102.toString()); - EClass _class_26 = PostprocessingHelpers.getClass(pckg, "ActorClass"); - cls = _class_26; - StringConcatenation _builder_103 = new StringConcatenation(); - _builder_103.append("Together with {@link ProtocolClass} and {@link DataClass} one of"); - _builder_103.newLine(); - _builder_103.append("the main class types of the ROOM language."); - _builder_103.newLine(); - _builder_103.newLine(); - _builder_103.append("

"); - _builder_103.newLine(); - _builder_103.append("The actor class in ROOM has three compartments which aren\'t represented as separate model objects."); - _builder_103.newLine(); - _builder_103.append("To understand to which compartment an attribute or reference belongs to here is a list"); - _builder_103.newLine(); - _builder_103.append("

    "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
  • Interface: everything which is visible from the outside from a model point of view"); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
      "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getInterfacePorts}: a list of all interface {@link Port}s
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link ActorContainerClass#getServiceProvisionPoints()}: a list of all interface {@link SPP}s
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
  • Structure: all internal structural aspects of an actor class
  • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
      "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getUserCode1}-3: user defined code with generator dependent meaning
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getInternalPorts}: a list of all internal end {@link Port}s
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getExternalPorts}: a list of all {@link ExternalPort}s (the interface ports that"); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("are end ports, not relay ports
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getServiceImplementations}: a list of all {@link ServiceImplementation}s
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getServiceAccessPoints}: a list of all {@link SAP}s used by this actor class
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getAttributes}: a list of all actor class {@link Attribute}s
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getActorRefs}: a list of all referenced actor classes (an {@link ActorRef}"); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("has the meaning of a composition)
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getBindings}: a list of all port {@link Binding}s of this actor class
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getConnections}: a list of all {@link LayerConnection}s
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
  • Behavior: the behavioral aspects of an actor class
  • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
      "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getOperations}: a list of {@link Operation}s
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    • {@link #getStateMachine}: the {@link StateGraph state machine} definition
    • "); - _builder_103.newLine(); - _builder_103.append(" "); - _builder_103.append("
    "); - _builder_103.newLine(); - _builder_103.append("
"); - _builder_103.newLine(); - _builder_103.append("

"); - _builder_103.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_103.toString()); - EAttribute _attribute_20 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_104 = new StringConcatenation(); - _builder_104.append("By this name the actor class is referred to in the model."); - _builder_104.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_20, _builder_104.toString()); - EAttribute _attribute_21 = PostprocessingHelpers.getAttribute(cls, "abstract"); - StringConcatenation _builder_105 = new StringConcatenation(); - _builder_105.append("If {@code true} this actor class can not be instantiated and can only be base class"); - _builder_105.newLine(); - _builder_105.append("for other actor classes."); - _builder_105.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_21, _builder_105.toString()); - EAttribute _attribute_22 = PostprocessingHelpers.getAttribute(cls, "commType"); - StringConcatenation _builder_106 = new StringConcatenation(); - _builder_106.append("The communication type of this actor class."); - _builder_106.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_22, _builder_106.toString()); - EReference _reference_56 = PostprocessingHelpers.getReference(cls, "base"); - StringConcatenation _builder_107 = new StringConcatenation(); - _builder_107.append("The base class from which all attributes, operations, ports, SAPs"); - _builder_107.newLine(); - _builder_107.append("and state machine are inherited."); - _builder_107.newLine(); - PostprocessingHelpers.setDocumentation(_reference_56, _builder_107.toString()); - EReference _reference_57 = PostprocessingHelpers.getReference(cls, "interfacePorts"); - StringConcatenation _builder_108 = new StringConcatenation(); - _builder_108.append("This is a list containing all ports of the actor interface."); - _builder_108.newLine(); - PostprocessingHelpers.setDocumentation(_reference_57, _builder_108.toString()); - EReference _reference_58 = PostprocessingHelpers.getReference(cls, "internalPorts"); - StringConcatenation _builder_109 = new StringConcatenation(); - _builder_109.append("This is a list containing all ports of the actor structure (internal end ports)."); - _builder_109.newLine(); - PostprocessingHelpers.setDocumentation(_reference_58, _builder_109.toString()); - EReference _reference_59 = PostprocessingHelpers.getReference(cls, "externalPorts"); - StringConcatenation _builder_110 = new StringConcatenation(); - _builder_110.append("This is a list containing all ports of the actor interface that are end ports."); - _builder_110.newLine(); - PostprocessingHelpers.setDocumentation(_reference_59, _builder_110.toString()); - EReference _reference_60 = PostprocessingHelpers.getReference(cls, "structureDocu"); - StringConcatenation _builder_111 = new StringConcatenation(); - _builder_111.append("This is an optional documentation of the actor structure."); - _builder_111.newLine(); - PostprocessingHelpers.setDocumentation(_reference_60, _builder_111.toString()); - EReference _reference_61 = PostprocessingHelpers.getReference(cls, "serviceImplementations"); - StringConcatenation _builder_112 = new StringConcatenation(); - _builder_112.append("This is a list of all service implementations."); - _builder_112.newLine(); - PostprocessingHelpers.setDocumentation(_reference_61, _builder_112.toString()); - EReference _reference_62 = PostprocessingHelpers.getReference(cls, "serviceAccessPoints"); - StringConcatenation _builder_113 = new StringConcatenation(); - _builder_113.append("This is a list of all SAPs."); - _builder_113.newLine(); - PostprocessingHelpers.setDocumentation(_reference_62, _builder_113.toString()); - EReference _reference_63 = PostprocessingHelpers.getReference(cls, "attributes"); - StringConcatenation _builder_114 = new StringConcatenation(); - _builder_114.append("This is a list of all actor class private attributes."); - _builder_114.newLine(); - PostprocessingHelpers.setDocumentation(_reference_63, _builder_114.toString()); - EReference _reference_64 = PostprocessingHelpers.getReference(cls, "behaviorDocu"); - StringConcatenation _builder_115 = new StringConcatenation(); - _builder_115.append("This is an optional documentation of the actor behavior."); - _builder_115.newLine(); - PostprocessingHelpers.setDocumentation(_reference_64, _builder_115.toString()); - EReference _reference_65 = PostprocessingHelpers.getReference(cls, "behaviorAnnotations"); - StringConcatenation _builder_116 = new StringConcatenation(); - _builder_116.append("This is a list of annotations to the actor behavior."); - _builder_116.newLine(); - PostprocessingHelpers.setDocumentation(_reference_65, _builder_116.toString()); - EReference _reference_66 = PostprocessingHelpers.getReference(cls, "operations"); - StringConcatenation _builder_117 = new StringConcatenation(); - _builder_117.append("This is a list of all private operations of this actor class."); - _builder_117.newLine(); - PostprocessingHelpers.setDocumentation(_reference_66, _builder_117.toString()); - EReference _reference_67 = PostprocessingHelpers.getReference(cls, "stateMachine"); - StringConcatenation _builder_118 = new StringConcatenation(); - _builder_118.append("This is the actor\'s optional state machine."); - _builder_118.newLine(); - PostprocessingHelpers.setDocumentation(_reference_67, _builder_118.toString()); - EClass _class_27 = PostprocessingHelpers.getClass(pckg, "InterfaceItem"); - cls = _class_27; - StringConcatenation _builder_119 = new StringConcatenation(); - _builder_119.append("This is a concrete sub class of an {@link AbstractInterfaceItem}."); - _builder_119.newLine(); - _builder_119.newLine(); - _builder_119.append("It is the super class of"); - _builder_119.newLine(); - _builder_119.append("
    "); - _builder_119.newLine(); - _builder_119.append(" "); - _builder_119.append("
  • {@link Port}
  • "); - _builder_119.newLine(); - _builder_119.append(" "); - _builder_119.append("
  • {@link SAP}
  • "); - _builder_119.newLine(); - _builder_119.append(" "); - _builder_119.append("
  • {@link SPP}
  • "); - _builder_119.newLine(); - _builder_119.append("
"); - _builder_119.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_119.toString()); - EAttribute _attribute_23 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_120 = new StringConcatenation(); - _builder_120.append("By this name the interface item is referred to in the model."); - _builder_120.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_23, _builder_120.toString()); - EClass _class_28 = PostprocessingHelpers.getClass(pckg, "Port"); - cls = _class_28; - StringConcatenation _builder_121 = new StringConcatenation(); - _builder_121.append("A port defines a part of the interface of an {@link ActorClass} in a specific role."); - _builder_121.newLine(); - _builder_121.append("The port is associated with a {@link ProtocolClass}. If it is conjugated then the"); - _builder_121.newLine(); - _builder_121.append("roles of incoming and outgoing messages of the protocol are inverted."); - _builder_121.newLine(); - _builder_121.newLine(); - _builder_121.append("

"); - _builder_121.newLine(); - _builder_121.append("Ports can have a multiplicity. If it is greater one the port is called replicated."); - _builder_121.newLine(); - _builder_121.append("

"); - _builder_121.newLine(); - _builder_121.newLine(); - _builder_121.append("

"); - _builder_121.newLine(); - _builder_121.append("Whether a port is a relay port or not is a property that is derived from how it is"); - _builder_121.newLine(); - _builder_121.append("referenced by its {@link ActorClass}:"); - _builder_121.newLine(); - _builder_121.append("

    "); - _builder_121.newLine(); - _builder_121.append(" "); - _builder_121.append("
  • ports contained in the actor structure are called internal end ports
  • "); - _builder_121.newLine(); - _builder_121.append(" "); - _builder_121.append("
  • ports contained in the actor interface and are also referenced by an {@link ExternalPort}"); - _builder_121.newLine(); - _builder_121.append(" "); - _builder_121.append("are called external end ports
  • "); - _builder_121.newLine(); - _builder_121.append(" "); - _builder_121.append("
  • ports contained in the actor interface only are called relay ports
  • "); - _builder_121.newLine(); - _builder_121.append("
"); - _builder_121.newLine(); - _builder_121.append("Relay ports delegate to sub actors and end ports are connected to the actor\'s state machine."); - _builder_121.newLine(); - _builder_121.append("

"); - _builder_121.newLine(); - _builder_121.newLine(); - _builder_121.append("@see org.eclipse.etrice.core.room.util.RoomHelpers#isRelay(Port) RoomHelpers.isRelay(Port)"); - _builder_121.newLine(); - _builder_121.append("@see org.eclipse.etrice.core.room.util.RoomHelpers#isInternal(Port) RoomHelpers.isInternal(Port)"); - _builder_121.newLine(); - _builder_121.append("@see org.eclipse.etrice.core.room.util.RoomHelpers#isExternal(Port) RoomHelpers.isExternal(Port)"); - _builder_121.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_121.toString()); - EAttribute _attribute_24 = PostprocessingHelpers.getAttribute(cls, "conjugated"); - StringConcatenation _builder_122 = new StringConcatenation(); - _builder_122.append("If a port is conjugated then the roles of outgoing and incoming messages are interchanged."); - _builder_122.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_24, _builder_122.toString()); - EAttribute _attribute_25 = PostprocessingHelpers.getAttribute(cls, "multiplicity"); - StringConcatenation _builder_123 = new StringConcatenation(); - _builder_123.append("Ports with multiplicity >1 are called relay ports. A multiplicity of {@code -1} means replicated"); - _builder_123.newLine(); - _builder_123.append("port with arbitrary multiplicity."); - _builder_123.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_25, _builder_123.toString()); - EReference _reference_68 = PostprocessingHelpers.getReference(cls, "protocol"); - StringConcatenation _builder_124 = new StringConcatenation(); - _builder_124.append("This is the port\'s protocol class."); - _builder_124.newLine(); - PostprocessingHelpers.setDocumentation(_reference_68, _builder_124.toString()); - EReference _reference_69 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_125 = new StringConcatenation(); - _builder_125.append("This is an optional documentation."); - _builder_125.newLine(); - PostprocessingHelpers.setDocumentation(_reference_69, _builder_125.toString()); - EClass _class_29 = PostprocessingHelpers.getClass(pckg, "ExternalPort"); - cls = _class_29; - StringConcatenation _builder_126 = new StringConcatenation(); - _builder_126.append("An external port is part of the actor structure and references an interface port."); - _builder_126.newLine(); - _builder_126.append("An interface port which is referenced by an external port is an external end port."); - _builder_126.newLine(); - _builder_126.append("If it is not referenced it is a relay port."); - _builder_126.newLine(); - _builder_126.newLine(); - _builder_126.append("@see Port"); - _builder_126.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_126.toString()); - EReference _reference_70 = PostprocessingHelpers.getReference(cls, "interfacePort"); - StringConcatenation _builder_127 = new StringConcatenation(); - _builder_127.append("This is the referenced interface port of the actor class which is now an external end port."); - _builder_127.newLine(); - PostprocessingHelpers.setDocumentation(_reference_70, _builder_127.toString()); - EClass _class_30 = PostprocessingHelpers.getClass(pckg, "SAP"); - cls = _class_30; - StringConcatenation _builder_128 = new StringConcatenation(); - _builder_128.append("A service access point is similar to a {@link Port} but is not explicitly bound to a peer."); - _builder_128.newLine(); - _builder_128.append("Rather, it is bound to a {@link ServiceImplementation} which is connected to one of the"); - _builder_128.newLine(); - _builder_128.append("containing actors."); - _builder_128.newLine(); - _builder_128.newLine(); - _builder_128.append("

"); - _builder_128.newLine(); - _builder_128.append("An SAP is associated with a {@link ProtocolClass} and is conjugate to this protocol."); - _builder_128.newLine(); - _builder_128.append("

"); - _builder_128.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_128.toString()); - EReference _reference_71 = PostprocessingHelpers.getReference(cls, "protocol"); - StringConcatenation _builder_129 = new StringConcatenation(); - _builder_129.append("This is the SAP\'s protocol class."); - _builder_129.newLine(); - PostprocessingHelpers.setDocumentation(_reference_71, _builder_129.toString()); - EClass _class_31 = PostprocessingHelpers.getClass(pckg, "SPP"); - cls = _class_31; - StringConcatenation _builder_130 = new StringConcatenation(); - _builder_130.append("A service provision point is used to connect an actor class with a {@link ServiceImplementation}."); - _builder_130.newLine(); - _builder_130.append("It can (similar to relay ports) delegate to another actor class (using a {@link LayerConnection})"); - _builder_130.newLine(); - _builder_130.append("or connect to a {@link ServiceImplementation} of its actor class."); - _builder_130.newLine(); - _builder_130.newLine(); - _builder_130.append("

"); - _builder_130.newLine(); - _builder_130.append("An SPP is associated with a {@link ProtocolClass} and is regular to this protocol."); - _builder_130.newLine(); - _builder_130.append("

"); - _builder_130.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_130.toString()); - EReference _reference_72 = PostprocessingHelpers.getReference(cls, "protocol"); - StringConcatenation _builder_131 = new StringConcatenation(); - _builder_131.append("This is the SAP\'s protocol class."); - _builder_131.newLine(); - PostprocessingHelpers.setDocumentation(_reference_72, _builder_131.toString()); - EClass _class_32 = PostprocessingHelpers.getClass(pckg, "ServiceImplementation"); - cls = _class_32; - StringConcatenation _builder_132 = new StringConcatenation(); - _builder_132.append("A service implementation can be reagrded as the replicated peer port of all {@link SAP}s"); - _builder_132.newLine(); - _builder_132.append("that are bound to it following the service resolution logic."); - _builder_132.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_132.toString()); - EReference _reference_73 = PostprocessingHelpers.getReference(cls, "spp"); - StringConcatenation _builder_133 = new StringConcatenation(); - _builder_133.append("This is the SPP connected to the service."); - _builder_133.newLine(); - PostprocessingHelpers.setDocumentation(_reference_73, _builder_133.toString()); - EClass _class_33 = PostprocessingHelpers.getClass(pckg, "LogicalSystem"); - cls = _class_33; - StringConcatenation _builder_134 = new StringConcatenation(); - _builder_134.append("The top level structural class. It can only contain sub systems using {@link SubSystemRef}s."); - _builder_134.newLine(); - _builder_134.append("This way the logical system is composed of sub system instances. It also defines"); - _builder_134.newLine(); - _builder_134.append("{@link Binding}s and {@link LayerConnection}s between those sub systems."); - _builder_134.newLine(); - _builder_134.newLine(); - _builder_134.append("

"); - _builder_134.newLine(); - _builder_134.append("The logical system is the root of the instance tree of the generator model."); - _builder_134.newLine(); - _builder_134.append("Each {@link SubSystemRef} is turned into a {@link org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance} and each"); - _builder_134.newLine(); - _builder_134.append("{@link ActorRef} is turned into an {@link org.eclipse.etrice.core.genmodel.etricegen.ActorInstance}."); - _builder_134.newLine(); - _builder_134.append("

"); - _builder_134.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_134.toString()); - EReference _reference_74 = PostprocessingHelpers.getReference(cls, "subSystems"); - StringConcatenation _builder_135 = new StringConcatenation(); - _builder_135.append("The list of all sub systems contained in the logical system."); - _builder_135.newLine(); - PostprocessingHelpers.setDocumentation(_reference_74, _builder_135.toString()); - EClass _class_34 = PostprocessingHelpers.getClass(pckg, "ActorContainerRef"); - cls = _class_34; - StringConcatenation _builder_136 = new StringConcatenation(); - _builder_136.append("The super class of"); - _builder_136.newLine(); - _builder_136.append("
    "); - _builder_136.newLine(); - _builder_136.append(" "); - _builder_136.append("
  • {@link SubSystemRef}
  • "); - _builder_136.newLine(); - _builder_136.append(" "); - _builder_136.append("
  • {@link ActorRef}
  • "); - _builder_136.newLine(); - _builder_136.append("
"); - _builder_136.newLine(); - _builder_136.append("The reference designates a specific role of the referenced structure class."); - _builder_136.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_136.toString()); - EAttribute _attribute_26 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_137 = new StringConcatenation(); - _builder_137.append("By this name the actor container reference is referred to in the model."); - _builder_137.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_26, _builder_137.toString()); - EReference _reference_75 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_138 = new StringConcatenation(); - _builder_138.append("This is an optional documentation."); - _builder_138.newLine(); - PostprocessingHelpers.setDocumentation(_reference_75, _builder_138.toString()); - EClass _class_35 = PostprocessingHelpers.getClass(pckg, "SubSystemRef"); - cls = _class_35; - StringConcatenation _builder_139 = new StringConcatenation(); - _builder_139.append("A means to compose {@link LogicalSystem}s of {@link SubSystemClass}es. Each ref will"); - _builder_139.newLine(); - _builder_139.append("be turned into a sub system instance of the referenced type."); - _builder_139.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_139.toString()); - EReference _reference_76 = PostprocessingHelpers.getReference(cls, "type"); - StringConcatenation _builder_140 = new StringConcatenation(); - _builder_140.append("The type of the reference."); - _builder_140.newLine(); - PostprocessingHelpers.setDocumentation(_reference_76, _builder_140.toString()); - EClass _class_36 = PostprocessingHelpers.getClass(pckg, "SubSystemClass"); - cls = _class_36; - StringConcatenation _builder_141 = new StringConcatenation(); - _builder_141.append("A sub system class corresponds to a process with a separate address space."); - _builder_141.newLine(); - _builder_141.append("It has no behavior of its own and is composed of {@link ActorClass}es."); - _builder_141.newLine(); - _builder_141.newLine(); - _builder_141.append("

"); - _builder_141.newLine(); - _builder_141.append("Sub systems can be connected using {@link Port}s and {@link Binding}s."); - _builder_141.newLine(); - _builder_141.append("All ports of a sub system are relay ports."); - _builder_141.newLine(); - _builder_141.append("

"); - _builder_141.newLine(); - _builder_141.newLine(); - _builder_141.append("

"); - _builder_141.newLine(); - _builder_141.append("Sub systems can define an arbitrary number of logical threads onto which their actor"); - _builder_141.newLine(); - _builder_141.append("instances are mapped."); - _builder_141.newLine(); - _builder_141.append("

"); - _builder_141.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_141.toString()); - EReference _reference_77 = PostprocessingHelpers.getReference(cls, "relayPorts"); - StringConcatenation _builder_142 = new StringConcatenation(); - _builder_142.append("This is a list of all relay ports of the sub system."); - _builder_142.newLine(); - PostprocessingHelpers.setDocumentation(_reference_77, _builder_142.toString()); - EReference _reference_78 = PostprocessingHelpers.getReference(cls, "threads"); - StringConcatenation _builder_143 = new StringConcatenation(); - _builder_143.append("This is a list of all threads of the sub system."); - _builder_143.newLine(); - PostprocessingHelpers.setDocumentation(_reference_78, _builder_143.toString()); - EReference _reference_79 = PostprocessingHelpers.getReference(cls, "threads"); - StringConcatenation _builder_144 = new StringConcatenation(); - _builder_144.append("This is a list of all actor instance mappings of the sub system."); - _builder_144.newLine(); - PostprocessingHelpers.setDocumentation(_reference_79, _builder_144.toString()); - EReference _reference_80 = PostprocessingHelpers.getReference(cls, "actorInstanceMappings"); - StringConcatenation _builder_145 = new StringConcatenation(); - _builder_145.append("This is a list of actor instance mappings."); - _builder_145.newLine(); - PostprocessingHelpers.setDocumentation(_reference_80, _builder_145.toString()); - EClass _class_37 = PostprocessingHelpers.getClass(pckg, "LogicalThread"); - cls = _class_37; - StringConcatenation _builder_146 = new StringConcatenation(); - _builder_146.append("A logical thread is addressed by the {@link ActorInstanceMapping}s of a {@link SubSystemClass}."); - _builder_146.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_146.toString()); - EAttribute _attribute_27 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_147 = new StringConcatenation(); - _builder_147.append("By this name the thread is referred to in the model."); - _builder_147.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_27, _builder_147.toString()); - EClass _class_38 = PostprocessingHelpers.getClass(pckg, "ActorInstanceMapping"); - cls = _class_38; - StringConcatenation _builder_148 = new StringConcatenation(); - _builder_148.append("An actor instance mapping maps an actor instances (described as a path of actor references)"); - _builder_148.newLine(); - _builder_148.append("to a {@link LogicalThread}"); - _builder_148.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_148.toString()); - EReference _reference_81 = PostprocessingHelpers.getReference(cls, "path"); - StringConcatenation _builder_149 = new StringConcatenation(); - _builder_149.append("This is the path of references starting at this sub system that uniquely references an actor instance."); - _builder_149.newLine(); - PostprocessingHelpers.setDocumentation(_reference_81, _builder_149.toString()); - EReference _reference_82 = PostprocessingHelpers.getReference(cls, "thread"); - StringConcatenation _builder_150 = new StringConcatenation(); - _builder_150.append("This is the logical thread to which the referenced actor instance and all of its contained instances"); - _builder_150.newLine(); - _builder_150.append("are mapped."); - _builder_150.newLine(); - PostprocessingHelpers.setDocumentation(_reference_82, _builder_150.toString()); - EReference _reference_83 = PostprocessingHelpers.getReference(cls, "actorInstanceMappings"); - StringConcatenation _builder_151 = new StringConcatenation(); - _builder_151.append("This is a list of nested mappings which override parent mappings."); - _builder_151.newLine(); - PostprocessingHelpers.setDocumentation(_reference_83, _builder_151.toString()); - EClass _class_39 = PostprocessingHelpers.getClass(pckg, "RefPath"); - cls = _class_39; - StringConcatenation _builder_152 = new StringConcatenation(); - _builder_152.append("A path of strings that are interpreted as {@link org.eclipse.etrice.core.room.ActorRef}s starting at a {@link org.eclipse.etrice.core.room.SubSystemClass}."); - _builder_152.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_152.toString()); - EReference _reference_84 = PostprocessingHelpers.getReference(cls, "refs"); - StringConcatenation _builder_153 = new StringConcatenation(); - _builder_153.append("This is a path in the instance tree where each segment corresponds to the name of the"); - _builder_153.newLine(); - _builder_153.append("corresponding {@link ActorContainerRef}."); - _builder_153.newLine(); - PostprocessingHelpers.setDocumentation(_reference_84, _builder_153.toString()); - EClass _class_40 = PostprocessingHelpers.getClass(pckg, "RefSegment"); - cls = _class_40; - StringConcatenation _builder_154 = new StringConcatenation(); - _builder_154.append("A segment of a {@link RefPath}. It consists of a name and an optional index."); - _builder_154.newLine(); - _builder_154.append("If the index is not set it will be {@code -1}."); - _builder_154.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_154.toString()); - EAttribute _attribute_28 = PostprocessingHelpers.getAttribute(cls, "ref"); - StringConcatenation _builder_155 = new StringConcatenation(); - _builder_155.append("The segment name corresponding to an actor reference."); - _builder_155.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_28, _builder_155.toString()); - EAttribute _attribute_29 = PostprocessingHelpers.getAttribute(cls, "idx"); - StringConcatenation _builder_156 = new StringConcatenation(); - _builder_156.append("The optional index of the reference (for replicated actors)."); - _builder_156.newLine(); - _builder_156.append("If not set the index is {@code -1}."); - _builder_156.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_29, _builder_156.toString()); - EClass _class_41 = PostprocessingHelpers.getClass(pckg, "Binding"); - cls = _class_41; - StringConcatenation _builder_157 = new StringConcatenation(); - _builder_157.append("A binding connects two {@link Port}s."); - _builder_157.newLine(); - _builder_157.append("To be able to distinguish the ports of two {@link ActorContainerRef}s of the same type"); - _builder_157.newLine(); - _builder_157.append("a {@link BindingEndPoint} is needed for disambiguation."); - _builder_157.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_157.toString()); - EReference _reference_85 = PostprocessingHelpers.getReference(cls, "endpoint1"); - StringConcatenation _builder_158 = new StringConcatenation(); - _builder_158.append("The first end point of a binding."); - _builder_158.newLine(); - PostprocessingHelpers.setDocumentation(_reference_85, _builder_158.toString()); - EReference _reference_86 = PostprocessingHelpers.getReference(cls, "endpoint2"); - StringConcatenation _builder_159 = new StringConcatenation(); - _builder_159.append("The second end point of a binding."); - _builder_159.newLine(); - PostprocessingHelpers.setDocumentation(_reference_86, _builder_159.toString()); - EClass _class_42 = PostprocessingHelpers.getClass(pckg, "BindingEndPoint"); - cls = _class_42; - StringConcatenation _builder_160 = new StringConcatenation(); - _builder_160.append("A binding end point is a pair of an {@link ActorContainerRef} and a {@link Port} and is used"); - _builder_160.newLine(); - _builder_160.append("to uniquely describe a port of a sub actor. If the actor container ref is {@code null} then"); - _builder_160.newLine(); - _builder_160.append("a port of the actor class itself is addressed."); - _builder_160.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_160.toString()); - EReference _reference_87 = PostprocessingHelpers.getReference(cls, "actorRef"); - StringConcatenation _builder_161 = new StringConcatenation(); - _builder_161.append("The actor reference holding the bound port or {@code null} in case of a local port."); - _builder_161.newLine(); - PostprocessingHelpers.setDocumentation(_reference_87, _builder_161.toString()); - EReference _reference_88 = PostprocessingHelpers.getReference(cls, "port"); - StringConcatenation _builder_162 = new StringConcatenation(); - _builder_162.append("This is the bound port."); - _builder_162.newLine(); - PostprocessingHelpers.setDocumentation(_reference_88, _builder_162.toString()); - EReference _reference_89 = PostprocessingHelpers.getReference(cls, "sub"); - StringConcatenation _builder_163 = new StringConcatenation(); - _builder_163.append("This is the bound sub protocol or {@code null} if not applicable."); - _builder_163.newLine(); - PostprocessingHelpers.setDocumentation(_reference_89, _builder_163.toString()); - EClass _class_43 = PostprocessingHelpers.getClass(pckg, "LayerConnection"); - cls = _class_43; - StringConcatenation _builder_164 = new StringConcatenation(); - _builder_164.append("Layer connections are used to connect {@link SAP}s and {@link ServiceImplementation}s."); - _builder_164.newLine(); - _builder_164.append("The source is described by a {@link SAPoint} and the target by a {@link SPPoint}."); - _builder_164.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_164.toString()); - EReference _reference_90 = PostprocessingHelpers.getReference(cls, "from"); - StringConcatenation _builder_165 = new StringConcatenation(); - _builder_165.append("This is source point of the layer connection."); - _builder_165.newLine(); - PostprocessingHelpers.setDocumentation(_reference_90, _builder_165.toString()); - EReference _reference_91 = PostprocessingHelpers.getReference(cls, "to"); - StringConcatenation _builder_166 = new StringConcatenation(); - _builder_166.append("This is target point of the layer connection."); - _builder_166.newLine(); - PostprocessingHelpers.setDocumentation(_reference_91, _builder_166.toString()); - EClass _class_44 = PostprocessingHelpers.getClass(pckg, "SAPoint"); - cls = _class_44; - StringConcatenation _builder_167 = new StringConcatenation(); - _builder_167.append("The super class of"); - _builder_167.newLine(); - _builder_167.append("
    "); - _builder_167.newLine(); - _builder_167.append(" "); - _builder_167.append("
  • {@link RefSAPoint}
  • "); - _builder_167.newLine(); - _builder_167.append(" "); - _builder_167.append("
  • {@link RelaySAPoint}
  • "); - _builder_167.newLine(); - _builder_167.append("
"); - _builder_167.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_167.toString()); - EClass _class_45 = PostprocessingHelpers.getClass(pckg, "RefSAPoint"); - cls = _class_45; - StringConcatenation _builder_168 = new StringConcatenation(); - _builder_168.append("Links from a {@link ActorContainerRef}, i.e. from a sub actor."); - _builder_168.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_168.toString()); - EReference _reference_92 = PostprocessingHelpers.getReference(cls, "ref"); - StringConcatenation _builder_169 = new StringConcatenation(); - _builder_169.append("This is the referenced actor container ref."); - _builder_169.newLine(); - PostprocessingHelpers.setDocumentation(_reference_92, _builder_169.toString()); - EClass _class_46 = PostprocessingHelpers.getClass(pckg, "RelaySAPoint"); - cls = _class_46; - StringConcatenation _builder_170 = new StringConcatenation(); - _builder_170.append("Links from a relay {@link SPP} of the actor class."); - _builder_170.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_170.toString()); - EReference _reference_93 = PostprocessingHelpers.getReference(cls, "relay"); - StringConcatenation _builder_171 = new StringConcatenation(); - _builder_171.append("This is the referenced SPP."); - _builder_171.newLine(); - PostprocessingHelpers.setDocumentation(_reference_93, _builder_171.toString()); - EClass _class_47 = PostprocessingHelpers.getClass(pckg, "SPPoint"); - cls = _class_47; - StringConcatenation _builder_172 = new StringConcatenation(); - _builder_172.append("Links to a {@link SPP} of an {@link ActorContainerRef}, i.e. an SPP of a sub actor"); - _builder_172.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_172.toString()); - EReference _reference_94 = PostprocessingHelpers.getReference(cls, "ref"); - StringConcatenation _builder_173 = new StringConcatenation(); - _builder_173.append("This is the referenced actor container ref."); - _builder_173.newLine(); - PostprocessingHelpers.setDocumentation(_reference_94, _builder_173.toString()); - EReference _reference_95 = PostprocessingHelpers.getReference(cls, "service"); - StringConcatenation _builder_174 = new StringConcatenation(); - _builder_174.append("This is the referenced service."); - _builder_174.newLine(); - PostprocessingHelpers.setDocumentation(_reference_95, _builder_174.toString()); - EClass _class_48 = PostprocessingHelpers.getClass(pckg, "ActorRef"); - cls = _class_48; - StringConcatenation _builder_175 = new StringConcatenation(); - _builder_175.append("A means to compose {@link SubSystemClass}es of {@link ActorClass}es. Each ref will"); - _builder_175.newLine(); - _builder_175.append("be turned into an actor instance of the referenced type."); - _builder_175.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_175.toString()); - EReference _reference_96 = PostprocessingHelpers.getReference(cls, "type"); - StringConcatenation _builder_176 = new StringConcatenation(); - _builder_176.append("This is the type (i.e. actor class) of the actor ref."); - _builder_176.newLine(); - PostprocessingHelpers.setDocumentation(_reference_96, _builder_176.toString()); - EAttribute _attribute_30 = PostprocessingHelpers.getAttribute(cls, "multiplicity"); - StringConcatenation _builder_177 = new StringConcatenation(); - _builder_177.append("If the size is >1 then this is a replicated actor."); - _builder_177.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_30, _builder_177.toString()); - } -} diff --git a/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java b/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java deleted file mode 100644 index 2ab916afb..000000000 --- a/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java +++ /dev/null @@ -1,246 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug - */ -package org.eclipse.etrice.core.postprocessing; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.etrice.core.fsm.fSM.FSMPackage; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -@SuppressWarnings("all") -public class ImplPostprocessor { - public boolean process(final GeneratedMetamodel metamodel) { - boolean _xblockexpression = false; - { - final EPackage roomPackage = metamodel.getEPackage(); - final EClass port = PostprocessingHelpers.getClass(roomPackage, "Port"); - EAttribute _attribute = PostprocessingHelpers.getAttribute(port, "multiplicity"); - _attribute.setDefaultValueLiteral("1"); - EClassifier _eClassifier = EcorePackage.eINSTANCE.getEClassifier("EBoolean"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("return multiplicity>1 || multiplicity==-1;"); - PostprocessingHelpers.addOperation(port, "isReplicated", _eClassifier, Integer.valueOf(1), _builder.toString()); - final EClass actorRef = PostprocessingHelpers.getClass(roomPackage, "ActorRef"); - EAttribute _attribute_1 = PostprocessingHelpers.getAttribute(actorRef, "multiplicity"); - _attribute_1.setDefaultValueLiteral("1"); - final EClass interfaceItem = PostprocessingHelpers.getClass(roomPackage, "InterfaceItem"); - EClassifier _eClassifier_1 = roomPackage.getEClassifier("GeneralProtocolClass"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("if (this instanceof <%org.eclipse.etrice.core.room.Port%>)"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((Port) this).getProtocol();"); - _builder_1.newLine(); - _builder_1.append("else if (this instanceof <%org.eclipse.etrice.core.room.SAP%>)"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((SAP) this).getProtocol();"); - _builder_1.newLine(); - _builder_1.append("else if (this instanceof <%org.eclipse.etrice.core.room.SPP%>)"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((SPP) this).getProtocol();"); - _builder_1.newLine(); - _builder_1.append("return null;"); - _builder_1.newLine(); - PostprocessingHelpers.addOperation(interfaceItem, "getGeneralProtocol", _eClassifier_1, Integer.valueOf(1), _builder_1.toString()); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("if (getGeneralProtocol() instanceof <%org.eclipse.etrice.core.room.ProtocolClass%>)"); - _builder_2.newLine(); - _builder_2.append("\t"); - _builder_2.append("return ((ProtocolClass)getGeneralProtocol()).getSemantics();"); - _builder_2.newLine(); - _builder_2.append("else"); - _builder_2.newLine(); - _builder_2.append("\t"); - _builder_2.append("return null;"); - _builder_2.newLine(); - PostprocessingHelpers.addOperation(interfaceItem, "getSemantics", FSMPackage.Literals.PROTOCOL_SEMANTICS, Integer.valueOf(1), _builder_2.toString()); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("return new <%org.eclipse.emf.common.util.BasicEList%>(new <%org.eclipse.etrice.core.room.util.RoomHelpers%>().getMessageListDeep(this, false));"); - _builder_3.newLine(); - PostprocessingHelpers.addOperation(interfaceItem, "getAllIncomingAbstractMessages", EcorePackage.Literals.EOBJECT, Integer.valueOf((-1)), _builder_3.toString()); - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("return new <%org.eclipse.emf.common.util.BasicEList%>(new <%org.eclipse.etrice.core.room.util.RoomHelpers%>().getMessageListDeep(this, true));"); - _builder_4.newLine(); - PostprocessingHelpers.addOperation(interfaceItem, "getAllOutgoingAbstractMessages", EcorePackage.Literals.EOBJECT, Integer.valueOf((-1)), _builder_4.toString()); - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("if (getGeneralProtocol() instanceof ProtocolClass)"); - _builder_5.newLine(); - _builder_5.append(" "); - _builder_5.append("return ((ProtocolClass) getGeneralProtocol()).getCommType() == <%org.eclipse.etrice.core.room.CommunicationType%>.EVENT_DRIVEN;"); - _builder_5.newLine(); - _builder_5.append("else"); - _builder_5.newLine(); - _builder_5.append(" "); - _builder_5.append("return false;"); - _builder_5.newLine(); - PostprocessingHelpers.addOperation(interfaceItem, "isEventDriven", EcorePackage.Literals.EBOOLEAN, Integer.valueOf(1), _builder_5.toString()); - final EClass actorClass = PostprocessingHelpers.getClass(roomPackage, "ActorClass"); - EClassifier _eClassifier_2 = roomPackage.getEClassifier("Port"); - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("EList ports = new BasicEList();"); - _builder_6.newLine(); - _builder_6.append("for (ExternalPort ep : getExternalPorts()) {"); - _builder_6.newLine(); - _builder_6.append("\t"); - _builder_6.append("ports.add(ep.getInterfacePort());"); - _builder_6.newLine(); - _builder_6.append("}"); - _builder_6.newLine(); - _builder_6.append("return ports;"); - _builder_6.newLine(); - PostprocessingHelpers.addOperation(actorClass, "getExternalEndPorts", _eClassifier_2, Integer.valueOf((-1)), _builder_6.toString()); - EClassifier _eClassifier_3 = roomPackage.getEClassifier("Port"); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("EList ports = new BasicEList(getInterfacePorts());"); - _builder_7.newLine(); - _builder_7.append("for (ExternalPort ep : getExternalPorts()) {"); - _builder_7.newLine(); - _builder_7.append("\t"); - _builder_7.append("ports.remove(ep.getInterfacePort());"); - _builder_7.newLine(); - _builder_7.append("}"); - _builder_7.newLine(); - _builder_7.append("return ports;"); - _builder_7.newLine(); - PostprocessingHelpers.addOperation(actorClass, "getRelayPorts", _eClassifier_3, Integer.valueOf((-1)), _builder_7.toString()); - EClassifier _eClassifier_4 = roomPackage.getEClassifier("SPP"); - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("EList spps = new BasicEList();"); - _builder_8.newLine(); - _builder_8.append("for (ServiceImplementation spp : getServiceImplementations()) {"); - _builder_8.newLine(); - _builder_8.append("\t"); - _builder_8.append("spps.add(spp.getSpp());"); - _builder_8.newLine(); - _builder_8.append("}"); - _builder_8.newLine(); - _builder_8.append("return spps;"); - _builder_8.newLine(); - PostprocessingHelpers.addOperation(actorClass, "getImplementedSPPs", _eClassifier_4, Integer.valueOf((-1)), _builder_8.toString()); - EClassifier _eClassifier_5 = roomPackage.getEClassifier("ActorClass"); - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append("return (ActorClass)getBase();"); - _builder_9.newLine(); - PostprocessingHelpers.addOperation(actorClass, "getActorBase", _eClassifier_5, Integer.valueOf(1), _builder_9.toString()); - EClassifier _eClassifier_6 = EcorePackage.eINSTANCE.getEClassifier("EString"); - StringConcatenation _builder_10 = new StringConcatenation(); - _builder_10.append("return getName();"); - _builder_10.newLine(); - PostprocessingHelpers.addOperation(actorClass, "getComponentName", _eClassifier_6, Integer.valueOf(1), _builder_10.toString()); - StringConcatenation _builder_11 = new StringConcatenation(); - _builder_11.append("return new <%org.eclipse.emf.common.util.BasicEList%>(new <%org.eclipse.etrice.core.room.util.RoomHelpers%>().getInterfaceItems(this));"); - _builder_11.newLine(); - PostprocessingHelpers.addOperation(actorClass, "getAbstractInterfaceItems", FSMPackage.Literals.ABSTRACT_INTERFACE_ITEM, Integer.valueOf((-1)), _builder_11.toString()); - StringConcatenation _builder_12 = new StringConcatenation(); - _builder_12.append("return new <%org.eclipse.emf.common.util.BasicEList%>(new <%org.eclipse.etrice.core.room.util.RoomHelpers%>().getAllInterfaceItems(this));"); - _builder_12.newLine(); - PostprocessingHelpers.addOperation(actorClass, "getAllAbstractInterfaceItems", FSMPackage.Literals.ABSTRACT_INTERFACE_ITEM, Integer.valueOf((-1)), _builder_12.toString()); - final EClass actorContainerRef = PostprocessingHelpers.getClass(roomPackage, "ActorContainerRef"); - EClassifier _eClassifier_7 = roomPackage.getEClassifier("StructureClass"); - StringConcatenation _builder_13 = new StringConcatenation(); - _builder_13.append("if (this instanceof <%org.eclipse.etrice.core.room.ActorRef%>)"); - _builder_13.newLine(); - _builder_13.append("\t"); - _builder_13.append("return ((ActorRef)this).getType();"); - _builder_13.newLine(); - _builder_13.append("else if (this instanceof <%org.eclipse.etrice.core.room.SubSystemRef%>)"); - _builder_13.newLine(); - _builder_13.append("\t"); - _builder_13.append("return ((SubSystemRef)this).getType();"); - _builder_13.newLine(); - _builder_13.append("else"); - _builder_13.newLine(); - _builder_13.append("\t"); - _builder_13.append("return null;"); - _builder_13.newLine(); - PostprocessingHelpers.addOperation(actorContainerRef, "getStructureClass", _eClassifier_7, - Integer.valueOf(1), _builder_13.toString()); - final EClass refPath = PostprocessingHelpers.getClass(roomPackage, "RefPath"); - EClassifier _eClassifier_8 = EcorePackage.eINSTANCE.getEClassifier("EString"); - StringConcatenation _builder_14 = new StringConcatenation(); - _builder_14.append("StringBuilder sb = new StringBuilder();"); - _builder_14.newLine(); - _builder_14.append("for (RefSegment ref : getRefs()) {"); - _builder_14.newLine(); - _builder_14.append("\t"); - _builder_14.append("sb.append(\"/\"+ref.toString());"); - _builder_14.newLine(); - _builder_14.append("}"); - _builder_14.newLine(); - _builder_14.append("return sb.toString();"); - _builder_14.newLine(); - PostprocessingHelpers.addOperation(refPath, - "toString", _eClassifier_8, - Integer.valueOf(1), _builder_14.toString()); - final EClass refSeg = PostprocessingHelpers.getClass(roomPackage, "RefSegment"); - EAttribute _attribute_2 = PostprocessingHelpers.getAttribute(refSeg, "idx"); - _attribute_2.setDefaultValueLiteral("-1"); - EClassifier _eClassifier_9 = EcorePackage.eINSTANCE.getEClassifier("EString"); - StringConcatenation _builder_15 = new StringConcatenation(); - _builder_15.append("return getRef() + ((getIdx()>=0)? \":\"+getIdx() : \"\");"); - _builder_15.newLine(); - PostprocessingHelpers.addOperation(refSeg, - "toString", _eClassifier_9, - Integer.valueOf(1), _builder_15.toString()); - final EClass enumLiteral = PostprocessingHelpers.getClass(roomPackage, "EnumLiteral"); - EClassifier _eClassifier_10 = EcorePackage.eINSTANCE.getEClassifier("ELong"); - StringConcatenation _builder_16 = new StringConcatenation(); - _builder_16.append("if (this.getLiteral() != null)"); - _builder_16.newLine(); - _builder_16.append("\t"); - _builder_16.append("return this.getLiteral().getValue();"); - _builder_16.newLine(); - _builder_16.newLine(); - _builder_16.append("// recursively from predecessor"); - _builder_16.newLine(); - _builder_16.append("<%org.eclipse.etrice.core.room.EnumerationType%> et = ((EnumerationType) this.eContainer());"); - _builder_16.newLine(); - _builder_16.append("int idx = et.getLiterals().indexOf(this);"); - _builder_16.newLine(); - _builder_16.append("if (idx > 0)"); - _builder_16.newLine(); - _builder_16.append("\t"); - _builder_16.append("return et.getLiterals().get(idx - 1).getLiteralValue() + 1;"); - _builder_16.newLine(); - _builder_16.newLine(); - _builder_16.append("return 0;"); - _builder_16.newLine(); - PostprocessingHelpers.addOperation(enumLiteral, - "getLiteralValue", _eClassifier_10, - Integer.valueOf(1), _builder_16.toString()); - EClassifier _eClassifier_11 = EcorePackage.eINSTANCE.getEClassifier("EString"); - StringConcatenation _builder_17 = new StringConcatenation(); - _builder_17.append("<%org.eclipse.etrice.core.room.EnumerationType%> et = ((EnumerationType) this.eContainer());"); - _builder_17.newLine(); - _builder_17.append("return et.getName() + \".\" + this.getName();"); - _builder_17.newLine(); - PostprocessingHelpers.addOperation(enumLiteral, - "getFullName", _eClassifier_11, - Integer.valueOf(1), _builder_17.toString()); - final EClass classStructor = PostprocessingHelpers.getClass(roomPackage, "ClassStructor"); - EClassifier _eClassifier_12 = EcorePackage.eINSTANCE.getEClassifier("EBoolean"); - StringConcatenation _builder_18 = new StringConcatenation(); - _builder_18.append("return \"ctor\".equals(this.getName());"); - _builder_18.newLine(); - _xblockexpression = PostprocessingHelpers.addOperation(classStructor, - "isConstructor", _eClassifier_12, - Integer.valueOf(1), _builder_18.toString()); - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/DefaultDetailExpressionProvider.java b/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/DefaultDetailExpressionProvider.java deleted file mode 100644 index 9d4ce8916..000000000 --- a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/DefaultDetailExpressionProvider.java +++ /dev/null @@ -1,209 +0,0 @@ -/** - * Copyright (c) 2015 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.expressions.detailcode; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import java.util.List; -import java.util.function.Consumer; -import org.eclipse.etrice.core.room.ActorClass; -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.InterfaceItem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.PortOperation; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.SAP; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.StandardOperation; -import org.eclipse.etrice.expressions.detailcode.GuardDetailExpressionProvider; -import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.ListExtensions; - -/** - * Defines expression for fsm detail code of an ActorClass - */ -@FinalFieldsConstructor -@SuppressWarnings("all") -public class DefaultDetailExpressionProvider extends GuardDetailExpressionProvider { - @Override - public List getInitialFeatures() { - final List scope = CollectionLiterals.newArrayList(); - boolean _notEquals = (!Objects.equal(this.transitionEventData, null)); - if (_notEquals) { - IDetailExpressionProvider.ExpressionFeature _createExprFeature = this.createExprFeature(this.transitionEventData, IDetailExpressionProvider.ExpressionPostfix.NONE); - scope.add(_createExprFeature); - } - List _latestOperations = this.roomHelpers.getLatestOperations(this.actorClass); - final Function1 _function = (StandardOperation it) -> { - return this.createExprFeature(it); - }; - List _map = ListExtensions.map(_latestOperations, _function); - Iterables.addAll(scope, _map); - List _allAttributes = this.roomHelpers.getAllAttributes(this.actorClass); - final Function1 _function_1 = (Attribute it) -> { - return this.createExprFeature(it); - }; - List _map_1 = ListExtensions.map(_allAttributes, _function_1); - Iterables.addAll(scope, _map_1); - List _allInterfaceItems = this.roomHelpers.getAllInterfaceItems(this.actorClass); - final Consumer _function_2 = (InterfaceItem it) -> { - boolean _matched = false; - if (it instanceof SPP) { - boolean _isEventDriven = ((SPP)it).isEventDriven(); - if (_isEventDriven) { - _matched=true; - } - } - if (!_matched) { - if (it instanceof Port) { - if ((((Port)it).isEventDriven() && ((Port)it).isReplicated())) { - _matched=true; - } - } - } - if (_matched) { - IDetailExpressionProvider.ExpressionFeature _createExprFeature_1 = this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.NONE); - scope.add(_createExprFeature_1); - IDetailExpressionProvider.ExpressionFeature _createExprFeature_2 = this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); - scope.add(_createExprFeature_2); - } - if (!_matched) { - if (it instanceof Port) { - boolean _isReplicated = ((Port)it).isReplicated(); - if (_isReplicated) { - _matched=true; - } - } - if (!_matched) { - if (it instanceof SPP) { - _matched=true; - } - } - if (_matched) { - IDetailExpressionProvider.ExpressionFeature _createExprFeature_3 = this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); - scope.add(_createExprFeature_3); - } - } - if (!_matched) { - IDetailExpressionProvider.ExpressionFeature _createExprFeature_4 = this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.NONE); - scope.add(_createExprFeature_4); - } - }; - _allInterfaceItems.forEach(_function_2); - return scope; - } - - @Override - public List getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx) { - this.assertNotNull(ctx); - final List scope = CollectionLiterals.newArrayList(); - Object _data = ctx.getData(); - final Object obj = _data; - boolean _matched = false; - if (obj instanceof Port) { - int _multiplicity = ((Port)obj).getMultiplicity(); - boolean _equals = (_multiplicity == 1); - if (_equals) { - _matched=true; - } - } - if (!_matched) { - if (obj instanceof SAP) { - _matched=true; - } - } - if (_matched) { - ProtocolClass _protocol = this.roomHelpers.getProtocol(((InterfaceItem)obj)); - boolean _isConjugated = this.roomHelpers.isConjugated(((InterfaceItem)obj)); - boolean _not = (!_isConjugated); - List _allOperations = this.roomHelpers.getAllOperations(_protocol, _not); - final Function1 _function = (PortOperation it) -> { - return this.createExprFeature(it); - }; - List _map = ListExtensions.map(_allOperations, _function); - Iterables.addAll(scope, _map); - } - Object _data_1 = ctx.getData(); - final Object obj_1 = _data_1; - boolean _matched_1 = false; - if (obj_1 instanceof InterfaceItem) { - _matched_1=true; - final ProtocolClass pc = this.roomHelpers.getProtocol(((InterfaceItem)obj_1)); - CommunicationType _commType = pc.getCommType(); - if (_commType != null) { - switch (_commType) { - case EVENT_DRIVEN: - boolean _isConjugated_1 = this.roomHelpers.isConjugated(((InterfaceItem)obj_1)); - List _allMessages = this.roomHelpers.getAllMessages(pc, _isConjugated_1); - final Function1 _function_1 = (Message it) -> { - return this.createExprFeature(it); - }; - List _map_1 = ListExtensions.map(_allMessages, _function_1); - Iterables.addAll(scope, _map_1); - break; - case DATA_DRIVEN: - boolean _isConjugated_2 = this.roomHelpers.isConjugated(((InterfaceItem)obj_1)); - if (_isConjugated_2) { - List _allIncomingMessages = this.roomHelpers.getAllIncomingMessages(pc); - final Function1 _function_2 = (Message it) -> { - return this.createExprFeature(it); - }; - List _map_2 = ListExtensions.map(_allIncomingMessages, _function_2); - Iterables.addAll(scope, _map_2); - } else { - List _allIncomingMessages_1 = this.roomHelpers.getAllIncomingMessages(pc); - final Function1 _function_3 = (Message it) -> { - return this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.NONE); - }; - List _map_3 = ListExtensions.map(_allIncomingMessages_1, _function_3); - Iterables.addAll(scope, _map_3); - } - break; - case SYNCHRONOUS: - break; - default: - break; - } - } - } - if (!_matched_1) { - if (obj_1 instanceof Attribute) { - RefableType _type = ((Attribute)obj_1).getType(); - DataType _type_1 = _type.getType(); - if ((_type_1 instanceof DataClass)) { - _matched_1=true; - RefableType _type_2 = ((Attribute)obj_1).getType(); - DataType _type_3 = _type_2.getType(); - final DataClass dc = ((DataClass) _type_3); - List _allAttributes = this.roomHelpers.getAllAttributes(dc); - final Function1 _function_1 = (Attribute it) -> { - return this.createExprFeature(it); - }; - List _map_1 = ListExtensions.map(_allAttributes, _function_1); - Iterables.addAll(scope, _map_1); - } - } - } - return scope; - } - - public DefaultDetailExpressionProvider(final ActorClass actorClass) { - super(actorClass); - } -} diff --git a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/DetailExpressionAssistParser.java b/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/DetailExpressionAssistParser.java deleted file mode 100644 index 7212a636d..000000000 --- a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/DetailExpressionAssistParser.java +++ /dev/null @@ -1,221 +0,0 @@ -/** - * Copyright (c) 2015 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.expressions.detailcode; - -import com.google.common.base.Objects; -import java.util.LinkedList; -import java.util.List; -import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.rules.IWordDetector; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Exceptions; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@FinalFieldsConstructor -@SuppressWarnings("all") -public class DetailExpressionAssistParser { - private final IDocument document; - - private final int invocationOffset; - - private final IDetailExpressionProvider provider; - - private final IWordDetector anyIdScanner = new IWordDetector() { - @Override - public boolean isWordPart(final char c) { - return Character.isJavaIdentifierPart(c); - } - - @Override - public boolean isWordStart(final char c) { - return Character.isJavaIdentifierStart(c); - } - }; - - public String computeIdentifierPrefix(final int offset) throws BadLocationException { - int start = (offset - 1); - while (((start >= 0) && this.anyIdScanner.isWordPart(this.document.getChar(start)))) { - start--; - } - start++; - return this.document.get(start, (offset - start)); - } - - public IDetailExpressionProvider.ExpressionFeature computeExpressionFeature(final int offset) throws BadLocationException { - IDetailExpressionProvider.ExpressionPostfix postfixResult = null; - char openingChar = 0; - char closingChar = 0; - char _char = this.document.getChar((offset - 1)); - String _string = Character.valueOf(_char).toString(); - switch (_string) { - case ")": - postfixResult = IDetailExpressionProvider.ExpressionPostfix.PARENTHESES; - openingChar = '('; - closingChar = ')'; - break; - case "]": - postfixResult = IDetailExpressionProvider.ExpressionPostfix.BRACKETS; - openingChar = '['; - closingChar = ']'; - break; - default: - postfixResult = IDetailExpressionProvider.ExpressionPostfix.NONE; - break; - } - int start = offset; - boolean _notEquals = (!Objects.equal(postfixResult, IDetailExpressionProvider.ExpressionPostfix.NONE)); - if (_notEquals) { - start--; - int counter = 1; - while (((start > 0) && (counter > 0))) { - { - start--; - char _char_1 = this.document.getChar(start); - boolean _matched = false; - if (Objects.equal(_char_1, openingChar)) { - _matched=true; - counter--; - } - if (!_matched) { - if (Objects.equal(_char_1, closingChar)) { - _matched=true; - counter++; - } - } - } - } - if ((counter > 0)) { - postfixResult = null; - } - } - String idResult = null; - try { - String _computeIdentifierPrefix = this.computeIdentifierPrefix(start); - idResult = _computeIdentifierPrefix; - } catch (final Throwable _t) { - if (_t instanceof BadLocationException) { - final BadLocationException e = (BadLocationException)_t; - } else { - throw Exceptions.sneakyThrow(_t); - } - } - return new IDetailExpressionProvider.ExpressionFeature(idResult, postfixResult); - } - - /** - * Try to resolve latest complete ExpressionFeature, e.g.: - *
    - *
  • port0.m_ => port0
  • - *
  • port0. => port0
  • - *
  • port0 => null
  • - *
- */ - public IDetailExpressionProvider.ExpressionFeature resolveLatestCompleted() { - int lastSeparatorPos = (this.invocationOffset - 1); - try { - final String invocationPrefix = this.computeIdentifierPrefix(this.invocationOffset); - int _lastSeparatorPos = lastSeparatorPos; - int _length = invocationPrefix.length(); - lastSeparatorPos = (_lastSeparatorPos - _length); - } catch (final Throwable _t) { - if (_t instanceof BadLocationException) { - final BadLocationException e = (BadLocationException)_t; - } else { - throw Exceptions.sneakyThrow(_t); - } - } - final LinkedList parsedFeatures = CollectionLiterals.newLinkedList(); - try { - while ((this.document.getChar(lastSeparatorPos) == IDetailExpressionProvider.SEPARATOR)) { - { - final IDetailExpressionProvider.ExpressionFeature parseResult = this.computeExpressionFeature(lastSeparatorPos); - boolean _isValid = this.isValid(parseResult); - boolean _not = (!_isValid); - if (_not) { - return null; - } - parsedFeatures.push(parseResult); - int _lastSeparatorPos_1 = lastSeparatorPos; - String _id = parseResult.getId(); - int _length_1 = _id.length(); - int _plus = (_length_1 + 1); - lastSeparatorPos = (_lastSeparatorPos_1 - _plus); - } - } - } catch (final Throwable _t_1) { - if (_t_1 instanceof BadLocationException) { - final BadLocationException e_1 = (BadLocationException)_t_1; - } else { - throw Exceptions.sneakyThrow(_t_1); - } - } - boolean _isEmpty = parsedFeatures.isEmpty(); - if (_isEmpty) { - return null; - } - final IDetailExpressionProvider.ExpressionFeature firstParseResult = parsedFeatures.pop(); - List _initialFeatures = this.provider.getInitialFeatures(); - final Function1 _function = (IDetailExpressionProvider.ExpressionFeature it) -> { - return Boolean.valueOf(this.matches(it, firstParseResult)); - }; - IDetailExpressionProvider.ExpressionFeature lastMatch = IterableExtensions.findFirst(_initialFeatures, _function); - while (((!Objects.equal(lastMatch, null)) && (!parsedFeatures.isEmpty()))) { - { - final IDetailExpressionProvider.ExpressionFeature nextParseResult = parsedFeatures.pop(); - List _contextFeatures = this.provider.getContextFeatures(lastMatch); - final Function1 _function_1 = (IDetailExpressionProvider.ExpressionFeature it) -> { - return Boolean.valueOf(this.matches(it, nextParseResult)); - }; - IDetailExpressionProvider.ExpressionFeature _findFirst = IterableExtensions.findFirst(_contextFeatures, _function_1); - lastMatch = _findFirst; - } - } - return lastMatch; - } - - public boolean isContextExpression() { - boolean _xtrycatchfinallyexpression = false; - try { - _xtrycatchfinallyexpression = ((this.document.getChar((this.invocationOffset - 1)) == IDetailExpressionProvider.SEPARATOR) || this.anyIdScanner.isWordPart(this.document.getChar((this.invocationOffset - 1)))); - } catch (final Throwable _t) { - if (_t instanceof BadLocationException) { - final BadLocationException e = (BadLocationException)_t; - _xtrycatchfinallyexpression = false; - } else { - throw Exceptions.sneakyThrow(_t); - } - } - return _xtrycatchfinallyexpression; - } - - /** - * non-empty id + not-null suffix - */ - private boolean isValid(final IDetailExpressionProvider.ExpressionFeature feature) { - return ((!Strings.isEmpty(feature.getId())) && (!Objects.equal(feature.getPostfix(), null))); - } - - private boolean matches(final IDetailExpressionProvider.ExpressionFeature f1, final IDetailExpressionProvider.ExpressionFeature f2) { - return (Objects.equal(f1.getId(), f2.getId()) && Objects.equal(f1.getPostfix(), f2.getPostfix())); - } - - public DetailExpressionAssistParser(final IDocument document, final int invocationOffset, final IDetailExpressionProvider provider) { - super(); - this.document = document; - this.invocationOffset = invocationOffset; - this.provider = provider; - } -} diff --git a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/GuardDetailExpressionProvider.java b/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/GuardDetailExpressionProvider.java deleted file mode 100644 index e234e3774..000000000 --- a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/GuardDetailExpressionProvider.java +++ /dev/null @@ -1,248 +0,0 @@ -/** - * Copyright (c) 2015 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.expressions.detailcode; - -import com.google.common.base.Objects; -import com.google.common.base.Strings; -import com.google.common.collect.Iterables; -import java.util.List; -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.room.ActorClass; -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.InterfaceItem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.Operation; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.PortOperation; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.SAP; -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.expressions.detailcode.IDetailExpressionProvider; -import org.eclipse.xtend.lib.annotations.AccessorType; -import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; -import org.eclipse.xtext.util.SimpleAttributeResolver; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; - -/** - * Defines expression for fsm guards of an ActorClass - *
    - *
  • attributes and operations of ActorClass
  • - *
  • data-driven incoming messages
  • - *
- */ -@FinalFieldsConstructor -@SuppressWarnings("all") -public class GuardDetailExpressionProvider implements IDetailExpressionProvider { - protected final ActorClass actorClass; - - @Extension - protected final RoomHelpers roomHelpers = new RoomHelpers(); - - protected final SimpleAttributeResolver nameProvider = SimpleAttributeResolver.NAME_RESOLVER; - - @Accessors(AccessorType.PUBLIC_SETTER) - protected VarDecl transitionEventData; - - @Override - public List getInitialFeatures() { - final List scope = CollectionLiterals.newArrayList(); - boolean _notEquals = (!Objects.equal(this.transitionEventData, null)); - if (_notEquals) { - IDetailExpressionProvider.ExpressionFeature _createExprFeature = this.createExprFeature(this.transitionEventData, IDetailExpressionProvider.ExpressionPostfix.NONE); - scope.add(_createExprFeature); - } - List _allInterfaceItems = this.roomHelpers.getAllInterfaceItems(this.actorClass); - final Function1 _function = (InterfaceItem it) -> { - return Boolean.valueOf((it.isEventDriven() || (!this.roomHelpers.isConjugated(it)))); - }; - Iterable _filter = IterableExtensions.filter(_allInterfaceItems, _function); - final Function1 _function_1 = (InterfaceItem it) -> { - IDetailExpressionProvider.ExpressionFeature _switchResult = null; - boolean _matched = false; - if (it instanceof Port) { - boolean _isReplicated = ((Port)it).isReplicated(); - if (_isReplicated) { - _matched=true; - _switchResult = this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); - } - } - if (!_matched) { - _switchResult = this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.NONE); - } - return _switchResult; - }; - Iterable _map = IterableExtensions.map(_filter, _function_1); - Iterables.addAll(scope, _map); - List _latestOperations = this.roomHelpers.getLatestOperations(this.actorClass); - final Function1 _function_2 = (StandardOperation it) -> { - return this.createExprFeature(it); - }; - List _map_1 = ListExtensions.map(_latestOperations, _function_2); - Iterables.addAll(scope, _map_1); - List _allAttributes = this.roomHelpers.getAllAttributes(this.actorClass); - final Function1 _function_3 = (Attribute it) -> { - return this.createExprFeature(it); - }; - List _map_2 = ListExtensions.map(_allAttributes, _function_3); - Iterables.addAll(scope, _map_2); - return scope; - } - - @Override - public List getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx) { - this.assertNotNull(ctx); - final List scope = CollectionLiterals.newArrayList(); - Object _data = ctx.getData(); - final Object obj = _data; - boolean _matched = false; - if (obj instanceof Port) { - int _multiplicity = ((Port)obj).getMultiplicity(); - boolean _equals = (_multiplicity == 1); - if (_equals) { - _matched=true; - } - } - if (!_matched) { - if (obj instanceof SAP) { - _matched=true; - } - } - if (_matched) { - ProtocolClass _protocol = this.roomHelpers.getProtocol(((InterfaceItem)obj)); - boolean _isConjugated = this.roomHelpers.isConjugated(((InterfaceItem)obj)); - boolean _not = (!_isConjugated); - List _allOperations = this.roomHelpers.getAllOperations(_protocol, _not); - final Function1 _function = (PortOperation it) -> { - return this.createExprFeature(it); - }; - List _map = ListExtensions.map(_allOperations, _function); - Iterables.addAll(scope, _map); - } - Object _data_1 = ctx.getData(); - final Object obj_1 = _data_1; - boolean _matched_1 = false; - if (obj_1 instanceof InterfaceItem) { - _matched_1=true; - final ProtocolClass pc = this.roomHelpers.getProtocol(((InterfaceItem)obj_1)); - CommunicationType _commType = pc.getCommType(); - if (_commType != null) { - switch (_commType) { - case DATA_DRIVEN: - boolean _isConjugated_1 = this.roomHelpers.isConjugated(((InterfaceItem)obj_1)); - boolean _not_1 = (!_isConjugated_1); - if (_not_1) { - List _allIncomingMessages = this.roomHelpers.getAllIncomingMessages(pc); - final Function1 _function_1 = (Message it) -> { - return this.createExprFeature(it); - }; - List _map_1 = ListExtensions.map(_allIncomingMessages, _function_1); - Iterables.addAll(scope, _map_1); - } - break; - case EVENT_DRIVEN: - break; - case SYNCHRONOUS: - break; - default: - break; - } - } - } - if (!_matched_1) { - if (obj_1 instanceof Attribute) { - RefableType _type = ((Attribute)obj_1).getType(); - DataType _type_1 = _type.getType(); - if ((_type_1 instanceof DataClass)) { - _matched_1=true; - RefableType _type_2 = ((Attribute)obj_1).getType(); - DataType _type_3 = _type_2.getType(); - final DataClass dc = ((DataClass) _type_3); - List _allAttributes = this.roomHelpers.getAllAttributes(dc); - final Function1 _function_1 = (Attribute it) -> { - return this.createExprFeature(it); - }; - List _map_1 = ListExtensions.map(_allAttributes, _function_1); - Iterables.addAll(scope, _map_1); - List _latestOperations = this.roomHelpers.getLatestOperations(dc); - final Function1 _function_2 = (StandardOperation it) -> { - return this.createExprFeature(it); - }; - List _map_2 = ListExtensions.map(_latestOperations, _function_2); - Iterables.addAll(scope, _map_2); - } - } - } - return scope; - } - - public IDetailExpressionProvider.ExpressionFeature createExprFeature(final Operation it) { - return this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); - } - - public IDetailExpressionProvider.ExpressionFeature createExprFeature(final Message it) { - return this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); - } - - public IDetailExpressionProvider.ExpressionFeature createExprFeature(final Attribute it) { - IDetailExpressionProvider.ExpressionFeature _switchResult = null; - int _size = it.getSize(); - boolean _matched = false; - int _size_1 = it.getSize(); - boolean _greaterThan = (_size_1 > 1); - if (_greaterThan) { - _matched=true; - _switchResult = this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.BRACKETS); - } - if (!_matched) { - _switchResult = this.createExprFeature(it, IDetailExpressionProvider.ExpressionPostfix.NONE); - } - return _switchResult; - } - - protected IDetailExpressionProvider.ExpressionFeature createExprFeature(final EObject eObj, final IDetailExpressionProvider.ExpressionPostfix postfix) { - String _apply = this.nameProvider.apply(eObj); - final IDetailExpressionProvider.ExpressionFeature feature = new IDetailExpressionProvider.ExpressionFeature(_apply, postfix); - feature.setData(eObj); - return feature; - } - - protected void assertNotNull(final IDetailExpressionProvider.ExpressionFeature feature) { - String _id = feature.getId(); - boolean _isNullOrEmpty = Strings.isNullOrEmpty(_id); - boolean _not = (!_isNullOrEmpty); - Assert.isTrue(_not); - IDetailExpressionProvider.ExpressionPostfix _postfix = feature.getPostfix(); - Assert.isNotNull(_postfix); - Object _data = feature.getData(); - Assert.isNotNull(_data); - } - - public GuardDetailExpressionProvider(final ActorClass actorClass) { - super(); - this.actorClass = actorClass; - } - - public void setTransitionEventData(final VarDecl transitionEventData) { - this.transitionEventData = transitionEventData; - } -} diff --git a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/IDetailExpressionProvider.java b/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/IDetailExpressionProvider.java deleted file mode 100644 index 4d2bed2db..000000000 --- a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/IDetailExpressionProvider.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (c) 2015 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.expressions.detailcode; - -import com.google.common.collect.ImmutableList; -import java.util.List; -import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtext.xbase.lib.Pure; - -/** - * Defines detail expressions = ExpressionFeature ('.' ExpressionFeature)* - */ -@SuppressWarnings("all") -public interface IDetailExpressionProvider { - /** - * ExpressionFeature = id(postfix)? with postfix = '(' .* ')' | '[' .* ']' - */ - @Accessors - public static class ExpressionFeature { - private final String id; - - private final IDetailExpressionProvider.ExpressionPostfix postfix; - - private Object data; - - public ExpressionFeature(final String id, final IDetailExpressionProvider.ExpressionPostfix postfix) { - super(); - this.id = id; - this.postfix = postfix; - } - - @Pure - public String getId() { - return this.id; - } - - @Pure - public IDetailExpressionProvider.ExpressionPostfix getPostfix() { - return this.postfix; - } - - @Pure - public Object getData() { - return this.data; - } - - public void setData(final Object data) { - this.data = data; - } - } - - public enum ExpressionPostfix { - NONE, - - PARENTHESES, - - BRACKETS; - } - - public static class EmptyDetailExpressionProvider implements IDetailExpressionProvider { - private final List EMPTY_LIST = ImmutableList.of(); - - @Override - public List getInitialFeatures() { - return this.EMPTY_LIST; - } - - @Override - public List getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx) { - return this.EMPTY_LIST; - } - } - - public final static char SEPARATOR = '.'; - - /** - * A list of ExpressionFeatures, without preceding '.' and that can start a context - * @return not null - */ - public abstract List getInitialFeatures(); - - /** - * A list of ExpressionFeatures, that can follow ctx - * @param ctx having non-null entries - * @return not null - */ - public abstract List getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx); -} diff --git a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/RuntimeDetailExpressionProvider.java b/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/RuntimeDetailExpressionProvider.java deleted file mode 100644 index 8ebc12f91..000000000 --- a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/detailcode/RuntimeDetailExpressionProvider.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.eclipse.etrice.expressions.detailcode; - -import com.google.common.base.Objects; -import java.util.List; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.expressions.detailcode.DefaultDetailExpressionProvider; -import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider; -import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; - -/** - * Defines expression that does not have an model representation. Extends {@link DefaultDetailExpressionProvider} - */ -@FinalFieldsConstructor -@SuppressWarnings("all") -public class RuntimeDetailExpressionProvider extends DefaultDetailExpressionProvider { - @Accessors - public static class RuntimeMethodExpressionData { - } - - public final static String RT_METHOD_GET_REPLICATION = "getReplication"; - - @Override - public List getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx) { - final List scope = super.getContextFeatures(ctx); - Object _data = ctx.getData(); - final Object obj = _data; - boolean _matched = false; - if (obj instanceof InterfaceItem) { - _matched=true; - IDetailExpressionProvider.ExpressionPostfix _postfix = ctx.getPostfix(); - boolean _equals = Objects.equal(_postfix, IDetailExpressionProvider.ExpressionPostfix.NONE); - if (_equals) { - boolean _matched_1 = false; - if (obj instanceof Port) { - boolean _isReplicated = ((Port)obj).isReplicated(); - if (_isReplicated) { - _matched_1=true; - } - } - if (!_matched_1) { - if (obj instanceof SPP) { - _matched_1=true; - } - } - if (_matched_1) { - } - } - } - return scope; - } - - protected IDetailExpressionProvider.ExpressionFeature createRtMethodExprFeature(final String methodName, final EObject eObj) { - final IDetailExpressionProvider.ExpressionFeature feature = new IDetailExpressionProvider.ExpressionFeature(methodName, IDetailExpressionProvider.ExpressionPostfix.PARENTHESES); - RuntimeDetailExpressionProvider.RuntimeMethodExpressionData _runtimeMethodExpressionData = new RuntimeDetailExpressionProvider.RuntimeMethodExpressionData(); - feature.setData(_runtimeMethodExpressionData); - return feature; - } - - public RuntimeDetailExpressionProvider(final ActorClass actorClass) { - super(actorClass); - } -} diff --git a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/DetailExpressionUIProvider.java b/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/DetailExpressionUIProvider.java deleted file mode 100644 index 9b2c17f78..000000000 --- a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/DetailExpressionUIProvider.java +++ /dev/null @@ -1,324 +0,0 @@ -/** - * Copyright (c) 2015 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.expressions.ui; - -import com.google.common.base.Objects; -import com.google.common.base.Strings; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.List; -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.Operation; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider; -import org.eclipse.etrice.expressions.detailcode.RuntimeDetailExpressionProvider; -import org.eclipse.etrice.expressions.ui.HighlightConstants; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; -import org.eclipse.xtext.xbase.lib.Pair; - -@Singleton -@SuppressWarnings("all") -public class DetailExpressionUIProvider { - private final static String IMAGE_RT_METHOD = "icons/rt_method.png"; - - @Inject - protected ILabelProvider labelProvider; - - @Inject - protected RoomHelpers roomHelpers; - - /** - * Return postfix string and its selection (relative start, length) - */ - public Pair getPostfixReplacement(final IDetailExpressionProvider.ExpressionFeature feature) { - Pair _xblockexpression = null; - { - this.assertNotNull(feature); - String[] _switchResult = null; - IDetailExpressionProvider.ExpressionPostfix _postfix = feature.getPostfix(); - if (_postfix != null) { - switch (_postfix) { - case PARENTHESES: - _switchResult = new String[] { "(", ")" }; - break; - case BRACKETS: - _switchResult = new String[] { "[", "]" }; - break; - default: - return Pair.of("", null); - } - } else { - return Pair.of("", null); - } - String[] brackets = _switchResult; - String _switchResult_1 = null; - Object _data = feature.getData(); - final Object data = _data; - boolean _matched = false; - if (data instanceof Operation) { - _matched=true; - EList _arguments = ((Operation)data).getArguments(); - final Function1 _function = (VarDecl it) -> { - return it.getName(); - }; - List _map = ListExtensions.map(_arguments, _function); - _switchResult_1 = IterableExtensions.join(_map, ", "); - } - if (!_matched) { - if (data instanceof Message) { - VarDecl _data_1 = ((Message)data).getData(); - boolean _notEquals = (!Objects.equal(_data_1, null)); - if (_notEquals) { - _matched=true; - VarDecl _data_2 = ((Message)data).getData(); - _switchResult_1 = _data_2.getName(); - } - } - } - if (!_matched) { - if (data instanceof Attribute) { - _matched=true; - } - if (!_matched) { - if (data instanceof InterfaceItem) { - _matched=true; - } - } - if (_matched) { - _switchResult_1 = "0"; - } - } - if (!_matched) { - _switchResult_1 = ""; - } - String replacement = _switchResult_1; - Point _xifexpression = null; - boolean _isEmpty = replacement.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - int _length = replacement.length(); - _xifexpression = new Point(1, _length); - } - final Point selection = _xifexpression; - final String[] _converted_brackets = (String[])brackets; - String _head = IterableExtensions.head(((Iterable)Conversions.doWrapArray(_converted_brackets))); - String _plus = (_head + replacement); - final String[] _converted_brackets_1 = (String[])brackets; - String _last = IterableExtensions.last(((Iterable)Conversions.doWrapArray(_converted_brackets_1))); - String _plus_1 = (_plus + _last); - _xblockexpression = Pair.of(_plus_1, selection); - } - return _xblockexpression; - } - - /** - * Return completion string and its selection (relative start, length) - */ - public Pair getCompletion(final IDetailExpressionProvider.ExpressionFeature feature) { - this.assertNotNull(feature); - Pair postfix = this.getPostfixReplacement(feature); - Point point = postfix.getValue(); - boolean _notEquals = (!Objects.equal(point, null)); - if (_notEquals) { - int _x = point.x; - String _id = feature.getId(); - int _length = _id.length(); - point.x = (_x + _length); - } - String _id_1 = feature.getId(); - String _key = postfix.getKey(); - String _plus = (_id_1 + _key); - return Pair.of(_plus, point); - } - - public String getID(final IDetailExpressionProvider.ExpressionFeature feature) { - this.assertNotNull(feature); - String _switchResult = null; - Object _data = feature.getData(); - boolean _matched = false; - if (_data instanceof InterfaceItem) { - _matched=true; - _switchResult = HighlightConstants.INTERFACE_ITEM; - } - if (!_matched) { - if (_data instanceof Attribute) { - _matched=true; - _switchResult = HighlightConstants.ATTRIBUTE; - } - } - if (!_matched) { - if (_data instanceof Operation) { - _matched=true; - _switchResult = HighlightConstants.OPERATION; - } - } - if (!_matched) { - if (_data instanceof EObject) { - _matched=true; - _switchResult = HighlightConstants.SPECIAL_FEATURE; - } - } - if (!_matched) { - if (_data instanceof RuntimeDetailExpressionProvider.RuntimeMethodExpressionData) { - _matched=true; - _switchResult = HighlightConstants.OPERATION; - } - } - return _switchResult; - } - - /** - * Text format: - * {@code completionInfo : typedInfo - classInfo} - */ - public String getDisplayString(final IDetailExpressionProvider.ExpressionFeature feature) { - this.assertNotNull(feature); - final Object data = feature.getData(); - String _id = feature.getId(); - Pair _postfixReplacement = this.getPostfixReplacement(feature); - String _key = _postfixReplacement.getKey(); - String completionInfo = (_id + _key); - String typedInfo = ""; - String _xifexpression = null; - if ((data instanceof EObject)) { - EClass _eClass = ((EObject)data).eClass(); - _xifexpression = _eClass.getName(); - } else { - _xifexpression = ""; - } - String classInfo = _xifexpression; - boolean _matched = false; - if (data instanceof Attribute) { - _matched=true; - RefableType _type = ((Attribute)data).getType(); - DataType _type_1 = _type.getType(); - String _name = _type_1.getName(); - typedInfo = _name; - } - if (!_matched) { - if (data instanceof InterfaceItem) { - _matched=true; - ProtocolClass _protocol = this.roomHelpers.getProtocol(((InterfaceItem)data)); - String _name = _protocol.getName(); - typedInfo = _name; - } - } - if (!_matched) { - if (data instanceof RuntimeDetailExpressionProvider.RuntimeMethodExpressionData) { - String _id_1 = feature.getId(); - boolean _equals = Objects.equal(_id_1, RuntimeDetailExpressionProvider.RT_METHOD_GET_REPLICATION); - if (_equals) { - _matched=true; - typedInfo = "int"; - } - } - } - if (!_matched) { - if (data instanceof VarDecl) { - _matched=true; - RefableType _refType = ((VarDecl)data).getRefType(); - DataType _type = _refType.getType(); - String _name = _type.getName(); - typedInfo = _name; - classInfo = ""; - } - } - if (!_matched) { - { - final String label = this.labelProvider.getText(data); - String _commonPrefix = Strings.commonPrefix(label, completionInfo); - boolean _isEmpty = _commonPrefix.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - completionInfo = label; - } - } - } - IDetailExpressionProvider.ExpressionPostfix _postfix = feature.getPostfix(); - boolean _equals = Objects.equal(_postfix, IDetailExpressionProvider.ExpressionPostfix.NONE); - if (_equals) { - boolean _matched_1 = false; - if (data instanceof SPP) { - boolean _isEventDriven = ((SPP)data).isEventDriven(); - if (_isEventDriven) { - _matched_1=true; - } - } - if (!_matched_1) { - if (data instanceof Port) { - if ((((Port)data).isReplicated() && ((Port)data).isEventDriven())) { - _matched_1=true; - } - } - } - if (_matched_1) { - completionInfo = (completionInfo + " (broadcast)"); - } - } - boolean _isEmpty = typedInfo.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - typedInfo = (" : " + typedInfo); - } - boolean _isEmpty_1 = classInfo.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - classInfo = (" - " + classInfo); - } - return ((completionInfo + typedInfo) + classInfo); - } - - public Image getImage(final IDetailExpressionProvider.ExpressionFeature feature) { - Image _xblockexpression = null; - { - this.assertNotNull(feature); - Image _switchResult = null; - Object _data = feature.getData(); - boolean _matched = false; - if (_data instanceof EObject) { - _matched=true; - Object _data_1 = feature.getData(); - _switchResult = this.labelProvider.getImage(_data_1); - } - _xblockexpression = _switchResult; - } - return _xblockexpression; - } - - protected void assertNotNull(final IDetailExpressionProvider.ExpressionFeature feature) { - String _id = feature.getId(); - boolean _isNullOrEmpty = Strings.isNullOrEmpty(_id); - boolean _not = (!_isNullOrEmpty); - Assert.isTrue(_not); - IDetailExpressionProvider.ExpressionPostfix _postfix = feature.getPostfix(); - Assert.isNotNull(_postfix); - Object _data = feature.getData(); - Assert.isNotNull(_data); - } -} diff --git a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/HighlightConstants.java b/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/HighlightConstants.java deleted file mode 100644 index 4a4a89785..000000000 --- a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/HighlightConstants.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * juergen.haug@protos.de (initial contribution) - */ -package org.eclipse.etrice.expressions.ui; - -import org.eclipse.swt.graphics.RGB; - -@SuppressWarnings("all") -public class HighlightConstants { - public final static String INTERFACE_ITEM = "room_InterfaceItem"; - - public final static String ATTRIBUTE = "room_Attribute"; - - public final static String OPERATION = "room_Operation"; - - public final static String SPECIAL_FEATURE = "room_EObject"; - - public final static RGB COLOR_TARGET_KEYWORD = new RGB(127, 0, 85); - - public final static RGB COLLOR_COMMENT = new RGB(63, 127, 95); - - public final static RGB COLOR_STRING = new RGB(42, 0, 255); - - public final static RGB COLOR_NUMBER = new RGB(125, 125, 125); -} diff --git a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/contentassist/RoomExpressionProposals.java b/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/contentassist/RoomExpressionProposals.java deleted file mode 100644 index c3a9b0690..000000000 --- a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/contentassist/RoomExpressionProposals.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.expressions.ui.contentassist; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.etrice.expressions.detailcode.DetailExpressionAssistParser; -import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider; -import org.eclipse.etrice.expressions.ui.DetailExpressionUIProvider; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal; -import org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Exceptions; -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.Pair; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; - -@SuppressWarnings("all") -public class RoomExpressionProposals { - @Inject - private DetailExpressionUIProvider uiExpressionProvider; - - @Inject - private PrefixMatcher prefixMatcher; - - public List createProposals(final IDetailExpressionProvider exprProvider, final String text, final int offset, final int globalOffset) { - try { - List _xblockexpression = null; - { - Document _document = new Document(text); - final DetailExpressionAssistParser parser = new DetailExpressionAssistParser(_document, offset, exprProvider); - ArrayList _newArrayList = CollectionLiterals.newArrayList(); - final Procedure1> _function = (ArrayList it) -> { - boolean _isContextExpression = parser.isContextExpression(); - if (_isContextExpression) { - IDetailExpressionProvider.ExpressionFeature _resolveLatestCompleted = null; - if (parser!=null) { - _resolveLatestCompleted=parser.resolveLatestCompleted(); - } - final IDetailExpressionProvider.ExpressionFeature contextFeature = _resolveLatestCompleted; - List _xifexpression = null; - if ((contextFeature != null)) { - _xifexpression = exprProvider.getContextFeatures(contextFeature); - } else { - _xifexpression = exprProvider.getInitialFeatures(); - } - Iterables.addAll(it, _xifexpression); - } else { - List _initialFeatures = exprProvider.getInitialFeatures(); - Iterables.addAll(it, _initialFeatures); - } - }; - final ArrayList availableFeatures = ObjectExtensions.>operator_doubleArrow(_newArrayList, _function); - final String prefix = parser.computeIdentifierPrefix(offset); - final Function1 _function_1 = (IDetailExpressionProvider.ExpressionFeature it) -> { - String _id = it.getId(); - return Boolean.valueOf(_id.startsWith(prefix)); - }; - Iterable _filter = IterableExtensions.filter(availableFeatures, _function_1); - final Function1 _function_2 = (IDetailExpressionProvider.ExpressionFeature feature) -> { - String _displayString = this.uiExpressionProvider.getDisplayString(feature); - final StyledString displayString = new StyledString(_displayString); - final Image image = this.uiExpressionProvider.getImage(feature); - String _id = feature.getId(); - ConfigurableCompletionProposal _doCreateProposal = this.doCreateProposal(_id, displayString, image, prefix, globalOffset); - final Procedure1 _function_3 = (ConfigurableCompletionProposal it) -> { - this.processPostfix(it, feature); - }; - final ConfigurableCompletionProposal prop = ObjectExtensions.operator_doubleArrow(_doCreateProposal, _function_3); - return ((ICompletionProposal) prop); - }; - Iterable _map = IterableExtensions.map(_filter, _function_2); - _xblockexpression = IterableExtensions.toList(_map); - } - return _xblockexpression; - } catch (Throwable _e) { - throw Exceptions.sneakyThrow(_e); - } - } - - protected ConfigurableCompletionProposal doCreateProposal(final String proposal, final StyledString displayString, final Image image, final String prefix, final int globalOffset) { - int _length = prefix.length(); - int _minus = (globalOffset - _length); - int _length_1 = prefix.length(); - int _length_2 = proposal.length(); - ConfigurableCompletionProposal _configurableCompletionProposal = new ConfigurableCompletionProposal(proposal, _minus, _length_1, _length_2, image, displayString, null, null); - final Procedure1 _function = (ConfigurableCompletionProposal it) -> { - it.setMatcher(this.prefixMatcher); - it.setAutoInsertable(false); - int _length_3 = proposal.length(); - it.setReplaceContextLength(_length_3); - }; - return ObjectExtensions.operator_doubleArrow(_configurableCompletionProposal, _function); - } - - protected ConfigurableCompletionProposal processPostfix(final ConfigurableCompletionProposal proposal, final IDetailExpressionProvider.ExpressionFeature feature) { - final Procedure1 _function = (ConfigurableCompletionProposal it) -> { - final Pair postfix = this.uiExpressionProvider.getPostfixReplacement(feature); - String _key = postfix.getKey(); - boolean _isEmpty = Strings.isEmpty(_key); - boolean _not = (!_isEmpty); - if (_not) { - Point _value = postfix.getValue(); - boolean _notEquals = (!Objects.equal(_value, null)); - if (_notEquals) { - int _replacementOffset = it.getReplacementOffset(); - String _replacementString = it.getReplacementString(); - int _length = _replacementString.length(); - int _plus = (_replacementOffset + _length); - Point _value_1 = postfix.getValue(); - int _plus_1 = (_plus + _value_1.x); - it.setSelectionStart(_plus_1); - int _cursorPosition = it.getCursorPosition(); - Point _value_2 = postfix.getValue(); - int _plus_2 = (_cursorPosition + _value_2.x); - it.setCursorPosition(_plus_2); - Point _value_3 = postfix.getValue(); - it.setSelectionLength(_value_3.y); - } else { - int _cursorPosition_1 = it.getCursorPosition(); - String _key_1 = postfix.getKey(); - int _length_1 = _key_1.length(); - int _plus_3 = (_cursorPosition_1 + _length_1); - it.setCursorPosition(_plus_3); - } - String _replacementString_1 = it.getReplacementString(); - String _key_2 = postfix.getKey(); - String _plus_4 = (_replacementString_1 + _key_2); - it.setReplacementString(_plus_4); - } - }; - return ObjectExtensions.operator_doubleArrow(proposal, _function); - } -} diff --git a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/highlight/RoomExpressionHighlighter.java b/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/highlight/RoomExpressionHighlighter.java deleted file mode 100644 index 1ac97ddac..000000000 --- a/plugins/org.eclipse.etrice.expressions.ui/xtend-gen/org/eclipse/etrice/expressions/ui/highlight/RoomExpressionHighlighter.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.expressions.ui.highlight; - -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.etrice.expressions.ui.DetailExpressionUIProvider; -import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Pure; - -@SuppressWarnings("all") -public class RoomExpressionHighlighter { - @Accessors - public static class HighlightResult { - private final int offset; - - private final int length; - - private final String id; - - public HighlightResult(final int offset, final int length, final String id) { - super(); - this.offset = offset; - this.length = length; - this.id = id; - } - - @Pure - public int getOffset() { - return this.offset; - } - - @Pure - public int getLength() { - return this.length; - } - - @Pure - public String getId() { - return this.id; - } - } - - @Inject - private DetailExpressionUIProvider expressionProvider; - - public List getHighlighting(final String text, final int offset) { - ArrayList _xblockexpression = null; - { - final ArrayList result = CollectionLiterals.newArrayList(); - _xblockexpression = result; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java deleted file mode 100644 index f8a9dde27..000000000 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java +++ /dev/null @@ -1,1287 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Thomas Schuetz (changed for C code generator) - */ -package org.eclipse.etrice.generator.c.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.room.ActorClass; -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.EnumerationType; -import org.eclipse.etrice.core.room.GeneralProtocolClass; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.Operation; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.PortClass; -import org.eclipse.etrice.core.room.PortOperation; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.SAP; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.ServiceImplementation; -import org.eclipse.etrice.core.room.StandardOperation; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; -import org.eclipse.etrice.generator.c.Main; -import org.eclipse.etrice.generator.c.gen.CExtensions; -import org.eclipse.etrice.generator.c.gen.StateMachineGen; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.GenericActorClassGenerator; -import org.eclipse.etrice.generator.generic.ILanguageExtension; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; - -@Singleton -@SuppressWarnings("all") -public class ActorClassGen extends GenericActorClassGenerator { - @Inject - @Extension - protected RoomExtensions _roomExtensions; - - @Inject - @Extension - protected CExtensions _cExtensions; - - @Inject - @Extension - protected ProcedureHelpers _procedureHelpers; - - @Inject - @Extension - protected StateMachineGen _stateMachineGen; - - @Inject - protected ILanguageExtension langExt; - - @Inject - protected IGeneratorFileIo fileIO; - - @Inject - protected ILogger logger; - - public void doGenerate(final Root root) { - EList _actorClasses = root.getActorClasses(); - final Function1 _function = (ActorClass it) -> { - return root.getExpandedActorClass(it); - }; - List _map = ListExtensions.map(_actorClasses, _function); - for (final ExpandedActorClass xpac : _map) { - { - ActorClass _actorClass = xpac.getActorClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_actorClass); - ActorClass _actorClass_1 = xpac.getActorClass(); - String _path = this._roomExtensions.getPath(_actorClass_1); - final String path = (_generationTargetPath + _path); - ActorClass _actorClass_2 = xpac.getActorClass(); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_actorClass_2); - ActorClass _actorClass_3 = xpac.getActorClass(); - String _path_1 = this._roomExtensions.getPath(_actorClass_3); - final String infopath = (_generationInfoPath + _path_1); - ActorClass _actorClass_4 = xpac.getActorClass(); - String file = this._cExtensions.getCHeaderFileName(_actorClass_4); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, xpac); - this.fileIO.generateFile("generating ActorClass header", path, infopath, file, _generateHeaderFile); - ActorClass _actorClass_5 = xpac.getActorClass(); - String _cUtilsFileName = this._cExtensions.getCUtilsFileName(_actorClass_5); - file = _cUtilsFileName; - CharSequence _generateUtilsFile = this.generateUtilsFile(root, xpac); - this.fileIO.generateFile("generating ActorClass utils", path, infopath, file, _generateUtilsFile); - ActorClass _actorClass_6 = xpac.getActorClass(); - boolean _isBehaviorAnnotationPresent = this._roomHelpers.isBehaviorAnnotationPresent(_actorClass_6, "BehaviorManual"); - if (_isBehaviorAnnotationPresent) { - ActorClass _actorClass_7 = xpac.getActorClass(); - String _name = _actorClass_7.getName(); - String _plus = ("omitting ActorClass source for \'" + _name); - String _plus_1 = (_plus + "\' since @BehaviorManual is specified"); - this.logger.logInfo(_plus_1); - } else { - ActorClass _actorClass_8 = xpac.getActorClass(); - String _cSourceFileName = this._cExtensions.getCSourceFileName(_actorClass_8); - file = _cSourceFileName; - CharSequence _generateSourceFile = this.generateSourceFile(root, xpac); - this.fileIO.generateFile("generating ActorClass source", path, infopath, file, _generateSourceFile); - } - } - } - } - - protected CharSequence generateHeaderFile(final Root root, final ExpandedActorClass xpac) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - List _allEndPorts = this._roomHelpers.getAllEndPorts(ac); - final Function1 _function = (Port p) -> { - GeneralProtocolClass _protocol = p.getProtocol(); - CommunicationType _commType = ((ProtocolClass) _protocol).getCommType(); - return Boolean.valueOf(Objects.equal(_commType, CommunicationType.EVENT_DRIVEN)); - }; - final Iterable eventPorts = IterableExtensions.filter(_allEndPorts, _function); - List _allEndPorts_1 = this._roomHelpers.getAllEndPorts(ac); - final Function1 _function_1 = (Port p) -> { - return Boolean.valueOf((Objects.equal(((ProtocolClass) p.getProtocol()).getCommType(), CommunicationType.DATA_DRIVEN) && p.isConjugated())); - }; - final Iterable sendPorts = IterableExtensions.filter(_allEndPorts_1, _function_1); - List _allEndPorts_2 = this._roomHelpers.getAllEndPorts(ac); - final Function1 _function_2 = (Port p) -> { - return Boolean.valueOf((Objects.equal(((ProtocolClass) p.getProtocol()).getCommType(), CommunicationType.DATA_DRIVEN) && (!p.isConjugated()))); - }; - final Iterable recvPorts = IterableExtensions.filter(_allEndPorts_2, _function_2); - ComponentCommunicationType _commType = ac.getCommType(); - final boolean dataDriven = Objects.equal(_commType, ComponentCommunicationType.DATA_DRIVEN); - ComponentCommunicationType _commType_1 = ac.getCommType(); - final boolean async = Objects.equal(_commType_1, ComponentCommunicationType.ASYNCHRONOUS); - final boolean hasConstData = ((!(((IterableExtensions.isEmpty(eventPorts) && IterableExtensions.isEmpty(recvPorts)) && this._roomHelpers.getAllSAPs(ac).isEmpty()) && this._roomHelpers.getAllServiceImplementations(ac).isEmpty())) || Main.getSettings().isGenerateMSCInstrumentation()); - final boolean hasVarData = (!(((IterableExtensions.isEmpty(sendPorts) && this._roomHelpers.getAllAttributes(ac).isEmpty()) && this._roomHelpers.isEmpty(xpac.getStateMachine())) && (!hasConstData))); - 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 ActorClass "); - String _name = ac.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(ac); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"etDatatypes.h\""); - _builder.newLine(); - _builder.append("#include \"messaging/etMessage.h\""); - _builder.newLine(); - _builder.newLine(); - { - EList _referencedDataClasses = root.getReferencedDataClasses(ac); - for(final DataClass dataClass : _referencedDataClasses) { - _builder.append("#include "); - String _includePath = this._cExtensions.getIncludePath(dataClass); - _builder.append(_includePath, ""); - _builder.newLineIfNotEmpty(); - } - } - { - EList _referencedEnumClasses = root.getReferencedEnumClasses(ac); - for(final EnumerationType enumClass : _referencedEnumClasses) { - _builder.append("#include "); - String _includePath_1 = this._cExtensions.getIncludePath(enumClass); - _builder.append(_includePath_1, ""); - _builder.newLineIfNotEmpty(); - } - } - { - EList _referencedProtocolClasses = root.getReferencedProtocolClasses(ac); - for(final ProtocolClass pc : _referencedProtocolClasses) { - _builder.append("#include "); - String _includePath_2 = this._cExtensions.getIncludePath(pc); - _builder.append(_includePath_2, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(ac, 1, true); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("typedef struct "); - String _name_1 = ac.getName(); - _builder.append(_name_1, ""); - _builder.append(" "); - String _name_2 = ac.getName(); - _builder.append(_name_2, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* const part of ActorClass (ROM) */"); - _builder.newLine(); - { - if (hasConstData) { - _builder.append("typedef struct "); - String _name_3 = ac.getName(); - _builder.append(_name_3, ""); - _builder.append("_const {"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t"); - _builder.append("const char* instName;"); - _builder.newLine(); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("/* simple ports */"); - _builder.newLine(); - { - for(final Port ep : eventPorts) { - { - int _multiplicity = ep.getMultiplicity(); - boolean _equals = (_multiplicity == 1); - if (_equals) { - _builder.append("\t"); - _builder.append("const "); - String _portClassName = this._roomExtensions.getPortClassName(ep); - _builder.append(_portClassName, "\t"); - _builder.append(" "); - String _name_4 = ep.getName(); - _builder.append(_name_4, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* data receive ports */"); - _builder.newLine(); - { - for(final Port ep_1 : recvPorts) { - { - int _multiplicity_1 = ep_1.getMultiplicity(); - boolean _equals_1 = (_multiplicity_1 == 1); - if (_equals_1) { - _builder.append("\t"); - _builder.append("const "); - String _portClassName_1 = this._roomExtensions.getPortClassName(ep_1); - _builder.append(_portClassName_1, "\t"); - _builder.append(" "); - String _name_5 = ep_1.getName(); - _builder.append(_name_5, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* saps */"); - _builder.newLine(); - { - List _allSAPs = this._roomHelpers.getAllSAPs(ac); - for(final SAP sap : _allSAPs) { - _builder.append("\t"); - _builder.append("const "); - String _portClassName_2 = this._roomExtensions.getPortClassName(sap); - _builder.append(_portClassName_2, "\t"); - _builder.append(" "); - String _name_6 = sap.getName(); - _builder.append(_name_6, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* replicated ports */"); - _builder.newLine(); - { - List _allEndPorts_3 = this._roomHelpers.getAllEndPorts(ac); - for(final Port ep_2 : _allEndPorts_3) { - { - int _multiplicity_2 = ep_2.getMultiplicity(); - boolean _notEquals = (_multiplicity_2 != 1); - if (_notEquals) { - _builder.append("\t"); - _builder.append("const etReplPort "); - String _name_7 = ep_2.getName(); - _builder.append(_name_7, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* services */"); - _builder.newLine(); - { - List _allServiceImplementations = this._roomHelpers.getAllServiceImplementations(ac); - for(final ServiceImplementation svc : _allServiceImplementations) { - _builder.append("\t"); - _builder.append("const etReplPort "); - SPP _spp = svc.getSpp(); - String _name_8 = _spp.getName(); - _builder.append(_name_8, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("} "); - String _name_9 = ac.getName(); - _builder.append(_name_9, ""); - _builder.append("_const;"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("/* this actor class has no ports and thus no constant data */"); - _builder.newLine(); - } - } - _builder.newLine(); - { - StateGraph _stateMachine = xpac.getStateMachine(); - boolean _isEmpty = this._roomHelpers.isEmpty(_stateMachine); - boolean _not = (!_isEmpty); - if (_not) { - _builder.newLine(); - CharSequence _genHeaderConstants = this._stateMachineGen.genHeaderConstants(xpac); - _builder.append(_genHeaderConstants, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* variable part of ActorClass (RAM) */"); - _builder.newLine(); - { - if (hasVarData) { - _builder.append("struct "); - String _name_10 = ac.getName(); - _builder.append(_name_10, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - { - if (hasConstData) { - _builder.append("\t"); - _builder.append("const "); - String _name_11 = ac.getName(); - _builder.append(_name_11, "\t"); - _builder.append("_const* const constData;"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("/* data send ports */"); - _builder.newLine(); - { - for(final Port ep_3 : sendPorts) { - { - int _multiplicity_3 = ep_3.getMultiplicity(); - boolean _equals_2 = (_multiplicity_3 == 1); - if (_equals_2) { - _builder.append("\t"); - String _portClassName_3 = this._roomExtensions.getPortClassName(ep_3); - _builder.append(_portClassName_3, "\t"); - _builder.append(" "); - String _name_12 = ep_3.getName(); - _builder.append(_name_12, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - List _allAttributes = this._roomHelpers.getAllAttributes(ac); - CharSequence _attributes = this._procedureHelpers.attributes(_allAttributes); - _builder.append(_attributes, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - StateGraph _stateMachine_1 = xpac.getStateMachine(); - boolean _isEmpty_1 = this._roomHelpers.isEmpty(_stateMachine_1); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - _builder.newLine(); - _builder.append("\t"); - CharSequence _genDataMembers = this._stateMachineGen.genDataMembers(xpac); - _builder.append(_genDataMembers, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("};"); - _builder.newLine(); - } else { - _builder.append("struct "); - String _name_13 = ac.getName(); - _builder.append(_name_13, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("/* This actor class has no data at all."); - _builder.newLine(); - _builder.append("\t "); - _builder.append("But the private actor instance data is passed to all life cycle functions."); - _builder.newLine(); - _builder.append("\t "); - _builder.append("By introducing the dummy data we keep this case simple"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("*/"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("int dummy;"); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("void "); - String _name_14 = ac.getName(); - _builder.append(_name_14, ""); - _builder.append("_init("); - String _name_15 = ac.getName(); - _builder.append(_name_15, ""); - _builder.append("* self);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("void "); - String _name_16 = ac.getName(); - _builder.append(_name_16, ""); - _builder.append("_receiveMessage(void* self, const void* ifitem, const etMessage* msg);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - if ((dataDriven || async)) { - _builder.append("void "); - String _name_17 = ac.getName(); - _builder.append(_name_17, ""); - _builder.append("_execute("); - String _name_18 = ac.getName(); - _builder.append(_name_18, ""); - _builder.append("* self);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - String _userStructorsDeclaration = this._procedureHelpers.userStructorsDeclaration(ac); - _builder.append(_userStructorsDeclaration, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - List _latestOperations = this._roomHelpers.getLatestOperations(ac); - String _name_19 = ac.getName(); - CharSequence _operationsDeclaration = this._procedureHelpers.operationsDeclaration(_latestOperations, _name_19); - _builder.append(_operationsDeclaration, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _userCode_1 = this._procedureHelpers.userCode(ac, 2, true); - _builder.append(_userCode_1, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(ac); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - protected CharSequence generateUtilsFile(final Root root, final ExpandedActorClass xpac) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - List _allEndPorts = this._roomHelpers.getAllEndPorts(ac); - final Function1 _function = (Port p) -> { - GeneralProtocolClass _protocol = p.getProtocol(); - CommunicationType _commType = ((ProtocolClass) _protocol).getCommType(); - return Boolean.valueOf(Objects.equal(_commType, CommunicationType.EVENT_DRIVEN)); - }; - final Iterable eventPorts = IterableExtensions.filter(_allEndPorts, _function); - final Function1 _function_1 = (Port it) -> { - int _multiplicity = it.getMultiplicity(); - return Boolean.valueOf((_multiplicity != 1)); - }; - final Iterable replEventPorts = IterableExtensions.filter(eventPorts, _function_1); - List _allEndPorts_1 = this._roomHelpers.getAllEndPorts(ac); - final Function1 _function_2 = (Port p) -> { - return Boolean.valueOf(((Objects.equal(((ProtocolClass) p.getProtocol()).getCommType(), CommunicationType.DATA_DRIVEN) && p.isConjugated()) && (p.getMultiplicity() == 1))); - }; - final Iterable sendPorts = IterableExtensions.filter(_allEndPorts_1, _function_2); - List _allEndPorts_2 = this._roomHelpers.getAllEndPorts(ac); - final Function1 _function_3 = (Port p) -> { - return Boolean.valueOf(((Objects.equal(((ProtocolClass) p.getProtocol()).getCommType(), CommunicationType.DATA_DRIVEN) && (!p.isConjugated())) && (p.getMultiplicity() == 1))); - }; - final Iterable recvPorts = IterableExtensions.filter(_allEndPorts_2, _function_3); - List _allInterfaceItems = this._roomHelpers.getAllInterfaceItems(ac); - final Function1 _function_4 = (InterfaceItem p) -> { - return Boolean.valueOf(((!Objects.equal(this._roomHelpers.getPortClass(p), null)) && (this._roomHelpers.getPortClass(p).getOperations().size() > 0))); - }; - final Iterable portsWithOperations = IterableExtensions.filter(_allInterfaceItems, _function_4); - EObject _eContainer = ac.eContainer(); - String _name = ((RoomModel) _eContainer).getName(); - String _replaceAll = _name.replaceAll("\\.", "_"); - String _plus = (_replaceAll + "_"); - String _name_1 = ac.getName(); - String _plus_1 = (_plus + _name_1); - final String filename = (_plus_1 + "_Utils"); - 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("* Utils File of ActorClass "); - String _name_2 = ac.getName(); - _builder.append(_name_2, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(filename); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include "); - String _includePath = this._cExtensions.getIncludePath(ac); - _builder.append(_includePath, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* access macros for ports, operations and attributes"); - _builder.newLine(); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("/* simple event ports */"); - _builder.newLine(); - { - final Function1 _function_5 = (Port it) -> { - int _multiplicity = it.getMultiplicity(); - return Boolean.valueOf((_multiplicity == 1)); - }; - Iterable _filter = IterableExtensions.filter(eventPorts, _function_5); - for(final Port ep : _filter) { - { - List _outgoing = this._roomHelpers.getOutgoing(ep); - for(final Message msg : _outgoing) { - String _xifexpression = null; - VarDecl _data = msg.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (_notEquals) { - _xifexpression = "data"; - } else { - _xifexpression = ""; - } - final String data1 = _xifexpression; - _builder.newLineIfNotEmpty(); - String _xifexpression_1 = null; - VarDecl _data_1 = msg.getData(); - boolean _notEquals_1 = (!Objects.equal(_data_1, null)); - if (_notEquals_1) { - _xifexpression_1 = ", data"; - } else { - _xifexpression_1 = ""; - } - final String data2 = _xifexpression_1; - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name_3 = ep.getName(); - _builder.append(_name_3, ""); - _builder.append("_"); - String _name_4 = msg.getName(); - _builder.append(_name_4, ""); - _builder.append("("); - _builder.append(data1, ""); - _builder.append(") "); - String _portClassName = this._roomExtensions.getPortClassName(ep); - _builder.append(_portClassName, ""); - _builder.append("_"); - String _name_5 = msg.getName(); - _builder.append(_name_5, ""); - _builder.append("(&self->constData->"); - String _name_6 = ep.getName(); - _builder.append(_name_6, ""); - _builder.append(data2, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("/* data receive ports */"); - _builder.newLine(); - { - for(final Port ep_1 : recvPorts) { - { - List _incoming = this._roomHelpers.getIncoming(ep_1); - for(final Message msg_1 : _incoming) { - _builder.append("#define "); - String _name_7 = ep_1.getName(); - _builder.append(_name_7, ""); - _builder.append("_"); - String _name_8 = msg_1.getName(); - _builder.append(_name_8, ""); - _builder.append(" "); - String _portClassName_1 = this._roomExtensions.getPortClassName(ep_1); - _builder.append(_portClassName_1, ""); - _builder.append("_"); - String _name_9 = msg_1.getName(); - _builder.append(_name_9, ""); - _builder.append("_get(&self->constData->"); - String _name_10 = ep_1.getName(); - _builder.append(_name_10, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("/* data send ports */"); - _builder.newLine(); - { - for(final Port ep_2 : sendPorts) { - { - List _outgoing_1 = this._roomHelpers.getOutgoing(ep_2); - for(final Message msg_2 : _outgoing_1) { - String _xifexpression_2 = null; - VarDecl _data_2 = msg_2.getData(); - boolean _notEquals_2 = (!Objects.equal(_data_2, null)); - if (_notEquals_2) { - _xifexpression_2 = "data"; - } else { - _xifexpression_2 = ""; - } - final String data1_1 = _xifexpression_2; - _builder.newLineIfNotEmpty(); - String _xifexpression_3 = null; - VarDecl _data_3 = msg_2.getData(); - boolean _notEquals_3 = (!Objects.equal(_data_3, null)); - if (_notEquals_3) { - _xifexpression_3 = ", data"; - } else { - _xifexpression_3 = ""; - } - final String data2_1 = _xifexpression_3; - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name_11 = ep_2.getName(); - _builder.append(_name_11, ""); - _builder.append("_"); - String _name_12 = msg_2.getName(); - _builder.append(_name_12, ""); - _builder.append("("); - _builder.append(data1_1, ""); - _builder.append(") "); - String _portClassName_2 = this._roomExtensions.getPortClassName(ep_2); - _builder.append(_portClassName_2, ""); - _builder.append("_"); - String _name_13 = msg_2.getName(); - _builder.append(_name_13, ""); - _builder.append("_set(&self->"); - String _name_14 = ep_2.getName(); - _builder.append(_name_14, ""); - _builder.append(data2_1, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("/* saps */"); - _builder.newLine(); - { - List _allSAPs = this._roomHelpers.getAllSAPs(ac); - for(final SAP sap : _allSAPs) { - { - List _outgoing_2 = this._roomHelpers.getOutgoing(sap); - for(final Message msg_3 : _outgoing_2) { - String _xifexpression_4 = null; - VarDecl _data_4 = msg_3.getData(); - boolean _notEquals_4 = (!Objects.equal(_data_4, null)); - if (_notEquals_4) { - _xifexpression_4 = "data"; - } else { - _xifexpression_4 = ""; - } - final String data1_2 = _xifexpression_4; - _builder.newLineIfNotEmpty(); - String _xifexpression_5 = null; - VarDecl _data_5 = msg_3.getData(); - boolean _notEquals_5 = (!Objects.equal(_data_5, null)); - if (_notEquals_5) { - _xifexpression_5 = ", data"; - } else { - _xifexpression_5 = ""; - } - final String data2_2 = _xifexpression_5; - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name_15 = sap.getName(); - _builder.append(_name_15, ""); - _builder.append("_"); - String _name_16 = msg_3.getName(); - _builder.append(_name_16, ""); - _builder.append("("); - _builder.append(data1_2, ""); - _builder.append(") "); - String _portClassName_3 = this._roomExtensions.getPortClassName(sap); - _builder.append(_portClassName_3, ""); - _builder.append("_"); - String _name_17 = msg_3.getName(); - _builder.append(_name_17, ""); - _builder.append("(&self->constData->"); - String _name_18 = sap.getName(); - _builder.append(_name_18, ""); - _builder.append(data2_2, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("/* replicated event ports */"); - _builder.newLine(); - { - boolean _isEmpty = IterableExtensions.isEmpty(replEventPorts); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append("#define ifitem_index (((etReplSubPort*)ifitem)->index)"); - _builder.newLine(); - } - } - { - for(final Port ep_3 : replEventPorts) { - { - List _outgoing_3 = this._roomHelpers.getOutgoing(ep_3); - for(final Message msg_4 : _outgoing_3) { - String _xifexpression_6 = null; - VarDecl _data_6 = msg_4.getData(); - boolean _notEquals_6 = (!Objects.equal(_data_6, null)); - if (_notEquals_6) { - _xifexpression_6 = "data"; - } else { - _xifexpression_6 = ""; - } - final String data1_3 = _xifexpression_6; - _builder.newLineIfNotEmpty(); - String _xifexpression_7 = null; - VarDecl _data_7 = msg_4.getData(); - boolean _notEquals_7 = (!Objects.equal(_data_7, null)); - if (_notEquals_7) { - _xifexpression_7 = ", data"; - } else { - _xifexpression_7 = ""; - } - final String data2_3 = _xifexpression_7; - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name_19 = ep_3.getName(); - _builder.append(_name_19, ""); - _builder.append("_"); - String _name_20 = msg_4.getName(); - _builder.append(_name_20, ""); - _builder.append("_broadcast("); - _builder.append(data1_3, ""); - _builder.append(") "); - String _portClassName_4 = this._roomExtensions.getPortClassName(ep_3); - _builder.append(_portClassName_4, ""); - _builder.append("_"); - String _name_21 = msg_4.getName(); - _builder.append(_name_21, ""); - _builder.append("_broadcast(&self->constData->"); - String _name_22 = ep_3.getName(); - _builder.append(_name_22, ""); - _builder.append(data2_3, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name_23 = ep_3.getName(); - _builder.append(_name_23, ""); - _builder.append("_"); - String _name_24 = msg_4.getName(); - _builder.append(_name_24, ""); - _builder.append("(idx"); - _builder.append(data2_3, ""); - _builder.append(") "); - String _portClassName_5 = this._roomExtensions.getPortClassName(ep_3); - _builder.append(_portClassName_5, ""); - _builder.append("_"); - String _name_25 = msg_4.getName(); - _builder.append(_name_25, ""); - _builder.append("(&self->constData->"); - String _name_26 = ep_3.getName(); - _builder.append(_name_26, ""); - _builder.append(", idx"); - _builder.append(data2_3, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("/* services */"); - _builder.newLine(); - { - List _allServiceImplementations = this._roomHelpers.getAllServiceImplementations(ac); - for(final ServiceImplementation svc : _allServiceImplementations) { - { - SPP _spp = svc.getSpp(); - List _outgoing_4 = this._roomHelpers.getOutgoing(_spp); - for(final Message msg_5 : _outgoing_4) { - String _xifexpression_8 = null; - VarDecl _data_8 = msg_5.getData(); - boolean _notEquals_8 = (!Objects.equal(_data_8, null)); - if (_notEquals_8) { - _xifexpression_8 = "data"; - } else { - _xifexpression_8 = ""; - } - final String data1_4 = _xifexpression_8; - _builder.newLineIfNotEmpty(); - String _xifexpression_9 = null; - VarDecl _data_9 = msg_5.getData(); - boolean _notEquals_9 = (!Objects.equal(_data_9, null)); - if (_notEquals_9) { - _xifexpression_9 = ", data"; - } else { - _xifexpression_9 = ""; - } - final String data2_4 = _xifexpression_9; - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - SPP _spp_1 = svc.getSpp(); - String _name_27 = _spp_1.getName(); - _builder.append(_name_27, ""); - _builder.append("_"); - String _name_28 = msg_5.getName(); - _builder.append(_name_28, ""); - _builder.append("_broadcast("); - _builder.append(data1_4, ""); - _builder.append(") "); - SPP _spp_2 = svc.getSpp(); - String _portClassName_6 = this._roomExtensions.getPortClassName(_spp_2); - _builder.append(_portClassName_6, ""); - _builder.append("_"); - String _name_29 = msg_5.getName(); - _builder.append(_name_29, ""); - _builder.append("_broadcast(&self->constData->"); - SPP _spp_3 = svc.getSpp(); - String _name_30 = _spp_3.getName(); - _builder.append(_name_30, ""); - _builder.append(data2_4, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - SPP _spp_4 = svc.getSpp(); - String _name_31 = _spp_4.getName(); - _builder.append(_name_31, ""); - _builder.append("_"); - String _name_32 = msg_5.getName(); - _builder.append(_name_32, ""); - _builder.append("(idx"); - _builder.append(data2_4, ""); - _builder.append(") "); - SPP _spp_5 = svc.getSpp(); - String _portClassName_7 = this._roomExtensions.getPortClassName(_spp_5); - _builder.append(_portClassName_7, ""); - _builder.append("_"); - String _name_33 = msg_5.getName(); - _builder.append(_name_33, ""); - _builder.append("(&self->constData->"); - SPP _spp_6 = svc.getSpp(); - String _name_34 = _spp_6.getName(); - _builder.append(_name_34, ""); - _builder.append(", idx"); - _builder.append(data2_4, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("/* operations */"); - _builder.newLine(); - { - List _latestOperations = this._roomHelpers.getLatestOperations(ac); - for(final StandardOperation op : _latestOperations) { - final CharSequence args = this.argList(op); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name_35 = op.getName(); - _builder.append(_name_35, ""); - _builder.append("("); - _builder.append(args, ""); - _builder.append(") "); - String _name_36 = ac.getName(); - _builder.append(_name_36, ""); - _builder.append("_"); - String _name_37 = op.getName(); - _builder.append(_name_37, ""); - _builder.append("(self"); - { - EList _arguments = op.getArguments(); - boolean _isEmpty_1 = _arguments.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - _builder.append(", "); - _builder.append(args, ""); - } - } - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* attributes */"); - _builder.newLine(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(ac); - for(final Attribute a : _allAttributes) { - _builder.append("#define "); - String _name_38 = a.getName(); - _builder.append(_name_38, ""); - _builder.append(" (self->"); - String _name_39 = a.getName(); - _builder.append(_name_39, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* port operations */"); - _builder.newLine(); - { - for(final InterfaceItem p : portsWithOperations) { - { - PortClass _portClass = this._roomHelpers.getPortClass(p); - EList _operations = _portClass.getOperations(); - for(final PortOperation op_1 : _operations) { - final CharSequence args_1 = this.argList(op_1); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name_40 = p.getName(); - _builder.append(_name_40, ""); - _builder.append("_"); - String _name_41 = op_1.getName(); - _builder.append(_name_41, ""); - _builder.append("("); - _builder.append(args_1, ""); - _builder.append(") "); - String _portClassName_8 = this._roomExtensions.getPortClassName(p); - _builder.append(_portClassName_8, ""); - _builder.append("_"); - String _name_42 = op_1.getName(); - _builder.append(_name_42, ""); - _builder.append("(("); - String _portClassName_9 = this._roomExtensions.getPortClassName(p); - _builder.append(_portClassName_9, ""); - _builder.append("*)&self->constData->"); - String _name_43 = p.getName(); - _builder.append(_name_43, ""); - { - EList _arguments_1 = op_1.getArguments(); - boolean _isEmpty_2 = _arguments_1.isEmpty(); - boolean _not_2 = (!_isEmpty_2); - if (_not_2) { - _builder.append(", "); - _builder.append(args_1, ""); - } - } - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(filename); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence argList(final Operation op) { - StringConcatenation _builder = new StringConcatenation(); - { - EList _arguments = op.getArguments(); - boolean _hasElements = false; - for(final VarDecl a : _arguments) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - String _name = a.getName(); - _builder.append(_name, ""); - } - } - return _builder; - } - - protected CharSequence generateSourceFile(final Root root, final ExpandedActorClass xpac) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - ComponentCommunicationType _commType = ac.getCommType(); - final boolean async = Objects.equal(_commType, ComponentCommunicationType.ASYNCHRONOUS); - ComponentCommunicationType _commType_1 = ac.getCommType(); - final boolean eventDriven = Objects.equal(_commType_1, ComponentCommunicationType.EVENT_DRIVEN); - ComponentCommunicationType _commType_2 = ac.getCommType(); - final boolean dataDriven = Objects.equal(_commType_2, ComponentCommunicationType.DATA_DRIVEN); - final boolean handleEvents = (async || eventDriven); - 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 ActorClass "); - String _name = ac.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._cExtensions.getCHeaderFileName(ac); - _builder.append(_cHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"modelbase/etActor.h\""); - _builder.newLine(); - _builder.append("#include \"debugging/etLogger.h\""); - _builder.newLine(); - _builder.append("#include \"debugging/etMSCLogger.h\""); - _builder.newLine(); - _builder.append("#include \"etUnit/etUnit.h\""); - _builder.newLine(); - _builder.append("#include \"base/etMemory.h\""); - _builder.newLine(); - _builder.newLine(); - { - EList _referencedProtocolClasses = root.getReferencedProtocolClasses(ac); - for(final ProtocolClass pc : _referencedProtocolClasses) { - _builder.append("#include "); - String _includePath = this._cExtensions.getIncludePath(pc); - _builder.append(_includePath, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("#include \""); - String _cUtilsFileName = this._cExtensions.getCUtilsFileName(ac); - _builder.append(_cUtilsFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(ac, 3, true); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* interface item IDs */"); - _builder.newLine(); - String _genInterfaceItemConstants = this.genInterfaceItemConstants(xpac); - _builder.append(_genInterfaceItemConstants, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - StateGraph _stateMachine = xpac.getStateMachine(); - boolean _isEmpty = this._roomHelpers.isEmpty(_stateMachine); - boolean _not = (!_isEmpty); - if (_not) { - CharSequence _genStateMachine = this._stateMachineGen.genStateMachine(xpac); - _builder.append(_genStateMachine, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("void "); - String _name_1 = ac.getName(); - _builder.append(_name_1, ""); - _builder.append("_init("); - String _name_2 = ac.getName(); - _builder.append(_name_2, ""); - _builder.append("* self){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - String _name_3 = ac.getName(); - _builder.append(_name_3, "\t"); - _builder.append("\", \"init\")"); - _builder.newLineIfNotEmpty(); - { - StateGraph _stateMachine_1 = xpac.getStateMachine(); - boolean _isEmpty_1 = this._roomHelpers.isEmpty(_stateMachine_1); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - _builder.append("\t"); - CharSequence _genInitialization = this._stateMachineGen.genInitialization(xpac); - _builder.append(_genInitialization, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - String _name_4 = ac.getName(); - _builder.append(_name_4, ""); - _builder.append("_receiveMessage(void* self, const void* ifitem, const etMessage* msg){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - String _name_5 = ac.getName(); - _builder.append(_name_5, "\t"); - _builder.append("\", \"_receiveMessage\")"); - _builder.newLineIfNotEmpty(); - { - StateGraph _stateMachine_2 = xpac.getStateMachine(); - boolean _isEmpty_2 = this._roomHelpers.isEmpty(_stateMachine_2); - boolean _not_2 = (!_isEmpty_2); - if (_not_2) { - { - if (handleEvents) { - _builder.append("\t"); - String _name_6 = ac.getName(); - String _operationScope = this.langExt.operationScope(_name_6, false); - _builder.append(_operationScope, "\t"); - _builder.append("receiveEvent(self, (etPort*)ifitem, msg->evtID, (void*)(((char*)msg)+MEM_CEIL(sizeof(etMessage))));"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - String _name_7 = ac.getName(); - String _operationScope_1 = this.langExt.operationScope(_name_7, false); - _builder.append(_operationScope_1, "\t"); - _builder.append("receiveEventInternal(self);"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - { - if ((dataDriven || async)) { - _builder.append("void "); - String _name_8 = ac.getName(); - _builder.append(_name_8, ""); - _builder.append("_execute("); - String _name_9 = ac.getName(); - _builder.append(_name_9, ""); - _builder.append("* self) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - String _name_10 = ac.getName(); - _builder.append(_name_10, "\t"); - _builder.append("\", \"_execute\")"); - _builder.newLineIfNotEmpty(); - { - StateGraph _stateMachine_3 = xpac.getStateMachine(); - boolean _isEmpty_3 = this._roomHelpers.isEmpty(_stateMachine_3); - boolean _not_3 = (!_isEmpty_3); - if (_not_3) { - _builder.newLine(); - { - if (handleEvents) { - _builder.append("\t"); - String _name_11 = ac.getName(); - String _operationScope_2 = this.langExt.operationScope(_name_11, false); - _builder.append(_operationScope_2, "\t"); - _builder.append("receiveEvent(self, NULL, 0, NULL);"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - String _name_12 = ac.getName(); - String _operationScope_3 = this.langExt.operationScope(_name_12, false); - _builder.append(_operationScope_3, "\t"); - _builder.append("receiveEventInternal(self);"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - String _userStructorsImplementation = this._procedureHelpers.userStructorsImplementation(ac); - _builder.append(_userStructorsImplementation, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - List _latestOperations = this._roomHelpers.getLatestOperations(ac); - String _name_13 = ac.getName(); - CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_latestOperations, _name_13); - _builder.append(_operationsImplementation, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} 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 deleted file mode 100644 index bf0bb37e9..000000000 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java +++ /dev/null @@ -1,816 +0,0 @@ -/** - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * Thomas Schuetz (changed for C code generator) - */ -package org.eclipse.etrice.generator.c.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.etrice.core.common.base.LiteralType; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.IDiagnostician; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumLiteral; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.ExternalType; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.PrimitiveType; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.RoomClass; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.generic.ILanguageExtension; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.util.Pair; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Extension; - -@Singleton -@SuppressWarnings("all") -public class CExtensions implements ILanguageExtension { - @Inject - protected IDiagnostician diagnostician; - - @Inject - @Extension - protected RoomHelpers _roomHelpers; - - @Override - public String getTypedDataDefinition(final EObject msg) { - String _xifexpression = null; - if ((msg instanceof Message)) { - VarDecl _data = ((Message) msg).getData(); - String[] _generateArglistAndTypedData = this.generateArglistAndTypedData(_data); - _xifexpression = _generateArglistAndTypedData[1]; - } else { - _xifexpression = ""; - } - return _xifexpression; - } - - @Override - public String accessLevelPrivate() { - return "static "; - } - - @Override - public String accessLevelProtected() { - return "static "; - } - - @Override - public String accessLevelPublic() { - return ""; - } - - @Override - public String memberAccess() { - return "self->"; - } - - @Override - public String selfPointer(final String classname, final boolean hasArgs) { - String _xifexpression = null; - if (hasArgs) { - _xifexpression = "* self, "; - } else { - _xifexpression = "* self"; - } - return (classname + _xifexpression); - } - - @Override - public String selfPointer(final boolean hasArgs) { - String _xifexpression = null; - if (hasArgs) { - _xifexpression = "self, "; - } else { - _xifexpression = "self"; - } - return _xifexpression; - } - - @Override - public String scopeSeparator() { - return ""; - } - - @Override - public String operationScope(final String classname, final boolean isDeclaration) { - return (classname + "_"); - } - - @Override - public String memberInDeclaration(final String namespace, final String member) { - return ((namespace + "_") + member); - } - - @Override - public String memberInUse(final String namespace, final String member) { - return ((namespace + "_") + member); - } - - /** - * TODO: move specific code elsewhere - */ - public String getCHeaderFileName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + ".h"); - } - - public String getCSourceFileName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + ".c"); - } - - public String getCUtilsFileName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + "_Utils.h"); - } - - public String getInstSourceFileName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + "_Inst.h"); - } - - public String getDispSourceFileName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + "_Disp.h"); - } - - public String getCHeaderFileName(final NodeRef nr, final SubSystemInstance ssi) { - String _name = nr.getName(); - String _plus = (_name + "_"); - String _name_1 = ssi.getName(); - String _plus_1 = (_plus + _name_1); - return (_plus_1 + ".h"); - } - - public String getCSourceFileName(final NodeRef nr, final SubSystemInstance ssi) { - String _name = nr.getName(); - String _plus = (_name + "_"); - String _name_1 = ssi.getName(); - String _plus_1 = (_plus + _name_1); - return (_plus_1 + ".c"); - } - - public String getInstSourceFileName(final NodeRef nr, final SubSystemInstance ssi) { - String _name = nr.getName(); - String _plus = (_name + "_"); - String _name_1 = ssi.getName(); - String _plus_1 = (_plus + _name_1); - return (_plus_1 + "_Inst.h"); - } - - public String getDispSourceFileName(final NodeRef nr, final SubSystemInstance ssi) { - String _name = nr.getName(); - String _plus = (_name + "_"); - String _name_1 = ssi.getName(); - String _plus_1 = (_plus + _name_1); - return (_plus_1 + "_Disp.h"); - } - - public CharSequence getIncludeGuardString(final String filename) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("_"); - String _upperCase = filename.toUpperCase(); - _builder.append(_upperCase, ""); - _builder.append("_H_"); - return _builder; - } - - public CharSequence generateIncludeGuardBegin(final RoomClass rc) { - CharSequence _xblockexpression = null; - { - EObject _eContainer = rc.eContainer(); - String _name = ((RoomModel) _eContainer).getName(); - String _replaceAll = _name.replaceAll("\\.", "_"); - String _plus = (_replaceAll + "_"); - String _name_1 = rc.getName(); - final String filename = (_plus + _name_1); - _xblockexpression = this.generateIncludeGuardBegin(filename); - } - return _xblockexpression; - } - - public CharSequence generateIncludeGuardEnd(final RoomClass rc) { - CharSequence _xblockexpression = null; - { - EObject _eContainer = rc.eContainer(); - String _name = ((RoomModel) _eContainer).getName(); - String _replaceAll = _name.replaceAll("\\.", "_"); - String _plus = (_replaceAll + "_"); - String _name_1 = rc.getName(); - final String filename = (_plus + _name_1); - _xblockexpression = this.generateIncludeGuardEnd(filename); - } - return _xblockexpression; - } - - public CharSequence generateIncludeGuardBegin(final String filename) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#ifndef "); - CharSequence _includeGuardString = this.getIncludeGuardString(filename); - _builder.append(_includeGuardString, ""); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - CharSequence _includeGuardString_1 = this.getIncludeGuardString(filename); - _builder.append(_includeGuardString_1, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public CharSequence generateIncludeGuardEnd(final String filename) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#endif /* "); - CharSequence _includeGuardString = this.getIncludeGuardString(filename); - _builder.append(_includeGuardString, ""); - _builder.append(" */"); - _builder.newLineIfNotEmpty(); - return _builder; - } - - @Override - public boolean usesInheritance() { - return false; - } - - @Override - public boolean usesPointers() { - return true; - } - - @Override - public String genEnumeration(final String name, final List> 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 _hasElements = false; - for(final Pair entry : entries) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - String _first = entry.getFirst(); - _builder.append(_first, "\t"); - _builder.append(" = "); - String _second = entry.getSecond(); - _builder.append(_second, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("};"); - _builder.newLine(); - _xblockexpression = _builder.toString(); - } - return _xblockexpression; - } - - @Override - public String booleanConstant(final boolean b) { - String _xifexpression = null; - if (b) { - _xifexpression = "ET_TRUE"; - } else { - _xifexpression = "ET_FALSE"; - } - return _xifexpression; - } - - @Override - public String pointerLiteral() { - return "*"; - } - - @Override - public String nullPointer() { - return "NULL"; - } - - @Override - public String voidPointer() { - return "void*"; - } - - @Override - public String arrayType(final String type, final int size, final boolean isRef) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append(type, ""); - { - if (isRef) { - _builder.append("*"); - } - } - _builder.newLineIfNotEmpty(); - return _builder.toString(); - } - - @Override - public String arrayDeclaration(final String type, final int size, final boolean isRef, final String name) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append(type, ""); - { - if (isRef) { - _builder.append("*"); - } - } - _builder.append(" "); - _builder.append(name, ""); - _builder.append("["); - _builder.append(size, ""); - _builder.append("]"); - _builder.newLineIfNotEmpty(); - return _builder.toString(); - } - - @Override - public String superCall(final String baseClassName, final String method, final String args) { - return ""; - } - - @Override - public String toValueLiteral(final PrimitiveType type, final String value) { - String _switchResult = null; - String _targetName = type.getTargetName(); - boolean _matched = false; - if ((type.getTargetName().equals("char") && (value.length() == 1))) { - _matched=true; - _switchResult = (("\'" + value) + "\'"); - } - if (!_matched) { - LiteralType _type = type.getType(); - boolean _equals = Objects.equal(_type, LiteralType.CHAR); - if (_equals) { - _matched=true; - _switchResult = (("\"" + value) + "\""); - } - } - if (!_matched) { - if ((value.contains(",") || value.contains("{"))) { - _matched=true; - 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(" }"); - _xblockexpression = _builder.toString(); - } - _switchResult = _xblockexpression; - } - } - if (!_matched) { - if (Objects.equal(_targetName, "boolean")) { - _matched=true; - String _xifexpression = null; - boolean _equals_1 = value.equals("true"); - if (_equals_1) { - _xifexpression = "ET_TRUE"; - } else { - _xifexpression = "ET_FALSE"; - } - _switchResult = _xifexpression; - } - } - if (!_matched) { - _switchResult = value; - } - return _switchResult; - } - - @Override - public String toEnumLiteral(final EnumerationType type, final String value) { - String _xifexpression = null; - if ((value.contains(",") || value.contains("{"))) { - 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 _convertStringEnumLiteral = this.convertStringEnumLiteral(type, _trim_1); - _builder.append(_convertStringEnumLiteral, ""); - } - } - _builder.append(" }"); - _xblockexpression = _builder.toString(); - } - _xifexpression = _xblockexpression; - } else { - _xifexpression = this.convertStringEnumLiteral(type, value); - } - return _xifexpression; - } - - private String convertStringEnumLiteral(final EnumerationType type, final String value) { - String v = value; - String _name = type.getName(); - boolean _startsWith = v.startsWith(_name); - if (_startsWith) { - String _name_1 = type.getName(); - int _length = _name_1.length(); - int _plus = (_length + 1); - String _substring = v.substring(_plus); - v = _substring; - } - EList _literals = type.getLiterals(); - for (final EnumLiteral l : _literals) { - String _name_2 = l.getName(); - boolean _equals = _name_2.equals(v); - if (_equals) { - String _name_3 = type.getName(); - String _plus_1 = (_name_3 + "_"); - String _name_4 = l.getName(); - return (_plus_1 + _name_4); - } - } - return null; - } - - @Override - public String defaultValue(final DataType dt) { - String _switchResult = null; - boolean _matched = false; - if (dt instanceof PrimitiveType) { - _matched=true; - String _defaultValueLiteral = ((PrimitiveType)dt).getDefaultValueLiteral(); - _switchResult = this.toValueLiteral(((PrimitiveType)dt), _defaultValueLiteral); - } - if (!_matched) { - if (dt instanceof EnumerationType) { - _matched=true; - _switchResult = this.getDefaultValue(((EnumerationType)dt)); - } - } - if (!_matched) { - if (dt instanceof ExternalType) { - _matched=true; - String _xblockexpression = null; - { - String _defaultValueLiteral = ((ExternalType)dt).getDefaultValueLiteral(); - boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); - if (_notEquals) { - return ((ExternalType)dt).getDefaultValueLiteral(); - } - String _name = ((ExternalType)dt).getName(); - String _plus = ("external type " + _name); - String _plus_1 = (_plus + "has no default initialization"); - EObject _eContainer = ((ExternalType)dt).eContainer(); - EStructuralFeature _eContainingFeature = ((ExternalType)dt).eContainingFeature(); - this.diagnostician.error(_plus_1, _eContainer, _eContainingFeature); - _xblockexpression = ""; - } - _switchResult = _xblockexpression; - } - } - if (!_matched) { - if (dt instanceof DataClass) { - _matched=true; - StringConcatenation _builder = new StringConcatenation(); - _builder.append("{"); - _builder.newLine(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(((DataClass)dt)); - boolean _hasElements = false; - for(final Attribute att : _allAttributes) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - String _initializationWithDefaultValues = this.initializationWithDefaultValues(att); - _builder.append(_initializationWithDefaultValues, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _builder.newLine(); - _switchResult = _builder.toString(); - } - } - return _switchResult; - } - - public String getDefaultValue(final EnumerationType type) { - String _xifexpression = null; - EList _literals = type.getLiterals(); - boolean _isEmpty = _literals.isEmpty(); - if (_isEmpty) { - _xifexpression = ""; - } else { - EList _literals_1 = type.getLiterals(); - EnumLiteral _get = _literals_1.get(0); - _xifexpression = this.getCastedValue(_get); - } - return _xifexpression; - } - - @Override - public String initializationWithDefaultValues(final DataType dt, final int size) { - String _xblockexpression = null; - { - final String dv = this.defaultValue(dt); - _xblockexpression = this.initializer(dv, size); - } - return _xblockexpression; - } - - private String initializer(final String dv, final int size) { - String _xifexpression = null; - if ((size > 1)) { - String _xblockexpression = null; - { - String res = "{"; - int i = 0; - while ((i < size)) { - { - res = (res + dv); - i = (i + 1); - if ((i < size)) { - res = (res + ","); - } - } - } - _xblockexpression = (res + "}"); - } - _xifexpression = _xblockexpression; - } else { - _xifexpression = dv; - } - return _xifexpression; - } - - public String initializationWithDefaultValues(final Attribute att) { - String _xblockexpression = null; - { - final String dv = att.getDefaultValueLiteral(); - String _xifexpression = null; - boolean _notEquals = (!Objects.equal(dv, null)); - if (_notEquals) { - String _xifexpression_1 = null; - boolean _startsWith = dv.startsWith("{"); - if (_startsWith) { - _xifexpression_1 = dv; - } else { - int _size = att.getSize(); - _xifexpression_1 = this.initializer(dv, _size); - } - _xifexpression = _xifexpression_1; - } else { - String _xifexpression_2 = null; - RefableType _type = att.getType(); - boolean _isRef = _type.isRef(); - if (_isRef) { - int _size_1 = att.getSize(); - _xifexpression_2 = this.initializer("NULL", _size_1); - } else { - RefableType _type_1 = att.getType(); - DataType _type_2 = _type_1.getType(); - int _size_2 = att.getSize(); - _xifexpression_2 = this.initializationWithDefaultValues(_type_2, _size_2); - } - _xifexpression = _xifexpression_2; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - @Override - public String[] generateArglistAndTypedData(final EObject d) { - if ((Objects.equal(d, null) || (!(d instanceof VarDecl)))) { - return ((String[])Conversions.unwrapArray(CollectionLiterals.newArrayList("", "", ""), String.class)); - } - final VarDecl data = ((VarDecl) d); - boolean _equals = Objects.equal(data, null); - if (_equals) { - return ((String[])Conversions.unwrapArray(CollectionLiterals.newArrayList("", "", ""), String.class)); - } - String _xifexpression = null; - RefableType _refType = data.getRefType(); - DataType _type = _refType.getType(); - if ((_type instanceof PrimitiveType)) { - RefableType _refType_1 = data.getRefType(); - DataType _type_1 = _refType_1.getType(); - _xifexpression = ((PrimitiveType) _type_1).getTargetName(); - } else { - String _xifexpression_1 = null; - RefableType _refType_2 = data.getRefType(); - DataType _type_2 = _refType_2.getType(); - if ((_type_2 instanceof EnumerationType)) { - RefableType _refType_3 = data.getRefType(); - DataType _type_3 = _refType_3.getType(); - _xifexpression_1 = this.getTargetType(((EnumerationType) _type_3)); - } else { - String _xifexpression_2 = null; - RefableType _refType_4 = data.getRefType(); - DataType _type_4 = _refType_4.getType(); - if ((_type_4 instanceof ExternalType)) { - RefableType _refType_5 = data.getRefType(); - DataType _type_5 = _refType_5.getType(); - _xifexpression_2 = ((ExternalType) _type_5).getTargetName(); - } else { - RefableType _refType_6 = data.getRefType(); - DataType _type_6 = _refType_6.getType(); - _xifexpression_2 = _type_6.getName(); - } - _xifexpression_1 = _xifexpression_2; - } - _xifexpression = _xifexpression_1; - } - String typeName = _xifexpression; - String _xifexpression_3 = null; - RefableType _refType_7 = data.getRefType(); - DataType _type_7 = _refType_7.getType(); - if ((_type_7 instanceof PrimitiveType)) { - String _xblockexpression = null; - { - RefableType _refType_8 = data.getRefType(); - DataType _type_8 = _refType_8.getType(); - final String ct = ((PrimitiveType) _type_8).getCastName(); - String _xifexpression_4 = null; - if (((!Objects.equal(ct, null)) && (!ct.isEmpty()))) { - _xifexpression_4 = ct; - } else { - _xifexpression_4 = typeName; - } - _xblockexpression = _xifexpression_4; - } - _xifexpression_3 = _xblockexpression; - } else { - String _xifexpression_4 = null; - RefableType _refType_8 = data.getRefType(); - DataType _type_8 = _refType_8.getType(); - if ((_type_8 instanceof EnumerationType)) { - RefableType _refType_9 = data.getRefType(); - DataType _type_9 = _refType_9.getType(); - _xifexpression_4 = this.getCastType(((EnumerationType) _type_9)); - } else { - _xifexpression_4 = typeName; - } - _xifexpression_3 = _xifexpression_4; - } - String castTypeName = _xifexpression_3; - castTypeName = (castTypeName + "*"); - String deRef = "*"; - RefableType _refType_10 = data.getRefType(); - final boolean isRef = _refType_10.isRef(); - final boolean isPrim = ((data.getRefType().getType() instanceof PrimitiveType) || (data.getRefType().getType() instanceof EnumerationType)); - if (isRef) { - typeName = (typeName + "*"); - castTypeName = (castTypeName + "*"); - } else { - if ((!isPrim)) { - typeName = (typeName + "*"); - deRef = ""; - } - } - String _name = data.getName(); - String _plus = ((typeName + " ") + _name); - String _plus_1 = (_plus + " = "); - String _plus_2 = (_plus_1 + deRef); - String _plus_3 = (_plus_2 + "(("); - String _plus_4 = (_plus_3 + castTypeName); - final String typedData = (_plus_4 + ") generic_data__et);\n"); - String _name_1 = data.getName(); - final String dataArg = (", " + _name_1); - String _name_2 = data.getName(); - final String typedArgList = (((", " + typeName) + " ") + _name_2); - return ((String[])Conversions.unwrapArray(CollectionLiterals.newArrayList(dataArg, typedData, typedArgList), String.class)); - } - - public String getIncludePath(final RoomClass rc) { - EObject _eContainer = rc.eContainer(); - String _name = ((RoomModel) _eContainer).getName(); - String _replaceAll = _name.replaceAll("\\.", "/"); - String _plus = ("\"" + _replaceAll); - String _plus_1 = (_plus + "/"); - String _cHeaderFileName = this.getCHeaderFileName(rc); - String _plus_2 = (_plus_1 + _cHeaderFileName); - return (_plus_2 + "\""); - } - - public String getUtilsIncludePath(final RoomClass rc) { - EObject _eContainer = rc.eContainer(); - String _name = ((RoomModel) _eContainer).getName(); - String _replaceAll = _name.replaceAll("\\.", "/"); - String _plus = ("\"" + _replaceAll); - String _plus_1 = (_plus + "/"); - String _cUtilsFileName = this.getCUtilsFileName(rc); - String _plus_2 = (_plus_1 + _cUtilsFileName); - return (_plus_2 + "\""); - } - - @Override - public String getTargetType(final EnumerationType type) { - String _xifexpression = null; - PrimitiveType _primitiveType = type.getPrimitiveType(); - boolean _notEquals = (!Objects.equal(_primitiveType, null)); - if (_notEquals) { - PrimitiveType _primitiveType_1 = type.getPrimitiveType(); - _xifexpression = _primitiveType_1.getTargetName(); - } else { - _xifexpression = type.getName(); - } - return _xifexpression; - } - - @Override - public String getCastedValue(final EnumLiteral literal) { - String _xblockexpression = null; - { - EObject _eContainer = literal.eContainer(); - final EnumerationType type = ((EnumerationType) _eContainer); - final String cast = this.getTargetType(type); - String _xifexpression = null; - PrimitiveType _primitiveType = type.getPrimitiveType(); - boolean _equals = Objects.equal(_primitiveType, null); - if (_equals) { - long _literalValue = literal.getLiteralValue(); - _xifexpression = Long.toString(_literalValue); - } else { - long _literalValue_1 = literal.getLiteralValue(); - String _string = Long.toString(_literalValue_1); - String _plus = ((("((" + cast) + ")") + _string); - _xifexpression = (_plus + ")"); - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - @Override - public String getCastType(final EnumerationType type) { - String _xifexpression = null; - PrimitiveType _primitiveType = type.getPrimitiveType(); - boolean _notEquals = (!Objects.equal(_primitiveType, null)); - if (_notEquals) { - PrimitiveType _primitiveType_1 = type.getPrimitiveType(); - _xifexpression = _primitiveType_1.getCastName(); - } else { - _xifexpression = type.getName(); - } - return _xifexpression; - } - - @Override - public String makeOverridable() { - return ""; - } -} diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java deleted file mode 100644 index 8f77c7b74..000000000 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java +++ /dev/null @@ -1,398 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Thomas Schuetz (changed for C code generator) - */ -package org.eclipse.etrice.generator.c.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.Operation; -import org.eclipse.etrice.core.room.RoomModel; -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.c.gen.CExtensions; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; - -@Singleton -@SuppressWarnings("all") -public class DataClassGen { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - @Extension - private CExtensions _cExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private ProcedureHelpers _procedureHelpers; - - @Inject - private ILogger logger; - - public void doGenerate(final Root root) { - EList _dataClasses = root.getDataClasses(); - for (final DataClass dc : _dataClasses) { - { - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(dc); - String _path = this._roomExtensions.getPath(dc); - final String path = (_generationTargetPath + _path); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(dc); - String _path_1 = this._roomExtensions.getPath(dc); - final String infopath = (_generationInfoPath + _path_1); - String file = this._cExtensions.getCHeaderFileName(dc); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, dc); - this.fileIO.generateFile("generating DataClass header", path, infopath, file, _generateHeaderFile); - String _cUtilsFileName = this._cExtensions.getCUtilsFileName(dc); - file = _cUtilsFileName; - CharSequence _generateUtilsFile = this.generateUtilsFile(root, dc); - this.fileIO.generateFile("generating ProtocolClass utils", path, infopath, file, _generateUtilsFile); - String _cSourceFileName = this._cExtensions.getCSourceFileName(dc); - file = _cSourceFileName; - CharSequence _generateSourceFile = this.generateSourceFile(root, dc); - this.fileIO.generateFile("generating DataClass header", path, infopath, file, _generateSourceFile); - } - } - } - - public CharSequence generateHeaderFile(final Root root, final DataClass dc) { - 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 DataClass "); - String _name = dc.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* "); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(dc); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"etDatatypes.h\""); - _builder.newLine(); - _builder.newLine(); - { - EList _referencedDataClasses = root.getReferencedDataClasses(dc); - for(final DataClass dataClass : _referencedDataClasses) { - _builder.append("#include "); - String _includePath = this._cExtensions.getIncludePath(dataClass); - _builder.append(_includePath, ""); - _builder.newLineIfNotEmpty(); - } - } - { - EList _referencedEnumClasses = root.getReferencedEnumClasses(dc); - for(final EnumerationType enumClass : _referencedEnumClasses) { - _builder.append("#include "); - String _includePath_1 = this._cExtensions.getIncludePath(enumClass); - _builder.append(_includePath_1, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(dc, 1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("typedef struct {"); - _builder.newLine(); - _builder.append("\t"); - List _allAttributes = this._roomHelpers.getAllAttributes(dc); - CharSequence _attributes = this._procedureHelpers.attributes(_allAttributes); - _builder.append(_attributes, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("} "); - String _name_1 = dc.getName(); - _builder.append(_name_1, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - List _allAttributes_1 = this._roomHelpers.getAllAttributes(dc); - for(final Attribute a : _allAttributes_1) { - { - String _defaultValueLiteral = a.getDefaultValueLiteral(); - boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); - if (_notEquals) { - String _name_2 = dc.getName(); - String _plus = (_name_2 + " "); - String _name_3 = a.getName(); - String _plus_1 = (_plus + _name_3); - String _plus_2 = (_plus_1 + ": Attribute initialization not supported in C"); - this.logger.logInfo(_plus_2); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.newLine(); - EList _operations = dc.getOperations(); - String _name_4 = dc.getName(); - CharSequence _operationsDeclaration = this._procedureHelpers.operationsDeclaration(_operations, _name_4); - _builder.append(_operationsDeclaration, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* deep copy */"); - _builder.newLine(); - _builder.append("void "); - String _name_5 = dc.getName(); - _builder.append(_name_5, ""); - _builder.append("_deepCopy("); - String _name_6 = dc.getName(); - _builder.append(_name_6, ""); - _builder.append("* source, "); - String _name_7 = dc.getName(); - _builder.append(_name_7, ""); - _builder.append("* target);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _userCode_1 = this._procedureHelpers.userCode(dc, 2); - _builder.append(_userCode_1, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(dc); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - return _builder; - } - - private CharSequence generateUtilsFile(final Root root, final DataClass dc) { - CharSequence _xblockexpression = null; - { - EObject _eContainer = dc.eContainer(); - String _name = ((RoomModel) _eContainer).getName(); - String _replaceAll = _name.replaceAll("\\.", "_"); - String _plus = (_replaceAll + "_"); - String _name_1 = dc.getName(); - String _plus_1 = (_plus + _name_1); - final String filename = (_plus_1 + "_Utils"); - 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("* Utils File of DataClass "); - String _name_2 = dc.getName(); - _builder.append(_name_2, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* "); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(filename); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include "); - String _includePath = this._cExtensions.getIncludePath(dc); - _builder.append(_includePath, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* access macros for operations and attributes"); - _builder.newLine(); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("/* operations */"); - _builder.newLine(); - { - List _allOperations = this._roomHelpers.getAllOperations(dc); - for(final StandardOperation op : _allOperations) { - final CharSequence args = this.argList(op); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name_3 = op.getName(); - _builder.append(_name_3, ""); - _builder.append("("); - _builder.append(args, ""); - _builder.append(") "); - String _name_4 = dc.getName(); - _builder.append(_name_4, ""); - _builder.append("_"); - String _name_5 = op.getName(); - _builder.append(_name_5, ""); - _builder.append("(self"); - { - EList _arguments = op.getArguments(); - boolean _isEmpty = _arguments.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append(", "); - _builder.append(args, ""); - } - } - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* attributes */"); - _builder.newLine(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(dc); - for(final Attribute a : _allAttributes) { - _builder.append("#define "); - String _name_6 = a.getName(); - _builder.append(_name_6, ""); - _builder.append(" (self->"); - String _name_7 = a.getName(); - _builder.append(_name_7, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(filename); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence argList(final Operation op) { - StringConcatenation _builder = new StringConcatenation(); - { - EList _arguments = op.getArguments(); - boolean _hasElements = false; - for(final VarDecl a : _arguments) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - String _name = a.getName(); - _builder.append(_name, ""); - } - } - return _builder; - } - - public CharSequence generateSourceFile(final Root root, final DataClass dc) { - 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 DataClass "); - String _name = dc.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* "); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include "); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \""); - String _cHeaderFileName = this._cExtensions.getCHeaderFileName(dc); - _builder.append(_cHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.append("#include \""); - String _cUtilsFileName = this._cExtensions.getCUtilsFileName(dc); - _builder.append(_cUtilsFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(dc, 3); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.newLine(); - EList _operations = dc.getOperations(); - String _name_1 = dc.getName(); - CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, _name_1); - _builder.append(_operationsImplementation, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("void "); - String _name_2 = dc.getName(); - _builder.append(_name_2, ""); - _builder.append("_deepCopy("); - String _name_3 = dc.getName(); - _builder.append(_name_3, ""); - _builder.append("* source, "); - String _name_4 = dc.getName(); - _builder.append(_name_4, ""); - _builder.append("* target) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("memcpy(target, source, sizeof("); - String _name_5 = dc.getName(); - _builder.append(_name_5, "\t"); - _builder.append("));"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.newLine(); - return _builder; - } -} diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/EnumerationTypeGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/EnumerationTypeGen.java deleted file mode 100644 index c6f516f7f..000000000 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/EnumerationTypeGen.java +++ /dev/null @@ -1,234 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.c.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.room.EnumLiteral; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.PrimitiveType; -import org.eclipse.etrice.generator.c.gen.CExtensions; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.generic.TypeHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; - -/** - * @author Henrik Rentz-Reichert - */ -@SuppressWarnings("all") -public class EnumerationTypeGen { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private CExtensions _cExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private TypeHelpers _typeHelpers; - - public void doGenerate(final Root root) { - EList _enumClasses = root.getEnumClasses(); - for (final EnumerationType et : _enumClasses) { - { - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(et); - String _path = this._roomExtensions.getPath(et); - final String path = (_generationTargetPath + _path); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(et); - String _path_1 = this._roomExtensions.getPath(et); - final String infopath = (_generationInfoPath + _path_1); - String file = this._cExtensions.getCHeaderFileName(et); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, et); - this.fileIO.generateFile("generating Enumeration header", path, infopath, file, _generateHeaderFile); - String _cSourceFileName = this._cExtensions.getCSourceFileName(et); - file = _cSourceFileName; - CharSequence _generateSourceFile = this.generateSourceFile(root, et); - this.fileIO.generateFile("generating Enumeration source", path, infopath, file, _generateSourceFile); - } - } - } - - private CharSequence generateHeaderFile(final Root root, final EnumerationType et) { - 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 Enumeration "); - String _name = et.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* "); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(et); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"etDatatypes.h\""); - _builder.newLine(); - _builder.newLine(); - { - PrimitiveType _primitiveType = et.getPrimitiveType(); - boolean _notEquals = (!Objects.equal(_primitiveType, null)); - if (_notEquals) { - { - EList _literals = et.getLiterals(); - for(final EnumLiteral lit : _literals) { - _builder.append("#define "); - String _name_1 = et.getName(); - _builder.append(_name_1, ""); - _builder.append("_"); - String _name_2 = lit.getName(); - _builder.append(_name_2, ""); - _builder.append(" "); - String _castedValue = this._cExtensions.getCastedValue(lit); - _builder.append(_castedValue, ""); - _builder.newLineIfNotEmpty(); - } - } - } else { - _builder.append("typedef enum "); - String _name_3 = et.getName(); - _builder.append(_name_3, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - { - EList _literals_1 = et.getLiterals(); - boolean _hasElements = false; - for(final EnumLiteral lit_1 : _literals_1) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - String _name_4 = et.getName(); - _builder.append(_name_4, "\t"); - _builder.append("_"); - String _name_5 = lit_1.getName(); - _builder.append(_name_5, "\t"); - _builder.append(" = "); - long _literalValue = lit_1.getLiteralValue(); - _builder.append(_literalValue, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _builder.newLine(); - String _name_6 = et.getName(); - _builder.append(_name_6, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("const char* "); - String _name_7 = et.getName(); - _builder.append(_name_7, ""); - _builder.append("_getLiteralName("); - String _typeName = this._typeHelpers.typeName(et); - _builder.append(_typeName, ""); - _builder.append(" literal);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(et); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - private CharSequence generateSourceFile(final Root root, final EnumerationType et) { - 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 = et.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._cExtensions.getCHeaderFileName(et); - _builder.append(_cHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("const char* "); - String _name_1 = et.getName(); - _builder.append(_name_1, ""); - _builder.append("_getLiteralName("); - String _typeName = this._typeHelpers.typeName(et); - _builder.append(_typeName, ""); - _builder.append(" literal) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("switch(literal) {"); - _builder.newLine(); - { - EList _literals = et.getLiterals(); - for(final EnumLiteral lit : _literals) { - _builder.append("\t\t"); - _builder.append("case "); - String _name_2 = et.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append("_"); - String _name_3 = lit.getName(); - _builder.append(_name_3, "\t\t"); - _builder.append(": return \""); - String _name_4 = lit.getName(); - _builder.append(_name_4, "\t\t"); - _builder.append("\";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("return NULL;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - return _builder; - } -} 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 deleted file mode 100644 index 95373640f..000000000 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java +++ /dev/null @@ -1,308 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.generator.c.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase; -import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.ExternalType; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.PortClass; -import org.eclipse.etrice.core.room.PrimitiveType; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.c.gen.CExtensions; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.generic.TypeHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.IntegerRange; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@SuppressWarnings("all") -public class Initialization { - @Inject - private CExtensions languageExt; - - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private TypeHelpers _typeHelpers; - - public CharSequence generateAttributeInit(final InstanceBase instance, final List attributes) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _hasElements = false; - for(final Attribute a : attributes) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", ""); - } - ArrayList _arrayList = new ArrayList(); - List _union = this._roomExtensions.union(_arrayList, a); - String _initAttributeArray = this.initAttributeArray(instance, _union); - _builder.append(_initAttributeArray, ""); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - private String initAttributeArray(final InstanceBase instance, final List path) { - String _xblockexpression = null; - { - Attribute a = IterableExtensions.last(path); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\t\t"); - _builder.append("/* "); - String _name = a.getName(); - _builder.append(_name, "\t\t"); - { - int _size = a.getSize(); - boolean _greaterThan = (_size > 1); - if (_greaterThan) { - _builder.append("["); - int _size_1 = a.getSize(); - _builder.append(_size_1, "\t\t"); - _builder.append("]"); - } - } - _builder.append(" */"); - String COMMENT = _builder.toString(); - String _xifexpression = null; - if (((a.getSize() == 0) || ((!a.getType().isRef()) && this._typeHelpers.isEnumerationOrPrimitive(a.getType().getType())))) { - CharSequence _initAttribute = this.initAttribute(instance, path); - _xifexpression = (_initAttribute + COMMENT); - } else { - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("{ "); - { - int _size_2 = a.getSize(); - IntegerRange _upTo = new IntegerRange(1, _size_2); - boolean _hasElements = false; - for(final Integer i : _upTo) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder_1.appendImmediate(", ", ""); - } - CharSequence _initAttribute_1 = this.initAttribute(instance, path); - _builder_1.append(_initAttribute_1, ""); - } - } - _builder_1.append(" } "); - _builder_1.append(COMMENT, ""); - _builder_1.newLineIfNotEmpty(); - _xifexpression = _builder_1.toString(); - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - private CharSequence initAttribute(final InstanceBase instance, final List path) { - CharSequence _xblockexpression = null; - { - Attribute a = IterableExtensions.last(path); - RefableType _type = a.getType(); - DataType aType = _type.getType(); - RefableType _type_1 = a.getType(); - boolean _isRef = _type_1.isRef(); - if (_isRef) { - String _xifexpression = null; - String _defaultValueLiteral = a.getDefaultValueLiteral(); - boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); - if (_notEquals) { - _xifexpression = a.getDefaultValueLiteral(); - } else { - _xifexpression = this.languageExt.nullPointer(); - } - return _xifexpression; - } - CharSequence _switchResult = null; - boolean _matched = false; - if (aType instanceof DataClass) { - _matched=true; - StringConcatenation _builder = new StringConcatenation(); - _builder.append("{"); - _builder.newLine(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType)); - boolean _hasElements = false; - for(final Attribute subA : _allAttributes) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - List _union = this._roomExtensions.union(path, subA); - String _initAttributeArray = this.initAttributeArray(instance, _union); - _builder.append(_initAttributeArray, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _switchResult = _builder; - } - if (!_matched) { - if (aType instanceof ExternalType) { - _matched=true; - String _xifexpression_1 = null; - String _defaultValueLiteral_1 = a.getDefaultValueLiteral(); - boolean _notEquals_1 = (!Objects.equal(_defaultValueLiteral_1, null)); - if (_notEquals_1) { - _xifexpression_1 = a.getDefaultValueLiteral(); - } else { - _xifexpression_1 = this.languageExt.defaultValue(aType); - } - _switchResult = _xifexpression_1; - } - } - if (!_matched) { - if (aType instanceof PrimitiveType) { - _matched=true; - CharSequence _xblockexpression_1 = null; - { - String value = this.getPrimitiveValue(instance, path); - CharSequence _xifexpression_1 = null; - if ((((a.getSize() > 0) && (!this._typeHelpers.isCharacterType(((PrimitiveType)aType)))) && (!value.trim().startsWith("{")))) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("{"); - { - int _size = a.getSize(); - IntegerRange _upTo = new IntegerRange(1, _size); - boolean _hasElements = false; - for(final Integer i : _upTo) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - _builder.append(value, ""); - } - } - _builder.append("}"); - _xifexpression_1 = _builder; - } else { - String _xifexpression_2 = null; - if ((((a.getSize() > 0) && this._typeHelpers.isCharacterType(((PrimitiveType)aType))) && value.startsWith("\'"))) { - _xifexpression_2 = (("{" + value) + "}"); - } else { - _xifexpression_2 = value; - } - _xifexpression_1 = _xifexpression_2; - } - _xblockexpression_1 = _xifexpression_1; - } - _switchResult = _xblockexpression_1; - } - } - if (!_matched) { - if (aType instanceof EnumerationType) { - _matched=true; - CharSequence _xblockexpression_1 = null; - { - String value = this.getPrimitiveValue(instance, path); - CharSequence _xifexpression_1 = null; - if (((a.getSize() > 0) && (!value.trim().startsWith("{")))) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("{"); - { - int _size = a.getSize(); - IntegerRange _upTo = new IntegerRange(1, _size); - boolean _hasElements = false; - for(final Integer i : _upTo) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - _builder.append(value, ""); - } - } - _builder.append("}"); - _xifexpression_1 = _builder; - } else { - _xifexpression_1 = value; - } - _xblockexpression_1 = _xifexpression_1; - } - _switchResult = _xblockexpression_1; - } - } - _xblockexpression = _switchResult; - } - return _xblockexpression; - } - - private String getPrimitiveValue(final InstanceBase instance, final List path) { - String value = this._typeHelpers.getAttrInstanceConfigValue(path, instance); - boolean _equals = Objects.equal(value, null); - if (_equals) { - String _switchResult = null; - boolean _matched = false; - if (instance instanceof ActorInstance) { - _matched=true; - ActorClass _actorClass = ((ActorInstance)instance).getActorClass(); - _switchResult = this._typeHelpers.getAttrClassConfigValue(path, _actorClass, true); - } - if (!_matched) { - if (instance instanceof InterfaceItemInstance) { - _matched=true; - InterfaceItem _interfaceItem = ((InterfaceItemInstance)instance).getInterfaceItem(); - PortClass _portClass = this._roomHelpers.getPortClass(_interfaceItem); - _switchResult = this._typeHelpers.getAttrClassConfigValue(path, _portClass); - } - } - value = _switchResult; - } - boolean _equals_1 = Objects.equal(value, null); - if (_equals_1) { - Attribute _last = IterableExtensions.last(path); - String _defaultValueLiteral = _last.getDefaultValueLiteral(); - value = _defaultValueLiteral; - } - Attribute _last_1 = IterableExtensions.last(path); - RefableType _type = _last_1.getType(); - DataType type = _type.getType(); - String _xifexpression = null; - if (((!Objects.equal(value, null)) && this._typeHelpers.isPrimitive(type))) { - _xifexpression = this.languageExt.toValueLiteral(((PrimitiveType) type), value); - } else { - String _xifexpression_1 = null; - if (((!Objects.equal(value, null)) && this._typeHelpers.isEnumeration(type))) { - _xifexpression_1 = this.languageExt.toEnumLiteral(((EnumerationType) type), value); - } else { - _xifexpression_1 = this.languageExt.defaultValue(type); - } - _xifexpression = _xifexpression_1; - } - return _xifexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java deleted file mode 100644 index 062ba12a4..000000000 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Thomas Schuetz (changed for C code generator) - */ -package org.eclipse.etrice.generator.c.gen; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.generator.c.gen.ActorClassGen; -import org.eclipse.etrice.generator.c.gen.DataClassGen; -import org.eclipse.etrice.generator.c.gen.EnumerationTypeGen; -import org.eclipse.etrice.generator.c.gen.NodeGen; -import org.eclipse.etrice.generator.c.gen.NodeRunnerGen; -import org.eclipse.etrice.generator.c.gen.ProtocolClassGen; -import org.eclipse.etrice.generator.generic.PrepareFileSystem; - -@Singleton -@SuppressWarnings("all") -public class MainGen { - @Inject - private DataClassGen dataClassGen; - - @Inject - private EnumerationTypeGen enumClassGen; - - @Inject - private ProtocolClassGen protocolClassGen; - - @Inject - private ActorClassGen actorClassGen; - - @Inject - private NodeGen nodeGen; - - @Inject - private NodeRunnerGen nodeRunnerGen; - - @Inject - private PrepareFileSystem prepFS; - - public void doGenerate(final Resource resource) { - this.prepFS.prepareCodeTargetPaths(resource); - EList _contents = resource.getContents(); - for (final EObject e : _contents) { - if ((e instanceof Root)) { - this.doGenerate(((Root) e)); - } - } - } - - public void doGenerate(final Root e) { - this.dataClassGen.doGenerate(e); - this.enumClassGen.doGenerate(e); - this.protocolClassGen.doGenerate(e); - this.actorClassGen.doGenerate(e); - this.nodeGen.doGenerate(e); - boolean _isLibrary = e.isLibrary(); - boolean _not = (!_isLibrary); - if (_not) { - this.nodeRunnerGen.doGenerate(e); - } - } -} diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java deleted file mode 100644 index 893f29e41..000000000 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java +++ /dev/null @@ -1,2751 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Thomas Schuetz (changed for C code generator) - */ -package org.eclipse.etrice.generator.c.gen; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.etrice.core.common.base.Annotation; -import org.eclipse.etrice.core.common.base.LiteralType; -import org.eclipse.etrice.core.common.converter.TimeConverter; -import org.eclipse.etrice.core.etmap.util.ETMapUtil; -import org.eclipse.etrice.core.etphys.eTPhys.ExecMode; -import org.eclipse.etrice.core.etphys.eTPhys.NodeClass; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread; -import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass; -import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance; -import org.eclipse.etrice.core.genmodel.etricegen.PortInstance; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.IDiagnostician; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.CommunicationType; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.GeneralProtocolClass; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.MessageHandler; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.PortClass; -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.SAP; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; -import org.eclipse.etrice.generator.c.Main; -import org.eclipse.etrice.generator.c.gen.CExtensions; -import org.eclipse.etrice.generator.c.gen.Initialization; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.fsm.base.IntelligentSeparator; -import org.eclipse.etrice.generator.generic.ILanguageExtension; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.generic.TypeHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IntegerRange; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@Singleton -@SuppressWarnings("all") -public class NodeGen { - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - @Extension - private CExtensions _cExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private TypeHelpers _typeHelpers; - - @Inject - @Extension - private ProcedureHelpers helpers; - - @Inject - private IGeneratorFileIo fileIO; - - @Inject - private Initialization attrInitGenAddon; - - @Inject - private ILanguageExtension languageExt; - - @Inject - private IDiagnostician diagnostician; - - @Inject - private ILogger logger; - - public void doGenerate(final Root root) { - Collection _nodeRefs = ETMapUtil.getNodeRefs(); - for (final NodeRef nr : _nodeRefs) { - List _subSystemInstancePaths = ETMapUtil.getSubSystemInstancePaths(nr); - for (final String instpath : _subSystemInstancePaths) { - { - StructureInstance _instance = root.getInstance(instpath); - final SubSystemInstance ssi = ((SubSystemInstance) _instance); - boolean _notEquals = (!Objects.equal(ssi, null)); - if (_notEquals) { - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass); - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - String _path = this._roomExtensions.getPath(_subSystemClass_1); - final String filepath = (_generationTargetPath + _path); - SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_subSystemClass_2); - SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - String _path_1 = this._roomExtensions.getPath(_subSystemClass_3); - final String infopath = (_generationInfoPath + _path_1); - String file = this._cExtensions.getCHeaderFileName(nr, ssi); - this.checkDataPorts(ssi); - final Set usedThreads = ETMapUtil.getUsedThreads(nr, ssi); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, ssi); - this.fileIO.generateFile("generating Node declaration", filepath, infopath, file, _generateHeaderFile); - String _cSourceFileName = this._cExtensions.getCSourceFileName(nr, ssi); - file = _cSourceFileName; - CharSequence _generateSourceFile = this.generateSourceFile(root, ssi, usedThreads); - this.fileIO.generateFile("generating Node implementation", filepath, infopath, file, _generateSourceFile); - String _instSourceFileName = this._cExtensions.getInstSourceFileName(nr, ssi); - file = _instSourceFileName; - CharSequence _generateInstanceFile = this.generateInstanceFile(root, ssi, usedThreads); - this.fileIO.generateFile("generating Node instance file", filepath, infopath, file, _generateInstanceFile); - String _dispSourceFileName = this._cExtensions.getDispSourceFileName(nr, ssi); - file = _dispSourceFileName; - CharSequence _generateDispatcherFile = this.generateDispatcherFile(root, ssi, usedThreads); - this.fileIO.generateFile("generating Node dispatcher file", filepath, infopath, file, _generateDispatcherFile); - } - } - } - } - } - - private CharSequence generateHeaderFile(final Root root, final SubSystemInstance ssi) { - CharSequence _xblockexpression = null; - { - final NodeRef nr = ETMapUtil.getNodeRef(ssi); - final SubSystemClass ssc = ssi.getSubSystemClass(); - String _name = nr.getName(); - String _plus = (_name + "_"); - String _name_1 = ssi.getName(); - final String clsname = (_plus + _name_1); - 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 Node "); - String _name_2 = nr.getName(); - _builder.append(_name_2, " "); - _builder.append(" with SubSystem "); - String _name_3 = ssi.getName(); - _builder.append(_name_3, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(clsname); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"etDatatypes.h\""); - _builder.newLine(); - _builder.newLine(); - DetailCode _userCode1 = ssc.getUserCode1(); - CharSequence _userCode = this.helpers.userCode(_userCode1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.newLine(); - _builder.append("/* lifecycle functions"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* init -> start -> run (loop) -> stop -> destroy"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_init(void);\t\t/* lifecycle init \t */"); - _builder.newLineIfNotEmpty(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_start(void);\t/* lifecycle start \t */"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_run(etBool runAsTest);\t\t/* lifecycle run \t */"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_stop(void); \t/* lifecycle stop\t */"); - _builder.newLineIfNotEmpty(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_destroy(void); \t/* lifecycle destroy */"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_shutdown(void); /* shutdown the dispatcher loop */"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - DetailCode _userCode2 = ssc.getUserCode2(); - CharSequence _userCode_1 = this.helpers.userCode(_userCode2); - _builder.append(_userCode_1, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(clsname); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence generateSourceFile(final Root root, final SubSystemInstance ssi, final Collection usedThreads) { - CharSequence _xblockexpression = null; - { - final NodeRef nr = ETMapUtil.getNodeRef(ssi); - final SubSystemClass ssc = ssi.getSubSystemClass(); - String _name = nr.getName(); - String _plus = (_name + "_"); - String _name_1 = ssi.getName(); - final String clsname = (_plus + _name_1); - NodeClass _type = nr.getType(); - EList _threads = _type.getThreads(); - final Function1 _function = (PhysicalThread t) -> { - return Boolean.valueOf(usedThreads.contains(t)); - }; - final Iterable threads = IterableExtensions.filter(_threads, _function); - final boolean logData = (Main.getSettings().isGenerateDataInstrumentation() && this._roomHelpers.isAnnotationPresent(ssc.getAnnotations(), "DataLogging")); - 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 Node "); - String _name_2 = nr.getName(); - _builder.append(_name_2, " "); - _builder.append(" with SubSystem "); - String _name_3 = ssi.getName(); - _builder.append(_name_3, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include "); - _builder.newLine(); - _builder.append("#include "); - _builder.newLine(); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \""); - String _cHeaderFileName = this._cExtensions.getCHeaderFileName(nr, ssi); - _builder.append(_cHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"debugging/etLogger.h\""); - _builder.newLine(); - _builder.append("#include \"debugging/etMSCLogger.h\""); - _builder.newLine(); - _builder.append("#include \"debugging/etDataLogger.h\""); - _builder.newLine(); - _builder.append("#include \"messaging/etSystemProtocol.h\""); - _builder.newLine(); - _builder.append("#include \"osal/etTimer.h\""); - _builder.newLine(); - _builder.append("#include \"osal/etSema.h\""); - _builder.newLine(); - _builder.append("#include \"runtime/etRuntime.h\""); - _builder.newLine(); - _builder.append("#include \"etRuntimeConfig.h\""); - _builder.newLine(); - _builder.newLine(); - DetailCode _userCode3 = ssc.getUserCode3(); - CharSequence _userCode = this.helpers.userCode(_userCode3); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* data for Node "); - String _name_4 = nr.getName(); - _builder.append(_name_4, ""); - _builder.append(" with SubSystem "); - String _name_5 = ssi.getName(); - _builder.append(_name_5, ""); - _builder.append(" */"); - _builder.newLineIfNotEmpty(); - _builder.append("typedef struct "); - _builder.append(clsname, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("char *name;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("volatile int shutdownRequest;"); - _builder.newLine(); - _builder.append("} "); - _builder.append(clsname, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("static "); - _builder.append(clsname, ""); - _builder.append(" "); - _builder.append(clsname, ""); - _builder.append("Inst = {\""); - _builder.append(clsname, ""); - _builder.append("\", 0};"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("static void "); - _builder.append(clsname, ""); - _builder.append("_initActorInstances(void);"); - _builder.newLineIfNotEmpty(); - _builder.append("static void "); - _builder.append(clsname, ""); - _builder.append("_constructActorInstances(void);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* include instances for all classes */"); - _builder.newLine(); - _builder.append("#include \""); - String _instSourceFileName = this._cExtensions.getInstSourceFileName(nr, ssi); - _builder.append(_instSourceFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.append("#include \""); - String _dispSourceFileName = this._cExtensions.getDispSourceFileName(nr, ssi); - _builder.append(_dispSourceFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("static void "); - _builder.append(clsname, ""); - _builder.append("_initMessageServices(void) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"initMessageServices\")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("etTime interval;"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("/* initialization of all message services */"); - _builder.newLine(); - { - final Function1 _function_1 = (PhysicalThread it) -> { - long _prio = it.getPrio(); - return Long.valueOf((-_prio)); - }; - List _sortBy = IterableExtensions.sortBy(threads, _function_1); - for(final PhysicalThread thread : _sortBy) { - { - if ((Objects.equal(thread.getExecmode(), ExecMode.POLLED) || Objects.equal(thread.getExecmode(), ExecMode.MIXED))) { - _builder.append("\t\t"); - _builder.append("interval.sec = "); - long _time = thread.getTime(); - long _split = TimeConverter.split(_time, TimeConverter.SEC, true); - _builder.append(_split, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("interval.nSec = "); - long _time_1 = thread.getTime(); - long _split_1 = TimeConverter.split(_time_1, TimeConverter.MILLI_SEC, false); - _builder.append(_split_1, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("etMessageService_init("); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("&msgService_"); - String _name_6 = thread.getName(); - _builder.append(_name_6, "\t\t\t"); - _builder.append(","); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("msgBuffer_"); - String _name_7 = thread.getName(); - _builder.append(_name_7, "\t\t\t"); - _builder.append(","); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - String _name_8 = thread.getName(); - String _upperCase = _name_8.toUpperCase(); - _builder.append(_upperCase, "\t\t\t"); - _builder.append("_POOL_SIZE,"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - String _name_9 = thread.getName(); - String _upperCase_1 = _name_9.toUpperCase(); - _builder.append(_upperCase_1, "\t\t\t"); - _builder.append("_BLOCK_SIZE,"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - int _stacksize = thread.getStacksize(); - _builder.append(_stacksize, "\t\t\t"); - _builder.append(","); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - long _prio = thread.getPrio(); - _builder.append(_prio, "\t\t\t"); - _builder.append(","); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("interval,"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("MsgDispatcher_"); - String _name_10 = thread.getName(); - _builder.append(_name_10, "\t\t\t"); - _builder.append("_receiveMessage,"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("EXECMODE_"); - ExecMode _execmode = thread.getExecmode(); - String _string = _execmode.toString(); - String _upperCase_2 = _string.toUpperCase(); - _builder.append(_upperCase_2, "\t\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("static void "); - _builder.append(clsname, ""); - _builder.append("_startMessageServices(void) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"startMessageServices\")"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - final Function1 _function_2 = (PhysicalThread it) -> { - long _prio_1 = it.getPrio(); - return Long.valueOf((-_prio_1)); - }; - List _sortBy_1 = IterableExtensions.sortBy(threads, _function_2); - for(final PhysicalThread thread_1 : _sortBy_1) { - _builder.append("\t"); - _builder.append("etMessageService_start(&msgService_"); - String _name_11 = thread_1.getName(); - _builder.append(_name_11, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("static void "); - _builder.append(clsname, ""); - _builder.append("_stopMessageServices(void) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"stopMessageServices\")"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - for(final PhysicalThread thread_2 : threads) { - _builder.append("\t"); - _builder.append("etMessageService_stop(&msgService_"); - String _name_12 = thread_2.getName(); - _builder.append(_name_12, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("static void "); - _builder.append(clsname, ""); - _builder.append("_destroyMessageServices(void) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"destroyMessageServices\")"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - for(final PhysicalThread thread_3 : threads) { - _builder.append("\t"); - _builder.append("etMessageService_destroy(&msgService_"); - String _name_13 = thread_3.getName(); - _builder.append(_name_13, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_init(void) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"init\")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("etLogger_logInfoF(\"%s_init\", "); - _builder.append(clsname, "\t"); - _builder.append("Inst.name);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* construct all actors */"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_constructActorInstances();"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* initialization of all message services */"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_initMessageServices();"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* init all actors */"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_initActorInstances();"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - if (logData) { - { - for(final PhysicalThread thread_4 : threads) { - _builder.append("\t"); - _builder.append("MsgDispatcher_"); - String _name_14 = thread_4.getName(); - _builder.append(_name_14, "\t"); - _builder.append("_logDataHeaders();"); - _builder.newLineIfNotEmpty(); - } - } - { - for(final PhysicalThread thread_5 : threads) { - _builder.append("\t"); - _builder.append("MsgDispatcher_"); - String _name_15 = thread_5.getName(); - _builder.append(_name_15, "\t"); - _builder.append("_logData();"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_start(void) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"start\")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("etLogger_logInfoF(\"%s_start\", "); - _builder.append(clsname, "\t"); - _builder.append("Inst.name);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_startMessageServices();"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_run(etBool runAsTest) {"); - _builder.newLineIfNotEmpty(); - _builder.append("#ifdef ET_RUNNER_ACTIVATE"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"run\")"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("if (runAsTest) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("etSema_waitForWakeup(etRuntime_getTerminateSemaphore());"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("else {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("printf(\"type quit to exit\\n\");"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("fflush(stdout);"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("while (ET_TRUE) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("char line[64];"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("if (fgets(line, 64, stdin) != NULL) {"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("if (strncmp(line, \"quit\", 4)==0)"); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append("break;"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_stop(void){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"stop\")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("etLogger_logInfoF(\"%s_stop\", "); - _builder.append(clsname, "\t"); - _builder.append("Inst.name);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_stopMessageServices();"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_destroy(void){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"destroy\")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("etLogger_logInfoF(\"%s_destroy\", "); - _builder.append(clsname, "\t"); - _builder.append("Inst.name);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - EList _allContainedInstances = ssi.getAllContainedInstances(); - for(final ActorInstance ai : _allContainedInstances) { - _builder.append("\t"); - ActorClass _actorClass = ai.getActorClass(); - String _path = ai.getPath(); - String _pathName = this._roomExtensions.getPathName(_path); - String _plus_1 = ("&" + _pathName); - String _invokeUserStructor = this.helpers.invokeUserStructor(_actorClass, _plus_1, false); - _builder.append(_invokeUserStructor, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_destroyMessageServices();"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("_shutdown(void){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"shutdown\")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("etLogger_logInfoF(\"%s_shutdown\", "); - _builder.append(clsname, "\t"); - _builder.append("Inst.name);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("Inst.shutdownRequest = 1;"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.newLine(); - _builder.append("static void "); - _builder.append(clsname, ""); - _builder.append("_constructActorInstances(void){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"constructActorInstances\")"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - EList _allContainedInstances_1 = ssi.getAllContainedInstances(); - for(final ActorInstance ai_1 : _allContainedInstances_1) { - _builder.append("\t"); - ActorClass _actorClass_1 = ai_1.getActorClass(); - String _path_1 = ai_1.getPath(); - String _pathName_1 = this._roomExtensions.getPathName(_path_1); - String _plus_2 = ("&" + _pathName_1); - String _invokeUserStructor_1 = this.helpers.invokeUserStructor(_actorClass_1, _plus_2, true); - _builder.append(_invokeUserStructor_1, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("static void "); - _builder.append(clsname, ""); - _builder.append("_initActorInstances(void){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(clsname, "\t"); - _builder.append("\", \"initActorInstances\")"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - EList _allContainedInstances_2 = ssi.getAllContainedInstances(); - for(final ActorInstance ai_2 : _allContainedInstances_2) { - _builder.append("\t"); - ActorClass _actorClass_2 = ai_2.getActorClass(); - String _name_16 = _actorClass_2.getName(); - _builder.append(_name_16, "\t"); - _builder.append("_init(&"); - String _path_2 = ai_2.getPath(); - String _pathName_2 = this._roomExtensions.getPathName(_path_2); - _builder.append(_pathName_2, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence generateInstanceFile(final Root root, final SubSystemInstance ssi, final Collection usedThreads) { - CharSequence _xblockexpression = null; - { - final NodeRef nr = ETMapUtil.getNodeRef(ssi); - 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("* Instance File of Node "); - String _name = nr.getName(); - _builder.append(_name, " "); - _builder.append(" with SubSystem "); - String _name_1 = ssi.getName(); - _builder.append(_name_1, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* - instantiation of all actor instances and port instances"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* - configuration of data and connection of ports"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \"messaging/etMessageService.h\""); - _builder.newLine(); - _builder.newLine(); - _builder.append("/* include all referenced ActorClasses */"); - _builder.newLine(); - { - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - EList _referencedActorClasses = root.getReferencedActorClasses(_subSystemClass); - for(final ActorClass actorClass : _referencedActorClasses) { - _builder.append("#include "); - String _includePath = this._cExtensions.getIncludePath(actorClass); - _builder.append(_includePath, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* include all referenced ProtcolClasses */"); - _builder.newLine(); - { - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - EList _referencedProtocolClasses = root.getReferencedProtocolClasses(_subSystemClass_1); - for(final ProtocolClass protocolClass : _referencedProtocolClasses) { - _builder.append("#include "); - String _includePath_1 = this._cExtensions.getIncludePath(protocolClass); - _builder.append(_includePath_1, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* instantiation of message services and message buffers */"); - _builder.newLine(); - { - NodeClass _type = nr.getType(); - EList _threads = _type.getThreads(); - final Function1 _function = (PhysicalThread t) -> { - return Boolean.valueOf(usedThreads.contains(t)); - }; - Iterable _filter = IterableExtensions.filter(_threads, _function); - for(final PhysicalThread thread : _filter) { - _builder.append("/* "); - String _name_2 = thread.getName(); - _builder.append(_name_2, ""); - _builder.append(" */"); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name_3 = thread.getName(); - String _upperCase = _name_3.toUpperCase(); - _builder.append(_upperCase, ""); - _builder.append("_POOL_SIZE\t\t"); - int _msgpoolsize = thread.getMsgpoolsize(); - _builder.append(_msgpoolsize, ""); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name_4 = thread.getName(); - String _upperCase_1 = _name_4.toUpperCase(); - _builder.append(_upperCase_1, ""); - _builder.append("_BLOCK_SIZE\t"); - int _msgblocksize = thread.getMsgblocksize(); - _builder.append(_msgblocksize, ""); - _builder.newLineIfNotEmpty(); - _builder.append("static uint8 msgBuffer_"); - String _name_5 = thread.getName(); - _builder.append(_name_5, ""); - _builder.append("["); - String _name_6 = thread.getName(); - String _upperCase_2 = _name_6.toUpperCase(); - _builder.append(_upperCase_2, ""); - _builder.append("_POOL_SIZE * "); - String _name_7 = thread.getName(); - String _upperCase_3 = _name_7.toUpperCase(); - _builder.append(_upperCase_3, ""); - _builder.append("_BLOCK_SIZE];"); - _builder.newLineIfNotEmpty(); - _builder.append("static etMessageService msgService_"); - String _name_8 = thread.getName(); - _builder.append(_name_8, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* declarations of all ActorClass instances (const and variable structs) */"); - _builder.newLine(); - _builder.newLine(); - _builder.append("/* forward declaration of variable actor structs */"); - _builder.newLine(); - { - EList _allContainedInstances = ssi.getAllContainedInstances(); - for(final ActorInstance ai : _allContainedInstances) { - _builder.append("static "); - ActorClass _actorClass = ai.getActorClass(); - String _name_9 = _actorClass.getName(); - _builder.append(_name_9, ""); - _builder.append(" "); - String _path = ai.getPath(); - String _pathName = this._roomExtensions.getPathName(_path); - _builder.append(_pathName, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* forward declaration of variable port structs */"); - _builder.newLine(); - { - EList _allContainedInstances_1 = ssi.getAllContainedInstances(); - for(final ActorInstance ai_1 : _allContainedInstances_1) { - { - EList _orderedIfItemInstances = ai_1.getOrderedIfItemInstances(); - boolean _isEmpty = _orderedIfItemInstances.isEmpty(); - if (_isEmpty) { - _builder.append("/* nothing to do */"); - _builder.newLine(); - } else { - { - EList _orderedIfItemInstances_1 = ai_1.getOrderedIfItemInstances(); - for(final InterfaceItemInstance pi : _orderedIfItemInstances_1) { - { - ProtocolClass _protocol = pi.getProtocol(); - boolean _isConjugated = this._roomExtensions.isConjugated(pi); - PortClass _portClass = this._roomExtensions.getPortClass(_protocol, _isConjugated); - EList _attributes = null; - if (_portClass!=null) { - _attributes=_portClass.getAttributes(); - } - int _size = 0; - if (_attributes!=null) { - _size=_attributes.size(); - } - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _builder.append("static "); - ProtocolClass _protocol_1 = pi.getProtocol(); - boolean _isConjugated_1 = this._roomExtensions.isConjugated(pi); - String _portClassName = this._roomExtensions.getPortClassName(_protocol_1, _isConjugated_1); - _builder.append(_portClassName, ""); - _builder.append("_var "); - String _path_1 = pi.getPath(); - String _pathName_1 = this._roomExtensions.getPathName(_path_1); - _builder.append(_pathName_1, ""); - _builder.append("_var"); - { - boolean _isReplicated = pi.isReplicated(); - if (_isReplicated) { - _builder.append("["); - EList _peers = pi.getPeers(); - int _size_1 = _peers.size(); - _builder.append(_size_1, ""); - _builder.append("]"); - } - } - _builder.append("={"); - _builder.newLineIfNotEmpty(); - { - int _xifexpression = (int) 0; - EList _peers_1 = pi.getPeers(); - int _size_2 = _peers_1.size(); - boolean _equals = (_size_2 == 0); - if (_equals) { - _xifexpression = 1; - } else { - EList _peers_2 = pi.getPeers(); - _xifexpression = _peers_2.size(); - } - IntegerRange _upTo = new IntegerRange(1, _xifexpression); - boolean _hasElements = false; - for(final Integer i : _upTo) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", "\t"); - } - _builder.append("\t"); - InterfaceItem _interfaceItem = pi.getInterfaceItem(); - PortClass _portClass_1 = this._roomHelpers.getPortClass(_interfaceItem); - EList _attributes_1 = _portClass_1.getAttributes(); - CharSequence _generateAttributeInit = this.attrInitGenAddon.generateAttributeInit(pi, _attributes_1); - _builder.append(_generateAttributeInit, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t\t\t\t\t"); - } - } - _builder.append("};"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - } - } - _builder.newLine(); - { - EList _allContainedInstances_2 = ssi.getAllContainedInstances(); - for(final ActorInstance ai_2 : _allContainedInstances_2) { - _builder.newLine(); - _builder.append("/* instance "); - String _path_2 = ai_2.getPath(); - String _pathName_2 = this._roomExtensions.getPathName(_path_2); - _builder.append(_pathName_2, ""); - _builder.append(" */"); - _builder.newLineIfNotEmpty(); - { - if (((!Main.getSettings().isGenerateMSCInstrumentation()) && ai_2.getOrderedIfItemInstances().isEmpty())) { - _builder.append("/* no ports/saps/services - nothing to initialize statically */"); - _builder.newLine(); - } else { - CharSequence _genActorInstanceInitializer = this.genActorInstanceInitializer(root, ai_2); - _builder.append(_genActorInstanceInitializer, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence genActorInstanceInitializer(final Root root, final ActorInstance ai) { - CharSequence _xblockexpression = null; - { - String _path = ai.getPath(); - final String instName = this._roomExtensions.getPathName(_path); - final ArrayList replEventItems = new ArrayList(); - EList _orderedIfItemInstances = ai.getOrderedIfItemInstances(); - final Function1 _function = (InterfaceItemInstance e) -> { - return Boolean.valueOf(e.isReplicated()); - }; - Iterable _filter = IterableExtensions.filter(_orderedIfItemInstances, _function); - Iterables.addAll(replEventItems, _filter); - final Function1 _function_1 = (InterfaceItemInstance e) -> { - EList _peers = e.getPeers(); - boolean _isEmpty = _peers.isEmpty(); - return Boolean.valueOf((!_isEmpty)); - }; - InterfaceItemInstance _findFirst = IterableExtensions.findFirst(replEventItems, _function_1); - final boolean haveReplSubItems = (!Objects.equal(_findFirst, null)); - final Function1 _function_2 = (InterfaceItemInstance i) -> { - InterfaceItem _interfaceItem = i.getInterfaceItem(); - return Boolean.valueOf((_interfaceItem instanceof Port)); - }; - final Iterable replEventPorts = IterableExtensions.filter(replEventItems, _function_2); - final Function1 _function_3 = (InterfaceItemInstance i) -> { - InterfaceItem _interfaceItem = i.getInterfaceItem(); - return Boolean.valueOf((_interfaceItem instanceof SPP)); - }; - final Iterable replEventSPPs = IterableExtensions.filter(replEventItems, _function_3); - EList _orderedIfItemInstances_1 = ai.getOrderedIfItemInstances(); - final Function1 _function_4 = (InterfaceItemInstance e) -> { - return Boolean.valueOf(e.isSimple()); - }; - final Iterable simplePorts = IterableExtensions.filter(_orderedIfItemInstances_1, _function_4); - final ArrayList simpleEventItems = new ArrayList(); - final Function1 _function_5 = (InterfaceItemInstance p) -> { - ProtocolClass _protocol = p.getProtocol(); - CommunicationType _commType = _protocol.getCommType(); - return Boolean.valueOf(Objects.equal(_commType, CommunicationType.EVENT_DRIVEN)); - }; - Iterable _filter_1 = IterableExtensions.filter(simplePorts, _function_5); - Iterables.addAll(simpleEventItems, _filter_1); - final Function1 _function_6 = (InterfaceItemInstance i) -> { - InterfaceItem _interfaceItem = i.getInterfaceItem(); - return Boolean.valueOf((_interfaceItem instanceof Port)); - }; - final Iterable simpleEventPorts = IterableExtensions.filter(simpleEventItems, _function_6); - final Function1 _function_7 = (InterfaceItemInstance i) -> { - InterfaceItem _interfaceItem = i.getInterfaceItem(); - return Boolean.valueOf((_interfaceItem instanceof SAP)); - }; - final Iterable simpleEventSAPs = IterableExtensions.filter(simpleEventItems, _function_7); - final Function1 _function_8 = (InterfaceItemInstance p) -> { - ProtocolClass _protocol = p.getProtocol(); - CommunicationType _commType = _protocol.getCommType(); - return Boolean.valueOf(Objects.equal(_commType, CommunicationType.DATA_DRIVEN)); - }; - final Iterable dataPorts = IterableExtensions.filter(simplePorts, _function_8); - final Function1 _function_9 = (InterfaceItemInstance p) -> { - return Boolean.valueOf(((p instanceof PortInstance) && (!((PortInstance) p).getPort().isConjugated()))); - }; - final Iterable recvPorts = IterableExtensions.filter(dataPorts, _function_9); - final Function1 _function_10 = (InterfaceItemInstance p) -> { - return Boolean.valueOf(((p instanceof PortInstance) && ((PortInstance) p).getPort().isConjugated())); - }; - final Iterable sendPorts = IterableExtensions.filter(dataPorts, _function_10); - final HashMap offsets = new HashMap(); - int offset = 0; - for (final InterfaceItemInstance p : replEventItems) { - { - offsets.put(p, Integer.valueOf(offset)); - EList _peers = p.getPeers(); - int _size = _peers.size(); - int _plus = (offset + _size); - offset = _plus; - } - } - String _xifexpression = null; - if (haveReplSubItems) { - _xifexpression = (instName + "_repl_sub_ports"); - } else { - _xifexpression = "NULL"; - } - String replSubPortsArray = _xifexpression; - final boolean haveConstData = ((((!simpleEventItems.isEmpty()) || (!IterableExtensions.isEmpty(recvPorts))) || (!replEventItems.isEmpty())) || Main.getSettings().isGenerateMSCInstrumentation()); - final IntelligentSeparator sep = new IntelligentSeparator(","); - String _xifexpression_1 = null; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _xifexpression_1 = "/*const*/"; - } else { - _xifexpression_1 = "const"; - } - final String const_ = _xifexpression_1; - StringConcatenation _builder = new StringConcatenation(); - { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - CharSequence _genPeerPortArrays = this.genPeerPortArrays(root, ai); - _builder.append(_genPeerPortArrays, ""); - _builder.newLineIfNotEmpty(); - } - } - { - if (haveReplSubItems) { - _builder.append("static const etReplSubPort "); - _builder.append(replSubPortsArray, ""); - _builder.append("["); - _builder.append(offset, ""); - _builder.append("] = {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("/* Replicated Sub Ports: {varData, msgService, peerAddress, localId, index} */"); - _builder.newLine(); - { - final Function1 _function_11 = (InterfaceItemInstance e) -> { - EList _peers = e.getPeers(); - boolean _isEmpty = _peers.isEmpty(); - return Boolean.valueOf((!_isEmpty)); - }; - Iterable _filter_2 = IterableExtensions.filter(replEventItems, _function_11); - boolean _hasElements = false; - for(final InterfaceItemInstance pi : _filter_2) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - String _genReplSubPortInitializers = this.genReplSubPortInitializers(root, ai, pi); - _builder.append(_genReplSubPortInitializers, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("};"); - _builder.newLine(); - } - } - { - if (haveConstData) { - _builder.append("static "); - _builder.append(const_, ""); - _builder.append(" "); - ActorClass _actorClass = ai.getActorClass(); - String _name = _actorClass.getName(); - _builder.append(_name, ""); - _builder.append("_const "); - _builder.append(instName, ""); - _builder.append("_const = {"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings_2 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_2) { - _builder.append("\t"); - _builder.append(sep, "\t"); - _builder.append("\""); - String _path_1 = ai.getPath(); - _builder.append(_path_1, "\t"); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("/* Ports: {varData, msgService, peerAddress, localId} */"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* simple ports */"); - _builder.newLine(); - { - for(final InterfaceItemInstance pi_1 : simpleEventPorts) { - _builder.append("\t"); - _builder.append(sep, "\t"); - String _genPortInitializer = this.genPortInitializer(root, ai, pi_1); - _builder.append(_genPortInitializer, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* data receive ports */"); - _builder.newLine(); - { - for(final InterfaceItemInstance pi_2 : recvPorts) { - _builder.append("\t"); - _builder.append(sep, "\t"); - String _genRecvPortInitializer = this.genRecvPortInitializer(root, ai, pi_2); - _builder.append(_genRecvPortInitializer, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* saps */"); - _builder.newLine(); - { - for(final InterfaceItemInstance pi_3 : simpleEventSAPs) { - _builder.append("\t"); - _builder.append(sep, "\t"); - String _genPortInitializer_1 = this.genPortInitializer(root, ai, pi_3); - _builder.append(_genPortInitializer_1, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* replicated ports */"); - _builder.newLine(); - { - for(final InterfaceItemInstance pi_4 : replEventPorts) { - _builder.append("\t"); - _builder.append(sep, "\t"); - _builder.append("{"); - EList _peers = pi_4.getPeers(); - int _size = _peers.size(); - _builder.append(_size, "\t"); - _builder.append(", "); - _builder.append(replSubPortsArray, "\t"); - _builder.append("+"); - Integer _get = offsets.get(pi_4); - _builder.append(_get, "\t"); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* services */"); - _builder.newLine(); - { - for(final InterfaceItemInstance pi_5 : replEventSPPs) { - _builder.append("\t"); - _builder.append(sep, "\t"); - _builder.append("{"); - EList _peers_1 = pi_5.getPeers(); - int _size_1 = _peers_1.size(); - _builder.append(_size_1, "\t"); - _builder.append(", "); - _builder.append(replSubPortsArray, "\t"); - _builder.append("+"); - Integer _get_1 = offsets.get(pi_5); - _builder.append(_get_1, "\t"); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("};"); - _builder.newLine(); - } - } - _builder.append("static "); - ActorClass _actorClass_1 = ai.getActorClass(); - String _name_1 = _actorClass_1.getName(); - _builder.append(_name_1, ""); - _builder.append(" "); - _builder.append(instName, ""); - _builder.append(" = {"); - _builder.newLineIfNotEmpty(); - { - if (haveConstData) { - _builder.append("\t"); - _builder.append("&"); - _builder.append(instName, "\t"); - _builder.append("_const,"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("/* data send ports */"); - _builder.newLine(); - { - for(final InterfaceItemInstance pi_6 : sendPorts) { - _builder.append("\t"); - CharSequence _genSendPortInitializer = this.genSendPortInitializer(pi_6); - _builder.append(_genSendPortInitializer, "\t"); - _builder.append(","); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* attributes */"); - _builder.newLine(); - _builder.append("\t"); - ActorClass _actorClass_2 = ai.getActorClass(); - List _allAttributes = this._roomHelpers.getAllAttributes(_actorClass_2); - CharSequence _generateAttributeInit = this.attrInitGenAddon.generateAttributeInit(ai, _allAttributes); - _builder.append(_generateAttributeInit, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* state and history are initialized in init function */"); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence genPeerPortArrays(final Root root, final ActorInstance ai) { - CharSequence _xblockexpression = null; - { - EList _orderedIfItemInstances = ai.getOrderedIfItemInstances(); - final Function1 _function = (InterfaceItemInstance e) -> { - return Boolean.valueOf((e.isSimple() && (e instanceof PortInstance))); - }; - Iterable _filter = IterableExtensions.filter(_orderedIfItemInstances, _function); - final Function1 _function_1 = (InterfaceItemInstance inst) -> { - return ((PortInstance) inst); - }; - final Iterable simplePorts = IterableExtensions.map(_filter, _function_1); - final Function1 _function_2 = (PortInstance p) -> { - return Boolean.valueOf((p.getPort().isConjugated() && Objects.equal(p.getProtocol().getCommType(), CommunicationType.DATA_DRIVEN))); - }; - final Iterable sendPorts = IterableExtensions.filter(simplePorts, _function_2); - final Function1 _function_3 = (PortInstance p) -> { - Port _port = p.getPort(); - List _outgoing = this._roomHelpers.getOutgoing(_port); - final Function1 _function_4 = (Message m) -> { - return Boolean.valueOf((this._typeHelpers.isEnumeration(m.getData().getRefType().getType()) || this._typeHelpers.isBoolean(m.getData().getRefType().getType()))); - }; - Iterable _filter_1 = IterableExtensions.filter(_outgoing, _function_4); - boolean _isEmpty = IterableExtensions.isEmpty(_filter_1); - return Boolean.valueOf((!_isEmpty)); - }; - final Iterable loggedPorts = IterableExtensions.filter(sendPorts, _function_3); - StringConcatenation _builder = new StringConcatenation(); - { - boolean _isEmpty = IterableExtensions.isEmpty(loggedPorts); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append("#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE"); - _builder.newLine(); - { - for(final PortInstance pi : loggedPorts) { - _builder.append("static const char* "); - String _path = pi.getPath(); - String _pathName = this._roomExtensions.getPathName(_path); - _builder.append(_pathName, ""); - _builder.append("_peers["); - EList _peers = pi.getPeers(); - int _size = _peers.size(); - int _plus = (_size + 1); - _builder.append(_plus, ""); - _builder.append("] = {"); - _builder.newLineIfNotEmpty(); - { - EList _peers_1 = pi.getPeers(); - for(final InterfaceItemInstance peer : _peers_1) { - _builder.append("\t"); - _builder.append("\""); - EObject _eContainer = peer.eContainer(); - String _path_1 = ((ActorInstance) _eContainer).getPath(); - _builder.append(_path_1, "\t"); - _builder.append("\","); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("NULL"); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - } - } - _builder.append("#endif"); - _builder.newLine(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private String genPortInitializer(final Root root, final ActorInstance ai, final InterfaceItemInstance pi) { - String _xblockexpression = null; - { - int _xifexpression = (int) 0; - EList _peers = pi.getPeers(); - boolean _isEmpty = _peers.isEmpty(); - if (_isEmpty) { - _xifexpression = 0; - } else { - EList _peers_1 = pi.getPeers(); - InterfaceItemInstance _get = _peers_1.get(0); - _xifexpression = _get.getObjId(); - } - final int objId = _xifexpression; - int _xifexpression_1 = (int) 0; - EList _peers_2 = pi.getPeers(); - boolean _isEmpty_1 = _peers_2.isEmpty(); - if (_isEmpty_1) { - _xifexpression_1 = 0; - } else { - EList _peers_3 = pi.getPeers(); - InterfaceItemInstance _get_1 = _peers_3.get(0); - EList _peers_4 = _get_1.getPeers(); - _xifexpression_1 = _peers_4.indexOf(pi); - } - final int idx = _xifexpression_1; - String _xifexpression_2 = null; - EList _peers_5 = pi.getPeers(); - boolean _isEmpty_2 = _peers_5.isEmpty(); - if (_isEmpty_2) { - _xifexpression_2 = "NULL"; - } else { - EList _peers_6 = pi.getPeers(); - InterfaceItemInstance _get_2 = _peers_6.get(0); - EObject _eContainer = _get_2.eContainer(); - ETMapUtil.MappedThread _mappedThread = ETMapUtil.getMappedThread(((ActorInstance) _eContainer)); - PhysicalThread _thread = _mappedThread.getThread(); - String _name = _thread.getName(); - _xifexpression_2 = ("&msgService_" + _name); - } - final String msgSvc = _xifexpression_2; - String myInst = ""; - String peerInst = ""; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - EObject _eContainer_1 = pi.eContainer(); - String _path = ((ActorInstance) _eContainer_1).getPath(); - String _plus = ("\n#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE\n,\"" + _path); - String _plus_1 = (_plus + "\","); - myInst = _plus_1; - String _xifexpression_3 = null; - EList _peers_7 = pi.getPeers(); - boolean _isEmpty_3 = _peers_7.isEmpty(); - boolean _not = (!_isEmpty_3); - if (_not) { - EList _peers_8 = pi.getPeers(); - InterfaceItemInstance _get_3 = _peers_8.get(0); - EObject _eContainer_2 = _get_3.eContainer(); - String _path_1 = ((ActorInstance) _eContainer_2).getPath(); - String _plus_2 = ("\"" + _path_1); - _xifexpression_3 = (_plus_2 + "\"\n#endif\n"); - } else { - _xifexpression_3 = "\n#endif\n"; - } - peerInst = _xifexpression_3; - } - String _interfaceItemInstanceData = this.getInterfaceItemInstanceData(pi); - String _plus_3 = ("{" + _interfaceItemInstanceData); - String _plus_4 = (_plus_3 + ", "); - String _plus_5 = (_plus_4 + msgSvc); - String _plus_6 = (_plus_5 + ", "); - String _plus_7 = (_plus_6 + Integer.valueOf((objId + idx))); - String _plus_8 = (_plus_7 + "+BASE_ADDRESS, "); - ExpandedActorClass _expandedActorClass = root.getExpandedActorClass(ai); - InterfaceItem _interfaceItem = pi.getInterfaceItem(); - int _interfaceItemLocalId = _expandedActorClass.getInterfaceItemLocalId(_interfaceItem); - int _plus_9 = (_interfaceItemLocalId + 1); - String _plus_10 = (_plus_8 + Integer.valueOf(_plus_9)); - String _plus_11 = (_plus_10 + myInst); - String _plus_12 = (_plus_11 + peerInst); - String _plus_13 = (_plus_12 + "} /* Port "); - String _name_1 = pi.getName(); - String _plus_14 = (_plus_13 + _name_1); - _xblockexpression = (_plus_14 + " */"); - } - return _xblockexpression; - } - - private CharSequence genSendPortInitializer(final InterfaceItemInstance pi) { - CharSequence _xblockexpression = null; - { - Port _port = ((PortInstance) pi).getPort(); - GeneralProtocolClass _protocol = _port.getProtocol(); - final ProtocolClass pc = ((ProtocolClass) _protocol); - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - final Function1 _function = (Message m) -> { - VarDecl _data = m.getData(); - return Boolean.valueOf((!Objects.equal(_data, null))); - }; - Iterable messages = IterableExtensions.filter(_allIncomingMessages, _function); - final Function1 _function_1 = (Message m) -> { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - return Boolean.valueOf(this._typeHelpers.isEnumeration(_type)); - }; - final Iterable enumMsgs = IterableExtensions.filter(messages, _function_1); - final Function1 _function_2 = (Message m) -> { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - return Boolean.valueOf(this._typeHelpers.isBoolean(_type)); - }; - final Iterable boolMsgs = IterableExtensions.filter(messages, _function_2); - final boolean usesMSC = (Main.getSettings().isGenerateMSCInstrumentation() && (!(IterableExtensions.isEmpty(enumMsgs) && IterableExtensions.isEmpty(boolMsgs)))); - EObject _eContainer = pi.eContainer(); - final String instName = ((ActorInstance) _eContainer).getPath(); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("{"); - _builder.newLine(); - { - EList _incomingMessages = pc.getIncomingMessages(); - boolean _hasElements = false; - for(final Message m : _incomingMessages) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - String _defaultValue = this._cExtensions.defaultValue(_type); - _builder.append(_defaultValue, "\t"); - _builder.newLineIfNotEmpty(); - } - } - { - if (usesMSC) { - _builder.append("\t"); - _builder.append("#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append(", \""); - _builder.append(instName, "\t\t"); - _builder.append("\","); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - String _path = pi.getPath(); - String _pathName = this._roomExtensions.getPathName(_path); - _builder.append(_pathName, "\t\t"); - _builder.append("_peers"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("#endif"); - _builder.newLine(); - } - } - _builder.append("} /* send port "); - String _name = pi.getName(); - _builder.append(_name, ""); - _builder.append(" */"); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private String getInterfaceItemInstanceData(final InterfaceItemInstance pi) { - ProtocolClass _protocol = pi.getProtocol(); - boolean _isConjugated = this._roomExtensions.isConjugated(pi); - PortClass _portClass = this._roomExtensions.getPortClass(_protocol, _isConjugated); - boolean _equals = Objects.equal(_portClass, null); - if (_equals) { - return "NULL"; - } - ProtocolClass _protocol_1 = pi.getProtocol(); - boolean _isConjugated_1 = this._roomExtensions.isConjugated(pi); - PortClass _portClass_1 = this._roomExtensions.getPortClass(_protocol_1, _isConjugated_1); - EList _attributes = _portClass_1.getAttributes(); - boolean _isEmpty = _attributes.isEmpty(); - if (_isEmpty) { - return "NULL"; - } else { - String _path = pi.getPath(); - String _pathName = this._roomExtensions.getPathName(_path); - String _plus = ("&" + _pathName); - return (_plus + "_var"); - } - } - - private String genRecvPortInitializer(final Root root, final ActorInstance ai, final InterfaceItemInstance pi) { - String _xblockexpression = null; - { - InterfaceItem _interfaceItem = pi.getInterfaceItem(); - List _incoming = this._roomHelpers.getIncoming(_interfaceItem); - final Function1 _function = (Message m) -> { - VarDecl _data = m.getData(); - return Boolean.valueOf((!Objects.equal(_data, null))); - }; - Iterable sentMsgs = IterableExtensions.filter(_incoming, _function); - final Function1 _function_1 = (Message m) -> { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - return Boolean.valueOf(this._typeHelpers.isEnumeration(_type)); - }; - final Iterable enumMsgs = IterableExtensions.filter(sentMsgs, _function_1); - final Function1 _function_2 = (Message m) -> { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - return Boolean.valueOf(this._typeHelpers.isBoolean(_type)); - }; - final Iterable boolMsgs = IterableExtensions.filter(sentMsgs, _function_2); - final boolean usesMSC = (Main.getSettings().isGenerateMSCInstrumentation() && (!(IterableExtensions.isEmpty(enumMsgs) && IterableExtensions.isEmpty(boolMsgs)))); - String enumVal = ""; - if (usesMSC) { - String _path = ai.getPath(); - String _plus = ("\n, \"" + _path); - String _plus_1 = (_plus + "\""); - enumVal = _plus_1; - for (final Message msg : enumMsgs) { - VarDecl _data = msg.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - String _defaultValue = this._cExtensions.defaultValue(_type); - String _plus_2 = ((enumVal + "\n, ") + _defaultValue); - enumVal = _plus_2; - } - for (final Message msg_1 : boolMsgs) { - VarDecl _data_1 = msg_1.getData(); - RefableType _refType_1 = _data_1.getRefType(); - DataType _type_1 = _refType_1.getType(); - String _defaultValue_1 = this._cExtensions.defaultValue(_type_1); - String _plus_3 = ((enumVal + "\n, ") + _defaultValue_1); - enumVal = _plus_3; - } - enumVal = (("\n#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE" + enumVal) + "\n#endif\n"); - } - EList _peers = pi.getPeers(); - boolean _isEmpty = _peers.isEmpty(); - if (_isEmpty) { - return (("{NULL" + enumVal) + "}"); - } - EList _peers_1 = pi.getPeers(); - InterfaceItemInstance peer = _peers_1.get(0); - EList _peers_2 = pi.getPeers(); - InterfaceItemInstance _get = _peers_2.get(0); - EObject _eContainer = _get.eContainer(); - ActorInstance peerInst = ((ActorInstance) _eContainer); - String _path_1 = peerInst.getPath(); - String instName = this._roomExtensions.getPathName(_path_1); - String _name = peer.getName(); - String _plus_4 = ((("{&" + instName) + ".") + _name); - String _plus_5 = (_plus_4 + enumVal); - _xblockexpression = (_plus_5 + "}"); - } - return _xblockexpression; - } - - private String genReplSubPortInitializers(final Root root, final ActorInstance ai, final InterfaceItemInstance pi) { - String result = ""; - String _xifexpression = null; - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - EObject _eContainer = pi.eContainer(); - String _path = ((ActorInstance) _eContainer).getPath(); - String _plus = ("\n#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE\n,\"" + _path); - _xifexpression = (_plus + "\"\n"); - } else { - _xifexpression = ""; - } - final String myInst = _xifexpression; - EList _peers = pi.getPeers(); - for (final InterfaceItemInstance p : _peers) { - { - EList _peers_1 = pi.getPeers(); - final int idx = _peers_1.indexOf(p); - String _xifexpression_1 = null; - EList _peers_2 = pi.getPeers(); - int _size = _peers_2.size(); - int _minus = (_size - 1); - boolean _lessThan = (idx < _minus); - if (_lessThan) { - _xifexpression_1 = ","; - } else { - _xifexpression_1 = ""; - } - final String comma = _xifexpression_1; - EObject _eContainer_1 = p.eContainer(); - ETMapUtil.MappedThread _mappedThread = ETMapUtil.getMappedThread(((ActorInstance) _eContainer_1)); - PhysicalThread _thread = _mappedThread.getThread(); - final String thread = _thread.getName(); - String iiiD = this.getInterfaceItemInstanceData(pi); - String _xifexpression_2 = null; - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - EObject _eContainer_2 = p.eContainer(); - String _path_1 = ((ActorInstance) _eContainer_2).getPath(); - String _plus_1 = (",\"" + _path_1); - _xifexpression_2 = (_plus_1 + "\"\n#endif\n"); - } else { - _xifexpression_2 = ""; - } - final String peerInst = _xifexpression_2; - String _xifexpression_3 = null; - boolean _equals = iiiD.equals("NULL"); - if (_equals) { - _xifexpression_3 = (iiiD + ","); - } else { - _xifexpression_3 = (((iiiD + "[") + Integer.valueOf(idx)) + "],"); - } - iiiD = _xifexpression_3; - int _objId = p.getObjId(); - String _plus_2 = ((((((result + - "{{") + iiiD) + "&msgService_") + thread) + ", ") + Integer.valueOf(_objId)); - String _plus_3 = (_plus_2 + "+BASE_ADDRESS, "); - ExpandedActorClass _expandedActorClass = root.getExpandedActorClass(ai); - InterfaceItem _interfaceItem = pi.getInterfaceItem(); - int _interfaceItemLocalId = _expandedActorClass.getInterfaceItemLocalId(_interfaceItem); - int _plus_4 = (_interfaceItemLocalId + 1); - String _plus_5 = (_plus_3 + Integer.valueOf(_plus_4)); - String _plus_6 = (_plus_5 + myInst); - String _plus_7 = (_plus_6 + peerInst); - String _plus_8 = (_plus_7 + "},"); - String _plus_9 = (_plus_8 + Integer.valueOf(idx)); - String _plus_10 = (_plus_9 + "}"); - String _plus_11 = (_plus_10 + comma); - String _plus_12 = (_plus_11 + " /* Repl Sub Port "); - String _name = pi.getName(); - String _plus_13 = (_plus_12 + _name); - String _plus_14 = (_plus_13 + " idx +"); - String _plus_15 = (_plus_14 + Integer.valueOf(idx)); - String _plus_16 = (_plus_15 + "*/\n"); - result = _plus_16; - } - } - return result; - } - - private CharSequence generateDispatcherFile(final Root root, final SubSystemInstance ssi, final Collection usedThreads) { - CharSequence _xblockexpression = null; - { - final NodeRef nr = ETMapUtil.getNodeRef(ssi); - final boolean logData = (Main.getSettings().isGenerateDataInstrumentation() && this._roomHelpers.isAnnotationPresent(ssi.getSubSystemClass().getAnnotations(), "DataLogging")); - ArrayList _xifexpression = null; - if (logData) { - _xifexpression = this.loggedPorts(ssi); - } else { - _xifexpression = CollectionLiterals.newArrayList(); - } - final ArrayList loggedPorts = _xifexpression; - 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("* Dispatcher File of Node "); - String _name = nr.getName(); - _builder.append(_name, " "); - _builder.append(" with SubSystem "); - String _name_1 = ssi.getName(); - _builder.append(_name_1, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* contains a generated message dispatcher (receiveMessage) for each MessageService (Thread)"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \"messaging/etMessageReceiver.h\""); - _builder.newLine(); - _builder.append("#include \"debugging/etLogger.h\""); - _builder.newLine(); - _builder.append("#include \"debugging/etMSCLogger.h\""); - _builder.newLine(); - _builder.newLine(); - { - NodeClass _type = nr.getType(); - EList _threads = _type.getThreads(); - final Function1 _function = (PhysicalThread t) -> { - return Boolean.valueOf(usedThreads.contains(t)); - }; - Iterable _filter = IterableExtensions.filter(_threads, _function); - boolean _hasElements = false; - for(final PhysicalThread thread : _filter) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate("\n", ""); - } - EList _allContainedInstances = ssi.getAllContainedInstances(); - final Function1 _function_1 = (ActorInstance ai) -> { - ETMapUtil.MappedThread _mappedThread = ETMapUtil.getMappedThread(ai); - PhysicalThread _thread = _mappedThread.getThread(); - return Boolean.valueOf(Objects.equal(_thread, thread)); - }; - final Iterable instancesOnThread = IterableExtensions.filter(_allContainedInstances, _function_1); - _builder.newLineIfNotEmpty(); - final Function1 _function_2 = (ActorInstance ai) -> { - return Boolean.valueOf((Objects.equal(ai.getActorClass().getCommType(), ComponentCommunicationType.EVENT_DRIVEN) || Objects.equal(ai.getActorClass().getCommType(), ComponentCommunicationType.ASYNCHRONOUS))); - }; - final Iterable dispatchedInstances = IterableExtensions.filter(instancesOnThread, _function_2); - _builder.newLineIfNotEmpty(); - final Function1 _function_3 = (ActorInstance ai) -> { - return Boolean.valueOf((Objects.equal(ai.getActorClass().getCommType(), ComponentCommunicationType.DATA_DRIVEN) || Objects.equal(ai.getActorClass().getCommType(), ComponentCommunicationType.ASYNCHRONOUS))); - }; - final Iterable executedInstances = IterableExtensions.filter(instancesOnThread, _function_3); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - int _size = IterableExtensions.size(executedInstances); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* generated execute function for all cyclic execute calls for the async or datadriven actor instances of thread \""); - String _name_2 = thread.getName(); - _builder.append(_name_2, " "); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.append("static void MsgDispatcher_"); - String _name_3 = thread.getName(); - _builder.append(_name_3, ""); - _builder.append("_poll(void){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"MsgDispatcher_"); - String _name_4 = thread.getName(); - _builder.append(_name_4, "\t"); - _builder.append("\", \"execute\")"); - _builder.newLineIfNotEmpty(); - { - for(final ActorInstance ai : executedInstances) { - _builder.append("\t"); - ActorClass _actorClass = ai.getActorClass(); - String _name_5 = _actorClass.getName(); - _builder.append(_name_5, "\t"); - _builder.append("_execute((void*)&"); - String _path = ai.getPath(); - String _pathName = this._roomExtensions.getPathName(_path); - _builder.append(_pathName, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - { - if (logData) { - _builder.append("static void MsgDispatcher_"); - String _name_6 = thread.getName(); - _builder.append(_name_6, ""); - _builder.append("_logDataHeaders(void){"); - _builder.newLineIfNotEmpty(); - { - for(final PortInstance pi : loggedPorts) { - _builder.append("\t"); - _builder.append("ET_DATA_LOGGER_LOG_STRING(\""); - String _path_1 = pi.getPath(); - _builder.append(_path_1, "\t"); - _builder.append("\")"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _builder.newLine(); - _builder.append("static void MsgDispatcher_"); - String _name_7 = thread.getName(); - _builder.append(_name_7, ""); - _builder.append("_logData(void){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_DATA_LOGGER_NEW_ROW"); - _builder.newLine(); - { - for(final PortInstance pi_1 : loggedPorts) { - _builder.append("\t"); - String _createLoggerCall = this.createLoggerCall(pi_1); - _builder.append(_createLoggerCall, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _builder.newLine(); - } - } - } - } - _builder.newLine(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* generated dispatch function for all messages for the thread \""); - String _name_8 = thread.getName(); - _builder.append(_name_8, " "); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.append("static etBool MsgDispatcher_"); - String _name_9 = thread.getName(); - _builder.append(_name_9, ""); - _builder.append("_receiveMessage(const etMessage* msg){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\"MsgDispatcher_"); - String _name_10 = thread.getName(); - _builder.append(_name_10, "\t"); - _builder.append("\", \"receiveMessage\")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("switch(msg->address){"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("case MESSAGESERVICE_ADDRESS:"); - _builder.newLine(); - { - boolean _isEmpty = IterableExtensions.isEmpty(executedInstances); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append("\t\t\t"); - _builder.append("if (msg->evtID == etSystemProtocol_IN_poll) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("MsgDispatcher_"); - String _name_11 = thread.getName(); - _builder.append(_name_11, "\t\t\t\t"); - _builder.append("_poll();"); - _builder.newLineIfNotEmpty(); - { - if (logData) { - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("MsgDispatcher_"); - String _name_12 = thread.getName(); - _builder.append(_name_12, "\t\t\t\t"); - _builder.append("_logData();"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("else"); - _builder.newLine(); - } - } - _builder.append("\t\t\t"); - _builder.append("if (msg->evtID == etSystemProtocol_IN_terminate)"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("return ET_FALSE;"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("break;"); - _builder.newLine(); - { - for(final ActorInstance ai_1 : dispatchedInstances) { - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("/* interface items of "); - String _path_2 = ai_1.getPath(); - _builder.append(_path_2, "\t\t"); - _builder.append(" */"); - _builder.newLineIfNotEmpty(); - { - EList _orderedIfItemInstances = ai_1.getOrderedIfItemInstances(); - final Function1 _function_4 = (InterfaceItemInstance p) -> { - ProtocolClass _protocol = p.getProtocol(); - CommunicationType _commType = _protocol.getCommType(); - return Boolean.valueOf(Objects.equal(_commType, CommunicationType.EVENT_DRIVEN)); - }; - Iterable _filter_1 = IterableExtensions.filter(_orderedIfItemInstances, _function_4); - for(final InterfaceItemInstance pi_2 : _filter_1) { - { - boolean _isReplicated = pi_2.isReplicated(); - if (_isReplicated) { - { - EList _peers = pi_2.getPeers(); - for(final InterfaceItemInstance peer : _peers) { - _builder.append("\t\t"); - _builder.append("case "); - int _objId = pi_2.getObjId(); - EList _peers_1 = pi_2.getPeers(); - int _indexOf = _peers_1.indexOf(peer); - int _plus = (_objId + _indexOf); - _builder.append(_plus, "\t\t"); - _builder.append("+BASE_ADDRESS:"); - _builder.newLineIfNotEmpty(); - { - ProtocolClass _protocol = pi_2.getProtocol(); - boolean _isConjugated = this._roomExtensions.isConjugated(pi_2); - boolean _handlesReceive = this._roomExtensions.handlesReceive(_protocol, _isConjugated); - if (_handlesReceive) { - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("switch (msg->evtID){"); - _builder.newLine(); - { - ProtocolClass _protocol_1 = pi_2.getProtocol(); - boolean _isConjugated_1 = this._roomExtensions.isConjugated(pi_2); - List _receiveHandlers = this._roomExtensions.getReceiveHandlers(_protocol_1, _isConjugated_1); - for(final MessageHandler h : _receiveHandlers) { - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("case "); - ProtocolClass _protocol_2 = pi_2.getProtocol(); - String _name_13 = _protocol_2.getName(); - _builder.append(_name_13, "\t\t\t\t"); - _builder.append("_"); - Message _msg = h.getMsg(); - String _codeName = this._roomExtensions.getCodeName(_msg); - _builder.append(_codeName, "\t\t\t\t"); - _builder.append(":"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - ProtocolClass _protocol_3 = pi_2.getProtocol(); - boolean _isConjugated_2 = this._roomExtensions.isConjugated(pi_2); - String _portClassName = this._roomExtensions.getPortClassName(_protocol_3, _isConjugated_2); - _builder.append(_portClassName, "\t\t\t\t\t"); - _builder.append("_"); - Message _msg_1 = h.getMsg(); - String _name_14 = _msg_1.getName(); - _builder.append(_name_14, "\t\t\t\t\t"); - _builder.append("_receiveHandler((etPort *)&"); - String _path_3 = ai_1.getPath(); - String _pathName_1 = this._roomExtensions.getPathName(_path_3); - _builder.append(_pathName_1, "\t\t\t\t\t"); - _builder.append("_const."); - String _name_15 = pi_2.getName(); - _builder.append(_name_15, "\t\t\t\t\t"); - _builder.append(".ports["); - EList _peers_2 = pi_2.getPeers(); - int _indexOf_1 = _peers_2.indexOf(peer); - _builder.append(_indexOf_1, "\t\t\t\t\t"); - _builder.append("],msg,(void*)&"); - String _path_4 = ai_1.getPath(); - String _pathName_2 = this._roomExtensions.getPathName(_path_4); - _builder.append(_pathName_2, "\t\t\t\t\t"); - _builder.append(","); - ActorClass _actorClass_1 = ai_1.getActorClass(); - String _name_16 = _actorClass_1.getName(); - _builder.append(_name_16, "\t\t\t\t\t"); - _builder.append("_receiveMessage);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("break;"); - _builder.newLine(); - } - } - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("default: "); - ActorClass _actorClass_2 = ai_1.getActorClass(); - String _name_17 = _actorClass_2.getName(); - _builder.append(_name_17, "\t\t\t\t"); - _builder.append("_receiveMessage((void*)&"); - String _path_5 = ai_1.getPath(); - String _pathName_3 = this._roomExtensions.getPathName(_path_5); - _builder.append(_pathName_3, "\t\t\t\t"); - _builder.append(",(etPort*)&"); - String _path_6 = ai_1.getPath(); - String _pathName_4 = this._roomExtensions.getPathName(_path_6); - _builder.append(_pathName_4, "\t\t\t\t"); - _builder.append("_const."); - String _name_18 = pi_2.getName(); - _builder.append(_name_18, "\t\t\t\t"); - _builder.append(".ports["); - EList _peers_3 = pi_2.getPeers(); - int _indexOf_2 = _peers_3.indexOf(peer); - _builder.append(_indexOf_2, "\t\t\t\t"); - _builder.append("], msg);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("break;"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } else { - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_ASYNC_IN("); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - String _path_7 = ai_1.getPath(); - String _pathName_5 = this._roomExtensions.getPathName(_path_7); - _builder.append(_pathName_5, "\t\t\t\t"); - _builder.append("_const."); - String _name_19 = pi_2.getName(); - _builder.append(_name_19, "\t\t\t\t"); - _builder.append(".ports["); - EList _peers_4 = pi_2.getPeers(); - int _indexOf_3 = _peers_4.indexOf(peer); - _builder.append(_indexOf_3, "\t\t\t\t"); - _builder.append("].port.peerInstName,"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - ProtocolClass _protocol_4 = pi_2.getProtocol(); - String _name_20 = _protocol_4.getName(); - _builder.append(_name_20, "\t\t\t\t"); - _builder.append("_getMessageString(msg->evtID),"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - String _path_8 = ai_1.getPath(); - String _pathName_6 = this._roomExtensions.getPathName(_path_8); - _builder.append(_pathName_6, "\t\t\t\t"); - _builder.append("_const."); - String _name_21 = pi_2.getName(); - _builder.append(_name_21, "\t\t\t\t"); - _builder.append(".ports["); - EList _peers_5 = pi_2.getPeers(); - int _indexOf_4 = _peers_5.indexOf(peer); - _builder.append(_indexOf_4, "\t\t\t\t"); - _builder.append("].port.myInstName"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append(")"); - _builder.newLine(); - } - } - _builder.append("\t\t"); - _builder.append("\t"); - ActorClass _actorClass_3 = ai_1.getActorClass(); - String _name_22 = _actorClass_3.getName(); - _builder.append(_name_22, "\t\t\t"); - _builder.append("_receiveMessage((void*)&"); - String _path_9 = ai_1.getPath(); - String _pathName_7 = this._roomExtensions.getPathName(_path_9); - _builder.append(_pathName_7, "\t\t\t"); - _builder.append(",&"); - String _path_10 = ai_1.getPath(); - String _pathName_8 = this._roomExtensions.getPathName(_path_10); - _builder.append(_pathName_8, "\t\t\t"); - _builder.append("_const."); - String _name_23 = pi_2.getName(); - _builder.append(_name_23, "\t\t\t"); - _builder.append(".ports["); - EList _peers_6 = pi_2.getPeers(); - int _indexOf_5 = _peers_6.indexOf(peer); - _builder.append(_indexOf_5, "\t\t\t"); - _builder.append("].port, msg);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("break;"); - _builder.newLine(); - } - } - } else { - _builder.append("\t\t"); - _builder.append("case "); - int _objId_1 = pi_2.getObjId(); - _builder.append(_objId_1, "\t\t"); - _builder.append("+BASE_ADDRESS:"); - _builder.newLineIfNotEmpty(); - { - ProtocolClass _protocol_5 = pi_2.getProtocol(); - boolean _isConjugated_3 = this._roomExtensions.isConjugated(pi_2); - boolean _handlesReceive_1 = this._roomExtensions.handlesReceive(_protocol_5, _isConjugated_3); - if (_handlesReceive_1) { - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("switch (msg->evtID){"); - _builder.newLine(); - { - ProtocolClass _protocol_6 = pi_2.getProtocol(); - boolean _isConjugated_4 = this._roomExtensions.isConjugated(pi_2); - List _receiveHandlers_1 = this._roomExtensions.getReceiveHandlers(_protocol_6, _isConjugated_4); - for(final MessageHandler h_1 : _receiveHandlers_1) { - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("case "); - ProtocolClass _protocol_7 = pi_2.getProtocol(); - String _name_24 = _protocol_7.getName(); - _builder.append(_name_24, "\t\t\t\t"); - _builder.append("_"); - Message _msg_2 = h_1.getMsg(); - String _codeName_1 = this._roomExtensions.getCodeName(_msg_2); - _builder.append(_codeName_1, "\t\t\t\t"); - _builder.append(":"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - ProtocolClass _protocol_8 = pi_2.getProtocol(); - boolean _isConjugated_5 = this._roomExtensions.isConjugated(pi_2); - String _portClassName_1 = this._roomExtensions.getPortClassName(_protocol_8, _isConjugated_5); - _builder.append(_portClassName_1, "\t\t\t\t\t"); - _builder.append("_"); - Message _msg_3 = h_1.getMsg(); - String _name_25 = _msg_3.getName(); - _builder.append(_name_25, "\t\t\t\t\t"); - _builder.append("_receiveHandler((etPort *)&"); - String _path_11 = ai_1.getPath(); - String _pathName_9 = this._roomExtensions.getPathName(_path_11); - _builder.append(_pathName_9, "\t\t\t\t\t"); - _builder.append("_const."); - String _name_26 = pi_2.getName(); - _builder.append(_name_26, "\t\t\t\t\t"); - _builder.append(",msg,(void*)&"); - String _path_12 = ai_1.getPath(); - String _pathName_10 = this._roomExtensions.getPathName(_path_12); - _builder.append(_pathName_10, "\t\t\t\t\t"); - _builder.append(","); - ActorClass _actorClass_4 = ai_1.getActorClass(); - String _name_27 = _actorClass_4.getName(); - _builder.append(_name_27, "\t\t\t\t\t"); - _builder.append("_receiveMessage);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("break;"); - _builder.newLine(); - } - } - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("default: "); - ActorClass _actorClass_5 = ai_1.getActorClass(); - String _name_28 = _actorClass_5.getName(); - _builder.append(_name_28, "\t\t\t\t"); - _builder.append("_receiveMessage((void*)&"); - String _path_13 = ai_1.getPath(); - String _pathName_11 = this._roomExtensions.getPathName(_path_13); - _builder.append(_pathName_11, "\t\t\t\t"); - _builder.append(",(etPort*)&"); - String _path_14 = ai_1.getPath(); - String _pathName_12 = this._roomExtensions.getPathName(_path_14); - _builder.append(_pathName_12, "\t\t\t\t"); - _builder.append("_const."); - String _name_29 = pi_2.getName(); - _builder.append(_name_29, "\t\t\t\t"); - _builder.append(", msg);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("break;"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } else { - { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_ASYNC_IN("); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("((etPort*)&"); - String _path_15 = ai_1.getPath(); - String _pathName_13 = this._roomExtensions.getPathName(_path_15); - _builder.append(_pathName_13, "\t\t\t\t"); - _builder.append("_const."); - String _name_30 = pi_2.getName(); - _builder.append(_name_30, "\t\t\t\t"); - _builder.append(")->peerInstName,"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - ProtocolClass _protocol_9 = pi_2.getProtocol(); - String _name_31 = _protocol_9.getName(); - _builder.append(_name_31, "\t\t\t\t"); - _builder.append("_getMessageString(msg->evtID),"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("((etPort*)&"); - String _path_16 = ai_1.getPath(); - String _pathName_14 = this._roomExtensions.getPathName(_path_16); - _builder.append(_pathName_14, "\t\t\t\t"); - _builder.append("_const."); - String _name_32 = pi_2.getName(); - _builder.append(_name_32, "\t\t\t\t"); - _builder.append(")->myInstName"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append(")"); - _builder.newLine(); - } - } - _builder.append("\t\t"); - _builder.append("\t"); - ActorClass _actorClass_6 = ai_1.getActorClass(); - String _name_33 = _actorClass_6.getName(); - _builder.append(_name_33, "\t\t\t"); - _builder.append("_receiveMessage((void*)&"); - String _path_17 = ai_1.getPath(); - String _pathName_15 = this._roomExtensions.getPathName(_path_17); - _builder.append(_pathName_15, "\t\t\t"); - _builder.append(",(etPort*)&"); - String _path_18 = ai_1.getPath(); - String _pathName_16 = this._roomExtensions.getPathName(_path_18); - _builder.append(_pathName_16, "\t\t\t"); - _builder.append("_const."); - String _name_34 = pi_2.getName(); - _builder.append(_name_34, "\t\t\t"); - _builder.append(", msg);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("break;"); - _builder.newLine(); - } - } - } - } - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("default:"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("etLogger_logErrorF(\"MessageService_"); - String _name_35 = thread.getName(); - _builder.append(_name_35, "\t\t\t"); - _builder.append("_receiveMessage: address %d does not exist \", msg->address);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("break;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("return ET_TRUE;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private String createLoggerCall(final PortInstance pi) { - String _xblockexpression = null; - { - ProtocolClass _protocol = pi.getProtocol(); - EList _incomingMessages = _protocol.getIncomingMessages(); - final Function1 _function = (Message m) -> { - return Boolean.valueOf(((!Objects.equal(m.getData(), null)) && this._typeHelpers.isEnumerationOrPrimitive(m.getData().getRefType().getType()))); - }; - Iterable _filter = IterableExtensions.filter(_incomingMessages, _function); - final Message msg = ((Message[])Conversions.unwrapArray(_filter, Message.class))[0]; - EObject _eContainer = pi.eContainer(); - final ActorInstance ai = ((ActorInstance) _eContainer); - String _path = ai.getPath(); - String _pathName = this._roomExtensions.getPathName(_path); - String _plus = (_pathName + "."); - String _name = pi.getName(); - String _plus_1 = (_plus + _name); - String _plus_2 = (_plus_1 + "."); - String _name_1 = msg.getName(); - final String data = (_plus_2 + _name_1); - LiteralType _xifexpression = null; - VarDecl _data = msg.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - if ((_type instanceof EnumerationType)) { - _xifexpression = LiteralType.INT; - } else { - VarDecl _data_1 = msg.getData(); - RefableType _refType_1 = _data_1.getRefType(); - DataType _type_1 = _refType_1.getType(); - _xifexpression = ((PrimitiveType) _type_1).getType(); - } - final LiteralType type = _xifexpression; - String _switchResult = null; - if (type != null) { - switch (type) { - case BOOL: - _switchResult = (("ET_DATA_LOGGER_LOG_BOOL((int)" + data) + ")"); - break; - case CHAR: - _switchResult = (("ET_DATA_LOGGER_LOG_INT((int)" + data) + ")"); - break; - case INT: - _switchResult = (("ET_DATA_LOGGER_LOG_INT((int)" + data) + ")"); - break; - case REAL: - _switchResult = (("ET_DATA_LOGGER_LOG_DOUBLE((double)" + data) + ")"); - break; - default: - _switchResult = "internal error: unknown primitive type"; - break; - } - } else { - _switchResult = "internal error: unknown primitive type"; - } - _xblockexpression = _switchResult; - } - return _xblockexpression; - } - - private ArrayList loggedPorts(final SubSystemInstance ssi) { - final ArrayList result = CollectionLiterals.newArrayList(); - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - EList _annotations = _subSystemClass.getAnnotations(); - boolean _isAnnotationPresent = this._roomHelpers.isAnnotationPresent(_annotations, "DataLogging"); - if (_isAnnotationPresent) { - this.logger.logInfo("Data Logging is configured by annotation"); - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - EList _annotations_1 = _subSystemClass_1.getAnnotations(); - final String filters = this._roomHelpers.getAttribute(_annotations_1, "DataLogging", "pathlist"); - final String[] filterList = filters.split(","); - for (final String filter : filterList) { - this.logger.logInfo((" filter: " + filter)); - } - final ArrayList notLogged = CollectionLiterals.newArrayList(); - this.logger.logInfo(" logged ports:"); - TreeIterator iter = ssi.eAllContents(); - while (iter.hasNext()) { - { - final EObject obj = iter.next(); - if ((obj instanceof PortInstance)) { - final PortInstance pi = ((PortInstance) obj); - Port _port = pi.getPort(); - boolean _isRelay = this._roomHelpers.isRelay(_port); - boolean _not = (!_isRelay); - if (_not) { - ProtocolClass _protocol = pi.getProtocol(); - CommunicationType _commType = _protocol.getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN); - if (_equals) { - Port _port_1 = pi.getPort(); - boolean _isConjugated = _port_1.isConjugated(); - if (_isConjugated) { - final String path = pi.getPath(); - boolean matched = false; - boolean primitive = false; - for (final String filter_1 : filterList) { - boolean _matches = path.matches(filter_1); - if (_matches) { - matched = true; - ProtocolClass _protocol_1 = pi.getProtocol(); - EList _incomingMessages = _protocol_1.getIncomingMessages(); - final Function1 _function = (Message m) -> { - return Boolean.valueOf(((!Objects.equal(m.getData(), null)) && this._typeHelpers.isEnumerationOrPrimitive(m.getData().getRefType().getType()))); - }; - Iterable _filter = IterableExtensions.filter(_incomingMessages, _function); - boolean _isEmpty = IterableExtensions.isEmpty(_filter); - boolean _not_1 = (!_isEmpty); - if (_not_1) { - result.add(pi); - primitive = true; - String _path = pi.getPath(); - String _plus = (" data driven port " + _path); - String _plus_1 = (_plus + " (matched "); - String _plus_2 = (_plus_1 + filter_1); - String _plus_3 = (_plus_2 + ")"); - this.logger.logInfo(_plus_3); - } - } - } - if ((!primitive)) { - if (matched) { - String _path_1 = pi.getPath(); - String _plus_4 = (" data driven port " + _path_1); - String _plus_5 = (_plus_4 + " (matched but contains no primitive data)"); - notLogged.add(_plus_5); - } else { - String _path_2 = pi.getPath(); - String _plus_6 = (" data driven port " + _path_2); - String _plus_7 = (_plus_6 + " (no match found)"); - notLogged.add(_plus_7); - } - } - } else { - String _path_3 = pi.getPath(); - String _plus_8 = (" data driven port " + _path_3); - String _plus_9 = (_plus_8 + " (receive port)"); - notLogged.add(_plus_9); - } - } - } - } - } - } - this.logger.logInfo(" NOT logged ports:"); - for (final String nl : notLogged) { - this.logger.logInfo(nl); - } - } - return result; - } - - private void checkDataPorts(final SubSystemInstance comp) { - final HashSet found = new HashSet(); - EList _allContainedInstances = comp.getAllContainedInstances(); - for (final ActorInstance ai : _allContainedInstances) { - { - final int thread = ai.getThreadId(); - EList _orderedIfItemInstances = ai.getOrderedIfItemInstances(); - for (final InterfaceItemInstance pi : _orderedIfItemInstances) { - ProtocolClass _protocol = pi.getProtocol(); - CommunicationType _commType = _protocol.getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN); - if (_equals) { - EList _peers = pi.getPeers(); - for (final InterfaceItemInstance peer : _peers) { - { - EObject _eContainer = peer.eContainer(); - final ActorInstance peer_ai = ((ActorInstance) _eContainer); - final int peer_thread = peer_ai.getThreadId(); - if ((thread != peer_thread)) { - final String path = pi.getPath(); - final String ppath = peer.getPath(); - String _xifexpression = null; - int _compareTo = path.compareTo(ppath); - boolean _lessThan = (_compareTo < 0); - if (_lessThan) { - _xifexpression = ((path + " and ") + ppath); - } else { - _xifexpression = ((ppath + " and ") + path); - } - final String pair = _xifexpression; - boolean _contains = found.contains(pair); - boolean _not = (!_contains); - if (_not) { - found.add(pair); - InterfaceItem _interfaceItem = pi.getInterfaceItem(); - InterfaceItem _interfaceItem_1 = pi.getInterfaceItem(); - EStructuralFeature _eContainingFeature = _interfaceItem_1.eContainingFeature(); - this.diagnostician.error((pair + ": data ports placed on different threads (not supported yet)"), _interfaceItem, _eContainingFeature); - } - } - } - } - } - } - } - } - } -} diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java deleted file mode 100644 index 57ec2e878..000000000 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java +++ /dev/null @@ -1,273 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Thomas Schuetz (changed for C code generator) - */ -package org.eclipse.etrice.generator.c.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.Collection; -import java.util.List; -import org.eclipse.etrice.core.common.base.util.BaseHelpers; -import org.eclipse.etrice.core.etmap.util.ETMapUtil; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; -import org.eclipse.etrice.generator.c.Main; -import org.eclipse.etrice.generator.c.gen.CExtensions; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.generator.JavaIoFileSystemAccess; -import org.eclipse.xtext.xbase.lib.Extension; - -@Singleton -@SuppressWarnings("all") -public class NodeRunnerGen { - @Inject - @Extension - private BaseHelpers _baseHelpers; - - @Inject - @Extension - private JavaIoFileSystemAccess fileAccess; - - @Inject - @Extension - private CExtensions _cExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - public void doGenerate(final Root root) { - boolean first = true; - Collection _nodeRefs = ETMapUtil.getNodeRefs(); - for (final NodeRef nr : _nodeRefs) { - List _subSystemInstancePaths = ETMapUtil.getSubSystemInstancePaths(nr); - for (final String instpath : _subSystemInstancePaths) { - { - StructureInstance _instance = root.getInstance(instpath); - final SubSystemInstance ssi = ((SubSystemInstance) _instance); - boolean _notEquals = (!Objects.equal(ssi, null)); - if (_notEquals) { - String _name = nr.getName(); - String _plus = (_name + "_"); - String _name_1 = ssi.getName(); - final String clsname = (_plus + _name_1); - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass); - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - String _path = this._roomExtensions.getPath(_subSystemClass_1); - String _plus_1 = (_generationTargetPath + _path); - this.fileAccess.setOutputPath(_plus_1); - CharSequence _generateSourceFile = this.generateSourceFile(root, ssi, first); - this.fileAccess.generateFile((clsname + "_Runner.c"), _generateSourceFile); - first = false; - } - } - } - } - } - - public CharSequence generateSourceFile(final Root root, final SubSystemInstance ssi, final boolean first) { - CharSequence _xblockexpression = null; - { - final NodeRef nr = ETMapUtil.getNodeRef(ssi); - String _name = nr.getName(); - String _plus = (_name + "_"); - String _name_1 = ssi.getName(); - final String clsname = (_plus + _name_1); - final boolean logData = (Main.getSettings().isGenerateDataInstrumentation() && this._baseHelpers.isAnnotationPresent(ssi.getSubSystemClass().getAnnotations(), "DataLogging")); - 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("* this class contains the main function running Node "); - String _name_2 = nr.getName(); - _builder.append(_name_2, " "); - _builder.append(" with SubSystem "); - String _name_3 = ssi.getName(); - _builder.append(_name_3, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* it instantiates Node "); - String _name_4 = nr.getName(); - _builder.append(_name_4, " "); - _builder.append(" with SubSystem "); - String _name_5 = ssi.getName(); - _builder.append(_name_5, " "); - _builder.append(" and starts and ends the lifecycle"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include "); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \""); - String _cHeaderFileName = this._cExtensions.getCHeaderFileName(nr, ssi); - _builder.append(_cHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"debugging/etLogger.h\""); - _builder.newLine(); - _builder.append("#include \"debugging/etMSCLogger.h\""); - _builder.newLine(); - _builder.append("#include \"debugging/etDataLogger.h\""); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \"osal/etPlatformLifecycle.h\""); - _builder.newLine(); - _builder.newLine(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* "); - GlobalGeneratorSettings _settings = Main.getSettings(); - String _mainMethodName = _settings.getMainMethodName(); - _builder.append(_mainMethodName, " "); - _builder.append(" function"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* creates components and starts and stops the lifecycle"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("int "); - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - String _mainMethodName_1 = _settings_1.getMainMethodName(); - _builder.append(_mainMethodName_1, ""); - _builder.append("(int argc, char** argv) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("etBool runAsTest = ET_FALSE;"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#ifdef ET_DO_NOT_USE_ARGC_ARGV"); - _builder.newLine(); - _builder.append("#else"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("if (argc>1 && strcmp(argv[1], \"-headless\")==0)"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("runAsTest = ET_TRUE;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("if (argc>1 && strcmp(argv[1], \"-run_as_test\")==0)"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("runAsTest = ET_TRUE;"); - _builder.newLine(); - _builder.append("#endif\t\t"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("etUserEntry(); /* platform specific */"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("etLogger_logInfo(\"*** T H E B E G I N ***\");"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_OPEN(\"main\");"); - _builder.newLine(); - { - if (logData) { - _builder.append("\t"); - _builder.append("ET_DATA_LOGGER_OPEN(\"main\");"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* startup sequence of lifecycle */"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_init(); \t\t/* lifecycle init */"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_start(); \t/* lifecycle start */"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("etUserPreRun(); /* platform specific */"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* run Scheduler */"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_run(runAsTest);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("etUserPostRun(); /* platform specific */"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* shutdown sequence of lifecycle */"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_stop(); \t\t/* lifecycle stop */"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("_destroy(); \t/* lifecycle destroy */"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - if (logData) { - _builder.append("\t"); - _builder.append("ET_DATA_LOGGER_CLOSE"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_CLOSE"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("etLogger_logInfo(\"*** T H E E N D ***\");"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("etUserExit(); /* platform specific */"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("return 0;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} 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 deleted file mode 100644 index 7252d6dc7..000000000 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java +++ /dev/null @@ -1,1532 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Thomas Schuetz (changed for C code generator) - */ -package org.eclipse.etrice.generator.c.gen; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -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.EnumerationType; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.MessageHandler; -import org.eclipse.etrice.core.room.Operation; -import org.eclipse.etrice.core.room.PortClass; -import org.eclipse.etrice.core.room.PortOperation; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.generator.base.AbstractGenerator; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; -import org.eclipse.etrice.generator.c.Main; -import org.eclipse.etrice.generator.c.gen.CExtensions; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -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.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; - -@Singleton -@SuppressWarnings("all") -public class ProtocolClassGen extends GenericProtocolClassGenerator { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private CExtensions _cExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private ProcedureHelpers _procedureHelpers; - - @Inject - @Extension - private TypeHelpers _typeHelpers; - - @Inject - private ILogger logger; - - public void doGenerate(final Root root) { - EList _protocolClasses = root.getProtocolClasses(); - for (final ProtocolClass pc : _protocolClasses) { - { - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(pc); - String _path = this._roomExtensions.getPath(pc); - final String path = (_generationTargetPath + _path); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(pc); - String _path_1 = this._roomExtensions.getPath(pc); - final String infopath = (_generationInfoPath + _path_1); - String file = this._cExtensions.getCHeaderFileName(pc); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, pc); - this.fileIO.generateFile("generating ProtocolClass header", path, infopath, file, _generateHeaderFile); - String _cUtilsFileName = this._cExtensions.getCUtilsFileName(pc); - file = _cUtilsFileName; - CharSequence _generateUtilsFile = this.generateUtilsFile(root, pc); - this.fileIO.generateFile("generating ProtocolClass utils", path, infopath, file, _generateUtilsFile); - String _cSourceFileName = this._cExtensions.getCSourceFileName(pc); - file = _cSourceFileName; - CharSequence _generateSourceFile = this.generateSourceFile(root, pc); - this.fileIO.generateFile("generating ProtocolClass source", path, infopath, file, _generateSourceFile); - } - } - } - - private CharSequence 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(); - CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(pc); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"etDatatypes.h\""); - _builder.newLine(); - _builder.append("#include \"modelbase/etPort.h\""); - _builder.newLine(); - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(pc, 1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - EList _referencedProtocolClasses = root.getReferencedProtocolClasses(pc); - for(final ProtocolClass protocolClass : _referencedProtocolClasses) { - _builder.append("#include "); - String _includePath = this._cExtensions.getIncludePath(protocolClass); - _builder.append(_includePath, ""); - _builder.newLineIfNotEmpty(); - } - } - { - EList _referencedDataClasses = root.getReferencedDataClasses(pc); - for(final DataClass dataClass : _referencedDataClasses) { - _builder.append("#include "); - String _includePath_1 = this._cExtensions.getIncludePath(dataClass); - _builder.append(_includePath_1, ""); - _builder.newLineIfNotEmpty(); - } - } - { - EList _referencedEnumClasses = root.getReferencedEnumClasses(pc); - for(final EnumerationType enumClass : _referencedEnumClasses) { - _builder.append("#include "); - String _includePath_2 = this._cExtensions.getIncludePath(enumClass); - _builder.append(_includePath_2, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - CommunicationType _commType = pc.getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.EVENT_DRIVEN); - if (_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(); - CharSequence _portClassHeader = this.portClassHeader(pc, Boolean.valueOf(false)); - _builder.append(_portClassHeader, ""); - _builder.newLineIfNotEmpty(); - CharSequence _portClassHeader_1 = this.portClassHeader(pc, Boolean.valueOf(true)); - _builder.append(_portClassHeader_1, ""); - _builder.newLineIfNotEmpty(); - } else { - CommunicationType _commType_1 = pc.getCommType(); - boolean _equals_1 = Objects.equal(_commType_1, CommunicationType.DATA_DRIVEN); - if (_equals_1) { - _builder.append("/*--------------------- port structs and methods */"); - _builder.newLine(); - CharSequence _genDataDrivenPortHeaders = this.genDataDrivenPortHeaders(pc); - _builder.append(_genDataDrivenPortHeaders, ""); - _builder.newLineIfNotEmpty(); - } else { - CommunicationType _commType_2 = pc.getCommType(); - boolean _equals_2 = Objects.equal(_commType_2, CommunicationType.SYNCHRONOUS); - if (_equals_2) { - _builder.append("#error \"synchronoue protocols not implemented yet\""); - _builder.newLine(); - } - } - } - } - _builder.newLine(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("/*--------------------- debug helpers */"); - _builder.newLine(); - _builder.newLine(); - _builder.append("/* get message string for message id */"); - _builder.newLine(); - _builder.append("const char* "); - String _name_1 = pc.getName(); - _builder.append(_name_1, ""); - _builder.append("_getMessageString(int msg_id);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - CharSequence _userCode_1 = this._procedureHelpers.userCode(pc, 2); - _builder.append(_userCode_1, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(pc); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - return _builder; - } - - private CharSequence generateUtilsFile(final Root root, final ProtocolClass pc) { - CharSequence _xblockexpression = null; - { - EObject _eContainer = pc.eContainer(); - String _name = ((RoomModel) _eContainer).getName(); - String _replaceAll = _name.replaceAll("\\.", "_"); - String _plus = (_replaceAll + "_"); - String _name_1 = pc.getName(); - String _plus_1 = (_plus + _name_1); - final String filename = (_plus_1 + "_Utils"); - 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("* Utils File of ProtocolClass "); - String _name_2 = pc.getName(); - _builder.append(_name_2, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* "); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateIncludeGuardBegin = this._cExtensions.generateIncludeGuardBegin(filename); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - ProtocolClass _base = pc.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - _builder.append("// include base class utils"); - _builder.newLine(); - _builder.append("#include "); - ProtocolClass _base_1 = pc.getBase(); - String _utilsIncludePath = this._cExtensions.getUtilsIncludePath(_base_1); - _builder.append(_utilsIncludePath, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - } - } - _builder.append("#include "); - String _includePath = this._cExtensions.getIncludePath(pc); - _builder.append(_includePath, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* access macros for operations and attributes"); - _builder.newLine(); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateUtilsFile = this.generateUtilsFile(pc, false); - _builder.append(_generateUtilsFile, ""); - _builder.newLineIfNotEmpty(); - CharSequence _generateUtilsFile_1 = this.generateUtilsFile(pc, true); - _builder.append(_generateUtilsFile_1, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cExtensions.generateIncludeGuardEnd(filename); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence generateUtilsFile(final ProtocolClass pc, final boolean conj) { - CharSequence _xblockexpression = null; - { - final PortClass portClass = this._roomExtensions.getPortClass(pc, conj); - final String portClassName = this._roomExtensions.getPortClassName(pc, conj); - StringConcatenation _builder = new StringConcatenation(); - { - boolean _notEquals = (!Objects.equal(portClass, null)); - if (_notEquals) { - _builder.append("/* "); - { - if (conj) { - _builder.append("conjugate"); - } else { - _builder.append("regular"); - } - } - _builder.append(" port class */"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* operations */"); - _builder.newLine(); - { - EList _operations = portClass.getOperations(); - for(final PortOperation op : _operations) { - final CharSequence args = this.argList(op); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _name = op.getName(); - _builder.append(_name, ""); - _builder.append("("); - _builder.append(args, ""); - _builder.append(") "); - _builder.append(portClassName, ""); - _builder.append("_"); - String _name_1 = op.getName(); - _builder.append(_name_1, ""); - _builder.append("(self"); - { - EList _arguments = op.getArguments(); - boolean _isEmpty = _arguments.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append(", "); - _builder.append(args, ""); - } - } - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* attributes */"); - _builder.newLine(); - { - EList _attributes = portClass.getAttributes(); - for(final Attribute a : _attributes) { - _builder.append("#define "); - String _name_2 = a.getName(); - _builder.append(_name_2, ""); - _builder.append(" ((("); - _builder.append(portClassName, ""); - _builder.append("_var*)(self->varData))->"); - String _name_3 = a.getName(); - _builder.append(_name_3, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence argList(final Operation op) { - StringConcatenation _builder = new StringConcatenation(); - { - EList _arguments = op.getArguments(); - boolean _hasElements = false; - for(final VarDecl a : _arguments) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - String _name = a.getName(); - _builder.append(_name, ""); - } - } - return _builder; - } - - private CharSequence 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._cExtensions.getCHeaderFileName(pc); - _builder.append(_cHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.append("#include \"debugging/etMSCLogger.h\""); - _builder.newLine(); - _builder.append("#include \""); - String _cUtilsFileName = this._cExtensions.getCUtilsFileName(pc); - _builder.append(_cUtilsFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(pc, 3); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/*--------------------- port methods */"); - _builder.newLine(); - { - CommunicationType _commType = pc.getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.EVENT_DRIVEN); - if (_equals) { - CharSequence _portClassSource = this.portClassSource(pc, Boolean.valueOf(false)); - _builder.append(_portClassSource, ""); - _builder.newLineIfNotEmpty(); - CharSequence _portClassSource_1 = this.portClassSource(pc, Boolean.valueOf(true)); - _builder.append(_portClassSource_1, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("/*--------------------- debug helpers */"); - _builder.newLine(); - CharSequence _generateDebugHelpersImplementation = this.generateDebugHelpersImplementation(root, pc); - _builder.append(_generateDebugHelpersImplementation, ""); - _builder.newLineIfNotEmpty(); - } - } - } else { - CommunicationType _commType_1 = pc.getCommType(); - boolean _equals_1 = Objects.equal(_commType_1, CommunicationType.DATA_DRIVEN); - if (_equals_1) { - CharSequence _genDataDrivenPortSources = this.genDataDrivenPortSources(pc); - _builder.append(_genDataDrivenPortSources, ""); - _builder.newLineIfNotEmpty(); - } else { - CommunicationType _commType_2 = pc.getCommType(); - boolean _equals_2 = Objects.equal(_commType_2, CommunicationType.SYNCHRONOUS); - if (_equals_2) { - _builder.append("#error \"synchronous protocols not implemented yet\""); - _builder.newLine(); - } - } - } - } - return _builder; - } - - private CharSequence portClassHeader(final ProtocolClass pc, final Boolean conj) { - CharSequence _xblockexpression = null; - { - String portClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue()); - String replPortClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue(), true); - List _xifexpression = null; - if ((conj).booleanValue()) { - _xifexpression = this._roomHelpers.getAllIncomingMessages(pc); - } else { - _xifexpression = this._roomHelpers.getAllOutgoingMessages(pc); - } - List messages = _xifexpression; - final List allPortClasses = this._roomExtensions.getAllPortClasses(pc, (conj).booleanValue()); - final Function1> _function = (PortClass p) -> { - return p.getAttributes(); - }; - List> _map = ListExtensions.>map(allPortClasses, _function); - Iterable _flatten = Iterables.concat(_map); - final List allAttributes = IterableExtensions.toList(_flatten); - final Function1> _function_1 = (PortClass p) -> { - return p.getOperations(); - }; - List> _map_1 = ListExtensions.>map(allPortClasses, _function_1); - Iterable _flatten_1 = Iterables.concat(_map_1); - final List allOperations = IterableExtensions.toList(_flatten_1); - 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(); - { - boolean _isEmpty = allAttributes.isEmpty(); - boolean _not = (!_isEmpty); - if (_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"); - CharSequence _attributes = this._procedureHelpers.attributes(allAttributes); - _builder.append(_attributes, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("};"); - _builder.newLine(); - { - for(final Attribute a : allAttributes) { - { - String _defaultValueLiteral = a.getDefaultValueLiteral(); - boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); - if (_notEquals) { - String _name = a.getName(); - String _plus = ((portClassName + " ") + _name); - String _plus_1 = (_plus + ": Attribute initialization not supported in C"); - this.logger.logInfo(_plus_1); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - _builder.newLine(); - { - for(final Message message : messages) { - VarDecl _data = message.getData(); - boolean hasData = (!Objects.equal(_data, null)); - _builder.newLineIfNotEmpty(); - String _xifexpression_1 = null; - if (hasData) { - VarDecl _data_1 = message.getData(); - RefableType _refType = _data_1.getRefType(); - DataType _type = _refType.getType(); - _xifexpression_1 = this._typeHelpers.typeName(_type); - } else { - _xifexpression_1 = ""; - } - String typeName = _xifexpression_1; - _builder.newLineIfNotEmpty(); - String _xifexpression_2 = null; - if ((hasData && ((!this._typeHelpers.isEnumerationOrPrimitive(message.getData().getRefType().getType())) || message.getData().getRefType().isRef()))) { - _xifexpression_2 = "*"; - } else { - _xifexpression_2 = ""; - } - String refp = _xifexpression_2; - _builder.newLineIfNotEmpty(); - String _xifexpression_3 = null; - if (hasData) { - _xifexpression_3 = (((", " + typeName) + refp) + " data"); - } 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 _messageSignature_2 = this.messageSignature(replPortClassName, _name_3, "", (", int idx" + data)); - _builder.append(_messageSignature_2, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - boolean _isEmpty_1 = allOperations.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - CharSequence _operationsDeclaration = this._procedureHelpers.operationsDeclaration(allOperations, portClassName); - _builder.append(_operationsDeclaration, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - boolean _handlesReceiveIncludingSuper = this._roomExtensions.handlesReceiveIncludingSuper(pc, (conj).booleanValue()); - if (_handlesReceiveIncludingSuper) { - { - List _receiveHandlersIncludingSuper = this._roomExtensions.getReceiveHandlersIncludingSuper(pc, (conj).booleanValue()); - for(final MessageHandler h : _receiveHandlersIncludingSuper) { - _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(); - } - } - } - } - _builder.append("etInt32 "); - _builder.append(replPortClassName, ""); - _builder.append("_getReplication(const "); - _builder.append(replPortClassName, ""); - _builder.append("* self);"); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence genDataDrivenPortHeaders(final ProtocolClass pc) { - CharSequence _xblockexpression = null; - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - final Function1 _function = (Message m) -> { - VarDecl _data = m.getData(); - return Boolean.valueOf((!Objects.equal(_data, null))); - }; - Iterable sentMsgs = IterableExtensions.filter(_allIncomingMessages, _function); - final Function1 _function_1 = (Message m) -> { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - return Boolean.valueOf(this._typeHelpers.isEnumeration(_type)); - }; - final Iterable enumMsgs = IterableExtensions.filter(sentMsgs, _function_1); - final Function1 _function_2 = (Message m) -> { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - return Boolean.valueOf(this._typeHelpers.isBoolean(_type)); - }; - final Iterable boolMsgs = IterableExtensions.filter(sentMsgs, _function_2); - final boolean usesMSC = (Main.getSettings().isGenerateMSCInstrumentation() && (!(IterableExtensions.isEmpty(enumMsgs) && IterableExtensions.isEmpty(boolMsgs)))); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/* data driven send port (conjugated) */"); - _builder.newLine(); - _builder.append("typedef struct "); - String _portClassName = this._roomExtensions.getPortClassName(pc, true); - _builder.append(_portClassName, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - { - 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); - _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, "\t"); - _builder.append(refp, "\t"); - _builder.append(" "); - String _name = msg.getName(); - _builder.append(_name, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - { - if (usesMSC) { - _builder.append("\t"); - _builder.append("#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("const char* instName;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("const char** peerNames;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#endif"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - String _portClassName_1 = this._roomExtensions.getPortClassName(pc, true); - _builder.append(_portClassName_1, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* data driven receive port (regular) */"); - _builder.newLine(); - _builder.append("typedef struct "); - String _portClassName_2 = this._roomExtensions.getPortClassName(pc, false); - _builder.append(_portClassName_2, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("const "); - String _portClassName_3 = this._roomExtensions.getPortClassName(pc, true); - _builder.append(_portClassName_3, "\t"); - _builder.append("* peer;"); - _builder.newLineIfNotEmpty(); - { - if (usesMSC) { - _builder.append("\t"); - _builder.append("#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("const char* instName;"); - _builder.newLine(); - { - for(final Message msg_1 : enumMsgs) { - _builder.append("\t"); - _builder.append("\t"); - VarDecl _data_2 = msg_1.getData(); - RefableType _refType_2 = _data_2.getRefType(); - DataType _type_1 = _refType_2.getType(); - String typeName_1 = this._typeHelpers.typeName(_type_1); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - String _xifexpression_1 = null; - VarDecl _data_3 = msg_1.getData(); - RefableType _refType_3 = _data_3.getRefType(); - boolean _isRef_1 = _refType_3.isRef(); - if (_isRef_1) { - _xifexpression_1 = "*"; - } else { - _xifexpression_1 = ""; - } - String refp_1 = _xifexpression_1; - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append(typeName_1, "\t\t"); - _builder.append(refp_1, "\t\t"); - _builder.append(" "); - String _name_1 = msg_1.getName(); - _builder.append(_name_1, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - { - for(final Message msg_2 : boolMsgs) { - _builder.append("\t"); - _builder.append("\t"); - VarDecl _data_4 = msg_2.getData(); - RefableType _refType_4 = _data_4.getRefType(); - DataType _type_2 = _refType_4.getType(); - String typeName_2 = this._typeHelpers.typeName(_type_2); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - String _xifexpression_2 = null; - VarDecl _data_5 = msg_2.getData(); - RefableType _refType_5 = _data_5.getRefType(); - boolean _isRef_2 = _refType_5.isRef(); - if (_isRef_2) { - _xifexpression_2 = "*"; - } else { - _xifexpression_2 = ""; - } - String refp_2 = _xifexpression_2; - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append(typeName_2, "\t\t"); - _builder.append(refp_2, "\t\t"); - _builder.append(" "); - String _name_2 = msg_2.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("#endif"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - String _portClassName_4 = this._roomExtensions.getPortClassName(pc, false); - _builder.append(_portClassName_4, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - for(final Message message : sentMsgs) { - VarDecl _data_6 = message.getData(); - boolean hasData = (!Objects.equal(_data_6, null)); - _builder.newLineIfNotEmpty(); - String _xifexpression_3 = null; - if (hasData) { - VarDecl _data_7 = message.getData(); - RefableType _refType_6 = _data_7.getRefType(); - DataType _type_3 = _refType_6.getType(); - _xifexpression_3 = this._typeHelpers.typeName(_type_3); - } else { - _xifexpression_3 = ""; - } - String typeName_3 = _xifexpression_3; - _builder.newLineIfNotEmpty(); - String _xifexpression_4 = null; - if ((hasData && (!this._typeHelpers.isEnumerationOrPrimitive(message.getData().getRefType().getType())))) { - _xifexpression_4 = "*"; - } else { - _xifexpression_4 = ""; - } - String refp_3 = _xifexpression_4; - _builder.newLineIfNotEmpty(); - String _xifexpression_5 = null; - if (hasData) { - _xifexpression_5 = (((", " + typeName_3) + refp_3) + " data"); - } else { - _xifexpression_5 = ""; - } - String data = _xifexpression_5; - _builder.newLineIfNotEmpty(); - String _portClassName_5 = this._roomExtensions.getPortClassName(pc, true); - String _name_3 = message.getName(); - String _messageSetterSignature = this.messageSetterSignature(_portClassName_5, _name_3, data); - _builder.append(_messageSetterSignature, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - String _portClassName_6 = this._roomExtensions.getPortClassName(pc, false); - String _name_4 = message.getName(); - String _messageGetterSignature = this.messageGetterSignature(_portClassName_6, _name_4, typeName_3); - _builder.append(_messageGetterSignature, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence genDataDrivenPortSources(final ProtocolClass pc) { - CharSequence _xblockexpression = null; - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - final Function1 _function = (Message m) -> { - VarDecl _data = m.getData(); - return Boolean.valueOf((!Objects.equal(_data, null))); - }; - Iterable messages = IterableExtensions.filter(_allIncomingMessages, _function); - final Function1 _function_1 = (Message m) -> { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - return Boolean.valueOf(this._typeHelpers.isEnumeration(_type)); - }; - final Iterable enumMsgs = IterableExtensions.filter(messages, _function_1); - final Function1 _function_2 = (Message m) -> { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - return Boolean.valueOf(this._typeHelpers.isBoolean(_type)); - }; - final Iterable boolMsgs = IterableExtensions.filter(messages, _function_2); - final boolean usesMSC = (Main.getSettings().isGenerateMSCInstrumentation() && (!(IterableExtensions.isEmpty(enumMsgs) && IterableExtensions.isEmpty(boolMsgs)))); - 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); - _builder.newLineIfNotEmpty(); - String _xifexpression = null; - VarDecl _data_1 = message.getData(); - RefableType _refType_1 = _data_1.getRefType(); - DataType _type_1 = _refType_1.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1); - boolean _not = (!_isEnumerationOrPrimitive); - if (_not) { - _xifexpression = "*"; - } else { - _xifexpression = ""; - } - String refp = _xifexpression; - _builder.newLineIfNotEmpty(); - String data = (((", " + typeName) + refp) + " data"); - _builder.newLineIfNotEmpty(); - String _portClassName = this._roomExtensions.getPortClassName(pc, true); - String _name = message.getName(); - String _messageSetterSignature = this.messageSetterSignature(_portClassName, _name, data); - _builder.append(_messageSetterSignature, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - { - if ((usesMSC && IterableExtensions.exists(enumMsgs, ((Function1) (Message m) -> { - return Boolean.valueOf(Objects.equal(m, message)); - })))) { - _builder.append("\t"); - _builder.append("#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("const char** peerName;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("for (peerName=self->peerNames; *peerName!=NULL; ++peerName) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t\t"); - _builder.append("ET_MSC_LOGGER_ASYNC_OUT(self->instName, "); - VarDecl _data_2 = message.getData(); - RefableType _refType_2 = _data_2.getRefType(); - DataType _type_2 = _refType_2.getType(); - String _name_1 = _type_2.getName(); - _builder.append(_name_1, "\t\t\t\t"); - _builder.append("_getLiteralName(data), *peerName)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t\t\t"); - _builder.append("ET_MSC_LOGGER_ASYNC_IN(self->instName, "); - VarDecl _data_3 = message.getData(); - RefableType _refType_3 = _data_3.getRefType(); - DataType _type_3 = _refType_3.getType(); - String _name_2 = _type_3.getName(); - _builder.append(_name_2, "\t\t\t\t"); - _builder.append("_getLiteralName(data), *peerName)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#endif"); - _builder.newLine(); - } - } - { - if ((usesMSC && IterableExtensions.exists(boolMsgs, ((Function1) (Message m) -> { - return Boolean.valueOf(Objects.equal(m, message)); - })))) { - _builder.append("\t"); - _builder.append("#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("const char** peerName;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("for (peerName=self->peerNames; *peerName!=NULL; ++peerName) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t\t"); - _builder.append("ET_MSC_LOGGER_ASYNC_OUT(self->instName, data?\"true\":\"false\", *peerName)"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t\t"); - _builder.append("ET_MSC_LOGGER_ASYNC_IN(self->instName, data?\"true\":\"false\", *peerName)"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#endif"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("self->"); - String _name_3 = message.getName(); - _builder.append(_name_3, "\t"); - _builder.append(" = "); - _builder.append(refp, "\t"); - _builder.append("data;"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - String _portClassName_1 = this._roomExtensions.getPortClassName(pc, false); - String _name_4 = message.getName(); - String _messageGetterSignature = this.messageGetterSignature(_portClassName_1, _name_4, typeName); - _builder.append(_messageGetterSignature, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("return self->peer->"); - String _name_5 = message.getName(); - _builder.append(_name_5, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence portClassSource(final ProtocolClass pc, final Boolean conj) { - CharSequence _xblockexpression = null; - { - final List allPortClasses = this._roomExtensions.getAllPortClasses(pc, (conj).booleanValue()); - final String portClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue()); - final String replPortClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue(), true); - List _xifexpression = null; - if ((conj).booleanValue()) { - _xifexpression = this._roomHelpers.getAllIncomingMessages(pc); - } else { - _xifexpression = this._roomHelpers.getAllOutgoingMessages(pc); - } - final List messages = _xifexpression; - String _xifexpression_1 = null; - if ((conj).booleanValue()) { - _xifexpression_1 = "IN_"; - } else { - _xifexpression_1 = "OUT_"; - } - final String dir = _xifexpression_1; - StringConcatenation _builder = new StringConcatenation(); - { - for(final Message message : messages) { - VarDecl _data = message.getData(); - boolean hasData = (!Objects.equal(_data, null)); - _builder.newLineIfNotEmpty(); - String _xifexpression_2 = null; - if (hasData) { - VarDecl _data_1 = message.getData(); - RefableType _refType = _data_1.getRefType(); - DataType _type = _refType.getType(); - _xifexpression_2 = this._typeHelpers.typeName(_type); - } else { - _xifexpression_2 = ""; - } - String typeName = _xifexpression_2; - _builder.newLineIfNotEmpty(); - String _xifexpression_3 = null; - if ((hasData && message.getData().getRefType().isRef())) { - _xifexpression_3 = "*"; - } else { - _xifexpression_3 = ""; - } - String refp = _xifexpression_3; - _builder.newLineIfNotEmpty(); - String _xifexpression_4 = null; - if ((hasData && ((!this._typeHelpers.isEnumerationOrPrimitive(message.getData().getRefType().getType())) || message.getData().getRefType().isRef()))) { - _xifexpression_4 = "*"; - } else { - _xifexpression_4 = ""; - } - String refpd = _xifexpression_4; - _builder.newLineIfNotEmpty(); - String _xifexpression_5 = null; - if (((hasData && (!this._typeHelpers.isEnumerationOrPrimitive(message.getData().getRefType().getType()))) && (!message.getData().getRefType().isRef()))) { - _xifexpression_5 = ""; - } else { - _xifexpression_5 = "&"; - } - String refa = _xifexpression_5; - _builder.newLineIfNotEmpty(); - String _xifexpression_6 = null; - if (hasData) { - _xifexpression_6 = (((", " + typeName) + refpd) + " data__et"); - } else { - _xifexpression_6 = ""; - } - String data = _xifexpression_6; - _builder.newLineIfNotEmpty(); - String _xifexpression_7 = null; - if (hasData) { - _xifexpression_7 = ", data__et"; - } else { - _xifexpression_7 = ""; - } - String dataCall = _xifexpression_7; - _builder.newLineIfNotEmpty(); - MessageHandler hdlr = this._roomExtensions.getSendHandler(message, (conj).booleanValue()); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _name = message.getName(); - String _messageSignature = this.messageSignature(portClassName, _name, "", data); - _builder.append(_messageSignature, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - { - boolean _notEquals = (!Objects.equal(hdlr, null)); - if (_notEquals) { - _builder.append("\t"); - AbstractGenerator _instance = AbstractGenerator.getInstance(); - DetailCode _detailCode = hdlr.getDetailCode(); - String _translatedCode = _instance.getTranslatedCode(_detailCode); - _builder.append(_translatedCode, "\t"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(portClassName, "\t"); - _builder.append("\", \""); - String _name_1 = message.getName(); - _builder.append(_name_1, "\t"); - _builder.append("\")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - String _name_2 = pc.getName(); - String _name_3 = message.getName(); - String _plus = (dir + _name_3); - String _memberInUse = this._cExtensions.memberInUse(_name_2, _plus); - String _sendMessageCall = this.sendMessageCall(hasData, "self", _memberInUse, (typeName + refp), (refa + "data__et")); - _builder.append(_sendMessageCall, "\t\t"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_ASYNC_OUT(self->myInstName, \""); - String _name_4 = message.getName(); - _builder.append(_name_4, "\t\t"); - _builder.append("\", self->peerInstName)"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - String _name_5 = message.getName(); - String _messageSignature_1 = this.messageSignature(replPortClassName, _name_5, "_broadcast", data); - _builder.append(_messageSignature_1, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - { - boolean _notEquals_1 = (!Objects.equal(hdlr, null)); - if (_notEquals_1) { - _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, "\t\t"); - _builder.append("_"); - String _name_6 = message.getName(); - _builder.append(_name_6, "\t\t"); - _builder.append("(&((etReplPort*)self)->ports[i].port"); - _builder.append(dataCall, "\t\t"); - _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, "\t"); - _builder.append("\", \""); - String _name_7 = message.getName(); - _builder.append(_name_7, "\t"); - _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_8 = pc.getName(); - String _name_9 = message.getName(); - String _plus_1 = (dir + _name_9); - String _memberInUse_1 = this._cExtensions.memberInUse(_name_8, _plus_1); - String _sendMessageCall_1 = this.sendMessageCall(hasData, "(&((etReplPort*)self)->ports[i].port)", _memberInUse_1, (typeName + refp), (refa + "data__et")); - _builder.append(_sendMessageCall_1, "\t\t"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_ASYNC_OUT(((etReplPort*)self)->ports[i].port.myInstName, \""); - String _name_10 = message.getName(); - _builder.append(_name_10, "\t\t"); - _builder.append("\", ((etReplPort*)self)->ports[i].port.peerInstName)"); - _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_11 = message.getName(); - String _messageSignature_2 = this.messageSignature(replPortClassName, _name_11, "", (", int idx__et" + data)); - _builder.append(_messageSignature_2, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - { - boolean _notEquals_2 = (!Objects.equal(hdlr, null)); - if (_notEquals_2) { - _builder.append("\t"); - _builder.append(portClassName, "\t"); - _builder.append("_"); - String _name_12 = message.getName(); - _builder.append(_name_12, "\t"); - _builder.append("(&((etReplPort*)self)->ports[idx__et].port"); - _builder.append(dataCall, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); - _builder.append(replPortClassName, "\t"); - _builder.append("\", \""); - String _name_13 = message.getName(); - _builder.append(_name_13, "\t"); - _builder.append("\")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if (0<=idx__et && idx__et<((etReplPort*)self)->size) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - String _name_14 = pc.getName(); - String _name_15 = message.getName(); - String _plus_2 = (dir + _name_15); - String _memberInUse_2 = this._cExtensions.memberInUse(_name_14, _plus_2); - String _sendMessageCall_2 = this.sendMessageCall(hasData, "(&((etReplPort*)self)->ports[idx__et].port)", _memberInUse_2, (typeName + refp), (refa + "data__et")); - _builder.append(_sendMessageCall_2, "\t\t"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings_2 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_2) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_ASYNC_OUT(((etReplPort*)self)->ports[idx__et].port.myInstName, \""); - String _name_16 = message.getName(); - _builder.append(_name_16, "\t\t"); - _builder.append("\", ((etReplPort*)self)->ports[idx__et].port.peerInstName)"); - _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(); - } - } - { - boolean _isEmpty = allPortClasses.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append("/* begin "); - _builder.append(portClassName, ""); - _builder.append(" specific (including base classes) */"); - _builder.newLineIfNotEmpty(); - { - for(final PortClass p : allPortClasses) { - DetailCode _userCode = p.getUserCode(); - CharSequence _userCode_1 = this._procedureHelpers.userCode(_userCode); - _builder.append(_userCode_1, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - for(final PortClass p_1 : allPortClasses) { - EList _operations = p_1.getOperations(); - CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, portClassName); - _builder.append(_operationsImplementation, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("/* end "); - _builder.append(portClassName, ""); - _builder.append(" specific (including base classes) */"); - _builder.newLineIfNotEmpty(); - _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._roomExtensions.handlesReceive(pc, (conj).booleanValue()); - if (_handlesReceive) { - CharSequence _genReceiveHandlers = this.genReceiveHandlers(pc, conj); - _builder.append(_genReceiveHandlers, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private String sendMessageCall(final boolean hasData, final String selfPtr, final String msg, final String typeName, final String data) { - String _xifexpression = null; - if (hasData) { - _xifexpression = (((((((("etPort_sendMessage(" + selfPtr) + ", ") + msg) + ", sizeof(") + typeName) + "), ") + data) + ");"); - } else { - _xifexpression = (((("etPort_sendMessage(" + selfPtr) + ", ") + msg) + ", 0, NULL);"); - } - return _xifexpression; - } - - private String messageSignature(final String className, final String messageName, final String methodSuffix, final String data) { - return ((((((((("void " + className) + "_") + messageName) + methodSuffix) + "(const ") + className) + "* self") + data) + ")"); - } - - private String messageSetterSignature(final String className, final String messageName, final String data) { - return (((((((("void " + className) + "_") + messageName) + "_set(") + className) + "* self") + data) + ")"); - } - - private String messageGetterSignature(final String className, final String messageName, final String type) { - return (((((((type + " ") + className) + "_") + messageName) + "_get(const ") + className) + "* const self)"); - } - - private CharSequence genReceiveHandlers(final ProtocolClass pc, final Boolean conj) { - CharSequence _xblockexpression = null; - { - String portClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue()); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/* receiver handlers */"); - _builder.newLine(); - { - List _receiveHandlers = this._roomExtensions.getReceiveHandlers(pc, (conj).booleanValue()); - 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"); - AbstractGenerator _instance = AbstractGenerator.getInstance(); - DetailCode _detailCode = h.getDetailCode(); - String _translatedCode = _instance.getTranslatedCode(_detailCode); - _builder.append(_translatedCode, "\t"); - _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 CharSequence 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* const "); - String _name = pc.getName(); - _builder.append(_name, ""); - _builder.append("_messageStrings[] = {\"MIN\", "); - { - List _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); - for(final Message m : _allOutgoingMessages) { - _builder.append("\""); - String _name_1 = m.getName(); - _builder.append(_name_1, ""); - _builder.append("\","); - } - } - { - List _allIncomingMessages = this._roomHelpers.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, "\t"); - _builder.append("_MSG_MIN || msg_id>"); - String _name_5 = pc.getName(); - _builder.append(_name_5, "\t"); - _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, "\t\t"); - _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.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java deleted file mode 100644 index 4c11af223..000000000 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -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.fsm.fSM.ModelComponent; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedModelComponent; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; -import org.eclipse.etrice.generator.c.Main; -import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; - -@Singleton -@SuppressWarnings("all") -public class StateMachineGen extends GenericStateMachineGenerator { - @Inject - @Extension - private RoomExtensions _roomExtensions; - - public CharSequence genHeaderConstants(final ExpandedActorClass xpac) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - StateGraph _stateMachine = xpac.getStateMachine(); - List _baseStateList = this._fSMHelpers.getBaseStateList(_stateMachine); - int _size = _baseStateList.size(); - StateGraph _stateMachine_1 = xpac.getStateMachine(); - List _leafStateList = this._fSMHelpers.getLeafStateList(_stateMachine_1); - int _size_1 = _leafStateList.size(); - int _minus = (_size - _size_1); - final int historySize = (_minus + 2); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/* constant for state machine data */"); - _builder.newLine(); - _builder.append("#define "); - String _name = ac.getName(); - String _upperCase = _name.toUpperCase(); - _builder.append(_upperCase, ""); - _builder.append("_HISTORY_SIZE "); - _builder.append(historySize, ""); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - public CharSequence genDataMembers(final ExpandedActorClass xpac) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/* state machine variables */"); - _builder.newLine(); - _builder.append("etInt16 state;"); - _builder.newLine(); - _builder.append("etInt16 history["); - String _name = ac.getName(); - String _upperCase = _name.toUpperCase(); - _builder.append(_upperCase, ""); - _builder.append("_HISTORY_SIZE];"); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - public CharSequence genInitialization(final ExpandedActorClass xpac) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("self->state = STATE_TOP;"); - _builder.newLine(); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("int i;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("for (i=0; i<"); - String _name = ac.getName(); - String _upperCase = _name.toUpperCase(); - _builder.append(_upperCase, "\t"); - _builder.append("_HISTORY_SIZE; ++i)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("self->history[i] = NO_STATE;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - String _name_1 = ac.getName(); - String _operationScope = this.langExt.operationScope(_name_1, false); - _builder.append(_operationScope, ""); - _builder.append("executeInitTransition(self);"); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - /** - * @param generateImplementation NOT used - */ - @Override - public CharSequence genExtra(final ExpandedModelComponent xpmc, final boolean generateImplementation) { - CharSequence _xblockexpression = null; - { - final ModelComponent mc = xpmc.getModelComponent(); - StateGraph _stateMachine = xpmc.getStateMachine(); - List _baseStateList = this._fSMHelpers.getBaseStateList(_stateMachine); - final List states = this._roomExtensions.getLeafStatesLast(_baseStateList); - StringConcatenation _builder = new StringConcatenation(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("/* state names */"); - _builder.newLine(); - _builder.append("static char* stateStrings[] = {\"\",\"\","); - { - boolean _hasElements = false; - for(final State state : states) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", ""); - } - _builder.append("\""); - String _genStatePathName = this._codegenHelpers.getGenStatePathName(state); - _builder.append(_genStatePathName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("};"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - String _accessLevelPrivate = this.langExt.accessLevelPrivate(); - _builder.append(_accessLevelPrivate, ""); - _builder.append("void setState("); - String _componentName = mc.getComponentName(); - _builder.append(_componentName, ""); - _builder.append("* self, "); - String _stateType = this.stateType(); - _builder.append(_stateType, ""); - _builder.append(" new_state) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("self->state = new_state;"); - _builder.newLine(); - { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t"); - _builder.append("ET_MSC_LOGGER_CHANGE_STATE(self->constData->instName, stateStrings[new_state])"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - String _accessLevelPrivate_1 = this.langExt.accessLevelPrivate(); - _builder.append(_accessLevelPrivate_1, ""); - String _stateType_1 = this.stateType(); - _builder.append(_stateType_1, ""); - _builder.append(" getState("); - String _componentName_1 = mc.getComponentName(); - _builder.append(_componentName_1, ""); - _builder.append("* self) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("return self->state;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - @Override - public String stateType() { - return "etInt16"; - } - - @Override - public String boolType() { - return "etBool"; - } - - @Override - public CharSequence markVariableUsed(final String varname) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("((void)trigger__et);\t/* avoids unused warning */"); - _builder.newLine(); - return _builder; - } - - @Override - public String unreachableReturn() { - return "/* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */"; - } -} diff --git a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java deleted file mode 100644 index 5bf61078e..000000000 --- a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java +++ /dev/null @@ -1,458 +0,0 @@ -/** - * Copyright (c) 2012 Juergen Haug - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug - */ -package org.eclipse.etrice.generator.config; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.function.Consumer; -import org.eclipse.emf.common.EMFPlugin; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.etrice.core.ConfigStandaloneSetup; -import org.eclipse.etrice.core.common.base.BooleanLiteral; -import org.eclipse.etrice.core.common.base.IntLiteral; -import org.eclipse.etrice.core.common.base.Literal; -import org.eclipse.etrice.core.common.base.NumberLiteral; -import org.eclipse.etrice.core.common.base.RealLiteral; -import org.eclipse.etrice.core.common.base.StringLiteral; -import org.eclipse.etrice.core.config.AttrClassConfig; -import org.eclipse.etrice.core.config.AttrInstanceConfig; -import org.eclipse.etrice.core.config.ConfigValue; -import org.eclipse.etrice.core.config.ConfigValueArray; -import org.eclipse.etrice.core.config.DynamicConfig; -import org.eclipse.etrice.core.config.EnumConfigValue; -import org.eclipse.etrice.core.config.LiteralConfigValue; -import org.eclipse.etrice.core.config.SubSystemConfig; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.EnumLiteral; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.generator.base.IDataConfiguration; -import org.eclipse.etrice.generator.config.util.DataConfigurationHelper; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.scoping.impl.ImportUriResolver; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@SuppressWarnings("all") -public class DataConfiguration implements IDataConfiguration { - @Inject - @Extension - protected DataConfigurationHelper _dataConfigurationHelper; - - @Inject - protected ILogger logger; - - @Inject - protected ImportUriResolver uriResolver; - - @Override - public void doSetup() { - if ((!EMFPlugin.IS_ECLIPSE_RUNNING)) { - ConfigStandaloneSetup.doSetup(); - } - } - - @Override - public boolean setResources(final ResourceSet resource, final ILogger logger) { - return this._dataConfigurationHelper.setConfigModels(resource, logger); - } - - @Override - public String getAttrClassConfigValue(final ActorClass actor, final List path) { - AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path); - ConfigValueArray _value = null; - if (_attrClassConfig!=null) { - _value=_attrClassConfig.getValue(); - } - String _stringExpr = null; - if (_value!=null) { - _stringExpr=this.toStringExpr(_value); - } - return _stringExpr; - } - - @Override - public String getAttrClassConfigMaxValue(final ActorClass actor, final List path) { - AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path); - NumberLiteral _max = null; - if (_attrClassConfig!=null) { - _max=_attrClassConfig.getMax(); - } - String _stringExpr = null; - if (_max!=null) { - _stringExpr=this.toStringExpr(_max); - } - return _stringExpr; - } - - @Override - public String getAttrClassConfigMinValue(final ActorClass actor, final List path) { - AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path); - NumberLiteral _min = null; - if (_attrClassConfig!=null) { - _min=_attrClassConfig.getMin(); - } - String _stringExpr = null; - if (_min!=null) { - _stringExpr=this.toStringExpr(_min); - } - return _stringExpr; - } - - private AttrClassConfig getAttrClassConfig(final ActorClass actor, final List path) { - AttrClassConfig _xblockexpression = null; - { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/"); - String _name = actor.getName(); - _builder.append(_name, ""); - _builder.append("/"); - String _stringPath = this.toStringPath(path); - _builder.append(_stringPath, ""); - String id = _builder.toString(); - _xblockexpression = this._dataConfigurationHelper.actorClassAttrMap.get(id); - } - return _xblockexpression; - } - - @Override - public String getAttrClassConfigValue(final ProtocolClass pc, final boolean regular, final List path) { - String _xblockexpression = null; - { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/"); - String _name = pc.getName(); - _builder.append(_name, ""); - _builder.append("/"); - { - if (regular) { - _builder.append("regular"); - } else { - _builder.append("conjugated"); - } - } - _builder.append("/"); - String _stringPath = this.toStringPath(path); - _builder.append(_stringPath, ""); - String id = _builder.toString(); - AttrClassConfig _get = this._dataConfigurationHelper.protocolClassAttrMap.get(id); - ConfigValueArray _value = null; - if (_get!=null) { - _value=_get.getValue(); - } - String _stringExpr = null; - if (_value!=null) { - _stringExpr=this.toStringExpr(_value); - } - _xblockexpression = _stringExpr; - } - return _xblockexpression; - } - - private String toStringPath(final List path) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _hasElements = false; - for(final Attribute a : path) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate("/", ""); - } - String _name = a.getName(); - _builder.append(_name, ""); - } - } - return _builder.toString(); - } - - @Override - public String getAttrInstanceConfigValue(final ActorInstance ai, final List path) { - String _xblockexpression = null; - { - String _path = ai.getPath(); - String _plus = (_path + "/"); - String _stringPath = this.toStringPath(path); - String id = (_plus + _stringPath); - AttrInstanceConfig _get = this._dataConfigurationHelper.actorInstanceAttrMap.get(id); - ConfigValueArray _value = null; - if (_get!=null) { - _value=_get.getValue(); - } - String _stringExpr = null; - if (_value!=null) { - _stringExpr=this.toStringExpr(_value); - } - _xblockexpression = _stringExpr; - } - return _xblockexpression; - } - - @Override - public String getAttrInstanceConfigValue(final InterfaceItemInstance item, final List path) { - String _path = item.getPath(); - String _plus = (_path + "/"); - String _stringPath = this.toStringPath(path); - String _plus_1 = (_plus + _stringPath); - AttrInstanceConfig _get = this._dataConfigurationHelper.actorInstanceAttrMap.get(_plus_1); - ConfigValueArray _value = null; - if (_get!=null) { - _value=_get.getValue(); - } - String _stringExpr = null; - if (_value!=null) { - _stringExpr=this.toStringExpr(_value); - } - return _stringExpr; - } - - @Override - public long getPollingTimerUser(final SubSystemInstance subsystem) { - long _xblockexpression = (long) 0; - { - SubSystemConfig _config = this.getConfig(subsystem); - DynamicConfig _dynConfig = null; - if (_config!=null) { - _dynConfig=_config.getDynConfig(); - } - final DynamicConfig dynConf = _dynConfig; - long _xifexpression = (long) 0; - boolean _equals = Objects.equal(dynConf, null); - if (_equals) { - _xifexpression = 0; - } else { - _xifexpression = dynConf.getPolling(); - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - @Override - public String getUserCode1(final SubSystemInstance subsystem) { - SubSystemConfig _config = this.getConfig(subsystem); - DynamicConfig _dynConfig = null; - if (_config!=null) { - _dynConfig=_config.getDynConfig(); - } - DynamicConfig dynConfig = _dynConfig; - String _xifexpression = null; - String _filePath = null; - if (dynConfig!=null) { - _filePath=dynConfig.getFilePath(); - } - boolean _notEquals = (!Objects.equal(_filePath, null)); - if (_notEquals) { - _xifexpression = "import org.eclipse.etrice.runtime.java.config.ConfigSourceFile;"; - } else { - String _userCode1 = null; - if (dynConfig!=null) { - _userCode1=dynConfig.getUserCode1(); - } - _xifexpression = _userCode1; - } - return _xifexpression; - } - - @Override - public String getUserCode2(final SubSystemInstance subsystem) { - SubSystemConfig _config = this.getConfig(subsystem); - DynamicConfig _dynConfig = null; - if (_config!=null) { - _dynConfig=_config.getDynConfig(); - } - DynamicConfig dynConfig = _dynConfig; - String _xifexpression = null; - String _filePath = null; - if (dynConfig!=null) { - _filePath=dynConfig.getFilePath(); - } - boolean _notEquals = (!Objects.equal(_filePath, null)); - if (_notEquals) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("new ConfigSourceFile(\""); - String _filePath_1 = dynConfig.getFilePath(); - _builder.append(_filePath_1, ""); - _builder.append("\")"); - _xifexpression = _builder.toString(); - } else { - String _userCode2 = null; - if (dynConfig!=null) { - _userCode2=dynConfig.getUserCode2(); - } - _xifexpression = _userCode2; - } - return _xifexpression; - } - - @Override - public List getDynConfigReadAttributes(final ActorInstance ai) { - final ArrayList result = new ArrayList(); - String _path = ai.getPath(); - List configs = this._dataConfigurationHelper.dynActorInstanceAttrMap.get(_path); - if (configs!=null) { - final Consumer _function = (AttrInstanceConfig c) -> { - boolean _isReadOnly = c.isReadOnly(); - if (_isReadOnly) { - Attribute _attribute = c.getAttribute(); - result.add(_attribute); - } - }; - configs.forEach(_function); - } - return result; - } - - @Override - public List getDynConfigWriteAttributes(final ActorInstance ai) { - final ArrayList result = new ArrayList(); - String _path = ai.getPath(); - List configs = this._dataConfigurationHelper.dynActorInstanceAttrMap.get(_path); - if (configs!=null) { - final Consumer _function = (AttrInstanceConfig c) -> { - boolean _isReadOnly = c.isReadOnly(); - boolean _not = (!_isReadOnly); - if (_not) { - Attribute _attribute = c.getAttribute(); - result.add(_attribute); - } - }; - configs.forEach(_function); - } - return result; - } - - @Override - public boolean hasVariableService(final SubSystemInstance subsystem) { - SubSystemConfig _config = this.getConfig(subsystem); - DynamicConfig _dynConfig = null; - if (_config!=null) { - _dynConfig=_config.getDynConfig(); - } - return (!Objects.equal(_dynConfig, null)); - } - - private String toStringExpr(final ConfigValueArray literal) { - StringConcatenation _builder = new StringConcatenation(); - { - EList _values = literal.getValues(); - boolean _hasElements = false; - for(final ConfigValue l : _values) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", ""); - } - String _stringExpr = this.toStringExpr(l); - _builder.append(_stringExpr, ""); - } - } - return _builder.toString(); - } - - private String toStringExpr(final ConfigValue configValue) { - String _switchResult = null; - boolean _matched = false; - if (configValue instanceof LiteralConfigValue) { - _matched=true; - Literal _value = ((LiteralConfigValue)configValue).getValue(); - _switchResult = this.toStringExpr(_value); - } - if (!_matched) { - if (configValue instanceof EnumConfigValue) { - _matched=true; - EnumLiteral _value = ((EnumConfigValue)configValue).getValue(); - _switchResult = _value.getFullName(); - } - } - return _switchResult; - } - - private String toStringExpr(final Literal literal) { - String _switchResult = null; - boolean _matched = false; - if (literal instanceof BooleanLiteral) { - _matched=true; - boolean _isIsTrue = ((BooleanLiteral)literal).isIsTrue(); - _switchResult = Boolean.valueOf(_isIsTrue).toString(); - } - if (!_matched) { - if (literal instanceof IntLiteral) { - _matched=true; - long _value = ((IntLiteral)literal).getValue(); - _switchResult = Long.valueOf(_value).toString(); - } - } - if (!_matched) { - if (literal instanceof RealLiteral) { - _matched=true; - double _value = ((RealLiteral)literal).getValue(); - _switchResult = Double.valueOf(_value).toString(); - } - } - if (!_matched) { - if (literal instanceof StringLiteral) { - _matched=true; - String _value = ((StringLiteral)literal).getValue(); - _switchResult = _value.toString(); - } - } - return _switchResult; - } - - private SubSystemConfig getConfig(final SubSystemInstance cc) { - String _path = cc.getPath(); - return this._dataConfigurationHelper.subSystemConfigMap.get(_path); - } - - @Override - public List getDynConfigReadAttributes(final ActorClass actor) { - final HashSet result = new HashSet(); - final List configs = this._dataConfigurationHelper.dynActorClassAttrMap.get(actor); - if (configs!=null) { - final Consumer _function = (AttrInstanceConfig c) -> { - boolean _isReadOnly = c.isReadOnly(); - if (_isReadOnly) { - Attribute _attribute = c.getAttribute(); - result.add(_attribute); - } - }; - configs.forEach(_function); - } - return IterableExtensions.toList(result); - } - - @Override - public List getDynConfigWriteAttributes(final ActorClass actor) { - final HashSet result = new HashSet(); - final List configs = this._dataConfigurationHelper.dynActorClassAttrMap.get(actor); - if (configs!=null) { - final Consumer _function = (AttrInstanceConfig c) -> { - boolean _isReadOnly = c.isReadOnly(); - boolean _not = (!_isReadOnly); - if (_not) { - Attribute _attribute = c.getAttribute(); - result.add(_attribute); - } - }; - configs.forEach(_function); - } - return IterableExtensions.toList(result); - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java deleted file mode 100644 index fb693fa07..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java +++ /dev/null @@ -1,1157 +0,0 @@ -/** - * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.Wire; -import org.eclipse.etrice.core.genmodel.etricegen.WiredActorClass; -import org.eclipse.etrice.core.genmodel.etricegen.WiredStructureClass; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorRef; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.SAP; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.ServiceImplementation; -import org.eclipse.etrice.core.room.StandardOperation; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; -import org.eclipse.etrice.generator.cpp.Main; -import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.cpp.gen.Initialization; -import org.eclipse.etrice.generator.cpp.gen.StateMachineGen; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.GenericActorClassGenerator; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; - -@Singleton -@SuppressWarnings("all") -public class ActorClassGen extends GenericActorClassGenerator { - @Inject - protected IGeneratorFileIo fileIO; - - @Inject - @Extension - protected CppExtensions _cppExtensions; - - @Inject - @Extension - protected RoomExtensions _roomExtensions; - - @Inject - @Extension - protected ProcedureHelpers _procedureHelpers; - - @Inject - protected Initialization initHelper; - - @Inject - @Extension - protected StateMachineGen _stateMachineGen; - - @Inject - @Extension - protected FileSystemHelpers _fileSystemHelpers; - - public void doGenerate(final Root root) { - final Map ac2wired = CollectionLiterals.newHashMap(); - EList _wiredInstances = root.getWiredInstances(); - Iterable _filter = Iterables.filter(_wiredInstances, WiredActorClass.class); - final Consumer _function = (WiredActorClass it) -> { - ActorClass _actorClass = it.getActorClass(); - ac2wired.put(_actorClass, it); - }; - _filter.forEach(_function); - EList _actorClasses = root.getActorClasses(); - final Function1 _function_1 = (ActorClass it) -> { - return Boolean.valueOf(this._fileSystemHelpers.isValidGenerationLocation(it)); - }; - Iterable _filter_1 = IterableExtensions.filter(_actorClasses, _function_1); - final Function1 _function_2 = (ActorClass it) -> { - return root.getExpandedActorClass(it); - }; - Iterable _map = IterableExtensions.map(_filter_1, _function_2); - for (final ExpandedActorClass xpac : _map) { - { - ActorClass _actorClass = xpac.getActorClass(); - final WiredActorClass wired = ac2wired.get(_actorClass); - ActorClass _actorClass_1 = xpac.getActorClass(); - final boolean manualBehavior = this._roomHelpers.isBehaviorAnnotationPresent(_actorClass_1, "BehaviorManual"); - ActorClass _actorClass_2 = xpac.getActorClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_actorClass_2); - ActorClass _actorClass_3 = xpac.getActorClass(); - String _path = this._roomExtensions.getPath(_actorClass_3); - final String path = (_generationTargetPath + _path); - ActorClass _actorClass_4 = xpac.getActorClass(); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_actorClass_4); - ActorClass _actorClass_5 = xpac.getActorClass(); - String _path_1 = this._roomExtensions.getPath(_actorClass_5); - final String infopath = (_generationInfoPath + _path_1); - String _xifexpression = null; - if (manualBehavior) { - _xifexpression = "Abstract"; - } else { - _xifexpression = ""; - } - String file = _xifexpression; - ActorClass _actorClass_6 = xpac.getActorClass(); - String _cppHeaderFileName = this._cppExtensions.getCppHeaderFileName(_actorClass_6); - String _plus = (file + _cppHeaderFileName); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, xpac, wired, manualBehavior); - this.fileIO.generateFile("generating ActorClass declaration", path, infopath, _plus, _generateHeaderFile); - ActorClass _actorClass_7 = xpac.getActorClass(); - String _cppSourceFileName = this._cppExtensions.getCppSourceFileName(_actorClass_7); - String _plus_1 = (file + _cppSourceFileName); - CharSequence _generateSourceFile = this.generateSourceFile(root, xpac, wired, manualBehavior); - this.fileIO.generateFile("generating ActorClass implementation", path, infopath, _plus_1, _generateSourceFile); - } - } - } - - protected CharSequence generateHeaderFile(final Root root, final ExpandedActorClass xpac, final WiredActorClass wired, final boolean manualBehavior) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - String _xifexpression = null; - if (manualBehavior) { - String _name = ac.getName(); - _xifexpression = ("Abstract" + _name); - } else { - _xifexpression = ac.getName(); - } - final String clsname = _xifexpression; - String _elvis = null; - ActorClass _actorBase = ac.getActorBase(); - String _name_1 = null; - if (_actorBase!=null) { - _name_1=_actorBase.getName(); - } - if (_name_1 != null) { - _elvis = _name_1; - } else { - _elvis = "etRuntime::ActorClassBase"; - } - final String rtBaseClassName = _elvis; - 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 ActorClass "); - _builder.append(clsname, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateIncludeGuardBegin = this._cppExtensions.generateIncludeGuardBegin(ac, ""); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"common/etDatatypesCpp.hpp\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/IRTObject.h\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/PortBase.h\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/ReplicatedActorClassBase.h\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/InterfaceItemBase.h\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/SubSystemClassBase.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/Address.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/IMessageReceiver.h\""); - _builder.newLine(); - _builder.append("#include \"common/debugging/DebuggingService.h\""); - _builder.newLine(); - _builder.newLine(); - { - EList _referencedProtocolClasses = root.getReferencedProtocolClasses(ac); - for(final ProtocolClass pc : _referencedProtocolClasses) { - _builder.append("#include \""); - String _path = this._roomExtensions.getPath(pc); - _builder.append(_path, ""); - String _name_2 = pc.getName(); - _builder.append(_name_2, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } - } - { - EList _referencedDataClasses = root.getReferencedDataClasses(ac); - for(final DataClass dc : _referencedDataClasses) { - _builder.append("#include \""); - String _path_1 = this._roomExtensions.getPath(dc); - _builder.append(_path_1, ""); - String _name_3 = dc.getName(); - _builder.append(_name_3, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - ActorClass _actorBase_1 = ac.getActorBase(); - boolean _equals = Objects.equal(_actorBase_1, null); - if (_equals) { - _builder.append("#include \"common/modelbase/ActorClassBase.h\""); - _builder.newLine(); - } else { - _builder.append("#include \""); - ActorClass _actorBase_2 = ac.getActorBase(); - String _path_2 = this._roomExtensions.getPath(_actorBase_2); - _builder.append(_path_2, ""); - ActorClass _actorBase_3 = ac.getActorBase(); - String _name_4 = _actorBase_3.getName(); - _builder.append(_name_4, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } - } - { - EList _actorRefs = ac.getActorRefs(); - for(final ActorRef ar : _actorRefs) { - _builder.append("#include \""); - ActorClass _type = ar.getType(); - String _actorIncludePath = this._cppExtensions.getActorIncludePath(_type); - _builder.append(_actorIncludePath, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - DetailCode _userCode1 = ac.getUserCode1(); - CharSequence _userCode = this._procedureHelpers.userCode(_userCode1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("using namespace etRuntime;"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceBegin = this._cppExtensions.generateNamespaceBegin(ac); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("class "); - _builder.append(clsname, ""); - _builder.append(" : public "); - _builder.append(rtBaseClassName, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("protected:"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("//--------------------- ports"); - _builder.newLine(); - { - List _endPorts = this._roomHelpers.getEndPorts(ac); - for(final Port ep : _endPorts) { - _builder.append("\t\t"); - String _portClassName = this._roomExtensions.getPortClassName(ep); - _builder.append(_portClassName, "\t\t"); - _builder.append(" "); - String _name_5 = ep.getName(); - _builder.append(_name_5, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("//--------------------- sub actors"); - _builder.newLine(); - { - EList _actorRefs_1 = ac.getActorRefs(); - for(final ActorRef sub : _actorRefs_1) { - { - int _multiplicity = sub.getMultiplicity(); - boolean _greaterThan = (_multiplicity > 1); - if (_greaterThan) { - _builder.append("\t\t"); - _builder.append("Replicated"); - ActorClass _type_1 = sub.getType(); - String _implementationClassName = this._cppExtensions.getImplementationClassName(_type_1); - _builder.append(_implementationClassName, "\t\t"); - _builder.append(" "); - String _name_6 = sub.getName(); - _builder.append(_name_6, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t\t"); - ActorClass _type_2 = sub.getType(); - String _implementationClassName_1 = this._cppExtensions.getImplementationClassName(_type_2); - _builder.append(_implementationClassName_1, "\t\t"); - _builder.append(" "); - String _name_7 = sub.getName(); - _builder.append(_name_7, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("//--------------------- saps"); - _builder.newLine(); - { - EList _serviceAccessPoints = ac.getServiceAccessPoints(); - for(final SAP sap : _serviceAccessPoints) { - _builder.append("\t\t"); - String _portClassName_1 = this._roomExtensions.getPortClassName(sap); - _builder.append(_portClassName_1, "\t\t"); - _builder.append(" "); - String _name_8 = sap.getName(); - _builder.append(_name_8, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("//--------------------- services"); - _builder.newLine(); - { - EList _serviceImplementations = ac.getServiceImplementations(); - for(final ServiceImplementation svc : _serviceImplementations) { - _builder.append("\t\t"); - String _portClassName_2 = this._roomExtensions.getPortClassName(svc); - _builder.append(_portClassName_2, "\t\t"); - _builder.append(" "); - SPP _spp = svc.getSpp(); - String _name_9 = _spp.getName(); - _builder.append(_name_9, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("//--------------------- interface item IDs"); - _builder.newLine(); - _builder.append("\t\t"); - String _genInterfaceItemConstants = this.genInterfaceItemConstants(xpac); - _builder.append(_genInterfaceItemConstants, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - EList _attributes = ac.getAttributes(); - CharSequence _attributes_1 = this._procedureHelpers.attributes(_attributes); - _builder.append(_attributes_1, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - EList _operations = ac.getOperations(); - String _name_10 = ac.getName(); - CharSequence _operationsDeclaration = this._procedureHelpers.operationsDeclaration(_operations, _name_10); - _builder.append(_operationsDeclaration, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("//--------------------- construction"); - _builder.newLine(); - _builder.append("\t\t"); - String _name_11 = ac.getName(); - _builder.append(_name_11, "\t\t"); - _builder.append("(etRuntime::IRTObject* parent, const String& name);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("void initialize(void);"); - _builder.newLine(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t\t"); - _builder.append("void setProbesActive(bool recursive, bool active);"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("//--------------------- port getters"); - _builder.newLine(); - _builder.append("\t\t"); - List _endPorts_1 = this._roomHelpers.getEndPorts(ac); - final Function1 _function = (Port it) -> { - String _portClassName_3 = this._roomExtensions.getPortClassName(it); - String _plus = (_portClassName_3 + "&"); - String _name_12 = it.getName(); - return this._procedureHelpers.getterImplementation(_plus, _name_12, clsname); - }; - List _map = ListExtensions.map(_endPorts_1, _function); - String _join = IterableExtensions.join(_map, this._roomExtensions.NEWLINE); - _builder.append(_join, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - EList _serviceAccessPoints_1 = ac.getServiceAccessPoints(); - final Function1 _function_1 = (SAP it) -> { - String _portClassName_3 = this._roomExtensions.getPortClassName(it); - String _plus = (_portClassName_3 + "&"); - String _name_12 = it.getName(); - return this._procedureHelpers.getterImplementation(_plus, _name_12, clsname); - }; - List _map_1 = ListExtensions.map(_serviceAccessPoints_1, _function_1); - String _join_1 = IterableExtensions.join(_map_1, this._roomExtensions.NEWLINE); - _builder.append(_join_1, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - EList _serviceImplementations_1 = ac.getServiceImplementations(); - final Function1 _function_2 = (ServiceImplementation it) -> { - String _portClassName_3 = this._roomExtensions.getPortClassName(it); - String _plus = (_portClassName_3 + "&"); - SPP _spp_1 = it.getSpp(); - String _name_12 = _spp_1.getName(); - return this._procedureHelpers.getterImplementation(_plus, _name_12, clsname); - }; - List _map_2 = ListExtensions.map(_serviceImplementations_1, _function_2); - String _join_2 = IterableExtensions.join(_map_2, this._roomExtensions.NEWLINE); - _builder.append(_join_2, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("//--------------------- lifecycle functions"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("virtual void destroy();"); - _builder.newLine(); - _builder.newLine(); - { - boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac); - if (_hasNonEmptyStateMachine) { - _builder.append("\t\t"); - CharSequence _genStateMachineConstants = this._stateMachineGen.genStateMachineConstants(xpac); - _builder.append(_genStateMachineConstants, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - CharSequence _genStateMachineMethods = this._stateMachineGen.genStateMachineMethods(xpac, false); - _builder.append(_genStateMachineMethods, "\t\t"); - _builder.newLineIfNotEmpty(); - { - ComponentCommunicationType _commType = ac.getCommType(); - boolean _equals_1 = Objects.equal(_commType, ComponentCommunicationType.DATA_DRIVEN); - if (_equals_1) { - _builder.append("\t\t"); - _builder.append("void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* generic_data);"); - _builder.newLine(); - } - } - { - if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { - _builder.append("\t\t"); - _builder.append("virtual void receive(const etRuntime::Message* msg);"); - _builder.newLine(); - } - } - } else { - StateGraph _stateMachine = xpac.getStateMachine(); - boolean _isEmpty = this._roomHelpers.isEmpty(_stateMachine); - if (_isEmpty) { - _builder.append("\t\t"); - _builder.append("//--------------------- no state machine"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data);"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("virtual void executeInitTransition() {}"); - _builder.newLine(); - } - } - } - _builder.newLine(); - _builder.append("\t\t"); - DetailCode _userCode2 = ac.getUserCode2(); - CharSequence _userCode_1 = this._procedureHelpers.userCode(_userCode2); - _builder.append(_userCode_1, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - _builder.append("class Replicated"); - _builder.append(clsname, ""); - _builder.append(" : public ReplicatedActorClassBase {"); - _builder.newLineIfNotEmpty(); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("Replicated"); - _builder.append(clsname, "\t"); - _builder.append("(IRTObject* parent, const String& name) :"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("ReplicatedActorClassBase(parent, name) {}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("protected:"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ActorClassBase* createActor(IRTObject* parent, const String& name) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return new "); - _builder.append(clsname, "\t\t"); - _builder.append("(parent, name);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceEnd = this._cppExtensions.generateNamespaceEnd(ac); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd(ac, ""); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence generateConstructorInitalizerList(final ActorClass ac) { - CharSequence _xblockexpression = null; - { - @Extension - final Initialization initHelper = this.initHelper; - ArrayList initList = CollectionLiterals.newArrayList(); - StringConcatenation _builder = new StringConcatenation(); - String _elvis = null; - ActorClass _actorBase = ac.getActorBase(); - String _name = null; - if (_actorBase!=null) { - _name=_actorBase.getName(); - } - if (_name != null) { - _elvis = _name; - } else { - _elvis = "ActorClassBase"; - } - _builder.append(_elvis, ""); - _builder.append("(parent, name)"); - initList.add(_builder.toString()); - List _endPorts = this._roomHelpers.getEndPorts(ac); - final Function1 _function = (Port it) -> { - StringConcatenation _builder_1 = new StringConcatenation(); - String _name_1 = it.getName(); - _builder_1.append(_name_1, ""); - _builder_1.append("(this, \""); - String _name_2 = it.getName(); - _builder_1.append(_name_2, ""); - _builder_1.append("\", IFITEM_"); - String _name_3 = it.getName(); - _builder_1.append(_name_3, ""); - _builder_1.append(")"); - return _builder_1.toString(); - }; - List _map = ListExtensions.map(_endPorts, _function); - Iterables.addAll(initList, _map); - EList _actorRefs = ac.getActorRefs(); - final Function1 _function_1 = (ActorRef it) -> { - StringConcatenation _builder_1 = new StringConcatenation(); - String _name_1 = it.getName(); - _builder_1.append(_name_1, ""); - _builder_1.append("(this, \""); - String _name_2 = it.getName(); - _builder_1.append(_name_2, ""); - _builder_1.append("\")"); - return _builder_1.toString(); - }; - List _map_1 = ListExtensions.map(_actorRefs, _function_1); - Iterables.addAll(initList, _map_1); - EList _serviceAccessPoints = ac.getServiceAccessPoints(); - final Function1 _function_2 = (SAP it) -> { - StringConcatenation _builder_1 = new StringConcatenation(); - String _name_1 = it.getName(); - _builder_1.append(_name_1, ""); - _builder_1.append("(this, \""); - String _name_2 = it.getName(); - _builder_1.append(_name_2, ""); - _builder_1.append("\", IFITEM_"); - String _name_3 = it.getName(); - _builder_1.append(_name_3, ""); - _builder_1.append(")"); - return _builder_1.toString(); - }; - List _map_2 = ListExtensions.map(_serviceAccessPoints, _function_2); - Iterables.addAll(initList, _map_2); - EList _serviceImplementations = ac.getServiceImplementations(); - final Function1 _function_3 = (ServiceImplementation it) -> { - StringConcatenation _builder_1 = new StringConcatenation(); - SPP _spp = it.getSpp(); - String _name_1 = _spp.getName(); - _builder_1.append(_name_1, ""); - _builder_1.append("(this, \""); - SPP _spp_1 = it.getSpp(); - String _name_2 = _spp_1.getName(); - _builder_1.append(_name_2, ""); - _builder_1.append("\", IFITEM_"); - SPP _spp_2 = it.getSpp(); - String _name_3 = _spp_2.getName(); - _builder_1.append(_name_3, ""); - _builder_1.append(")"); - return _builder_1.toString(); - }; - List _map_3 = ListExtensions.map(_serviceImplementations, _function_3); - Iterables.addAll(initList, _map_3); - EList _attributes = ac.getAttributes(); - final Function1 _function_4 = (Attribute it) -> { - StringConcatenation _builder_1 = new StringConcatenation(); - String _name_1 = it.getName(); - _builder_1.append(_name_1, ""); - _builder_1.append("("); - String _initializerListValue = initHelper.getInitializerListValue(it); - _builder_1.append(_initializerListValue, ""); - _builder_1.append(")"); - return _builder_1.toString(); - }; - List _map_4 = ListExtensions.map(_attributes, _function_4); - Iterables.addAll(initList, _map_4); - _xblockexpression = initHelper.generateCtorInitializerList(initList); - } - return _xblockexpression; - } - - protected CharSequence generateSourceFile(final Root root, final ExpandedActorClass xpac, final WiredActorClass wired, final boolean manualBehavior) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - String _xifexpression = null; - if (manualBehavior) { - String _name = ac.getName(); - _xifexpression = ("Abstract" + _name); - } else { - _xifexpression = ac.getName(); - } - final String clsname = _xifexpression; - String _elvis = null; - ActorClass _actorBase = ac.getActorBase(); - String _name_1 = null; - if (_actorBase!=null) { - _name_1=_actorBase.getName(); - } - if (_name_1 != null) { - _elvis = _name_1; - } else { - _elvis = "ActorClassBase"; - } - final String rtBaseClassName = _elvis; - 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 ActorClass "); - String _name_2 = ac.getName(); - _builder.append(_name_2, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \""); - String _cppHeaderFileName = this._cppExtensions.getCppHeaderFileName(ac); - _builder.append(_cppHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"common/messaging/RTObject.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/RTServices.h\""); - _builder.newLine(); - _builder.append("#include \"common/debugging/DebuggingService.h\""); - _builder.newLine(); - _builder.append("#include \"common/debugging/MSCFunctionObject.h\""); - _builder.newLine(); - _builder.newLine(); - _builder.append("using namespace etRuntime;"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceBegin = this._cppExtensions.generateNamespaceBegin(ac); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - DetailCode _userCode3 = ac.getUserCode3(); - CharSequence _userCode = this._procedureHelpers.userCode(_userCode3); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append(clsname, ""); - _builder.append("::"); - _builder.append(clsname, ""); - _builder.append("(etRuntime::IRTObject* parent, const String& name)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - CharSequence _generateConstructorInitalizerList = this.generateConstructorInitalizerList(ac); - _builder.append(_generateConstructorInitalizerList, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("{"); - _builder.newLine(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t"); - _builder.append("MSCFunctionObject mscFunctionObject(getInstancePathName(), \"Constructor\");"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.newLine(); - { - boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac); - if (_hasNonEmptyStateMachine) { - _builder.append("\t"); - _builder.append("for (int i = 0; i < s_numberOfStates; i++) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("history[i] = NO_STATE;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("setClassName(\""); - String _name_3 = ac.getName(); - _builder.append(_name_3, "\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// sub actors"); - _builder.newLine(); - { - EList _actorRefs = ac.getActorRefs(); - for(final ActorRef sub : _actorRefs) { - { - int _multiplicity = sub.getMultiplicity(); - boolean _greaterThan = (_multiplicity > 1); - if (_greaterThan) { - _builder.append("\t"); - String _name_4 = sub.getName(); - _builder.append(_name_4, "\t"); - _builder.append(".createSubActors("); - int _multiplicity_1 = sub.getMultiplicity(); - _builder.append(_multiplicity_1, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - EList _attributes = ac.getAttributes(); - CharSequence _genExtraInitializers = this.initHelper.genExtraInitializers(_attributes); - _builder.append(_genExtraInitializers, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _userStructorBody = this._procedureHelpers.userStructorBody(ac, true); - _builder.append(_userStructorBody, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - String _name_5 = ac.getName(); - _builder.append(_name_5, ""); - _builder.append("::initialize() {"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t"); - _builder.append("MSCFunctionObject mscFunctionObject(getInstancePathName(), \"initialize()\");"); - _builder.newLine(); - { - EList _actorRefs_1 = ac.getActorRefs(); - for(final ActorRef sub_1 : _actorRefs_1) { - { - int _multiplicity_2 = sub_1.getMultiplicity(); - boolean _greaterThan_1 = (_multiplicity_2 > 1); - if (_greaterThan_1) { - _builder.append("\t"); - _builder.append("for (int i=0; i<"); - int _multiplicity_3 = sub_1.getMultiplicity(); - _builder.append(_multiplicity_3, "\t"); - _builder.append("; ++i) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addMessageActorCreate(*this, "); - String _name_6 = sub_1.getName(); - _builder.append(_name_6, "\t\t"); - _builder.append(".getSubActor(i)->getName());"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } else { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addMessageActorCreate(*this, \""); - String _name_7 = sub_1.getName(); - _builder.append(_name_7, "\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ActorClassBase::initialize();"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - { - EList _actorRefs_2 = ac.getActorRefs(); - for(final ActorRef sub_2 : _actorRefs_2) { - _builder.append("\t"); - String _name_8 = sub_2.getName(); - _builder.append(_name_8, "\t"); - _builder.append(".initialize();"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// wiring"); - _builder.newLine(); - { - EList _wires = wired.getWires(); - for(final Wire wire : _wires) { - _builder.append("\t"); - String _xifexpression_1 = null; - boolean _isDataDriven = wire.isDataDriven(); - if (_isDataDriven) { - _xifexpression_1 = "DataPortBase"; - } else { - _xifexpression_1 = "InterfaceItemBase"; - } - _builder.append(_xifexpression_1, "\t"); - _builder.append("::connect(this, \""); - EList _path1 = wire.getPath1(); - String _join = IterableExtensions.join(_path1, "/"); - _builder.append(_join, "\t"); - _builder.append("\", \""); - EList _path2 = wire.getPath2(); - String _join_1 = IterableExtensions.join(_path2, "/"); - _builder.append(_join_1, "\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { - _builder.append("\t"); - _builder.append("// activate polling for data-driven communication"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(getThread())->addPollingMessageReceiver(*this);"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - { - GlobalGeneratorSettings _settings_2 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_2) { - _builder.append("void "); - String _name_9 = ac.getName(); - _builder.append(_name_9, ""); - _builder.append("::setProbesActive(bool recursive, bool active) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addPortInstance(m_RTSystemPort);"); - _builder.newLine(); - { - EList _actorRefs_3 = ac.getActorRefs(); - int _size = _actorRefs_3.size(); - boolean _greaterThan_2 = (_size > 0); - if (_greaterThan_2) { - _builder.append("\t"); - _builder.append("if(recursive) {"); - _builder.newLine(); - { - EList _actorRefs_4 = ac.getActorRefs(); - for(final ActorRef sub_3 : _actorRefs_4) { - _builder.append("\t"); - _builder.append("\t"); - String _name_10 = sub_3.getName(); - _builder.append(_name_10, "\t\t"); - _builder.append(".setProbesActive(recursive, active);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - { - List _endPorts = this._roomHelpers.getEndPorts(ac); - for(final Port ep : _endPorts) { - { - boolean _isDataDriven_1 = this._roomHelpers.isDataDriven(ep); - boolean _not = (!_isDataDriven_1); - if (_not) { - { - boolean _isReplicated = ep.isReplicated(); - if (_isReplicated) { - _builder.append("\t"); - _builder.append("for(int i = 0; i < "); - String _name_11 = ep.getName(); - _builder.append(_name_11, "\t"); - _builder.append(".getNInterfaceItems(); i++)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addPortInstance(*("); - String _name_12 = ep.getName(); - _builder.append(_name_12, "\t\t"); - _builder.append(".getInterfaceItem(i)));"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addPortInstance("); - String _name_13 = ep.getName(); - _builder.append(_name_13, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - { - EList _serviceAccessPoints = ac.getServiceAccessPoints(); - for(final SAP sap : _serviceAccessPoints) { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addPortInstance("); - String _name_14 = sap.getName(); - _builder.append(_name_14, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - { - EList _serviceProvisionPoints = ac.getServiceProvisionPoints(); - for(final SPP spp : _serviceProvisionPoints) { - _builder.append("\t"); - _builder.append("for(int i = 0; i < "); - String _name_15 = spp.getName(); - _builder.append(_name_15, "\t"); - _builder.append(".getNInterfaceItems(); i++)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("DebuggingService::getInstance().addPortInstance(*("); - String _name_16 = spp.getName(); - _builder.append(_name_16, "\t\t\t"); - _builder.append(".getInterfaceItem(i)));"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("void "); - String _name_17 = ac.getName(); - _builder.append(_name_17, ""); - _builder.append("::destroy(){"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings_3 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_3 = _settings_3.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_3) { - _builder.append("\t"); - _builder.append("MSCFunctionObject mscFunctionObject(getInstancePathName(), \"destroy()\");"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - String _userStructorBody_1 = this._procedureHelpers.userStructorBody(ac, false); - _builder.append(_userStructorBody_1, "\t"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings_4 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_4 = _settings_4.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_4) { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addMessageActorDestroy(*this);"); - _builder.newLine(); - } - } - { - if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { - _builder.append("\t"); - _builder.append("RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(getThread())->removePollingMessageReceiver(*this);"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append(rtBaseClassName, "\t"); - _builder.append("::destroy();"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - EList _operations = ac.getOperations(); - String _name_18 = ac.getName(); - CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, _name_18); - _builder.append(_operationsImplementation, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - boolean _hasNonEmptyStateMachine_1 = this._roomHelpers.hasNonEmptyStateMachine(ac); - if (_hasNonEmptyStateMachine_1) { - CharSequence _genStateMachineMethods = this._stateMachineGen.genStateMachineMethods(xpac, true); - _builder.append(_genStateMachineMethods, ""); - _builder.newLineIfNotEmpty(); - { - ComponentCommunicationType _commType = ac.getCommType(); - boolean _equals = Objects.equal(_commType, ComponentCommunicationType.DATA_DRIVEN); - if (_equals) { - _builder.append("void "); - String _name_19 = ac.getName(); - _builder.append(_name_19, ""); - _builder.append("::receiveEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("handleSystemEvent(ifitem, evt, generic_data);"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } - } - { - if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { - _builder.append("void "); - String _name_20 = ac.getName(); - _builder.append(_name_20, ""); - _builder.append("::receive(const Message* msg) {"); - _builder.newLineIfNotEmpty(); - { - ComponentCommunicationType _commType_1 = ac.getCommType(); - boolean _equals_1 = Objects.equal(_commType_1, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals_1) { - _builder.append("\t"); - _builder.append("receiveEvent(0, -1, 0);"); - _builder.newLine(); - } else { - _builder.append("\t"); - _builder.append("receiveEventInternal();"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - } - } - } else { - StateGraph _stateMachine = xpac.getStateMachine(); - boolean _isEmpty = this._roomHelpers.isEmpty(_stateMachine); - if (_isEmpty) { - _builder.append("//--------------------- no state machine"); - _builder.newLine(); - _builder.append("void "); - String _name_21 = ac.getName(); - _builder.append(_name_21, ""); - _builder.append("::receiveEvent(InterfaceItemBase* ifitem, int evt, void* data) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("handleSystemEvent(ifitem, evt, data);"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } - } - } - _builder.newLine(); - String _generateNamespaceEnd = this._cppExtensions.generateNamespaceEnd(ac); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.java deleted file mode 100644 index 44b6c04f4..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.java +++ /dev/null @@ -1,570 +0,0 @@ -/** - * Copyright (c) 2012 Juergen Haug - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug - * Peter Karlitschek - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase; -import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.ExternalType; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.PortClass; -import org.eclipse.etrice.core.room.PrimitiveType; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.base.IDataConfiguration; -import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.generic.TypeHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.StringExtensions; - -@SuppressWarnings("all") -public class ConfigGenAddon { - @Inject - @Extension - private CppExtensions stdExt; - - @Inject - @Extension - private TypeHelpers typeHelpers; - - @Inject - @Extension - private ProcedureHelpers helpers; - - @Inject - private IDataConfiguration dataConfigExt; - - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - public CharSequence genActorInstanceConfig(final ActorInstance ai, final String aiVariableName) { - StringConcatenation _builder = new StringConcatenation(); - { - ActorClass _actorClass = ai.getActorClass(); - List _allAttributes = this._roomHelpers.getAllAttributes(_actorClass); - for(final Attribute a : _allAttributes) { - ArrayList _arrayList = new ArrayList(); - List _union = this._roomExtensions.union(_arrayList, a); - String _applyInstanceConfig = this.applyInstanceConfig(ai, aiVariableName, _union); - _builder.append(_applyInstanceConfig, ""); - _builder.newLineIfNotEmpty(); - } - } - { - EList _orderedIfItemInstances = ai.getOrderedIfItemInstances(); - for(final InterfaceItemInstance pi : _orderedIfItemInstances) { - InterfaceItem _interfaceItem = pi.getInterfaceItem(); - PortClass _portClass = this._roomHelpers.getPortClass(_interfaceItem); - EList _attributes = null; - if (_portClass!=null) { - _attributes=_portClass.getAttributes(); - } - EList attribs = _attributes; - _builder.newLineIfNotEmpty(); - { - boolean _notEquals = (!Objects.equal(attribs, null)); - if (_notEquals) { - { - for(final Attribute a_1 : attribs) { - String _name = pi.getName(); - CharSequence _invokeGetter = this.helpers.invokeGetter(_name, null); - String _plus = ((aiVariableName + ".") + _invokeGetter); - ArrayList _arrayList_1 = new ArrayList(); - List _union_1 = this._roomExtensions.union(_arrayList_1, a_1); - String _applyInstanceConfig_1 = this.applyInstanceConfig(pi, _plus, _union_1); - _builder.append(_applyInstanceConfig_1, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - return _builder; - } - - private String applyInstanceConfig(final InstanceBase instance, final String invokes, final List path) { - String _xblockexpression = null; - { - Attribute a = IterableExtensions.last(path); - RefableType _type = a.getType(); - DataType aType = _type.getType(); - String _xifexpression = null; - boolean _isPrimitive = this.typeHelpers.isPrimitive(aType); - if (_isPrimitive) { - String _xblockexpression_1 = null; - { - String value = this.typeHelpers.getAttrInstanceConfigValue(path, instance); - String _xifexpression_1 = null; - boolean _equals = Objects.equal(value, null); - if (_equals) { - StringConcatenation _builder = new StringConcatenation(); - _xifexpression_1 = _builder.toString(); - } else { - String _xifexpression_2 = null; - if (((a.getSize() == 0) || this.typeHelpers.isCharacterType(aType))) { - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append(invokes, ""); - _builder_1.append("."); - String _name = a.getName(); - String _valueLiteral = this.stdExt.toValueLiteral(((PrimitiveType) aType), value); - CharSequence _invokeSetter = this.helpers.invokeSetter(_name, null, _valueLiteral); - _builder_1.append(_invokeSetter, ""); - _builder_1.append(";"); - _xifexpression_2 = _builder_1.toString(); - } else { - String _xifexpression_3 = null; - int _size = a.getSize(); - String[] _split = value.split(","); - int _size_1 = ((List)Conversions.doWrapArray(_split)).size(); - boolean _equals_1 = (_size == _size_1); - if (_equals_1) { - String _xblockexpression_2 = null; - { - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("{ "); - { - String[] _split_1 = value.split(","); - boolean _hasElements = false; - for(final String s : _split_1) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder_2.appendImmediate(", ", ""); - } - String _trim = s.trim(); - String _valueLiteral_1 = this.stdExt.toValueLiteral(((PrimitiveType) aType), _trim); - _builder_2.append(_valueLiteral_1, ""); - } - } - _builder_2.append(" }"); - String arrayExpr = _builder_2.toString(); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append(invokes, ""); - _builder_3.append("."); - String _name_1 = a.getName(); - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("new "); - String _typeName = this.typeHelpers.typeName(aType); - _builder_4.append(_typeName, ""); - _builder_4.append("[] "); - _builder_4.append(arrayExpr, ""); - String _string = _builder_4.toString(); - CharSequence _invokeSetter_1 = this.helpers.invokeSetter(_name_1, null, _string); - _builder_3.append(_invokeSetter_1, ""); - _builder_3.append(";"); - _xblockexpression_2 = _builder_3.toString(); - } - _xifexpression_3 = _xblockexpression_2; - } else { - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("{"); - _builder_2.newLine(); - _builder_2.append("\t"); - String _typeName = this.typeHelpers.typeName(aType); - _builder_2.append(_typeName, "\t"); - _builder_2.append("[] array = "); - _builder_2.append(invokes, "\t"); - _builder_2.append("."); - String _name_1 = a.getName(); - CharSequence _invokeGetter = this.helpers.invokeGetter(_name_1, null); - _builder_2.append(_invokeGetter, "\t"); - _builder_2.append(";"); - _builder_2.newLineIfNotEmpty(); - _builder_2.append("\t"); - _builder_2.append("for (int i=0;i<"); - int _size_2 = a.getSize(); - _builder_2.append(_size_2, "\t"); - _builder_2.append(";i++){"); - _builder_2.newLineIfNotEmpty(); - _builder_2.append("\t\t"); - _builder_2.append("array[i] = "); - String _valueLiteral_1 = this.stdExt.toValueLiteral(((PrimitiveType) aType), value); - _builder_2.append(_valueLiteral_1, "\t\t"); - _builder_2.append(";"); - _builder_2.newLineIfNotEmpty(); - _builder_2.append("}"); - _xifexpression_3 = _builder_2.toString(); - } - _xifexpression_2 = _xifexpression_3; - } - _xifexpression_1 = _xifexpression_2; - } - _xblockexpression_1 = _xifexpression_1; - } - _xifexpression = _xblockexpression_1; - } else { - String _xifexpression_1 = null; - boolean _isDataClass = this.typeHelpers.isDataClass(aType); - if (_isDataClass) { - StringConcatenation _builder = new StringConcatenation(); - { - EList _attributes = ((DataClass) aType).getAttributes(); - for(final Attribute e : _attributes) { - String _name = a.getName(); - CharSequence _invokeGetter = this.helpers.invokeGetter(_name, null); - String _plus = ((invokes + ".") + _invokeGetter); - List _union = this._roomExtensions.union(path, e); - String _applyInstanceConfig = this.applyInstanceConfig(instance, _plus, _union); - _builder.append(_applyInstanceConfig, ""); - _builder.newLineIfNotEmpty(); - } - } - _xifexpression_1 = _builder.toString(); - } - _xifexpression = _xifexpression_1; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - public CharSequence genDynConfigGetterSetter(final ActorClass ac) { - StringConcatenation _builder = new StringConcatenation(); - { - List _dynConfigReadAttributes = this.dataConfigExt.getDynConfigReadAttributes(ac); - for(final Attribute a : _dynConfigReadAttributes) { - _builder.append("public "); - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this.typeHelpers.typeName(_type_1); - _builder.append(_typeName, ""); - { - int _size = a.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _builder.append("[]"); - } - } - _builder.append(" get"); - String _name = a.getName(); - String _firstUpper = StringExtensions.toFirstUpper(_name); - _builder.append(_firstUpper, ""); - _builder.append("(){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if(lock_"); - String _name_1 = a.getName(); - _builder.append(_name_1, "\t"); - _builder.append(" == null)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("return "); - String _name_2 = a.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("else"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("synchronized(lock_"); - String _name_3 = a.getName(); - _builder.append(_name_3, "\t\t"); - _builder.append("){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("return "); - String _name_4 = a.getName(); - _builder.append(_name_4, "\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.append("public void set"); - String _name_5 = a.getName(); - String _firstUpper_1 = StringExtensions.toFirstUpper(_name_5); - _builder.append(_firstUpper_1, ""); - _builder.append("("); - RefableType _type_2 = a.getType(); - DataType _type_3 = _type_2.getType(); - String _typeName_1 = this.typeHelpers.typeName(_type_3); - _builder.append(_typeName_1, ""); - { - int _size_1 = a.getSize(); - boolean _greaterThan_1 = (_size_1 > 0); - if (_greaterThan_1) { - _builder.append("[]"); - } - } - _builder.append(" "); - String _name_6 = a.getName(); - _builder.append(_name_6, ""); - _builder.append("){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if(lock_"); - String _name_7 = a.getName(); - _builder.append(_name_7, "\t"); - _builder.append(" == null)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("this."); - String _name_8 = a.getName(); - _builder.append(_name_8, "\t\t"); - _builder.append(" = "); - String _name_9 = a.getName(); - _builder.append(_name_9, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("else"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("synchronized(lock_"); - String _name_10 = a.getName(); - _builder.append(_name_10, "\t\t"); - _builder.append("){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("this."); - String _name_11 = a.getName(); - _builder.append(_name_11, "\t\t\t"); - _builder.append(" = "); - String _name_12 = a.getName(); - _builder.append(_name_12, "\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.append("public DynConfigLock get"); - String _name_13 = a.getName(); - String _firstUpper_2 = StringExtensions.toFirstUpper(_name_13); - _builder.append(_firstUpper_2, ""); - _builder.append("Lock(){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("return lock_"); - String _name_14 = a.getName(); - _builder.append(_name_14, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("}\t"); - _builder.newLine(); - } - } - { - List _dynConfigWriteAttributes = this.dataConfigExt.getDynConfigWriteAttributes(ac); - for(final Attribute a_1 : _dynConfigWriteAttributes) { - _builder.append("public void setAndWrite"); - String _name_15 = a_1.getName(); - String _firstUpper_3 = StringExtensions.toFirstUpper(_name_15); - _builder.append(_firstUpper_3, ""); - _builder.append("("); - RefableType _type_4 = a_1.getType(); - DataType _type_5 = _type_4.getType(); - String _typeName_2 = this.typeHelpers.typeName(_type_5); - _builder.append(_typeName_2, ""); - { - int _size_2 = a_1.getSize(); - boolean _greaterThan_2 = (_size_2 > 0); - if (_greaterThan_2) { - _builder.append("[]"); - } - } - _builder.append(" "); - String _name_16 = a_1.getName(); - _builder.append(_name_16, ""); - _builder.append("){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("set"); - String _name_17 = a_1.getName(); - String _firstUpper_4 = StringExtensions.toFirstUpper(_name_17); - _builder.append(_firstUpper_4, "\t\t"); - _builder.append("("); - String _name_18 = a_1.getName(); - _builder.append(_name_18, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("variableService.write(this.getInstancePath()+\"/"); - String _name_19 = a_1.getName(); - _builder.append(_name_19, "\t\t"); - _builder.append("\", "); - String _name_20 = a_1.getName(); - _builder.append(_name_20, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - return _builder; - } - - public String genMinMaxConstants(final ActorClass ac) { - StringConcatenation _builder = new StringConcatenation(); - { - EList _attributes = ac.getAttributes(); - for(final Attribute a : _attributes) { - String _name = a.getName(); - ArrayList _arrayList = new ArrayList(); - List _union = this._roomExtensions.union(_arrayList, a); - String _genMinMaxConstantsRec = this.genMinMaxConstantsRec(ac, _name, _union); - _builder.append(_genMinMaxConstantsRec, ""); - _builder.newLineIfNotEmpty(); - } - } - String result = _builder.toString(); - int _length = result.length(); - boolean _notEquals = (_length != 0); - if (_notEquals) { - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("//--------------------- Attribute Specifications"); - String _plus = (result + _builder_1); - result = _plus; - } - return result; - } - - private String genMinMaxConstantsRec(final ActorClass ac, final String varNamePath, final List path) { - String _xblockexpression = null; - { - String temp = ((String) null); - String _xifexpression = null; - Attribute _last = IterableExtensions.last(path); - RefableType _type = _last.getType(); - DataType _type_1 = _type.getType(); - boolean _isDataClass = this.typeHelpers.isDataClass(_type_1); - if (_isDataClass) { - StringConcatenation _builder = new StringConcatenation(); - { - Attribute _last_1 = IterableExtensions.last(path); - RefableType _type_2 = _last_1.getType(); - DataType _type_3 = _type_2.getType(); - List _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) _type_3)); - for(final Attribute e : _allAttributes) { - String _name = e.getName(); - String _plus = ((varNamePath + "_") + _name); - List _union = this._roomExtensions.union(path, e); - String _genMinMaxConstantsRec = this.genMinMaxConstantsRec(ac, _plus, _union); - _builder.append(_genMinMaxConstantsRec, ""); - _builder.newLineIfNotEmpty(); - } - } - _xifexpression = _builder.toString(); - } else { - String _xifexpression_1 = null; - Attribute _last_2 = IterableExtensions.last(path); - RefableType _type_4 = _last_2.getType(); - DataType _type_5 = _type_4.getType(); - if ((_type_5 instanceof ExternalType)) { - _xifexpression_1 = null; - } else { - String _xifexpression_2 = null; - Attribute _last_3 = IterableExtensions.last(path); - RefableType _type_6 = _last_3.getType(); - DataType _type_7 = _type_6.getType(); - if ((_type_7 instanceof EnumerationType)) { - _xifexpression_2 = null; - } else { - String _xblockexpression_1 = null; - { - Attribute _last_4 = IterableExtensions.last(path); - RefableType _type_8 = _last_4.getType(); - DataType _type_9 = _type_8.getType(); - PrimitiveType aType = ((PrimitiveType) _type_9); - StringConcatenation _builder_1 = new StringConcatenation(); - { - String _attrClassConfigMinValue = this.dataConfigExt.getAttrClassConfigMinValue(ac, path); - String _temp = (temp = _attrClassConfigMinValue); - boolean _notEquals = (!Objects.equal(_temp, null)); - if (_notEquals) { - _builder_1.append("public static "); - String _minMaxType = this.getMinMaxType(aType); - _builder_1.append(_minMaxType, ""); - _builder_1.append(" MIN_"); - _builder_1.append(varNamePath, ""); - _builder_1.append(" = "); - String _valueLiteral = this.stdExt.toValueLiteral(aType, temp); - _builder_1.append(_valueLiteral, ""); - _builder_1.append(";"); - _builder_1.newLineIfNotEmpty(); - } - } - { - String _attrClassConfigMaxValue = this.dataConfigExt.getAttrClassConfigMaxValue(ac, path); - String _temp_1 = (temp = _attrClassConfigMaxValue); - boolean _notEquals_1 = (!Objects.equal(_temp_1, null)); - if (_notEquals_1) { - _builder_1.append("public static "); - String _minMaxType_1 = this.getMinMaxType(aType); - _builder_1.append(_minMaxType_1, ""); - _builder_1.append(" MAX_"); - _builder_1.append(varNamePath, ""); - _builder_1.append(" = "); - String _valueLiteral_1 = this.stdExt.toValueLiteral(aType, temp); - _builder_1.append(_valueLiteral_1, ""); - _builder_1.append(";"); - _builder_1.newLineIfNotEmpty(); - } - } - _xblockexpression_1 = _builder_1.toString(); - } - _xifexpression_2 = _xblockexpression_1; - } - _xifexpression_1 = _xifexpression_2; - } - _xifexpression = _xifexpression_1; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - private String getMinMaxType(final PrimitiveType type) { - String _switchResult = null; - String _typeName = this.typeHelpers.typeName(type); - switch (_typeName) { - case "byte": - _switchResult = "int"; - break; - case "short": - _switchResult = "int"; - break; - case "float": - _switchResult = "double"; - break; - default: - _switchResult = this.typeHelpers.typeName(type); - break; - } - return _switchResult; - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java deleted file mode 100644 index f6030edbe..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java +++ /dev/null @@ -1,614 +0,0 @@ -/** - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * Peter Karlitschek - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.Collections; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.common.base.KeyValue; -import org.eclipse.etrice.core.common.base.Literal; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.IDiagnostician; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumLiteral; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.ExternalType; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.PrimitiveType; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.RoomClass; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.core.room.util.RoomHelpers; -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.util.Strings; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@Singleton -@SuppressWarnings("all") -public class CppExtensions implements ILanguageExtension { - @Inject - private IDiagnostician diagnostician; - - @Inject - @Extension - private TypeHelpers _typeHelpers; - - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Override - public String getTypedDataDefinition(final EObject msg) { - VarDecl _data = ((Message) msg).getData(); - String[] _generateArglistAndTypedData = this.generateArglistAndTypedData(_data); - return _generateArglistAndTypedData[1]; - } - - public String getCppHeaderFileName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + ".h"); - } - - public String getCppSourceFileName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + ".cpp"); - } - - public String getCppClassName(final NodeRef nr, final SubSystemInstance ssi) { - String _name = nr.getName(); - String _plus = ("Node_" + _name); - String _plus_1 = (_plus + "_"); - String _name_1 = ssi.getName(); - return (_plus_1 + _name_1); - } - - public String getCppHeaderFileName(final NodeRef nr, final SubSystemInstance ssi) { - String _cppClassName = this.getCppClassName(nr, ssi); - return (_cppClassName + ".h"); - } - - public String getCppSourceFileName(final NodeRef nr, final SubSystemInstance ssi) { - String _cppClassName = this.getCppClassName(nr, ssi); - return (_cppClassName + ".cpp"); - } - - @Override - public String accessLevelPrivate() { - return ""; - } - - @Override - public String accessLevelProtected() { - return ""; - } - - @Override - public String accessLevelPublic() { - return ""; - } - - @Override - public String memberAccess() { - return "this->"; - } - - @Override - public String selfPointer(final String classname, final boolean hasArgs) { - return ""; - } - - @Override - public String selfPointer(final boolean hasArgs) { - return ""; - } - - @Override - public String scopeSeparator() { - return "::"; - } - - @Override - public String operationScope(final String classname, final boolean isDeclaration) { - String _xifexpression = null; - if (isDeclaration) { - _xifexpression = ""; - } else { - _xifexpression = (classname + "::"); - } - return _xifexpression; - } - - @Override - public String memberInDeclaration(final String namespace, final String member) { - return member; - } - - @Override - public String memberInUse(final String namespace, final String member) { - return ((namespace + ".") + member); - } - - @Override - public boolean usesInheritance() { - return true; - } - - @Override - public boolean usesPointers() { - return true; - } - - @Override - public String genEnumeration(final String name, final List> entries) { - String _xblockexpression = null; - { - boolean _isEmpty = entries.isEmpty(); - if (_isEmpty) { - return ""; - } - StringConcatenation _builder = new StringConcatenation(); - _builder.append("typedef enum {"); - _builder.newLine(); - { - boolean _hasElements = false; - for(final Pair entry : entries) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - String _first = entry.getFirst(); - _builder.append(_first, "\t"); - _builder.append(" = "); - String _second = entry.getSecond(); - _builder.append(_second, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("} "); - _builder.append(name, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder.toString(); - } - return _xblockexpression; - } - - @Override - public String booleanConstant(final boolean b) { - return Boolean.valueOf(b).toString(); - } - - @Override - public String pointerLiteral() { - return "*"; - } - - @Override - public String nullPointer() { - return "0"; - } - - @Override - public String voidPointer() { - return "void*"; - } - - @Override - public String arrayType(final String type, final int size, final boolean isRef) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("StaticArray<"); - _builder.append(type, ""); - { - if (isRef) { - _builder.append("*"); - } - } - _builder.append(", "); - _builder.append(size, ""); - _builder.append(">"); - return _builder.toString(); - } - - @Override - public String arrayDeclaration(final String type, final int size, final boolean isRef, final String name) { - String _arrayType = this.arrayType(type, size, isRef); - String _plus = (_arrayType + " "); - return (_plus + name); - } - - public String getIncludeGuardString(final RoomClass roomClass, final String appendSegments) { - String _package = this._roomExtensions.getPackage(roomClass); - String[] _split = _package.split("\\."); - String _name = roomClass.getName(); - Iterable _plus = Iterables.concat(((Iterable)Conversions.doWrapArray(_split)), Collections.unmodifiableList(CollectionLiterals.newArrayList(_name))); - String[] _split_1 = appendSegments.split("\\."); - Iterable _plus_1 = Iterables.concat(_plus, ((Iterable)Conversions.doWrapArray(_split_1))); - final Function1 _function = (String it) -> { - boolean _isEmpty = it.isEmpty(); - return Boolean.valueOf((!_isEmpty)); - }; - Iterable _filter = IterableExtensions.filter(_plus_1, _function); - String _join = IterableExtensions.join(_filter, "_"); - String _upperCase = _join.toUpperCase(); - String _plus_2 = ("_" + _upperCase); - return (_plus_2 + "_H_"); - } - - public CharSequence generateIncludeGuardBegin(final RoomClass roomClass, final String appendSegments) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#ifndef "); - String _includeGuardString = this.getIncludeGuardString(roomClass, appendSegments); - _builder.append(_includeGuardString, ""); - _builder.newLineIfNotEmpty(); - _builder.append("#define "); - String _includeGuardString_1 = this.getIncludeGuardString(roomClass, appendSegments); - _builder.append(_includeGuardString_1, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public CharSequence generateIncludeGuardEnd(final RoomClass roomClass, final String appendSegments) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#endif /* "); - String _includeGuardString = this.getIncludeGuardString(roomClass, appendSegments); - _builder.append(_includeGuardString, ""); - _builder.append(" */"); - return _builder; - } - - public String generateNamespaceBegin(final RoomClass roomClass) { - return ""; - } - - public String generateNamespaceEnd(final RoomClass roomClass) { - return ""; - } - - @Override - public String superCall(final String baseClassName, final String method, final String arguments) { - return (((((baseClassName + "::") + method) + "(") + arguments) + ");"); - } - - @Override - public String toValueLiteral(final PrimitiveType type, final String value) { - throw new UnsupportedOperationException("TODO Config for Cpp"); - } - - @Override - public String toEnumLiteral(final EnumerationType type, final String value) { - throw new UnsupportedOperationException("TODO Config for Cpp"); - } - - @Override - public String defaultValue(final DataType dt) { - String _switchResult = null; - final DataType it = dt; - boolean _matched = false; - if (it instanceof PrimitiveType) { - _matched=true; - _switchResult = ((PrimitiveType)it).getDefaultValueLiteral(); - } - if (!_matched) { - if (it instanceof EnumerationType) { - _matched=true; - String _xblockexpression = null; - { - this.diagnostician.error("Enumeration not supported", dt, null); - _xblockexpression = "/* TODO */"; - } - _switchResult = _xblockexpression; - } - } - if (!_matched) { - if (it instanceof ExternalType) { - _matched=true; - _switchResult = ((ExternalType)it).getDefaultValueLiteral(); - } - } - return _switchResult; - } - - public String getDefaultValue(final EnumerationType type) { - String _xifexpression = null; - EList _literals = type.getLiterals(); - boolean _isEmpty = _literals.isEmpty(); - if (_isEmpty) { - _xifexpression = ""; - } else { - EList _literals_1 = type.getLiterals(); - EnumLiteral _get = _literals_1.get(0); - _xifexpression = this.getCastedValue(_get); - } - return _xifexpression; - } - - @Override - public String initializationWithDefaultValues(final DataType dt, final int size) { - String _xblockexpression = null; - { - final String dv = this.defaultValue(dt); - String _xifexpression = null; - if ((size > 1)) { - String _xblockexpression_1 = null; - { - String res = "{"; - int i = 0; - while ((i < size)) { - { - res = (res + dv); - i = (i + 1); - if ((i < size)) { - res = (res + ","); - } - } - } - _xblockexpression_1 = (res + "}"); - } - _xifexpression = _xblockexpression_1; - } else { - _xifexpression = dv; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - @Override - public String[] generateArglistAndTypedData(final EObject d) { - if ((Objects.equal(d, null) || (!(d instanceof VarDecl)))) { - return ((String[])Conversions.unwrapArray(CollectionLiterals.newArrayList("", "", ""), String.class)); - } - final VarDecl data = ((VarDecl) d); - String _switchResult = null; - RefableType _refType = data.getRefType(); - DataType _type = _refType.getType(); - final DataType it = _type; - boolean _matched = false; - if (it instanceof PrimitiveType) { - String _castName = ((PrimitiveType)it).getCastName(); - boolean _isEmpty = Strings.isEmpty(_castName); - boolean _not = (!_isEmpty); - if (_not) { - _matched=true; - _switchResult = ((PrimitiveType)it).getCastName(); - } - } - if (!_matched) { - if (it instanceof EnumerationType) { - _matched=true; - _switchResult = this.getCastType(((EnumerationType)it)); - } - } - if (!_matched) { - _switchResult = this._typeHelpers.typeName(it); - } - final String castExpr = (_switchResult + "*"); - RefableType _refType_1 = data.getRefType(); - DataType _type_1 = _refType_1.getType(); - String _typeName = this._typeHelpers.typeName(_type_1); - String _switchResult_1 = null; - RefableType _refType_2 = data.getRefType(); - final RefableType it_1 = _refType_2; - boolean _matched_1 = false; - boolean _isRef = it_1.isRef(); - if (_isRef) { - _matched_1=true; - _switchResult_1 = "*"; - } - if (!_matched_1) { - DataType _type_2 = it_1.getType(); - boolean _isPrimitive = this._typeHelpers.isPrimitive(_type_2); - if (_isPrimitive) { - _matched_1=true; - _switchResult_1 = ""; - } - } - if (!_matched_1) { - _switchResult_1 = "&"; - } - final String typeExpr = (_typeName + _switchResult_1); - String _xifexpression = null; - RefableType _refType_3 = data.getRefType(); - boolean _isRef_1 = _refType_3.isRef(); - boolean _not = (!_isRef_1); - if (_not) { - _xifexpression = "*"; - } else { - _xifexpression = ""; - } - String deRef = _xifexpression; - StringConcatenation _builder = new StringConcatenation(); - _builder.append(typeExpr, ""); - _builder.append(" "); - String _name = data.getName(); - _builder.append(_name, ""); - _builder.append(" = "); - _builder.append(deRef, ""); - _builder.append("(static_cast<"); - _builder.append(castExpr, ""); - _builder.append(">(generic_data__et));"); - final String typedData = (_builder.toString() + this._roomExtensions.NEWLINE); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append(", "); - String _name_1 = data.getName(); - _builder_1.append(_name_1, ""); - final String dataArg = _builder_1.toString(); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append(", "); - _builder_2.append(typeExpr, ""); - _builder_2.append(" "); - String _name_2 = data.getName(); - _builder_2.append(_name_2, ""); - final String typedArgList = _builder_2.toString(); - return new String[] { dataArg, typedData, typedArgList }; - } - - @Override - public String getTargetType(final EnumerationType type) { - String _xifexpression = null; - PrimitiveType _primitiveType = type.getPrimitiveType(); - boolean _notEquals = (!Objects.equal(_primitiveType, null)); - if (_notEquals) { - PrimitiveType _primitiveType_1 = type.getPrimitiveType(); - _xifexpression = _primitiveType_1.getTargetName(); - } else { - _xifexpression = type.getName(); - } - return _xifexpression; - } - - @Override - public String getCastedValue(final EnumLiteral literal) { - String _xblockexpression = null; - { - EObject _eContainer = literal.eContainer(); - final EnumerationType type = ((EnumerationType) _eContainer); - final String cast = this.getTargetType(type); - String _xifexpression = null; - PrimitiveType _primitiveType = type.getPrimitiveType(); - boolean _notEquals = (!Objects.equal(_primitiveType, null)); - if (_notEquals) { - long _literalValue = literal.getLiteralValue(); - _xifexpression = Long.toString(_literalValue); - } else { - long _literalValue_1 = literal.getLiteralValue(); - String _string = Long.toString(_literalValue_1); - String _plus = ((("((" + cast) + ")") + _string); - _xifexpression = (_plus + ")"); - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - @Override - public String getCastType(final EnumerationType type) { - String _xifexpression = null; - PrimitiveType _primitiveType = type.getPrimitiveType(); - boolean _notEquals = (!Objects.equal(_primitiveType, null)); - if (_notEquals) { - PrimitiveType _primitiveType_1 = type.getPrimitiveType(); - _xifexpression = _primitiveType_1.getCastName(); - } else { - _xifexpression = type.getName(); - } - return _xifexpression; - } - - @Override - public String makeOverridable() { - return "virtual "; - } - - /** - * check if there is an ImplementationSubclass annotation and return its fully qualified name or the actor class name - */ - public String getImplementationClassName(final ActorClass ac) { - String _xblockexpression = null; - { - final List attributes = this._roomHelpers.getAttributes(ac, "ImplementationSubclass"); - String _xifexpression = null; - boolean _isEmpty = attributes.isEmpty(); - if (_isEmpty) { - _xifexpression = ac.getName(); - } else { - final Function1 _function = (KeyValue it) -> { - String _key = it.getKey(); - return Boolean.valueOf(Objects.equal(_key, "fqnClassName")); - }; - Iterable _filter = IterableExtensions.filter(attributes, _function); - KeyValue _head = IterableExtensions.head(_filter); - Literal _value = _head.getValue(); - _xifexpression = this._roomHelpers.literalToString(_value); - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - /** - * check if there is an ImplementationSubclass annotation. If it also has an includePath use it. - * If there is not includePath, use the class name as base file name. - * If there is no annotation use the default path. - */ - public String getActorIncludePath(final ActorClass ac) { - String _xblockexpression = null; - { - final List attributes = this._roomHelpers.getAttributes(ac, "ImplementationSubclass"); - String _xifexpression = null; - boolean _isEmpty = attributes.isEmpty(); - if (_isEmpty) { - String _path = this._roomExtensions.getPath(ac); - String _name = ac.getName(); - String _plus = (_path + _name); - _xifexpression = (_plus + ".h"); - } else { - String _xblockexpression_1 = null; - { - final Function1 _function = (KeyValue it) -> { - String _key = it.getKey(); - return Boolean.valueOf(Objects.equal(_key, "includePath")); - }; - final Iterable path = IterableExtensions.filter(attributes, _function); - String _xifexpression_1 = null; - boolean _isEmpty_1 = IterableExtensions.isEmpty(path); - if (_isEmpty_1) { - String _xblockexpression_2 = null; - { - final Function1 _function_1 = (KeyValue it) -> { - String _key = it.getKey(); - return Boolean.valueOf(Objects.equal(_key, "fqnClassName")); - }; - Iterable _filter = IterableExtensions.filter(attributes, _function_1); - KeyValue _head = IterableExtensions.head(_filter); - Literal _value = _head.getValue(); - String _literalToString = this._roomHelpers.literalToString(_value); - String[] _split = _literalToString.split("::"); - final String baseName = IterableExtensions.last(((Iterable)Conversions.doWrapArray(_split))); - _xblockexpression_2 = (baseName + ".h"); - } - _xifexpression_1 = _xblockexpression_2; - } else { - KeyValue _head = IterableExtensions.head(path); - Literal _value = _head.getValue(); - _xifexpression_1 = this._roomHelpers.literalToString(_value); - } - _xblockexpression_1 = _xifexpression_1; - } - _xifexpression = _xblockexpression_1; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppProcedureHelpers.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppProcedureHelpers.java deleted file mode 100644 index 6b4e0eb55..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppProcedureHelpers.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.common.base.Objects; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@SuppressWarnings("all") -public class CppProcedureHelpers extends ProcedureHelpers { - @Override - protected CharSequence getterHeader(final Attribute attribute, final String classname) { - String _xblockexpression = null; - { - String _xifexpression = null; - if (((attribute.getSize() == 0) && (this._typeHelpers.isPrimitive(attribute.getType().getType()) || attribute.getType().isRef()))) { - _xifexpression = " const"; - } else { - _xifexpression = ""; - } - final String constModifier = _xifexpression; - CharSequence _terHeader = super.getterHeader(attribute, classname); - _xblockexpression = (_terHeader + constModifier); - } - return _xblockexpression; - } - - @Override - public String declarationString(final Attribute attribute) { - String _switchResult = null; - final Attribute it = attribute; - boolean _matched = false; - int _size = it.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _matched=true; - _switchResult = super.declarationString(it); - } - if (!_matched) { - RefableType _type = it.getType(); - String _signatureString = super.signatureString(_type); - String _plus = (_signatureString + " "); - String _name = it.getName(); - _switchResult = (_plus + _name); - } - return _switchResult; - } - - @Override - public String signatureString(final RefableType type) { - String _switchResult = null; - final RefableType it = type; - boolean _matched = false; - if (Objects.equal(it, null)) { - _matched=true; - _switchResult = "void"; - } - if (!_matched) { - boolean _not = (!(it.isRef() || this._typeHelpers.isPrimitive(type.getType()))); - if (_not) { - _matched=true; - String _signatureString = super.signatureString(type); - _switchResult = (_signatureString + "&"); - } - } - if (!_matched) { - _switchResult = super.signatureString(type); - } - return _switchResult; - } - - @Override - public String signatureString(final Attribute attribute) { - String _switchResult = null; - final Attribute it = attribute; - boolean _matched = false; - int _size = it.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _matched=true; - String _signatureString = super.signatureString(attribute); - _switchResult = (_signatureString + "&"); - } - if (!_matched) { - RefableType _type = it.getType(); - _switchResult = this.signatureString(_type); - } - return _switchResult; - } - - /** - * @param attributes a list of {@link Attribute}s - * @return an argument list for the attributes with const except for ref {@link Attribute}s - */ - public String constArgList(final Iterable attributes) { - final Function1 _function = (Attribute it) -> { - String _xifexpression = null; - RefableType _type = it.getType(); - boolean _isRef = _type.isRef(); - boolean _not = (!_isRef); - if (_not) { - _xifexpression = "const "; - } else { - _xifexpression = ""; - } - String _signatureString = this.signatureString(it); - String _plus = (_xifexpression + _signatureString); - String _plus_1 = (_plus + " "); - String _name = it.getName(); - return (_plus_1 + _name); - }; - Iterable _map = IterableExtensions.map(attributes, _function); - return IterableExtensions.join(_map, ", "); - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java deleted file mode 100644 index f97e5e339..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java +++ /dev/null @@ -1,662 +0,0 @@ -/** - * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.ComplexType; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.StandardOperation; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.cpp.gen.CppProcedureHelpers; -import org.eclipse.etrice.generator.cpp.gen.Initialization; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.generator.JavaIoFileSystemAccess; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; - -@Singleton -@SuppressWarnings("all") -public class DataClassGen { - @Inject - @Extension - private JavaIoFileSystemAccess fileAccess; - - @Inject - @Extension - private CppExtensions stdExt; - - @Inject - @Extension - private RoomExtensions roomExt; - - @Inject - @Extension - private CppProcedureHelpers helpers; - - @Inject - private Initialization initHelper; - - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - private ILogger logger; - - public void doGenerate(final Root root) { - this.logger.logInfo("generating code"); - EList _dataClasses = root.getDataClasses(); - for (final DataClass dc : _dataClasses) { - { - String _generationTargetPath = this.roomExt.getGenerationTargetPath(dc); - String _path = this.roomExt.getPath(dc); - String path = (_generationTargetPath + _path); - String _cppHeaderFileName = this.stdExt.getCppHeaderFileName(dc); - String _plus = ("generating DataClass header \'" + _cppHeaderFileName); - String _plus_1 = (_plus + "\' in \'"); - String _plus_2 = (_plus_1 + path); - String _plus_3 = (_plus_2 + "\'"); - this.logger.logInfo(_plus_3); - this.fileAccess.setOutputPath(path); - String _cppHeaderFileName_1 = this.stdExt.getCppHeaderFileName(dc); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, dc); - this.fileAccess.generateFile(_cppHeaderFileName_1, _generateHeaderFile); - String _cppSourceFileName = this.stdExt.getCppSourceFileName(dc); - String _plus_4 = ("generating DataClass source \'" + _cppSourceFileName); - String _plus_5 = (_plus_4 + "\' in \'"); - String _plus_6 = (_plus_5 + path); - String _plus_7 = (_plus_6 + "\'"); - this.logger.logInfo(_plus_7); - this.fileAccess.setOutputPath(path); - String _cppSourceFileName_1 = this.stdExt.getCppSourceFileName(dc); - CharSequence _generateSourceFile = this.generateSourceFile(root, dc); - this.fileAccess.generateFile(_cppSourceFileName_1, _generateSourceFile); - } - } - } - - public CharSequence generateHeaderFile(final Root root, final DataClass dc) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _generateIncludeGuardBegin = this.stdExt.generateIncludeGuardBegin(dc, ""); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"common/etDatatypesCpp.hpp\""); - _builder.newLine(); - { - DataClass _base = dc.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - _builder.append("#include \""); - DataClass _base_1 = dc.getBase(); - String _path = this.roomExt.getPath(_base_1); - _builder.append(_path, ""); - DataClass _base_2 = dc.getBase(); - String _name = _base_2.getName(); - _builder.append(_name, ""); - _builder.append(".h\""); - } - } - _builder.newLineIfNotEmpty(); - { - EList _referencedDataClasses = root.getReferencedDataClasses(dc); - for(final DataClass classes : _referencedDataClasses) { - _builder.append("#include \""); - String _path_1 = this.roomExt.getPath(classes); - _builder.append(_path_1, ""); - String _name_1 = classes.getName(); - _builder.append(_name_1, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } - } - { - EList _referencedModels = root.getReferencedModels(dc); - for(final RoomModel model : _referencedModels) { - { - EList _dataClasses = model.getDataClasses(); - for(final DataClass classes_1 : _dataClasses) { - _builder.append("#include \""); - String _path_2 = this.roomExt.getPath(classes_1); - _builder.append(_path_2, ""); - String _name_2 = classes_1.getName(); - _builder.append(_name_2, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - DetailCode _userCode1 = dc.getUserCode1(); - CharSequence _userCode = this.helpers.userCode(_userCode1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("using namespace etRuntime; // TODO JH remove"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceBegin = this.stdExt.generateNamespaceBegin(dc); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("class "); - String _name_3 = dc.getName(); - _builder.append(_name_3, ""); - { - DataClass _base_3 = dc.getBase(); - boolean _notEquals_1 = (!Objects.equal(_base_3, null)); - if (_notEquals_1) { - _builder.append(" : public "); - DataClass _base_4 = dc.getBase(); - String _name_4 = _base_4.getName(); - _builder.append(_name_4, ""); - } - } - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t"); - DetailCode _userCode2 = dc.getUserCode2(); - CharSequence _userCode_1 = this.helpers.userCode(_userCode2); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - EList _attributes = dc.getAttributes(); - CharSequence _attributes_1 = this.helpers.attributes(_attributes); - _builder.append(_attributes_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - EList _attributes_2 = dc.getAttributes(); - String _name_5 = dc.getName(); - CharSequence _attributeSettersGettersImplementation = this.helpers.attributeSettersGettersImplementation(_attributes_2, _name_5); - _builder.append(_attributeSettersGettersImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - EList _operations = dc.getOperations(); - String _name_6 = dc.getName(); - CharSequence _operationsDeclaration = this.helpers.operationsDeclaration(_operations, _name_6); - _builder.append(_operationsDeclaration, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// default constructor, copy constructor and assignment operator"); - _builder.newLine(); - _builder.append("\t"); - String _name_7 = dc.getName(); - _builder.append(_name_7, "\t"); - _builder.append("();"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _name_8 = dc.getName(); - _builder.append(_name_8, "\t"); - _builder.append("(const "); - String _name_9 = dc.getName(); - _builder.append(_name_9, "\t"); - _builder.append("& rhs);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("// constructor using fields"); - _builder.newLine(); - _builder.append("\t"); - { - List _allAttributes = this._roomHelpers.getAllAttributes(dc); - boolean _isEmpty = _allAttributes.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - String _name_10 = dc.getName(); - _builder.append(_name_10, "\t"); - _builder.append("("); - List _allAttributes_1 = this._roomHelpers.getAllAttributes(dc); - String _constArgList = this.helpers.constArgList(_allAttributes_1); - _builder.append(_constArgList, "\t"); - _builder.append(");"); - } - } - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - String _name_11 = dc.getName(); - _builder.append(_name_11, "\t"); - _builder.append("& operator=(const "); - String _name_12 = dc.getName(); - _builder.append(_name_12, "\t"); - _builder.append("& rhs);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceEnd = this.stdExt.generateNamespaceEnd(dc); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(dc, ""); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - return _builder; - } - - public CharSequence generateSourceFile(final Root root, final DataClass dc) { - 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 DataClass "); - String _name = dc.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \""); - String _cppHeaderFileName = this.stdExt.getCppHeaderFileName(dc); - _builder.append(_cppHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"etUnit/etUnit.h\""); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceBegin = this.stdExt.generateNamespaceBegin(dc); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - DetailCode _userCode3 = dc.getUserCode3(); - CharSequence _userCode = this.helpers.userCode(_userCode3); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("// default constructor"); - _builder.newLine(); - String _name_1 = dc.getName(); - _builder.append(_name_1, ""); - _builder.append("::"); - String _name_2 = dc.getName(); - _builder.append(_name_2, ""); - _builder.append("()"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _generateDefaultInitalizerList = this.generateDefaultInitalizerList(dc); - _builder.append(_generateDefaultInitalizerList, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - EList _attributes = dc.getAttributes(); - CharSequence _genExtraInitializers = this.initHelper.genExtraInitializers(_attributes); - _builder.append(_genExtraInitializers, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _userStructorBody = this.helpers.userStructorBody(dc, true); - _builder.append(_userStructorBody, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// copy constructor"); - _builder.newLine(); - String _name_3 = dc.getName(); - _builder.append(_name_3, ""); - _builder.append("::"); - String _name_4 = dc.getName(); - _builder.append(_name_4, ""); - _builder.append("(const "); - String _name_5 = dc.getName(); - _builder.append(_name_5, ""); - _builder.append("& rhs)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _generateCopyInitalizerList = this.generateCopyInitalizerList(dc); - _builder.append(_generateCopyInitalizerList, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("{"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// constructor using fields"); - _builder.newLine(); - _builder.append("// TODO"); - _builder.newLine(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(dc); - boolean _isEmpty = _allAttributes.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - String _name_6 = dc.getName(); - _builder.append(_name_6, ""); - _builder.append("::"); - String _name_7 = dc.getName(); - _builder.append(_name_7, ""); - _builder.append("("); - List _allAttributes_1 = this._roomHelpers.getAllAttributes(dc); - String _constArgList = this.helpers.constArgList(_allAttributes_1); - _builder.append(_constArgList, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _generateFieldInitializerList = this.generateFieldInitializerList(dc); - _builder.append(_generateFieldInitializerList, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("{"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("// assignment operator"); - _builder.newLine(); - String _name_8 = dc.getName(); - _builder.append(_name_8, ""); - _builder.append("& "); - String _name_9 = dc.getName(); - _builder.append(_name_9, ""); - _builder.append("::operator=(const "); - String _name_10 = dc.getName(); - _builder.append(_name_10, ""); - _builder.append("& rhs)"); - _builder.newLineIfNotEmpty(); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("if (this == &rhs) { return *this; };"); - _builder.newLine(); - _builder.append("\t"); - { - DataClass _base = dc.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - DataClass _base_1 = dc.getBase(); - String _name_11 = _base_1.getName(); - _builder.append(_name_11, "\t"); - _builder.append("::operator=(rhs);"); - } - } - _builder.newLineIfNotEmpty(); - { - EList _attributes_1 = dc.getAttributes(); - for(final Attribute attr : _attributes_1) { - _builder.append("\t"); - _builder.append("this->"); - String _name_12 = attr.getName(); - _builder.append(_name_12, "\t"); - _builder.append(" = rhs."); - String _name_13 = attr.getName(); - _builder.append(_name_13, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("return *this;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - EList _operations = dc.getOperations(); - String _name_14 = dc.getName(); - CharSequence _operationsImplementation = this.helpers.operationsImplementation(_operations, _name_14); - _builder.append(_operationsImplementation, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _generateNamespaceEnd = this.stdExt.generateNamespaceEnd(dc); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - return _builder; - } - - private CharSequence generateDefaultInitalizerList(final DataClass dataClass) { - CharSequence _xblockexpression = null; - { - @Extension - final Initialization initHelper = this.initHelper; - ArrayList initList = CollectionLiterals.newArrayList(); - DataClass _base = dataClass.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - DataClass _base_1 = dataClass.getBase(); - String _name = _base_1.getName(); - String _plus = (_name + "()"); - initList.add(_plus); - } - EList _attributes = dataClass.getAttributes(); - final Function1 _function = (Attribute it) -> { - StringConcatenation _builder = new StringConcatenation(); - String _name_1 = it.getName(); - _builder.append(_name_1, ""); - _builder.append("("); - String _initializerListValue = initHelper.getInitializerListValue(it); - _builder.append(_initializerListValue, ""); - _builder.append(")"); - return _builder.toString(); - }; - List _map = ListExtensions.map(_attributes, _function); - Iterables.addAll(initList, _map); - _xblockexpression = initHelper.generateCtorInitializerList(initList); - } - return _xblockexpression; - } - - private CharSequence generateCopyInitalizerList(final DataClass dataClass) { - CharSequence _xblockexpression = null; - { - @Extension - final Initialization initHelper = this.initHelper; - ArrayList initList = CollectionLiterals.newArrayList(); - DataClass _base = dataClass.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - DataClass _base_1 = dataClass.getBase(); - String _name = _base_1.getName(); - String _plus = (_name + "(rhs)"); - initList.add(_plus); - } - EList _attributes = dataClass.getAttributes(); - final Function1 _function = (Attribute it) -> { - StringConcatenation _builder = new StringConcatenation(); - String _name_1 = it.getName(); - _builder.append(_name_1, ""); - _builder.append("(rhs."); - String _name_2 = it.getName(); - _builder.append(_name_2, ""); - _builder.append(")"); - return _builder.toString(); - }; - List _map = ListExtensions.map(_attributes, _function); - Iterables.addAll(initList, _map); - _xblockexpression = initHelper.generateCtorInitializerList(initList); - } - return _xblockexpression; - } - - private CharSequence generateFieldInitializerList(final DataClass dataClass) { - CharSequence _xblockexpression = null; - { - @Extension - final Initialization initHelper = this.initHelper; - ArrayList initList = CollectionLiterals.newArrayList(); - DataClass _base = dataClass.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - StringConcatenation _builder = new StringConcatenation(); - DataClass _base_1 = dataClass.getBase(); - String _name = _base_1.getName(); - _builder.append(_name, ""); - _builder.append("("); - DataClass _base_2 = dataClass.getBase(); - List _allAttributes = this._roomHelpers.getAllAttributes(_base_2); - final Function1 _function = (Attribute it) -> { - return it.getName(); - }; - List _map = ListExtensions.map(_allAttributes, _function); - String _join = IterableExtensions.join(_map, ", "); - _builder.append(_join, ""); - _builder.append(")"); - initList.add(_builder.toString()); - } - EList _attributes = dataClass.getAttributes(); - final Function1 _function_1 = (Attribute it) -> { - StringConcatenation _builder_1 = new StringConcatenation(); - String _name_1 = it.getName(); - _builder_1.append(_name_1, ""); - _builder_1.append("("); - String _name_2 = it.getName(); - _builder_1.append(_name_2, ""); - _builder_1.append(")"); - return _builder_1.toString(); - }; - List _map_1 = ListExtensions.map(_attributes, _function_1); - Iterables.addAll(initList, _map_1); - _xblockexpression = initHelper.generateCtorInitializerList(initList); - } - return _xblockexpression; - } - - public String deepCopy(final DataClass _dc) { - String result = ""; - DataClass dc = _dc; - while ((!Objects.equal(dc, null))) { - { - EList _attributes = dc.getAttributes(); - CharSequence _deepCopy = this.deepCopy(_attributes); - String _string = _deepCopy.toString(); - String _plus = (_string + result); - result = _plus; - DataClass _base = dc.getBase(); - dc = _base; - } - } - return result; - } - - public CharSequence deepCopy(final List attributes) { - StringConcatenation _builder = new StringConcatenation(); - { - for(final Attribute a : attributes) { - { - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - if ((_type_1 instanceof ComplexType)) { - _builder.append("if ("); - String _name = a.getName(); - _builder.append(_name, ""); - _builder.append("!=null) {"); - _builder.newLineIfNotEmpty(); - { - int _size = a.getSize(); - boolean _equals = (_size == 0); - if (_equals) { - _builder.append("\t"); - _builder.append("copy."); - String _name_1 = a.getName(); - _builder.append(_name_1, "\t"); - _builder.append(" = "); - String _name_2 = a.getName(); - _builder.append(_name_2, "\t"); - _builder.append(".deepCopy();"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("for (int i=0;i<"); - String _name_3 = a.getName(); - _builder.append(_name_3, "\t"); - _builder.append(".length;i++){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("copy."); - String _name_4 = a.getName(); - _builder.append(_name_4, "\t\t"); - _builder.append("[i] = "); - String _name_5 = a.getName(); - _builder.append(_name_5, "\t\t"); - _builder.append("[i].deepCopy();"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - } else { - { - int _size_1 = a.getSize(); - boolean _equals_1 = (_size_1 == 0); - if (_equals_1) { - _builder.append("copy."); - String _name_6 = a.getName(); - _builder.append(_name_6, ""); - _builder.append(" = "); - String _name_7 = a.getName(); - _builder.append(_name_7, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("for (int i=0;i<"); - String _name_8 = a.getName(); - _builder.append(_name_8, ""); - _builder.append(".length;i++){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("copy."); - String _name_9 = a.getName(); - _builder.append(_name_9, "\t"); - _builder.append("[i] = "); - String _name_10 = a.getName(); - _builder.append(_name_10, "\t"); - _builder.append("[i];"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - } - } - } - } - return _builder; - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/Initialization.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/Initialization.java deleted file mode 100644 index 7f6cfbfa6..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/Initialization.java +++ /dev/null @@ -1,173 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Peter Karlitschek - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.generator.generic.ILanguageExtension; -import org.eclipse.etrice.generator.generic.TypeHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@Singleton -@SuppressWarnings("all") -public class Initialization { - @Inject - private ILanguageExtension languageExt; - - @Inject - private TypeHelpers typeHelpers; - - public CharSequence generateCtorInitializerList(final Iterable items) { - CharSequence _xblockexpression = null; - { - boolean _isEmpty = IterableExtensions.isEmpty(items); - if (_isEmpty) { - return ""; - } - StringConcatenation _builder = new StringConcatenation(); - _builder.append(": "); - CharSequence _head = IterableExtensions.head(items); - _builder.append(_head, ""); - _builder.newLineIfNotEmpty(); - { - Iterable _tail = IterableExtensions.tail(items); - for(final CharSequence item : _tail) { - _builder.append(", "); - _builder.append(item, ""); - _builder.newLineIfNotEmpty(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - /** - * Generate array and struct initialization - */ - public CharSequence genExtraInitializers(final Iterable attributes) { - CharSequence _xblockexpression = null; - { - final Function1 _function = (Attribute it) -> { - return Boolean.valueOf(((Objects.equal(this.getInitializerListValue(it), null) && (!Objects.equal(this.getInitValue(it), null))) && this.getInitValue(it).startsWith("{"))); - }; - final Iterable extraInitAttrs = IterableExtensions.filter(attributes, _function); - boolean _isEmpty = IterableExtensions.isEmpty(extraInitAttrs); - if (_isEmpty) { - return ""; - } - StringConcatenation _builder = new StringConcatenation(); - _builder.append("// extra initialization"); - _builder.newLine(); - { - final Function1 _function_1 = (Attribute it) -> { - int _size = it.getSize(); - return Boolean.valueOf((_size > 0)); - }; - Iterable _filter = IterableExtensions.filter(extraInitAttrs, _function_1); - for(final Attribute it : _filter) { - String _typeName = this.typeHelpers.getTypeName(it); - _builder.append(_typeName, ""); - _builder.append(" "); - String _name = it.getName(); - _builder.append(_name, ""); - _builder.append("InitValues["); - int _size = it.getSize(); - _builder.append(_size, ""); - _builder.append("] = "); - String _initValue = this.getInitValue(it); - _builder.append(_initValue, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - String _name_1 = it.getName(); - _builder.append(_name_1, ""); - _builder.append(" = "); - String _name_2 = it.getName(); - _builder.append(_name_2, ""); - _builder.append("InitValues;"); - _builder.newLineIfNotEmpty(); - } - } - { - final Function1 _function_2 = (Attribute it_1) -> { - int _size_1 = it_1.getSize(); - return Boolean.valueOf((_size_1 == 0)); - }; - Iterable _filter_1 = IterableExtensions.filter(extraInitAttrs, _function_2); - for(final Attribute it_1 : _filter_1) { - String _typeName_1 = this.typeHelpers.getTypeName(it_1); - _builder.append(_typeName_1, ""); - _builder.append(" "); - String _name_3 = it_1.getName(); - _builder.append(_name_3, ""); - _builder.append("InitValue = "); - String _initValue_1 = this.getInitValue(it_1); - _builder.append(_initValue_1, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - String _name_4 = it_1.getName(); - _builder.append(_name_4, ""); - _builder.append(" = "); - String _name_5 = it_1.getName(); - _builder.append(_name_5, ""); - _builder.append("InitValue;"); - _builder.newLineIfNotEmpty(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - public String getInitializerListValue(final Attribute attribute) { - final String initValue = this.getInitValue(attribute); - String _xifexpression = null; - if (((!Objects.equal(initValue, null)) && initValue.startsWith("{"))) { - _xifexpression = null; - } else { - _xifexpression = initValue; - } - return _xifexpression; - } - - protected String getInitValue(final Attribute attribute) { - String _switchResult = null; - final Attribute it = attribute; - boolean _matched = false; - String _defaultValueLiteral = it.getDefaultValueLiteral(); - boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); - if (_notEquals) { - _matched=true; - _switchResult = it.getDefaultValueLiteral(); - } - if (!_matched) { - RefableType _type = it.getType(); - boolean _isRef = _type.isRef(); - if (_isRef) { - _matched=true; - _switchResult = this.languageExt.nullPointer(); - } - } - if (!_matched) { - RefableType _type_1 = it.getType(); - DataType _type_2 = _type_1.getType(); - _switchResult = this.languageExt.defaultValue(_type_2); - } - return _switchResult; - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java deleted file mode 100644 index 91fb4674e..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Peter Karlitschek - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.generator.cpp.gen.ActorClassGen; -import org.eclipse.etrice.generator.cpp.gen.DataClassGen; -import org.eclipse.etrice.generator.cpp.gen.NodeGen; -import org.eclipse.etrice.generator.cpp.gen.NodeRunnerGen; -import org.eclipse.etrice.generator.cpp.gen.ProtocolClassGen; -import org.eclipse.etrice.generator.generic.PrepareFileSystem; - -@Singleton -@SuppressWarnings("all") -public class MainGen { - @Inject - private DataClassGen dataClassGen; - - @Inject - private ProtocolClassGen protocolClassGen; - - @Inject - private ActorClassGen actorClassGen; - - @Inject - private NodeGen subsystemClassGen; - - @Inject - private NodeRunnerGen subsystemRunnerGen; - - @Inject - private PrepareFileSystem prepFS; - - public void doGenerate(final Resource resource) { - this.prepFS.prepareCodeTargetPaths(resource); - EList _contents = resource.getContents(); - for (final EObject e : _contents) { - if ((e instanceof Root)) { - this.doGenerate(((Root) e)); - } - } - } - - public void doGenerate(final Root e) { - this.dataClassGen.doGenerate(e); - this.protocolClassGen.doGenerate(e); - this.actorClassGen.doGenerate(e); - this.subsystemClassGen.doGenerate(e); - boolean _isLibrary = e.isLibrary(); - boolean _not = (!_isLibrary); - if (_not) { - this.subsystemRunnerGen.doGenerate(e); - } - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java deleted file mode 100644 index d02e2ac15..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java +++ /dev/null @@ -1,902 +0,0 @@ -/** - * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.common.converter.TimeConverter; -import org.eclipse.etrice.core.etmap.util.ETMapUtil; -import org.eclipse.etrice.core.etphys.eTPhys.ExecMode; -import org.eclipse.etrice.core.etphys.eTPhys.NodeClass; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.genmodel.etricegen.Wire; -import org.eclipse.etrice.core.genmodel.etricegen.WiredStructureClass; -import org.eclipse.etrice.core.genmodel.etricegen.WiredSubSystemClass; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorRef; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; -import org.eclipse.etrice.generator.cpp.Main; -import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.cpp.gen.Initialization; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.fsm.base.Indexed; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; - -@Singleton -@SuppressWarnings("all") -public class NodeGen { - @Inject - @Extension - private CppExtensions _cppExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private ProcedureHelpers _procedureHelpers; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - @Inject - private IGeneratorFileIo fileIO; - - @Inject - private Initialization initHelper; - - public void doGenerate(final Root root) { - final Map sscc2wired = CollectionLiterals.newHashMap(); - EList _wiredInstances = root.getWiredInstances(); - Iterable _filter = Iterables.filter(_wiredInstances, WiredSubSystemClass.class); - final Consumer _function = (WiredSubSystemClass it) -> { - SubSystemClass _subSystemClass = it.getSubSystemClass(); - sscc2wired.put(_subSystemClass, it); - }; - _filter.forEach(_function); - Collection _nodeRefs = ETMapUtil.getNodeRefs(); - for (final NodeRef nr : _nodeRefs) { - List _subSystemInstancePaths = ETMapUtil.getSubSystemInstancePaths(nr); - for (final String instpath : _subSystemInstancePaths) { - { - StructureInstance _instance = root.getInstance(instpath); - final SubSystemInstance ssi = ((SubSystemInstance) _instance); - if (((!Objects.equal(ssi, null)) && this._fileSystemHelpers.isValidGenerationLocation(ssi.getSubSystemClass()))) { - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - final WiredSubSystemClass wired = sscc2wired.get(_subSystemClass); - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass_1); - SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String _path = this._roomExtensions.getPath(_subSystemClass_2); - final String path = (_generationTargetPath + _path); - SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_subSystemClass_3); - SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass(); - String _path_1 = this._roomExtensions.getPath(_subSystemClass_4); - final String infopath = (_generationInfoPath + _path_1); - final Set usedThreads = ETMapUtil.getUsedThreads(nr, ssi); - String _cppHeaderFileName = this._cppExtensions.getCppHeaderFileName(nr, ssi); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, ssi, wired, usedThreads); - this.fileIO.generateFile("generating Node declaration", path, infopath, _cppHeaderFileName, _generateHeaderFile); - String _cppSourceFileName = this._cppExtensions.getCppSourceFileName(nr, ssi); - CharSequence _generateSourceFile = this.generateSourceFile(root, ssi, wired, usedThreads); - this.fileIO.generateFile("generating Node implementation", path, infopath, _cppSourceFileName, _generateSourceFile); - } - } - } - } - } - - public CharSequence generateHeaderFile(final Root root, final SubSystemInstance comp, final WiredSubSystemClass wired, final Collection usedThreads) { - CharSequence _xblockexpression = null; - { - final SubSystemClass cc = comp.getSubSystemClass(); - final EList models = root.getReferencedModels(cc); - final NodeRef nr = ETMapUtil.getNodeRef(comp); - final String clsname = this._cppExtensions.getCppClassName(nr, comp); - NodeClass _type = nr.getType(); - EList _threads = _type.getThreads(); - final Function1 _function = (PhysicalThread t) -> { - return Boolean.valueOf(usedThreads.contains(t)); - }; - final Iterable threads = IterableExtensions.filter(_threads, _function); - 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 SubSystemClass "); - _builder.append(clsname, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateIncludeGuardBegin = this._cppExtensions.generateIncludeGuardBegin(cc, ""); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"common/messaging/IMessageService.h\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/SubSystemClassBase.h\""); - _builder.newLine(); - { - EList _actorInstances = comp.getActorInstances(); - for(final ActorInstance ai : _actorInstances) { - _builder.append("#include \""); - ActorClass _actorClass = ai.getActorClass(); - String _actorIncludePath = this._cppExtensions.getActorIncludePath(_actorClass); - _builder.append(_actorIncludePath, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - DetailCode _userCode1 = cc.getUserCode1(); - CharSequence _userCode = this._procedureHelpers.userCode(_userCode1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _generateNamespaceBegin = this._cppExtensions.generateNamespaceBegin(cc); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("class "); - _builder.append(clsname, ""); - _builder.append(" : public etRuntime::SubSystemClassBase{"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - DetailCode _userCode2 = cc.getUserCode2(); - CharSequence _userCode_1 = this._procedureHelpers.userCode(_userCode2); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public:"); - _builder.newLine(); - { - Iterable> _indexed = Indexed.indexed(threads); - for(final Indexed thread : _indexed) { - _builder.append("\t\t"); - _builder.append("static const int "); - PhysicalThread _value = thread.getValue(); - String _threadId = this.getThreadId(_value); - _builder.append(_threadId, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// sub actors"); - _builder.newLine(); - { - EList _actorRefs = cc.getActorRefs(); - for(final ActorRef sub : _actorRefs) { - { - int _multiplicity = sub.getMultiplicity(); - boolean _greaterThan = (_multiplicity > 1); - if (_greaterThan) { - _builder.append("\t\t"); - _builder.append("Replicated"); - ActorClass _type_1 = sub.getType(); - String _implementationClassName = this._cppExtensions.getImplementationClassName(_type_1); - _builder.append(_implementationClassName, "\t\t"); - _builder.append(" "); - String _name = sub.getName(); - _builder.append(_name, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t\t"); - ActorClass _type_2 = sub.getType(); - String _implementationClassName_1 = this._cppExtensions.getImplementationClassName(_type_2); - _builder.append(_implementationClassName_1, "\t\t"); - _builder.append(" "); - String _name_1 = sub.getName(); - _builder.append(_name_1, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(clsname, "\t\t"); - _builder.append("(IRTObject* parent, const String& name);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("~"); - _builder.append(clsname, "\t\t"); - _builder.append("();"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data);"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("virtual void instantiateMessageServices();"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("virtual void mapThreads(void);"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("virtual void initialize(void);"); - _builder.newLine(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t\t"); - _builder.append("virtual void setProbesActive(bool recursive, bool active);"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("virtual void init();"); - _builder.newLine(); - _builder.newLine(); - { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t\t"); - _builder.append("etBool hasGeneratedMSCInstrumentation() const { return true; }"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("virtual void destroy();"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("private:"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// MessageServices"); - _builder.newLine(); - { - for(final PhysicalThread thread_1 : threads) { - _builder.append("\t\t"); - _builder.append("IMessageService* msgSvc_"); - String _name_2 = thread_1.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(clsname, "\t\t"); - _builder.append("();"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append(clsname, "\t\t"); - _builder.append("("); - _builder.append(clsname, "\t\t"); - _builder.append(" const&);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append(clsname, "\t\t"); - _builder.append("& operator=("); - _builder.append(clsname, "\t\t"); - _builder.append(" const&);"); - _builder.newLineIfNotEmpty(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceEnd = this._cppExtensions.generateNamespaceEnd(cc); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd(cc, ""); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private String getThreadId(final PhysicalThread thread) { - String _name = thread.getName(); - String _upperCase = _name.toUpperCase(); - return ("THREAD_" + _upperCase); - } - - private CharSequence generateConstructorInitalizerList(final SubSystemClass cc) { - CharSequence _xblockexpression = null; - { - @Extension - final Initialization initHelper = this.initHelper; - ArrayList initList = CollectionLiterals.newArrayList(); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("SubSystemClassBase(parent, name)"); - initList.add(_builder.toString()); - EList _actorRefs = cc.getActorRefs(); - final Function1 _function = (ActorRef it) -> { - StringConcatenation _builder_1 = new StringConcatenation(); - String _name = it.getName(); - _builder_1.append(_name, ""); - _builder_1.append("(this, \""); - String _name_1 = it.getName(); - _builder_1.append(_name_1, ""); - _builder_1.append("\")"); - return _builder_1.toString(); - }; - List _map = ListExtensions.map(_actorRefs, _function); - Iterables.addAll(initList, _map); - _xblockexpression = initHelper.generateCtorInitializerList(initList); - } - return _xblockexpression; - } - - public CharSequence generateSourceFile(final Root root, final SubSystemInstance comp, final WiredSubSystemClass wired, final Collection usedThreads) { - CharSequence _xblockexpression = null; - { - final SubSystemClass cc = comp.getSubSystemClass(); - final EList models = root.getReferencedModels(cc); - final NodeRef nr = ETMapUtil.getNodeRef(comp); - final String clsname = this._cppExtensions.getCppClassName(nr, comp); - NodeClass _type = nr.getType(); - EList _threads = _type.getThreads(); - final Function1 _function = (PhysicalThread t) -> { - return Boolean.valueOf(usedThreads.contains(t)); - }; - final Iterable threads = IterableExtensions.filter(_threads, _function); - 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 SubsystemClass "); - _builder.append(clsname, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \""); - String _cppHeaderFileName = this._cppExtensions.getCppHeaderFileName(nr, comp); - _builder.append(_cppHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"common/debugging/DebuggingService.h\""); - _builder.newLine(); - _builder.append("#include \"common/debugging/MSCFunctionObject.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/IMessageService.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/MessageService.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/MessageServiceController.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/RTServices.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/StaticMessageMemory.h\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/InterfaceItemBase.h\""); - _builder.newLine(); - _builder.newLine(); - _builder.append("using namespace etRuntime;"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceBegin = this._cppExtensions.generateNamespaceBegin(cc); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - Iterable> _indexed = Indexed.indexed(threads); - for(final Indexed thread : _indexed) { - _builder.append("const int "); - _builder.append(clsname, ""); - _builder.append("::"); - PhysicalThread _value = thread.getValue(); - String _threadId = this.getThreadId(_value); - _builder.append(_threadId, ""); - _builder.append(" = "); - int _index0 = thread.getIndex0(); - _builder.append(_index0, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append(clsname, ""); - _builder.append("::"); - _builder.append(clsname, ""); - _builder.append("(IRTObject* parent, const String& name)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - CharSequence _generateConstructorInitalizerList = this.generateConstructorInitalizerList(cc); - _builder.append(_generateConstructorInitalizerList, "\t\t"); - _builder.newLineIfNotEmpty(); - { - for(final PhysicalThread thread_1 : threads) { - _builder.append("\t\t"); - _builder.append(", msgSvc_"); - String _name = thread_1.getName(); - _builder.append(_name, "\t\t"); - _builder.append("(NULL)"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("{"); - _builder.newLine(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t"); - _builder.append("MSCFunctionObject mscFunctionObject(getInstancePathName(), \"Constructor\");"); - _builder.newLine(); - } - } - { - EList _actorRefs = cc.getActorRefs(); - for(final ActorRef sub : _actorRefs) { - { - int _multiplicity = sub.getMultiplicity(); - boolean _greaterThan = (_multiplicity > 1); - if (_greaterThan) { - _builder.append("\t"); - String _name_1 = sub.getName(); - _builder.append(_name_1, "\t"); - _builder.append(".createSubActors("); - int _multiplicity_1 = sub.getMultiplicity(); - _builder.append(_multiplicity_1, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append(clsname, ""); - _builder.append("::~"); - _builder.append(clsname, ""); - _builder.append("() {"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t"); - _builder.append("MSCFunctionObject mscFunctionObject(getInstancePathName(), \"Destructor\");"); - _builder.newLine(); - } - } - { - for(final PhysicalThread thread_2 : threads) { - _builder.append("\t"); - _builder.append("delete msgSvc_"); - String _name_2 = thread_2.getName(); - _builder.append(_name_2, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("::receiveEvent(InterfaceItemBase* ifitem, int evt, void* data){"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("::instantiateMessageServices(){"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - GlobalGeneratorSettings _settings_2 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_2) { - _builder.append("\t"); - _builder.append("MSCFunctionObject mscFunctionObject(getInstancePathName(), \"instantiateMessageServices()\");"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("IMessageMemory* msgMemory;"); - _builder.newLine(); - { - final Function1 _function_1 = (PhysicalThread it) -> { - long _prio = it.getPrio(); - return Long.valueOf((-_prio)); - }; - List _sortBy = IterableExtensions.sortBy(threads, _function_1); - for(final PhysicalThread thread_3 : _sortBy) { - _builder.append("\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("msgMemory = new StaticMessageMemory(this, \"MessageMemory_"); - String _name_3 = thread_3.getName(); - _builder.append(_name_3, "\t\t"); - _builder.append("\", "); - int _msgblocksize = thread_3.getMsgblocksize(); - _builder.append(_msgblocksize, "\t\t"); - _builder.append(", "); - int _msgpoolsize = thread_3.getMsgpoolsize(); - _builder.append(_msgpoolsize, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - { - if ((Objects.equal(thread_3.getExecmode(), ExecMode.POLLED) || Objects.equal(thread_3.getExecmode(), ExecMode.MIXED))) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("etTime interval;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("interval.sec = "); - long _time = thread_3.getTime(); - long _split = TimeConverter.split(_time, TimeConverter.SEC, true); - _builder.append(_split, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("interval.nSec = "); - long _time_1 = thread_3.getTime(); - long _split_1 = TimeConverter.split(_time_1, TimeConverter.MILLI_SEC, false); - _builder.append(_split_1, "\t\t"); - _builder.append("L;"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("msgSvc_"); - String _name_4 = thread_3.getName(); - _builder.append(_name_4, "\t\t"); - _builder.append(" = new MessageService(this, IMessageService::"); - ExecMode _execmode = thread_3.getExecmode(); - String _name_5 = _execmode.getName(); - _builder.append(_name_5, "\t\t"); - _builder.append(", interval, 0, "); - String _threadId_1 = this.getThreadId(thread_3); - _builder.append(_threadId_1, "\t\t"); - _builder.append(", \"MessageService_"); - String _name_6 = thread_3.getName(); - _builder.append(_name_6, "\t\t"); - _builder.append("\", msgMemory, "); - long _prio = thread_3.getPrio(); - _builder.append(_prio, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("msgSvc_"); - String _name_7 = thread_3.getName(); - _builder.append(_name_7, "\t\t"); - _builder.append(" = new MessageService(this, IMessageService::"); - ExecMode _execmode_1 = thread_3.getExecmode(); - String _name_8 = _execmode_1.getName(); - _builder.append(_name_8, "\t\t"); - _builder.append(", 0, "); - String _threadId_2 = this.getThreadId(thread_3); - _builder.append(_threadId_2, "\t\t"); - _builder.append(", \"MessageService_"); - String _name_9 = thread_3.getName(); - _builder.append(_name_9, "\t\t"); - _builder.append("\", msgMemory, "); - long _prio_1 = thread_3.getPrio(); - _builder.append(_prio_1, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("\t"); - _builder.append("RTServices::getInstance().getMsgSvcCtrl().addMsgSvc(*msgSvc_"); - String _name_10 = thread_3.getName(); - _builder.append(_name_10, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("::mapThreads() {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("// thread mappings"); - _builder.newLine(); - { - EList _allContainedInstances = comp.getAllContainedInstances(); - for(final ActorInstance ai : _allContainedInstances) { - _builder.append("\t"); - final ETMapUtil.MappedThread mapped = ETMapUtil.getMappedThread(ai); - _builder.newLineIfNotEmpty(); - { - boolean _not = (!(mapped.isImplicit() || mapped.isAsParent())); - if (_not) { - _builder.append("\t"); - _builder.append("addPathToThread(\""); - String _path = ai.getPath(); - _builder.append(_path, "\t"); - _builder.append("\", "); - PhysicalThread _thread = mapped.getThread(); - String _threadId_3 = this.getThreadId(_thread); - _builder.append(_threadId_3, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("::initialize() {"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings_3 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_3 = _settings_3.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_3) { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().getSyncLogger().addVisibleComment(\"starting initialization\");"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("MSCFunctionObject mscFunctionObject(getInstancePathName(), \"initialize()\");"); - _builder.newLine(); - { - EList _actorRefs_1 = cc.getActorRefs(); - for(final ActorRef sub_1 : _actorRefs_1) { - { - int _multiplicity_2 = sub_1.getMultiplicity(); - boolean _greaterThan_1 = (_multiplicity_2 > 1); - if (_greaterThan_1) { - _builder.append("\t"); - _builder.append("for (int i=0; i<"); - int _multiplicity_3 = sub_1.getMultiplicity(); - _builder.append(_multiplicity_3, "\t"); - _builder.append("; ++i) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addMessageActorCreate(*this, "); - String _name_11 = sub_1.getName(); - _builder.append(_name_11, "\t\t"); - _builder.append(".getSubActor(i)->getName());"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } else { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addMessageActorCreate(*this, \""); - String _name_12 = sub_1.getName(); - _builder.append(_name_12, "\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// wiring"); - _builder.newLine(); - { - EList _wires = wired.getWires(); - for(final Wire wire : _wires) { - _builder.append("\t"); - String _xifexpression = null; - boolean _isDataDriven = wire.isDataDriven(); - if (_isDataDriven) { - _xifexpression = "DataPortBase"; - } else { - _xifexpression = "InterfaceItemBase"; - } - _builder.append(_xifexpression, "\t"); - _builder.append("::connect(this, \""); - EList _path1 = wire.getPath1(); - String _join = IterableExtensions.join(_path1, "/"); - _builder.append(_join, "\t"); - _builder.append("\", \""); - EList _path2 = wire.getPath2(); - String _join_1 = IterableExtensions.join(_path2, "/"); - _builder.append(_join_1, "\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// call initialize of sub actors"); - _builder.newLine(); - { - EList _actorRefs_2 = cc.getActorRefs(); - for(final ActorRef sub_2 : _actorRefs_2) { - _builder.append("\t"); - String _name_13 = sub_2.getName(); - _builder.append(_name_13, "\t"); - _builder.append(".initialize();"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - { - GlobalGeneratorSettings _settings_4 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_4 = _settings_4.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_4) { - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("::setProbesActive(bool recursive, bool active) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("for(int i = 0; i < m_RTSystemPort.getNInterfaceItems(); i++)"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("DebuggingService::getInstance().addPortInstance(*(m_RTSystemPort.getInterfaceItem(i)));"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("if(recursive) {"); - _builder.newLine(); - { - EList _actorRefs_3 = cc.getActorRefs(); - for(final ActorRef sub_3 : _actorRefs_3) { - _builder.append("\t\t"); - String _name_14 = sub_3.getName(); - _builder.append(_name_14, "\t\t"); - _builder.append(".setProbesActive(recursive, active);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("::init(){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("SubSystemClassBase::init();"); - _builder.newLine(); - { - GlobalGeneratorSettings _settings_5 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_5 = _settings_5.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_5) { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addVisibleComment(\"done sub system initialization\");"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - { - GlobalGeneratorSettings _settings_6 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_6 = _settings_6.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_6) { - _builder.newLine(); - _builder.append("void "); - _builder.append(clsname, ""); - _builder.append("::destroy() {"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings_7 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_7 = _settings_7.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_7) { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().getSyncLogger().addVisibleComment(\"starting destruction\");"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("MSCFunctionObject mscFunctionObject(getInstancePathName(), \"destroy()\");"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addVisibleComment(\"begin sub system destruction\");"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("SubSystemClassBase::destroy();"); - _builder.newLine(); - { - GlobalGeneratorSettings _settings_8 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_8 = _settings_8.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_8) { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addVisibleComment(\"done sub system destruction\");"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - String _generateNamespaceEnd = this._cppExtensions.generateNamespaceEnd(cc); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java deleted file mode 100644 index 715a31c75..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java +++ /dev/null @@ -1,301 +0,0 @@ -/** - * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.Collection; -import java.util.List; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.etmap.util.ETMapUtil; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SystemInstance; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; -import org.eclipse.etrice.generator.cpp.Main; -import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; - -@Singleton -@SuppressWarnings("all") -public class NodeRunnerGen { - @Inject - @Extension - private RoomExtensions roomExt; - - @Inject - @Extension - private CppExtensions _cppExtensions; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - @Inject - private IGeneratorFileIo fileIO; - - public void doGenerate(final Root root) { - Collection _nodeRefs = ETMapUtil.getNodeRefs(); - for (final NodeRef nr : _nodeRefs) { - List _subSystemInstancePaths = ETMapUtil.getSubSystemInstancePaths(nr); - for (final String instpath : _subSystemInstancePaths) { - { - StructureInstance _instance = root.getInstance(instpath); - final SubSystemInstance ssi = ((SubSystemInstance) _instance); - if (((!Objects.equal(ssi, null)) && this._fileSystemHelpers.isValidGenerationLocation(ssi.getSubSystemClass()))) { - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass); - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - String _path = this.roomExt.getPath(_subSystemClass_1); - final String filepath = (_generationTargetPath + _path); - SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String _generationInfoPath = this.roomExt.getGenerationInfoPath(_subSystemClass_2); - SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - String _path_1 = this.roomExt.getPath(_subSystemClass_3); - final String infopath = (_generationInfoPath + _path_1); - String _cppClassName = this._cppExtensions.getCppClassName(nr, ssi); - String _plus = (_cppClassName + "Runner.h"); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, ssi); - this.fileIO.generateFile("generating SubSystemRunner declaration", filepath, infopath, _plus, _generateHeaderFile); - String _cppClassName_1 = this._cppExtensions.getCppClassName(nr, ssi); - String _plus_1 = (_cppClassName_1 + "Runner.cpp"); - CharSequence _generateSourceFile = this.generateSourceFile(root, ssi); - this.fileIO.generateFile("generating SubSystemRunner implementation", filepath, infopath, _plus_1, _generateSourceFile); - } - } - } - } - } - - public CharSequence generateHeaderFile(final Root root, final SubSystemInstance ssc) { - CharSequence _xblockexpression = null; - { - final SubSystemClass cc = ssc.getSubSystemClass(); - final NodeRef nr = ETMapUtil.getNodeRef(ssc); - final String clsname = this._cppExtensions.getCppClassName(nr, ssc); - 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("* this class contains the main function running component "); - String _name = ssc.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* it instantiates "); - String _name_1 = ssc.getName(); - _builder.append(_name_1, " "); - _builder.append(" and starts and ends the lifecycle"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - CharSequence _generateIncludeGuardBegin = this._cppExtensions.generateIncludeGuardBegin(cc, "Runner"); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _generateNamespaceBegin = this._cppExtensions.generateNamespaceBegin(cc); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"common/modelbase/SubSystemRunnerBase.h\""); - _builder.newLine(); - _builder.newLine(); - _builder.append("class "); - _builder.append((clsname + "Runner"), ""); - _builder.append(" : public etRuntime::SubSystemRunnerBase {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceEnd = this._cppExtensions.generateNamespaceEnd(cc); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd(cc, "Runner"); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - public CharSequence generateSourceFile(final Root root, final SubSystemInstance ssc) { - CharSequence _xblockexpression = null; - { - final SubSystemClass cc = ssc.getSubSystemClass(); - final NodeRef nr = ETMapUtil.getNodeRef(ssc); - final String clsname = this._cppExtensions.getCppClassName(nr, ssc); - 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("* this class contains the main function running component "); - String _name = ssc.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* it instantiates "); - String _name_1 = ssc.getName(); - _builder.append(_name_1, " "); - _builder.append(" and starts and ends the lifecycle"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \""); - _builder.append(clsname, ""); - _builder.append("Runner.h\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \""); - _builder.append(clsname, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - _builder.append("#include \"common/modelbase/RTSystem.h\""); - _builder.newLine(); - _builder.append("#include \"common/containers/String.h\""); - _builder.newLine(); - _builder.append("#include \"common/containers/Vector.h\""); - _builder.newLine(); - _builder.append("#include \"common/containers/Set.h\""); - _builder.newLine(); - _builder.append("#include \"common/containers/Map.h\""); - _builder.newLine(); - _builder.newLine(); - _builder.append("using namespace etRuntime;"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceBegin = this._cppExtensions.generateNamespaceBegin(cc); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* "); - GlobalGeneratorSettings _settings = Main.getSettings(); - String _mainMethodName = _settings.getMainMethodName(); - _builder.append(_mainMethodName, " "); - _builder.append(" function"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* creates components and starts and stops the lifecycle"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.append("int "); - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - String _mainMethodName_1 = _settings_1.getMainMethodName(); - _builder.append(_mainMethodName_1, ""); - _builder.append("(int argc, char* argv[]) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("// instantiate the main component"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("RTSystem* sys = "); - { - EObject _eContainer = ssc.eContainer(); - if ((_eContainer instanceof SystemInstance)) { - _builder.append("new RTSystem(\""); - EObject _eContainer_1 = ssc.eContainer(); - String _name_2 = ((SystemInstance) _eContainer_1).getName(); - _builder.append(_name_2, "\t"); - _builder.append("\")"); - } else { - _builder.append("0"); - } - } - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("* main_component = new "); - _builder.append(clsname, "\t"); - _builder.append("(sys, \""); - String _name_3 = ssc.getName(); - _builder.append(_name_3, "\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append(clsname, "\t"); - _builder.append("Runner::run(*main_component, argc, argv);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("//delete sys;"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("printf(\"String allocations %d and deallocations %d\\n\", etRuntime::String::getNAllocations(), etRuntime::String::getNDeallocations());"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("printf(\"String creations %d and destructions %d\\n\", etRuntime::String::getNCreated(), etRuntime::String::getNDestroyed());"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("printf(\"Vector allocations %d and deallocations %d\\n\", etRuntime::VectorStats::getNAllocations(), etRuntime::VectorStats::getNDeallocations());"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("printf(\"Vector creations %d and destructions %d\\n\", etRuntime::VectorStats::getNCreated(), etRuntime::VectorStats::getNDestroyed());"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("printf(\"Set creations %d and destructions %d\\n\", etRuntime::SetStats::getNCreated(), etRuntime::SetStats::getNDestroyed());"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("printf(\"Map creations %d and destructions %d\\n\", etRuntime::MapStats::getNCreated(), etRuntime::MapStats::getNDestroyed());"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("fflush(stdout);"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("return 0;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceEnd = this._cppExtensions.generateNamespaceEnd(cc); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java deleted file mode 100644 index 9f3ceacb5..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java +++ /dev/null @@ -1,1616 +0,0 @@ -/** - * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -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.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -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.GeneralProtocolClass; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.MessageHandler; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.PortClass; -import org.eclipse.etrice.core.room.PortOperation; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.SAP; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; -import org.eclipse.etrice.generator.cpp.Main; -import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.cpp.gen.Initialization; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -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.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; - -@Singleton -@SuppressWarnings("all") -public class ProtocolClassGen extends GenericProtocolClassGenerator { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private CppExtensions stdExt; - - @Inject - @Extension - private RoomExtensions roomExt; - - @Inject - @Extension - private ProcedureHelpers helpers; - - @Inject - @Extension - private TypeHelpers _typeHelpers; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - @Inject - private Initialization initHelper; - - @Inject - private ILogger logger; - - public void doGenerate(final Root root) { - EList _protocolClasses = root.getProtocolClasses(); - final Function1 _function = (ProtocolClass cl) -> { - return Boolean.valueOf(this._fileSystemHelpers.isValidGenerationLocation(cl)); - }; - Iterable _filter = IterableExtensions.filter(_protocolClasses, _function); - for (final ProtocolClass pc : _filter) { - { - String _generationTargetPath = this.roomExt.getGenerationTargetPath(pc); - String _path = this.roomExt.getPath(pc); - final String path = (_generationTargetPath + _path); - String _generationInfoPath = this.roomExt.getGenerationInfoPath(pc); - String _path_1 = this.roomExt.getPath(pc); - final String infopath = (_generationInfoPath + _path_1); - CommunicationType _commType = pc.getCommType(); - if (_commType != null) { - switch (_commType) { - case EVENT_DRIVEN: - String _cppHeaderFileName = this.stdExt.getCppHeaderFileName(pc); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, pc); - this.fileIO.generateFile("generating ProtocolClass declaration", path, infopath, _cppHeaderFileName, _generateHeaderFile); - String _cppSourceFileName = this.stdExt.getCppSourceFileName(pc); - CharSequence _generateSourceFile = this.generateSourceFile(root, pc); - this.fileIO.generateFile("generating ProtocolClass implementation", path, infopath, _cppSourceFileName, _generateSourceFile); - break; - case DATA_DRIVEN: - String _cppHeaderFileName_1 = this.stdExt.getCppHeaderFileName(pc); - CharSequence _generateDataDrivenHeaderFile = this.generateDataDrivenHeaderFile(root, pc); - this.fileIO.generateFile("generating ProtocolClass declaration", path, infopath, _cppHeaderFileName_1, _generateDataDrivenHeaderFile); - String _cppSourceFileName_1 = this.stdExt.getCppSourceFileName(pc); - CharSequence _generateDataDrivenSourceFile = this.generateDataDrivenSourceFile(root, pc); - this.fileIO.generateFile("generating ProtocolClass implementation", path, infopath, _cppSourceFileName_1, _generateDataDrivenSourceFile); - break; - case SYNCHRONOUS: - this.logger.logError("synchronous protocols not supported yet", pc); - break; - default: - break; - } - } - } - } - } - - protected CharSequence 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(); - CharSequence _generateIncludeGuardBegin = this.stdExt.generateIncludeGuardBegin(pc, ""); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"common/modelbase/InterfaceItemBase.h\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/PortBase.h\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/ReplicatedInterfaceItemBase.h\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/ReplicatedPortBase.h\""); - _builder.newLine(); - _builder.append("#include \"common/etDatatypesCpp.hpp\""); - _builder.newLine(); - _builder.newLine(); - { - EList _referencedDataClasses = root.getReferencedDataClasses(pc); - for(final DataClass dataClass : _referencedDataClasses) { - _builder.append("#include \""); - String _path = this.roomExt.getPath(dataClass); - _builder.append(_path, ""); - String _name_1 = dataClass.getName(); - _builder.append(_name_1, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - DetailCode _userCode1 = pc.getUserCode1(); - CharSequence _userCode = this.helpers.userCode(_userCode1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _generateNamespaceBegin = this.stdExt.generateNamespaceBegin(pc); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("class "); - String _name_2 = pc.getName(); - _builder.append(_name_2, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("/* message IDs */"); - _builder.newLine(); - _builder.append("\t\t"); - String _genMessageIDs = this.genMessageIDs(pc); - _builder.append(_genMessageIDs, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - CharSequence _userCode_1 = this.helpers.userCode(pc, 2); - _builder.append(_userCode_1, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("static bool isValidEvtID(int evtId) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return ((MSG_MIN < evtId) && (evtId < MSG_MAX));"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("static bool isValidOutgoingEvtID(int evtId) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return ((MSG_MIN < evtId) && (evtId < "); - { - EList _incomingMessages = pc.getIncomingMessages(); - int _size = _incomingMessages.size(); - boolean _equals = (_size == 0); - if (_equals) { - _builder.append("MSG_MAX"); - } else { - _builder.append("IN_"); - EList _incomingMessages_1 = pc.getIncomingMessages(); - Message _get = _incomingMessages_1.get(0); - String _name_3 = _get.getName(); - _builder.append(_name_3, "\t\t\t"); - } - } - _builder.append("));"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("static bool isValidIncomingEvtID(int evtId) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return (("); - { - EList _incomingMessages_2 = pc.getIncomingMessages(); - int _size_1 = _incomingMessages_2.size(); - boolean _equals_1 = (_size_1 == 0); - if (_equals_1) { - _builder.append("MSG_MAX"); - } else { - _builder.append("IN_"); - EList _incomingMessages_3 = pc.getIncomingMessages(); - Message _get_1 = _incomingMessages_3.get(0); - String _name_4 = _get_1.getName(); - _builder.append(_name_4, "\t\t\t"); - } - } - _builder.append(" <= evtId) && (evtId < MSG_MAX));"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("static const etRuntime::String& getMessageString(int msg_id);"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("private:"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("static const etRuntime::String s_messageStrings[];"); - _builder.newLine(); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - CharSequence _portClassDeclaration = this.portClassDeclaration(pc, false); - _builder.append(_portClassDeclaration, ""); - _builder.newLineIfNotEmpty(); - CharSequence _portClassDeclaration_1 = this.portClassDeclaration(pc, true); - _builder.append(_portClassDeclaration_1, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _generateNamespaceEnd = this.stdExt.generateNamespaceEnd(pc); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(pc, ""); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - protected CharSequence portClassDeclaration(final ProtocolClass pc, final boolean conj) { - CharSequence _xblockexpression = null; - { - PortClass pclass = this.roomExt.getPortClass(pc, conj); - String portClassName = this.roomExt.getPortClassName(pc, conj); - String replPortClassName = this.roomExt.getPortClassName(pc, conj, true); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("//------------------------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.append("// "); - { - if (conj) { - _builder.append("conjugated "); - } - } - _builder.append("port class"); - _builder.newLineIfNotEmpty(); - _builder.append("//------------------------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.append("class "); - _builder.append(portClassName, ""); - _builder.append(" : public etRuntime::PortBase {"); - _builder.newLineIfNotEmpty(); - { - boolean _notEquals = (!Objects.equal(pclass, null)); - if (_notEquals) { - _builder.append("\t"); - DetailCode _userCode = pclass.getUserCode(); - CharSequence _userCode_1 = this.helpers.userCode(_userCode); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append(" "); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t "); - _builder.append(portClassName, "\t "); - _builder.append("(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t "); - _builder.append(portClassName, "\t "); - _builder.append("(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId, int idx);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t"); - _builder.append("virtual void destroy();"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t "); - _builder.append("virtual void receive(const etRuntime::Message* m);"); - _builder.newLine(); - _builder.newLine(); - { - boolean _notEquals_1 = (!Objects.equal(pclass, null)); - if (_notEquals_1) { - _builder.append("\t"); - EList _attributes = pclass.getAttributes(); - CharSequence _attributes_1 = this.helpers.attributes(_attributes); - _builder.append(_attributes_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - EList _operations = pclass.getOperations(); - CharSequence _operationsDeclaration = this.helpers.operationsDeclaration(_operations, portClassName); - _builder.append(_operationsDeclaration, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t "); - _builder.append("// sent messages"); - _builder.newLine(); - { - List _allMessages = this._roomHelpers.getAllMessages(pc, conj); - for(final Message m : _allMessages) { - _builder.append("\t"); - CharSequence _messageSignature = this.messageSignature(m, false); - _builder.append(_messageSignature, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _messageSignature_1 = this.messageSignature(m, true); - _builder.append(_messageSignature_1, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - _builder.append("//------------------------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.append("// "); - { - if (conj) { - _builder.append("conjugated "); - } - } - _builder.append("replicated port class"); - _builder.newLineIfNotEmpty(); - _builder.append("//------------------------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.append("class "); - _builder.append(replPortClassName, ""); - _builder.append(" : public etRuntime::ReplicatedPortBase {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(replPortClassName, "\t\t"); - _builder.append("(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("int getReplication() const { return getNInterfaceItems(); }"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("int getIndexOf(const etRuntime::InterfaceItemBase& ifitem) const { return ifitem.getIdx(); }"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(portClassName, "\t\t"); - _builder.append("& get(int idx) const { return *dynamic_cast<"); - _builder.append(portClassName, "\t\t"); - _builder.append("*>(getInterfaceItem(idx)); }"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - if (conj) { - _builder.append("\t\t"); - _builder.append("// incoming messages"); - _builder.newLine(); - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - for(final Message m_1 : _allIncomingMessages) { - _builder.append("\t\t"); - CharSequence _messageSignature_2 = this.messageSignature(m_1, false); - _builder.append(_messageSignature_2, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } else { - _builder.append("\t\t"); - _builder.append("// outgoing messages"); - _builder.newLine(); - { - List _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); - for(final Message m_2 : _allOutgoingMessages) { - _builder.append("\t\t"); - CharSequence _messageSignature_3 = this.messageSignature(m_2, false); - _builder.append(_messageSignature_3, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("protected:"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const etRuntime::String& name, int lid, int idx) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return new "); - _builder.append(portClassName, "\t\t\t"); - _builder.append("(rcv, name, lid, idx);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - protected CharSequence 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 _cppHeaderFileName = this.stdExt.getCppHeaderFileName(pc); - _builder.append(_cppHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"common/debugging/DebuggingService.h\""); - _builder.newLine(); - _builder.append("#include \"common/debugging/MSCFunctionObject.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/AbstractMessageReceiver.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/Address.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/Message.h\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/IEventReceiver.h\""); - _builder.newLine(); - _builder.newLine(); - _builder.append("using namespace etRuntime;"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceBegin = this.stdExt.generateNamespaceBegin(pc); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _userCode = this.helpers.userCode(pc, 3); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* message names as strings for debugging (generate MSC) */"); - _builder.newLine(); - _builder.append("const String "); - String _name_1 = pc.getName(); - _builder.append(_name_1, ""); - _builder.append("::s_messageStrings[] = {\"MIN\", "); - { - List _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); - for(final Message m : _allOutgoingMessages) { - _builder.append("\""); - String _name_2 = m.getName(); - _builder.append(_name_2, ""); - _builder.append("\","); - } - } - _builder.append(" "); - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - for(final Message m_1 : _allIncomingMessages) { - _builder.append("\""); - String _name_3 = m_1.getName(); - _builder.append(_name_3, ""); - _builder.append("\","); - } - } - _builder.append("\"MAX\"};"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("const String& "); - String _name_4 = pc.getName(); - _builder.append(_name_4, ""); - _builder.append("::getMessageString(int msg_id) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if ((MSG_MIN < msg_id ) && ( msg_id < MSG_MAX )) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return s_messageStrings[msg_id];"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("} else {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// id out of range"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("static const String errorMsg = \"Message ID out of range\";"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return errorMsg;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - CharSequence _portClassImplementation = this.portClassImplementation(pc, false); - _builder.append(_portClassImplementation, ""); - _builder.newLineIfNotEmpty(); - CharSequence _portClassImplementation_1 = this.portClassImplementation(pc, true); - _builder.append(_portClassImplementation_1, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _generateNamespaceEnd = this.stdExt.generateNamespaceEnd(pc); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - return _builder; - } - - protected CharSequence portClassImplementation(final ProtocolClass pc, final boolean conj) { - CharSequence _xblockexpression = null; - { - PortClass pclass = this.roomExt.getPortClass(pc, conj); - String portClassName = this.roomExt.getPortClassName(pc, conj); - String replPortClassName = this.roomExt.getPortClassName(pc, conj, true); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("//------------------------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.append("// "); - { - if (conj) { - _builder.append("conjugated "); - } - } - _builder.append("port class"); - _builder.newLineIfNotEmpty(); - _builder.append("//------------------------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.newLine(); - _builder.append(portClassName, ""); - _builder.append("::"); - _builder.append(portClassName, ""); - _builder.append("(IInterfaceItemOwner* actor, const String& name, int localId)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _generateConstructorInitalizerList = this.generateConstructorInitalizerList(pclass, "0"); - _builder.append(_generateConstructorInitalizerList, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("{"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append(portClassName, ""); - _builder.append("::"); - _builder.append(portClassName, ""); - _builder.append("(IInterfaceItemOwner* actor, const String& name, int localId, int idx)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _generateConstructorInitalizerList_1 = this.generateConstructorInitalizerList(pclass, "idx"); - _builder.append(_generateConstructorInitalizerList_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - { - boolean _notEquals = (!Objects.equal(pclass, null)); - if (_notEquals) { - EList _attributes = pclass.getAttributes(); - CharSequence _genExtraInitializers = this.initHelper.genExtraInitializers(_attributes); - _builder.append(_genExtraInitializers, "\t"); - } - } - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.newLine(); - _builder.append("void "); - _builder.append(portClassName, ""); - _builder.append("::destroy() {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().removePortInstance(*this);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("PortBase::destroy();"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("void "); - _builder.append(portClassName, ""); - _builder.append("::receive(const Message* msg) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("// TODO JH further"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("if (! "); - String _name = pc.getName(); - _builder.append(_name, "\t"); - _builder.append("::"); - { - if (conj) { - _builder.append("isValidOutgoingEvtID"); - } else { - _builder.append("isValidIncomingEvtID"); - } - } - _builder.append("(msg->getEvtId())) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("//std::cout << \"unknown\" << std::endl;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), "); - String _name_1 = pc.getName(); - _builder.append(_name_1, "\t"); - _builder.append("::getMessageString(msg->getEvtId()).c_str());"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - boolean _handlesReceive = this.roomExt.handlesReceive(pc, conj); - if (_handlesReceive) { - _builder.append("\t"); - _builder.append("switch (msg->getEvtId()) {"); - _builder.newLine(); - { - List _receiveHandlers = this.roomExt.getReceiveHandlers(pc, conj); - for(final MessageHandler hdlr : _receiveHandlers) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("case "); - String _name_2 = pc.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append("::"); - Message _msg = hdlr.getMsg(); - String _codeName = this.roomExt.getCodeName(_msg); - _builder.append(_codeName, "\t\t"); - _builder.append(":"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("{"); - _builder.newLine(); - { - DetailCode _detailCode = hdlr.getDetailCode(); - EList _lines = _detailCode.getLines(); - for(final String command : _lines) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append(command, "\t\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("break;"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("\t"); - _builder.append("default:"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("getActor()->receiveEvent(this, msg->getEvtId(),\tmsg->getData());"); - _builder.newLine(); - { - boolean _handlesReceive_1 = this.roomExt.handlesReceive(pc, conj); - if (_handlesReceive_1) { - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("break;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - { - boolean _notEquals_1 = (!Objects.equal(pclass, null)); - if (_notEquals_1) { - EList _operations = pclass.getOperations(); - CharSequence _operationsImplementation = this.helpers.operationsImplementation(_operations, portClassName); - _builder.append(_operationsImplementation, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("// sent messages"); - _builder.newLine(); - { - List _allMessages = this._roomHelpers.getAllMessages(pc, conj); - for(final Message m : _allMessages) { - String _name_3 = pc.getName(); - CharSequence _sendMessage = this.sendMessage(m, _name_3, portClassName, conj); - _builder.append(_sendMessage, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("//------------------------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.append("// "); - { - if (conj) { - _builder.append("conjugated "); - } - } - _builder.append("replicated port class"); - _builder.newLineIfNotEmpty(); - _builder.append("//------------------------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.append(replPortClassName, ""); - _builder.append("::"); - _builder.append(replPortClassName, ""); - _builder.append("(IInterfaceItemOwner* actor, const String& name, int localId) :"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("ReplicatedPortBase(actor, name, localId)"); - _builder.newLine(); - _builder.append("{"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - { - if (conj) { - _builder.append("// incoming messages"); - _builder.newLine(); - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - for(final Message m_1 : _allIncomingMessages) { - CharSequence _messageSignatureDefinition = this.messageSignatureDefinition(m_1, replPortClassName, false); - _builder.append(_messageSignatureDefinition, ""); - _builder.append("{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("for (Vector::iterator it = getItems().begin(); it != getItems().end(); ++it) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("(dynamic_cast<"); - _builder.append(portClassName, "\t\t"); - _builder.append("*>(*it))->"); - CharSequence _messageCall = this.messageCall(m_1, false); - _builder.append(_messageCall, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } - } - } else { - _builder.append("// outgoing messages"); - _builder.newLine(); - { - List _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); - for(final Message m_2 : _allOutgoingMessages) { - CharSequence _messageSignatureDefinition_1 = this.messageSignatureDefinition(m_2, replPortClassName, false); - _builder.append(_messageSignatureDefinition_1, ""); - _builder.append("{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("for (Vector::iterator it = getItems().begin(); it != getItems().end(); ++it) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("(dynamic_cast<"); - _builder.append(portClassName, "\t\t"); - _builder.append("*>(*it))->"); - CharSequence _messageCall_1 = this.messageCall(m_2, false); - _builder.append(_messageCall_1, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } - } - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence generateConstructorInitalizerList(final PortClass pc, final String index) { - CharSequence _xblockexpression = null; - { - @Extension - final Initialization initHelper = this.initHelper; - final List initList = CollectionLiterals.newArrayList(); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("PortBase(actor, name, localId, "); - _builder.append(index, ""); - _builder.append(")"); - initList.add(_builder.toString()); - boolean _notEquals = (!Objects.equal(pc, null)); - if (_notEquals) { - EList _attributes = pc.getAttributes(); - final Function1 _function = (Attribute it) -> { - StringConcatenation _builder_1 = new StringConcatenation(); - String _name = it.getName(); - _builder_1.append(_name, ""); - _builder_1.append("("); - String _initializerListValue = initHelper.getInitializerListValue(it); - _builder_1.append(_initializerListValue, ""); - _builder_1.append(")"); - return _builder_1.toString(); - }; - List _map = ListExtensions.map(_attributes, _function); - Iterables.addAll(initList, _map); - } - _xblockexpression = initHelper.generateCtorInitializerList(initList); - } - return _xblockexpression; - } - - protected CharSequence messageCall(final Message m, final boolean impl) { - StringConcatenation _builder = new StringConcatenation(); - String _name = m.getName(); - _builder.append(_name, ""); - { - if (impl) { - _builder.append("_impl"); - } - } - _builder.append("("); - { - VarDecl _data = m.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (_notEquals) { - _builder.append(" "); - VarDecl _data_1 = m.getData(); - String _name_1 = _data_1.getName(); - _builder.append(_name_1, ""); - } - } - _builder.append(")"); - return _builder; - } - - protected CharSequence messageSignature(final Message m, final boolean impl) { - StringConcatenation _builder = new StringConcatenation(); - { - if ((m.isPriv() || impl)) { - _builder.append("private:"); - } else { - _builder.append("public:"); - } - } - _builder.append(" void "); - String _name = m.getName(); - _builder.append(_name, ""); - { - if (impl) { - _builder.append("_impl"); - } - } - _builder.append("("); - { - VarDecl _data = m.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (_notEquals) { - VarDecl _data_1 = m.getData(); - RefableType _refType = _data_1.getRefType(); - String _signatureString = this.helpers.signatureString(_refType); - _builder.append(_signatureString, ""); - _builder.append(" "); - VarDecl _data_2 = m.getData(); - String _name_1 = _data_2.getName(); - _builder.append(_name_1, ""); - } - } - _builder.append(")"); - return _builder; - } - - protected CharSequence messageSignatureDefinition(final Message m, final String classPrefix, final boolean impl) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("void "); - _builder.append(classPrefix, ""); - _builder.append("::"); - String _name = m.getName(); - _builder.append(_name, ""); - { - if (impl) { - _builder.append("_impl"); - } - } - _builder.append("("); - { - VarDecl _data = m.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (_notEquals) { - VarDecl _data_1 = m.getData(); - RefableType _refType = _data_1.getRefType(); - String _signatureString = this.helpers.signatureString(_refType); - _builder.append(_signatureString, ""); - _builder.append(" "); - VarDecl _data_2 = m.getData(); - String _name_1 = _data_2.getName(); - _builder.append(_name_1, ""); - } - } - _builder.append(")"); - return _builder; - } - - protected CharSequence sendMessage(final Message m, final String portClassName, final String classPrefix, final boolean conj) { - CharSequence _xblockexpression = null; - { - String _xifexpression = null; - if (conj) { - _xifexpression = "IN"; - } else { - _xifexpression = "OUT"; - } - String dir = _xifexpression; - MessageHandler hdlr = this.roomExt.getSendHandler(m, conj); - String _xifexpression_1 = null; - VarDecl _data = m.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (_notEquals) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append(", "); - VarDecl _data_1 = m.getData(); - String _name = _data_1.getName(); - _builder.append(_name, ""); - _xifexpression_1 = _builder.toString(); - } - final String dataArg = _xifexpression_1; - String _xifexpression_2 = null; - if (((!Objects.equal(m.getData(), null)) && (!m.getData().getRefType().isRef()))) { - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("DataMessage<"); - VarDecl _data_2 = m.getData(); - RefableType _refType = _data_2.getRefType(); - DataType _type = _refType.getType(); - String _typeName = this._typeHelpers.typeName(_type); - _builder_1.append(_typeName, ""); - _builder_1.append(">"); - _xifexpression_2 = _builder_1.toString(); - } else { - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("Message"); - _xifexpression_2 = _builder_2.toString(); - } - final String messageType = _xifexpression_2; - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("new (buffer) "); - _builder_3.append(messageType, ""); - _builder_3.append("(getPeerAddress(), "); - _builder_3.append(portClassName, ""); - _builder_3.append("::"); - _builder_3.append(dir, ""); - _builder_3.append("_"); - String _name_1 = m.getName(); - _builder_3.append(_name_1, ""); - String _elvis = null; - if (dataArg != null) { - _elvis = dataArg; - } else { - _elvis = ""; - } - _builder_3.append(_elvis, ""); - _builder_3.append(")"); - final String message = _builder_3.toString(); - StringConcatenation _builder_4 = new StringConcatenation(); - CharSequence _messageSignatureDefinition = this.messageSignatureDefinition(m, classPrefix, false); - _builder_4.append(_messageSignatureDefinition, ""); - _builder_4.append(" {"); - _builder_4.newLineIfNotEmpty(); - { - boolean _notEquals_1 = (!Objects.equal(hdlr, null)); - if (_notEquals_1) { - _builder_4.append("\t"); - { - DetailCode _detailCode = hdlr.getDetailCode(); - EList _lines = _detailCode.getLines(); - for(final String command : _lines) { - _builder_4.append("\t"); - _builder_4.append(command, "\t"); - _builder_4.newLineIfNotEmpty(); - } - } - } else { - _builder_4.append("\t"); - CharSequence _messageCall = this.messageCall(m, true); - _builder_4.append(_messageCall, "\t"); - _builder_4.append(";"); - _builder_4.newLineIfNotEmpty(); - } - } - _builder_4.append("}"); - _builder_4.newLine(); - _builder_4.newLine(); - CharSequence _messageSignatureDefinition_1 = this.messageSignatureDefinition(m, classPrefix, true); - _builder_4.append(_messageSignatureDefinition_1, ""); - _builder_4.append(" {"); - _builder_4.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder_4.append("\t"); - _builder_4.append("DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),"); - _builder_4.newLine(); - _builder_4.append("\t"); - _builder_4.append("\t"); - _builder_4.append(portClassName, "\t\t"); - _builder_4.append("::getMessageString("); - _builder_4.append(portClassName, "\t\t"); - _builder_4.append("::"); - _builder_4.append(dir, "\t\t"); - _builder_4.append("_"); - String _name_2 = m.getName(); - _builder_4.append(_name_2, "\t\t"); - _builder_4.append(").c_str());"); - _builder_4.newLineIfNotEmpty(); - } - } - _builder_4.append("\t"); - _builder_4.append("if (getPeerAddress().isValid()) {"); - _builder_4.newLine(); - _builder_4.append("\t\t"); - _builder_4.append("Message* buffer = dynamic_cast(getPeerMsgReceiver())->getMessageBuffer(sizeof("); - _builder_4.append(messageType, "\t\t"); - _builder_4.append("));"); - _builder_4.newLineIfNotEmpty(); - _builder_4.append("\t\t"); - _builder_4.append("if (buffer) {"); - _builder_4.newLine(); - _builder_4.append("\t\t\t"); - _builder_4.append("getPeerMsgReceiver()->receive("); - _builder_4.append(message, "\t\t\t"); - _builder_4.append(");"); - _builder_4.newLineIfNotEmpty(); - _builder_4.append("\t\t"); - _builder_4.append("}"); - _builder_4.newLine(); - _builder_4.append("\t"); - _builder_4.append("}"); - _builder_4.newLine(); - _builder_4.append("}"); - _builder_4.newLine(); - _xblockexpression = _builder_4; - } - return _xblockexpression; - } - - protected CharSequence generateDataDrivenHeaderFile(final Root root, final ProtocolClass pc) { - CharSequence _xblockexpression = null; - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - final Function1 _function = (Message m) -> { - VarDecl _data = m.getData(); - return Boolean.valueOf((!Objects.equal(_data, null))); - }; - final Iterable sentMsgs = IterableExtensions.filter(_allIncomingMessages, _function); - 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(); - CharSequence _generateIncludeGuardBegin = this.stdExt.generateIncludeGuardBegin(pc, ""); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"common/etDatatypesCpp.hpp\""); - _builder.newLine(); - _builder.append("#include \"common/modelbase/DataPort.h\""); - _builder.newLine(); - { - EList _referencedDataClasses = root.getReferencedDataClasses(pc); - for(final DataClass dataClass : _referencedDataClasses) { - _builder.append("#include \""); - String _path = this.roomExt.getPath(dataClass); - _builder.append(_path, ""); - String _name_1 = dataClass.getName(); - _builder.append(_name_1, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - DetailCode _userCode1 = pc.getUserCode1(); - CharSequence _userCode = this.helpers.userCode(_userCode1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _generateNamespaceBegin = this.stdExt.generateNamespaceBegin(pc); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("class "); - String _name_2 = pc.getName(); - _builder.append(_name_2, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - DetailCode _userCode2 = pc.getUserCode2(); - CharSequence _userCode_1 = this.helpers.userCode(_userCode2); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// send port holds data"); - _builder.newLine(); - _builder.append("class "); - String _portClassName = this.roomExt.getPortClassName(pc, true); - _builder.append(_portClassName, ""); - _builder.append(" : public etRuntime::DataSendPort {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t"); - String _portClassName_1 = this.roomExt.getPortClassName(pc, true); - _builder.append(_portClassName_1, "\t"); - _builder.append("(etRuntime::IRTObject* parent, const etRuntime::String& name, int localId);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// getters and setters"); - _builder.newLine(); - { - for(final Message msg : sentMsgs) { - _builder.append("\t"); - _builder.append("void "); - String _name_3 = msg.getName(); - _builder.append(_name_3, "\t"); - _builder.append("("); - VarDecl _data = msg.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - String _typeName = this._typeHelpers.typeName(_type); - _builder.append(_typeName, "\t"); - _builder.append(" "); - String _name_4 = msg.getName(); - _builder.append(_name_4, "\t"); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("m_"); - String _name_5 = msg.getName(); - _builder.append(_name_5, "\t\t"); - _builder.append(" = "); - String _name_6 = msg.getName(); - _builder.append(_name_6, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - VarDecl _data_1 = msg.getData(); - RefableType _refType_1 = _data_1.getRefType(); - DataType _type_1 = _refType_1.getType(); - String _typeName_1 = this._typeHelpers.typeName(_type_1); - _builder.append(_typeName_1, "\t"); - _builder.append(" "); - String _name_7 = msg.getName(); - _builder.append(_name_7, "\t"); - _builder.append("() const {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("return m_"); - String _name_8 = msg.getName(); - _builder.append(_name_8, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("private:"); - _builder.newLine(); - { - for(final Message msg_1 : sentMsgs) { - _builder.append("\t"); - VarDecl _data_2 = msg_1.getData(); - RefableType _refType_2 = _data_2.getRefType(); - DataType _type_2 = _refType_2.getType(); - String _typeName_2 = this._typeHelpers.typeName(_type_2); - _builder.append(_typeName_2, "\t"); - _builder.append(" m_"); - String _name_9 = msg_1.getName(); - _builder.append(_name_9, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// receive port accesses send port"); - _builder.newLine(); - _builder.append("class "); - String _portClassName_2 = this.roomExt.getPortClassName(pc, false); - _builder.append(_portClassName_2, ""); - _builder.append(" : public etRuntime::DataReceivePort {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t"); - String _portClassName_3 = this.roomExt.getPortClassName(pc, false); - _builder.append(_portClassName_3, "\t"); - _builder.append("(etRuntime::IRTObject* parent, const etRuntime::String& name, int localId);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// getters"); - _builder.newLine(); - { - for(final Message msg_2 : sentMsgs) { - _builder.append("\t"); - VarDecl _data_3 = msg_2.getData(); - RefableType _refType_3 = _data_3.getRefType(); - DataType _type_3 = _refType_3.getType(); - String _typeName_3 = this._typeHelpers.typeName(_type_3); - _builder.append(_typeName_3, "\t"); - _builder.append(" "); - String _name_10 = msg_2.getName(); - _builder.append(_name_10, "\t"); - _builder.append("() const;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("protected:"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("virtual void connect(etRuntime::DataSendPort* dataSendPort);"); - _builder.newLine(); - _builder.newLine(); - _builder.append("private:"); - _builder.newLine(); - _builder.append("\t"); - String _portClassName_4 = this.roomExt.getPortClassName(pc, true); - _builder.append(_portClassName_4, "\t"); - _builder.append("* m_peer;"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceEnd = this.stdExt.generateNamespaceEnd(pc); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(pc, ""); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - protected CharSequence generateDataDrivenSourceFile(final Root root, final ProtocolClass pc) { - CharSequence _xblockexpression = null; - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - final Function1 _function = (Message m) -> { - VarDecl _data = m.getData(); - return Boolean.valueOf((!Objects.equal(_data, null))); - }; - final Iterable sentMsgs = IterableExtensions.filter(_allIncomingMessages, _function); - 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 _cppHeaderFileName = this.stdExt.getCppHeaderFileName(pc); - _builder.append(_cppHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("using namespace etRuntime;"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceBegin = this.stdExt.generateNamespaceBegin(pc); - _builder.append(_generateNamespaceBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - DetailCode _userCode3 = pc.getUserCode3(); - CharSequence _userCode = this.helpers.userCode(_userCode3); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("// send port holds data"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// constructor"); - _builder.newLine(); - String _portClassName = this.roomExt.getPortClassName(pc, true); - _builder.append(_portClassName, ""); - _builder.append("::"); - String _portClassName_1 = this.roomExt.getPortClassName(pc, true); - _builder.append(_portClassName_1, ""); - _builder.append("(IRTObject* parent, const String& name, int localId) :"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("DataSendPort(parent, name, localId)"); - _builder.newLine(); - _builder.append("{"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// receive port accesses send port"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// constructor"); - _builder.newLine(); - String _portClassName_2 = this.roomExt.getPortClassName(pc, false); - _builder.append(_portClassName_2, ""); - _builder.append("::"); - String _portClassName_3 = this.roomExt.getPortClassName(pc, false); - _builder.append(_portClassName_3, ""); - _builder.append("(IRTObject* parent, const String& name, int localId) :"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("DataReceivePort(parent, name, localId),"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("m_peer(0)"); - _builder.newLine(); - _builder.append("{"); - _builder.newLine(); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// getters"); - _builder.newLine(); - { - for(final Message msg : sentMsgs) { - VarDecl _data = msg.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - String _typeName = this._typeHelpers.typeName(_type); - _builder.append(_typeName, ""); - _builder.append(" "); - String _portClassName_4 = this.roomExt.getPortClassName(pc, false); - _builder.append(_portClassName_4, ""); - _builder.append("::"); - String _name_1 = msg.getName(); - _builder.append(_name_1, ""); - _builder.append("() const {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("// TODO needs default value"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("//if (m_peer == 0)"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/*\treturn "); - VarDecl _data_1 = msg.getData(); - RefableType _refType_1 = _data_1.getRefType(); - DataType _type_1 = _refType_1.getType(); - String _defaultValue = this.stdExt.defaultValue(_type_1); - _builder.append(_defaultValue, "\t"); - _builder.append("; */"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("return m_peer->"); - String _name_2 = msg.getName(); - _builder.append(_name_2, "\t"); - _builder.append("();"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("void "); - String _portClassName_5 = this.roomExt.getPortClassName(pc, false); - _builder.append(_portClassName_5, ""); - _builder.append("::connect(DataSendPort* dataSendPort) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _portClassName_6 = this.roomExt.getPortClassName(pc, true); - _builder.append(_portClassName_6, "\t"); - _builder.append("* peer = dynamic_cast<"); - String _portClassName_7 = this.roomExt.getPortClassName(pc, true); - _builder.append(_portClassName_7, "\t"); - _builder.append("*>(dataSendPort);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if (peer != 0)"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("m_peer = peer;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - String _generateNamespaceEnd = this.stdExt.generateNamespaceEnd(pc); - _builder.append(_generateNamespaceEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - @Override - public String getMessageID(final Message msg, final InterfaceItem item) { - if ((item instanceof Port)) { - Port p = ((Port) item); - String _xifexpression = null; - boolean _isConjugated = p.isConjugated(); - if (_isConjugated) { - _xifexpression = "OUT_"; - } else { - _xifexpression = "IN_"; - } - String direction = _xifexpression; - GeneralProtocolClass _protocol = p.getProtocol(); - String _name = _protocol.getName(); - String _name_1 = msg.getName(); - String _plus = (direction + _name_1); - return this.enumInUse(_name, _plus); - } else { - if ((item instanceof SAP)) { - SAP sap = ((SAP) item); - ProtocolClass _protocol_1 = sap.getProtocol(); - String _name_2 = _protocol_1.getName(); - String _name_3 = msg.getName(); - String _plus_1 = ("OUT_" + _name_3); - return this.enumInUse(_name_2, _plus_1); - } else { - if ((item instanceof SPP)) { - SPP spp = ((SPP) item); - ProtocolClass _protocol_2 = spp.getProtocol(); - String _name_4 = _protocol_2.getName(); - String _name_5 = msg.getName(); - String _plus_2 = ("IN_" + _name_5); - return this.enumInUse(_name_4, _plus_2); - } - } - } - return "unknown interface item"; - } - - protected String enumInUse(final String namespace, final String member) { - return ((namespace + "::") + member); - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java deleted file mode 100644 index 579716fe0..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java +++ /dev/null @@ -1,171 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Peter Karlitschek - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedModelComponent; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; -import org.eclipse.etrice.generator.cpp.Main; -import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; - -@Singleton -@SuppressWarnings("all") -public class StateMachineGen extends GenericStateMachineGenerator { - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Override - public CharSequence genExtra(final ExpandedModelComponent xpac, final boolean generateImplementation) { - CharSequence _xblockexpression = null; - { - final ArrayList states = CollectionLiterals.newArrayList(); - ModelComponent ac = xpac.getModelComponent(); - ModelComponent _modelComponent = xpac.getModelComponent(); - final String clsName = _modelComponent.getComponentName(); - while ((!Objects.equal(ac, null))) { - { - List _allBaseStates = this._fSMHelpers.getAllBaseStates(ac); - List _leafStatesLast = this._roomExtensions.getLeafStatesLast(_allBaseStates); - states.addAll(0, _leafStatesLast); - ModelComponent _base = ac.getBase(); - ac = _base; - } - } - CharSequence _xifexpression = null; - if (generateImplementation) { - StringConcatenation _builder = new StringConcatenation(); - { - if ((Main.getSettings().isGenerateMSCInstrumentation() || Main.getSettings().isGenerateWithVerboseOutput())) { - _builder.append("// state names"); - _builder.newLine(); - _builder.append("const String "); - _builder.append(clsName, ""); - _builder.append("::s_stateStrings[] = {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\"\","); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\"\","); - _builder.newLine(); - { - boolean _hasElements = false; - for(final State state : states) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - _builder.append("\""); - String _genStatePathName = this._codegenHelpers.getGenStatePathName(state); - _builder.append(_genStatePathName, "\t"); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("};"); - _builder.newLine(); - } - } - _builder.append("const int "); - _builder.append(clsName, ""); - _builder.append("::s_numberOfStates = "); - int _size = states.size(); - int _plus = (2 + _size); - _builder.append(_plus, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("void "); - _builder.append(clsName, ""); - _builder.append("::setState(int new_state) {"); - _builder.newLineIfNotEmpty(); - { - GlobalGeneratorSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state].c_str());"); - _builder.newLine(); - } - } - { - GlobalGeneratorSettings _settings_1 = Main.getSettings(); - boolean _isGenerateWithVerboseOutput = _settings_1.isGenerateWithVerboseOutput(); - if (_isGenerateWithVerboseOutput) { - _builder.append("\t"); - _builder.append("if (s_stateStrings[new_state] != \"Idle\") {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("std::cout << getInstancePath().c_str() << \" -> \" << s_stateStrings[new_state].c_str() << std::endl;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("m_state = new_state;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _xifexpression = _builder; - } else { - StringConcatenation _builder_1 = new StringConcatenation(); - { - if ((Main.getSettings().isGenerateMSCInstrumentation() || Main.getSettings().isGenerateWithVerboseOutput())) { - _builder_1.append("static const String s_stateStrings[];"); - _builder_1.newLine(); - } - } - _builder_1.append("static const int s_numberOfStates;"); - _builder_1.newLine(); - _builder_1.newLine(); - _builder_1.append("int history["); - int _size_1 = states.size(); - int _plus_1 = (2 + _size_1); - _builder_1.append(_plus_1, ""); - _builder_1.append("];"); - _builder_1.newLineIfNotEmpty(); - _builder_1.newLine(); - _builder_1.append("void setState(int new_state);"); - _builder_1.newLine(); - _xifexpression = _builder_1; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - @Override - public String stateType() { - return "etInt16"; - } - - @Override - public String boolType() { - return "etBool"; - } -} diff --git a/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java b/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java deleted file mode 100644 index 9775f4a35..000000000 --- a/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java +++ /dev/null @@ -1,1625 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Jung, Thomas Schuetz (initial contribution) - */ -package org.eclipse.etrice.generator.doc.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.io.File; -import java.util.Arrays; -import java.util.List; -import java.util.Set; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.common.base.Documentation; -import org.eclipse.etrice.core.common.base.util.RelativePathHelpers; -import org.eclipse.etrice.core.fsm.fSM.ChoicePoint; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.CompoundProtocolClass; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumLiteral; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.GeneralProtocolClass; -import org.eclipse.etrice.core.room.LogicalSystem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.Port; -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.RoomClass; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.StandardOperation; -import org.eclipse.etrice.core.room.SubProtocol; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.fsm.base.CodegenHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.generator.JavaIoFileSystemAccess; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@Singleton -@SuppressWarnings("all") -public class DocGen { - public static class DocGenContext { - private final Root root; - - private final RoomModel model; - - public DocGenContext(final Root r, final RoomModel m) { - this.root = r; - this.model = m; - } - } - - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - @Extension - private CodegenHelpers _codegenHelpers; - - @Inject - @Extension - private JavaIoFileSystemAccess fileAccess; - - @Inject - @Extension - private RoomExtensions roomExt; - - @Inject - private ILogger logger; - - private final String IMGDIR_DEFAULT = "./images"; - - private final String IMGWIDTH_DEFAULT = "1.0\\textwidth"; - - public void doGenerate(final Root root) { - EList _models = root.getModels(); - for (final RoomModel model : _models) { - { - final DocGen.DocGenContext ctx = new DocGen.DocGenContext(root, model); - String path = this.roomExt.getDocGenerationTargetPath(model); - String _name = model.getName(); - String file = (_name + ".tex"); - final Set referencedModels = CollectionLiterals.newHashSet(); - this.logger.logInfo((((("generating LaTeX documentation: \'" + file) + "\' in \'") + path) + "\'")); - String _name_1 = model.getName(); - String _plus = (path + _name_1); - this.fileAccess.setOutputPath(_plus); - EList _systems = model.getSystems(); - final Consumer _function = (LogicalSystem it) -> { - CharSequence _generateDoc = this.generateDoc(it, ctx); - String _docFragmentName = this.docFragmentName(it); - this.saveAs(_generateDoc, _docFragmentName); - }; - _systems.forEach(_function); - EList _systems_1 = model.getSystems(); - final Consumer _function_1 = (LogicalSystem it) -> { - EList _referencedModels = root.getReferencedModels(it); - referencedModels.addAll(_referencedModels); - }; - _systems_1.forEach(_function_1); - EList _subSystemClasses = model.getSubSystemClasses(); - final Consumer _function_2 = (SubSystemClass it) -> { - CharSequence _generateDoc = this.generateDoc(it, ctx); - String _docFragmentName = this.docFragmentName(it); - this.saveAs(_generateDoc, _docFragmentName); - }; - _subSystemClasses.forEach(_function_2); - EList _subSystemClasses_1 = model.getSubSystemClasses(); - final Consumer _function_3 = (SubSystemClass it) -> { - EList _referencedModels = root.getReferencedModels(it); - referencedModels.addAll(_referencedModels); - }; - _subSystemClasses_1.forEach(_function_3); - EList _protocolClasses = model.getProtocolClasses(); - final Consumer _function_4 = (GeneralProtocolClass it) -> { - CharSequence _generateDoc = this.generateDoc(it, ctx); - String _docFragmentName = this.docFragmentName(it); - this.saveAs(_generateDoc, _docFragmentName); - }; - _protocolClasses.forEach(_function_4); - EList _protocolClasses_1 = model.getProtocolClasses(); - final Consumer _function_5 = (GeneralProtocolClass it) -> { - EList _referencedModels = root.getReferencedModels(it); - referencedModels.addAll(_referencedModels); - }; - _protocolClasses_1.forEach(_function_5); - EList _enumerationTypes = model.getEnumerationTypes(); - final Consumer _function_6 = (EnumerationType it) -> { - CharSequence _generateDoc = this.generateDoc(it, ctx); - String _docFragmentName = this.docFragmentName(it); - this.saveAs(_generateDoc, _docFragmentName); - }; - _enumerationTypes.forEach(_function_6); - EList _enumerationTypes_1 = model.getEnumerationTypes(); - final Consumer _function_7 = (EnumerationType it) -> { - EList _referencedModels = root.getReferencedModels(it); - referencedModels.addAll(_referencedModels); - }; - _enumerationTypes_1.forEach(_function_7); - EList _dataClasses = model.getDataClasses(); - final Consumer _function_8 = (DataClass it) -> { - CharSequence _generateDoc = this.generateDoc(it, ctx); - String _docFragmentName = this.docFragmentName(it); - this.saveAs(_generateDoc, _docFragmentName); - }; - _dataClasses.forEach(_function_8); - EList _dataClasses_1 = model.getDataClasses(); - final Consumer _function_9 = (DataClass it) -> { - EList _referencedModels = root.getReferencedModels(it); - referencedModels.addAll(_referencedModels); - }; - _dataClasses_1.forEach(_function_9); - EList _actorClasses = model.getActorClasses(); - final Consumer _function_10 = (ActorClass it) -> { - CharSequence _generateDoc = this.generateDoc(it, ctx); - String _docFragmentName = this.docFragmentName(it); - this.saveAs(_generateDoc, _docFragmentName); - }; - _actorClasses.forEach(_function_10); - EList _actorClasses_1 = model.getActorClasses(); - final Consumer _function_11 = (ActorClass it) -> { - EList _referencedModels = root.getReferencedModels(it); - referencedModels.addAll(_referencedModels); - }; - _actorClasses_1.forEach(_function_11); - this.fileAccess.setOutputPath(path); - CharSequence _generateModelDoc = this.generateModelDoc(ctx, referencedModels); - this.saveAs(_generateModelDoc, file); - } - } - } - - private String removeLast(final String str) { - int _length = str.length(); - int _minus = (_length - 1); - return str.substring(0, _minus); - } - - private String appendIfNotEmpty(final String txt, final String suffix) { - String _xifexpression = null; - boolean _isEmpty = txt.isEmpty(); - if (_isEmpty) { - _xifexpression = txt; - } else { - _xifexpression = (txt + suffix); - } - return _xifexpression; - } - - private CharSequence generateModelDoc(final DocGen.DocGenContext ctx, final Set referencedModels) { - CharSequence _xblockexpression = null; - { - RoomModel model = ctx.model; - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\documentclass[titlepage]{article}"); - _builder.newLine(); - _builder.append("\\usepackage{import}"); - _builder.newLine(); - _builder.append("\\usepackage{graphicx}"); - _builder.newLine(); - _builder.append("\\usepackage{xr}"); - _builder.newLine(); - _builder.append("\\usepackage{hyperref}"); - _builder.newLine(); - _builder.append("\\IfFileExists{../doc/userinputs.tex}{\\subimport{../doc/}{userinputs.tex}}{} %hook for conditional user-specific inputs, includes, macros, ... "); - _builder.newLine(); - _builder.append("\\usepackage[a4paper,text={160mm,255mm},centering,headsep=5mm,footskip=10mm]{geometry}"); - _builder.newLine(); - _builder.append("\\usepackage{nonfloat}"); - _builder.newLine(); - _builder.append("\\parindent 0pt"); - _builder.newLine(); - _builder.append("\\makeatletter"); - _builder.newLine(); - _builder.append("\\newcommand\\level[1]{%"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\ifcase#1\\relax\\expandafter\\chapter\\or"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\expandafter\\section\\or"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\expandafter\\subsection\\or"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\expandafter\\subsubsection\\else"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\def\\next{\\@level{#1}}\\expandafter\\next"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\fi}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\\newcommand{\\@level}[1]{%"); - _builder.newLine(); - _builder.append("\\@startsection{level#1}"); - _builder.newLine(); - _builder.append(" "); - _builder.append("{#1}"); - _builder.newLine(); - _builder.append(" "); - _builder.append("{\\z@}%"); - _builder.newLine(); - _builder.append(" "); - _builder.append("{-3.25ex\\@plus -1ex \\@minus -.2ex}%"); - _builder.newLine(); - _builder.append(" "); - _builder.append("{1.5ex \\@plus .2ex}%"); - _builder.newLine(); - _builder.append(" "); - _builder.append("{\\normalfont\\normalsize\\bfseries}}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\\newdimen\\@leveldim"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\newdimen\\@dotsdim"); - _builder.newLine(); - _builder.append(" "); - _builder.append("{\\normalfont\\normalsize"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\sbox\\z@{0}\\global\\@leveldim=\\wd\\z@"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\sbox\\z@{.}\\global\\@dotsdim=\\wd\\z@"); - _builder.newLine(); - _builder.append(" "); - _builder.append("} "); - _builder.newLine(); - _builder.append("\\newcounter{level4}[subsubsection]"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\@namedef{thelevel4}{\\thesubsubsection.\\arabic{level4}}"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\@namedef{level4mark}#1{}"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\def\\l@section{\\@dottedtocline{1}{0pt}{\\dimexpr\\@leveldim*4+\\@dotsdim*1+6pt\\relax}}"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\def\\l@subsection{\\@dottedtocline{2}{0pt}{\\dimexpr\\@leveldim*5+\\@dotsdim*2+6pt\\relax}}"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\def\\l@subsubsection{\\@dottedtocline{3}{0pt}{\\dimexpr\\@leveldim*6+\\@dotsdim*3+6pt\\relax}}"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\@namedef{l@level4}{\\@dottedtocline{4}{0pt}{\\dimexpr\\@leveldim*7+\\@dotsdim*4+6pt\\relax}}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\\count@=4"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\def\\@ncp#1{\\number\\numexpr\\count@+#1\\relax}"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\loop\\ifnum\\count@<100"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\begingroup\\edef\\x{\\endgroup"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\noexpand\\newcounter{level\\@ncp{1}}[level\\number\\count@]"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\noexpand\\@namedef{thelevel\\@ncp{1}}{%"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\noexpand\\@nameuse{thelevel\\@ncp{0}}.\\noexpand\\arabic{level\\@ncp{0}}}"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\noexpand\\@namedef{level\\@ncp{1}mark}####1{}%"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\noexpand\\@namedef{l@level\\@ncp{1}}%"); - _builder.newLine(); - _builder.append(" "); - _builder.append("{\\noexpand\\@dottedtocline{\\@ncp{1}}{0pt}{\\the\\dimexpr\\@leveldim*\\@ncp{5}+\\@dotsdim*\\@ncp{0}\\relax}}}%"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\x"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\advance\\count@\\@ne"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\repeat"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\makeatother"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\setcounter{secnumdepth}{100}"); - _builder.newLine(); - _builder.append(" "); - _builder.append("\\setcounter{tocdepth}{100}"); - _builder.newLine(); - _builder.newLine(); - _builder.newLine(); - _builder.append("\\title{"); - String _name = model.getName(); - String _escapedString = this.escapedString(_name); - _builder.append(_escapedString, ""); - _builder.append(" Model Documentation}"); - _builder.newLineIfNotEmpty(); - _builder.append("\\date{\\today}"); - _builder.newLine(); - _builder.append("\\author{generated by eTrice}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\\begin{document}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\\pagestyle{plain}"); - _builder.newLine(); - _builder.append("\\maketitle"); - _builder.newLine(); - _builder.append("\\tableofcontents"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\\newpage"); - _builder.newLine(); - _builder.append("\\listoffigures"); - _builder.newLine(); - _builder.append("\\newpage"); - _builder.newLine(); - _builder.append("\\section{Model Description}"); - _builder.newLine(); - _builder.newLine(); - { - boolean _isEmpty = referencedModels.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append("\\section{Referenced Models}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\\begin{itemize}"); - _builder.newLine(); - { - final Function1 _function = (RoomModel it) -> { - return it.getName(); - }; - List _sortBy = IterableExtensions.sortBy(referencedModels, _function); - for(final RoomModel refModel : _sortBy) { - String _docGenerationTargetPath = this.roomExt.getDocGenerationTargetPath(model); - String _removeLast = this.removeLast(_docGenerationTargetPath); - String _docGenerationTargetPath_1 = this.roomExt.getDocGenerationTargetPath(refModel); - String _removeLast_1 = this.removeLast(_docGenerationTargetPath_1); - String _relativePath = RelativePathHelpers.getRelativePath(_removeLast, _removeLast_1, true); - final String relPath = this.appendIfNotEmpty(_relativePath, "/"); - _builder.newLineIfNotEmpty(); - _builder.append("\\item \\href{"); - String _replace = relPath.replace("\\", "/"); - String _name_1 = refModel.getName(); - String _plus = (_replace + _name_1); - String _escapedString_1 = this.escapedString(_plus); - _builder.append(_escapedString_1, ""); - _builder.append(".pdf}{"); - String _name_2 = refModel.getName(); - String _escapedString_2 = this.escapedString(_name_2); - _builder.append(_escapedString_2, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\end{itemize}"); - _builder.newLine(); - _builder.append("\\newpage"); - _builder.newLine(); - } - } - _builder.newLine(); - { - EList _systems = model.getSystems(); - boolean _isEmpty_1 = _systems.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - _builder.append("\\section{Logical System Classes}"); - _builder.newLine(); - { - EList _systems_1 = model.getSystems(); - for(final LogicalSystem s : _systems_1) { - String _name_3 = model.getName(); - CharSequence _generateImport = this.generateImport(s, _name_3); - _builder.append(_generateImport, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\newpage"); - _builder.newLine(); - } - } - _builder.newLine(); - { - EList _subSystemClasses = model.getSubSystemClasses(); - boolean _isEmpty_2 = _subSystemClasses.isEmpty(); - boolean _not_2 = (!_isEmpty_2); - if (_not_2) { - _builder.append("\\section{Subsystem Classes}"); - _builder.newLine(); - { - EList _subSystemClasses_1 = model.getSubSystemClasses(); - for(final SubSystemClass s_1 : _subSystemClasses_1) { - String _name_4 = model.getName(); - CharSequence _generateImport_1 = this.generateImport(s_1, _name_4); - _builder.append(_generateImport_1, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\newpage"); - _builder.newLine(); - } - } - _builder.newLine(); - { - EList _protocolClasses = model.getProtocolClasses(); - boolean _isEmpty_3 = _protocolClasses.isEmpty(); - boolean _not_3 = (!_isEmpty_3); - if (_not_3) { - _builder.append("\\section{Protocol Classes}"); - _builder.newLine(); - { - EList _protocolClasses_1 = model.getProtocolClasses(); - for(final GeneralProtocolClass c : _protocolClasses_1) { - String _name_5 = model.getName(); - CharSequence _generateImport_2 = this.generateImport(c, _name_5); - _builder.append(_generateImport_2, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\newpage"); - _builder.newLine(); - } - } - _builder.newLine(); - { - EList _enumerationTypes = model.getEnumerationTypes(); - boolean _isEmpty_4 = _enumerationTypes.isEmpty(); - boolean _not_4 = (!_isEmpty_4); - if (_not_4) { - _builder.append("\\section{Enumeration Types}"); - _builder.newLine(); - { - EList _enumerationTypes_1 = model.getEnumerationTypes(); - for(final EnumerationType e : _enumerationTypes_1) { - String _name_6 = model.getName(); - CharSequence _generateImport_3 = this.generateImport(e, _name_6); - _builder.append(_generateImport_3, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\newpage"); - _builder.newLine(); - } - } - _builder.newLine(); - { - EList _dataClasses = model.getDataClasses(); - boolean _isEmpty_5 = _dataClasses.isEmpty(); - boolean _not_5 = (!_isEmpty_5); - if (_not_5) { - _builder.append("\\section{Data Classes}"); - _builder.newLine(); - { - EList _dataClasses_1 = model.getDataClasses(); - for(final DataClass c_1 : _dataClasses_1) { - String _name_7 = model.getName(); - CharSequence _generateImport_4 = this.generateImport(c_1, _name_7); - _builder.append(_generateImport_4, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\newpage"); - _builder.newLine(); - } - } - _builder.newLine(); - { - EList _actorClasses = model.getActorClasses(); - boolean _isEmpty_6 = _actorClasses.isEmpty(); - boolean _not_6 = (!_isEmpty_6); - if (_not_6) { - _builder.append("\\section{Actor Classes}"); - _builder.newLine(); - { - EList _actorClasses_1 = model.getActorClasses(); - for(final ActorClass c_2 : _actorClasses_1) { - String _name_8 = model.getName(); - CharSequence _generateImport_5 = this.generateImport(c_2, _name_8); - _builder.append(_generateImport_5, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.append("\\end{document}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence _generateDoc(final LogicalSystem system, final DocGen.DocGenContext ctx) { - CharSequence _xblockexpression = null; - { - String _name = system.getName(); - final String filename = (_name + "_instanceTree.jpg"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\level{2}{"); - String _name_1 = system.getName(); - String _escapedString = this.escapedString(_name_1); - _builder.append(_escapedString, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - Documentation _docu = system.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu); - _builder.append(_generateDocText, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\\level{3}{Instance Tree}"); - _builder.newLine(); - { - String _imagePath = this.getImagePath(filename); - String _fileExists = this.fileExists(ctx.model, _imagePath); - boolean _equals = _fileExists.equals("true"); - if (_equals) { - String _imagePath_1 = this.getImagePath(filename); - String _name_2 = system.getName(); - String _plus = (_name_2 + " Instance Tree"); - CharSequence _includeGraphics = this.includeGraphics(_imagePath_1, this.IMGWIDTH_DEFAULT, _plus); - _builder.append(_includeGraphics, ""); - _builder.newLineIfNotEmpty(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence _generateDoc(final SubSystemClass ssc, final DocGen.DocGenContext ctx) { - CharSequence _xblockexpression = null; - { - String _name = ssc.getName(); - String _escapedString = this.escapedString(_name); - final String filename = (_escapedString + "_structure.jpg"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\level{2}{"); - String _name_1 = ssc.getName(); - String _escapedString_1 = this.escapedString(_name_1); - _builder.append(_escapedString_1, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - Documentation _docu = ssc.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu); - _builder.append(_generateDocText, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\\level{3}{Structure}"); - _builder.newLine(); - { - String _imagePath = this.getImagePath(filename); - String _fileExists = this.fileExists(ctx.model, _imagePath); - boolean _equals = _fileExists.equals("true"); - if (_equals) { - String _imagePath_1 = this.getImagePath(filename); - String _name_2 = ssc.getName(); - String _plus = (_name_2 + " Structure"); - CharSequence _includeGraphics = this.includeGraphics(_imagePath_1, this.IMGWIDTH_DEFAULT, _plus); - _builder.append(_includeGraphics, ""); - _builder.newLineIfNotEmpty(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence _generateDoc(final EnumerationType dc, final DocGen.DocGenContext ctx) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\level{2} {"); - String _name = dc.getName(); - String _escapedString = this.escapedString(_name); - _builder.append(_escapedString, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - Documentation _docu = dc.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu); - _builder.append(_generateDocText, ""); - _builder.newLineIfNotEmpty(); - { - PrimitiveType _primitiveType = dc.getPrimitiveType(); - boolean _notEquals = (!Objects.equal(_primitiveType, null)); - if (_notEquals) { - _builder.append("The literals of this enumeration are based on PrimitiveType "); - PrimitiveType _primitiveType_1 = dc.getPrimitiveType(); - String _name_1 = _primitiveType_1.getName(); - String _escapedString_1 = this.escapedString(_name_1); - _builder.append(_escapedString_1, ""); - _builder.append("."); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("The literals of this enumeration are of type \\texttt{int}."); - _builder.newLine(); - } - } - _builder.append("\\level{3}{Literals}"); - _builder.newLine(); - _builder.append("\\begin{tabular}[ht]{|l|r|r|r|}"); - _builder.newLine(); - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\textbf{Name} & \\textbf{Value} & \\textbf{Hex Value} & \\textbf{Binary Value}\\\\"); - _builder.newLine(); - { - EList _literals = dc.getLiterals(); - for(final EnumLiteral lit : _literals) { - _builder.append("\\hline"); - _builder.newLine(); - String _name_2 = lit.getName(); - String _escapedString_2 = this.escapedString(_name_2); - _builder.append(_escapedString_2, ""); - _builder.append(" & "); - long _literalValue = lit.getLiteralValue(); - _builder.append(_literalValue, ""); - _builder.append(" & 0x"); - long _literalValue_1 = lit.getLiteralValue(); - String _hexString = Long.toHexString(_literalValue_1); - _builder.append(_hexString, ""); - _builder.append(" & "); - long _literalValue_2 = lit.getLiteralValue(); - String _binaryString = Long.toBinaryString(_literalValue_2); - _builder.append(_binaryString, ""); - _builder.append("\\\\"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\end{tabular}"); - _builder.newLine(); - return _builder; - } - - private CharSequence _generateDoc(final DataClass dc, final DocGen.DocGenContext ctx) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\level{2} {"); - String _name = dc.getName(); - String _escapedString = this.escapedString(_name); - _builder.append(_escapedString, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - Documentation _docu = dc.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu); - _builder.append(_generateDocText, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\\level{3}{Attributes}"); - _builder.newLine(); - EList _attributes = dc.getAttributes(); - CharSequence _generateAttributesDoc = this.generateAttributesDoc(_attributes); - _builder.append(_generateAttributesDoc, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\\level{3}{Operations}"); - _builder.newLine(); - EList _operations = dc.getOperations(); - CharSequence _generateOperationsDoc = this.generateOperationsDoc(_operations); - _builder.append(_generateOperationsDoc, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - private CharSequence _generateDoc(final ProtocolClass pc, final DocGen.DocGenContext ctx) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\level{2} {"); - String _name = pc.getName(); - String _escapedString = this.escapedString(_name); - _builder.append(_escapedString, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - Documentation _docu = pc.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu); - _builder.append(_generateDocText, ""); - _builder.newLineIfNotEmpty(); - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - boolean _isEmpty = _allIncomingMessages.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append("\\level{3}{Incoming Messages}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\\begin{tabular}[ht]{|l|l|l|p{8cm}|}"); - _builder.newLine(); - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("Message & Data & Type & Description\\\\"); - _builder.newLine(); - { - List _allIncomingMessages_1 = this._roomHelpers.getAllIncomingMessages(pc); - for(final Message ims : _allIncomingMessages_1) { - _builder.append("\\hline"); - _builder.newLine(); - String _name_1 = ims.getName(); - String _escapedString_1 = this.escapedString(_name_1); - _builder.append(_escapedString_1, ""); - _builder.append(" & "); - { - VarDecl _data = ims.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (_notEquals) { - _builder.append(" "); - VarDecl _data_1 = ims.getData(); - String _name_2 = _data_1.getName(); - String _escapedString_2 = this.escapedString(_name_2); - _builder.append(_escapedString_2, ""); - _builder.append(" "); - } - } - _builder.append(" & "); - { - VarDecl _data_2 = ims.getData(); - boolean _notEquals_1 = (!Objects.equal(_data_2, null)); - if (_notEquals_1) { - _builder.append(" "); - VarDecl _data_3 = ims.getData(); - RefableType _refType = _data_3.getRefType(); - DataType _type = _refType.getType(); - String _name_3 = _type.getName(); - String _escapedString_3 = this.escapedString(_name_3); - _builder.append(_escapedString_3, ""); - _builder.append(" "); - } - } - _builder.append(" & "); - Documentation _docu_1 = ims.getDocu(); - CharSequence _generateDocText_1 = this.generateDocText(_docu_1); - _builder.append(_generateDocText_1, ""); - _builder.append("\\\\"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\end{tabular}"); - _builder.newLine(); - } - } - { - List _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); - boolean _isEmpty_1 = _allOutgoingMessages.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - _builder.append("\\level{3}{Outgoing Messages}"); - _builder.newLine(); - _builder.append("\\begin{tabular}[ht]{|l|l|l|p{8cm}|}"); - _builder.newLine(); - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("Message & Data & Type & Description\\\\"); - _builder.newLine(); - { - List _allOutgoingMessages_1 = this._roomHelpers.getAllOutgoingMessages(pc); - for(final Message oms : _allOutgoingMessages_1) { - _builder.append("\\hline"); - _builder.newLine(); - String _name_4 = oms.getName(); - String _escapedString_4 = this.escapedString(_name_4); - _builder.append(_escapedString_4, ""); - _builder.append(" & "); - { - VarDecl _data_4 = oms.getData(); - boolean _notEquals_2 = (!Objects.equal(_data_4, null)); - if (_notEquals_2) { - _builder.append(" "); - VarDecl _data_5 = oms.getData(); - String _name_5 = _data_5.getName(); - String _escapedString_5 = this.escapedString(_name_5); - _builder.append(_escapedString_5, ""); - _builder.append(" "); - } - } - _builder.append(" & "); - { - VarDecl _data_6 = oms.getData(); - boolean _notEquals_3 = (!Objects.equal(_data_6, null)); - if (_notEquals_3) { - _builder.append(" "); - VarDecl _data_7 = oms.getData(); - RefableType _refType_1 = _data_7.getRefType(); - DataType _type_1 = _refType_1.getType(); - String _name_6 = _type_1.getName(); - String _escapedString_6 = this.escapedString(_name_6); - _builder.append(_escapedString_6, ""); - _builder.append(" "); - } - } - _builder.append(" & "); - Documentation _docu_2 = oms.getDocu(); - CharSequence _generateDocText_2 = this.generateDocText(_docu_2); - _builder.append(_generateDocText_2, ""); - _builder.append("\\\\"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\end{tabular}"); - _builder.newLine(); - } - } - return _builder; - } - - private CharSequence _generateDoc(final CompoundProtocolClass pc, final DocGen.DocGenContext ctx) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\level{2} {"); - String _name = pc.getName(); - String _escapedString = this.escapedString(_name); - _builder.append(_escapedString, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - Documentation _docu = pc.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu); - _builder.append(_generateDocText, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\\level{3}{Sub Protocols}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\\begin{tabular}[ht]{|l|l|}"); - _builder.newLine(); - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\textbf{Name} & \\textbf{Protocol}\\\\"); - _builder.newLine(); - { - EList _subProtocols = pc.getSubProtocols(); - for(final SubProtocol sub : _subProtocols) { - _builder.append("\\hline"); - _builder.newLine(); - String _name_1 = sub.getName(); - String _escapedString_1 = this.escapedString(_name_1); - _builder.append(_escapedString_1, ""); - _builder.append(" & "); - GeneralProtocolClass _protocol = sub.getProtocol(); - String _name_2 = _protocol.getName(); - String _escapedString_2 = this.escapedString(_name_2); - _builder.append(_escapedString_2, ""); - _builder.append("\\\\"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\end{tabular}"); - _builder.newLine(); - return _builder; - } - - private CharSequence _generateDoc(final ActorClass ac, final DocGen.DocGenContext ctx) { - CharSequence _xblockexpression = null; - { - String _name = ac.getName(); - final String filename = (_name + "_structure.jpg"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\level{2}{"); - String _name_1 = ac.getName(); - String _escapedString = this.escapedString(_name_1); - _builder.append(_escapedString, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - Documentation _docu = ac.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu); - _builder.append(_generateDocText, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - if ((this.fileExists(ctx.model, this.getImagePath(filename)).equals("true") && ((!this._roomHelpers.getAllInterfaceItems(ac).isEmpty()) || (!ac.getActorRefs().isEmpty())))) { - _builder.append("\\level{3}{Structure}"); - _builder.newLine(); - Documentation _structureDocu = ac.getStructureDocu(); - CharSequence _generateDocText_1 = this.generateDocText(_structureDocu); - _builder.append(_generateDocText_1, ""); - _builder.newLineIfNotEmpty(); - String _imagePath = this.getImagePath(filename); - String _name_2 = ac.getName(); - String _plus = (_name_2 + " Structure"); - CharSequence _includeGraphics = this.includeGraphics(_imagePath, this.IMGWIDTH_DEFAULT, _plus); - _builder.append(_includeGraphics, ""); - _builder.newLineIfNotEmpty(); - } else { - Documentation _structureDocu_1 = ac.getStructureDocu(); - boolean _notEquals = (!Objects.equal(_structureDocu_1, null)); - if (_notEquals) { - _builder.append("\\level{3}{Structure}"); - _builder.newLine(); - Documentation _structureDocu_2 = ac.getStructureDocu(); - CharSequence _generateDocText_2 = this.generateDocText(_structureDocu_2); - _builder.append(_generateDocText_2, ""); - _builder.newLineIfNotEmpty(); - } - } - } - _builder.newLine(); - { - List _allPorts = this._roomHelpers.getAllPorts(ac); - boolean _isEmpty = _allPorts.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append("\\level{3}{Ports}"); - _builder.newLine(); - String _generatePortDoc = this.generatePortDoc(ac); - _builder.append(_generatePortDoc, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - boolean _isBehaviorAnnotationPresent = this._roomHelpers.isBehaviorAnnotationPresent(ac, "BehaviorManual"); - if (_isBehaviorAnnotationPresent) { - _builder.append("\\level{3}{Behavior}"); - _builder.newLine(); - Documentation _behaviorDocu = ac.getBehaviorDocu(); - CharSequence _generateDocText_3 = this.generateDocText(_behaviorDocu); - _builder.append(_generateDocText_3, ""); - _builder.newLineIfNotEmpty(); - _builder.append("The behavior for ActorClass "); - String _name_3 = ac.getName(); - _builder.append(_name_3, ""); - _builder.append(" is implemented manually."); - _builder.newLineIfNotEmpty(); - } else { - boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac); - if (_hasNonEmptyStateMachine) { - _builder.append("\\level{3}{Behavior}"); - _builder.newLine(); - Documentation _behaviorDocu_1 = ac.getBehaviorDocu(); - CharSequence _generateDocText_4 = this.generateDocText(_behaviorDocu_1); - _builder.append(_generateDocText_4, ""); - _builder.newLineIfNotEmpty(); - CharSequence _generateFsmDoc = this.generateFsmDoc(ctx.model, ac); - _builder.append(_generateFsmDoc, ""); - _builder.newLineIfNotEmpty(); - } else { - Documentation _behaviorDocu_2 = ac.getBehaviorDocu(); - boolean _notEquals_1 = (!Objects.equal(_behaviorDocu_2, null)); - if (_notEquals_1) { - _builder.append("\\level{3}{Behavior}"); - _builder.newLine(); - Documentation _behaviorDocu_3 = ac.getBehaviorDocu(); - CharSequence _generateDocText_5 = this.generateDocText(_behaviorDocu_3); - _builder.append(_generateDocText_5, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - { - EList _attributes = ac.getAttributes(); - boolean _isEmpty_1 = _attributes.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - _builder.append("\\level{3}{Attributes}"); - _builder.newLine(); - EList _attributes_1 = ac.getAttributes(); - CharSequence _generateAttributesDoc = this.generateAttributesDoc(_attributes_1); - _builder.append(_generateAttributesDoc, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - EList _operations = ac.getOperations(); - boolean _isEmpty_2 = _operations.isEmpty(); - boolean _not_2 = (!_isEmpty_2); - if (_not_2) { - _builder.append("\\level{3}{Operations}"); - _builder.newLine(); - EList _operations_1 = ac.getOperations(); - CharSequence _generateOperationsDoc = this.generateOperationsDoc(_operations_1); - _builder.append(_generateOperationsDoc, ""); - _builder.newLineIfNotEmpty(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence generateFsmDoc(final RoomModel model, final ActorClass ac) { - CharSequence _xblockexpression = null; - { - String _name = ac.getName(); - final String filename = (_name + "_behavior.jpg"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\level{4}{Top Level}"); - _builder.newLine(); - { - String _imagePath = this.getImagePath(filename); - String _fileExists = this.fileExists(model, _imagePath); - boolean _equals = _fileExists.equals("true"); - if (_equals) { - String _imagePath_1 = this.getImagePath(filename); - String _name_1 = ac.getName(); - String _plus = (_name_1 + " Top State"); - CharSequence _includeGraphics = this.includeGraphics(_imagePath_1, this.IMGWIDTH_DEFAULT, _plus); - _builder.append(_includeGraphics, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\\begin{par}"); - _builder.newLine(); - { - StateGraph _stateMachine = ac.getStateMachine(); - EList _states = _stateMachine.getStates(); - for(final State s : _states) { - { - Documentation _docu = s.getDocu(); - boolean _notEquals = (!Objects.equal(_docu, null)); - if (_notEquals) { - _builder.append("\\textbf{State description} \\textit{"); - String _genStatePathName = this._codegenHelpers.getGenStatePathName(s); - String _replaceAll = _genStatePathName.replaceAll("_", "\\\\_"); - _builder.append(_replaceAll, ""); - _builder.append("}:"); - _builder.newLineIfNotEmpty(); - _builder.append("\\newline"); - _builder.newLine(); - Documentation _docu_1 = s.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu_1); - _builder.append(_generateDocText, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\\newline\\newline"); - _builder.newLine(); - } - } - } - } - _builder.newLine(); - { - StateGraph _stateMachine_1 = ac.getStateMachine(); - EList _chPoints = _stateMachine_1.getChPoints(); - for(final ChoicePoint c : _chPoints) { - { - Documentation _docu_2 = c.getDocu(); - boolean _notEquals_1 = (!Objects.equal(_docu_2, null)); - if (_notEquals_1) { - _builder.append("\\textbf{Choicepoint description} \\textit{"); - String _name_2 = c.getName(); - String _escapedString = this.escapedString(_name_2); - _builder.append(_escapedString, ""); - _builder.append("}:"); - _builder.newLineIfNotEmpty(); - _builder.append("\\newline"); - _builder.newLine(); - Documentation _docu_3 = c.getDocu(); - CharSequence _generateDocText_1 = this.generateDocText(_docu_3); - _builder.append(_generateDocText_1, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\\newline\\newline"); - _builder.newLine(); - } - } - } - } - _builder.append("\\end{par}"); - _builder.newLine(); - _builder.newLine(); - { - StateGraph _stateMachine_2 = ac.getStateMachine(); - EList _states_1 = _stateMachine_2.getStates(); - for(final State s_1 : _states_1) { - { - boolean _isLeaf = this._roomHelpers.isLeaf(s_1); - boolean _not = (!_isLeaf); - if (_not) { - String _generateStateDoc = this.generateStateDoc(model, ac, s_1); - _builder.append(_generateStateDoc, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private String getType(final Port p) { - String _xifexpression = null; - boolean _isConjugated = p.isConjugated(); - if (_isConjugated) { - _xifexpression = "conj."; - } else { - _xifexpression = "reg."; - } - return _xifexpression; - } - - private String getKind(final Port p) { - String _xifexpression = null; - boolean _isInternal = this._roomHelpers.isInternal(p); - if (_isInternal) { - _xifexpression = "internal"; - } else { - String _xifexpression_1 = null; - boolean _isExternal = this._roomHelpers.isExternal(p); - if (_isExternal) { - _xifexpression_1 = "external"; - } else { - String _xifexpression_2 = null; - boolean _isRelay = this._roomHelpers.isRelay(p); - if (_isRelay) { - _xifexpression_2 = "relay"; - } else { - _xifexpression_2 = "?"; - } - _xifexpression_1 = _xifexpression_2; - } - _xifexpression = _xifexpression_1; - } - return _xifexpression; - } - - private String getMultAsText(final Port p) { - String _xifexpression = null; - int _multiplicity = p.getMultiplicity(); - boolean _equals = (_multiplicity == (-1)); - if (_equals) { - _xifexpression = "*"; - } else { - int _multiplicity_1 = p.getMultiplicity(); - _xifexpression = Integer.valueOf(_multiplicity_1).toString(); - } - return _xifexpression; - } - - private String generatePortDoc(final ActorClass ac) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\begin{tabular}[ht]{|l|l|l|l|l|p{5cm}|}"); - _builder.newLine(); - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\textbf{Name} & \\textbf{Protocol} & \\textbf{Type} & \\textbf{Kind} & \\textbf{Multiplicity} & \\textbf{Description}\\\\"); - _builder.newLine(); - { - List _allPorts = this._roomHelpers.getAllPorts(ac); - for(final Port at : _allPorts) { - _builder.append("\\hline"); - _builder.newLine(); - String _name = at.getName(); - String _escapedString = this.escapedString(_name); - _builder.append(_escapedString, ""); - _builder.append(" & "); - GeneralProtocolClass _protocol = at.getProtocol(); - String _name_1 = _protocol.getName(); - String _escapedString_1 = this.escapedString(_name_1); - _builder.append(_escapedString_1, ""); - _builder.append(" & "); - String _type = this.getType(at); - _builder.append(_type, ""); - _builder.append(" & "); - String _kind = this.getKind(at); - _builder.append(_kind, ""); - _builder.append(" & "); - String _multAsText = this.getMultAsText(at); - _builder.append(_multAsText, ""); - _builder.append(" & "); - Documentation _docu = at.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu); - _builder.append(_generateDocText, ""); - _builder.append("\\\\"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\end{tabular}"); - _builder.newLine(); - return _builder.toString(); - } - - private String generateStateDoc(final RoomModel model, final ActorClass ac, final State state) { - String _xblockexpression = null; - { - String _name = ac.getName(); - String _plus = (_name + "_"); - String _genStatePathName = this._codegenHelpers.getGenStatePathName(state); - String _plus_1 = (_plus + _genStatePathName); - final String filename = (_plus_1 + "_behavior.jpg"); - this.logger.logInfo(("Gen Filename: " + filename)); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\level{4}{Subgraph "); - String _genStatePathName_1 = this._codegenHelpers.getGenStatePathName(state); - String _replaceAll = _genStatePathName_1.replaceAll("_", "\\\\_"); - _builder.append(_replaceAll, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - { - String _imagePath = this.getImagePath(filename); - String _fileExists = this.fileExists(model, _imagePath); - boolean _equals = _fileExists.equals("true"); - if (_equals) { - String _imagePath_1 = this.getImagePath(filename); - String _name_1 = ac.getName(); - String _plus_2 = (_name_1 + "_"); - String _genStatePathName_2 = this._codegenHelpers.getGenStatePathName(state); - String _plus_3 = (_plus_2 + _genStatePathName_2); - CharSequence _includeGraphics = this.includeGraphics(_imagePath_1, this.IMGWIDTH_DEFAULT, _plus_3); - _builder.append(_includeGraphics, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\\begin{par}"); - _builder.newLine(); - { - StateGraph _subgraph = state.getSubgraph(); - EList _states = _subgraph.getStates(); - for(final State s : _states) { - { - Documentation _docu = s.getDocu(); - boolean _notEquals = (!Objects.equal(_docu, null)); - if (_notEquals) { - _builder.append("\\textbf{State description} \\textit{"); - String _genStatePathName_3 = this._codegenHelpers.getGenStatePathName(s); - String _replaceAll_1 = _genStatePathName_3.replaceAll("_", "\\\\_"); - _builder.append(_replaceAll_1, ""); - _builder.append("}:"); - _builder.newLineIfNotEmpty(); - _builder.append("\\newline"); - _builder.newLine(); - Documentation _docu_1 = s.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu_1); - _builder.append(_generateDocText, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\\newline\\newline"); - _builder.newLine(); - } - } - } - } - _builder.newLine(); - { - StateGraph _subgraph_1 = state.getSubgraph(); - EList _chPoints = _subgraph_1.getChPoints(); - for(final ChoicePoint c : _chPoints) { - { - Documentation _docu_2 = c.getDocu(); - boolean _notEquals_1 = (!Objects.equal(_docu_2, null)); - if (_notEquals_1) { - _builder.append("\\textbf{Choicepoint description} \\textit{"); - String _name_2 = c.getName(); - String _escapedString = this.escapedString(_name_2); - _builder.append(_escapedString, ""); - _builder.append("}:"); - _builder.newLineIfNotEmpty(); - _builder.append("\\newline"); - _builder.newLine(); - Documentation _docu_3 = c.getDocu(); - CharSequence _generateDocText_1 = this.generateDocText(_docu_3); - _builder.append(_generateDocText_1, ""); - _builder.newLineIfNotEmpty(); - _builder.append("\\newline\\newline"); - _builder.newLine(); - } - } - } - } - _builder.append("\\end{par}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - { - StateGraph _subgraph_2 = state.getSubgraph(); - EList _states_1 = _subgraph_2.getStates(); - for(final State s_1 : _states_1) { - { - boolean _isLeaf = this._roomHelpers.isLeaf(s_1); - boolean _not = (!_isLeaf); - if (_not) { - String _generateStateDoc = this.generateStateDoc(model, ac, s_1); - _builder.append(_generateStateDoc, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - _xblockexpression = _builder.toString(); - } - return _xblockexpression; - } - - private CharSequence generateAttributesDoc(final List attributes) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _isEmpty = attributes.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append("\\begin{tabular}[ht]{|l|l|p{8cm}|}"); - _builder.newLine(); - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\textbf{Name} & \\textbf{Type} & \\textbf{Description}\\\\"); - _builder.newLine(); - { - for(final Attribute at : attributes) { - _builder.append("\\hline"); - _builder.newLine(); - String _name = at.getName(); - String _escapedString = this.escapedString(_name); - _builder.append(_escapedString, ""); - _builder.append(" & "); - RefableType _type = at.getType(); - DataType _type_1 = _type.getType(); - String _name_1 = _type_1.getName(); - String _escapedString_1 = this.escapedString(_name_1); - _builder.append(_escapedString_1, ""); - _builder.append(" & "); - Documentation _docu = at.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu); - _builder.append(_generateDocText, ""); - _builder.append("\\\\"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\end{tabular}"); - _builder.newLine(); - } - } - return _builder; - } - - private CharSequence generateOperationsDoc(final List operations) { - StringConcatenation _builder = new StringConcatenation(); - { - for(final StandardOperation op : operations) { - _builder.append("\\begin{tabular}[ht]{|l|l|}"); - _builder.newLine(); - _builder.append("\\hline\t\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("Name: & "); - String _name = op.getName(); - String _escapedString = this.escapedString(_name); - _builder.append(_escapedString, "\t"); - _builder.append("\\\\"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ReturnType: & "); - { - RefableType _returnType = op.getReturnType(); - boolean _notEquals = (!Objects.equal(_returnType, null)); - if (_notEquals) { - RefableType _returnType_1 = op.getReturnType(); - DataType _type = _returnType_1.getType(); - String _name_1 = _type.getName(); - String _escapedString_1 = this.escapedString(_name_1); - _builder.append(_escapedString_1, "\t"); - } else { - _builder.append("void"); - } - } - _builder.append("\\\\"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("Arguments: & "); - { - EList _arguments = op.getArguments(); - boolean _hasElements = false; - for(final VarDecl pa : _arguments) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", "\t"); - } - String _name_2 = pa.getName(); - String _escapedString_2 = this.escapedString(_name_2); - _builder.append(_escapedString_2, "\t"); - _builder.append(":"); - RefableType _refType = pa.getRefType(); - DataType _type_1 = _refType.getType(); - String _name_3 = _type_1.getName(); - String _escapedString_3 = this.escapedString(_name_3); - _builder.append(_escapedString_3, "\t"); - } - } - _builder.append("\\\\"); - _builder.newLineIfNotEmpty(); - { - Documentation _docu = op.getDocu(); - boolean _notEquals_1 = (!Objects.equal(_docu, null)); - if (_notEquals_1) { - _builder.append("\t"); - _builder.append("\\hline"); - _builder.newLine(); - { - Documentation _docu_1 = op.getDocu(); - String _string = _docu_1.toString(); - int _length = _string.length(); - boolean _greaterThan = (_length > 85); - if (_greaterThan) { - _builder.append("\t"); - _builder.append("\\multicolumn{2} {|p{13cm}|} {"); - Documentation _docu_2 = op.getDocu(); - CharSequence _generateDocText = this.generateDocText(_docu_2); - _builder.append(_generateDocText, "\t"); - _builder.append("}\\\\"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("\\multicolumn{2} {|l|} {"); - Documentation _docu_3 = op.getDocu(); - CharSequence _generateDocText_1 = this.generateDocText(_docu_3); - _builder.append(_generateDocText_1, "\t"); - _builder.append("}\\\\"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.append("\t"); - _builder.append("\\hline"); - _builder.newLine(); - _builder.append("\\end{tabular}"); - _builder.newLine(); - _builder.append("\\newline\\newline\\newline"); - _builder.newLine(); - } - } - return _builder; - } - - private CharSequence generateDocText(final Documentation doc) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _notEquals = (!Objects.equal(doc, null)); - if (_notEquals) { - _builder.append("% begin text from user Documentation"); - _builder.newLine(); - { - EList _lines = doc.getLines(); - for(final String line : _lines) { - String _escapedString = this.escapedString(line); - _builder.append(_escapedString, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("% end text from user Documentation"); - _builder.newLine(); - } - } - return _builder; - } - - private String fileExists(final RoomModel model, final String f) { - String _docGenerationTargetPath = this.roomExt.getDocGenerationTargetPath(model); - final String absPath = (_docGenerationTargetPath + f); - final File file = new File(absPath); - final boolean exist = file.exists(); - if ((exist == true)) { - this.logger.logInfo(("File found ! " + f)); - return "true"; - } else { - this.logger.logInfo(("File not found ! " + f)); - return "false"; - } - } - - private CharSequence includeGraphics(final String filename, final String width, final String caption) { - CharSequence _xblockexpression = null; - { - String latexCaption = caption.replaceAll("_", "\\\\_"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("{"); - _builder.newLine(); - _builder.append("\\centering{}"); - _builder.newLine(); - _builder.append("\\includegraphics[width="); - _builder.append(width, ""); - _builder.append("]{"); - _builder.append(filename, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - _builder.append("\\figcaption{"); - _builder.append(latexCaption, ""); - _builder.append("}"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private String escapedString(final String text) { - return text.replace("_", "\\_"); - } - - private String getImagePath(final String filename) { - String filenamei = ((this.IMGDIR_DEFAULT + "/") + filename); - String _replaceAll = filenamei.replaceAll("\\\\", "/"); - filenamei = _replaceAll; - return filenamei; - } - - private void saveAs(final CharSequence content, final String filename) { - this.fileAccess.generateFile(filename, content); - } - - private String docFragmentName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + ".tex"); - } - - private CharSequence generateImport(final RoomClass rc, final String dir) { - StringConcatenation _builder = new StringConcatenation(); - String _docFragmentName = this.docFragmentName(rc); - CharSequence _generateImport = this.generateImport(_docFragmentName, dir); - _builder.append(_generateImport, ""); - return _builder; - } - - private CharSequence generateImport(final String name, final String dir) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\\subimport*{"); - _builder.append(dir, ""); - _builder.append("/}{"); - _builder.append(name, ""); - _builder.append("}"); - return _builder; - } - - private CharSequence generateDoc(final RoomClass ac, final DocGen.DocGenContext ctx) { - if (ac instanceof ActorClass) { - return _generateDoc((ActorClass)ac, ctx); - } else if (ac instanceof DataClass) { - return _generateDoc((DataClass)ac, ctx); - } else if (ac instanceof SubSystemClass) { - return _generateDoc((SubSystemClass)ac, ctx); - } else if (ac instanceof CompoundProtocolClass) { - return _generateDoc((CompoundProtocolClass)ac, ctx); - } else if (ac instanceof EnumerationType) { - return _generateDoc((EnumerationType)ac, ctx); - } else if (ac instanceof LogicalSystem) { - return _generateDoc((LogicalSystem)ac, ctx); - } else if (ac instanceof ProtocolClass) { - return _generateDoc((ProtocolClass)ac, ctx); - } else { - throw new IllegalArgumentException("Unhandled parameter types: " + - Arrays.asList(ac, ctx).toString()); - } - } -} diff --git a/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.java b/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.java deleted file mode 100644 index 8905db1e5..000000000 --- a/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.java +++ /dev/null @@ -1,276 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.doc.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.io.File; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.etmap.util.ETMapUtil; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread; -import org.eclipse.etrice.core.genmodel.etricegen.AbstractInstance; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInterfaceInstance; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SystemInstance; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.generator.JavaIoFileSystemAccess; -import org.eclipse.xtext.xbase.lib.Exceptions; -import org.eclipse.xtext.xbase.lib.Extension; - -@Singleton -@SuppressWarnings("all") -public class InstanceDiagramGen { - @Inject - @Extension - private JavaIoFileSystemAccess fileAccess; - - @Inject - @Extension - private RoomExtensions roomExt; - - @Inject - private ILogger logger; - - public void doGenerate(final Root root) { - EList _models = root.getModels(); - for (final RoomModel model : _models) { - { - String _docGenerationTargetPath = this.roomExt.getDocGenerationTargetPath(model); - String path = (_docGenerationTargetPath + "/images"); - this.fileAccess.setOutputPath(path); - String batchFile = "dot2jpg.bat"; - EList _systemInstances = root.getSystemInstances(); - for (final SystemInstance sys : _systemInstances) { - { - String _name = sys.getName(); - String file = (_name + "_instanceTree.dot"); - this.logger.logInfo((((("generating instance tree diagram: \'" + file) + "\' in \'") + path) + "\'")); - CharSequence _generate = this.generate(root, sys); - this.fileAccess.generateFile(file, _generate); - } - } - CharSequence _generate2jpg = this.generate2jpg(root); - this.fileAccess.generateFile(batchFile, _generate2jpg); - this.runDot2Jpg(path, batchFile); - } - } - } - - private CharSequence generate2jpg(final Root root) { - StringConcatenation _builder = new StringConcatenation(); - { - EList _systemInstances = root.getSystemInstances(); - for(final SystemInstance sys : _systemInstances) { - _builder.append("dot -Tjpg -o "); - String _name = sys.getName(); - _builder.append(_name, ""); - _builder.append("_instanceTree.jpg "); - String _name_1 = sys.getName(); - _builder.append(_name_1, ""); - _builder.append("_instanceTree.dot"); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - private CharSequence generate(final Root root, final SystemInstance sys) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("digraph "); - String _name = sys.getName(); - _builder.append(_name, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("rankdir=LR;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("node [shape=box];"); - _builder.newLine(); - _builder.append("\t"); - String _path = sys.getPath(); - String _pathName = this.roomExt.getPathName(_path); - _builder.append(_pathName, "\t"); - _builder.append(" [label=\""); - String _name_1 = sys.getName(); - _builder.append(_name_1, "\t"); - _builder.append("\\n("); - String _name_2 = sys.getName(); - _builder.append(_name_2, "\t"); - _builder.append(")\" style=filled color=red];"); - _builder.newLineIfNotEmpty(); - { - EList _instances = sys.getInstances(); - for(final SubSystemInstance ssi : _instances) { - _builder.append("\t"); - String _path_1 = ssi.getPath(); - String _pathName_1 = this.roomExt.getPathName(_path_1); - _builder.append(_pathName_1, "\t"); - _builder.append(" [label=\""); - String _name_3 = ssi.getName(); - _builder.append(_name_3, "\t"); - _builder.append("\\n("); - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - String _name_4 = _subSystemClass.getName(); - _builder.append(_name_4, "\t"); - _builder.append(")\" style=filled color=yellow];"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _path_2 = sys.getPath(); - String _pathName_2 = this.roomExt.getPathName(_path_2); - _builder.append(_pathName_2, "\t"); - _builder.append(" -> "); - String _path_3 = ssi.getPath(); - String _pathName_3 = this.roomExt.getPathName(_path_3); - _builder.append(_pathName_3, "\t"); - _builder.append("; "); - _builder.newLineIfNotEmpty(); - { - EList _instances_1 = ssi.getInstances(); - for(final AbstractInstance ai : _instances_1) { - _builder.append("\t"); - String _instance = this.instance(ai); - _builder.append(_instance, "\t"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.append("}"); - _builder.newLine(); - return _builder; - } - - private String instance(final AbstractInstance ai) { - String _xblockexpression = null; - { - EObject _eContainer = ai.eContainer(); - final StructureInstance parent = ((StructureInstance) _eContainer); - final ETMapUtil.MappedThread pthread = ETMapUtil.getMappedThread(ai); - String _xifexpression = null; - boolean _equals = Objects.equal(pthread, null); - if (_equals) { - _xifexpression = "?"; - } else { - PhysicalThread _thread = pthread.getThread(); - _xifexpression = _thread.getName(); - } - final String tname = _xifexpression; - final NodeRef node = ETMapUtil.getNodeRef(ai); - String _xifexpression_1 = null; - boolean _equals_1 = Objects.equal(node, null); - if (_equals_1) { - _xifexpression_1 = "?"; - } else { - _xifexpression_1 = node.getName(); - } - final String nname = _xifexpression_1; - String _xifexpression_2 = null; - if ((ai instanceof ActorInterfaceInstance)) { - _xifexpression_2 = "optional "; - } else { - _xifexpression_2 = ""; - } - final String optional = _xifexpression_2; - String _xifexpression_3 = null; - if ((ai instanceof ActorInstance)) { - ActorClass _actorClass = ((ActorInstance) ai).getActorClass(); - _xifexpression_3 = _actorClass.getName(); - } else { - String _xifexpression_4 = null; - if ((ai instanceof ActorInterfaceInstance)) { - ActorClass _actorClass_1 = ((ActorInterfaceInstance) ai).getActorClass(); - _xifexpression_4 = _actorClass_1.getName(); - } else { - _xifexpression_4 = "?"; - } - _xifexpression_3 = _xifexpression_4; - } - final String clsname = _xifexpression_3; - StringConcatenation _builder = new StringConcatenation(); - String _path = ai.getPath(); - String _pathName = this.roomExt.getPathName(_path); - _builder.append(_pathName, ""); - _builder.append(" [label=\""); - _builder.append(optional, ""); - String _name = ai.getName(); - _builder.append(_name, ""); - _builder.append("\\n("); - _builder.append(clsname, ""); - _builder.append(")\\n@"); - _builder.append(nname, ""); - _builder.append(":"); - _builder.append(tname, ""); - _builder.append("\""); - { - boolean _isEmpty = optional.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append(" color=blue style=dashed"); - } - } - _builder.append("];"); - _builder.newLineIfNotEmpty(); - String _path_1 = parent.getPath(); - String _pathName_1 = this.roomExt.getPathName(_path_1); - _builder.append(_pathName_1, ""); - _builder.append(" -> "); - String _path_2 = ai.getPath(); - String _pathName_2 = this.roomExt.getPathName(_path_2); - _builder.append(_pathName_2, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - { - if ((ai instanceof StructureInstance)) { - { - EList _instances = ((StructureInstance) ai).getInstances(); - for(final AbstractInstance sub_ai : _instances) { - String _instance = this.instance(sub_ai); - _builder.append(_instance, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - _xblockexpression = _builder.toString(); - } - return _xblockexpression; - } - - private void runDot2Jpg(final String path, final String bat) { - File wdir = new File(path); - try { - Runtime _runtime = Runtime.getRuntime(); - final Process p = _runtime.exec(("cmd /C " + bat), null, wdir); - int _waitFor = p.waitFor(); - String _plus = ((bat + " finished with ") + Integer.valueOf(_waitFor)); - this.logger.logInfo(_plus); - } catch (final Throwable _t) { - if (_t instanceof Exception) { - final Exception e = (Exception)_t; - e.printStackTrace(); - } else { - throw Exceptions.sneakyThrow(_t); - } - } - } -} diff --git a/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/MainGen.java b/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/MainGen.java deleted file mode 100644 index 06fabcb7d..000000000 --- a/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/MainGen.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.doc.gen; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.generator.doc.gen.DocGen; -import org.eclipse.etrice.generator.doc.gen.InstanceDiagramGen; -import org.eclipse.etrice.generator.generic.PrepareFileSystem; - -@Singleton -@SuppressWarnings("all") -public class MainGen { - @Inject - private InstanceDiagramGen instanceDiagramGen; - - @Inject - private PrepareFileSystem prepFS; - - @Inject - private DocGen docGen; - - public void doGenerate(final Resource resource) { - this.prepFS.prepareDocTargetPaths(resource); - EList _contents = resource.getContents(); - for (final EObject e : _contents) { - if ((e instanceof Root)) { - this.doGenerate(((Root) e)); - } - } - } - - private void doGenerate(final Root e) { - this.instanceDiagramGen.doGenerate(e); - this.docGen.doGenerate(e); - } -} diff --git a/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java b/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java deleted file mode 100644 index c11e78fd6..000000000 --- a/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java +++ /dev/null @@ -1,1765 +0,0 @@ -/** - * Copyright (c) 2014 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.fsm.generic; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem; -import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType; -import org.eclipse.etrice.core.fsm.fSM.GuardedTransition; -import org.eclipse.etrice.core.fsm.fSM.MessageFromIf; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.TrPoint; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.fSM.TransitionPoint; -import org.eclipse.etrice.core.fsm.fSM.TriggeredTransition; -import org.eclipse.etrice.core.fsm.util.FSMHelpers; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ActiveTrigger; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedModelComponent; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.TransitionChain; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.util.FsmGenUtil; -import org.eclipse.etrice.generator.fsm.base.CodegenHelpers; -import org.eclipse.etrice.generator.fsm.generic.FSMExtensions; -import org.eclipse.etrice.generator.fsm.generic.IDetailCodeTranslator; -import org.eclipse.etrice.generator.fsm.generic.IIfItemIdGenerator; -import org.eclipse.etrice.generator.fsm.generic.ILanguageExtensionBase; -import org.eclipse.etrice.generator.fsm.generic.IMessageIdGenerator; -import org.eclipse.etrice.generator.fsm.generic.TransitionChainGenerator; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.util.Pair; -import org.eclipse.xtext.util.Tuples; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -/** - * @author Henrik Rentz-Reichert - */ -@SuppressWarnings("all") -public abstract class AbstractStateMachineGenerator { - @Inject - @Extension - public FSMHelpers _fSMHelpers; - - @Inject - @Extension - public FsmGenUtil _fsmGenUtil; - - @Inject - @Extension - public CodegenHelpers _codegenHelpers; - - @Inject - @Extension - public FSMExtensions _fSMExtensions; - - @Inject - public ILanguageExtensionBase langExt; - - @Inject - public IMessageIdGenerator msgIdGen; - - @Inject - public IIfItemIdGenerator itemIdGen; - - @Inject - public TransitionChainGenerator transitionChainGenerator; - - @Inject - public IDetailCodeTranslator translator; - - /** - * generates trigger IDs. - * Inheritance (if available) is used for base class IDs. - * - * @param xpmc the {@link ExpandedModelComponent} - * @return the generated code - */ - public String genTriggerConstants(final ExpandedModelComponent xpmc) { - boolean _usesInheritance = this.langExt.usesInheritance(); - return this.genTriggerConstants(xpmc, _usesInheritance); - } - - /** - * generates trigger IDs. - * Inheritance (if available) is used for base class IDs. - * - * @param xpmc the {@link ExpandedModelComponent} - * @param omitBase use true if no base class trigger constants are needed - * - * @return the generated code - */ - public String genTriggerConstants(final ExpandedModelComponent xpmc, final boolean omitBase) { - List _xifexpression = null; - if (omitBase) { - ModelComponent _modelComponent = xpmc.getModelComponent(); - _xifexpression = this._fSMHelpers.getOwnMessagesFromInterfaces(_modelComponent); - } else { - ModelComponent _modelComponent_1 = xpmc.getModelComponent(); - _xifexpression = this._fSMHelpers.getAllMessagesFromInterfaces(_modelComponent_1); - } - final List triggers = _xifexpression; - final ArrayList> list = new ArrayList>(); - Pair _pair = Tuples.pair("POLLING", "0"); - list.add(_pair); - for (final MessageFromIf mif : triggers) { - AbstractInterfaceItem _from = mif.getFrom(); - boolean _isEventDriven = _from.isEventDriven(); - if (_isEventDriven) { - String _triggerCodeName = xpmc.getTriggerCodeName(mif); - AbstractInterfaceItem _from_1 = mif.getFrom(); - String _ifItemId = this.itemIdGen.getIfItemId(_from_1); - String _plus = (_ifItemId + " + EVT_SHIFT*"); - String _messageID = this.msgIdGen.getMessageID(mif); - String _plus_1 = (_plus + _messageID); - Pair _pair_1 = Tuples.pair(_triggerCodeName, _plus_1); - list.add(_pair_1); - } - } - return this.langExt.genEnumeration("triggers", list); - } - - /** - * generates state ID constants. - * Inheritance (if available) is used for base class IDs. - * - * @param xpmc the {@link ExpandedModelComponent} - * @return the generated code - */ - public String genStateIdConstants(final ExpandedModelComponent xpmc) { - boolean _usesInheritance = this.langExt.usesInheritance(); - return this.genStateIdConstants(xpmc, _usesInheritance); - } - - /** - * generates state ID constants. - * Inheritance (if available) is used for base class IDs. - * - * @param xpmc the {@link ExpandedModelComponent} - * @param omitBase use true if no base class state constants are needed - * - * @return the generated code - */ - public String genStateIdConstants(final ExpandedModelComponent xpmc, final boolean omitBase) { - final ModelComponent mc = xpmc.getModelComponent(); - int _xifexpression = (int) 0; - if (omitBase) { - _xifexpression = this._fSMExtensions.getNumberOfInheritedBaseStates(mc); - } else { - _xifexpression = 0; - } - int offset = (2 + _xifexpression); - List _xifexpression_1 = null; - if (omitBase) { - StateGraph _stateMachine = mc.getStateMachine(); - _xifexpression_1 = this._fSMHelpers.getBaseStateList(_stateMachine); - } else { - StateGraph _stateMachine_1 = xpmc.getStateMachine(); - _xifexpression_1 = this._fSMHelpers.getBaseStateList(_stateMachine_1); - } - List baseStates = _xifexpression_1; - List _leafStatesLast = this._fSMExtensions.getLeafStatesLast(baseStates); - baseStates = _leafStatesLast; - ArrayList> list = new ArrayList>(); - if ((!omitBase)) { - Pair _pair = Tuples.pair("NO_STATE", "0"); - list.add(_pair); - Pair _pair_1 = Tuples.pair("STATE_TOP", "1"); - list.add(_pair_1); - } - for (final State state : baseStates) { - { - String _genStateId = this._codegenHelpers.getGenStateId(state); - String _string = Integer.valueOf(offset).toString(); - Pair _pair_2 = Tuples.pair(_genStateId, _string); - list.add(_pair_2); - offset = (offset + 1); - } - } - String _string = Integer.valueOf(offset).toString(); - Pair _pair_2 = Tuples.pair("STATE_MAX", _string); - list.add(_pair_2); - return this.langExt.genEnumeration("state_ids", list); - } - - /** - * generates transition chain ID constants. - * Inheritance can't be used used for base class IDs because of corner cases - * where base class and derived class chain IDs deviate (see bug 501354). - * - * @param xpmc the {@link ExpandedModelComponent} - * - * @return the generated code - */ - public String genTransitionChainConstants(final ExpandedModelComponent xpmc) { - return this.genTransitionChainConstants(xpmc, false); - } - - /** - * generates transition chain ID constants. - * Inheritance can't be used used for base class IDs because of corner cases - * where base class and derived class chain IDs deviate. - * - * @param xpmc the {@link ExpandedModelComponent} - * @param omitBase use true if no base class transition chain constants are needed - * - * @return the generated code - */ - public String genTransitionChainConstants(final ExpandedModelComponent xpmc, final boolean omitBase) { - EList _xifexpression = null; - if (omitBase) { - _xifexpression = xpmc.getOwnTransitionChains(); - } else { - _xifexpression = xpmc.getTransitionChains(); - } - EList chains = _xifexpression; - int _xifexpression_1 = (int) 0; - if (omitBase) { - EList _transitionChains = xpmc.getTransitionChains(); - int _size = _transitionChains.size(); - int _size_1 = chains.size(); - _xifexpression_1 = (_size - _size_1); - } else { - _xifexpression_1 = 0; - } - int offset = _xifexpression_1; - ArrayList> list = new ArrayList>(); - for (final TransitionChain chain : chains) { - { - offset = (offset + 1); - String _genChainId = this._codegenHelpers.getGenChainId(chain); - String _string = Integer.valueOf(offset).toString(); - Pair _pair = Tuples.pair(_genChainId, _string); - list.add(_pair); - } - } - return this.langExt.genEnumeration("ChainIDs", list); - } - - /** - * generates entry and exit code for states - * - * @param xpmc the {@link ExpandedModelComponent} - * @param generateImplementation if true the implementation is generated, else the declaration - * - * @return the generated code - */ - public String genEntryAndExitCodes(final ExpandedModelComponent xpmc, final boolean generateImplementation) { - boolean _usesInheritance = this.langExt.usesInheritance(); - return this.genEntryAndExitCodes(xpmc, generateImplementation, _usesInheritance); - } - - /** - * generates entry and exit code for states - * - * @param xpmc the {@link ExpandedModelComponent} - * @param generateImplementation if true the implementation is generated, else the declaration - * @param omitBase use true if no base class entry and exit codes are needed - * - * @return the generated code - */ - public String genEntryAndExitCodes(final ExpandedModelComponent xpmc, final boolean generateImplementation, final boolean omitBase) { - StringConcatenation _builder = new StringConcatenation(); - { - StateGraph _stateMachine = xpmc.getStateMachine(); - List _stateList = this._fSMHelpers.getStateList(_stateMachine); - for(final State state : _stateList) { - { - if (((!omitBase) || xpmc.isOwnObject(state))) { - String _genActionCodeMethods = this.genActionCodeMethods(xpmc, state, generateImplementation); - _builder.append(_genActionCodeMethods, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - return _builder.toString(); - } - - /** - * generates transition action codes - * - * @param xpmc the {@link ExpandedModelComponent} - * @param generateImplementation if true the implementation is generated, else the declaration - * - * @return the generated code - */ - public String genActionCodes(final ExpandedModelComponent xpmc, final boolean generateImplementation) { - boolean _usesInheritance = this.langExt.usesInheritance(); - return this.genActionCodes(xpmc, generateImplementation, _usesInheritance); - } - - /** - * generates transition action codes - * - * @param xpmc the {@link ExpandedModelComponent} - * @param generateImplementation if true the implementation is generated, else the declaration - * @param omitBase use true if no base class action codes are needed - * - * @return the generated code - */ - public String genActionCodes(final ExpandedModelComponent xpmc, final boolean generateImplementation, final boolean omitBase) { - StringConcatenation _builder = new StringConcatenation(); - { - StateGraph _stateMachine = xpmc.getStateMachine(); - List _allTransitionsRecursive = this._fSMHelpers.getAllTransitionsRecursive(_stateMachine); - for(final Transition tr : _allTransitionsRecursive) { - { - if ((((!omitBase) || xpmc.isOwnObject(tr)) && this._fSMHelpers.hasDetailCode(tr.getAction()))) { - String _genActionCodeMethod = this.genActionCodeMethod(xpmc, tr, generateImplementation); - _builder.append(_genActionCodeMethod, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - return _builder.toString(); - } - - public String genStateSwitchMethods(final ExpandedModelComponent xpmc, final boolean generateImplementation) { - String _xblockexpression = null; - { - final ModelComponent mc = xpmc.getModelComponent(); - ComponentCommunicationType _commType = mc.getCommType(); - final boolean async = Objects.equal(_commType, ComponentCommunicationType.ASYNCHRONOUS); - ComponentCommunicationType _commType_1 = mc.getCommType(); - final boolean eventDriven = Objects.equal(_commType_1, ComponentCommunicationType.EVENT_DRIVEN); - String _interfaceItemType = this.interfaceItemType(); - String _pointerLiteral = this.langExt.pointerLiteral(); - final String ifItemPtr = (_interfaceItemType + _pointerLiteral); - final boolean handleEvents = (async || eventDriven); - String _xifexpression = null; - boolean _usesInheritance = this.langExt.usesInheritance(); - if (_usesInheritance) { - String _className = this.getClassName(mc); - String _scopeSeparator = this.langExt.scopeSeparator(); - _xifexpression = (_className + _scopeSeparator); - } else { - _xifexpression = ""; - } - final String chainIDScope = _xifexpression; - String _className_1 = this.getClassName(mc); - final String opScope = this.langExt.operationScope(_className_1, (!generateImplementation)); - String _xifexpression_1 = null; - boolean _usesInheritance_1 = this.langExt.usesInheritance(); - if (_usesInheritance_1) { - _xifexpression_1 = opScope; - } else { - _xifexpression_1 = ""; - } - final String opScopePriv = _xifexpression_1; - String _xifexpression_2 = null; - boolean _usesInheritance_2 = this.langExt.usesInheritance(); - if (_usesInheritance_2) { - _xifexpression_2 = this.langExt.accessLevelPublic(); - } else { - _xifexpression_2 = this.langExt.accessLevelPrivate(); - } - final String publicIf = _xifexpression_2; - final String privAccess = this.langExt.accessLevelPrivate(); - String _className_2 = this.getClassName(mc); - final String selfPtr = this.langExt.selfPointer(_className_2, true); - String _className_3 = this.getClassName(mc); - final String selfOnly = this.langExt.selfPointer(_className_3, false); - String _xifexpression_3 = null; - boolean _usesInheritance_3 = this.langExt.usesInheritance(); - if (_usesInheritance_3) { - String _xifexpression_4 = null; - boolean _usesPointers = this.langExt.usesPointers(); - if (_usesPointers) { - _xifexpression_4 = "->getLocalId()"; - } else { - _xifexpression_4 = ".getLocalId()"; - } - _xifexpression_3 = _xifexpression_4; - } else { - _xifexpression_3 = "->localId"; - } - final String getLocalId = _xifexpression_3; - String _xifexpression_5 = null; - boolean _usesPointers_1 = this.langExt.usesPointers(); - if (_usesPointers_1) { - _xifexpression_5 = ("const " + ifItemPtr); - } else { - _xifexpression_5 = ifItemPtr; - } - final String constIfItemPtr = _xifexpression_5; - final boolean usesHdlr = this.usesHandlerTrPoints(xpmc); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* calls exit codes while exiting from the current state to one of its"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* parent states while remembering the history"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* @param current__et - the current state"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* @param to - the final parent state"); - _builder.newLine(); - { - if (usesHdlr) { - _builder.append("* @param handler__et - entry and exit codes are called only if not handler (for handler TransitionPoints)"); - _builder.newLine(); - } - } - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - { - if (generateImplementation) { - _builder.append(privAccess, ""); - _builder.append("void "); - _builder.append(opScopePriv, ""); - _builder.append("exitTo("); - _builder.append(selfPtr, ""); - String _stateType = this.stateType(); - _builder.append(_stateType, ""); - _builder.append(" current__et, "); - String _stateType_1 = this.stateType(); - _builder.append(_stateType_1, ""); - _builder.append(" to"); - { - if (usesHdlr) { - _builder.append(", "); - String _boolType = this.boolType(); - _builder.append(_boolType, ""); - _builder.append(" handler__et"); - } - } - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("while (current__et!=to) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("switch (current__et) {"); - _builder.newLine(); - { - StateGraph _stateMachine = xpmc.getStateMachine(); - List _baseStateList = this._fSMHelpers.getBaseStateList(_stateMachine); - for(final State state : _baseStateList) { - _builder.append("\t\t\t"); - _builder.append("case "); - String _genStateId = this._codegenHelpers.getGenStateId(state); - _builder.append(_genStateId, "\t\t\t"); - _builder.append(":"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("\t"); - { - boolean _hasExitCode = this._fSMHelpers.hasExitCode(state, true); - if (_hasExitCode) { - { - if (usesHdlr) { - _builder.append("if (!handler__et) "); - } - } - String _exitCodeOperationName = this._codegenHelpers.getExitCodeOperationName(state); - _builder.append(_exitCodeOperationName, "\t\t\t\t"); - _builder.append("("); - String _selfPointer = this.langExt.selfPointer(false); - _builder.append(_selfPointer, "\t\t\t\t"); - _builder.append(");"); - } - } - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("\t"); - String _parentStateId = this._codegenHelpers.getParentStateId(state); - String _genStateId_1 = this._codegenHelpers.getGenStateId(state); - String _setHistory = this.setHistory(_parentStateId, _genStateId_1); - _builder.append(_setHistory, "\t\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("current__et = "); - String _parentStateId_1 = this._codegenHelpers.getParentStateId(state); - _builder.append(_parentStateId_1, "\t\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("break;"); - _builder.newLine(); - } - } - _builder.append("\t\t\t"); - _builder.append("default:"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("/* should not occur */"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("break;"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } else { - _builder.append("void exitTo("); - _builder.append(selfPtr, ""); - String _stateType_2 = this.stateType(); - _builder.append(_stateType_2, ""); - _builder.append(" current__et, "); - String _stateType_3 = this.stateType(); - _builder.append(_stateType_3, ""); - _builder.append(" to"); - { - if (usesHdlr) { - _builder.append(", "); - String _boolType_1 = this.boolType(); - _builder.append(_boolType_1, ""); - _builder.append(" handler__et"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* calls action, entry and exit codes along a transition chain. The generic data are cast to typed data"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* matching the trigger of this chain. The ID of the final state is returned"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* @param chain__et - the chain ID"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* @param generic_data__et - the generic data pointer"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* @return the +/- ID of the final state either with a positive sign, that indicates to execute the state\'s entry code, or a negative sign vice versa"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - { - if (generateImplementation) { - _builder.append(privAccess, ""); - String _stateType_4 = this.stateType(); - _builder.append(_stateType_4, ""); - _builder.append(" "); - _builder.append(opScopePriv, ""); - _builder.append("executeTransitionChain("); - _builder.append(selfPtr, ""); - _builder.append("int chain__et"); - { - if (handleEvents) { - _builder.append(", "); - _builder.append(constIfItemPtr, ""); - _builder.append(" ifitem, "); - String _voidPointer = this.langExt.voidPointer(); - _builder.append(_voidPointer, ""); - _builder.append(" generic_data__et"); - } - } - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("switch (chain__et) {"); - _builder.newLine(); - _builder.append("\t\t"); - EList allchains = xpmc.getTransitionChains(); - _builder.newLineIfNotEmpty(); - { - for(final TransitionChain tc : allchains) { - _builder.append("\t\t"); - _builder.append("case "); - _builder.append(chainIDScope, "\t\t"); - String _genChainId = this._codegenHelpers.getGenChainId(tc); - _builder.append(_genChainId, "\t\t"); - _builder.append(":"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - String _generateExecuteChain = this.transitionChainGenerator.generateExecuteChain(xpmc, tc); - _builder.append(_generateExecuteChain, "\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("\t\t\t"); - _builder.append("default:"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("/* should not occur */"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("break;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("return NO_STATE;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } else { - String _stateType_5 = this.stateType(); - _builder.append(_stateType_5, ""); - _builder.append(" executeTransitionChain("); - _builder.append(selfPtr, ""); - _builder.append("int chain__et"); - { - if (handleEvents) { - _builder.append(", "); - _builder.append(constIfItemPtr, ""); - _builder.append(" ifitem, "); - String _voidPointer_1 = this.langExt.voidPointer(); - _builder.append(_voidPointer_1, ""); - _builder.append(" generic_data__et"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* calls entry codes while entering a state\'s history. The ID of the final leaf state is returned"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* @param state__et - the state which is entered"); - _builder.newLine(); - { - if (usesHdlr) { - _builder.append("* @param handler__et - entry code is executed if not handler"); - _builder.newLine(); - } - } - _builder.append(" "); - _builder.append("* @return - the ID of the final leaf state"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - { - if (generateImplementation) { - _builder.append(privAccess, ""); - String _stateType_6 = this.stateType(); - _builder.append(_stateType_6, ""); - _builder.append(" "); - _builder.append(opScopePriv, ""); - _builder.append("enterHistory("); - _builder.append(selfPtr, ""); - String _stateType_7 = this.stateType(); - _builder.append(_stateType_7, ""); - _builder.append(" state__et"); - { - if (usesHdlr) { - _builder.append(", "); - String _boolType_2 = this.boolType(); - _builder.append(_boolType_2, ""); - _builder.append(" handler__et"); - } - } - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - StateGraph _stateMachine_1 = xpmc.getStateMachine(); - final List baseStateList = this._fSMHelpers.getBaseStateList(_stateMachine_1); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - final Function1 _function = (State s) -> { - return Boolean.valueOf(this._fSMHelpers.hasEntryCode(s, true)); - }; - Iterable _filter = IterableExtensions.filter(baseStateList, _function); - boolean _isEmpty = IterableExtensions.isEmpty(_filter); - final boolean needsSkipVar = (!_isEmpty); - _builder.newLineIfNotEmpty(); - { - if (needsSkipVar) { - _builder.append("\t"); - String _boolType_3 = this.boolType(); - _builder.append(_boolType_3, "\t"); - _builder.append(" skip_entry__et = "); - String _booleanConstant = this.langExt.booleanConstant(false); - _builder.append(_booleanConstant, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("if (state__et >= STATE_MAX) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("state__et = "); - { - boolean _usesInheritance_4 = this.langExt.usesInheritance(); - boolean _not = (!_usesInheritance_4); - if (_not) { - _builder.append("("); - String _stateType_8 = this.stateType(); - _builder.append(_stateType_8, "\t\t"); - _builder.append(")"); - } - } - _builder.append(" (state__et - STATE_MAX);"); - _builder.newLineIfNotEmpty(); - { - if (needsSkipVar) { - _builder.append("\t\t"); - _builder.append("skip_entry__et = "); - String _booleanConstant_1 = this.langExt.booleanConstant(true); - _builder.append(_booleanConstant_1, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("while ("); - String _booleanConstant_2 = this.langExt.booleanConstant(true); - _builder.append(_booleanConstant_2, "\t"); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("switch (state__et) {"); - _builder.newLine(); - { - for(final State state_1 : baseStateList) { - _builder.append("\t\t\t"); - _builder.append("case "); - String _genStateId_2 = this._codegenHelpers.getGenStateId(state_1); - _builder.append(_genStateId_2, "\t\t\t"); - _builder.append(":"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("\t"); - { - boolean _hasEntryCode = this._fSMHelpers.hasEntryCode(state_1, true); - if (_hasEntryCode) { - _builder.append("if (!(skip_entry__et"); - { - if (usesHdlr) { - _builder.append(" || handler__et"); - } - } - _builder.append(")) "); - String _entryCodeOperationName = this._codegenHelpers.getEntryCodeOperationName(state_1); - _builder.append(_entryCodeOperationName, "\t\t\t\t"); - _builder.append("("); - String _selfPointer_1 = this.langExt.selfPointer(false); - _builder.append(_selfPointer_1, "\t\t\t\t"); - _builder.append(");"); - } - } - _builder.newLineIfNotEmpty(); - { - boolean _isLeaf = this._fSMHelpers.isLeaf(state_1); - if (_isLeaf) { - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("/* in leaf state: return state id */"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("return "); - String _genStateId_3 = this._codegenHelpers.getGenStateId(state_1); - _builder.append(_genStateId_3, "\t\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("/* state has a sub graph */"); - _builder.newLine(); - { - StateGraph _subgraph = state_1.getSubgraph(); - boolean _hasInitTransition = this._fSMHelpers.hasInitTransition(_subgraph); - if (_hasInitTransition) { - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("/* with init transition */"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("if ("); - String _genStateId_4 = this._codegenHelpers.getGenStateId(state_1); - String _history = this.getHistory(_genStateId_4); - _builder.append(_history, "\t\t\t\t"); - _builder.append("==NO_STATE) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("\t"); - StateGraph _subgraph_1 = state_1.getSubgraph(); - Transition sub_initt = this._fSMHelpers.getInitTransition(_subgraph_1); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("state__et = executeTransitionChain("); - String _selfPointer_2 = this.langExt.selfPointer(true); - _builder.append(_selfPointer_2, "\t\t\t\t\t"); - _builder.append(chainIDScope, "\t\t\t\t\t"); - TransitionChain _chain = xpmc.getChain(sub_initt); - String _genChainId_1 = this._codegenHelpers.getGenChainId(_chain); - _builder.append(_genChainId_1, "\t\t\t\t\t"); - { - if (handleEvents) { - _builder.append(", "); - String _nullPointer = this.langExt.nullPointer(); - _builder.append(_nullPointer, "\t\t\t\t\t"); - _builder.append(", "); - String _nullPointer_1 = this.langExt.nullPointer(); - _builder.append(_nullPointer_1, "\t\t\t\t\t"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("else {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("state__et = "); - String _genStateId_5 = this._codegenHelpers.getGenStateId(state_1); - String _history_1 = this.getHistory(_genStateId_5); - _builder.append(_history_1, "\t\t\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } else { - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("/* without init transition */"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("state__et = "); - String _genStateId_6 = this._codegenHelpers.getGenStateId(state_1); - String _history_2 = this.getHistory(_genStateId_6); - _builder.append(_history_2, "\t\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("break;"); - _builder.newLine(); - } - } - } - } - _builder.append("\t\t\t"); - _builder.append("case STATE_TOP:"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("state__et = "); - String _history_3 = this.getHistory("STATE_TOP"); - _builder.append(_history_3, "\t\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t\t"); - _builder.append("break;"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("default:"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("/* should not occur */"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("break;"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - { - if (needsSkipVar) { - _builder.append("\t\t"); - _builder.append("skip_entry__et = "); - String _booleanConstant_3 = this.langExt.booleanConstant(false); - _builder.append(_booleanConstant_3, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - String _unreachableReturn = this.unreachableReturn(); - _builder.append(_unreachableReturn, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } else { - String _stateType_9 = this.stateType(); - _builder.append(_stateType_9, ""); - _builder.append(" enterHistory("); - _builder.append(selfPtr, ""); - String _stateType_10 = this.stateType(); - _builder.append(_stateType_10, ""); - _builder.append(" state__et"); - { - if (usesHdlr) { - _builder.append(", "); - String _boolType_4 = this.boolType(); - _builder.append(_boolType_4, ""); - _builder.append(" handler__et"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - if (generateImplementation) { - _builder.append(publicIf, ""); - _builder.append("void "); - _builder.append(opScope, ""); - _builder.append("executeInitTransition("); - _builder.append(selfOnly, ""); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - StateGraph _stateMachine_2 = xpmc.getStateMachine(); - Transition initt = this._fSMHelpers.getInitTransition(_stateMachine_2); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("int chain__et = "); - _builder.append(chainIDScope, "\t"); - TransitionChain _chain_1 = xpmc.getChain(initt); - String _genChainId_2 = this._codegenHelpers.getGenChainId(_chain_1); - _builder.append(_genChainId_2, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _stateType_11 = this.stateType(); - _builder.append(_stateType_11, "\t"); - _builder.append(" next__et = "); - _builder.append(opScopePriv, "\t"); - _builder.append("executeTransitionChain("); - String _selfPointer_3 = this.langExt.selfPointer(true); - _builder.append(_selfPointer_3, "\t"); - _builder.append("chain__et"); - { - if (handleEvents) { - _builder.append(", "); - String _nullPointer_2 = this.langExt.nullPointer(); - _builder.append(_nullPointer_2, "\t"); - _builder.append(", "); - String _nullPointer_3 = this.langExt.nullPointer(); - _builder.append(_nullPointer_3, "\t"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("next__et = "); - _builder.append(opScopePriv, "\t"); - _builder.append("enterHistory("); - String _selfPointer_4 = this.langExt.selfPointer(true); - _builder.append(_selfPointer_4, "\t"); - _builder.append("next__et"); - { - if (usesHdlr) { - _builder.append(", "); - String _booleanConstant_4 = this.langExt.booleanConstant(false); - _builder.append(_booleanConstant_4, "\t"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("setState("); - String _selfPointer_5 = this.langExt.selfPointer(true); - _builder.append(_selfPointer_5, "\t"); - _builder.append("next__et);"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } else { - _builder.append("void "); - _builder.append(opScope, ""); - _builder.append("executeInitTransition("); - _builder.append(selfOnly, ""); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("/* receiveEvent contains the main implementation of the FSM */"); - _builder.newLine(); - { - if (generateImplementation) { - _builder.append(publicIf, ""); - _builder.append("void "); - _builder.append(opScope, ""); - _builder.append("receiveEventInternal("); - String _className_4 = this.getClassName(mc); - String _selfPointer_6 = this.langExt.selfPointer(_className_4, handleEvents); - _builder.append(_selfPointer_6, ""); - { - if (handleEvents) { - _builder.append(ifItemPtr, ""); - _builder.append(" ifitem, int localId, int evt, "); - String _voidPointer_2 = this.langExt.voidPointer(); - _builder.append(_voidPointer_2, ""); - _builder.append(" generic_data__et"); - } - } - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - { - if (async) { - _builder.append("\t"); - _builder.append("int trigger__et = (ifitem=="); - String _nullPointer_4 = this.langExt.nullPointer(); - _builder.append(_nullPointer_4, "\t"); - _builder.append(")? POLLING : localId + EVT_SHIFT*evt;"); - _builder.newLineIfNotEmpty(); - } else { - if (eventDriven) { - _builder.append("\t"); - _builder.append("int trigger__et = localId + EVT_SHIFT*evt;"); - _builder.newLine(); - } - } - } - _builder.append("\t"); - _builder.append("int chain__et = NOT_CAUGHT;"); - _builder.newLine(); - _builder.append("\t"); - String _stateType_12 = this.stateType(); - _builder.append(_stateType_12, "\t"); - _builder.append(" catching_state__et = NO_STATE;"); - _builder.newLineIfNotEmpty(); - { - if (usesHdlr) { - _builder.append("\t"); - String _boolType_5 = this.boolType(); - _builder.append(_boolType_5, "\t"); - _builder.append(" is_handler__et = "); - String _booleanConstant_5 = this.langExt.booleanConstant(false); - _builder.append(_booleanConstant_5, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - { - if ((async || eventDriven)) { - _builder.append("\t"); - CharSequence _markVariableUsed = this.markVariableUsed("trigger__et"); - _builder.append(_markVariableUsed, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - if (handleEvents) { - _builder.append("\t"); - _builder.append("if (!handleSystemEvent(ifitem, evt, generic_data__et)) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - CharSequence _genStateSwitch = this.genStateSwitch(xpmc, usesHdlr); - _builder.append(_genStateSwitch, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } else { - _builder.append("\t"); - CharSequence _genStateSwitch_1 = this.genStateSwitch(xpmc, usesHdlr); - _builder.append(_genStateSwitch_1, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("if (chain__et != NOT_CAUGHT) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(opScopePriv, "\t\t"); - _builder.append("exitTo("); - String _selfPointer_7 = this.langExt.selfPointer(true); - _builder.append(_selfPointer_7, "\t\t"); - _builder.append("getState("); - String _selfPointer_8 = this.langExt.selfPointer(false); - _builder.append(_selfPointer_8, "\t\t"); - _builder.append("), catching_state__et"); - { - if (usesHdlr) { - _builder.append(", is_handler__et"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t\t\t"); - String _stateType_13 = this.stateType(); - _builder.append(_stateType_13, "\t\t\t"); - _builder.append(" next__et = "); - _builder.append(opScopePriv, "\t\t\t"); - _builder.append("executeTransitionChain("); - String _selfPointer_9 = this.langExt.selfPointer(true); - _builder.append(_selfPointer_9, "\t\t\t"); - _builder.append("chain__et"); - { - if (handleEvents) { - _builder.append(", ifitem, generic_data__et"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("next__et = "); - _builder.append(opScopePriv, "\t\t\t"); - _builder.append("enterHistory("); - String _selfPointer_10 = this.langExt.selfPointer(true); - _builder.append(_selfPointer_10, "\t\t\t"); - _builder.append("next__et"); - { - if (usesHdlr) { - _builder.append(", is_handler__et"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("setState("); - String _selfPointer_11 = this.langExt.selfPointer(true); - _builder.append(_selfPointer_11, "\t\t\t"); - _builder.append("next__et);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - CharSequence _finalAction = this.finalAction(); - _builder.append(_finalAction, "\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } else { - _builder.append("void "); - _builder.append(opScope, ""); - _builder.append("receiveEventInternal("); - String _className_5 = this.getClassName(mc); - String _selfPointer_12 = this.langExt.selfPointer(_className_5, handleEvents); - _builder.append(_selfPointer_12, ""); - { - if (handleEvents) { - _builder.append(ifItemPtr, ""); - _builder.append(" ifitem, int localId, int evt, "); - String _voidPointer_3 = this.langExt.voidPointer(); - _builder.append(_voidPointer_3, ""); - _builder.append(" generic_data__et"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - { - if (handleEvents) { - { - if (generateImplementation) { - _builder.append(publicIf, ""); - _builder.append("void "); - _builder.append(opScope, ""); - _builder.append("receiveEvent("); - String _className_6 = this.getClassName(mc); - String _selfPointer_13 = this.langExt.selfPointer(_className_6, true); - _builder.append(_selfPointer_13, ""); - _builder.append(ifItemPtr, ""); - _builder.append(" ifitem, int evt, "); - String _voidPointer_4 = this.langExt.voidPointer(); - _builder.append(_voidPointer_4, ""); - _builder.append(" generic_data__et) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("int localId = (ifitem=="); - String _nullPointer_5 = this.langExt.nullPointer(); - _builder.append(_nullPointer_5, "\t"); - _builder.append(")? 0 : ifitem"); - _builder.append(getLocalId, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(opScope, "\t"); - _builder.append("receiveEventInternal("); - String _selfPointer_14 = this.langExt.selfPointer(true); - _builder.append(_selfPointer_14, "\t"); - _builder.append("ifitem, localId, evt, generic_data__et);"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } else { - _builder.append("void "); - _builder.append(opScope, ""); - _builder.append("receiveEvent("); - String _selfPointer_15 = this.langExt.selfPointer(true); - _builder.append(_selfPointer_15, ""); - _builder.append(ifItemPtr, ""); - _builder.append(" ifitem, int evt, "); - String _voidPointer_5 = this.langExt.voidPointer(); - _builder.append(_voidPointer_5, ""); - _builder.append(" generic_data__et);"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _xblockexpression = _builder.toString(); - } - return _xblockexpression; - } - - /** - * generate the do code calls for a given state - * - * @param state the {@link State} - * @return the generated code - */ - public String genDoCodes(final State state) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _hasDoCode = this._fSMHelpers.hasDoCode(state, true); - if (_hasDoCode) { - String _doCodeOperationName = this._codegenHelpers.getDoCodeOperationName(state); - _builder.append(_doCodeOperationName, ""); - _builder.append("("); - String _selfPointer = this.langExt.selfPointer(false); - _builder.append(_selfPointer, ""); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - { - EObject _eContainer = state.eContainer(); - EObject _eContainer_1 = _eContainer.eContainer(); - if ((_eContainer_1 instanceof State)) { - EObject _eContainer_2 = state.eContainer(); - EObject _eContainer_3 = _eContainer_2.eContainer(); - String _genDoCodes = this.genDoCodes(((State) _eContainer_3)); - _builder.append(_genDoCodes, ""); - _builder.newLineIfNotEmpty(); - } - } - return _builder.toString(); - } - - /** - * helper method which generates the state switch. - * Asynchronous, data driven and event driven state machines are distinguished - * - * @param xpmc the {@link ExpandedModelComponent} - * @param usesHdlr if the state machine uses no handler {@link TransitionPoint}s - * at all then unused variables can be avoided by passing true - * @return the generated code - */ - public CharSequence genStateSwitch(final ExpandedModelComponent xpmc, final boolean usesHdlr) { - CharSequence _xblockexpression = null; - { - ModelComponent _modelComponent = xpmc.getModelComponent(); - ComponentCommunicationType _commType = _modelComponent.getCommType(); - boolean async = Objects.equal(_commType, ComponentCommunicationType.ASYNCHRONOUS); - ModelComponent _modelComponent_1 = xpmc.getModelComponent(); - ComponentCommunicationType _commType_1 = _modelComponent_1.getCommType(); - boolean eventDriven = Objects.equal(_commType_1, ComponentCommunicationType.EVENT_DRIVEN); - ModelComponent _modelComponent_2 = xpmc.getModelComponent(); - ComponentCommunicationType _commType_2 = _modelComponent_2.getCommType(); - boolean dataDriven = Objects.equal(_commType_2, ComponentCommunicationType.DATA_DRIVEN); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("switch (getState("); - String _selfPointer = this.langExt.selfPointer(false); - _builder.append(_selfPointer, ""); - _builder.append(")) {"); - _builder.newLineIfNotEmpty(); - { - StateGraph _stateMachine = xpmc.getStateMachine(); - List _leafStateList = this._fSMHelpers.getLeafStateList(_stateMachine); - for(final State state : _leafStateList) { - _builder.append(" "); - _builder.append("case "); - String _genStateId = this._codegenHelpers.getGenStateId(state); - _builder.append(_genStateId, " "); - _builder.append(":"); - _builder.newLineIfNotEmpty(); - { - if (async) { - _builder.append(" "); - _builder.append(" "); - EList atlist = xpmc.getActiveTriggers(state); - _builder.newLineIfNotEmpty(); - { - boolean _isEmpty = atlist.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _builder.append(" "); - _builder.append(" "); - _builder.append("switch(trigger__et) {"); - _builder.newLine(); - _builder.append(" "); - _builder.append(" "); - _builder.append(" "); - _builder.append("case POLLING:"); - _builder.newLine(); - _builder.append(" "); - _builder.append(" "); - _builder.append(" "); - CharSequence _genDataDrivenTriggers = this.genDataDrivenTriggers(xpmc, state, usesHdlr); - _builder.append(_genDataDrivenTriggers, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append(" "); - _builder.append(" "); - _builder.append("break;"); - _builder.newLine(); - _builder.append(" "); - _builder.append(" "); - _builder.append(" "); - CharSequence _genEventDrivenTriggers = this.genEventDrivenTriggers(xpmc, state, atlist, usesHdlr); - _builder.append(_genEventDrivenTriggers, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append(" "); - _builder.append("}"); - _builder.newLine(); - } else { - _builder.append(" "); - _builder.append(" "); - CharSequence _genDataDrivenTriggers_1 = this.genDataDrivenTriggers(xpmc, state, usesHdlr); - _builder.append(_genDataDrivenTriggers_1, " "); - _builder.newLineIfNotEmpty(); - } - } - } else { - if (dataDriven) { - _builder.append(" "); - _builder.append(" "); - CharSequence _genDataDrivenTriggers_2 = this.genDataDrivenTriggers(xpmc, state, usesHdlr); - _builder.append(_genDataDrivenTriggers_2, " "); - _builder.newLineIfNotEmpty(); - } else { - if (eventDriven) { - _builder.append(" "); - _builder.append(" "); - EList atlist_1 = xpmc.getActiveTriggers(state); - _builder.newLineIfNotEmpty(); - { - boolean _isEmpty_1 = atlist_1.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - _builder.append(" "); - _builder.append(" "); - _builder.append("switch(trigger__et) {"); - _builder.newLine(); - _builder.append(" "); - _builder.append(" "); - _builder.append(" "); - CharSequence _genEventDrivenTriggers_1 = this.genEventDrivenTriggers(xpmc, state, atlist_1, usesHdlr); - _builder.append(_genEventDrivenTriggers_1, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append(" "); - _builder.append("}"); - _builder.newLine(); - } - } - } - } - } - } - _builder.append(" "); - _builder.append(" "); - _builder.append("break;"); - _builder.newLine(); - } - } - _builder.append(" "); - _builder.append("default:"); - _builder.newLine(); - _builder.append(" "); - _builder.append("/* should not occur */"); - _builder.newLine(); - _builder.append(" "); - _builder.append("break;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - /** - * helper method which generates the data driven triggers - * - * @param xpmc the {@link ExpandedModelComponent} - * @param state the {@link State} for which the trigger if-else switch should be generated - * @param usesHdlr if the state machine uses no handler {@link TransitionPoints} - * at all then unused variables can be avoided by passing true - * @return the generated code - */ - public CharSequence genDataDrivenTriggers(final ExpandedModelComponent xpmc, final State state, final boolean usesHdlr) { - CharSequence _xblockexpression = null; - { - String _xifexpression = null; - boolean _usesInheritance = this.langExt.usesInheritance(); - if (_usesInheritance) { - String _className = this.getClassName(xpmc); - String _scopeSeparator = this.langExt.scopeSeparator(); - _xifexpression = (_className + _scopeSeparator); - } else { - _xifexpression = ""; - } - final String chainIDScope = _xifexpression; - StringConcatenation _builder = new StringConcatenation(); - String _genDoCodes = this.genDoCodes(state); - _builder.append(_genDoCodes, ""); - _builder.newLineIfNotEmpty(); - List _outgoingTransitionsHierarchical = this._fSMExtensions.getOutgoingTransitionsHierarchical(xpmc, state); - final Function1 _function = (Transition t) -> { - return Boolean.valueOf((t instanceof GuardedTransition)); - }; - Iterable transitions = IterableExtensions.filter(_outgoingTransitionsHierarchical, _function); - _builder.newLineIfNotEmpty(); - { - for(final Transition tr : transitions) { - _builder.append("if ("); - String _guard = this.guard(((GuardedTransition) tr), "", xpmc); - _builder.append(_guard, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - _builder.append("{"); - _builder.newLine(); - _builder.append(" "); - TransitionChain chain = xpmc.getChain(tr); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("chain__et = "); - _builder.append(chainIDScope, " "); - String _genChainId = this._codegenHelpers.getGenChainId(chain); - _builder.append(_genChainId, " "); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("catching_state__et = "); - State _stateContext = chain.getStateContext(); - String _genStateId = this._codegenHelpers.getGenStateId(_stateContext); - _builder.append(_genStateId, " "); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - { - if ((chain.isHandler() && usesHdlr)) { - _builder.append(" "); - _builder.append("is_handler__et = TRUE;"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - { - Transition _last = IterableExtensions.last(transitions); - boolean _notEquals = (!Objects.equal(tr, _last)); - if (_notEquals) { - _builder.append("else"); - _builder.newLine(); - } - } - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - /** - * helper method which generates the event driven triggers - * - * @param xpmc the {@link ExpandedModelComponent} - * @param state the {@link State} for which the trigger switch should be generated - * @param atlist the list of {@link ActiveTrigger}s of this state - * @param usesHdlr if the state machine uses no handler {@link TransitionPoints} - * at all then unused variables can be avoided by passing true - * @return the generated code - */ - public CharSequence genEventDrivenTriggers(final ExpandedModelComponent xpmc, final State state, final List atlist, final boolean usesHdlr) { - CharSequence _xblockexpression = null; - { - String _xifexpression = null; - boolean _usesInheritance = this.langExt.usesInheritance(); - if (_usesInheritance) { - String _className = this.getClassName(xpmc); - String _scopeSeparator = this.langExt.scopeSeparator(); - _xifexpression = (_className + _scopeSeparator); - } else { - _xifexpression = ""; - } - final String chainIDScope = _xifexpression; - StringConcatenation _builder = new StringConcatenation(); - { - for(final ActiveTrigger at : atlist) { - _builder.append("case "); - String _triggerCodeName = xpmc.getTriggerCodeName(at); - _builder.append(_triggerCodeName, ""); - _builder.append(":"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - boolean needData = this._fsmGenUtil.hasGuard(at); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - { - if (needData) { - _builder.append("{ "); - EObject _msg = at.getMsg(); - String _typedDataDefinition = this.langExt.getTypedDataDefinition(_msg); - _builder.append(_typedDataDefinition, " "); - } - } - _builder.newLineIfNotEmpty(); - { - EList _transitions = at.getTransitions(); - boolean _hasElements = false; - for(final TriggeredTransition tt : _transitions) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(" else ", " "); - } - _builder.append(" "); - TransitionChain chain = xpmc.getChain(tt); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - Transition _transition = chain.getTransition(); - String _trigger = at.getTrigger(); - String _guard = this.guard(((TriggeredTransition) _transition), _trigger, xpmc); - _builder.append(_guard, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("{"); - _builder.newLine(); - _builder.append(" "); - _builder.append(" "); - _builder.append("chain__et = "); - _builder.append(chainIDScope, " "); - String _genChainId = this._codegenHelpers.getGenChainId(chain); - _builder.append(_genChainId, " "); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append(" "); - _builder.append("catching_state__et = "); - State _stateContext = chain.getStateContext(); - String _genStateId = this._codegenHelpers.getGenStateId(_stateContext); - _builder.append(_genStateId, " "); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - { - if ((chain.isHandler() && usesHdlr)) { - _builder.append(" "); - _builder.append(" "); - _builder.append("is_handler__et = "); - String _booleanConstant = this.langExt.booleanConstant(true); - _builder.append(_booleanConstant, " "); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append(" "); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append(" "); - { - if (needData) { - _builder.append("}"); - } - } - _builder.newLineIfNotEmpty(); - _builder.append("break;"); - _builder.newLine(); - } - } - _builder.append("default:"); - _builder.newLine(); - _builder.append(" "); - _builder.append("/* should not occur */"); - _builder.newLine(); - _builder.append(" "); - _builder.append("break;"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - public String getClassName(final ExpandedModelComponent xpmc) { - ModelComponent _modelComponent = xpmc.getModelComponent(); - return this.getClassName(_modelComponent); - } - - public String getClassName(final ModelComponent mc) { - return mc.getComponentName(); - } - - /** - * getter for history array - * - * @param state the ID of the history state - * @return the generated code - */ - public String getHistory(final String state) { - String _memberAccess = this.langExt.memberAccess(); - String _plus = (_memberAccess + "history["); - String _plus_1 = (_plus + state); - return (_plus_1 + "]"); - } - - /** - * setter for history array - * - * @param state the ID of the state whose history should be set - * @param historyState the ID of the state that should be assigned - * @return the generated code - */ - public String setHistory(final String state, final String historyState) { - String _memberAccess = this.langExt.memberAccess(); - String _plus = (_memberAccess + "history["); - String _plus_1 = (_plus + state); - String _plus_2 = (_plus_1 + "] = "); - return (_plus_2 + historyState); - } - - /** - * @return the type of (temporary) state variables (defaults to "int") - * and has to be signed - */ - public String stateType() { - return "int"; - } - - /** - * allow target language dependent generation of unreachable return in generated enterHistory method. - * The default is just a comment. - * @return the generated code - */ - public String unreachableReturn() { - return "/* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */"; - } - - /** - * type of (temporary) boolean variables (defaults to "boolean") - * @return the generated code - */ - public String boolType() { - return "boolean"; - } - - /** - * empty, but may be overridden - */ - public CharSequence finalAction() { - StringConcatenation _builder = new StringConcatenation(); - return _builder; - } - - /** - * the type of the interface item passed into the receiveEvent() method - */ - public String interfaceItemType() { - return "InterfaceItemBase"; - } - - /** - * empty, but may be overridden - */ - public CharSequence markVariableUsed(final String varname) { - StringConcatenation _builder = new StringConcatenation(); - return _builder; - } - - /** - * helper method to determine whether this state machine uses handler transitions - * points at all - * - * @param xpax the {@link ExpandedModelComponent} - * @return true if the state machine uses handler transition points - */ - public boolean usesHandlerTrPoints(final ExpandedModelComponent xpmc) { - boolean _xblockexpression = false; - { - StateGraph _stateMachine = xpmc.getStateMachine(); - boolean _isEmpty = this._fSMHelpers.isEmpty(_stateMachine); - if (_isEmpty) { - return false; - } - StateGraph _stateMachine_1 = xpmc.getStateMachine(); - List _allTrPointsRecursive = this._fSMHelpers.getAllTrPointsRecursive(_stateMachine_1); - final Function1 _function = (TrPoint t) -> { - return Boolean.valueOf(((t instanceof TransitionPoint) && ((TransitionPoint) t).isHandler())); - }; - Iterable _filter = IterableExtensions.filter(_allTrPointsRecursive, _function); - boolean _isEmpty_1 = IterableExtensions.isEmpty(_filter); - _xblockexpression = (!_isEmpty_1); - } - return _xblockexpression; - } - - public abstract String guard(final TriggeredTransition tt, final String trigger, final ExpandedModelComponent mc); - - public abstract String guard(final GuardedTransition tt, final String trigger, final ExpandedModelComponent mc); - - public abstract String genActionCodeMethod(final ExpandedModelComponent xpmc, final Transition tr, final boolean generateImplementation); - - public abstract String genActionCodeMethods(final ExpandedModelComponent xpmc, final State state, final boolean generateImplementation); -} diff --git a/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/FSMExtensions.java b/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/FSMExtensions.java deleted file mode 100644 index 6273eba1d..000000000 --- a/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/FSMExtensions.java +++ /dev/null @@ -1,213 +0,0 @@ -/** - * Copyright (c) 2014 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.fsm.generic; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.fsm.fSM.CPBranchTransition; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.fsm.fSM.Guard; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.TrPoint; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.fSM.TransitionPoint; -import org.eclipse.etrice.core.fsm.util.FSMHelpers; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedModelComponent; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -/** - * @author Henrik Rentz-Reichert - */ -@SuppressWarnings("all") -public class FSMExtensions { - @Inject - @Extension - protected FSMHelpers _fSMHelpers; - - /** - * the template type is T - * @param l an iterable of type T - * @param e a single element of type T - * @return the union of the iterable and the element as new list - */ - public List union(final Iterable l, final T e) { - ArrayList ret = new ArrayList(); - Iterables.addAll(ret, l); - ret.add(e); - return ret; - } - - /** - * the template type is T - * @param l1 an iterable of type T - * @param l2 a second iterable of type T - * @return the union of the two iterables as new list - */ - public List union(final Iterable l1, final Iterable l2) { - ArrayList ret = new ArrayList(); - Iterables.addAll(ret, l1); - Iterables.addAll(ret, l2); - return ret; - } - - /** - * the template type is T - * @param l1 a list of elements of type T - * @param l2 a second list of elements of type T - * @return a new list with the contents of l1 - */ - public List minus(final List l1, final List l2) { - ArrayList ret = new ArrayList(l1); - ret.removeAll(l2); - return ret; - } - - /** - * @param ac an {@link ExpandedActorClass} - * @param s a {@link State} - * @return a list of {@link Transition}s starting at the state and going up in the hierarchy - * following the logic of evaluation of firing conditions - */ - public List getOutgoingTransitionsHierarchical(final ExpandedModelComponent ac, final State s) { - ArrayList result = new ArrayList(); - EList _outgoingTransitions = ac.getOutgoingTransitions(s); - result.addAll(_outgoingTransitions); - EObject _eContainer = s.eContainer(); - StateGraph sg = ((StateGraph) _eContainer); - EList _trPoints = sg.getTrPoints(); - for (final TrPoint tp : _trPoints) { - if ((tp instanceof TransitionPoint)) { - EList _outgoingTransitions_1 = ac.getOutgoingTransitions(tp); - result.addAll(_outgoingTransitions_1); - } - } - EObject _eContainer_1 = sg.eContainer(); - if ((_eContainer_1 instanceof State)) { - EObject _eContainer_2 = sg.eContainer(); - List _outgoingTransitionsHierarchical = this.getOutgoingTransitionsHierarchical(ac, ((State) _eContainer_2)); - result.addAll(_outgoingTransitionsHierarchical); - } - return result; - } - - /** - * @param states a list of {@link State}s - * @return a list ordered such that leaf states are last - */ - public List getLeafStatesLast(final List states) { - List _xblockexpression = null; - { - final Function1 _function = (State s) -> { - return Boolean.valueOf(this._fSMHelpers.isLeaf(s)); - }; - final Iterable leaf = IterableExtensions.filter(states, _function); - final Function1 _function_1 = (State s) -> { - boolean _isLeaf = this._fSMHelpers.isLeaf(s); - return Boolean.valueOf((!_isLeaf)); - }; - final Iterable nonLeaf = IterableExtensions.filter(states, _function_1); - _xblockexpression = this.union(nonLeaf, leaf); - } - return _xblockexpression; - } - - /** - * @param ac an {@link ActorClass} - * @return a list of all leaf states - */ - public List getAllLeafStates(final ModelComponent mc) { - StateGraph _stateMachine = mc.getStateMachine(); - return this._fSMHelpers.getLeafStateList(_stateMachine); - } - - /** - * @param ac an {@link ActorClass} - * @return a list of simple states with leaf states last - */ - public List getAllBaseStatesLeavesLast(final ModelComponent mc) { - List _allBaseStates = this._fSMHelpers.getAllBaseStates(mc); - return this.getLeafStatesLast(_allBaseStates); - } - - /** - * @param ac an {@link ModelComponent} - * @return the number of all inherited states - */ - public int getNumberOfInheritedStates(final ModelComponent mc) { - ModelComponent _base = mc.getBase(); - boolean _equals = Objects.equal(_base, null); - if (_equals) { - return 0; - } else { - ModelComponent _base_1 = mc.getBase(); - StateGraph _stateMachine = _base_1.getStateMachine(); - List _stateList = this._fSMHelpers.getStateList(_stateMachine); - int _size = _stateList.size(); - ModelComponent _base_2 = mc.getBase(); - int _numberOfInheritedStates = this.getNumberOfInheritedStates(_base_2); - return (_size + _numberOfInheritedStates); - } - } - - /** - * @param ac an {@link ModelComponent} - * @return the number of all inherited base (or simple) states - */ - public int getNumberOfInheritedBaseStates(final ModelComponent ac) { - ModelComponent _base = ac.getBase(); - boolean _equals = Objects.equal(_base, null); - if (_equals) { - return 0; - } else { - ModelComponent _base_1 = ac.getBase(); - StateGraph _stateMachine = _base_1.getStateMachine(); - List _baseStateList = this._fSMHelpers.getBaseStateList(_stateMachine); - int _size = _baseStateList.size(); - ModelComponent _base_2 = ac.getBase(); - int _numberOfInheritedBaseStates = this.getNumberOfInheritedBaseStates(_base_2); - return (_size + _numberOfInheritedBaseStates); - } - } - - public boolean isConditionOrGuard(final DetailCode dc) { - boolean _xblockexpression = false; - { - final EObject parent = dc.eContainer(); - boolean _switchResult = false; - boolean _matched = false; - if (parent instanceof Guard) { - _matched=true; - _switchResult = true; - } - if (!_matched) { - if (parent instanceof CPBranchTransition) { - _matched=true; - DetailCode _condition = ((CPBranchTransition)parent).getCondition(); - _switchResult = Objects.equal(_condition, dc); - } - } - if (!_matched) { - _switchResult = false; - } - _xblockexpression = _switchResult; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.fsmtest/xtend-gen/org/eclipse/etrice/generator/generator/FSMtestGenerator.java b/plugins/org.eclipse.etrice.generator.fsmtest/xtend-gen/org/eclipse/etrice/generator/generator/FSMtestGenerator.java deleted file mode 100644 index b0a1699f4..000000000 --- a/plugins/org.eclipse.etrice.generator.fsmtest/xtend-gen/org/eclipse/etrice/generator/generator/FSMtestGenerator.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.generator.generator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.xtext.generator.IFileSystemAccess; -import org.eclipse.xtext.generator.IGenerator; - -@SuppressWarnings("all") -public class FSMtestGenerator implements IGenerator { - @Override - public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { - } -} diff --git a/plugins/org.eclipse.etrice.generator.gnuplot/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.etrice.generator.gnuplot/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 7a7ab3463..000000000 --- a/plugins/org.eclipse.etrice.generator.gnuplot/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.xtend=UTF-8 diff --git a/plugins/org.eclipse.etrice.generator.gnuplot/src/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.xtend b/plugins/org.eclipse.etrice.generator.gnuplot/src/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.xtend index 4804246c3..7b0ca83e4 100644 --- a/plugins/org.eclipse.etrice.generator.gnuplot/src/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.xtend +++ b/plugins/org.eclipse.etrice.generator.gnuplot/src/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.xtend @@ -126,18 +126,18 @@ class GnuplotScriptGenerator { cd 'log' set datafile separator comma - set terminal «format» size «width»,«height» font ",«fontsize»" background "white" - set output '«outputfile»' + set terminal «format» size «width»,«height» font ",«fontsize»" background "white" + set output '«outputfile»' set size 1,1 - set multiplot layout «graphAnnotations.size»,1 + set multiplot layout «graphAnnotations.size»,1 set grid show grid set format y "% 5.3f" - «var i = 0» - «FOR a : graphAnnotations» + «var i = 0» + «FOR a : graphAnnotations» - «ssi.generateGraph(a, i++, graphAnnotations.size)» - «ENDFOR» + «ssi.generateGraph(a, i++, graphAnnotations.size)» + «ENDFOR» unset multiplot unset output @@ -161,15 +161,15 @@ class GnuplotScriptGenerator { val vertSize = 1.0F / total ''' - set yrange [«ymin ?: "*"» : «ymax ?: "*"»] - set xtics rotate «xtics» - set mxtics «mxtics» + set yrange [«ymin ?: "*"» : «ymax ?: "*"»] + set xtics rotate «xtics» + set mxtics «mxtics» set ylabel set xlabel "time (ms)" - timeInMs(x) = «interval» * x - set origin 0,«vertOrigin» - set size 1,«vertSize» - plot 'main.data.csv' using (timeInMs(column(1))):(column("«paths»")) with lines + timeInMs(x) = «interval» * x + set origin 0,«vertOrigin» + set size 1,«vertSize» + plot 'main.data.csv' using (timeInMs(column(1))):(column("«paths»")) with lines ''' } } diff --git a/plugins/org.eclipse.etrice.generator.gnuplot/xtend-gen/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.java b/plugins/org.eclipse.etrice.generator.gnuplot/xtend-gen/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.java deleted file mode 100644 index f6275baa0..000000000 --- a/plugins/org.eclipse.etrice.generator.gnuplot/xtend-gen/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.java +++ /dev/null @@ -1,415 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Eyrak Pean (initial contribution) - * Juergen Haug - */ -package org.eclipse.etrice.generator.gnuplot; - -import com.google.common.base.Objects; -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.common.base.Annotation; -import org.eclipse.etrice.core.common.base.AnnotationType; -import org.eclipse.etrice.core.common.base.IntLiteral; -import org.eclipse.etrice.core.common.base.KeyValue; -import org.eclipse.etrice.core.common.base.Literal; -import org.eclipse.etrice.core.common.base.RealLiteral; -import org.eclipse.etrice.core.common.base.StringLiteral; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Exceptions; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@Singleton -@SuppressWarnings("all") -public class GnuplotScriptGenerator { - @Inject - private IGeneratorFileIo fileIo; - - @Inject - @Extension - private RoomExtensions roomExtensions; - - public void doGenerate(final Root root) { - EList _subSystemInstances = root.getSubSystemInstances(); - boolean _isEmpty = _subSystemInstances.isEmpty(); - if (_isEmpty) { - return; - } - EList _subSystemInstances_1 = root.getSubSystemInstances(); - final SubSystemInstance ssi = IterableExtensions.head(_subSystemInstances_1); - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - EList _annotations = _subSystemClass.getAnnotations(); - final Function1 _function = (Annotation a) -> { - AnnotationType _type = a.getType(); - String _name = _type.getName(); - return Boolean.valueOf(Objects.equal(_name, "Gnuplot")); - }; - boolean _exists = IterableExtensions.exists(_annotations, _function); - boolean _not = (!_exists); - if (_not) { - return; - } - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - final String path = this.roomExtensions.getGenerationTargetPath(_subSystemClass_1); - SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - final String infoPath = this.roomExtensions.getGenerationInfoPath(_subSystemClass_2); - try { - String _name = ssi.getName(); - String _plus = ("Generating gnuplot script for subsystem " + _name); - CharSequence _generatePlotScript = this.generatePlotScript(ssi); - this.fileIo.generateFile(_plus, path, infoPath, - "/gnuplot/main.data.csv-script.plt", _generatePlotScript); - CharSequence _gnuPlotLaunchFile = this.gnuPlotLaunchFile(); - this.fileIo.generateFile("Generating gnuplot launch configuration", path, infoPath, - "/gnuplot/create_gnuplot.launch", _gnuPlotLaunchFile); - } catch (final Throwable _t) { - if (_t instanceof Exception) { - final Exception e = (Exception)_t; - } else { - throw Exceptions.sneakyThrow(_t); - } - } - } - - protected CharSequence gnuPlotLaunchFile() { - StringConcatenation _builder = new StringConcatenation(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.newLine(); - return _builder; - } - - protected KeyValue getAttribute(final Annotation anno, final String name) { - EList _attributes = anno.getAttributes(); - final Function1 _function = (KeyValue attr) -> { - String _key = attr.getKey(); - return Boolean.valueOf(Objects.equal(_key, name)); - }; - return IterableExtensions.findFirst(_attributes, _function); - } - - protected String asString(final KeyValue kv) { - String _xifexpression = null; - Literal _value = kv.getValue(); - if ((_value instanceof StringLiteral)) { - Literal _value_1 = kv.getValue(); - _xifexpression = ((StringLiteral) _value_1).getValue(); - } else { - _xifexpression = null; - } - return _xifexpression; - } - - protected Double asReal(final KeyValue kv) { - Double _xifexpression = null; - Literal _value = kv.getValue(); - if ((_value instanceof RealLiteral)) { - Literal _value_1 = kv.getValue(); - _xifexpression = Double.valueOf(((RealLiteral) _value_1).getValue()); - } else { - Double _xifexpression_1 = null; - Literal _value_2 = kv.getValue(); - if ((_value_2 instanceof IntLiteral)) { - Literal _value_3 = kv.getValue(); - long _value_4 = ((IntLiteral) _value_3).getValue(); - _xifexpression_1 = Double.valueOf(((double) _value_4)); - } else { - _xifexpression_1 = null; - } - _xifexpression = _xifexpression_1; - } - return _xifexpression; - } - - protected Long asInteger(final KeyValue kv) { - Long _xifexpression = null; - Literal _value = kv.getValue(); - if ((_value instanceof IntLiteral)) { - Literal _value_1 = kv.getValue(); - _xifexpression = Long.valueOf(((IntLiteral) _value_1).getValue()); - } else { - _xifexpression = null; - } - return _xifexpression; - } - - protected CharSequence generatePlotScript(final SubSystemInstance ssi) { - CharSequence _xblockexpression = null; - { - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - EList _annotations = _subSystemClass.getAnnotations(); - final Function1 _function = (Annotation a) -> { - AnnotationType _type = a.getType(); - String _name = _type.getName(); - return Boolean.valueOf(Objects.equal(_name, "Gnuplot")); - }; - Iterable _filter = IterableExtensions.filter(_annotations, _function); - final Annotation plotAnnotation = IterableExtensions.head(_filter); - final int defaultFontsize = 10; - KeyValue _attribute = null; - if (plotAnnotation!=null) { - _attribute=this.getAttribute(plotAnnotation, "format"); - } - String _asString = null; - if (_attribute!=null) { - _asString=this.asString(_attribute); - } - final String format = _asString; - KeyValue _attribute_1 = null; - if (plotAnnotation!=null) { - _attribute_1=this.getAttribute(plotAnnotation, "outputfile"); - } - String _asString_1 = null; - if (_attribute_1!=null) { - _asString_1=this.asString(_attribute_1); - } - final String outputfile = _asString_1; - KeyValue _attribute_2 = null; - if (plotAnnotation!=null) { - _attribute_2=this.getAttribute(plotAnnotation, "width"); - } - Long _asInteger = null; - if (_attribute_2!=null) { - _asInteger=this.asInteger(_attribute_2); - } - final Long width = _asInteger; - KeyValue _attribute_3 = null; - if (plotAnnotation!=null) { - _attribute_3=this.getAttribute(plotAnnotation, "height"); - } - Long _asInteger_1 = null; - if (_attribute_3!=null) { - _asInteger_1=this.asInteger(_attribute_3); - } - final Long height = _asInteger_1; - Number _elvis = null; - KeyValue _attribute_4 = null; - if (plotAnnotation!=null) { - _attribute_4=this.getAttribute(plotAnnotation, "fontsize"); - } - Long _asInteger_2 = null; - if (_attribute_4!=null) { - _asInteger_2=this.asInteger(_attribute_4); - } - if (_asInteger_2 != null) { - _elvis = _asInteger_2; - } else { - _elvis = Integer.valueOf(defaultFontsize); - } - final Number fontsize = ((Number)_elvis); - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - EList _annotations_1 = _subSystemClass_1.getAnnotations(); - final Function1 _function_1 = (Annotation a) -> { - AnnotationType _type = a.getType(); - String _name = _type.getName(); - return Boolean.valueOf(Objects.equal(_name, "GnuplotGraph")); - }; - Iterable _filter_1 = IterableExtensions.filter(_annotations_1, _function_1); - final List graphAnnotations = IterableExtensions.toList(_filter_1); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("#!/gnuplot"); - _builder.newLine(); - _builder.newLine(); - _builder.append("# Color Brewer set1 5-set"); - _builder.newLine(); - _builder.append("set linetype 1 lc rgb \'#e41a1c\' lw 1"); - _builder.newLine(); - _builder.append("set linetype 2 lc rgb \'#377eb8\' lw 1"); - _builder.newLine(); - _builder.append("set linetype 3 lc rgb \'#4daf4a\' lw 1"); - _builder.newLine(); - _builder.append("set linetype 4 lc rgb \'#984ea3\' lw 1"); - _builder.newLine(); - _builder.append("set linetype 5 lc rgb \'#ff7f00\' lw 1"); - _builder.newLine(); - _builder.append("set linetype cycle 5"); - _builder.newLine(); - _builder.newLine(); - _builder.append("cd \'log\'"); - _builder.newLine(); - _builder.append("set datafile separator comma"); - _builder.newLine(); - _builder.append("set terminal "); - _builder.append(format, ""); - _builder.append(" size "); - _builder.append(width, ""); - _builder.append(","); - _builder.append(height, ""); - _builder.append(" font \","); - _builder.append(((Number)fontsize), ""); - _builder.append("\" background \"white\""); - _builder.newLineIfNotEmpty(); - _builder.append("set output \'"); - _builder.append(outputfile, ""); - _builder.append("\'"); - _builder.newLineIfNotEmpty(); - _builder.append("set size 1,1"); - _builder.newLine(); - _builder.append("set multiplot layout "); - int _size = graphAnnotations.size(); - _builder.append(_size, ""); - _builder.append(",1"); - _builder.newLineIfNotEmpty(); - _builder.append("set grid"); - _builder.newLine(); - _builder.append("show grid"); - _builder.newLine(); - _builder.append("set format y \"% 5.3f\""); - _builder.newLine(); - int i = 0; - _builder.newLineIfNotEmpty(); - { - for(final Annotation a : graphAnnotations) { - _builder.newLine(); - int _plusPlus = i++; - int _size_1 = graphAnnotations.size(); - CharSequence _generateGraph = this.generateGraph(ssi, a, _plusPlus, _size_1); - _builder.append(_generateGraph, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("unset multiplot"); - _builder.newLine(); - _builder.append("unset output"); - _builder.newLine(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - protected CharSequence generateGraph(final SubSystemInstance ssi, final Annotation graph, final int index, final int total) { - CharSequence _xblockexpression = null; - { - KeyValue _attribute = this.getAttribute(graph, "paths"); - String _asString = null; - if (_attribute!=null) { - _asString=this.asString(_attribute); - } - final String paths = _asString; - Number _elvis = null; - KeyValue _attribute_1 = this.getAttribute(graph, "interval"); - Long _asInteger = null; - if (_attribute_1!=null) { - _asInteger=this.asInteger(_attribute_1); - } - if (_asInteger != null) { - _elvis = _asInteger; - } else { - _elvis = Integer.valueOf(20); - } - final Number interval = ((Number)_elvis); - Number _elvis_1 = null; - KeyValue _attribute_2 = this.getAttribute(graph, "xtics"); - Double _asReal = null; - if (_attribute_2!=null) { - _asReal=this.asReal(_attribute_2); - } - if (_asReal != null) { - _elvis_1 = _asReal; - } else { - _elvis_1 = Integer.valueOf(100); - } - final Number xtics = ((Number)_elvis_1); - Number _elvis_2 = null; - KeyValue _attribute_3 = this.getAttribute(graph, "mxtics"); - Long _asInteger_1 = null; - if (_attribute_3!=null) { - _asInteger_1=this.asInteger(_attribute_3); - } - if (_asInteger_1 != null) { - _elvis_2 = _asInteger_1; - } else { - _elvis_2 = Integer.valueOf(4); - } - final Number mxtics = ((Number)_elvis_2); - KeyValue _attribute_4 = this.getAttribute(graph, "ymin"); - Double _asReal_1 = null; - if (_attribute_4!=null) { - _asReal_1=this.asReal(_attribute_4); - } - final Double ymin = _asReal_1; - KeyValue _attribute_5 = this.getAttribute(graph, "ymax"); - Double _asReal_2 = null; - if (_attribute_5!=null) { - _asReal_2=this.asReal(_attribute_5); - } - final Double ymax = _asReal_2; - final double vertOrigin = (((double) (total - (index + 1))) / total); - final float vertSize = (1.0F / total); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("set yrange ["); - Object _elvis_3 = null; - if (ymin != null) { - _elvis_3 = ymin; - } else { - _elvis_3 = "*"; - } - _builder.append(((Object)_elvis_3), ""); - _builder.append(" : "); - Object _elvis_4 = null; - if (ymax != null) { - _elvis_4 = ymax; - } else { - _elvis_4 = "*"; - } - _builder.append(((Object)_elvis_4), ""); - _builder.append("]"); - _builder.newLineIfNotEmpty(); - _builder.append("set xtics rotate "); - _builder.append(((Number)xtics), ""); - _builder.newLineIfNotEmpty(); - _builder.append("set mxtics "); - _builder.append(((Number)mxtics), ""); - _builder.newLineIfNotEmpty(); - _builder.append("set ylabel"); - _builder.newLine(); - _builder.append("set xlabel \"time (ms)\""); - _builder.newLine(); - _builder.append("timeInMs(x) = "); - _builder.append(((Number)interval), ""); - _builder.append(" * x"); - _builder.newLineIfNotEmpty(); - _builder.append("set origin 0,"); - _builder.append(vertOrigin, ""); - _builder.newLineIfNotEmpty(); - _builder.append("set size 1,"); - _builder.append(vertSize, ""); - _builder.newLineIfNotEmpty(); - _builder.append("plot \'main.data.csv\' using (timeInMs(column(1))):(column(\""); - _builder.append(paths, ""); - _builder.append("\")) with lines"); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java deleted file mode 100644 index e4e78ba9a..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java +++ /dev/null @@ -1,236 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.HashMap; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; -import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.WiredActorClass; -import org.eclipse.etrice.core.genmodel.etricegen.WiredStructureClass; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@Singleton -@SuppressWarnings("all") -public class ActorClassDataGen { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - @Inject - @Extension - private ProcedureHelpers _procedureHelpers; - - public void doGenerate(final Root root) { - final HashMap ac2wired = new HashMap(); - EList _wiredInstances = root.getWiredInstances(); - final Function1 _function = (WiredStructureClass w) -> { - return Boolean.valueOf((w instanceof WiredActorClass)); - }; - Iterable _filter = IterableExtensions.filter(_wiredInstances, _function); - final Consumer _function_1 = (WiredStructureClass w) -> { - ActorClass _actorClass = ((WiredActorClass) w).getActorClass(); - ac2wired.put(_actorClass, ((WiredActorClass) w)); - }; - _filter.forEach(_function_1); - EList _xpActorClasses = root.getXpActorClasses(); - final Function1 _function_2 = (ExpandedActorClass cl) -> { - ActorClass _actorClass = cl.getActorClass(); - return Boolean.valueOf(this._fileSystemHelpers.isValidGenerationLocation(_actorClass)); - }; - Iterable _filter_1 = IterableExtensions.filter(_xpActorClasses, _function_2); - for (final ExpandedActorClass xpac : _filter_1) { - { - ActorClass _actorClass = xpac.getActorClass(); - final WiredActorClass wired = ac2wired.get(_actorClass); - ActorClass _actorClass_1 = xpac.getActorClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_actorClass_1); - ActorClass _actorClass_2 = xpac.getActorClass(); - String _path = this._roomExtensions.getPath(_actorClass_2); - final String path = (_generationTargetPath + _path); - ActorClass _actorClass_3 = xpac.getActorClass(); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_actorClass_3); - ActorClass _actorClass_4 = xpac.getActorClass(); - String _path_1 = this._roomExtensions.getPath(_actorClass_4); - final String infopath = (_generationInfoPath + _path_1); - ActorClass _actorClass_5 = xpac.getActorClass(); - String _name = _actorClass_5.getName(); - String file = (_name + "_DataObject.java"); - CharSequence _generate = this.generate(root, xpac, wired); - this.fileIO.generateFile("generating ActorClass implementation", path, infopath, file, _generate); - } - } - } - - public CharSequence generate(final Root root, final ExpandedActorClass xpac, final WiredActorClass wired) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - String _name = ac.getName(); - final String clsname = (_name + "_DataObject"); - final EList models = root.getReferencedModels(ac); - String _xifexpression = null; - ModelComponent _base = ac.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - ActorClass _actorBase = ac.getActorBase(); - String _name_1 = _actorBase.getName(); - String _plus = ("extends " + _name_1); - _xifexpression = (_plus + "_DataObject "); - } else { - _xifexpression = ""; - } - final String baseClass = _xifexpression; - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _package = this._roomExtensions.getPackage(ac); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.IActorClassDataObject;"); - _builder.newLine(); - { - for(final RoomModel model : models) { - _builder.append("import "); - String _name_2 = model.getName(); - _builder.append(_name_2, ""); - _builder.append(".*;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("public class "); - _builder.append(clsname, ""); - _builder.append(" "); - _builder.append(baseClass, ""); - _builder.append("implements IActorClassDataObject {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - { - boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac); - if (_hasNonEmptyStateMachine) { - _builder.append("\t"); - _builder.append("// state and history"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("private int state;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("private int[] history;"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - } - } - _builder.append("\t"); - EList _attributes = ac.getAttributes(); - CharSequence _attributes_1 = this._procedureHelpers.attributes(_attributes); - _builder.append(_attributes_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - { - boolean _hasNonEmptyStateMachine_1 = this._roomHelpers.hasNonEmptyStateMachine(ac); - if (_hasNonEmptyStateMachine_1) { - _builder.append("\t"); - _builder.append("public int getState() {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("return state;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void setState(int state) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("this.state = state;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public int[] getHistory() {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("return history;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void setHistory(int[] history) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("this.history = history;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - } - } - _builder.append("\t"); - EList _attributes_2 = ac.getAttributes(); - String _name_3 = ac.getName(); - CharSequence _attributeSettersGettersImplementation = this._procedureHelpers.attributeSettersGettersImplementation(_attributes_2, _name_3); - _builder.append(_attributeSettersGettersImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java deleted file mode 100644 index aebf1d1ff..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java +++ /dev/null @@ -1,1772 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.HashMap; -import java.util.List; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants; -import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.Wire; -import org.eclipse.etrice.core.genmodel.etricegen.WiredActorClass; -import org.eclipse.etrice.core.genmodel.etricegen.WiredStructureClass; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorRef; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.ReferenceType; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.SAP; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.ServiceImplementation; -import org.eclipse.etrice.core.room.StandardOperation; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.generator.base.IDataConfiguration; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.GenericActorClassGenerator; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.generic.TypeHelpers; -import org.eclipse.etrice.generator.java.Main; -import org.eclipse.etrice.generator.java.gen.ConfigGenAddon; -import org.eclipse.etrice.generator.java.gen.GlobalSettings; -import org.eclipse.etrice.generator.java.gen.Initialization; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.etrice.generator.java.gen.StateMachineGen; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.StringExtensions; - -@Singleton -@SuppressWarnings("all") -public class ActorClassGen extends GenericActorClassGenerator { - @Inject - protected IGeneratorFileIo fileIO; - - @Inject - @Extension - protected JavaExtensions _javaExtensions; - - @Inject - @Extension - protected RoomExtensions _roomExtensions; - - @Inject - protected IDataConfiguration dataConfigExt; - - protected final ConfigGenAddon configGenAddon; - - @Inject - @Extension - protected ProcedureHelpers _procedureHelpers; - - @Inject - @Extension - protected Initialization _initialization; - - @Inject - @Extension - protected StateMachineGen _stateMachineGen; - - @Inject - @Extension - protected TypeHelpers _typeHelpers; - - @Inject - @Extension - protected FileSystemHelpers _fileSystemHelpers; - - @Inject - public ActorClassGen(final ConfigGenAddon configGenAddon) { - this.configGenAddon = configGenAddon; - } - - public void doGenerate(final Root root) { - final HashMap ac2wired = new HashMap(); - EList _wiredInstances = root.getWiredInstances(); - final Function1 _function = (WiredStructureClass w) -> { - return Boolean.valueOf((w instanceof WiredActorClass)); - }; - Iterable _filter = IterableExtensions.filter(_wiredInstances, _function); - final Consumer _function_1 = (WiredStructureClass w) -> { - ActorClass _actorClass = ((WiredActorClass) w).getActorClass(); - ac2wired.put(_actorClass, ((WiredActorClass) w)); - }; - _filter.forEach(_function_1); - EList _actorClasses = root.getActorClasses(); - final Function1 _function_2 = (ActorClass it) -> { - return Boolean.valueOf(this._fileSystemHelpers.isValidGenerationLocation(it)); - }; - Iterable _filter_1 = IterableExtensions.filter(_actorClasses, _function_2); - final Function1 _function_3 = (ActorClass it) -> { - return root.getExpandedActorClass(it); - }; - Iterable _map = IterableExtensions.map(_filter_1, _function_3); - for (final ExpandedActorClass xpac : _map) { - { - ActorClass _actorClass = xpac.getActorClass(); - final WiredActorClass wired = ac2wired.get(_actorClass); - ActorClass _actorClass_1 = xpac.getActorClass(); - final boolean manualBehavior = this._roomHelpers.isBehaviorAnnotationPresent(_actorClass_1, "BehaviorManual"); - ActorClass _actorClass_2 = xpac.getActorClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_actorClass_2); - ActorClass _actorClass_3 = xpac.getActorClass(); - String _path = this._roomExtensions.getPath(_actorClass_3); - final String path = (_generationTargetPath + _path); - ActorClass _actorClass_4 = xpac.getActorClass(); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_actorClass_4); - ActorClass _actorClass_5 = xpac.getActorClass(); - String _path_1 = this._roomExtensions.getPath(_actorClass_5); - final String infopath = (_generationInfoPath + _path_1); - ActorClass _actorClass_6 = xpac.getActorClass(); - String file = this._javaExtensions.getJavaFileName(_actorClass_6); - if (manualBehavior) { - file = ("Abstract" + file); - } - CharSequence _generate = this.generate(root, xpac, wired, manualBehavior); - this.fileIO.generateFile("generating ActorClass implementation", path, infopath, file, _generate); - } - } - } - - public CharSequence generate(final Root root, final ExpandedActorClass xpac, final WiredActorClass wired, final boolean manualBehavior) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - String _xifexpression = null; - if (manualBehavior) { - String _name = ac.getName(); - _xifexpression = ("Abstract" + _name); - } else { - _xifexpression = ac.getName(); - } - final String clsname = _xifexpression; - final EList models = root.getReferencedModels(ac); - String _xifexpression_1 = null; - GlobalSettings _settings = Main.getSettings(); - boolean _isGeneratePersistenceInterface = _settings.isGeneratePersistenceInterface(); - if (_isGeneratePersistenceInterface) { - _xifexpression_1 = "implements IPersistable "; - } else { - _xifexpression_1 = ""; - } - final String impPersist = _xifexpression_1; - String _name_1 = ac.getName(); - final String dataObjClass = (_name_1 + "_DataObject"); - String _xifexpression_2 = null; - ActorClass _actorBase = ac.getActorBase(); - boolean _notEquals = (!Objects.equal(_actorBase, null)); - if (_notEquals) { - ActorClass _actorBase_1 = ac.getActorBase(); - _xifexpression_2 = _actorBase_1.getName(); - } else { - String _xifexpression_3 = null; - String _attribute = this._roomHelpers.getAttribute(ac, "ActorBaseClass", "class"); - boolean _isEmpty = _attribute.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - _xifexpression_3 = this._roomHelpers.getAttribute(ac, "ActorBaseClass", "class"); - } else { - String _xifexpression_4 = null; - GlobalSettings _settings_1 = Main.getSettings(); - boolean _isGenerateStoreDataObj = _settings_1.isGenerateStoreDataObj(); - if (_isGenerateStoreDataObj) { - _xifexpression_4 = "ActorClassFinalActionBase"; - } else { - _xifexpression_4 = "ActorClassBase"; - } - _xifexpression_3 = _xifexpression_4; - } - _xifexpression_2 = _xifexpression_3; - } - final String baseClass = _xifexpression_2; - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _package = this._roomExtensions.getPackage(ac); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - List _dynConfigReadAttributes = this.dataConfigExt.getDynConfigReadAttributes(ac); - boolean _isEmpty_1 = _dynConfigReadAttributes.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - _builder.append("import org.eclipse.etrice.runtime.java.config.DynConfigLock;"); - _builder.newLine(); - } - } - { - GlobalSettings _settings_2 = Main.getSettings(); - boolean _isGeneratePersistenceInterface_1 = _settings_2.isGeneratePersistenceInterface(); - if (_isGeneratePersistenceInterface_1) { - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.IPersistable;"); - _builder.newLine(); - _builder.append("import java.io.IOException;"); - _builder.newLine(); - _builder.append("import java.io.ObjectInput;"); - _builder.newLine(); - _builder.append("import java.io.ObjectOutput;"); - _builder.newLine(); - } - } - { - GlobalSettings _settings_3 = Main.getSettings(); - boolean _isGenerateStoreDataObj_1 = _settings_3.isGenerateStoreDataObj(); - if (_isGenerateStoreDataObj_1) { - _builder.append("import java.util.Arrays;"); - _builder.newLine(); - } - } - _builder.append("import org.eclipse.etrice.runtime.java.messaging.*;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.*;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.debugging.*;"); - _builder.newLine(); - _builder.newLine(); - _builder.append("import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;"); - _builder.newLine(); - _builder.newLine(); - { - for(final RoomModel model : models) { - _builder.append("import "); - String _name_2 = model.getName(); - _builder.append(_name_2, ""); - _builder.append(".*;"); - _builder.newLineIfNotEmpty(); - } - } - { - EList _referencedProtocolClasses = root.getReferencedProtocolClasses(ac); - for(final ProtocolClass pc : _referencedProtocolClasses) { - _builder.append("import "); - String _package_1 = this._roomExtensions.getPackage(pc); - _builder.append(_package_1, ""); - _builder.append("."); - String _name_3 = pc.getName(); - _builder.append(_name_3, ""); - _builder.append(".*;"); - _builder.newLineIfNotEmpty(); - } - } - { - EList _actorRefs = ac.getActorRefs(); - final Function1 _function = (ActorRef r) -> { - ReferenceType _refType = r.getRefType(); - return Boolean.valueOf(Objects.equal(_refType, ReferenceType.OPTIONAL)); - }; - Iterable _filter = IterableExtensions.filter(_actorRefs, _function); - for(final ActorRef sub : _filter) { - _builder.append("import "); - ActorClass _type = sub.getType(); - String _package_2 = this._roomExtensions.getPackage(_type); - _builder.append(_package_2, ""); - _builder.append("."); - ActorClass _type_1 = sub.getType(); - String _name_4 = _type_1.getName(); - _builder.append(_name_4, ""); - _builder.append("Interface;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(ac, 1, true); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.newLine(); - _builder.append("public "); - { - if ((manualBehavior || ac.isAbstract())) { - _builder.append("abstract "); - } - } - _builder.append("class "); - _builder.append(clsname, ""); - _builder.append(" extends "); - _builder.append(baseClass, ""); - _builder.append(" "); - _builder.append(impPersist, ""); - _builder.append("{"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - CharSequence _userCode_1 = this._procedureHelpers.userCode(ac, 2, false); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- ports"); - _builder.newLine(); - { - List _endPorts = this._roomHelpers.getEndPorts(ac); - for(final Port ep : _endPorts) { - _builder.append("\t"); - _builder.append("protected "); - String _portClassName = this._roomExtensions.getPortClassName(ep); - _builder.append(_portClassName, "\t"); - _builder.append(" "); - String _name_5 = ep.getName(); - _builder.append(_name_5, "\t"); - _builder.append(" = null;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- saps"); - _builder.newLine(); - { - EList _serviceAccessPoints = ac.getServiceAccessPoints(); - for(final SAP sap : _serviceAccessPoints) { - _builder.append("\t"); - _builder.append("protected "); - String _portClassName_1 = this._roomExtensions.getPortClassName(sap); - _builder.append(_portClassName_1, "\t"); - _builder.append(" "); - String _name_6 = sap.getName(); - _builder.append(_name_6, "\t"); - _builder.append(" = null;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- services"); - _builder.newLine(); - { - EList _serviceImplementations = ac.getServiceImplementations(); - for(final ServiceImplementation svc : _serviceImplementations) { - _builder.append("\t"); - _builder.append("protected "); - String _portClassName_2 = this._roomExtensions.getPortClassName(svc); - _builder.append(_portClassName_2, "\t"); - _builder.append(" "); - SPP _spp = svc.getSpp(); - String _name_7 = _spp.getName(); - _builder.append(_name_7, "\t"); - _builder.append(" = null;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- optional actors"); - _builder.newLine(); - { - EList _actorRefs_1 = ac.getActorRefs(); - final Function1 _function_1 = (ActorRef r) -> { - ReferenceType _refType = r.getRefType(); - return Boolean.valueOf(Objects.equal(_refType, ReferenceType.OPTIONAL)); - }; - Iterable _filter_1 = IterableExtensions.filter(_actorRefs_1, _function_1); - for(final ActorRef sub_1 : _filter_1) { - _builder.append("\t"); - _builder.append("protected "); - ActorClass _type_2 = sub_1.getType(); - String _name_8 = _type_2.getName(); - _builder.append(_name_8, "\t"); - { - int _multiplicity = sub_1.getMultiplicity(); - boolean _notEquals_1 = (_multiplicity != 1); - if (_notEquals_1) { - _builder.append("Replicated"); - } - } - _builder.append("Interface "); - String _name_9 = sub_1.getName(); - _builder.append(_name_9, "\t"); - _builder.append(" = null;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- interface item IDs"); - _builder.newLine(); - _builder.append("\t"); - String _genInterfaceItemConstants = this.genInterfaceItemConstants(xpac); - _builder.append(_genInterfaceItemConstants, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - String _genMinMaxConstants = this.configGenAddon.genMinMaxConstants(ac); - _builder.append(_genMinMaxConstants, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - EList _attributes = ac.getAttributes(); - CharSequence _attributes_1 = this._procedureHelpers.attributes(_attributes); - _builder.append(_attributes_1, "\t"); - _builder.newLineIfNotEmpty(); - { - List _dynConfigReadAttributes_1 = this.dataConfigExt.getDynConfigReadAttributes(ac); - for(final Attribute a : _dynConfigReadAttributes_1) { - _builder.append("\t"); - _builder.append("private DynConfigLock lock_"); - String _name_10 = a.getName(); - _builder.append(_name_10, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - EList _operations = ac.getOperations(); - String _name_11 = ac.getName(); - CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, _name_11); - _builder.append(_operationsImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- construction"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - _builder.append(clsname, "\t"); - _builder.append("(IRTObject parent, String name) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("super(parent, name);"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("setClassName(\""); - String _name_12 = ac.getName(); - _builder.append(_name_12, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - EList _attributes_2 = ac.getAttributes(); - CharSequence _attributeInitialization = this._initialization.attributeInitialization(_attributes_2, ac, false); - _builder.append(_attributeInitialization, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// own ports"); - _builder.newLine(); - { - List _endPorts_1 = this._roomHelpers.getEndPorts(ac); - for(final Port ep_1 : _endPorts_1) { - _builder.append("\t\t"); - String _name_13 = ep_1.getName(); - _builder.append(_name_13, "\t\t"); - _builder.append(" = new "); - String _portClassName_3 = this._roomExtensions.getPortClassName(ep_1); - _builder.append(_portClassName_3, "\t\t"); - _builder.append("(this, \""); - String _name_14 = ep_1.getName(); - _builder.append(_name_14, "\t\t"); - _builder.append("\", "); - String _ifItemId = this.getIfItemId(ep_1); - _builder.append(_ifItemId, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// own saps"); - _builder.newLine(); - { - EList _serviceAccessPoints_1 = ac.getServiceAccessPoints(); - for(final SAP sap_1 : _serviceAccessPoints_1) { - _builder.append("\t\t"); - String _name_15 = sap_1.getName(); - _builder.append(_name_15, "\t\t"); - _builder.append(" = new "); - String _portClassName_4 = this._roomExtensions.getPortClassName(sap_1); - _builder.append(_portClassName_4, "\t\t"); - _builder.append("(this, \""); - String _name_16 = sap_1.getName(); - _builder.append(_name_16, "\t\t"); - _builder.append("\", "); - String _ifItemId_1 = this.getIfItemId(sap_1); - _builder.append(_ifItemId_1, "\t\t"); - _builder.append(", 0);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// own service implementations"); - _builder.newLine(); - { - EList _serviceImplementations_1 = ac.getServiceImplementations(); - for(final ServiceImplementation svc_1 : _serviceImplementations_1) { - _builder.append("\t\t"); - SPP _spp_1 = svc_1.getSpp(); - String _name_17 = _spp_1.getName(); - _builder.append(_name_17, "\t\t"); - _builder.append(" = new "); - String _portClassName_5 = this._roomExtensions.getPortClassName(svc_1); - _builder.append(_portClassName_5, "\t\t"); - _builder.append("(this, \""); - SPP _spp_2 = svc_1.getSpp(); - String _name_18 = _spp_2.getName(); - _builder.append(_name_18, "\t\t"); - _builder.append("\", "); - SPP _spp_3 = svc_1.getSpp(); - String _ifItemId_2 = this.getIfItemId(_spp_3); - _builder.append(_ifItemId_2, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// sub actors"); - _builder.newLine(); - { - EList _actorRefs_2 = ac.getActorRefs(); - for(final ActorRef sub_2 : _actorRefs_2) { - { - ReferenceType _refType = sub_2.getRefType(); - boolean _equals = Objects.equal(_refType, ReferenceType.OPTIONAL); - if (_equals) { - _builder.append("\t\t"); - String _name_19 = sub_2.getName(); - _builder.append(_name_19, "\t\t"); - _builder.append(" = new "); - ActorClass _type_3 = sub_2.getType(); - String _name_20 = _type_3.getName(); - _builder.append(_name_20, "\t\t"); - { - int _multiplicity_1 = sub_2.getMultiplicity(); - boolean _notEquals_2 = (_multiplicity_1 != 1); - if (_notEquals_2) { - _builder.append("Replicated"); - } - } - _builder.append("Interface(this, \""); - String _name_21 = sub_2.getName(); - _builder.append(_name_21, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } else { - int _multiplicity_2 = sub_2.getMultiplicity(); - boolean _greaterThan = (_multiplicity_2 > 1); - if (_greaterThan) { - _builder.append("\t\t"); - _builder.append("for (int i=0; i<"); - int _multiplicity_3 = sub_2.getMultiplicity(); - _builder.append(_multiplicity_3, "\t\t"); - _builder.append("; ++i) {"); - _builder.newLineIfNotEmpty(); - { - GlobalSettings _settings_4 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings_4.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("DebuggingService.getInstance().addMessageActorCreate(this, \""); - String _name_22 = sub_2.getName(); - _builder.append(_name_22, "\t\t\t"); - _builder.append(GenmodelConstants.INDEX_SEP, "\t\t\t"); - _builder.append("\"+i);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("new "); - ActorClass _type_4 = sub_2.getType(); - String _name_23 = _type_4.getName(); - _builder.append(_name_23, "\t\t\t"); - _builder.append("(this, \""); - String _name_24 = sub_2.getName(); - _builder.append(_name_24, "\t\t\t"); - _builder.append(GenmodelConstants.INDEX_SEP, "\t\t\t"); - _builder.append("\"+i);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } else { - { - GlobalSettings _settings_5 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_5.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t\t"); - _builder.append("DebuggingService.getInstance().addMessageActorCreate(this, \""); - String _name_25 = sub_2.getName(); - _builder.append(_name_25, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("new "); - ActorClass _type_5 = sub_2.getType(); - String _name_26 = _type_5.getName(); - _builder.append(_name_26, "\t\t"); - _builder.append("(this, \""); - String _name_27 = sub_2.getName(); - _builder.append(_name_27, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// wiring"); - _builder.newLine(); - { - EList _wires = wired.getWires(); - for(final Wire wire : _wires) { - _builder.append("\t\t"); - String _xifexpression_5 = null; - boolean _isDataDriven = wire.isDataDriven(); - if (_isDataDriven) { - _xifexpression_5 = "DataPortBase"; - } else { - _xifexpression_5 = "InterfaceItemBase"; - } - _builder.append(_xifexpression_5, "\t\t"); - _builder.append(".connect(this, \""); - EList _path1 = wire.getPath1(); - String _join = IterableExtensions.join(_path1, "/"); - _builder.append(_join, "\t\t"); - _builder.append("\", \""); - EList _path2 = wire.getPath2(); - String _join_1 = IterableExtensions.join(_path2, "/"); - _builder.append(_join_1, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - { - if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { - _builder.append("\t\t"); - _builder.append("// activate polling for data-driven communication"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(getThread()).addPollingMessageReceiver(this);"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - String _userStructorBody = this._procedureHelpers.userStructorBody(ac, true); - _builder.append(_userStructorBody, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - if (((!this.dataConfigExt.getDynConfigReadAttributes(ac).isEmpty()) || (!this.dataConfigExt.getDynConfigWriteAttributes(ac).isEmpty()))) { - { - List _dynConfigReadAttributes_2 = this.dataConfigExt.getDynConfigReadAttributes(ac); - for(final Attribute a_1 : _dynConfigReadAttributes_2) { - _builder.append("\t\t"); - _builder.append("lock_"); - String _name_28 = a_1.getName(); - _builder.append(_name_28, "\t\t"); - _builder.append(" = new DynConfigLock();"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - EList _attributes_3 = ac.getAttributes(); - List _dynConfigReadAttributes_3 = this.dataConfigExt.getDynConfigReadAttributes(ac); - List _minus = this._roomExtensions.minus(_attributes_3, _dynConfigReadAttributes_3); - String _name_29 = ac.getName(); - CharSequence _attributeSettersGettersImplementation = this._procedureHelpers.attributeSettersGettersImplementation(_minus, _name_29); - _builder.append(_attributeSettersGettersImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - CharSequence _genDynConfigGetterSetter = this.configGenAddon.genDynConfigGetterSetter(ac); - _builder.append(_genDynConfigGetterSetter, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- port getters"); - _builder.newLine(); - { - List _endPorts_2 = this._roomHelpers.getEndPorts(ac); - for(final Port ep_2 : _endPorts_2) { - _builder.append("\t"); - String _portClassName_6 = this._roomExtensions.getPortClassName(ep_2); - String _name_30 = ep_2.getName(); - String _name_31 = ac.getName(); - CharSequence _terImplementation = this._procedureHelpers.getterImplementation(_portClassName_6, _name_30, _name_31); - _builder.append(_terImplementation, "\t"); - _builder.newLineIfNotEmpty(); - } - } - { - EList _serviceAccessPoints_2 = ac.getServiceAccessPoints(); - for(final SAP sap_2 : _serviceAccessPoints_2) { - _builder.append("\t"); - String _portClassName_7 = this._roomExtensions.getPortClassName(sap_2); - String _name_32 = sap_2.getName(); - String _name_33 = ac.getName(); - CharSequence _terImplementation_1 = this._procedureHelpers.getterImplementation(_portClassName_7, _name_32, _name_33); - _builder.append(_terImplementation_1, "\t"); - _builder.newLineIfNotEmpty(); - } - } - { - EList _serviceImplementations_2 = ac.getServiceImplementations(); - for(final ServiceImplementation svc_2 : _serviceImplementations_2) { - _builder.append("\t"); - String _portClassName_8 = this._roomExtensions.getPortClassName(svc_2); - SPP _spp_4 = svc_2.getSpp(); - String _name_34 = _spp_4.getName(); - String _name_35 = ac.getName(); - CharSequence _terImplementation_2 = this._procedureHelpers.getterImplementation(_portClassName_8, _name_34, _name_35); - _builder.append(_terImplementation_2, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- lifecycle functions"); - _builder.newLine(); - { - boolean _overridesStop = this._roomExtensions.overridesStop(ac); - boolean _not_2 = (!_overridesStop); - if (_not_2) { - { - if (manualBehavior) { - _builder.append("\t"); - _builder.append("public abstract void stop();"); - _builder.newLine(); - } else { - _builder.append("\t"); - _builder.append("public void stop(){"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("super.stop();"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - } - } - _builder.newLine(); - { - if (manualBehavior) { - _builder.append("\t"); - _builder.append("public abstract void destroy();"); - _builder.newLine(); - } else { - _builder.append("\t"); - _builder.append("public void destroy(){"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - String _userStructorBody_1 = this._procedureHelpers.userStructorBody(ac, false); - _builder.append(_userStructorBody_1, "\t\t"); - _builder.newLineIfNotEmpty(); - { - GlobalSettings _settings_6 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_2 = _settings_6.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_2) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("DebuggingService.getInstance().addMessageActorDestroy(this);"); - _builder.newLine(); - } - } - { - if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(getThread()).removePollingMessageReceiver(this);"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("\t"); - _builder.append("super.destroy();"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - { - if (manualBehavior) { - _builder.append("\t"); - _builder.append("public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data) {"); - _builder.newLine(); - { - List _allInterfaceItems = this._roomHelpers.getAllInterfaceItems(ac); - boolean _hasElements = false; - for(final InterfaceItem ifitem : _allInterfaceItems) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate("else ", "\t\t"); - } - _builder.append("\t"); - _builder.append("\t"); - _builder.append("if (ifitem=="); - String _name_36 = ifitem.getName(); - _builder.append(_name_36, "\t\t"); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("switch (evt) {"); - _builder.newLine(); - { - List _incoming = this._roomHelpers.getIncoming(ifitem); - for(final Message msg : _incoming) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("case "); - ProtocolClass _protocolClass = this._roomHelpers.getProtocolClass(msg); - String _name_37 = _protocolClass.getName(); - _builder.append(_name_37, "\t\t\t\t"); - _builder.append("."); - String _xifexpression_6 = null; - boolean _isIncoming = this._roomExtensions.isIncoming(msg); - if (_isIncoming) { - _xifexpression_6 = "IN_"; - } else { - _xifexpression_6 = "OUT_"; - } - _builder.append(_xifexpression_6, "\t\t\t\t"); - String _name_38 = msg.getName(); - _builder.append(_name_38, "\t\t\t\t"); - _builder.append(":"); - _builder.newLineIfNotEmpty(); - { - VarDecl _data = msg.getData(); - boolean _notEquals_3 = (!Objects.equal(_data, null)); - if (_notEquals_3) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("{"); - String _typedDataDefinition = this._javaExtensions.getTypedDataDefinition(msg); - _builder.append(_typedDataDefinition, "\t\t\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("on_"); - String _name_39 = ifitem.getName(); - _builder.append(_name_39, "\t\t\t\t\t"); - _builder.append("_"); - String _name_40 = msg.getName(); - _builder.append(_name_40, "\t\t\t\t\t"); - _builder.append("(ifitem"); - { - VarDecl _data_1 = msg.getData(); - boolean _notEquals_4 = (!Objects.equal(_data_1, null)); - if (_notEquals_4) { - _builder.append(", "); - VarDecl _data_2 = msg.getData(); - String _name_41 = _data_2.getName(); - _builder.append(_name_41, "\t\t\t\t\t"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("break;"); - _builder.newLine(); - { - VarDecl _data_3 = msg.getData(); - boolean _notEquals_5 = (!Objects.equal(_data_3, null)); - if (_notEquals_5) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - } - } - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - { - List _allInterfaceItems_1 = this._roomHelpers.getAllInterfaceItems(ac); - for(final InterfaceItem ifitem_1 : _allInterfaceItems_1) { - { - List _incoming_1 = this._roomHelpers.getIncoming(ifitem_1); - for(final Message msg_1 : _incoming_1) { - _builder.append("\t"); - _builder.append("protected void on_"); - String _name_42 = ifitem_1.getName(); - _builder.append(_name_42, "\t"); - _builder.append("_"); - String _name_43 = msg_1.getName(); - _builder.append(_name_43, "\t"); - _builder.append("(InterfaceItemBase ifitem"); - { - VarDecl _data_4 = msg_1.getData(); - boolean _notEquals_6 = (!Objects.equal(_data_4, null)); - if (_notEquals_6) { - VarDecl _data_5 = msg_1.getData(); - String[] _generateArglistAndTypedData = this._javaExtensions.generateArglistAndTypedData(_data_5); - String _get = _generateArglistAndTypedData[2]; - _builder.append(_get, "\t"); - } - } - _builder.append(") {}"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("public abstract void executeInitTransition();"); - _builder.newLine(); - } else { - { - boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac); - if (_hasNonEmptyStateMachine) { - _builder.append("\t"); - CharSequence _genStateMachine = this._stateMachineGen.genStateMachine(xpac); - _builder.append(_genStateMachine, "\t"); - _builder.newLineIfNotEmpty(); - { - ComponentCommunicationType _commType = ac.getCommType(); - boolean _equals_1 = Objects.equal(_commType, ComponentCommunicationType.DATA_DRIVEN); - if (_equals_1) { - _builder.append("\t"); - _builder.append("public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("handleSystemEvent(ifitem, evt, generic_data);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - { - if ((Objects.equal(ac.getCommType(), ComponentCommunicationType.ASYNCHRONOUS) || Objects.equal(ac.getCommType(), ComponentCommunicationType.DATA_DRIVEN))) { - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void receive(Message msg) {"); - _builder.newLine(); - { - ComponentCommunicationType _commType_1 = ac.getCommType(); - boolean _equals_2 = Objects.equal(_commType_1, ComponentCommunicationType.ASYNCHRONOUS); - if (_equals_2) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("receiveEvent(null, -1, null);"); - _builder.newLine(); - } else { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("receiveEventInternal();"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - } else { - StateGraph _stateMachine = xpac.getStateMachine(); - boolean _isEmpty_2 = this._roomHelpers.isEmpty(_stateMachine); - if (_isEmpty_2) { - _builder.append("\t"); - _builder.append("//--------------------- no state machine"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void receiveEvent(InterfaceItemBase ifitem, int evt, Object data) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("handleSystemEvent(ifitem, evt, data);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void executeInitTransition() {}"); - _builder.newLine(); - } - } - } - } - } - _builder.newLine(); - { - GlobalSettings _settings_7 = Main.getSettings(); - boolean _isGeneratePersistenceInterface_2 = _settings_7.isGeneratePersistenceInterface(); - if (_isGeneratePersistenceInterface_2) { - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void saveObject(ObjectOutput output) throws IOException {"); - _builder.newLine(); - { - boolean _hasStateMachine = xpac.hasStateMachine(); - if (_hasStateMachine) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("// state and history"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("output.writeInt(getState());"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("for (int h: history) output.writeInt(h);"); - _builder.newLine(); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("\t"); - _builder.append("saveAttributes(output);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("protected void saveAttributes(ObjectOutput output) throws IOException {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - CharSequence _genSaveImpl = this.genSaveImpl(xpac); - _builder.append(_genSaveImpl, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void loadObject(ObjectInput input) throws IOException, ClassNotFoundException {"); - _builder.newLine(); - { - boolean _hasStateMachine_1 = xpac.hasStateMachine(); - if (_hasStateMachine_1) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("// state and history"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("setState(input.readInt());"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("for (int i=0; i _attributes_4 = ac.getAttributes(); - boolean _isEmpty_3 = _attributes_4.isEmpty(); - boolean _not_3 = (!_isEmpty_3); - if (_not_3) { - _builder.newLine(); - { - EList _attributes_5 = ac.getAttributes(); - for(final Attribute att : _attributes_5) { - { - RefableType _type_6 = att.getType(); - DataType _type_7 = _type_6.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_7); - if (_isEnumerationOrPrimitive) { - { - int _size = att.getSize(); - boolean _greaterThan_1 = (_size > 1); - if (_greaterThan_1) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("dataObject.set"); - String _name_44 = att.getName(); - String _firstUpper = StringExtensions.toFirstUpper(_name_44); - _builder.append(_firstUpper, "\t\t"); - _builder.append("(Arrays.copyOf("); - String _name_45 = att.getName(); - _builder.append(_name_45, "\t\t"); - _builder.append(", "); - String _name_46 = att.getName(); - _builder.append(_name_46, "\t\t"); - _builder.append(".length));"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("dataObject.set"); - String _name_47 = att.getName(); - String _firstUpper_1 = StringExtensions.toFirstUpper(_name_47); - _builder.append(_firstUpper_1, "\t\t"); - _builder.append("("); - String _name_48 = att.getName(); - _builder.append(_name_48, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } else { - { - int _size_1 = att.getSize(); - boolean _greaterThan_2 = (_size_1 > 1); - if (_greaterThan_2) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - RefableType _type_8 = att.getType(); - DataType _type_9 = _type_8.getType(); - String _name_49 = _type_9.getName(); - _builder.append(_name_49, "\t\t\t"); - _builder.append("[] arr = Arrays.copyOf("); - String _name_50 = att.getName(); - _builder.append(_name_50, "\t\t\t"); - _builder.append(", "); - String _name_51 = att.getName(); - _builder.append(_name_51, "\t\t\t"); - _builder.append(".length);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("for(int i=0; i _attributes_6 = ac.getAttributes(); - boolean _isEmpty_4 = _attributes_6.isEmpty(); - boolean _not_4 = (!_isEmpty_4); - if (_not_4) { - _builder.newLine(); - { - EList _attributes_7 = ac.getAttributes(); - for(final Attribute att_1 : _attributes_7) { - { - RefableType _type_10 = att_1.getType(); - DataType _type_11 = _type_10.getType(); - boolean _isEnumerationOrPrimitive_1 = this._typeHelpers.isEnumerationOrPrimitive(_type_11); - if (_isEnumerationOrPrimitive_1) { - { - int _size_2 = att_1.getSize(); - boolean _greaterThan_3 = (_size_2 > 1); - if (_greaterThan_3) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("set"); - String _name_55 = att_1.getName(); - String _firstUpper_4 = StringExtensions.toFirstUpper(_name_55); - _builder.append(_firstUpper_4, "\t\t"); - _builder.append("(Arrays.copyOf(dataObject.get"); - String _name_56 = att_1.getName(); - String _firstUpper_5 = StringExtensions.toFirstUpper(_name_56); - _builder.append(_firstUpper_5, "\t\t"); - _builder.append("(), "); - String _name_57 = att_1.getName(); - _builder.append(_name_57, "\t\t"); - _builder.append(".length));"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("set"); - String _name_58 = att_1.getName(); - String _firstUpper_6 = StringExtensions.toFirstUpper(_name_58); - _builder.append(_firstUpper_6, "\t\t"); - _builder.append("(dataObject.get"); - String _name_59 = att_1.getName(); - String _firstUpper_7 = StringExtensions.toFirstUpper(_name_59); - _builder.append(_firstUpper_7, "\t\t"); - _builder.append("());"); - _builder.newLineIfNotEmpty(); - } - } - } else { - { - int _size_3 = att_1.getSize(); - boolean _greaterThan_4 = (_size_3 > 1); - if (_greaterThan_4) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - RefableType _type_12 = att_1.getType(); - DataType _type_13 = _type_12.getType(); - String _name_60 = _type_13.getName(); - _builder.append(_name_60, "\t\t\t"); - _builder.append("[] arr = Arrays.copyOf(dataObject.get"); - String _name_61 = att_1.getName(); - String _firstUpper_8 = StringExtensions.toFirstUpper(_name_61); - _builder.append(_firstUpper_8, "\t\t\t"); - _builder.append("(), "); - String _name_62 = att_1.getName(); - _builder.append(_name_62, "\t\t\t"); - _builder.append(".length);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("for(int i=0; i _attributes = ac.getAttributes(); - boolean _isEmpty = _attributes.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - { - EList _attributes_1 = ac.getAttributes(); - for(final Attribute att : _attributes_1) { - { - RefableType _type = att.getType(); - DataType _type_1 = _type.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1); - if (_isEnumerationOrPrimitive) { - String _genSavePrimitive = this.genSavePrimitive(att); - _builder.append(_genSavePrimitive, ""); - _builder.newLineIfNotEmpty(); - } else { - { - int _size = att.getSize(); - boolean _greaterThan = (_size > 1); - if (_greaterThan) { - _builder.append("for ("); - RefableType _type_2 = att.getType(); - DataType _type_3 = _type_2.getType(); - String _name = _type_3.getName(); - _builder.append(_name, ""); - _builder.append(" v: "); - String _name_1 = att.getName(); - _builder.append(_name_1, ""); - _builder.append(") output.writeObject(v);"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("output.writeObject("); - String _name_2 = att.getName(); - _builder.append(_name_2, ""); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence genLoadImpl(final ExpandedActorClass xpac) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = xpac.getActorClass(); - StringConcatenation _builder = new StringConcatenation(); - { - ActorClass _actorBase = ac.getActorBase(); - boolean _notEquals = (!Objects.equal(_actorBase, null)); - if (_notEquals) { - _builder.append("super.loadAttributes(input);"); - _builder.newLine(); - _builder.newLine(); - } - } - { - EList _attributes = ac.getAttributes(); - boolean _isEmpty = _attributes.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - { - EList _attributes_1 = ac.getAttributes(); - for(final Attribute att : _attributes_1) { - { - RefableType _type = att.getType(); - DataType _type_1 = _type.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1); - if (_isEnumerationOrPrimitive) { - String _genLoadPrimitive = this.genLoadPrimitive(att); - _builder.append(_genLoadPrimitive, ""); - _builder.newLineIfNotEmpty(); - } else { - { - int _size = att.getSize(); - boolean _greaterThan = (_size > 1); - if (_greaterThan) { - _builder.append("for (int i=0; i< "); - String _name = att.getName(); - _builder.append(_name, ""); - _builder.append(".length; ++i) "); - String _name_1 = att.getName(); - _builder.append(_name_1, ""); - _builder.append("[i] = ("); - RefableType _type_2 = att.getType(); - DataType _type_3 = _type_2.getType(); - String _name_2 = _type_3.getName(); - _builder.append(_name_2, ""); - _builder.append(") input.readObject();"); - _builder.newLineIfNotEmpty(); - } else { - String _name_3 = att.getName(); - _builder.append(_name_3, ""); - _builder.append(" = ("); - RefableType _type_4 = att.getType(); - DataType _type_5 = _type_4.getType(); - String _name_4 = _type_5.getName(); - _builder.append(_name_4, ""); - _builder.append(") input.readObject();"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private String genSavePrimitive(final Attribute att) { - String _xblockexpression = null; - { - String _xifexpression = null; - if (((att.getType().getType() instanceof EnumerationType) && Objects.equal(((EnumerationType) att.getType().getType()).getPrimitiveType(), null))) { - _xifexpression = "int"; - } else { - RefableType _type = att.getType(); - DataType _type_1 = _type.getType(); - _xifexpression = this._typeHelpers.typeName(_type_1); - } - final String type = _xifexpression; - final String method = this.getSaveMethod(type); - String _xifexpression_1 = null; - int _size = att.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - String _name = att.getName(); - String _plus = ((("for (" + type) + " v: ") + _name); - String _plus_1 = (_plus + ") output."); - String _plus_2 = (_plus_1 + method); - _xifexpression_1 = (_plus_2 + "(v);"); - } else { - String _name_1 = att.getName(); - String _plus_3 = ((("output." + method) + "(") + _name_1); - _xifexpression_1 = (_plus_3 + ");"); - } - _xblockexpression = _xifexpression_1; - } - return _xblockexpression; - } - - private String getSaveMethod(final String type) { - String _switchResult = null; - switch (type) { - case "boolean": - _switchResult = "writeBoolean"; - break; - case "char": - _switchResult = "writeChar"; - break; - case "byte": - _switchResult = "writeByte"; - break; - case "short": - _switchResult = "writeShort"; - break; - case "int": - _switchResult = "write"; - break; - case "long": - _switchResult = "writeLong"; - break; - case "float": - _switchResult = "writeFloat"; - break; - case "double": - _switchResult = "writeDouble"; - break; - case "String": - _switchResult = "writeUTF"; - break; - } - return _switchResult; - } - - private String genLoadPrimitive(final Attribute att) { - String _xblockexpression = null; - { - String _xifexpression = null; - if (((att.getType().getType() instanceof EnumerationType) && Objects.equal(((EnumerationType) att.getType().getType()).getPrimitiveType(), null))) { - _xifexpression = "int"; - } else { - RefableType _type = att.getType(); - DataType _type_1 = _type.getType(); - _xifexpression = this._typeHelpers.typeName(_type_1); - } - final String type = _xifexpression; - final String method = this.getLoadMethod(type); - String _xifexpression_1 = null; - int _size = att.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - String _name = att.getName(); - String _plus = ("for (int i=0; i<" + _name); - String _plus_1 = (_plus + ".length; ++i) "); - String _name_1 = att.getName(); - String _plus_2 = (_plus_1 + _name_1); - String _plus_3 = (_plus_2 + "[i] = input."); - String _plus_4 = (_plus_3 + method); - _xifexpression_1 = (_plus_4 + "();"); - } else { - String _name_2 = att.getName(); - String _plus_5 = (_name_2 + " = input."); - String _plus_6 = (_plus_5 + method); - _xifexpression_1 = (_plus_6 + "();"); - } - _xblockexpression = _xifexpression_1; - } - return _xblockexpression; - } - - private String getLoadMethod(final String type) { - String _switchResult = null; - switch (type) { - case "boolean": - _switchResult = "readBoolean"; - break; - case "char": - _switchResult = "readChar"; - break; - case "byte": - _switchResult = "readByte"; - break; - case "short": - _switchResult = "readShort"; - break; - case "int": - _switchResult = "read"; - break; - case "long": - _switchResult = "readLong"; - break; - case "float": - _switchResult = "readFloat"; - break; - case "double": - _switchResult = "readDouble"; - break; - case "String": - _switchResult = "readUTF"; - break; - } - return _switchResult; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java deleted file mode 100644 index 6f2960ad2..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java +++ /dev/null @@ -1,478 +0,0 @@ -/** - * Copyright (c) 2012 Juergen Haug - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase; -import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.PortClass; -import org.eclipse.etrice.core.room.PrimitiveType; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.base.IDataConfiguration; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.generic.TypeHelpers; -import org.eclipse.etrice.generator.java.gen.Initialization; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.StringExtensions; - -@SuppressWarnings("all") -public class ConfigGenAddon { - @Inject - @Extension - private JavaExtensions stdExt; - - @Inject - @Extension - private TypeHelpers typeHelpers; - - @Inject - @Extension - private ProcedureHelpers helpers; - - @Inject - private IDataConfiguration dataConfigExt; - - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - private Initialization initGen; - - public CharSequence genActorInstanceConfig(final ActorInstance ai, final String aiVariableName) { - StringConcatenation _builder = new StringConcatenation(); - { - ActorClass _actorClass = ai.getActorClass(); - List _allAttributes = this._roomHelpers.getAllAttributes(_actorClass); - for(final Attribute a : _allAttributes) { - ArrayList _arrayList = new ArrayList(); - List _union = this._roomExtensions.union(_arrayList, a); - CharSequence _applyInstanceConfig = this.applyInstanceConfig(ai, aiVariableName, _union); - _builder.append(_applyInstanceConfig, ""); - _builder.newLineIfNotEmpty(); - } - } - { - EList _orderedIfItemInstances = ai.getOrderedIfItemInstances(); - for(final InterfaceItemInstance pi : _orderedIfItemInstances) { - InterfaceItem _interfaceItem = pi.getInterfaceItem(); - PortClass _portClass = this._roomHelpers.getPortClass(_interfaceItem); - EList _attributes = null; - if (_portClass!=null) { - _attributes=_portClass.getAttributes(); - } - EList attribs = _attributes; - _builder.newLineIfNotEmpty(); - { - boolean _notEquals = (!Objects.equal(attribs, null)); - if (_notEquals) { - { - for(final Attribute a_1 : attribs) { - String _name = pi.getName(); - CharSequence _invokeGetter = this.helpers.invokeGetter(_name, null); - String _plus = ((aiVariableName + ".") + _invokeGetter); - ArrayList _arrayList_1 = new ArrayList(); - List _union_1 = this._roomExtensions.union(_arrayList_1, a_1); - CharSequence _applyInstanceConfig_1 = this.applyInstanceConfig(pi, _plus, _union_1); - _builder.append(_applyInstanceConfig_1, ""); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - return _builder; - } - - private CharSequence applyInstanceConfig(final InstanceBase instance, final String invokes, final List path) { - CharSequence _xblockexpression = null; - { - Attribute a = IterableExtensions.last(path); - RefableType _type = a.getType(); - DataType aType = _type.getType(); - CharSequence _switchResult = null; - boolean _matched = false; - if (aType instanceof PrimitiveType) { - _matched=true; - CharSequence _xblockexpression_1 = null; - { - String value = this.typeHelpers.getAttrInstanceConfigValue(path, instance); - CharSequence _xifexpression = null; - boolean _notEquals = (!Objects.equal(value, null)); - if (_notEquals) { - String _valueLiteral = this.stdExt.toValueLiteral(((PrimitiveType)aType), value); - _xifexpression = this.initGen.genAttributeInitializer(a, _valueLiteral, invokes); - } - _xblockexpression_1 = _xifexpression; - } - _switchResult = _xblockexpression_1; - } - if (!_matched) { - if (aType instanceof EnumerationType) { - _matched=true; - CharSequence _xblockexpression_1 = null; - { - String value = this.typeHelpers.getAttrInstanceConfigValue(path, instance); - CharSequence _xifexpression = null; - boolean _notEquals = (!Objects.equal(value, null)); - if (_notEquals) { - _xifexpression = this.initGen.genAttributeInitializer(a, value, invokes); - } - _xblockexpression_1 = _xifexpression; - } - _switchResult = _xblockexpression_1; - } - } - if (!_matched) { - if (aType instanceof DataClass) { - _matched=true; - StringConcatenation _builder = new StringConcatenation(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType)); - for(final Attribute e : _allAttributes) { - String _name = a.getName(); - CharSequence _invokeGetter = this.helpers.invokeGetter(_name, null); - String _plus = ((invokes + ".") + _invokeGetter); - List _union = this._roomExtensions.union(path, e); - CharSequence _applyInstanceConfig = this.applyInstanceConfig(instance, _plus, _union); - _builder.append(_applyInstanceConfig, ""); - _builder.newLineIfNotEmpty(); - } - } - _switchResult = _builder; - } - } - _xblockexpression = _switchResult; - } - return _xblockexpression; - } - - public CharSequence genDynConfigGetterSetter(final ActorClass ac) { - StringConcatenation _builder = new StringConcatenation(); - { - List _dynConfigReadAttributes = this.dataConfigExt.getDynConfigReadAttributes(ac); - for(final Attribute a : _dynConfigReadAttributes) { - _builder.append("public "); - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this.typeHelpers.typeName(_type_1); - _builder.append(_typeName, ""); - { - int _size = a.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _builder.append("[]"); - } - } - _builder.append(" get"); - String _name = a.getName(); - String _firstUpper = StringExtensions.toFirstUpper(_name); - _builder.append(_firstUpper, ""); - _builder.append("(){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if(lock_"); - String _name_1 = a.getName(); - _builder.append(_name_1, "\t"); - _builder.append(" == null)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("return "); - String _name_2 = a.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("else"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("synchronized(lock_"); - String _name_3 = a.getName(); - _builder.append(_name_3, "\t\t"); - _builder.append("){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("return "); - String _name_4 = a.getName(); - _builder.append(_name_4, "\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.append("public void set"); - String _name_5 = a.getName(); - String _firstUpper_1 = StringExtensions.toFirstUpper(_name_5); - _builder.append(_firstUpper_1, ""); - _builder.append("("); - RefableType _type_2 = a.getType(); - DataType _type_3 = _type_2.getType(); - String _typeName_1 = this.typeHelpers.typeName(_type_3); - _builder.append(_typeName_1, ""); - { - int _size_1 = a.getSize(); - boolean _greaterThan_1 = (_size_1 > 0); - if (_greaterThan_1) { - _builder.append("[]"); - } - } - _builder.append(" "); - String _name_6 = a.getName(); - _builder.append(_name_6, ""); - _builder.append("){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if(lock_"); - String _name_7 = a.getName(); - _builder.append(_name_7, "\t"); - _builder.append(" == null)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("this."); - String _name_8 = a.getName(); - _builder.append(_name_8, "\t\t"); - _builder.append(" = "); - String _name_9 = a.getName(); - _builder.append(_name_9, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("else"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("synchronized(lock_"); - String _name_10 = a.getName(); - _builder.append(_name_10, "\t\t"); - _builder.append("){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("this."); - String _name_11 = a.getName(); - _builder.append(_name_11, "\t\t\t"); - _builder.append(" = "); - String _name_12 = a.getName(); - _builder.append(_name_12, "\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.append("public DynConfigLock get"); - String _name_13 = a.getName(); - String _firstUpper_2 = StringExtensions.toFirstUpper(_name_13); - _builder.append(_firstUpper_2, ""); - _builder.append("Lock(){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("return lock_"); - String _name_14 = a.getName(); - _builder.append(_name_14, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("}\t"); - _builder.newLine(); - } - } - { - List _dynConfigWriteAttributes = this.dataConfigExt.getDynConfigWriteAttributes(ac); - for(final Attribute a_1 : _dynConfigWriteAttributes) { - _builder.append("public void setAndWrite"); - String _name_15 = a_1.getName(); - String _firstUpper_3 = StringExtensions.toFirstUpper(_name_15); - _builder.append(_firstUpper_3, ""); - _builder.append("("); - RefableType _type_4 = a_1.getType(); - DataType _type_5 = _type_4.getType(); - String _typeName_2 = this.typeHelpers.typeName(_type_5); - _builder.append(_typeName_2, ""); - { - int _size_2 = a_1.getSize(); - boolean _greaterThan_2 = (_size_2 > 0); - if (_greaterThan_2) { - _builder.append("[]"); - } - } - _builder.append(" "); - String _name_16 = a_1.getName(); - _builder.append(_name_16, ""); - _builder.append("){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("set"); - String _name_17 = a_1.getName(); - String _firstUpper_4 = StringExtensions.toFirstUpper(_name_17); - _builder.append(_firstUpper_4, "\t\t"); - _builder.append("("); - String _name_18 = a_1.getName(); - _builder.append(_name_18, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("getVariableService().write(this.getInstancePath()+\"/"); - String _name_19 = a_1.getName(); - _builder.append(_name_19, "\t\t"); - _builder.append("\", "); - String _name_20 = a_1.getName(); - _builder.append(_name_20, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - return _builder; - } - - public String genMinMaxConstants(final ActorClass ac) { - StringConcatenation _builder = new StringConcatenation(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(ac); - for(final Attribute a : _allAttributes) { - String _name = a.getName(); - ArrayList _arrayList = new ArrayList(); - List _union = this._roomExtensions.union(_arrayList, a); - CharSequence _genMinMaxConstantsRec = this.genMinMaxConstantsRec(ac, _name, _union); - _builder.append(_genMinMaxConstantsRec, ""); - _builder.newLineIfNotEmpty(); - } - } - String result = _builder.toString(); - int _length = result.length(); - boolean _notEquals = (_length != 0); - if (_notEquals) { - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("//--------------------- Attribute Specifications"); - String _plus = (result + _builder_1); - result = _plus; - } - return result; - } - - private CharSequence genMinMaxConstantsRec(final ActorClass ac, final String varNamePath, final List path) { - CharSequence _xblockexpression = null; - { - Attribute _last = IterableExtensions.last(path); - RefableType _type = _last.getType(); - DataType aType = _type.getType(); - CharSequence _switchResult = null; - boolean _matched = false; - if (aType instanceof DataClass) { - _matched=true; - StringConcatenation _builder = new StringConcatenation(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType)); - for(final Attribute e : _allAttributes) { - String _name = e.getName(); - String _plus = ((varNamePath + "_") + _name); - List _union = this._roomExtensions.union(path, e); - CharSequence _genMinMaxConstantsRec = this.genMinMaxConstantsRec(ac, _plus, _union); - _builder.append(_genMinMaxConstantsRec, ""); - _builder.newLineIfNotEmpty(); - } - } - _switchResult = _builder; - } - if (!_matched) { - if (aType instanceof PrimitiveType) { - _matched=true; - CharSequence _xblockexpression_1 = null; - { - String temp = ((String) null); - StringConcatenation _builder = new StringConcatenation(); - { - String _attrClassConfigMinValue = this.dataConfigExt.getAttrClassConfigMinValue(ac, path); - String _temp = (temp = _attrClassConfigMinValue); - boolean _notEquals = (!Objects.equal(_temp, null)); - if (_notEquals) { - _builder.append("public static "); - String _minMaxType = this.getMinMaxType(((PrimitiveType)aType)); - _builder.append(_minMaxType, ""); - _builder.append(" MIN_"); - _builder.append(varNamePath, ""); - _builder.append(" = "); - String _valueLiteral = this.stdExt.toValueLiteral(((PrimitiveType)aType), temp); - _builder.append(_valueLiteral, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - { - String _attrClassConfigMaxValue = this.dataConfigExt.getAttrClassConfigMaxValue(ac, path); - String _temp_1 = (temp = _attrClassConfigMaxValue); - boolean _notEquals_1 = (!Objects.equal(_temp_1, null)); - if (_notEquals_1) { - _builder.append("public static "); - String _minMaxType_1 = this.getMinMaxType(((PrimitiveType)aType)); - _builder.append(_minMaxType_1, ""); - _builder.append(" MAX_"); - _builder.append(varNamePath, ""); - _builder.append(" = "); - String _valueLiteral_1 = this.stdExt.toValueLiteral(((PrimitiveType)aType), temp); - _builder.append(_valueLiteral_1, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _xblockexpression_1 = _builder; - } - _switchResult = _xblockexpression_1; - } - } - _xblockexpression = _switchResult; - } - return _xblockexpression; - } - - private String getMinMaxType(final PrimitiveType type) { - String _switchResult = null; - String _typeName = this.typeHelpers.typeName(type); - switch (_typeName) { - case "byte": - _switchResult = "int"; - break; - case "short": - _switchResult = "int"; - break; - case "float": - _switchResult = "double"; - break; - default: - _switchResult = this.typeHelpers.typeName(type); - break; - } - return _switchResult; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java deleted file mode 100644 index f64d09d04..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java +++ /dev/null @@ -1,442 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -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.genmodel.etricegen.Root; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.ComplexType; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.StandardOperation; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.java.gen.Initialization; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@Singleton -@SuppressWarnings("all") -public class DataClassGen { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private JavaExtensions _javaExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private ProcedureHelpers _procedureHelpers; - - @Inject - @Extension - private Initialization _initialization; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - @Inject - private RoomHelpers roomHelpers; - - public void doGenerate(final Root root) { - EList _dataClasses = root.getDataClasses(); - final Function1 _function = (DataClass cl) -> { - return Boolean.valueOf(this._fileSystemHelpers.isValidGenerationLocation(cl)); - }; - Iterable _filter = IterableExtensions.filter(_dataClasses, _function); - for (final DataClass dc : _filter) { - { - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(dc); - String _path = this._roomExtensions.getPath(dc); - String path = (_generationTargetPath + _path); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(dc); - String _path_1 = this._roomExtensions.getPath(dc); - String infopath = (_generationInfoPath + _path_1); - String file = this._javaExtensions.getJavaFileName(dc); - CharSequence _generate = this.generate(root, dc); - this.fileIO.generateFile("generating DataClass implementation", path, infopath, file, _generate); - } - } - } - - public CharSequence generate(final Root root, final DataClass dc) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _package = this._roomExtensions.getPackage(dc); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;"); - _builder.newLine(); - _builder.append("import java.io.Serializable;"); - _builder.newLine(); - _builder.newLine(); - EList models = root.getReferencedModels(dc); - _builder.newLineIfNotEmpty(); - { - for(final RoomModel model : models) { - _builder.append("import "); - String _name = model.getName(); - _builder.append(_name, ""); - _builder.append(".*;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(dc, 1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.newLine(); - _builder.append("public class "); - String _name_1 = dc.getName(); - _builder.append(_name_1, ""); - { - DataClass _base = dc.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - _builder.append(" extends "); - DataClass _base_1 = dc.getBase(); - String _name_2 = _base_1.getName(); - _builder.append(_name_2, ""); - } - } - _builder.append(" implements Serializable {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("private static final long serialVersionUID = "); - String _package_1 = this._roomExtensions.getPackage(dc); - String _name_3 = dc.getName(); - String _plus = (_package_1 + _name_3); - int _hashCode = _plus.hashCode(); - _builder.append(_hashCode, "\t"); - _builder.append("L;"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - CharSequence _userCode_1 = this._procedureHelpers.userCode(dc, 2); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - EList _attributes = dc.getAttributes(); - CharSequence _attributes_1 = this._procedureHelpers.attributes(_attributes); - _builder.append(_attributes_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - EList _attributes_2 = dc.getAttributes(); - String _name_4 = dc.getName(); - CharSequence _attributeSettersGettersImplementation = this._procedureHelpers.attributeSettersGettersImplementation(_attributes_2, _name_4); - _builder.append(_attributeSettersGettersImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - EList _operations = dc.getOperations(); - String _name_5 = dc.getName(); - CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, _name_5); - _builder.append(_operationsImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// default constructor"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - String _name_6 = dc.getName(); - _builder.append(_name_6, "\t"); - _builder.append("() {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("super();"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t\t"); - EList _attributes_3 = dc.getAttributes(); - CharSequence _attributeInitialization = this._initialization.attributeInitialization(_attributes_3, dc, true); - _builder.append(_attributeInitialization, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - String _userStructorBody = this._procedureHelpers.userStructorBody(dc, true); - _builder.append(_userStructorBody, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// constructor using fields"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - String _name_7 = dc.getName(); - _builder.append(_name_7, "\t"); - _builder.append("("); - String _argList = this.argList(dc); - _builder.append(_argList, "\t"); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - { - DataClass _base_2 = dc.getBase(); - boolean _notEquals_1 = (!Objects.equal(_base_2, null)); - if (_notEquals_1) { - _builder.append("\t\t"); - _builder.append("super("); - DataClass _base_3 = dc.getBase(); - String _paramList = this.paramList(_base_3); - _builder.append(_paramList, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t\t"); - _builder.append("super();"); - _builder.newLine(); - } - } - _builder.newLine(); - { - EList _attributes_4 = dc.getAttributes(); - for(final Attribute a : _attributes_4) { - _builder.append("\t\t"); - _builder.append("this."); - String _name_8 = a.getName(); - _builder.append(_name_8, "\t\t"); - _builder.append(" = "); - String _name_9 = a.getName(); - _builder.append(_name_9, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - String _userStructorBody_1 = this._procedureHelpers.userStructorBody(dc, true); - _builder.append(_userStructorBody_1, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// deep copy"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - String _name_10 = dc.getName(); - _builder.append(_name_10, "\t"); - _builder.append(" deepCopy() {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - String _name_11 = dc.getName(); - _builder.append(_name_11, "\t\t"); - _builder.append(" copy = new "); - String _name_12 = dc.getName(); - _builder.append(_name_12, "\t\t"); - _builder.append("();"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - String _deepCopy = this.deepCopy(dc); - _builder.append(_deepCopy, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("return copy;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - return _builder; - } - - public String paramList(final DataClass _dc) { - String result = ""; - DataClass dc = _dc; - while ((!Objects.equal(dc, null))) { - { - EList _attributes = dc.getAttributes(); - CharSequence _paramList = this.paramList(_attributes); - String _string = _paramList.toString(); - String _plus = (_string + result); - result = _plus; - DataClass _base = dc.getBase(); - dc = _base; - boolean _notEquals = (!Objects.equal(dc, null)); - if (_notEquals) { - result = (", " + result); - } - } - } - return result; - } - - private CharSequence paramList(final List attributes) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _hasElements = false; - for(final Attribute a : attributes) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - String _name = a.getName(); - _builder.append(_name, ""); - } - } - return _builder; - } - - public String argList(final DataClass dc) { - List _allAttributes = this.roomHelpers.getAllAttributes(dc); - return this._procedureHelpers.argList(_allAttributes); - } - - private String deepCopy(final DataClass _dc) { - String result = ""; - DataClass dc = _dc; - while ((!Objects.equal(dc, null))) { - { - EList _attributes = dc.getAttributes(); - CharSequence _deepCopy = this.deepCopy(_attributes); - String _string = _deepCopy.toString(); - String _plus = (_string + result); - result = _plus; - DataClass _base = dc.getBase(); - dc = _base; - } - } - return result; - } - - private CharSequence deepCopy(final List attributes) { - StringConcatenation _builder = new StringConcatenation(); - { - for(final Attribute a : attributes) { - { - RefableType _type = a.getType(); - boolean _isRef = _type.isRef(); - if (_isRef) { - _builder.append("copy."); - String _name = a.getName(); - _builder.append(_name, ""); - _builder.append(" = "); - String _name_1 = a.getName(); - _builder.append(_name_1, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } else { - RefableType _type_1 = a.getType(); - DataType _type_2 = _type_1.getType(); - if ((_type_2 instanceof ComplexType)) { - _builder.append("if ("); - String _name_2 = a.getName(); - _builder.append(_name_2, ""); - _builder.append("!=null) {"); - _builder.newLineIfNotEmpty(); - { - int _size = a.getSize(); - boolean _lessEqualsThan = (_size <= 1); - if (_lessEqualsThan) { - _builder.append("\t"); - _builder.append("copy."); - String _name_3 = a.getName(); - _builder.append(_name_3, "\t"); - _builder.append(" = "); - String _name_4 = a.getName(); - _builder.append(_name_4, "\t"); - _builder.append(".deepCopy();"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("for (int i=0;i<"); - String _name_5 = a.getName(); - _builder.append(_name_5, "\t"); - _builder.append(".length;i++){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("copy."); - String _name_6 = a.getName(); - _builder.append(_name_6, "\t\t"); - _builder.append("[i] = "); - String _name_7 = a.getName(); - _builder.append(_name_7, "\t\t"); - _builder.append("[i].deepCopy();"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - } else { - { - int _size_1 = a.getSize(); - boolean _equals = (_size_1 == 0); - if (_equals) { - _builder.append("copy."); - String _name_8 = a.getName(); - _builder.append(_name_8, ""); - _builder.append(" = "); - String _name_9 = a.getName(); - _builder.append(_name_9, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("for (int i=0;i<"); - String _name_10 = a.getName(); - _builder.append(_name_10, ""); - _builder.append(".length;i++){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("copy."); - String _name_11 = a.getName(); - _builder.append(_name_11, "\t"); - _builder.append("[i] = "); - String _name_12 = a.getName(); - _builder.append(_name_12, "\t"); - _builder.append("[i];"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - } - } - } - } - } - return _builder; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.java deleted file mode 100644 index 20799c42b..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.inject.Inject; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.room.EnumLiteral; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -/** - * @author Henrik Rentz-Reichert - */ -@SuppressWarnings("all") -public class EnumerationTypeGen { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private JavaExtensions _javaExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - public void doGenerate(final Root root) { - EList _enumClasses = root.getEnumClasses(); - final Function1 _function = (EnumerationType cl) -> { - return Boolean.valueOf(this._fileSystemHelpers.isValidGenerationLocation(cl)); - }; - Iterable _filter = IterableExtensions.filter(_enumClasses, _function); - for (final EnumerationType et : _filter) { - { - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(et); - String _path = this._roomExtensions.getPath(et); - String path = (_generationTargetPath + _path); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(et); - String _path_1 = this._roomExtensions.getPath(et); - String infopath = (_generationInfoPath + _path_1); - String file = this._javaExtensions.getJavaFileName(et); - CharSequence _generate = this.generate(root, et); - this.fileIO.generateFile("generating Enumeration implementation", path, infopath, file, _generate); - } - } - } - - public CharSequence generate(final Root root, final EnumerationType et) { - CharSequence _xblockexpression = null; - { - final String type = this._javaExtensions.getTargetType(et); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _package = this._roomExtensions.getPackage(et); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("public interface "); - String _name = et.getName(); - _builder.append(_name, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - { - EList _literals = et.getLiterals(); - for(final EnumLiteral lit : _literals) { - _builder.append("\t"); - _builder.append("static final "); - _builder.append(type, "\t"); - _builder.append(" "); - String _name_1 = lit.getName(); - _builder.append(_name_1, "\t"); - _builder.append(" = "); - long _literalValue = lit.getLiteralValue(); - _builder.append(_literalValue, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java deleted file mode 100644 index 195ac149c..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java +++ /dev/null @@ -1,361 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.PortClass; -import org.eclipse.etrice.core.room.PrimitiveType; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.generic.TypeHelpers; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@Singleton -@SuppressWarnings("all") -public class Initialization { - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private TypeHelpers typeHelpers; - - @Inject - @Extension - private JavaExtensions languageExt; - - @Inject - @Extension - private ProcedureHelpers procedureHelpers; - - public CharSequence attributeInitialization(final List attribs, final EObject roomClass, final boolean useClassDefaultsOnly) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("// initialize attributes"); - _builder.newLine(); - { - for(final Attribute a : attribs) { - CharSequence _attributeClassInit = this.attributeClassInit(a, roomClass, useClassDefaultsOnly); - _builder.append(_attributeClassInit, ""); - _builder.newLineIfNotEmpty(); - { - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - boolean _isDataClass = this.typeHelpers.isDataClass(_type_1); - if (_isDataClass) { - ArrayList _arrayList = new ArrayList(); - List _union = this._roomExtensions.union(_arrayList, a); - CharSequence _attributeInitPrimitiveRec = this.attributeInitPrimitiveRec(_union, roomClass); - _builder.append(_attributeInitPrimitiveRec, ""); - } - } - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - private CharSequence attributeClassInit(final Attribute a, final EObject roomClass, final boolean useClassDefaultsOnly) { - CharSequence _xblockexpression = null; - { - RefableType _type = a.getType(); - DataType aType = _type.getType(); - CharSequence _switchResult = null; - boolean _matched = false; - RefableType _type_1 = a.getType(); - boolean _isRef = _type_1.isRef(); - if (_isRef) { - _matched=true; - CharSequence _xifexpression = null; - String _defaultValueLiteral = a.getDefaultValueLiteral(); - boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); - if (_notEquals) { - String _defaultValueLiteral_1 = a.getDefaultValueLiteral(); - _xifexpression = this.attributeInit(a, _defaultValueLiteral_1); - } else { - CharSequence _xifexpression_1 = null; - boolean _needsInitialization = this.languageExt.needsInitialization(a); - if (_needsInitialization) { - String _nullPointer = this.languageExt.nullPointer(); - _xifexpression_1 = this.attributeInit(a, _nullPointer); - } - _xifexpression = _xifexpression_1; - } - _switchResult = _xifexpression; - } - if (!_matched) { - if (aType instanceof PrimitiveType) { - _matched=true; - CharSequence _xblockexpression_1 = null; - { - ArrayList _arrayList = new ArrayList(); - List _union = this._roomExtensions.union(_arrayList, a); - String value = this.getDataConfigValue(_union, roomClass); - boolean _equals = Objects.equal(value, null); - if (_equals) { - String _defaultValueLiteral_2 = a.getDefaultValueLiteral(); - value = _defaultValueLiteral_2; - } - CharSequence _xifexpression_2 = null; - boolean _notEquals_1 = (!Objects.equal(value, null)); - if (_notEquals_1) { - String _valueLiteral = this.languageExt.toValueLiteral(((PrimitiveType)aType), value); - _xifexpression_2 = this.attributeInit(a, _valueLiteral); - } else { - CharSequence _xifexpression_3 = null; - if (((!useClassDefaultsOnly) || - this.languageExt.needsInitialization(a))) { - String _defaultValue = this.languageExt.defaultValue(aType); - _xifexpression_3 = this.attributeInit(a, _defaultValue); - } - _xifexpression_2 = _xifexpression_3; - } - _xblockexpression_1 = _xifexpression_2; - } - _switchResult = _xblockexpression_1; - } - } - if (!_matched) { - if (aType instanceof EnumerationType) { - _matched=true; - CharSequence _xblockexpression_1 = null; - { - ArrayList _arrayList = new ArrayList(); - List _union = this._roomExtensions.union(_arrayList, a); - String value = this.getDataConfigValue(_union, roomClass); - boolean _equals = Objects.equal(value, null); - if (_equals) { - String _defaultValueLiteral_2 = a.getDefaultValueLiteral(); - value = _defaultValueLiteral_2; - } - CharSequence _xifexpression_2 = null; - boolean _notEquals_1 = (!Objects.equal(value, null)); - if (_notEquals_1) { - String _enumLiteral = this.languageExt.toEnumLiteral(((EnumerationType)aType), value); - _xifexpression_2 = this.attributeInit(a, _enumLiteral); - } else { - CharSequence _xifexpression_3 = null; - if (((!useClassDefaultsOnly) || - this.languageExt.needsInitialization(a))) { - String _defaultValue = this.languageExt.defaultValue(aType); - _xifexpression_3 = this.attributeInit(a, _defaultValue); - } - _xifexpression_2 = _xifexpression_3; - } - _xblockexpression_1 = _xifexpression_2; - } - _switchResult = _xblockexpression_1; - } - } - if (!_matched) { - String _defaultValue = this.languageExt.defaultValue(aType); - _switchResult = this.attributeInit(a, _defaultValue); - } - _xblockexpression = _switchResult; - } - return _xblockexpression; - } - - private CharSequence attributeInitPrimitiveRec(final List path, final EObject roomClass) { - Attribute a = IterableExtensions.last(path); - RefableType _type = a.getType(); - DataType aType = _type.getType(); - boolean _matched = false; - if (aType instanceof DataClass) { - _matched=true; - StringConcatenation _builder = new StringConcatenation(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType)); - for(final Attribute e : _allAttributes) { - List _union = this._roomExtensions.union(path, e); - CharSequence _attributeInitPrimitiveRec = this.attributeInitPrimitiveRec(_union, roomClass); - _builder.append(_attributeInitPrimitiveRec, ""); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - if (!_matched) { - if (aType instanceof PrimitiveType) { - _matched=true; - String value = this.getDataConfigValue(path, roomClass); - CharSequence _xifexpression = null; - boolean _notEquals = (!Objects.equal(value, null)); - if (_notEquals) { - String _valueLiteral = this.languageExt.toValueLiteral(((PrimitiveType)aType), value); - _xifexpression = this.attributeInit(path, _valueLiteral); - } - return _xifexpression; - } - } - if (!_matched) { - if (aType instanceof EnumerationType) { - _matched=true; - String value = this.getDataConfigValue(path, roomClass); - CharSequence _xifexpression = null; - boolean _notEquals = (!Objects.equal(value, null)); - if (_notEquals) { - String _enumLiteral = this.languageExt.toEnumLiteral(((EnumerationType)aType), value); - _xifexpression = this.attributeInit(path, _enumLiteral); - } - return _xifexpression; - } - } - return null; - } - - private CharSequence attributeInit(final Attribute a, final String value) { - ArrayList _arrayList = new ArrayList(); - List _union = this._roomExtensions.union(_arrayList, a); - return this.attributeInit(_union, value); - } - - private CharSequence attributeInit(final List path, final String value) { - String _xifexpression = null; - int _size = path.size(); - boolean _equals = (_size == 1); - if (_equals) { - _xifexpression = "this"; - } else { - int _size_1 = path.size(); - int _minus = (_size_1 - 1); - Iterable _take = IterableExtensions.take(path, _minus); - CharSequence _invokeGetters = this.procedureHelpers.invokeGetters(_take, null); - _xifexpression = _invokeGetters.toString(); - } - final String getter = _xifexpression; - Attribute _last = IterableExtensions.last(path); - return this.genAttributeInitializer(_last, value, getter); - } - - public CharSequence genAttributeInitializer(final Attribute a, final String value, final String invokes) { - CharSequence _xblockexpression = null; - { - RefableType _type = a.getType(); - DataType aType = _type.getType(); - StringConcatenation _builder = new StringConcatenation(); - { - if (((a.getSize() == 0) || (((a.getSize() > 0) && "char".equals(this.typeHelpers.typeName(aType))) && (!value.matches("\'.\'|\\(char\\).*"))))) { - _builder.append(invokes, ""); - _builder.append("."); - String _name = a.getName(); - CharSequence _invokeSetter = this.procedureHelpers.invokeSetter(_name, null, value); - _builder.append(_invokeSetter, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } else { - if (((!value.trim().startsWith("{")) || "char".equals(this.typeHelpers.typeName(aType)))) { - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - String _typeName = this.typeHelpers.typeName(aType); - _builder.append(_typeName, "\t"); - _builder.append("[] array = new "); - String _typeName_1 = this.typeHelpers.typeName(aType); - _builder.append(_typeName_1, "\t"); - _builder.append("["); - int _size = a.getSize(); - _builder.append(_size, "\t"); - _builder.append("];"); - _builder.newLineIfNotEmpty(); - { - boolean _not = (!(a.getType().isRef() && this.typeHelpers.isPrimitive(aType))); - if (_not) { - _builder.append("\t"); - _builder.append("for (int i=0;i<"); - int _size_1 = a.getSize(); - _builder.append(_size_1, "\t"); - _builder.append(";i++){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("array[i] = "); - _builder.append(value, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append(invokes, "\t"); - _builder.append("."); - String _name_1 = a.getName(); - CharSequence _invokeSetter_1 = this.procedureHelpers.invokeSetter(_name_1, null, "array"); - _builder.append(_invokeSetter_1, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } else { - _builder.append(invokes, ""); - _builder.append("."); - String _name_2 = a.getName(); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("new "); - String _typeName_2 = this.typeHelpers.typeName(aType); - _builder_1.append(_typeName_2, ""); - _builder_1.append("[] "); - _builder_1.append(value, ""); - CharSequence _invokeSetter_2 = this.procedureHelpers.invokeSetter(_name_2, null, _builder_1.toString()); - _builder.append(_invokeSetter_2, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private String getDataConfigValue(final List path, final EObject roomClass) { - String _switchResult = null; - boolean _matched = false; - if (roomClass instanceof ActorClass) { - _matched=true; - _switchResult = this.typeHelpers.getAttrClassConfigValue(path, ((ActorClass)roomClass), false); - } - if (!_matched) { - if (roomClass instanceof PortClass) { - _matched=true; - _switchResult = this.typeHelpers.getAttrClassConfigValue(path, ((PortClass)roomClass)); - } - } - if (!_matched) { - if (roomClass instanceof DataClass) { - _matched=true; - _switchResult = null; - } - } - return _switchResult; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java deleted file mode 100644 index 5dd7d5d04..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java +++ /dev/null @@ -1,597 +0,0 @@ -/** - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumLiteral; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.ExternalType; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.PrimitiveType; -import org.eclipse.etrice.core.room.RefableType; -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.TypeHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.util.Pair; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.StringExtensions; - -@Singleton -@SuppressWarnings("all") -public class JavaExtensions implements ILanguageExtension { - @Inject - private TypeHelpers typeHelpers; - - @Override - public String getTypedDataDefinition(final EObject msg) { - String _xifexpression = null; - if ((msg instanceof Message)) { - VarDecl _data = ((Message) msg).getData(); - String[] _generateArglistAndTypedData = this.generateArglistAndTypedData(_data); - _xifexpression = _generateArglistAndTypedData[1]; - } else { - _xifexpression = ""; - } - return _xifexpression; - } - - public String getJavaFileName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + ".java"); - } - - public String getJavaFactoryName(final ActorClass rc) { - String _name = rc.getName(); - return (_name + "Factory"); - } - - public String getJavaFactoryFileName(final ActorClass rc) { - String _javaFactoryName = this.getJavaFactoryName(rc); - return (_javaFactoryName + ".java"); - } - - public String getJavaScalarInterfaceName(final ActorClass rc) { - String _name = rc.getName(); - return (_name + "Interface"); - } - - public String getJavaScalarInterfaceFileName(final ActorClass rc) { - String _javaScalarInterfaceName = this.getJavaScalarInterfaceName(rc); - return (_javaScalarInterfaceName + ".java"); - } - - public String getJavaReplicatedInterfaceName(final ActorClass rc) { - String _name = rc.getName(); - return (_name + "ReplicatedInterface"); - } - - public String getJavaReplicatedInterfaceFileName(final ActorClass rc) { - String _javaReplicatedInterfaceName = this.getJavaReplicatedInterfaceName(rc); - return (_javaReplicatedInterfaceName + ".java"); - } - - public String getJavaInterfaceName(final ActorClass ac, final boolean replicated) { - String _xifexpression = null; - if (replicated) { - _xifexpression = this.getJavaReplicatedInterfaceName(ac); - } else { - _xifexpression = this.getJavaScalarInterfaceName(ac); - } - return _xifexpression; - } - - public String getJavaInterfaceFileName(final ActorClass ac, final boolean replicated) { - String _xifexpression = null; - if (replicated) { - _xifexpression = this.getJavaReplicatedInterfaceFileName(ac); - } else { - _xifexpression = this.getJavaScalarInterfaceFileName(ac); - } - return _xifexpression; - } - - public String getJavaClassName(final NodeRef nr, final SubSystemInstance ssi) { - String _name = nr.getName(); - String _plus = ("Node_" + _name); - String _plus_1 = (_plus + "_"); - String _name_1 = ssi.getName(); - return (_plus_1 + _name_1); - } - - public String getJavaFileName(final NodeRef nr, final SubSystemInstance ssi) { - String _javaClassName = this.getJavaClassName(nr, ssi); - return (_javaClassName + ".java"); - } - - public String toWrapper(final String type) { - String _switchResult = null; - switch (type) { - case "int": - _switchResult = "Integer"; - break; - case "char": - _switchResult = "Character"; - break; - default: - _switchResult = StringExtensions.toFirstUpper(type); - break; - } - return _switchResult; - } - - public boolean needsInitialization(final Attribute a) { - return (((a.getSize() > 0) || (!this.typeHelpers.isEnumerationOrPrimitive(a.getType().getType()))) || this.typeHelpers.typeName(a.getType().getType()).equals("String")); - } - - @Override - public String accessLevelPrivate() { - return "private "; - } - - @Override - public String accessLevelProtected() { - return "protected "; - } - - @Override - public String accessLevelPublic() { - return "public "; - } - - @Override - public String memberAccess() { - return "this."; - } - - @Override - public String selfPointer(final String classname, final boolean hasArgs) { - return ""; - } - - @Override - public String selfPointer(final boolean hasArgs) { - return ""; - } - - @Override - public String operationScope(final String classname, final boolean isDeclaration) { - return ""; - } - - @Override - public String scopeSeparator() { - return "."; - } - - @Override - public String memberInDeclaration(final String namespace, final String member) { - return member; - } - - @Override - public String memberInUse(final String namespace, final String member) { - return ((namespace + ".") + member); - } - - @Override - public boolean usesInheritance() { - return true; - } - - @Override - public boolean usesPointers() { - return false; - } - - @Override - public String genEnumeration(final String name, final List> entries) { - StringConcatenation _builder = new StringConcatenation(); - { - for(final Pair entry : entries) { - _builder.append("public static final int "); - String _first = entry.getFirst(); - _builder.append(_first, ""); - _builder.append(" = "); - String _second = entry.getSecond(); - _builder.append(_second, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - return _builder.toString(); - } - - @Override - public String booleanConstant(final boolean b) { - return Boolean.valueOf(b).toString(); - } - - @Override - public String pointerLiteral() { - return ""; - } - - @Override - public String nullPointer() { - return "null"; - } - - @Override - public String voidPointer() { - return "Object"; - } - - @Override - public String arrayType(final String type, final int size, final boolean isRef) { - return (type + "[]"); - } - - @Override - public String arrayDeclaration(final String type, final int size, final boolean isRef, final String name) { - return (((type + " ") + name) + "[]"); - } - - @Override - public String superCall(final String baseClassName, final String method, final String args) { - return (((("super." + method) + "(") + args) + ");"); - } - - @Override - public String toValueLiteral(final PrimitiveType type, final String value) { - String _xifexpression = null; - if (((!this.typeHelpers.isCharacterType(type)) && (value.contains(",") || value.contains("{")))) { - 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 _castValue = this.castValue(type, _trim_1); - _builder.append(_castValue, ""); - } - } - _builder.append(" }"); - _xblockexpression = _builder.toString(); - } - _xifexpression = _xblockexpression; - } else { - _xifexpression = this.castValue(type, value); - } - return _xifexpression; - } - - @Override - public String toEnumLiteral(final EnumerationType type, final String value) { - String _xifexpression = null; - if ((value.contains(",") || value.contains("{"))) { - 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 _convertStringEnumLiteral = this.convertStringEnumLiteral(type, _trim_1); - _builder.append(_convertStringEnumLiteral, ""); - } - } - _builder.append(" }"); - _xblockexpression = _builder.toString(); - } - _xifexpression = _xblockexpression; - } else { - _xifexpression = this.convertStringEnumLiteral(type, value); - } - return _xifexpression; - } - - private String convertStringEnumLiteral(final EnumerationType type, final String value) { - String v = value; - String _name = type.getName(); - boolean _startsWith = v.startsWith(_name); - if (_startsWith) { - String _name_1 = type.getName(); - int _length = _name_1.length(); - int _plus = (_length + 1); - String _substring = v.substring(_plus); - v = _substring; - } - EList _literals = type.getLiterals(); - for (final EnumLiteral l : _literals) { - String _name_2 = l.getName(); - boolean _equals = _name_2.equals(v); - if (_equals) { - String _name_3 = type.getName(); - String _plus_1 = (_name_3 + "."); - String _name_4 = l.getName(); - return (_plus_1 + _name_4); - } - } - return null; - } - - private String castValue(final PrimitiveType type, final String value) { - String _switchResult = null; - String _targetName = type.getTargetName(); - switch (_targetName) { - case "boolean": - _switchResult = value.toLowerCase(); - break; - case "byte": - _switchResult = ("(byte)" + value); - break; - case "short": - _switchResult = ("(short)" + value); - break; - case "int": - _switchResult = value; - break; - case "long": - _switchResult = (value + "L"); - break; - case "float": - _switchResult = (value + "f"); - break; - case "double": - _switchResult = (value + "d"); - break; - case "char": - String _xifexpression = null; - boolean _isEmpty = value.isEmpty(); - if (_isEmpty) { - _xifexpression = "(char) 0"; - } else { - String _xifexpression_1 = null; - int _length = value.length(); - boolean _equals = (_length == 1); - if (_equals) { - char _charAt = value.charAt(0); - String _plus = ("\'" + Character.valueOf(_charAt)); - _xifexpression_1 = (_plus + "\'"); - } else { - String _replace = value.replace("\\", "\\\\"); - String _replace_1 = _replace.replace("\"", "\\\""); - String _plus_1 = ("\"" + _replace_1); - _xifexpression_1 = (_plus_1 + "\".toCharArray()"); - } - _xifexpression = _xifexpression_1; - } - _switchResult = _xifexpression; - break; - case "String": - String _replace_2 = value.replace("\\", "\\\\"); - String _replace_3 = _replace_2.replace("\"", "\\\""); - String _plus_2 = ("\"" + _replace_3); - _switchResult = (_plus_2 + "\""); - break; - default: - String _targetName_1 = type.getTargetName(); - throw new UnsupportedOperationException(_targetName_1); - } - return _switchResult; - } - - @Override - public String defaultValue(final DataType dt) { - String _switchResult = null; - boolean _matched = false; - if (dt instanceof PrimitiveType) { - _matched=true; - String _defaultValueLiteral = ((PrimitiveType)dt).getDefaultValueLiteral(); - _switchResult = this.toValueLiteral(((PrimitiveType)dt), _defaultValueLiteral); - } - if (!_matched) { - if (dt instanceof EnumerationType) { - _matched=true; - _switchResult = this.getDefaultValue(((EnumerationType)dt)); - } - } - if (!_matched) { - if (dt instanceof ExternalType) { - _matched=true; - String _targetName = ((ExternalType) dt).getTargetName(); - String _plus = ("new " + _targetName); - _switchResult = (_plus + "()"); - } - } - if (!_matched) { - String _name = dt.getName(); - String _plus = ("new " + _name); - _switchResult = (_plus + "()"); - } - return _switchResult; - } - - public String getDefaultValue(final EnumerationType type) { - String _xifexpression = null; - EList _literals = type.getLiterals(); - boolean _isEmpty = _literals.isEmpty(); - if (_isEmpty) { - _xifexpression = ""; - } else { - EList _literals_1 = type.getLiterals(); - EnumLiteral _get = _literals_1.get(0); - _xifexpression = this.getCastedValue(_get); - } - return _xifexpression; - } - - @Override - public String initializationWithDefaultValues(final DataType dt, final int size) { - String _xblockexpression = null; - { - final String dv = this.defaultValue(dt); - String _xifexpression = null; - if ((size > 1)) { - String _xblockexpression_1 = null; - { - String res = "{"; - int i = 0; - while ((i < size)) { - { - res = (res + dv); - i = (i + 1); - if ((i < size)) { - res = (res + ","); - } - } - } - _xblockexpression_1 = (res + "}"); - } - _xifexpression = _xblockexpression_1; - } else { - _xifexpression = dv; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - @Override - public String[] generateArglistAndTypedData(final EObject d) { - if ((Objects.equal(d, null) || (!(d instanceof VarDecl)))) { - return ((String[])Conversions.unwrapArray(CollectionLiterals.newArrayList("", "", ""), String.class)); - } - final VarDecl data = ((VarDecl) d); - RefableType _refType = data.getRefType(); - DataType _type = _refType.getType(); - String typeName = _type.getName(); - String castTypeName = typeName; - RefableType _refType_1 = data.getRefType(); - DataType _type_1 = _refType_1.getType(); - if ((_type_1 instanceof PrimitiveType)) { - RefableType _refType_2 = data.getRefType(); - DataType _type_2 = _refType_2.getType(); - String _targetName = ((PrimitiveType) _type_2).getTargetName(); - typeName = _targetName; - RefableType _refType_3 = data.getRefType(); - DataType _type_3 = _refType_3.getType(); - final String ct = ((PrimitiveType) _type_3).getCastName(); - if (((!Objects.equal(ct, null)) && (!ct.isEmpty()))) { - castTypeName = ct; - } - } else { - RefableType _refType_4 = data.getRefType(); - DataType _type_4 = _refType_4.getType(); - if ((_type_4 instanceof EnumerationType)) { - RefableType _refType_5 = data.getRefType(); - DataType _type_5 = _refType_5.getType(); - String _targetType = this.getTargetType(((EnumerationType) _type_5)); - typeName = _targetType; - RefableType _refType_6 = data.getRefType(); - DataType _type_6 = _refType_6.getType(); - String _castType = this.getCastType(((EnumerationType) _type_6)); - castTypeName = _castType; - } - } - String _name = data.getName(); - String _plus = ((typeName + " ") + _name); - String _plus_1 = (_plus + " = ("); - String _plus_2 = (_plus_1 + castTypeName); - final String typedData = (_plus_2 + ") generic_data__et;\n"); - String _name_1 = data.getName(); - final String dataArg = (", " + _name_1); - String _name_2 = data.getName(); - final String typedArgList = (((", " + typeName) + " ") + _name_2); - return ((String[])Conversions.unwrapArray(CollectionLiterals.newArrayList(dataArg, typedData, typedArgList), String.class)); - } - - @Override - public String getTargetType(final EnumerationType type) { - String _xifexpression = null; - PrimitiveType _primitiveType = type.getPrimitiveType(); - boolean _notEquals = (!Objects.equal(_primitiveType, null)); - if (_notEquals) { - PrimitiveType _primitiveType_1 = type.getPrimitiveType(); - _xifexpression = _primitiveType_1.getTargetName(); - } else { - _xifexpression = "int"; - } - return _xifexpression; - } - - @Override - public String getCastedValue(final EnumLiteral literal) { - String _xblockexpression = null; - { - EObject _eContainer = literal.eContainer(); - final EnumerationType type = ((EnumerationType) _eContainer); - final String cast = this.getTargetType(type); - String _xifexpression = null; - PrimitiveType _primitiveType = type.getPrimitiveType(); - boolean _equals = Objects.equal(_primitiveType, null); - if (_equals) { - long _literalValue = literal.getLiteralValue(); - _xifexpression = Long.toString(_literalValue); - } else { - long _literalValue_1 = literal.getLiteralValue(); - String _string = Long.toString(_literalValue_1); - String _plus = ((("((" + cast) + ")") + _string); - _xifexpression = (_plus + ")"); - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - @Override - public String getCastType(final EnumerationType type) { - String _xifexpression = null; - PrimitiveType _primitiveType = type.getPrimitiveType(); - boolean _notEquals = (!Objects.equal(_primitiveType, null)); - if (_notEquals) { - PrimitiveType _primitiveType_1 = type.getPrimitiveType(); - _xifexpression = _primitiveType_1.getCastName(); - } else { - _xifexpression = "int"; - } - return _xifexpression; - } - - @Override - public String makeOverridable() { - return ""; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/MainGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/MainGen.java deleted file mode 100644 index 7ba4c6b4b..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/MainGen.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.generator.generic.PrepareFileSystem; -import org.eclipse.etrice.generator.java.Main; -import org.eclipse.etrice.generator.java.gen.ActorClassDataGen; -import org.eclipse.etrice.generator.java.gen.ActorClassGen; -import org.eclipse.etrice.generator.java.gen.DataClassGen; -import org.eclipse.etrice.generator.java.gen.EnumerationTypeGen; -import org.eclipse.etrice.generator.java.gen.GlobalSettings; -import org.eclipse.etrice.generator.java.gen.NodeGen; -import org.eclipse.etrice.generator.java.gen.NodeRunnerGen; -import org.eclipse.etrice.generator.java.gen.OptionalActorFactoryGen; -import org.eclipse.etrice.generator.java.gen.OptionalActorInterfaceGen; -import org.eclipse.etrice.generator.java.gen.ProtocolClassGen; - -@Singleton -@SuppressWarnings("all") -public class MainGen { - @Inject - private DataClassGen dataClassGen; - - @Inject - private EnumerationTypeGen enumTypeGen; - - @Inject - private ProtocolClassGen protocolClassGen; - - @Inject - private ActorClassGen actorClassGen; - - @Inject - private ActorClassDataGen actorClassDataGen; - - @Inject - private OptionalActorInterfaceGen optionalActorInterfaceGen; - - @Inject - private OptionalActorFactoryGen optionalActorFactoryGen; - - @Inject - private NodeGen nodeGen; - - @Inject - private NodeRunnerGen nodeRunnerGen; - - @Inject - private PrepareFileSystem prepFS; - - public void doGenerate(final Resource resource) { - this.prepFS.prepareCodeTargetPaths(resource); - EList _contents = resource.getContents(); - for (final EObject e : _contents) { - if ((e instanceof Root)) { - this.doGenerate(((Root) e)); - } - } - } - - public void doGenerate(final Root e) { - this.dataClassGen.doGenerate(e); - this.enumTypeGen.doGenerate(e); - this.protocolClassGen.doGenerate(e); - this.actorClassGen.doGenerate(e); - GlobalSettings _settings = Main.getSettings(); - boolean _isGenerateStoreDataObj = _settings.isGenerateStoreDataObj(); - if (_isGenerateStoreDataObj) { - this.actorClassDataGen.doGenerate(e); - } - this.optionalActorInterfaceGen.doGenerate(e); - this.optionalActorFactoryGen.doGenerate(e); - this.nodeGen.doGenerate(e); - boolean _isLibrary = e.isLibrary(); - boolean _not = (!_isLibrary); - if (_not) { - this.nodeRunnerGen.doGenerate(e); - } - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java deleted file mode 100644 index 97e91558c..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java +++ /dev/null @@ -1,844 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.etrice.core.etmap.util.ETMapUtil; -import org.eclipse.etrice.core.etphys.eTPhys.ExecMode; -import org.eclipse.etrice.core.etphys.eTPhys.NodeClass; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread; -import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants; -import org.eclipse.etrice.core.genmodel.etricegen.AbstractInstance; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInterfaceInstance; -import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase; -import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance; -import org.eclipse.etrice.core.genmodel.etricegen.OptionalActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance; -import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.genmodel.etricegen.Wire; -import org.eclipse.etrice.core.genmodel.etricegen.WiredStructureClass; -import org.eclipse.etrice.core.genmodel.etricegen.WiredSubSystemClass; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.IDiagnostician; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorRef; -import org.eclipse.etrice.core.room.CommunicationType; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.generator.base.IDataConfiguration; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.fsm.base.Indexed; -import org.eclipse.etrice.generator.fsm.base.IntelligentSeparator; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.java.Main; -import org.eclipse.etrice.generator.java.gen.ConfigGenAddon; -import org.eclipse.etrice.generator.java.gen.GlobalSettings; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.etrice.generator.java.gen.VariableServiceGen; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.IteratorExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; - -@Singleton -@SuppressWarnings("all") -public class NodeGen { - @Inject - @Extension - private JavaExtensions _javaExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - private IDataConfiguration dataConfigExt; - - @Inject - private ConfigGenAddon configGenAddon; - - @Inject - @Extension - private ProcedureHelpers _procedureHelpers; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - @Inject - private IGeneratorFileIo fileIO; - - @Inject - private VariableServiceGen varService; - - @Inject - private IDiagnostician diagnostician; - - public void doGenerate(final Root root) { - final HashMap sscc2wired = new HashMap(); - EList _wiredInstances = root.getWiredInstances(); - final Function1 _function = (WiredStructureClass w) -> { - return Boolean.valueOf((w instanceof WiredSubSystemClass)); - }; - Iterable _filter = IterableExtensions.filter(_wiredInstances, _function); - final Consumer _function_1 = (WiredStructureClass w) -> { - SubSystemClass _subSystemClass = ((WiredSubSystemClass) w).getSubSystemClass(); - sscc2wired.put(_subSystemClass, ((WiredSubSystemClass) w)); - }; - _filter.forEach(_function_1); - Collection _nodeRefs = ETMapUtil.getNodeRefs(); - for (final NodeRef nr : _nodeRefs) { - List _subSystemInstancePaths = ETMapUtil.getSubSystemInstancePaths(nr); - for (final String instpath : _subSystemInstancePaths) { - { - StructureInstance _instance = root.getInstance(instpath); - final SubSystemInstance ssi = ((SubSystemInstance) _instance); - if (((!Objects.equal(ssi, null)) && this._fileSystemHelpers.isValidGenerationLocation(ssi.getSubSystemClass()))) { - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - final WiredSubSystemClass wired = sscc2wired.get(_subSystemClass); - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass_1); - SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String _path = this._roomExtensions.getPath(_subSystemClass_2); - final String path = (_generationTargetPath + _path); - SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_subSystemClass_3); - SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass(); - String _path_1 = this._roomExtensions.getPath(_subSystemClass_4); - final String infopath = (_generationInfoPath + _path_1); - final String file = this._javaExtensions.getJavaFileName(nr, ssi); - this.checkDataPorts(ssi); - final Set usedThreads = ETMapUtil.getUsedThreads(nr, ssi); - CharSequence _generate = this.generate(root, ssi, wired, usedThreads); - this.fileIO.generateFile("generating Node implementation", path, infopath, file, _generate); - boolean _hasVariableService = this.dataConfigExt.hasVariableService(ssi); - if (_hasVariableService) { - this.varService.doGenerate(root, ssi); - } - } - } - } - } - } - - /** - * Recursively collect all possible interface instances below a given structure instance. - */ - private HashSet getOptionalActorClasses(final Root root, final StructureInstance si) { - TreeIterator _eAllContents = si.eAllContents(); - final Function1 _function = (EObject i) -> { - return Boolean.valueOf((i instanceof ActorInterfaceInstance)); - }; - Iterator _filter = IteratorExtensions.filter(_eAllContents, _function); - final Function1 _function_1 = (EObject aii) -> { - return ((ActorInterfaceInstance) aii); - }; - Iterator _map = IteratorExtensions.map(_filter, _function_1); - final ArrayList aifs = Lists.newArrayList(_map); - final Function1 _function_2 = (ActorInterfaceInstance aii) -> { - return ((ActorInterfaceInstance) aii).getActorClass(); - }; - List _map_1 = ListExtensions.map(aifs, _function_2); - final HashSet result = Sets.newHashSet(_map_1); - for (final ActorInterfaceInstance ai : aifs) { - EList _optionalInstances = ai.getOptionalInstances(); - for (final OptionalActorInstance oi : _optionalInstances) { - HashSet _optionalActorClasses = this.getOptionalActorClasses(root, oi); - result.addAll(_optionalActorClasses); - } - } - return result; - } - - public CharSequence generate(final Root root, final SubSystemInstance comp, final WiredSubSystemClass wired, final Collection usedThreads) { - CharSequence _xblockexpression = null; - { - final SubSystemClass cc = comp.getSubSystemClass(); - final EList models = root.getReferencedModels(cc); - final NodeRef nr = ETMapUtil.getNodeRef(comp); - final String clsname = this._javaExtensions.getJavaClassName(nr, comp); - NodeClass _type = nr.getType(); - EList _threads = _type.getThreads(); - final Function1 _function = (PhysicalThread t) -> { - return Boolean.valueOf(usedThreads.contains(t)); - }; - final Iterable threads = IterableExtensions.filter(_threads, _function); - final HashSet opt = this.getOptionalActorClasses(root, comp); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _package = this._roomExtensions.getPackage(cc); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.config.IVariableService;"); - _builder.newLine(); - { - GlobalSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("import org.eclipse.etrice.runtime.java.debugging.DebuggingService;"); - _builder.newLine(); - } - } - _builder.append("import org.eclipse.etrice.runtime.java.messaging.IRTObject;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.messaging.IMessageService;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.messaging.MessageService;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.messaging.MessageServiceController;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.messaging.RTServices;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.ActorClassBase;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.DataPortBase;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.OptionalActorInterfaceBase;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.IOptionalActorFactory;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBroker;"); - _builder.newLine(); - _builder.newLine(); - { - for(final RoomModel model : models) { - _builder.append("import "); - String _name = model.getName(); - _builder.append(_name, ""); - _builder.append(".*;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(cc, 1, false); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("public class "); - _builder.append(clsname, ""); - _builder.append(" extends SubSystemClassBase {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - Iterable> _indexed = Indexed.indexed(threads); - for(final Indexed thread : _indexed) { - _builder.append("\t"); - _builder.append("public static final int "); - PhysicalThread _value = thread.getValue(); - String _threadId = this.getThreadId(_value); - _builder.append(_threadId, "\t"); - _builder.append(" = "); - int _index0 = thread.getIndex0(); - _builder.append(_index0, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - CharSequence _userCode_1 = this._procedureHelpers.userCode(cc, 2, false); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - _builder.append(clsname, "\t"); - _builder.append("(IRTObject parent, String name) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("super(parent, name);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void receiveEvent(InterfaceItemBase ifitem, int evt, Object data){"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void instantiateMessageServices() {"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("IMessageService msgService;"); - _builder.newLine(); - { - final Function1 _function_1 = (PhysicalThread it) -> { - long _prio = it.getPrio(); - return Long.valueOf((-_prio)); - }; - List _sortBy = IterableExtensions.sortBy(threads, _function_1); - for(final PhysicalThread thread_1 : _sortBy) { - { - if ((Objects.equal(thread_1.getExecmode(), ExecMode.POLLED) || Objects.equal(thread_1.getExecmode(), ExecMode.MIXED))) { - _builder.append("\t\t"); - _builder.append("msgService = new MessageService(this, MessageService.ExecMode."); - ExecMode _execmode = thread_1.getExecmode(); - String _name_1 = _execmode.getName(); - _builder.append(_name_1, "\t\t"); - _builder.append(", "); - long _time = thread_1.getTime(); - _builder.append(_time, "\t\t"); - _builder.append("L, 0, "); - String _threadId_1 = this.getThreadId(thread_1); - _builder.append(_threadId_1, "\t\t"); - _builder.append(", \"MessageService_"); - String _name_2 = thread_1.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append("\" /*, thread_prio */);"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t\t"); - _builder.append("msgService = new MessageService(this, MessageService.ExecMode."); - ExecMode _execmode_1 = thread_1.getExecmode(); - String _name_3 = _execmode_1.getName(); - _builder.append(_name_3, "\t\t"); - _builder.append(", 0, "); - String _threadId_2 = this.getThreadId(thread_1); - _builder.append(_threadId_2, "\t\t"); - _builder.append(", \"MessageService_"); - String _name_4 = thread_1.getName(); - _builder.append(_name_4, "\t\t"); - _builder.append("\" /*, thread_prio */);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("RTServices.getInstance().getMsgSvcCtrl().addMsgSvc(msgService);"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void instantiateActors() {"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// thread mappings"); - _builder.newLine(); - { - EList _allContainedInstances = comp.getAllContainedInstances(); - for(final ActorInstance ai : _allContainedInstances) { - _builder.append("\t\t"); - final ETMapUtil.MappedThread mapped = ETMapUtil.getMappedThread(ai); - _builder.newLineIfNotEmpty(); - { - boolean _not = (!(mapped.isImplicit() || mapped.isAsParent())); - if (_not) { - _builder.append("\t\t"); - _builder.append("addPathToThread(\""); - String _path = ai.getPath(); - _builder.append(_path, "\t\t"); - _builder.append("\", "); - PhysicalThread _thread = mapped.getThread(); - String _threadId_3 = this.getThreadId(_thread); - _builder.append(_threadId_3, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// sub actors"); - _builder.newLine(); - { - EList _actorRefs = cc.getActorRefs(); - for(final ActorRef sub : _actorRefs) { - { - int _multiplicity = sub.getMultiplicity(); - boolean _greaterThan = (_multiplicity > 1); - if (_greaterThan) { - _builder.append("\t\t"); - _builder.append("for (int i=0; i<"); - int _multiplicity_1 = sub.getMultiplicity(); - _builder.append(_multiplicity_1, "\t\t"); - _builder.append("; ++i) {"); - _builder.newLineIfNotEmpty(); - { - GlobalSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("DebuggingService.getInstance().addMessageActorCreate(this, \""); - String _name_5 = sub.getName(); - _builder.append(_name_5, "\t\t\t"); - _builder.append(GenmodelConstants.INDEX_SEP, "\t\t\t"); - _builder.append("\"+i);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("new "); - ActorClass _type_1 = sub.getType(); - String _name_6 = _type_1.getName(); - _builder.append(_name_6, "\t\t\t"); - _builder.append("(this, \""); - String _name_7 = sub.getName(); - _builder.append(_name_7, "\t\t\t"); - _builder.append(GenmodelConstants.INDEX_SEP, "\t\t\t"); - _builder.append("\"+i);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } else { - { - GlobalSettings _settings_2 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_2) { - _builder.append("\t\t"); - _builder.append("DebuggingService.getInstance().addMessageActorCreate(this, \""); - String _name_8 = sub.getName(); - _builder.append(_name_8, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("new "); - ActorClass _type_2 = sub.getType(); - String _name_9 = _type_2.getName(); - _builder.append(_name_9, "\t\t"); - _builder.append("(this, \""); - String _name_10 = sub.getName(); - _builder.append(_name_10, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// create service brokers in optional actor interfaces"); - _builder.newLine(); - { - BasicEList _allSubInstances = this._roomExtensions.getAllSubInstances(comp); - final Function1 _function_2 = (AbstractInstance inst) -> { - return Boolean.valueOf((inst instanceof ActorInterfaceInstance)); - }; - Iterable _filter = IterableExtensions.filter(_allSubInstances, _function_2); - final Function1 _function_3 = (AbstractInstance inst) -> { - return ((ActorInterfaceInstance) inst); - }; - Iterable _map = IterableExtensions.map(_filter, _function_3); - for(final ActorInterfaceInstance aii : _map) { - _builder.append("\t\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("OptionalActorInterfaceBase oai = (OptionalActorInterfaceBase) getObject(\""); - String _path_1 = aii.getPath(); - _builder.append(_path_1, "\t\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - { - EList _providedServices = aii.getProvidedServices(); - for(final ServiceImplInstance svc : _providedServices) { - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("new InterfaceItemBroker(oai, \""); - ProtocolClass _protocol = svc.getProtocol(); - String _fullyQualifiedName = this._roomExtensions.getFullyQualifiedName(_protocol); - _builder.append(_fullyQualifiedName, "\t\t\t"); - _builder.append("\", 0);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("InterfaceItemBase.connect(this, \""); - String _path_2 = svc.getPath(); - _builder.append(_path_2, "\t\t\t"); - _builder.append("\", \""); - String _path_3 = aii.getPath(); - String _plus = (_path_3 + Character.valueOf(InstanceBase.pathDelim)); - ProtocolClass _protocol_1 = svc.getProtocol(); - String _fullyQualifiedName_1 = this._roomExtensions.getFullyQualifiedName(_protocol_1); - String _plus_1 = (_plus + _fullyQualifiedName_1); - _builder.append(_plus_1, "\t\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// wiring"); - _builder.newLine(); - { - EList _wires = wired.getWires(); - for(final Wire wire : _wires) { - _builder.append("\t\t"); - String _xifexpression = null; - boolean _isDataDriven = wire.isDataDriven(); - if (_isDataDriven) { - _xifexpression = "DataPortBase"; - } else { - _xifexpression = "InterfaceItemBase"; - } - _builder.append(_xifexpression, "\t\t"); - _builder.append(".connect(this, \""); - EList _path1 = wire.getPath1(); - String _join = IterableExtensions.join(_path1, "/"); - _builder.append(_join, "\t\t"); - _builder.append("\", \""); - EList _path2 = wire.getPath2(); - String _join_1 = IterableExtensions.join(_path2, "/"); - _builder.append(_join_1, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// apply instance attribute configurations"); - _builder.newLine(); - { - EList _allContainedInstances_1 = comp.getAllContainedInstances(); - for(final ActorInstance ai_1 : _allContainedInstances_1) { - _builder.append("\t\t"); - final CharSequence cfg = this.configGenAddon.genActorInstanceConfig(ai_1, "inst"); - _builder.newLineIfNotEmpty(); - { - int _length = cfg.length(); - boolean _greaterThan_1 = (_length > 0); - if (_greaterThan_1) { - _builder.append("\t\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - ActorClass _actorClass = ai_1.getActorClass(); - String _name_11 = _actorClass.getName(); - _builder.append(_name_11, "\t\t\t"); - _builder.append(" inst = ("); - ActorClass _actorClass_1 = ai_1.getActorClass(); - String _name_12 = _actorClass_1.getName(); - _builder.append(_name_12, "\t\t\t"); - _builder.append(") getObject(\""); - String _path_4 = ai_1.getPath(); - _builder.append(_path_4, "\t\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("if (inst!=null) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t\t"); - _builder.append(cfg, "\t\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } - } - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void init(){"); - _builder.newLine(); - { - GlobalSettings _settings_3 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_3 = _settings_3.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_3) { - _builder.append("\t\t"); - _builder.append("DebuggingService.getInstance().addVisibleComment(\"begin sub system initialization\");"); - _builder.newLine(); - } - } - { - boolean _hasVariableService = this.dataConfigExt.hasVariableService(comp); - if (_hasVariableService) { - _builder.append("\t\t"); - _builder.append("variableService = new "); - _builder.append(clsname, "\t\t"); - _builder.append("VariableService(this);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("super.init();"); - _builder.newLine(); - { - boolean _hasVariableService_1 = this.dataConfigExt.hasVariableService(comp); - if (_hasVariableService_1) { - _builder.append("\t\t"); - _builder.append("variableService.init();"); - _builder.newLine(); - } - } - { - GlobalSettings _settings_4 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_4 = _settings_4.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_4) { - _builder.append("\t\t"); - _builder.append("DebuggingService.getInstance().addVisibleComment(\"done sub system initialization\");"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void stop(){"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("super.stop();"); - _builder.newLine(); - { - boolean _hasVariableService_2 = this.dataConfigExt.hasVariableService(comp); - if (_hasVariableService_2) { - _builder.append("\t\t"); - _builder.append("variableService.stop();"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - { - GlobalSettings _settings_5 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_5 = _settings_5.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_5) { - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public boolean hasGeneratedMSCInstrumentation() {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("return true;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void destroy() {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("DebuggingService.getInstance().addVisibleComment(\"begin sub system destruction\");"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("super.destroy();"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("DebuggingService.getInstance().addVisibleComment(\"done sub system destruction\");"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("public IOptionalActorFactory getFactory(String optionalActorClass, String actorClass) {"); - _builder.newLine(); - _builder.append("\t\t"); - final IntelligentSeparator else1 = new IntelligentSeparator("else "); - _builder.newLineIfNotEmpty(); - { - for(final ActorClass oa : opt) { - _builder.append("\t\t"); - _builder.append(else1, "\t\t"); - _builder.append("if (optionalActorClass.equals(\""); - String _name_13 = oa.getName(); - _builder.append(_name_13, "\t\t"); - _builder.append("\")) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - final IntelligentSeparator else2 = new IntelligentSeparator("else "); - _builder.newLineIfNotEmpty(); - { - EList _subClasses = root.getSubClasses(oa); - List _union = this._roomExtensions.union(_subClasses, oa); - final Function1 _function_4 = (ActorClass s) -> { - boolean _isAbstract = s.isAbstract(); - return Boolean.valueOf((!_isAbstract)); - }; - Iterable _filter_1 = IterableExtensions.filter(_union, _function_4); - for(final ActorClass subcls : _filter_1) { - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append(else2, "\t\t\t"); - _builder.append("if (\""); - String _name_14 = subcls.getName(); - _builder.append(_name_14, "\t\t\t"); - _builder.append("\".equals(actorClass)) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("return new "); - String _javaFactoryName = this._javaExtensions.getJavaFactoryName(subcls); - _builder.append(_javaFactoryName, "\t\t\t\t"); - _builder.append("();"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return null;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private String getThreadId(final PhysicalThread thread) { - String _name = thread.getName(); - String _upperCase = _name.toUpperCase(); - return ("THREAD_" + _upperCase); - } - - private void checkDataPorts(final SubSystemInstance comp) { - final HashSet found = new HashSet(); - EList _allContainedInstances = comp.getAllContainedInstances(); - for (final ActorInstance ai : _allContainedInstances) { - { - final int thread = ai.getThreadId(); - EList _orderedIfItemInstances = ai.getOrderedIfItemInstances(); - for (final InterfaceItemInstance pi : _orderedIfItemInstances) { - ProtocolClass _protocol = pi.getProtocol(); - CommunicationType _commType = _protocol.getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN); - if (_equals) { - EList _peers = pi.getPeers(); - for (final InterfaceItemInstance peer : _peers) { - { - EObject _eContainer = peer.eContainer(); - final ActorInstance peer_ai = ((ActorInstance) _eContainer); - final int peer_thread = peer_ai.getThreadId(); - if ((thread != peer_thread)) { - final String path = pi.getPath(); - final String ppath = peer.getPath(); - String _xifexpression = null; - int _compareTo = path.compareTo(ppath); - boolean _lessThan = (_compareTo < 0); - if (_lessThan) { - _xifexpression = ((path + " and ") + ppath); - } else { - _xifexpression = ((ppath + " and ") + path); - } - final String pair = _xifexpression; - boolean _contains = found.contains(pair); - boolean _not = (!_contains); - if (_not) { - found.add(pair); - InterfaceItem _interfaceItem = pi.getInterfaceItem(); - InterfaceItem _interfaceItem_1 = pi.getInterfaceItem(); - EStructuralFeature _eContainingFeature = _interfaceItem_1.eContainingFeature(); - this.diagnostician.error((pair + ": data ports placed on different threads (not supported yet)"), _interfaceItem, _eContainingFeature); - } - } - } - } - } - } - } - } - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.java deleted file mode 100644 index b8180a1eb..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.java +++ /dev/null @@ -1,183 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.Collection; -import java.util.List; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.etmap.util.ETMapUtil; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SystemInstance; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; - -@Singleton -@SuppressWarnings("all") -public class NodeRunnerGen { - @Inject - @Extension - private RoomExtensions roomExt; - - @Inject - @Extension - private JavaExtensions _javaExtensions; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - @Inject - private IGeneratorFileIo fileIO; - - public void doGenerate(final Root root) { - Collection _nodeRefs = ETMapUtil.getNodeRefs(); - for (final NodeRef nr : _nodeRefs) { - List _subSystemInstancePaths = ETMapUtil.getSubSystemInstancePaths(nr); - for (final String instpath : _subSystemInstancePaths) { - { - StructureInstance _instance = root.getInstance(instpath); - final SubSystemInstance ssi = ((SubSystemInstance) _instance); - if (((!Objects.equal(ssi, null)) && this._fileSystemHelpers.isValidGenerationLocation(ssi.getSubSystemClass()))) { - String _javaClassName = this._javaExtensions.getJavaClassName(nr, ssi); - final String file = (_javaClassName + "Runner.java"); - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass); - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - String _path = this.roomExt.getPath(_subSystemClass_1); - final String filepath = (_generationTargetPath + _path); - SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String _generationInfoPath = this.roomExt.getGenerationInfoPath(_subSystemClass_2); - SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - String _path_1 = this.roomExt.getPath(_subSystemClass_3); - final String infopath = (_generationInfoPath + _path_1); - CharSequence _generate = this.generate(root, ssi); - this.fileIO.generateFile("generating SubSystemRunner implementation", filepath, infopath, file, _generate); - } - } - } - } - } - - public CharSequence generate(final Root root, final SubSystemInstance ssc) { - CharSequence _xblockexpression = null; - { - final SubSystemClass cc = ssc.getSubSystemClass(); - final NodeRef nr = ETMapUtil.getNodeRef(ssc); - final String clsname = this._javaExtensions.getJavaClassName(nr, ssc); - 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("* this class contains the main function running component "); - String _name = ssc.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* it instantiates "); - String _name_1 = ssc.getName(); - _builder.append(_name_1, " "); - _builder.append(" and starts and ends the lifecycle"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("package "); - String _package = this.roomExt.getPackage(cc); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.RTSystem;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.SubSystemRunnerBase;"); - _builder.newLine(); - _builder.newLine(); - _builder.append("public class "); - _builder.append((clsname + "Runner"), ""); - _builder.append(" extends SubSystemRunnerBase {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* main function"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* creates the main component and starts and stops the lifecycle"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public static void main(String[] args) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// instantiate the main component"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("RTSystem sys = "); - { - EObject _eContainer = ssc.eContainer(); - if ((_eContainer instanceof SystemInstance)) { - _builder.append("new RTSystem(\""); - EObject _eContainer_1 = ssc.eContainer(); - String _name_2 = ((SystemInstance) _eContainer_1).getName(); - _builder.append(_name_2, "\t\t"); - _builder.append("\")"); - } else { - _builder.append("null"); - } - } - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append(clsname, "\t\t"); - _builder.append(" main_component = new "); - _builder.append(clsname, "\t\t"); - _builder.append("(sys, \""); - String _name_3 = ssc.getName(); - _builder.append(_name_3, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("run(main_component, args);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java deleted file mode 100644 index 751ba4211..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import java.util.HashMap; -import java.util.List; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.genmodel.etricegen.OpenBinding; -import org.eclipse.etrice.core.genmodel.etricegen.OpenServiceConnection; -import org.eclipse.etrice.core.genmodel.etricegen.OptionalActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.WiredActorClass; -import org.eclipse.etrice.core.genmodel.etricegen.WiredStructureClass; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.CommunicationType; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@SuppressWarnings("all") -public class OptionalActorFactoryGen { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private RoomHelpers _roomHelpers; - - @Inject - @Extension - private JavaExtensions _javaExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - public void doGenerate(final Root root) { - final HashMap ac2wired = new HashMap(); - EList _wiredInstances = root.getWiredInstances(); - final Function1 _function = (WiredStructureClass w) -> { - return Boolean.valueOf((w instanceof WiredActorClass)); - }; - Iterable _filter = IterableExtensions.filter(_wiredInstances, _function); - final Consumer _function_1 = (WiredStructureClass w) -> { - ActorClass _actorClass = ((WiredActorClass) w).getActorClass(); - ac2wired.put(_actorClass, ((WiredActorClass) w)); - }; - _filter.forEach(_function_1); - EList _optionalInstances = root.getOptionalInstances(); - final Function1 _function_2 = (OptionalActorInstance cl) -> { - ActorClass _actorClass = cl.getActorClass(); - return Boolean.valueOf(this._fileSystemHelpers.isValidGenerationLocation(_actorClass)); - }; - Iterable _filter_1 = IterableExtensions.filter(_optionalInstances, _function_2); - for (final OptionalActorInstance oi : _filter_1) { - { - final ActorClass ac = oi.getActorClass(); - final WiredActorClass wired = ac2wired.get(ac); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(ac); - String _path = this._roomExtensions.getPath(ac); - final String path = (_generationTargetPath + _path); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(ac); - String _path_1 = this._roomExtensions.getPath(ac); - final String infopath = (_generationInfoPath + _path_1); - final String file = this._javaExtensions.getJavaFactoryFileName(ac); - CharSequence _generate = this.generate(root, oi, wired); - this.fileIO.generateFile("generating ActorClass Interface implementation", path, infopath, file, _generate); - } - } - } - - public CharSequence generate(final Root root, final OptionalActorInstance oi, final WiredActorClass wired) { - CharSequence _xblockexpression = null; - { - final ActorClass ac = oi.getActorClass(); - final String clsname = this._javaExtensions.getJavaFactoryName(ac); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _package = this._roomExtensions.getPackage(ac); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("import "); - String _package_1 = this._roomExtensions.getPackage(ac); - _builder.append(_package_1, ""); - _builder.append("."); - String _name = ac.getName(); - _builder.append(_name, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.OptionalActorInterfaceBase;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.IOptionalActorFactory;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;"); - _builder.newLine(); - _builder.newLine(); - _builder.append("public class "); - _builder.append(clsname, ""); - _builder.append(" implements IOptionalActorFactory {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - String _name_1 = ac.getName(); - _builder.append(_name_1, "\t"); - _builder.append(" create(OptionalActorInterfaceBase ai, String name) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("// instantiate sub tree"); - _builder.newLine(); - _builder.append("\t\t"); - String _name_2 = ac.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append(" actor = new "); - String _name_3 = ac.getName(); - _builder.append(_name_3, "\t\t"); - _builder.append("(ai, name);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// wiring"); - _builder.newLine(); - { - List _allEndPorts = this._roomHelpers.getAllEndPorts(ac); - final Function1 _function = (Port p) -> { - return Boolean.valueOf(this._roomHelpers.isExternal(p)); - }; - Iterable _filter = IterableExtensions.filter(_allEndPorts, _function); - for(final Port port : _filter) { - _builder.append("\t\t"); - String _xifexpression = null; - boolean _isDataDriven = this._roomHelpers.isDataDriven(port); - if (_isDataDriven) { - _xifexpression = "DataPortBase"; - } else { - _xifexpression = "InterfaceItemBase"; - } - _builder.append(_xifexpression, "\t\t"); - _builder.append(".connect(ai, \""); - String _name_4 = port.getName(); - _builder.append(_name_4, "\t\t"); - _builder.append("\", name+\"/"); - String _name_5 = port.getName(); - _builder.append(_name_5, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - { - EList _openBindings = wired.getOpenBindings(); - for(final OpenBinding open : _openBindings) { - _builder.append("\t\t"); - String _xifexpression_1 = null; - Port _port = open.getPort(); - boolean _isDataDriven_1 = this._roomHelpers.isDataDriven(_port); - if (_isDataDriven_1) { - _xifexpression_1 = "DataPortBase"; - } else { - _xifexpression_1 = "InterfaceItemBase"; - } - _builder.append(_xifexpression_1, "\t\t"); - _builder.append(".connect(ai, \""); - Port _port_1 = open.getPort(); - String _name_6 = _port_1.getName(); - _builder.append(_name_6, "\t\t"); - _builder.append("\", name+\"/"); - EList _path = open.getPath(); - String _join = IterableExtensions.join(_path, "/"); - _builder.append(_join, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - { - EList _requiredServices = wired.getRequiredServices(); - for(final OpenServiceConnection req : _requiredServices) { - _builder.append("\t\t"); - String _xifexpression_2 = null; - ProtocolClass _protocol = req.getProtocol(); - CommunicationType _commType = _protocol.getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.DATA_DRIVEN); - if (_equals) { - _xifexpression_2 = "DataPortBase"; - } else { - _xifexpression_2 = "InterfaceItemBase"; - } - _builder.append(_xifexpression_2, "\t\t"); - _builder.append(".connect(ai, \""); - ProtocolClass _protocol_1 = req.getProtocol(); - String _fullyQualifiedName = this._roomExtensions.getFullyQualifiedName(_protocol_1); - _builder.append(_fullyQualifiedName, "\t\t"); - _builder.append("\", name+\"/"); - EList _path_1 = req.getPath(); - String _join_1 = IterableExtensions.join(_path_1, "/"); - _builder.append(_join_1, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return actor;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java deleted file mode 100644 index 26ed3bf43..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java +++ /dev/null @@ -1,235 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -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.genmodel.etricegen.Root; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.GenericActorClassGenerator; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.java.Main; -import org.eclipse.etrice.generator.java.gen.GlobalSettings; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@Singleton -@SuppressWarnings("all") -public class OptionalActorInterfaceGen extends GenericActorClassGenerator { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private JavaExtensions _javaExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - public void doGenerate(final Root root) { - EList _optionalActorClasses = root.getOptionalActorClasses(); - final Function1 _function = (ActorClass cl) -> { - return Boolean.valueOf(this._fileSystemHelpers.isValidGenerationLocation(cl)); - }; - Iterable _filter = IterableExtensions.filter(_optionalActorClasses, _function); - for (final ActorClass ac : _filter) { - { - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(ac); - String _path = this._roomExtensions.getPath(ac); - final String path = (_generationTargetPath + _path); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(ac); - String _path_1 = this._roomExtensions.getPath(ac); - final String infopath = (_generationInfoPath + _path_1); - String file = this._javaExtensions.getJavaInterfaceFileName(ac, false); - CharSequence _generate = this.generate(root, ac, false); - this.fileIO.generateFile("generating ActorClass Interface implementation", path, infopath, file, _generate); - String _javaInterfaceFileName = this._javaExtensions.getJavaInterfaceFileName(ac, true); - file = _javaInterfaceFileName; - CharSequence _generate_1 = this.generate(root, ac, true); - this.fileIO.generateFile("generating ActorClass Interface implementation", path, infopath, file, _generate_1); - } - } - } - - public CharSequence generate(final Root root, final ActorClass ac, final boolean replicated) { - CharSequence _xblockexpression = null; - { - String _xifexpression = null; - if (replicated) { - _xifexpression = "ReplicatedOptionalActorInterfaceBase"; - } else { - _xifexpression = "ScalarOptionalActorInterfaceBase"; - } - final String baseClass = _xifexpression; - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _package = this._roomExtensions.getPackage(ac); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - GlobalSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("import org.eclipse.etrice.runtime.java.debugging.DebuggingService;"); - _builder.newLine(); - } - } - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.IEventReceiver;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBroker;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase."); - _builder.append(baseClass, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("class "); - String _javaInterfaceName = this._javaExtensions.getJavaInterfaceName(ac, replicated); - _builder.append(_javaInterfaceName, ""); - _builder.append(" extends "); - _builder.append(baseClass, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("//--------------------- brokers for ports on the interface"); - _builder.newLine(); - { - List _allInterfacePorts = this._roomHelpers.getAllInterfacePorts(ac); - for(final Port ep : _allInterfacePorts) { - _builder.append("\t"); - _builder.append("protected InterfaceItemBroker "); - String _name = ep.getName(); - _builder.append(_name, "\t"); - _builder.append(" = null;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- interface item IDs"); - _builder.newLine(); - _builder.append("\t"); - String _genInterfaceItemConstantsForOptionalActor = this.genInterfaceItemConstantsForOptionalActor(ac); - _builder.append(_genInterfaceItemConstantsForOptionalActor, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- construction"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - String _javaInterfaceName_1 = this._javaExtensions.getJavaInterfaceName(ac, replicated); - _builder.append(_javaInterfaceName_1, "\t"); - _builder.append(" (IEventReceiver parent, String name) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("super(parent, name, \""); - String _name_1 = ac.getName(); - _builder.append(_name_1, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.newLine(); - { - List _allInterfacePorts_1 = this._roomHelpers.getAllInterfacePorts(ac); - for(final Port ep_1 : _allInterfacePorts_1) { - { - boolean _isReplicated = ep_1.isReplicated(); - if (_isReplicated) { - _builder.append("\t\t"); - String _name_2 = ep_1.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append(" = new ReplicatedInterfaceItemBroker(this, \""); - String _name_3 = ep_1.getName(); - _builder.append(_name_3, "\t\t"); - _builder.append("\", "); - String _ifItemId = this.getIfItemId(ep_1); - _builder.append(_ifItemId, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t\t"); - String _name_4 = ep_1.getName(); - _builder.append(_name_4, "\t\t"); - _builder.append(" = new InterfaceItemBroker(this, \""); - String _name_5 = ep_1.getName(); - _builder.append(_name_5, "\t\t"); - _builder.append("\", "); - String _ifItemId_1 = this.getIfItemId(ep_1); - _builder.append(_ifItemId_1, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - { - GlobalSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("protected void logCreation(String actorClass, String name) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("DebuggingService.getInstance().addMessageActorCreate(this, actorClass, name);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("protected void logDeletion(String name) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("DebuggingService.getInstance().addMessageActorDestroy(this, name);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java deleted file mode 100644 index 9ebd9bebc..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java +++ /dev/null @@ -1,1079 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -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.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -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.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.ProtocolClass; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -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.etrice.generator.java.Main; -import org.eclipse.etrice.generator.java.gen.DataClassGen; -import org.eclipse.etrice.generator.java.gen.GlobalSettings; -import org.eclipse.etrice.generator.java.gen.Initialization; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@Singleton -@SuppressWarnings("all") -public class ProtocolClassGen extends GenericProtocolClassGenerator { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private JavaExtensions _javaExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private ProcedureHelpers _procedureHelpers; - - @Inject - @Extension - private Initialization _initialization; - - @Inject - @Extension - private TypeHelpers _typeHelpers; - - @Inject - @Extension - private DataClassGen _dataClassGen; - - @Inject - @Extension - private FileSystemHelpers _fileSystemHelpers; - - @Inject - private ILogger logger; - - public void doGenerate(final Root root) { - EList _protocolClasses = root.getProtocolClasses(); - final Function1 _function = (ProtocolClass cl) -> { - return Boolean.valueOf(this._fileSystemHelpers.isValidGenerationLocation(cl)); - }; - Iterable _filter = IterableExtensions.filter(_protocolClasses, _function); - for (final ProtocolClass pc : _filter) { - { - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(pc); - String _path = this._roomExtensions.getPath(pc); - final String path = (_generationTargetPath + _path); - String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(pc); - String _path_1 = this._roomExtensions.getPath(pc); - final String infopath = (_generationInfoPath + _path_1); - final String file = this._javaExtensions.getJavaFileName(pc); - CharSequence _switchResult = null; - CommunicationType _commType = pc.getCommType(); - if (_commType != null) { - switch (_commType) { - case EVENT_DRIVEN: - _switchResult = this.generate(root, pc); - break; - case DATA_DRIVEN: - _switchResult = this.generateDataDriven(root, pc); - break; - case SYNCHRONOUS: - _switchResult = ""; - break; - default: - break; - } - } - final CharSequence contents = _switchResult; - String _string = contents.toString(); - boolean _isEmpty = _string.isEmpty(); - if (_isEmpty) { - this.logger.logError("synchronous protocols not supported yet", pc); - } else { - this.fileIO.generateFile("generating ProtocolClass implementation", path, infopath, file, contents); - } - } - } - } - - public CharSequence generate(final Root root, final ProtocolClass pc) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _package = this._roomExtensions.getPackage(pc); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.messaging.Message;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.EventMessage;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.EventWithDataMessage;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.IInterfaceItemOwner;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.PortBase;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.ReplicatedPortBase;"); - _builder.newLine(); - { - GlobalSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("import org.eclipse.etrice.runtime.java.debugging.DebuggingService;"); - _builder.newLine(); - } - } - _builder.append("import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;"); - _builder.newLine(); - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(pc, 1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - EList models = root.getReferencedModels(pc); - _builder.newLineIfNotEmpty(); - { - for(final RoomModel model : models) { - _builder.append("import "); - String _name = model.getName(); - _builder.append(_name, ""); - _builder.append(".*;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("public class "); - String _name_1 = pc.getName(); - _builder.append(_name_1, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("// message IDs"); - _builder.newLine(); - _builder.append("\t"); - String _genMessageIDs = this.genMessageIDs(pc); - _builder.append(_genMessageIDs, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - CharSequence _userCode_1 = this._procedureHelpers.userCode(pc, 2); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("private static String messageStrings[] = {\"MIN\", "); - { - List _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); - for(final Message m : _allOutgoingMessages) { - _builder.append("\""); - String _name_2 = m.getName(); - _builder.append(_name_2, "\t"); - _builder.append("\","); - } - } - _builder.append(" "); - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - for(final Message m_1 : _allIncomingMessages) { - _builder.append("\""); - String _name_3 = m_1.getName(); - _builder.append(_name_3, "\t"); - _builder.append("\","); - } - } - _builder.append("\"MAX\"};"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public String getMessageString(int msg_id) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("if (msg_idMSG_MAX+1){"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("// id out of range"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return \"Message ID out of range\";"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("else{"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return messageStrings[msg_id];"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - CharSequence _portClass = this.portClass(pc, false); - _builder.append(_portClass, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _portClass_1 = this.portClass(pc, true); - _builder.append(_portClass_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - return _builder; - } - - public CharSequence portClass(final ProtocolClass pc, final boolean conj) { - CharSequence _xblockexpression = null; - { - PortClass pclass = this._roomExtensions.getPortClass(pc, conj); - String portClassName = this._roomExtensions.getPortClassName(pc, conj); - String replPortClassName = this._roomExtensions.getPortClassName(pc, conj, true); - StringConcatenation _builder = new StringConcatenation(); - _builder.newLine(); - _builder.append("// port class"); - _builder.newLine(); - _builder.append("static public class "); - _builder.append(portClassName, ""); - _builder.append(" extends PortBase {"); - _builder.newLineIfNotEmpty(); - { - boolean _notEquals = (!Objects.equal(pclass, null)); - if (_notEquals) { - _builder.append("\t"); - DetailCode _userCode = pclass.getUserCode(); - CharSequence _userCode_1 = this._procedureHelpers.userCode(_userCode); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("// constructors"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - _builder.append(portClassName, "\t"); - _builder.append("(IInterfaceItemOwner actor, String name, int localId) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("this(actor, name, localId, 0);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - _builder.append(portClassName, "\t"); - _builder.append("(IInterfaceItemOwner actor, String name, int localId, int idx) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("super(actor, name, localId, idx);"); - _builder.newLine(); - { - boolean _notEquals_1 = (!Objects.equal(pclass, null)); - if (_notEquals_1) { - _builder.append("\t\t"); - EList _attributes = pclass.getAttributes(); - CharSequence _attributeInitialization = this._initialization.attributeInitialization(_attributes, pclass, true); - _builder.append(_attributeInitialization, "\t\t"); - _builder.newLineIfNotEmpty(); - } - } - { - GlobalSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t\t"); - _builder.append("DebuggingService.getInstance().addPortInstance(this);"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - { - GlobalSettings _settings_1 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_1) { - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void destroy() {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("DebuggingService.getInstance().removePortInstance(this);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("super.destroy();"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void receive(Message m) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("if (!(m instanceof EventMessage))"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return;"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("EventMessage msg = (EventMessage) m;"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) {"); - _builder.newLine(); - { - GlobalSettings _settings_2 = Main.getSettings(); - boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation_2) { - _builder.append("\t\t\t"); - _builder.append("DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);"); - _builder.newLine(); - } - } - { - boolean _handlesReceive = this._roomExtensions.handlesReceive(pc, conj); - if (_handlesReceive) { - _builder.append("\t\t\t"); - _builder.append("switch (msg.getEvtId()) {"); - _builder.newLine(); - { - List _receiveHandlers = this._roomExtensions.getReceiveHandlers(pc, conj); - for(final MessageHandler hdlr : _receiveHandlers) { - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("case "); - Message _msg = hdlr.getMsg(); - String _codeName = this._roomExtensions.getCodeName(_msg); - _builder.append(_codeName, "\t\t\t\t"); - _builder.append(":"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("{"); - _builder.newLine(); - { - DetailCode _detailCode = hdlr.getDetailCode(); - EList _lines = _detailCode.getLines(); - for(final String command : _lines) { - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("\t"); - _builder.append(command, "\t\t\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("break;"); - _builder.newLine(); - } - } - _builder.append("\t\t\t"); - _builder.append("\t"); - _builder.append("default:"); - _builder.newLine(); - } - } - _builder.append("\t\t\t"); - _builder.append("if (msg instanceof EventWithDataMessage)"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("else"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("getActor().receiveEvent(this, msg.getEvtId(), null);"); - _builder.newLine(); - { - boolean _handlesReceive_1 = this._roomExtensions.handlesReceive(pc, conj); - if (_handlesReceive_1) { - _builder.append("\t\t\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - { - boolean _notEquals_2 = (!Objects.equal(pclass, null)); - if (_notEquals_2) { - _builder.append("\t"); - EList _attributes_1 = pclass.getAttributes(); - CharSequence _attributes_2 = this._procedureHelpers.attributes(_attributes_1); - _builder.append(_attributes_2, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - EList _attributes_3 = pclass.getAttributes(); - CharSequence _attributeSettersGettersImplementation = this._procedureHelpers.attributeSettersGettersImplementation(_attributes_3, null); - _builder.append(_attributeSettersGettersImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - EList _operations = pclass.getOperations(); - CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, portClassName); - _builder.append(_operationsImplementation, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("// sent messages"); - _builder.newLine(); - { - List _allMessages = this._roomHelpers.getAllMessages(pc, conj); - for(final Message m : _allMessages) { - _builder.append("\t"); - CharSequence _sendMessage = this.sendMessage(m, conj); - _builder.append(_sendMessage, "\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// replicated port class"); - _builder.newLine(); - _builder.append("static public class "); - _builder.append(replPortClassName, ""); - _builder.append(" extends ReplicatedPortBase {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - _builder.append(replPortClassName, "\t"); - _builder.append("(IInterfaceItemOwner actor, String name, int localId) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("super(actor, name, localId);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public int getReplication() {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return getNInterfaceItems();"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public int getIndexOf(InterfaceItemBase ifitem){"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return ifitem.getIdx();"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - _builder.append(portClassName, "\t"); - _builder.append(" get(int idx) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("return ("); - _builder.append(portClassName, "\t\t"); - _builder.append(") getInterfaceItem(idx);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return new "); - _builder.append(portClassName, "\t\t"); - _builder.append("(rcv, name, lid, idx);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - { - if (conj) { - _builder.append("\t"); - _builder.append("// incoming messages"); - _builder.newLine(); - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - for(final Message m_1 : _allIncomingMessages) { - _builder.append("\t"); - CharSequence _messageSignature = this.messageSignature(m_1); - _builder.append(_messageSignature, "\t"); - _builder.append("{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("for (InterfaceItemBase item : getItems()) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("(("); - _builder.append(portClassName, "\t\t\t"); - _builder.append(")item)."); - CharSequence _messageCall = this.messageCall(m_1); - _builder.append(_messageCall, "\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - } else { - _builder.append("\t"); - _builder.append("// outgoing messages"); - _builder.newLine(); - { - List _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); - for(final Message m_2 : _allOutgoingMessages) { - _builder.append("\t"); - CharSequence _messageSignature_1 = this.messageSignature(m_2); - _builder.append(_messageSignature_1, "\t"); - _builder.append("{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("for (InterfaceItemBase item : getItems()) {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("(("); - _builder.append(portClassName, "\t\t\t"); - _builder.append(")item)."); - CharSequence _messageCall_1 = this.messageCall(m_2); - _builder.append(_messageCall_1, "\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - } - } - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - public CharSequence messageSignature(final Message m) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _isPriv = m.isPriv(); - if (_isPriv) { - _builder.append("private"); - } else { - _builder.append("public"); - } - } - _builder.append(" void "); - String _name = m.getName(); - _builder.append(_name, ""); - _builder.append("("); - { - VarDecl _data = m.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (_notEquals) { - VarDecl _data_1 = m.getData(); - RefableType _refType = _data_1.getRefType(); - DataType _type = _refType.getType(); - String _typeName = this._typeHelpers.typeName(_type); - _builder.append(_typeName, ""); - _builder.append(" "); - VarDecl _data_2 = m.getData(); - String _name_1 = _data_2.getName(); - _builder.append(_name_1, ""); - } - } - _builder.append(")"); - return _builder; - } - - public CharSequence messageSignatureExplicit(final Message m) { - CharSequence _xblockexpression = null; - { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - DataClass dc = ((DataClass) _type); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("public void "); - String _name = m.getName(); - _builder.append(_name, ""); - _builder.append("("); - String _argList = this._dataClassGen.argList(dc); - _builder.append(_argList, ""); - _builder.append(")"); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - public CharSequence messageCall(final Message m) { - StringConcatenation _builder = new StringConcatenation(); - String _name = m.getName(); - _builder.append(_name, ""); - _builder.append("("); - { - VarDecl _data = m.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (_notEquals) { - _builder.append(" "); - VarDecl _data_1 = m.getData(); - String _name_1 = _data_1.getName(); - _builder.append(_name_1, ""); - } - } - _builder.append(")"); - return _builder; - } - - public CharSequence sendMessage(final Message m, final boolean conj) { - CharSequence _xblockexpression = null; - { - String _xifexpression = null; - if (conj) { - _xifexpression = "IN"; - } else { - _xifexpression = "OUT"; - } - String dir = _xifexpression; - MessageHandler hdlr = this._roomExtensions.getSendHandler(m, conj); - StringConcatenation _builder = new StringConcatenation(); - CharSequence _messageSignature = this.messageSignature(m); - _builder.append(_messageSignature, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - { - boolean _notEquals = (!Objects.equal(hdlr, null)); - if (_notEquals) { - _builder.append("\t"); - { - DetailCode _detailCode = hdlr.getDetailCode(); - EList _lines = _detailCode.getLines(); - for(final String command : _lines) { - _builder.append("\t"); - _builder.append(command, "\t"); - _builder.newLineIfNotEmpty(); - } - } - } else { - { - GlobalSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t"); - _builder.append("DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings["); - _builder.append(dir, "\t"); - _builder.append("_"); - String _name = m.getName(); - _builder.append(_name, "\t"); - _builder.append("]);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("if (getPeerAddress()!=null)"); - _builder.newLine(); - { - VarDecl _data = m.getData(); - boolean _equals = Objects.equal(_data, null); - if (_equals) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), "); - _builder.append(dir, "\t\t"); - _builder.append("_"); - String _name_1 = m.getName(); - _builder.append(_name_1, "\t\t"); - _builder.append("));"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), "); - _builder.append(dir, "\t\t"); - _builder.append("_"); - String _name_2 = m.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append(", "); - VarDecl _data_1 = m.getData(); - String _name_3 = _data_1.getName(); - _builder.append(_name_3, "\t\t"); - { - if (((!m.getData().getRefType().isRef()) && (!this._typeHelpers.isEnumerationOrPrimitive(m.getData().getRefType().getType())))) { - _builder.append(".deepCopy()"); - } - } - _builder.append("));"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.append("}"); - _builder.newLine(); - { - if (((!Objects.equal(m.getData(), null)) && (m.getData().getRefType().getType() instanceof DataClass))) { - CharSequence _messageSignatureExplicit = this.messageSignatureExplicit(m); - _builder.append(_messageSignatureExplicit, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _name_4 = m.getName(); - _builder.append(_name_4, "\t"); - _builder.append("(new "); - VarDecl _data_2 = m.getData(); - RefableType _refType = _data_2.getRefType(); - DataType _type = _refType.getType(); - String _name_5 = _type.getName(); - _builder.append(_name_5, "\t"); - _builder.append("("); - VarDecl _data_3 = m.getData(); - RefableType _refType_1 = _data_3.getRefType(); - DataType _type_1 = _refType_1.getType(); - String _paramList = this._dataClassGen.paramList(((DataClass) _type_1)); - _builder.append(_paramList, "\t"); - _builder.append("));"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } - - public CharSequence generateDataDriven(final Root root, final ProtocolClass pc) { - CharSequence _xblockexpression = null; - { - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - final Function1 _function = (Message m) -> { - VarDecl _data = m.getData(); - return Boolean.valueOf((!Objects.equal(_data, null))); - }; - final Iterable sentMsgs = IterableExtensions.filter(_allIncomingMessages, _function); - final EList models = root.getReferencedModels(pc); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _package = this._roomExtensions.getPackage(pc); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.messaging.IRTObject;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.DataReceivePort;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.modelbase.DataSendPort;"); - _builder.newLine(); - _builder.append("import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;"); - _builder.newLine(); - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(pc, 1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - for(final RoomModel model : models) { - _builder.append("import "); - String _name = model.getName(); - _builder.append(_name, ""); - _builder.append(".*;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("public class "); - String _name_1 = pc.getName(); - _builder.append(_name_1, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - CharSequence _userCode_1 = this._procedureHelpers.userCode(pc, 2); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// send port holds data"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("static public class "); - String _portClassName = this._roomExtensions.getPortClassName(pc, true); - _builder.append(_portClassName, "\t"); - _builder.append(" extends DataSendPort {"); - _builder.newLineIfNotEmpty(); - { - for(final Message msg : sentMsgs) { - _builder.append("\t\t"); - _builder.append("private "); - VarDecl _data = msg.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - String _typeName = this._typeHelpers.typeName(_type); - _builder.append(_typeName, "\t\t"); - _builder.append(" "); - String _name_2 = msg.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// constructor"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("public "); - String _portClassName_1 = this._roomExtensions.getPortClassName(pc, true); - _builder.append(_portClassName_1, "\t\t"); - _builder.append("(IRTObject parent, String name, int localId) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("super(parent, name, localId);"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// getters and setters"); - _builder.newLine(); - { - for(final Message msg_1 : sentMsgs) { - _builder.append("\t\t"); - _builder.append("public void "); - String _name_3 = msg_1.getName(); - _builder.append(_name_3, "\t\t"); - _builder.append("("); - VarDecl _data_1 = msg_1.getData(); - RefableType _refType_1 = _data_1.getRefType(); - DataType _type_1 = _refType_1.getType(); - String _typeName_1 = this._typeHelpers.typeName(_type_1); - _builder.append(_typeName_1, "\t\t"); - _builder.append(" "); - String _name_4 = msg_1.getName(); - _builder.append(_name_4, "\t\t"); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("this."); - String _name_5 = msg_1.getName(); - _builder.append(_name_5, "\t\t\t"); - _builder.append(" = "); - String _name_6 = msg_1.getName(); - _builder.append(_name_6, "\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("public "); - VarDecl _data_2 = msg_1.getData(); - RefableType _refType_2 = _data_2.getRefType(); - DataType _type_2 = _refType_2.getType(); - String _typeName_2 = this._typeHelpers.typeName(_type_2); - _builder.append(_typeName_2, "\t\t"); - _builder.append(" "); - String _name_7 = msg_1.getName(); - _builder.append(_name_7, "\t\t"); - _builder.append("() {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("return "); - String _name_8 = msg_1.getName(); - _builder.append(_name_8, "\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// receive port accesses send port"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("static public class "); - String _portClassName_2 = this._roomExtensions.getPortClassName(pc, false); - _builder.append(_portClassName_2, "\t"); - _builder.append(" extends DataReceivePort {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("private "); - String _portClassName_3 = this._roomExtensions.getPortClassName(pc, true); - _builder.append(_portClassName_3, "\t\t"); - _builder.append(" peer;"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// constructor"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("public "); - String _portClassName_4 = this._roomExtensions.getPortClassName(pc, false); - _builder.append(_portClassName_4, "\t\t"); - _builder.append("(IRTObject parent, String name, int localId) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("super(parent, name, localId);"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// getters"); - _builder.newLine(); - { - for(final Message msg_2 : sentMsgs) { - _builder.append("\t\t"); - _builder.append("public "); - VarDecl _data_3 = msg_2.getData(); - RefableType _refType_3 = _data_3.getRefType(); - DataType _type_3 = _refType_3.getType(); - String _typeName_3 = this._typeHelpers.typeName(_type_3); - _builder.append(_typeName_3, "\t\t"); - _builder.append(" "); - String _name_9 = msg_2.getName(); - _builder.append(_name_9, "\t\t"); - _builder.append("() {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("if (peer==null)"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t\t"); - _builder.append("return "); - VarDecl _data_4 = msg_2.getData(); - RefableType _refType_4 = _data_4.getRefType(); - DataType _type_4 = _refType_4.getType(); - String _defaultValue = this._javaExtensions.defaultValue(_type_4); - _builder.append(_defaultValue, "\t\t\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("return peer."); - String _name_10 = msg_2.getName(); - _builder.append(_name_10, "\t\t\t"); - _builder.append("();"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("protected void connect(DataSendPort dataSendPort) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("if (dataSendPort instanceof "); - String _portClassName_5 = this._roomExtensions.getPortClassName(pc, true); - _builder.append(_portClassName_5, "\t\t\t"); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t\t"); - _builder.append("peer = ("); - String _portClassName_6 = this._roomExtensions.getPortClassName(pc, true); - _builder.append(_portClassName_6, "\t\t\t\t"); - _builder.append(")dataSendPort;"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java deleted file mode 100644 index 4b802168a..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedModelComponent; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator; -import org.eclipse.etrice.generator.java.Main; -import org.eclipse.etrice.generator.java.gen.GlobalSettings; -import org.eclipse.xtend2.lib.StringConcatenation; - -@Singleton -@SuppressWarnings("all") -public class StateMachineGen extends GenericStateMachineGenerator { - /** - * @param generateImplementation NOT used - */ - @Override - public CharSequence genExtra(final ExpandedModelComponent xpac, final boolean generateImplementation) { - CharSequence _xblockexpression = null; - { - final ArrayList states = new ArrayList(); - ModelComponent ac = xpac.getModelComponent(); - while ((!Objects.equal(ac, null))) { - { - List _allBaseStates = this._fSMHelpers.getAllBaseStates(ac); - List _leafStatesLast = this._fSMExtensions.getLeafStatesLast(_allBaseStates); - states.addAll(0, _leafStatesLast); - ModelComponent _base = ac.getBase(); - ac = _base; - } - } - StringConcatenation _builder = new StringConcatenation(); - { - if ((Main.getSettings().isGenerateMSCInstrumentation() || Main.getSettings().isGenerateWithVerboseOutput())) { - _builder.append("// state names"); - _builder.newLine(); - _builder.append("protected static final String stateStrings[] = {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\"\","); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\"\","); - _builder.newLine(); - { - boolean _hasElements = false; - for(final State state : states) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - _builder.append("\""); - String _genStatePathName = this._codegenHelpers.getGenStatePathName(state); - _builder.append(_genStatePathName, "\t"); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - } - } - _builder.append("// history"); - _builder.newLine(); - _builder.append("protected int history[] = {NO_STATE, NO_STATE"); - { - for(final State state_1 : states) { - _builder.append(", NO_STATE"); - } - } - _builder.append("};"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("private void setState(int new_state) {"); - _builder.newLine(); - { - GlobalSettings _settings = Main.getSettings(); - boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); - if (_isGenerateMSCInstrumentation) { - _builder.append("\t"); - _builder.append("DebuggingService.getInstance().addActorState(this,stateStrings[new_state]);"); - _builder.newLine(); - } - } - { - GlobalSettings _settings_1 = Main.getSettings(); - boolean _isGenerateWithVerboseOutput = _settings_1.isGenerateWithVerboseOutput(); - if (_isGenerateWithVerboseOutput) { - _builder.append("\t"); - _builder.append("if (stateStrings[new_state]!=\"Idle\") {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("System.out.println(\"state switch of \"+getInstancePath() + \": \""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t\t\t"); - _builder.append("+ stateStrings[this.state] + \" -> \" + stateStrings[new_state]);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.append("this.state = new_state;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - /** - * if {@code -storeDataObj} is set then a call to {@code finalAction()} is generated - */ - @Override - public CharSequence finalAction() { - StringConcatenation _builder = new StringConcatenation(); - { - GlobalSettings _settings = Main.getSettings(); - boolean _isGenerateStoreDataObj = _settings.isGenerateStoreDataObj(); - if (_isGenerateStoreDataObj) { - _builder.append("finalAction();"); - _builder.newLine(); - } - } - return _builder; - } - - public int getHistorySize(final ExpandedActorClass xpac) { - ActorClass _actorClass = xpac.getActorClass(); - List _allBaseStates = this._fSMHelpers.getAllBaseStates(_actorClass); - int _size = _allBaseStates.size(); - return (_size + 2); - } -} diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java deleted file mode 100644 index 7609e782b..000000000 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java +++ /dev/null @@ -1,954 +0,0 @@ -/** - * Copyright (c) 2012 Juergen Haug - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug - */ -package org.eclipse.etrice.generator.java.gen; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.common.converter.TimeConverter; -import org.eclipse.etrice.core.etmap.util.ETMapUtil; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.base.IDataConfiguration; -import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.etrice.generator.generic.TypeHelpers; -import org.eclipse.etrice.generator.java.gen.JavaExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.StringExtensions; - -@Singleton -@SuppressWarnings("all") -public class VariableServiceGen { - @Inject - private IGeneratorFileIo fileIO; - - @Inject - @Extension - private JavaExtensions stdExt; - - @Inject - @Extension - private RoomExtensions roomExt; - - @Inject - private IDataConfiguration configExt; - - @Inject - @Extension - private ProcedureHelpers helpers; - - @Inject - @Extension - private TypeHelpers _typeHelpers; - - @Inject - @Extension - private RoomHelpers _roomHelpers; - - public void doGenerate(final Root root, final SubSystemInstance ssi) { - final NodeRef nr = ETMapUtil.getNodeRef(ssi); - final String clsname = this.stdExt.getJavaClassName(nr, ssi); - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass); - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - String _path = this.roomExt.getPath(_subSystemClass_1); - final String path = (_generationTargetPath + _path); - SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String _generationInfoPath = this.roomExt.getGenerationInfoPath(_subSystemClass_2); - SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - String _path_1 = this.roomExt.getPath(_subSystemClass_3); - final String infopath = (_generationInfoPath + _path_1); - final String file = (clsname + "VariableService.java"); - CharSequence _generate = this.generate(root, ssi); - this.fileIO.generateFile("generating VariableService implementation", path, infopath, file, _generate); - } - - private CharSequence generate(final Root root, final SubSystemInstance comp) { - CharSequence _xblockexpression = null; - { - final NodeRef nr = ETMapUtil.getNodeRef(comp); - final String clsname = this.stdExt.getJavaClassName(nr, comp); - final HashMap> aisAttrMap = new HashMap>(); - EList _allContainedInstances = comp.getAllContainedInstances(); - final Consumer _function = (ActorInstance ai) -> { - List _dynConfigReadAttributes = this.configExt.getDynConfigReadAttributes(ai); - boolean _isEmpty = _dynConfigReadAttributes.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - List _dynConfigReadAttributes_1 = this.configExt.getDynConfigReadAttributes(ai); - aisAttrMap.put(ai, _dynConfigReadAttributes_1); - } - }; - _allContainedInstances.forEach(_function); - StringConcatenation _builder = new StringConcatenation(); - _builder.newLine(); - _builder.append("package "); - SubSystemClass _subSystemClass = comp.getSubSystemClass(); - String _package = this.roomExt.getPackage(_subSystemClass); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("import java.util.Arrays;"); - _builder.newLine(); - _builder.append("import java.util.HashMap;"); - _builder.newLine(); - _builder.append("import java.util.Map;"); - _builder.newLine(); - _builder.append("import org.eclipse.etrice.runtime.java.config.AbstractVariableService;"); - _builder.newLine(); - String _userCode1 = this.configExt.getUserCode1(comp); - _builder.append(_userCode1, ""); - _builder.newLineIfNotEmpty(); - { - Set _keySet = aisAttrMap.keySet(); - HashSet _roomModels = this.getRoomModels(_keySet); - for(final RoomModel model : _roomModels) { - _builder.append("import "); - String _name = model.getName(); - _builder.append(_name, ""); - _builder.append(".*;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - _builder.newLine(); - _builder.append("public class "); - _builder.append(clsname, ""); - _builder.append("VariableService extends AbstractVariableService{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("private "); - _builder.append(clsname, "\t"); - _builder.append(" subSystem;"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// Actor instances"); - _builder.newLine(); - { - Set _keySet_1 = aisAttrMap.keySet(); - for(final ActorInstance ai : _keySet_1) { - _builder.append("\t"); - _builder.append("private "); - ActorClass _actorClass = ai.getActorClass(); - String _name_1 = _actorClass.getName(); - _builder.append(_name_1, "\t"); - _builder.append(" "); - CharSequence _varName = this.getVarName(ai); - _builder.append(_varName, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - _builder.append(clsname, "\t"); - _builder.append("VariableService("); - _builder.append(clsname, "\t"); - _builder.append(" subSystem) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("super("); - String _userCode2 = this.configExt.getUserCode2(comp); - _builder.append(_userCode2, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("this.subSystem = subSystem;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("protected void initInstances(){"); - _builder.newLine(); - { - Set _keySet_2 = aisAttrMap.keySet(); - for(final ActorInstance ai_1 : _keySet_2) { - _builder.append("\t\t"); - CharSequence _varName_1 = this.getVarName(ai_1); - _builder.append(_varName_1, "\t\t"); - _builder.append(" = ("); - ActorClass _actorClass_1 = ai_1.getActorClass(); - String _name_2 = _actorClass_1.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append(")subSystem.getInstance(\""); - String _path = ai_1.getPath(); - _builder.append(_path, "\t\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("protected void setAttributeValues(Map values) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("Object object;"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("String id = null;"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.newLine(); - { - Set _keySet_3 = aisAttrMap.keySet(); - for(final ActorInstance ai_2 : _keySet_3) { - { - List _get = aisAttrMap.get(ai_2); - for(final Attribute a : _get) { - _builder.append("\t\t"); - _builder.append("try{"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("boolean changed = false;"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - ArrayList _arrayList = new ArrayList(); - List _union = this.roomExt.union(_arrayList, a); - CharSequence _genSetAttributeValues1 = this.genSetAttributeValues1(_union, ai_2); - _builder.append(_genSetAttributeValues1, "\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("if(changed)"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t\t"); - _builder.append("synchronized("); - CharSequence _varName_2 = this.getVarName(ai_2); - _builder.append(_varName_2, "\t\t\t\t"); - _builder.append("."); - String _name_3 = a.getName(); - String _plus = (_name_3 + "Lock"); - CharSequence _invokeGetter = this.helpers.invokeGetter(_plus, null); - _builder.append(_invokeGetter, "\t\t\t\t"); - _builder.append("){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t\t\t"); - _builder.append("if("); - CharSequence _varName_3 = this.getVarName(ai_2); - _builder.append(_varName_3, "\t\t\t\t\t"); - _builder.append("."); - String _name_4 = a.getName(); - String _plus_1 = (_name_4 + "Lock"); - CharSequence _invokeGetter_1 = this.helpers.invokeGetter(_plus_1, null); - _builder.append(_invokeGetter_1, "\t\t\t\t\t"); - _builder.append(".isUpdate()){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t\t\t\t"); - ArrayList _arrayList_1 = new ArrayList(); - List _union_1 = this.roomExt.union(_arrayList_1, a); - CharSequence _genSetAttributeValues2 = this.genSetAttributeValues2(_union_1, ai_2); - _builder.append(_genSetAttributeValues2, "\t\t\t\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}catch(IllegalArgumentException e){"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("error(id, e);"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } - } - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("protected Map getAttributeValues(){"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("Map values = new HashMap();"); - _builder.newLine(); - { - Set _keySet_4 = aisAttrMap.keySet(); - for(final ActorInstance ai_3 : _keySet_4) { - { - List _get_1 = aisAttrMap.get(ai_3); - for(final Attribute a_1 : _get_1) { - _builder.append("\t\t"); - ArrayList _arrayList_2 = new ArrayList(); - List _union_2 = this.roomExt.union(_arrayList_2, a_1); - CharSequence _genGetAttributeValues = this.genGetAttributeValues(_union_2, ai_3); - _builder.append(_genGetAttributeValues, "\t\t"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return values;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public void writeDataClass(String id, Object dcObject, Map writeMap) {"); - _builder.newLine(); - _builder.append("\t\t"); - Set _keySet_5 = aisAttrMap.keySet(); - HashSet dataClasses = this.getDynConfigDataClasses(_keySet_5); - _builder.newLineIfNotEmpty(); - { - for(final DataClass dc : dataClasses) { - _builder.append("\t\t"); - _builder.append("if(dcObject.getClass().equals("); - String _typeName = this._typeHelpers.typeName(dc); - _builder.append(_typeName, "\t\t"); - _builder.append(".class))"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("writeDataClass(id, ("); - String _typeName_1 = this._typeHelpers.typeName(dc); - _builder.append(_typeName_1, "\t\t\t"); - _builder.append(") dcObject, writeTasks);"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// DataClasses write operations"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - { - HashSet _allDataClasses = this.getAllDataClasses(dataClasses); - for(final DataClass dc_1 : _allDataClasses) { - _builder.append("\t"); - _builder.append("private void writeDataClass(String id, "); - String _typeName_2 = this._typeHelpers.typeName(dc_1); - _builder.append(_typeName_2, "\t"); - _builder.append(" object, Map map){"); - _builder.newLineIfNotEmpty(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(dc_1); - for(final Attribute a_2 : _allAttributes) { - { - RefableType _type = a_2.getType(); - DataType _type_1 = _type.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1); - if (_isEnumerationOrPrimitive) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("map.put(id+\"/"); - String _name_5 = a_2.getName(); - _builder.append(_name_5, "\t\t"); - _builder.append("\", "); - { - int _size = a_2.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _builder.append("toObjectArray("); - } - } - _builder.append("object."); - String _name_6 = a_2.getName(); - CharSequence _invokeGetter_2 = this.helpers.invokeGetter(_name_6, null); - _builder.append(_invokeGetter_2, "\t\t"); - { - int _size_1 = a_2.getSize(); - boolean _greaterThan_1 = (_size_1 > 0); - if (_greaterThan_1) { - _builder.append(")"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("writeDataClass(id+\"/"); - String _name_7 = a_2.getName(); - _builder.append(_name_7, "\t\t"); - _builder.append("\", object."); - String _name_8 = a_2.getName(); - CharSequence _invokeGetter_3 = this.helpers.invokeGetter(_name_8, null); - _builder.append(_invokeGetter_3, "\t\t"); - _builder.append(", map);"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("@Override"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("protected int getPollingTimerUser(){"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return "); - long _pollingTimerUser = this.configExt.getPollingTimerUser(comp); - long _split = TimeConverter.split(_pollingTimerUser, TimeConverter.MILLI_SEC, true); - _builder.append(_split, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - private CharSequence genMinMaxCheck(final List path, final ActorClass ac) { - CharSequence _xblockexpression = null; - { - Attribute a = IterableExtensions.last(path); - String aVarName = this.toAbsolutePath(path, "_"); - String _attrClassConfigMinValue = this.configExt.getAttrClassConfigMinValue(ac, path); - boolean min = (!Objects.equal(_attrClassConfigMinValue, null)); - String _attrClassConfigMaxValue = this.configExt.getAttrClassConfigMaxValue(ac, path); - boolean max = (!Objects.equal(_attrClassConfigMaxValue, null)); - CharSequence _xifexpression = null; - if ((min || max)) { - StringConcatenation _builder = new StringConcatenation(); - { - int _size = a.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _builder.append("for("); - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this._typeHelpers.typeName(_type_1); - _builder.append(_typeName, ""); - _builder.append(" e : "); - _builder.append(aVarName, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - } - } - _builder.append("checkMinMax("); - { - int _size_1 = a.getSize(); - boolean _greaterThan_1 = (_size_1 > 0); - if (_greaterThan_1) { - _builder.append("e"); - } else { - _builder.append(aVarName, ""); - } - } - _builder.append(", "); - { - if (min) { - String _name = ac.getName(); - _builder.append(_name, ""); - _builder.append(".MIN"); - _builder.append(aVarName, ""); - } else { - _builder.append("null"); - } - } - _builder.append(", "); - { - if (max) { - String _name_1 = ac.getName(); - _builder.append(_name_1, ""); - _builder.append(".MAX"); - _builder.append(aVarName, ""); - } else { - _builder.append("null"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _xifexpression = _builder; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - private HashSet getDynConfigDataClasses(final Iterable ais) { - final HashSet result = new HashSet(); - final Consumer _function = (ActorInstance ai) -> { - List _dynConfigReadAttributes = this.configExt.getDynConfigReadAttributes(ai); - final Consumer _function_1 = (Attribute a) -> { - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - boolean _isDataClass = this._typeHelpers.isDataClass(_type_1); - if (_isDataClass) { - RefableType _type_2 = a.getType(); - DataType _type_3 = _type_2.getType(); - result.add(((DataClass) _type_3)); - } - }; - _dynConfigReadAttributes.forEach(_function_1); - }; - ais.forEach(_function); - return result; - } - - private HashSet getAllDataClasses(final Iterable dcs) { - final HashSet result = new HashSet(); - Iterables.addAll(result, dcs); - final LinkedList visit = new LinkedList(); - Iterables.addAll(visit, dcs); - while ((!visit.isEmpty())) { - { - DataClass dc = visit.pop(); - List _allAttributes = this._roomHelpers.getAllAttributes(dc); - final Consumer _function = (Attribute a) -> { - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - boolean _isDataClass = this._typeHelpers.isDataClass(_type_1); - if (_isDataClass) { - RefableType _type_2 = a.getType(); - DataType _type_3 = _type_2.getType(); - visit.add(((DataClass) _type_3)); - } - }; - _allAttributes.forEach(_function); - } - } - return result; - } - - private HashSet getRoomModels(final Collection ais) { - final HashSet models = new HashSet(); - final Consumer _function = (ActorInstance ai) -> { - ActorClass _actorClass = ai.getActorClass(); - EObject _eContainer = _actorClass.eContainer(); - models.add(((RoomModel) _eContainer)); - }; - ais.forEach(_function); - return models; - } - - private String toAbsolutePath(final List path, final String pathDelim) { - StringConcatenation _builder = new StringConcatenation(); - { - for(final Attribute p : path) { - _builder.append(pathDelim, ""); - String _name = p.getName(); - _builder.append(_name, ""); - } - } - return _builder.toString(); - } - - private CharSequence getVarName(final ActorInstance ai) { - StringConcatenation _builder = new StringConcatenation(); - { - String _path = ai.getPath(); - String[] _split = _path.split("/"); - Iterable _drop = IterableExtensions.drop(((Iterable)Conversions.doWrapArray(_split)), 2); - boolean _hasElements = false; - for(final String p : _drop) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate("_", ""); - } - _builder.append(p, ""); - } - } - return _builder; - } - - private CharSequence genGetAttributeValues(final List path, final ActorInstance ai) { - CharSequence _xblockexpression = null; - { - final Attribute a = IterableExtensions.last(path); - CharSequence _xifexpression = null; - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1); - if (_isEnumerationOrPrimitive) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("values.put(\""); - String _path = ai.getPath(); - _builder.append(_path, ""); - String _absolutePath = this.toAbsolutePath(path, "/"); - _builder.append(_absolutePath, ""); - _builder.append("\", "); - { - int _size = a.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _builder.append("toObjectArray("); - } - } - CharSequence _varName = this.getVarName(ai); - _builder.append(_varName, ""); - _builder.append("."); - CharSequence _invokeGetters = this.helpers.invokeGetters(path, null); - _builder.append(_invokeGetters, ""); - { - int _size_1 = a.getSize(); - boolean _greaterThan_1 = (_size_1 > 0); - if (_greaterThan_1) { - _builder.append(")"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _xifexpression = _builder; - } else { - CharSequence _xifexpression_1 = null; - RefableType _type_2 = a.getType(); - DataType _type_3 = _type_2.getType(); - boolean _isDataClass = this._typeHelpers.isDataClass(_type_3); - if (_isDataClass) { - CharSequence _xblockexpression_1 = null; - { - RefableType _type_4 = a.getType(); - DataType _type_5 = _type_4.getType(); - DataClass dataClass = ((DataClass) _type_5); - StringConcatenation _builder_1 = new StringConcatenation(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(dataClass); - for(final Attribute at : _allAttributes) { - List _union = this.roomExt.union(path, at); - CharSequence _genGetAttributeValues = this.genGetAttributeValues(_union, ai); - _builder_1.append(_genGetAttributeValues, ""); - _builder_1.newLineIfNotEmpty(); - } - } - _xblockexpression_1 = _builder_1; - } - _xifexpression_1 = _xblockexpression_1; - } - _xifexpression = _xifexpression_1; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - private CharSequence genSetAttributeValues1(final List path, final ActorInstance ai) { - CharSequence _xblockexpression = null; - { - Attribute a = IterableExtensions.last(path); - String aVarName = this.toAbsolutePath(path, "_"); - CharSequence _xifexpression = null; - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1); - if (_isEnumerationOrPrimitive) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("id = \""); - String _path = ai.getPath(); - _builder.append(_path, ""); - String _absolutePath = this.toAbsolutePath(path, "/"); - _builder.append(_absolutePath, ""); - _builder.append("\";"); - _builder.newLineIfNotEmpty(); - { - int _size = a.getSize(); - boolean _equals = (_size == 0); - if (_equals) { - RefableType _type_2 = a.getType(); - DataType _type_3 = _type_2.getType(); - String _typeName = this._typeHelpers.typeName(_type_3); - String _wrapper = this.stdExt.toWrapper(_typeName); - _builder.append(_wrapper, ""); - } else { - RefableType _type_4 = a.getType(); - DataType _type_5 = _type_4.getType(); - String _typeName_1 = this._typeHelpers.typeName(_type_5); - _builder.append(_typeName_1, ""); - _builder.append("[]"); - } - } - _builder.append(" "); - _builder.append(aVarName, ""); - _builder.append(" = null;"); - _builder.newLineIfNotEmpty(); - _builder.append("object = values.get(id);"); - _builder.newLine(); - _builder.append("if(object != null){"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(aVarName, "\t"); - _builder.append(" = ensure"); - RefableType _type_6 = a.getType(); - DataType _type_7 = _type_6.getType(); - String _typeName_2 = this._typeHelpers.typeName(_type_7); - String _firstUpper = StringExtensions.toFirstUpper(_typeName_2); - _builder.append(_firstUpper, "\t"); - { - int _size_1 = a.getSize(); - boolean _greaterThan = (_size_1 > 0); - if (_greaterThan) { - _builder.append("Array"); - } - } - _builder.append("(object"); - { - int _size_2 = a.getSize(); - boolean _greaterThan_1 = (_size_2 > 0); - if (_greaterThan_1) { - _builder.append(", "); - int _size_3 = a.getSize(); - _builder.append(_size_3, "\t"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - ActorClass _actorClass = ai.getActorClass(); - CharSequence _genMinMaxCheck = this.genMinMaxCheck(path, _actorClass); - _builder.append(_genMinMaxCheck, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if(!"); - { - int _size_4 = a.getSize(); - boolean _equals_1 = (_size_4 == 0); - if (_equals_1) { - _builder.append(aVarName, "\t"); - _builder.append(".equals("); - } else { - _builder.append("Arrays.equals("); - _builder.append(aVarName, "\t"); - _builder.append(", "); - } - } - _builder.append("("); - { - int _size_5 = a.getSize(); - boolean _equals_2 = (_size_5 == 0); - if (_equals_2) { - RefableType _type_8 = a.getType(); - DataType _type_9 = _type_8.getType(); - String _typeName_3 = this._typeHelpers.typeName(_type_9); - String _wrapper_1 = this.stdExt.toWrapper(_typeName_3); - _builder.append(_wrapper_1, "\t"); - } else { - RefableType _type_10 = a.getType(); - DataType _type_11 = _type_10.getType(); - String _typeName_4 = this._typeHelpers.typeName(_type_11); - _builder.append(_typeName_4, "\t"); - _builder.append("[]"); - } - } - _builder.append(")getDiffMap().get(id)))"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("changed = true;"); - _builder.newLine(); - _builder.append("} else"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("warning(id, \"is missing\");"); - _builder.newLine(); - _xifexpression = _builder; - } else { - CharSequence _xifexpression_1 = null; - RefableType _type_12 = a.getType(); - DataType _type_13 = _type_12.getType(); - boolean _isDataClass = this._typeHelpers.isDataClass(_type_13); - if (_isDataClass) { - CharSequence _xblockexpression_1 = null; - { - RefableType _type_14 = a.getType(); - DataType _type_15 = _type_14.getType(); - DataClass dataClass = ((DataClass) _type_15); - StringConcatenation _builder_1 = new StringConcatenation(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(dataClass); - for(final Attribute at : _allAttributes) { - List _union = this.roomExt.union(path, at); - CharSequence _genSetAttributeValues1 = this.genSetAttributeValues1(_union, ai); - _builder_1.append(_genSetAttributeValues1, ""); - _builder_1.newLineIfNotEmpty(); - } - } - _xblockexpression_1 = _builder_1; - } - _xifexpression_1 = _xblockexpression_1; - } - _xifexpression = _xifexpression_1; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } - - private CharSequence genSetAttributeValues2(final List path, final ActorInstance ai) { - CharSequence _xblockexpression = null; - { - Attribute a = IterableExtensions.last(path); - String aVarName = this.toAbsolutePath(path, "_"); - CharSequence _xifexpression = null; - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1); - if (_isEnumerationOrPrimitive) { - CharSequence _xblockexpression_1 = null; - { - String _xifexpression_1 = null; - int _size = path.size(); - boolean _greaterThan = (_size > 1); - if (_greaterThan) { - int _size_1 = path.size(); - int _minus = (_size_1 - 1); - Iterable _take = IterableExtensions.take(path, _minus); - CharSequence _invokeGetters = this.helpers.invokeGetters(_take, null); - _xifexpression_1 = (_invokeGetters + "."); - } else { - _xifexpression_1 = ""; - } - final String getters = _xifexpression_1; - StringConcatenation _builder = new StringConcatenation(); - _builder.append("if("); - _builder.append(aVarName, ""); - _builder.append(" != null){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _varName = this.getVarName(ai); - _builder.append(_varName, "\t"); - _builder.append("."); - _builder.append(getters, "\t"); - String _name = a.getName(); - CharSequence _invokeSetter = this.helpers.invokeSetter(_name, null, aVarName); - _builder.append(_invokeSetter, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("getDiffMap().put(\""); - String _path = ai.getPath(); - _builder.append(_path, "\t"); - String _absolutePath = this.toAbsolutePath(path, "/"); - _builder.append(_absolutePath, "\t"); - _builder.append("\", "); - _builder.append(aVarName, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression_1 = _builder; - } - _xifexpression = _xblockexpression_1; - } else { - CharSequence _xifexpression_1 = null; - RefableType _type_2 = a.getType(); - DataType _type_3 = _type_2.getType(); - boolean _isDataClass = this._typeHelpers.isDataClass(_type_3); - if (_isDataClass) { - CharSequence _xblockexpression_2 = null; - { - RefableType _type_4 = a.getType(); - DataType _type_5 = _type_4.getType(); - final DataClass dataClass = ((DataClass) _type_5); - StringConcatenation _builder = new StringConcatenation(); - { - List _allAttributes = this._roomHelpers.getAllAttributes(dataClass); - for(final Attribute at : _allAttributes) { - List _union = this.roomExt.union(path, at); - CharSequence _genSetAttributeValues2 = this.genSetAttributeValues2(_union, ai); - _builder.append(_genSetAttributeValues2, ""); - _builder.newLineIfNotEmpty(); - } - } - _xblockexpression_2 = _builder; - } - _xifexpression_1 = _xblockexpression_2; - } - _xifexpression = _xifexpression_1; - } - _xblockexpression = _xifexpression; - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java b/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java deleted file mode 100644 index f1fe99688..000000000 --- a/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java +++ /dev/null @@ -1,977 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.ui.wizard; - -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.etrice.generator.ui.preferences.PreferenceConstants; -import org.eclipse.ui.preferences.ScopedPreferenceStore; -import org.eclipse.xtend2.lib.StringConcatenation; - -/** - * @author Henrik Rentz-Reichert - */ -@SuppressWarnings("all") -public class ProjectFileFragments { - public static String getBasicRoomModel(final String baseName) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("RoomModel "); - _builder.append(baseName, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("LogicalSystem "); - _builder.append(baseName, "\t"); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("SubSystemRef main: MainSubSystem"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("SubSystemClass MainSubSystem {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("ActorRef appl: Application"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("LogicalThread defaultThread"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("ActorClass Application {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - return _builder.toString(); - } - - /** - * @see ETPhysUtil - */ - public static String getBasicPhysicalModel(final String baseName) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("PhysicalModel "); - _builder.append(baseName, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("PhysicalSystem PhysSys1 {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("NodeRef nodeRef1 : NodeClass1"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("NodeClass NodeClass1 {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("runtime = RuntimeClass1"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("priomin = -10"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("priomax = 10"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("DefaultThread PhysicalThread1 {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("execmode = mixed"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("interval = 100ms"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("prio = 0"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("stacksize = 1024"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("msgblocksize = 32"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("msgpoolsize = 10"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("RuntimeClass RuntimeClass1 {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("model = multiThreaded"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("} "); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - return _builder.toString(); - } - - public static String getBasicMappingModel(final String baseName) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("MappingModel "); - _builder.append(baseName, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("import "); - _builder.append(baseName, "\t"); - _builder.append(".* from \""); - _builder.append(baseName, "\t"); - _builder.append(".room\""); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("import "); - _builder.append(baseName, "\t"); - _builder.append(".* from \""); - _builder.append(baseName, "\t"); - _builder.append(".etphys\""); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("Mapping "); - _builder.append(baseName, "\t"); - _builder.append(" -> PhysSys1 {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("SubSystemMapping main -> nodeRef1 {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("ThreadMapping defaultThread -> PhysicalThread1"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - return _builder.toString(); - } - - public static String getGeneratorLaunchConfig(final String targetLanguage, final String modelPath, final String baseName, final String mainMethodName, final String[] addLines) { - String _xblockexpression = null; - { - final ScopedPreferenceStore prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.generator.ui"); - final boolean useTranslation = prefStore.getBoolean(PreferenceConstants.GEN_USE_TRANSLATION); - StringConcatenation _builder = new StringConcatenation(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - { - for(final String line : addLines) { - _builder.append(line, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append(""); - _builder.newLine(); - _xblockexpression = _builder.toString(); - } - return _xblockexpression; - } - - public static String getLaunchJavaApplicationConfig(final String project, final String mdlName, final String mainClass) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLine(); - return _builder.toString(); - } - - public static String getLaunchCApplicationConfig(final String project) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - return _builder.toString(); - } - - public static String getMavenPOM(final String project, final String mdlName, final String mainClass) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append(""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("4.0.0"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(""); - _builder.append(project, "\t"); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(""); - _builder.append(mdlName, "\t"); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("1.0.0"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("repo.eclipse.org-snapshots"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("eTrice Repository - Snapshots"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("https://repo.eclipse.org/content/repositories/etrice-snapshots/"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("repo.eclipse.org-snapshots"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("eTrice Repository - Snapshots"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("https://repo.eclipse.org/content/repositories/etrice-snapshots/"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("src-gen"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("src-gen"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append("**/*.java"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("org.codehaus.mojo"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("build-helper-maven-plugin"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("1.7"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append("add-source"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append("generate-sources"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append("add-source"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t"); - _builder.append("src"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("org.eclipse.etrice"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("org.eclipse.etrice.generator.java.mvn"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("0.5.0-SNAPSHOT"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append("eTriceJavaGenerator"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t "); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t "); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t \t"); - _builder.append("model/"); - _builder.append(mdlName, "\t\t\t\t \t"); - _builder.append(".etmap"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t\t "); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t "); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append("org.eclipse.etrice"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append("org.eclipse.etrice.modellib.java"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append("0.5.0-SNAPSHOT"); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("maven-compiler-plugin"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("3.1"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append("1.6"); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append("1.6"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("maven-assembly-plugin"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append("package"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append("single"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append("jar-with-dependencies"); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.append(mdlName, "\t\t\t\t\t\t\t"); - _builder.append("."); - _builder.append(mainClass, "\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append("org.eclipse.m2e"); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append("lifecycle-mapping"); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append("1.0.0"); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t"); - _builder.append("org.eclipse.etrice"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t"); - _builder.append("org.eclipse.etrice.generator.java.mvn"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t"); - _builder.append("[0.5.0-SNAPSHOT,)"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t\t"); - _builder.append("eTriceJavaGenerator"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t"); - _builder.append("org.codehaus.mojo"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t"); - _builder.append("build-helper-maven-plugin"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t"); - _builder.append("[1.7,)"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t"); - _builder.append("add-source"); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("org.eclipse.etrice"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("org.eclipse.etrice.runtime.java"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("0.5.0-SNAPSHOT"); - _builder.newLine(); - _builder.append("\t \t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t \t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t \t\t"); - _builder.append("org.eclipse.etrice"); - _builder.newLine(); - _builder.append("\t \t\t"); - _builder.append("org.eclipse.etrice.modellib.java"); - _builder.newLine(); - _builder.append("\t \t\t"); - _builder.append("0.5.0-SNAPSHOT"); - _builder.newLine(); - _builder.append("\t \t"); - _builder.append(""); - _builder.newLine(); - _builder.append("\t"); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - return _builder.toString(); - } - - public static String getMavenBuilder(final String project) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLine(); - return _builder.toString(); - } - - public static String getMavenLauncher(final String project, final String mdlName) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLine(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLineIfNotEmpty(); - _builder.append(""); - _builder.newLine(); - return _builder.toString(); - } -} diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.java deleted file mode 100644 index 2b60bb84b..000000000 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Juergen Haug - */ -package org.eclipse.etrice.generator.base; - -import java.util.List; -import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Pure; - -@Accessors -@SuppressWarnings("all") -public class GlobalGeneratorSettings { - private final List inputModelURIs = CollectionLiterals.newArrayList(); - - private boolean generateAsLibrary = false; - - private boolean generateMSCInstrumentation = false; - - private boolean generateDataInstrumentation = false; - - private boolean noTranslation = false; - - private String mainMethodName = "main"; - - private String generatorModelPath = null; - - private boolean generateDocumentation = false; - - private boolean generateWithVerboseOutput = false; - - private boolean debugMode = false; - - @Pure - public List getInputModelURIs() { - return this.inputModelURIs; - } - - @Pure - public boolean isGenerateAsLibrary() { - return this.generateAsLibrary; - } - - public void setGenerateAsLibrary(final boolean generateAsLibrary) { - this.generateAsLibrary = generateAsLibrary; - } - - @Pure - public boolean isGenerateMSCInstrumentation() { - return this.generateMSCInstrumentation; - } - - public void setGenerateMSCInstrumentation(final boolean generateMSCInstrumentation) { - this.generateMSCInstrumentation = generateMSCInstrumentation; - } - - @Pure - public boolean isGenerateDataInstrumentation() { - return this.generateDataInstrumentation; - } - - public void setGenerateDataInstrumentation(final boolean generateDataInstrumentation) { - this.generateDataInstrumentation = generateDataInstrumentation; - } - - @Pure - public boolean isNoTranslation() { - return this.noTranslation; - } - - public void setNoTranslation(final boolean noTranslation) { - this.noTranslation = noTranslation; - } - - @Pure - public String getMainMethodName() { - return this.mainMethodName; - } - - public void setMainMethodName(final String mainMethodName) { - this.mainMethodName = mainMethodName; - } - - @Pure - public String getGeneratorModelPath() { - return this.generatorModelPath; - } - - public void setGeneratorModelPath(final String generatorModelPath) { - this.generatorModelPath = generatorModelPath; - } - - @Pure - public boolean isGenerateDocumentation() { - return this.generateDocumentation; - } - - public void setGenerateDocumentation(final boolean generateDocumentation) { - this.generateDocumentation = generateDocumentation; - } - - @Pure - public boolean isGenerateWithVerboseOutput() { - return this.generateWithVerboseOutput; - } - - public void setGenerateWithVerboseOutput(final boolean generateWithVerboseOutput) { - this.generateWithVerboseOutput = generateWithVerboseOutput; - } - - @Pure - public boolean isDebugMode() { - return this.debugMode; - } - - public void setDebugMode(final boolean debugMode) { - this.debugMode = debugMode; - } -} diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java deleted file mode 100644 index 509b81d29..000000000 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.generic; - -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem; -import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.SAP; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.ServiceImplementation; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.fsm.base.Indexed; -import org.eclipse.etrice.generator.fsm.generic.IIfItemIdGenerator; -import org.eclipse.etrice.generator.generic.ILanguageExtension; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtext.util.Pair; -import org.eclipse.xtext.util.Tuples; -import org.eclipse.xtext.xbase.lib.Extension; - -/** - * Target language independent part of an actor class generator. - * It uses the {@link ILanguageExtension}. - */ -@SuppressWarnings("all") -public class GenericActorClassGenerator implements IIfItemIdGenerator { - @Inject - @Extension - protected RoomHelpers _roomHelpers; - - @Inject - @Extension - protected RoomExtensions _roomExtensions; - - @Inject - protected ILanguageExtension langExt; - - /** - * Generate constants for the local IDs of all interface items of an actor - * class. - * - * @param xpac an {@link ExpandedActorClass} - * @return the generated code - */ - public String genInterfaceItemConstants(final ExpandedActorClass xpac) { - final ActorClass ac = xpac.getActorClass(); - List _xifexpression = null; - boolean _usesInheritance = this.langExt.usesInheritance(); - if (_usesInheritance) { - _xifexpression = this._roomHelpers.getEndPorts(ac); - } else { - _xifexpression = this._roomHelpers.getAllEndPorts(ac); - } - final List endPorts = _xifexpression; - List _xifexpression_1 = null; - boolean _usesInheritance_1 = this.langExt.usesInheritance(); - if (_usesInheritance_1) { - _xifexpression_1 = ac.getServiceAccessPoints(); - } else { - _xifexpression_1 = this._roomHelpers.getAllSAPs(ac); - } - final List strSAPs = _xifexpression_1; - List _xifexpression_2 = null; - boolean _usesInheritance_2 = this.langExt.usesInheritance(); - if (_usesInheritance_2) { - _xifexpression_2 = ac.getServiceImplementations(); - } else { - _xifexpression_2 = this._roomHelpers.getAllServiceImplementations(ac); - } - final List svcImpls = _xifexpression_2; - final ArrayList> list = new ArrayList>(); - for (final Port ep : endPorts) { - String _ifItemId = this.getIfItemId(ep); - int _interfaceItemLocalId = xpac.getInterfaceItemLocalId(ep); - int _plus = (1 + _interfaceItemLocalId); - String _string = Integer.valueOf(_plus).toString(); - Pair _pair = Tuples.pair(_ifItemId, _string); - list.add(_pair); - } - for (final SAP sap : strSAPs) { - String _ifItemId_1 = this.getIfItemId(sap); - int _interfaceItemLocalId_1 = xpac.getInterfaceItemLocalId(sap); - int _plus_1 = (1 + _interfaceItemLocalId_1); - String _string_1 = Integer.valueOf(_plus_1).toString(); - Pair _pair_1 = Tuples.pair(_ifItemId_1, _string_1); - list.add(_pair_1); - } - for (final ServiceImplementation svc : svcImpls) { - SPP _spp = svc.getSpp(); - String _ifItemId_2 = this.getIfItemId(_spp); - SPP _spp_1 = svc.getSpp(); - int _interfaceItemLocalId_2 = xpac.getInterfaceItemLocalId(_spp_1); - int _plus_2 = (1 + _interfaceItemLocalId_2); - String _string_2 = Integer.valueOf(_plus_2).toString(); - Pair _pair_2 = Tuples.pair(_ifItemId_2, _string_2); - list.add(_pair_2); - } - return this.langExt.genEnumeration("interface_items", list); - } - - public String genInterfaceItemConstantsForOptionalActor(final ActorClass ac) { - final List ports = this._roomHelpers.getAllInterfacePorts(ac); - final ArrayList> list = new ArrayList>(); - Iterable> _indexed = Indexed.indexed(ports); - for (final Indexed ep : _indexed) { - Port _value = ep.getValue(); - String _ifItemId = this.getIfItemId(_value); - int _index1 = ep.getIndex1(); - String _string = Integer.valueOf(_index1).toString(); - Pair _pair = Tuples.pair(_ifItemId, _string); - list.add(_pair); - } - return this.langExt.genEnumeration("interface_items", list); - } - - @Override - public String getIfItemId(final AbstractInterfaceItem item) { - String _name = item.getName(); - return ("IFITEM_" + _name); - } -} diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java deleted file mode 100644 index 8b476a3c3..000000000 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.generic; - -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem; -import org.eclipse.etrice.core.fsm.fSM.MessageFromIf; -import org.eclipse.etrice.core.room.GeneralProtocolClass; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.SAP; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.fsm.generic.IMessageIdGenerator; -import org.eclipse.etrice.generator.generic.ILanguageExtension; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtext.util.Pair; -import org.eclipse.xtext.util.Tuples; -import org.eclipse.xtext.xbase.lib.Extension; - -/** - * Target language independent protocol class generator. - */ -@SuppressWarnings("all") -public class GenericProtocolClassGenerator implements IMessageIdGenerator { - @Inject - @Extension - protected RoomHelpers _roomHelpers; - - @Inject - @Extension - protected ILanguageExtension _iLanguageExtension; - - @Inject - @Extension - protected RoomExtensions _roomExtensions; - - /** - * Generate constants for message IDs. - * - * @param pc the {@link ProtocolClass} - * @return the generated code for message ID constants - */ - public String genMessageIDs(final ProtocolClass pc) { - int offset = 0; - ArrayList> list = new ArrayList>(); - String _name = pc.getName(); - String _memberInDeclaration = this._iLanguageExtension.memberInDeclaration(_name, "MSG_MIN"); - String _string = Integer.valueOf(offset).toString(); - Pair _pair = Tuples.pair(_memberInDeclaration, _string); - list.add(_pair); - List _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); - for (final Message msg : _allOutgoingMessages) { - { - offset = (offset + 1); - String _name_1 = pc.getName(); - String _name_2 = msg.getName(); - String _plus = ("OUT_" + _name_2); - String _memberInDeclaration_1 = this._iLanguageExtension.memberInDeclaration(_name_1, _plus); - String _string_1 = Integer.valueOf(offset).toString(); - Pair _pair_1 = Tuples.pair(_memberInDeclaration_1, _string_1); - list.add(_pair_1); - } - } - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - for (final Message msg_1 : _allIncomingMessages) { - { - offset = (offset + 1); - String _name_1 = pc.getName(); - String _name_2 = msg_1.getName(); - String _plus = ("IN_" + _name_2); - String _memberInDeclaration_1 = this._iLanguageExtension.memberInDeclaration(_name_1, _plus); - String _string_1 = Integer.valueOf(offset).toString(); - Pair _pair_1 = Tuples.pair(_memberInDeclaration_1, _string_1); - list.add(_pair_1); - } - } - offset = (offset + 1); - String _name_1 = pc.getName(); - String _memberInDeclaration_1 = this._iLanguageExtension.memberInDeclaration(_name_1, "MSG_MAX"); - String _string_1 = Integer.valueOf(offset).toString(); - Pair _pair_1 = Tuples.pair(_memberInDeclaration_1, _string_1); - list.add(_pair_1); - String _name_2 = pc.getName(); - String _memberInDeclaration_2 = this._iLanguageExtension.memberInDeclaration(_name_2, "msg_ids"); - return this._iLanguageExtension.genEnumeration(_memberInDeclaration_2, list); - } - - /** - * @param mif a {@link MessageFromIf} - * @return an identifier for the message - */ - @Override - public String getMessageID(final MessageFromIf mif) { - EObject _message = mif.getMessage(); - AbstractInterfaceItem _from = mif.getFrom(); - return this.getMessageID(((Message) _message), ((InterfaceItem) _from)); - } - - /** - * @param msg a {@link Message} - * @param item a {@link InterfaceItem} - * @return an identifier for the message - */ - public String getMessageID(final Message msg, final InterfaceItem item) { - if ((item instanceof Port)) { - Port p = ((Port) item); - String _xifexpression = null; - boolean _isConjugated = p.isConjugated(); - if (_isConjugated) { - _xifexpression = "OUT_"; - } else { - _xifexpression = "IN_"; - } - String direction = _xifexpression; - GeneralProtocolClass _protocol = p.getProtocol(); - String _name = _protocol.getName(); - String _name_1 = msg.getName(); - String _plus = (direction + _name_1); - return this._iLanguageExtension.memberInUse(_name, _plus); - } else { - if ((item instanceof SAP)) { - SAP sap = ((SAP) item); - ProtocolClass _protocol_1 = sap.getProtocol(); - String _name_2 = _protocol_1.getName(); - String _name_3 = msg.getName(); - String _plus_1 = ("OUT_" + _name_3); - return this._iLanguageExtension.memberInUse(_name_2, _plus_1); - } else { - if ((item instanceof SPP)) { - SPP spp = ((SPP) item); - ProtocolClass _protocol_2 = spp.getProtocol(); - String _name_4 = _protocol_2.getName(); - String _name_5 = msg.getName(); - String _plus_2 = ("IN_" + _name_5); - return this._iLanguageExtension.memberInUse(_name_4, _plus_2); - } - } - } - return "unknown interface item"; - } -} diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java deleted file mode 100644 index d31d8c586..000000000 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java +++ /dev/null @@ -1,441 +0,0 @@ -/** - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.generic; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.fsm.fSM.Guard; -import org.eclipse.etrice.core.fsm.fSM.GuardedTransition; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; -import org.eclipse.etrice.core.fsm.fSM.NonInitialTransition; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.fSM.Trigger; -import org.eclipse.etrice.core.fsm.fSM.TriggeredTransition; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedModelComponent; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedRefinedState; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.TransitionChain; -import org.eclipse.etrice.generator.fsm.generic.AbstractStateMachineGenerator; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -/** - * A target language independent generator of the state machine implementation - */ -@SuppressWarnings("all") -public class GenericStateMachineGenerator extends AbstractStateMachineGenerator { - /** - * generates the code of the whole state machine, consisting of constants + methods - * - * @param xpmc the {@link ExpandedModelComponent} - * @return the generated code - */ - public CharSequence genStateMachine(final ExpandedModelComponent xpmc) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _genStateMachineConstants = this.genStateMachineConstants(xpmc); - _builder.append(_genStateMachineConstants, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _genStateMachineMethods = this.genStateMachineMethods(xpmc, true); - _builder.append(_genStateMachineMethods, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - /** - * generates the constants for the state machine - */ - public CharSequence genStateMachineConstants(final ExpandedModelComponent xpmc) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/* state IDs */"); - _builder.newLine(); - String _genStateIdConstants = this.genStateIdConstants(xpmc); - _builder.append(_genStateIdConstants, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* transition chains */"); - _builder.newLine(); - String _genTransitionChainConstants = this.genTransitionChainConstants(xpmc); - _builder.append(_genTransitionChainConstants, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* triggers */"); - _builder.newLine(); - String _genTriggerConstants = this.genTriggerConstants(xpmc); - _builder.append(_genTriggerConstants, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - /** - * generates the methods for the state machine codes and state switching - * - * @param xpmc the {@link ExpandedModelComponent} - * @param generateImplemenation or declaration only - * @return the generated code - */ - public CharSequence genStateMachineMethods(final ExpandedModelComponent xpmc, final boolean generateImplementation) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _genExtra = this.genExtra(xpmc, generateImplementation); - _builder.append(_genExtra, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* Entry and Exit Codes */"); - _builder.newLine(); - String _genEntryAndExitCodes = this.genEntryAndExitCodes(xpmc, generateImplementation); - _builder.append(_genEntryAndExitCodes, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* Action Codes */"); - _builder.newLine(); - String _genActionCodes = this.genActionCodes(xpmc, generateImplementation); - _builder.append(_genActionCodes, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* State Switch Methods */"); - _builder.newLine(); - String _genStateSwitchMethods = this.genStateSwitchMethods(xpmc, generateImplementation); - _builder.append(_genStateSwitchMethods, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - /** - * generate a transition guard if applicable - * - * @param tt a {@link TriggeredTransition} - * @param trigger a trigger string - * @param xpmc an expanded actor class - * @return the generated code - */ - @Override - public String guard(final TriggeredTransition tt, final String trigger, final ExpandedModelComponent mc) { - String _xblockexpression = null; - { - EList _triggers = tt.getTriggers(); - final Function1 _function = (Trigger e) -> { - return Boolean.valueOf(mc.isMatching(e, trigger)); - }; - final Trigger tr = IterableExtensions.findFirst(_triggers, _function); - StringConcatenation _builder = new StringConcatenation(); - { - boolean _hasGuard = this._fSMHelpers.hasGuard(tr); - if (_hasGuard) { - _builder.append("if ("); - Guard _guard = tr.getGuard(); - DetailCode _guard_1 = _guard.getGuard(); - String _translatedCode = this.translator.getTranslatedCode(_guard_1); - _builder.append(_translatedCode, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - } - } - _xblockexpression = _builder.toString(); - } - return _xblockexpression; - } - - @Override - public String guard(final GuardedTransition tt, final String trigger, final ExpandedModelComponent mc) { - StringConcatenation _builder = new StringConcatenation(); - DetailCode _guard = tt.getGuard(); - String _translatedCode = this.translator.getTranslatedCode(_guard); - _builder.append(_translatedCode, ""); - _builder.newLineIfNotEmpty(); - return _builder.toString(); - } - - @Override - public String genActionCodeMethod(final ExpandedModelComponent xpmc, final Transition tr, final boolean generateImplementation) { - String _xblockexpression = null; - { - EList chain = xpmc.getChains(tr); - boolean hasArgs = ((!chain.isEmpty()) && IterableExtensions.forall(chain, ((Function1) (TransitionChain it) -> { - return Boolean.valueOf(((it.getTransition() instanceof NonInitialTransition) && (!(it.getTransition() instanceof GuardedTransition)))); - }))); - String _className = this.getClassName(xpmc); - final String opScope = this.langExt.operationScope(_className, false); - String _xifexpression = null; - boolean _usesInheritance = this.langExt.usesInheritance(); - if (_usesInheritance) { - _xifexpression = opScope; - } else { - _xifexpression = ""; - } - final String opScopePriv = _xifexpression; - String _pointerLiteral = this.langExt.pointerLiteral(); - final String ifItemPtr = ("InterfaceItemBase" + _pointerLiteral); - String _xifexpression_1 = null; - boolean _usesPointers = this.langExt.usesPointers(); - if (_usesPointers) { - _xifexpression_1 = ("const " + ifItemPtr); - } else { - _xifexpression_1 = ifItemPtr; - } - final String constIfItemPtr = _xifexpression_1; - String _xifexpression_2 = null; - if (generateImplementation) { - StringConcatenation _builder = new StringConcatenation(); - String _accessLevelProtected = this.langExt.accessLevelProtected(); - _builder.append(_accessLevelProtected, ""); - _builder.append("void "); - _builder.append(opScopePriv, ""); - String _actionCodeOperationName = this._codegenHelpers.getActionCodeOperationName(tr); - _builder.append(_actionCodeOperationName, ""); - _builder.append("("); - String _className_1 = this.getClassName(xpmc); - String _selfPointer = this.langExt.selfPointer(_className_1, hasArgs); - _builder.append(_selfPointer, ""); - { - if (hasArgs) { - _builder.append(constIfItemPtr, ""); - _builder.append(" ifitem"); - String _generateArgumentList = this.transitionChainGenerator.generateArgumentList(xpmc, tr); - _builder.append(_generateArgumentList, ""); - } - } - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - DetailCode _action = tr.getAction(); - String _translatedCode = this.translator.getTranslatedCode(_action); - _builder.append(_translatedCode, " "); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - _xifexpression_2 = _builder.toString(); - } else { - StringConcatenation _builder_1 = new StringConcatenation(); - String _accessLevelProtected_1 = this.langExt.accessLevelProtected(); - _builder_1.append(_accessLevelProtected_1, ""); - String _makeOverridable = this.langExt.makeOverridable(); - _builder_1.append(_makeOverridable, ""); - _builder_1.append("void "); - String _actionCodeOperationName_1 = this._codegenHelpers.getActionCodeOperationName(tr); - _builder_1.append(_actionCodeOperationName_1, ""); - _builder_1.append("("); - String _className_2 = this.getClassName(xpmc); - String _selfPointer_1 = this.langExt.selfPointer(_className_2, hasArgs); - _builder_1.append(_selfPointer_1, ""); - { - if (hasArgs) { - _builder_1.append(constIfItemPtr, ""); - _builder_1.append(" ifitem"); - String _generateArgumentList_1 = this.transitionChainGenerator.generateArgumentList(xpmc, tr); - _builder_1.append(_generateArgumentList_1, ""); - } - } - _builder_1.append(");"); - _builder_1.newLineIfNotEmpty(); - _xifexpression_2 = _builder_1.toString(); - } - _xblockexpression = _xifexpression_2; - } - return _xblockexpression; - } - - /** - * generate action code method implementations or declarations - * - * @param xpax the {@link ExpandedModelComponent} - * @param state the {@link State} - * @param generateImplementation if only declarations should be generated then false has to be passed - * @return the generated code - */ - @Override - public String genActionCodeMethods(final ExpandedModelComponent xpmc, final State state, final boolean generateImplementation) { - String _xblockexpression = null; - { - final ModelComponent mc = xpmc.getModelComponent(); - String _className = this.getClassName(mc); - final String selfPtr = this.langExt.selfPointer(_className, false); - String _className_1 = this.getClassName(mc); - final String opScope = this.langExt.operationScope(_className_1, false); - String _xifexpression = null; - boolean _usesInheritance = this.langExt.usesInheritance(); - if (_usesInheritance) { - _xifexpression = opScope; - } else { - _xifexpression = ""; - } - final String opScopePriv = _xifexpression; - final String entryOp = this._codegenHelpers.getEntryCodeOperationName(state); - final String exitOp = this._codegenHelpers.getExitCodeOperationName(state); - final String doOp = this._codegenHelpers.getDoCodeOperationName(state); - DetailCode _entryCode = state.getEntryCode(); - String entry = this.translator.getTranslatedCode(_entryCode); - DetailCode _exitCode = state.getExitCode(); - String exit = this.translator.getTranslatedCode(_exitCode); - DetailCode _doCode = state.getDoCode(); - String docode = this.translator.getTranslatedCode(_doCode); - if ((state instanceof ExpandedRefinedState)) { - final ExpandedRefinedState rs = ((ExpandedRefinedState) state); - DetailCode _inheritedEntry = rs.getInheritedEntry(); - final String inhEntry = this.translator.getTranslatedCode(_inheritedEntry); - DetailCode _inheritedExit = rs.getInheritedExit(); - final String inhExit = this.translator.getTranslatedCode(_inheritedExit); - DetailCode _inheritedDo = rs.getInheritedDo(); - final String inhDo = this.translator.getTranslatedCode(_inheritedDo); - boolean _usesInheritance_1 = this.langExt.usesInheritance(); - if (_usesInheritance_1) { - ModelComponent _base = mc.getBase(); - final String baseName = this.getClassName(_base); - DetailCode _inheritedEntry_1 = rs.getInheritedEntry(); - boolean _hasDetailCode = this._fSMHelpers.hasDetailCode(_inheritedEntry_1); - if (_hasDetailCode) { - String _superCall = this.langExt.superCall(baseName, entryOp, ""); - String _plus = (_superCall + entry); - entry = _plus; - } - DetailCode _inheritedExit_1 = rs.getInheritedExit(); - boolean _hasDetailCode_1 = this._fSMHelpers.hasDetailCode(_inheritedExit_1); - if (_hasDetailCode_1) { - String _superCall_1 = this.langExt.superCall(baseName, exitOp, ""); - String _plus_1 = (exit + _superCall_1); - exit = _plus_1; - } - DetailCode _inheritedDo_1 = rs.getInheritedDo(); - boolean _hasDetailCode_2 = this._fSMHelpers.hasDetailCode(_inheritedDo_1); - if (_hasDetailCode_2) { - String _superCall_2 = this.langExt.superCall(baseName, doOp, ""); - String _plus_2 = (_superCall_2 + docode); - docode = _plus_2; - } - } else { - entry = (inhEntry + entry); - exit = (exit + inhExit); - docode = (inhDo + docode); - } - } - StringConcatenation _builder = new StringConcatenation(); - { - boolean _isEmpty = entry.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - { - if (generateImplementation) { - String _accessLevelProtected = this.langExt.accessLevelProtected(); - _builder.append(_accessLevelProtected, ""); - _builder.append("void "); - _builder.append(opScopePriv, ""); - _builder.append(entryOp, ""); - _builder.append("("); - _builder.append(selfPtr, ""); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(entry, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } else { - String _accessLevelProtected_1 = this.langExt.accessLevelProtected(); - _builder.append(_accessLevelProtected_1, ""); - String _makeOverridable = this.langExt.makeOverridable(); - _builder.append(_makeOverridable, ""); - _builder.append("void "); - _builder.append(entryOp, ""); - _builder.append("("); - _builder.append(selfPtr, ""); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - { - boolean _isEmpty_1 = exit.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - { - if (generateImplementation) { - String _accessLevelProtected_2 = this.langExt.accessLevelProtected(); - _builder.append(_accessLevelProtected_2, ""); - _builder.append("void "); - _builder.append(opScopePriv, ""); - _builder.append(exitOp, ""); - _builder.append("("); - _builder.append(selfPtr, ""); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(exit, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } else { - String _accessLevelProtected_3 = this.langExt.accessLevelProtected(); - _builder.append(_accessLevelProtected_3, ""); - String _makeOverridable_1 = this.langExt.makeOverridable(); - _builder.append(_makeOverridable_1, ""); - _builder.append("void "); - _builder.append(exitOp, ""); - _builder.append("("); - _builder.append(selfPtr, ""); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - { - boolean _isEmpty_2 = docode.isEmpty(); - boolean _not_2 = (!_isEmpty_2); - if (_not_2) { - { - if (generateImplementation) { - String _accessLevelProtected_4 = this.langExt.accessLevelProtected(); - _builder.append(_accessLevelProtected_4, ""); - _builder.append(" void "); - _builder.append(opScopePriv, ""); - _builder.append(doOp, ""); - _builder.append("("); - _builder.append(selfPtr, ""); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(docode, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } else { - String _accessLevelProtected_5 = this.langExt.accessLevelProtected(); - _builder.append(_accessLevelProtected_5, ""); - String _makeOverridable_2 = this.langExt.makeOverridable(); - _builder.append(_makeOverridable_2, ""); - _builder.append("void "); - _builder.append(doOp, ""); - _builder.append("("); - _builder.append(selfPtr, ""); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - _xblockexpression = _builder.toString(); - } - return _xblockexpression; - } - - /** - * let derived class add extra code after definition of constants - * - * @param xpmc an expanded actor class - * @param generateImplementation or declaration only - * @return the generated code - */ - public CharSequence genExtra(final ExpandedModelComponent xpmc, final boolean generateImplementation) { - StringConcatenation _builder = new StringConcatenation(); - return _builder; - } -} diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/PrepareFileSystem.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/PrepareFileSystem.java deleted file mode 100644 index 667fe42c5..000000000 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/PrepareFileSystem.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.generic; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.io.File; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.generator.JavaIoFileSystemAccess; -import org.eclipse.xtext.xbase.lib.Extension; - -/** - * A class that is used to recursively erase all folders receiving generated code - * an to place a readme file into those folders. - */ -@Singleton -@SuppressWarnings("all") -public class PrepareFileSystem { - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - private JavaIoFileSystemAccess fileAccess; - - @Inject - private ILogger logger; - - public void prepareCodeTargetPaths(final Resource resource) { - Set pathes = new HashSet(); - EList _contents = resource.getContents(); - for (final EObject e : _contents) { - if ((e instanceof Root)) { - EList _models = ((Root) e).getModels(); - for (final RoomModel mdl : _models) { - { - final String tgtpath = this._roomExtensions.getGenerationTargetPath(mdl); - if (((!Objects.equal(tgtpath, null)) && (!tgtpath.isEmpty()))) { - pathes.add(tgtpath); - } - } - } - } - } - this.prepare(pathes); - } - - public void prepareDocTargetPaths(final Resource resource) { - Set pathes = new HashSet(); - EList _contents = resource.getContents(); - for (final EObject e : _contents) { - if ((e instanceof Root)) { - EList _models = ((Root) e).getModels(); - for (final RoomModel mdl : _models) { - { - final String tgtpath = this._roomExtensions.getDocGenerationTargetPath(mdl); - if (((!Objects.equal(tgtpath, null)) && (!tgtpath.isEmpty()))) { - pathes.add(tgtpath); - } - } - } - } - } - this.prepare(pathes); - } - - /** - * Recursively erase all folders receiving generated code - * and place a readme file in those folders. - * The folders are determined from the used models of every generator - * model found in the resource. - * - * @param resource a {@link Resource} - */ - public void prepare(final Collection pathes) { - for (final String path : pathes) { - { - this.logger.logInfo(("clearing " + path)); - File f = new File(path); - this.eraseContents(f); - this.fileAccess.setOutputPath(path); - CharSequence _readmeText = this.readmeText(); - this.fileAccess.generateFile("readme.txt", _readmeText); - } - } - } - - private void eraseContents(final File f) { - boolean _isDirectory = f.isDirectory(); - if (_isDirectory) { - File[] children = f.listFiles(); - for (final File child : children) { - boolean _not = (!(child.isDirectory() && child.getName().equals("images"))); - if (_not) { - this.eraseContents(child); - child.delete(); - } - } - } - } - - private CharSequence readmeText() { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("This directory is an eTrice code generation target."); - _builder.newLine(); - _builder.append("It will be erased every time the generator is executed."); - _builder.newLine(); - _builder.newLine(); - _builder.append("DO NOT PLACE OTHER FILES HERE!"); - _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 deleted file mode 100644 index 4c6cebeb3..000000000 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java +++ /dev/null @@ -1,912 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * Thomas Schuetz (refactoring, adapted for other target languages) - */ -package org.eclipse.etrice.generator.generic; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorContainerClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.ClassStructor; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.Operation; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.RoomClass; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.base.AbstractGenerator; -import org.eclipse.etrice.generator.generic.ILanguageExtension; -import org.eclipse.etrice.generator.generic.TypeHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.StringExtensions; - -/** - * A collection of methods for generation of user code, attributes with getters and setters - * and operations. - */ -@Singleton -@SuppressWarnings("all") -public class ProcedureHelpers { - protected final String NEWLINE = System.getProperty("line.separator"); - - @Inject - @Extension - protected RoomHelpers _roomHelpers; - - @Inject - @Extension - protected TypeHelpers _typeHelpers; - - @Inject - protected ILanguageExtension languageExt; - - @Inject - protected ILogger logger; - - /** - * @param dc a {@link DataClass} - * @param id 0, 1 or 2 for the corresponding user codes - * @return the generated code - */ - public CharSequence userCode(final DataClass dc, final int id) { - CharSequence _switchResult = null; - switch (id) { - case 1: - String _deepUserCode1 = this._roomHelpers.getDeepUserCode1(dc); - _switchResult = this.userCode(_deepUserCode1); - break; - case 2: - String _deepUserCode2 = this._roomHelpers.getDeepUserCode2(dc); - _switchResult = this.userCode(_deepUserCode2); - break; - case 3: - String _deepUserCode3 = this._roomHelpers.getDeepUserCode3(dc); - _switchResult = this.userCode(_deepUserCode3); - break; - } - return _switchResult; - } - - /** - * @param pc a {@link ProtocolClass} - * @param id 0, 1 or 2 for the corresponding user codes - * @return the generated code - */ - public CharSequence userCode(final ProtocolClass pc, final int id) { - CharSequence _switchResult = null; - switch (id) { - case 1: - String _deepUserCode1 = this._roomHelpers.getDeepUserCode1(pc); - _switchResult = this.userCode(_deepUserCode1); - break; - case 2: - String _deepUserCode2 = this._roomHelpers.getDeepUserCode2(pc); - _switchResult = this.userCode(_deepUserCode2); - break; - case 3: - String _deepUserCode3 = this._roomHelpers.getDeepUserCode3(pc); - _switchResult = this.userCode(_deepUserCode3); - break; - } - return _switchResult; - } - - /** - * @param ac an {@link ActorContainerClass} - * @param id 0, 1 or 2 for the corresponding user codes - * @return the generated code - */ - public CharSequence userCode(final ActorContainerClass ac, final int id, final boolean includeInherited) { - CharSequence _xifexpression = null; - if (includeInherited) { - CharSequence _switchResult = null; - switch (id) { - case 1: - String _deepUserCode1 = this._roomHelpers.getDeepUserCode1(ac); - _switchResult = this.userCode(_deepUserCode1); - break; - case 2: - String _deepUserCode2 = this._roomHelpers.getDeepUserCode2(ac); - _switchResult = this.userCode(_deepUserCode2); - break; - case 3: - String _deepUserCode3 = this._roomHelpers.getDeepUserCode3(ac); - _switchResult = this.userCode(_deepUserCode3); - break; - } - _xifexpression = _switchResult; - } else { - CharSequence _switchResult_1 = null; - switch (id) { - case 1: - DetailCode _userCode1 = ac.getUserCode1(); - _switchResult_1 = this.userCode(_userCode1); - break; - case 2: - DetailCode _userCode2 = ac.getUserCode2(); - _switchResult_1 = this.userCode(_userCode2); - break; - case 3: - DetailCode _userCode3 = ac.getUserCode3(); - _switchResult_1 = this.userCode(_userCode3); - break; - } - _xifexpression = _switchResult_1; - } - return _xifexpression; - } - - /** - * @param dc some {@link DetailCode} - * @return a string containing the expanded code surrounded by - * comments (no tag replacement will happen) - */ - public CharSequence userCode(final DetailCode dc) { - String _detailCode = this._roomHelpers.getDetailCode(dc); - return this.userCode(_detailCode); - } - - private CharSequence userCode(final String code) { - StringConcatenation _builder = new StringConcatenation(); - { - if (((!Objects.equal(code, null)) && (!code.isEmpty()))) { - _builder.append("/*--------------------- begin user code ---------------------*/"); - _builder.newLine(); - _builder.append(code, ""); - _builder.newLineIfNotEmpty(); - _builder.append("/*--------------------- end user code ---------------------*/"); - _builder.newLine(); - } - } - return _builder; - } - - /** - * @param attributes a list of {@link Attribute}s - * @return code declaring the attributes - */ - public CharSequence attributes(final List attributes) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/*--------------------- attributes ---------------------*/"); - _builder.newLine(); - { - for(final Attribute it : attributes) { - CharSequence _attributeDeclaration = this.attributeDeclaration(it); - _builder.append(_attributeDeclaration, ""); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - /** - * @param attribute an {@link Attribute} - * @return the code declaring the attribute - */ - public CharSequence attributeDeclaration(final Attribute attribute) { - StringConcatenation _builder = new StringConcatenation(); - String _accessLevelPublic = this.languageExt.accessLevelPublic(); - _builder.append(_accessLevelPublic, ""); - _builder.append(" "); - String _declarationString = this.declarationString(attribute); - _builder.append(_declarationString, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - return _builder; - } - - /** - * @param attribute an {@link Attribute} - * @return the code for an array initializer - */ - public String arrayInitializer(final Attribute att) { - String _xifexpression = null; - String _defaultValueLiteral = att.getDefaultValueLiteral(); - boolean _notEquals = (!Objects.equal(_defaultValueLiteral, null)); - if (_notEquals) { - _xifexpression = att.getDefaultValueLiteral(); - } else { - RefableType _type = att.getType(); - DataType _type_1 = _type.getType(); - _xifexpression = this.languageExt.defaultValue(_type_1); - } - final String dflt = _xifexpression; - boolean _startsWith = dflt.startsWith("{"); - if (_startsWith) { - String[] _split = dflt.split(","); - int _size = ((List)Conversions.doWrapArray(_split)).size(); - int _size_1 = att.getSize(); - boolean _notEquals_1 = (_size != _size_1); - if (_notEquals_1) { - String _name = att.getName(); - String _plus = ("WARNING: array size determined by initializer differs from attribute size (" + _name); - String _plus_1 = (_plus + "["); - int _size_2 = att.getSize(); - String _plus_2 = (_plus_1 + Integer.valueOf(_size_2)); - String _plus_3 = (_plus_2 + "] <-> "); - String _plus_4 = (_plus_3 + dflt); - String _plus_5 = (_plus_4 + ")"); - this.logger.logInfo(_plus_5); - } - return dflt; - } - String result = "{"; - int i = 0; - while ((i < att.getSize())) { - { - result = (result + dflt); - i = (i + 1); - int _size_3 = att.getSize(); - boolean _lessThan = (i < _size_3); - if (_lessThan) { - result = (result + ", "); - } - } - } - return (result + "}"); - } - - /** - * @param EnumTest a list of {@link Attribute}s - * @param classname the name of the defining class - * @return code declaring setters and getters for the attributes - */ - public CharSequence attributeSettersGettersDeclaration(final List attributes, final String classname) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/* --------------------- attribute setters and getters */"); - _builder.newLine(); - { - for(final Attribute attribute : attributes) { - CharSequence _setterHeader = this.setterHeader(attribute, classname); - _builder.append(_setterHeader, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - CharSequence _terHeader = this.getterHeader(attribute, classname); - _builder.append(_terHeader, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - /** - * @param EnumTest a list of {@link Attribute}s - * @param classname the name of the defining class - * @return code defining setters and getters for the attributes - */ - public CharSequence attributeSettersGettersImplementation(final List attributes, final String classname) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/* --------------------- attribute setters and getters */"); - _builder.newLine(); - { - for(final Attribute attribute : attributes) { - CharSequence _setterHeader = this.setterHeader(attribute, classname); - _builder.append(_setterHeader, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t "); - String _memberAccess = this.languageExt.memberAccess(); - _builder.append(_memberAccess, "\t "); - String _name = attribute.getName(); - _builder.append(_name, "\t "); - _builder.append(" = "); - String _name_1 = attribute.getName(); - _builder.append(_name_1, "\t "); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - CharSequence _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, "\t"); - String _name_2 = attribute.getName(); - _builder.append(_name_2, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - return _builder; - } - - /** - * @param attribute an {@link Attribute} - * @param classname the name of the defining class - * @return code for the attribute setter declaration - */ - protected CharSequence 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, ""); - String _argList = this.argList(Collections.unmodifiableList(CollectionLiterals.newArrayList(attribute))); - _builder.append(_argList, ""); - _builder.append(")"); - return _builder; - } - - /** - * @param attribute an {@link Attribute} - * @param classname the name of the defining class - * @return code for the attribute getter declaration - */ - protected CharSequence getterHeader(final Attribute attribute, final String classname) { - StringConcatenation _builder = new StringConcatenation(); - String _accessLevelPublic = this.languageExt.accessLevelPublic(); - _builder.append(_accessLevelPublic, ""); - String _signatureString = this.signatureString(attribute); - _builder.append(_signatureString, ""); - _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; - } - - /** - * @param attributes a list of {@link Attribute}s - * @return an argument list for the attributes - */ - public String argList(final Iterable attributes) { - final Function1 _function = (Attribute it) -> { - String _signatureString = this.signatureString(it); - String _plus = (_signatureString + " "); - String _name = it.getName(); - return (_plus + _name); - }; - Iterable _map = IterableExtensions.map(attributes, _function); - return IterableExtensions.join(_map, ", "); - } - - /** - * @param EnumTest an iterable of {@link Attribute}s representing a path - * @param classname the name of the defining class - * @return the invocation code for the call of a setter - */ - public CharSequence invokeGetters(final Iterable path, final String classname) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _hasElements = false; - for(final Attribute a : path) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(".", ""); - } - String _name = a.getName(); - CharSequence _invokeGetter = this.invokeGetter(_name, classname); - _builder.append(_invokeGetter, ""); - } - } - return _builder; - } - - /** - * @param typeName the type name of the attribute - * @param name the name of the attribute - * @param classname the name of the type defining the getter - * @return code defining the attribute getter - */ - public CharSequence getterImplementation(final String typeName, final String name, final String classname) { - StringConcatenation _builder = new StringConcatenation(); - String _accessLevelPublic = this.languageExt.accessLevelPublic(); - _builder.append(_accessLevelPublic, ""); - _builder.append(typeName, ""); - _builder.append(" get"); - String _firstUpper = StringExtensions.toFirstUpper(name); - _builder.append(_firstUpper, ""); - _builder.append(" ("); - String _selfPointer = this.languageExt.selfPointer(classname, false); - _builder.append(_selfPointer, ""); - _builder.append("){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("return "); - String _memberAccess = this.languageExt.memberAccess(); - _builder.append(_memberAccess, "\t"); - _builder.append(name, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - return _builder; - } - - /** - * @param name the name of the attribute - * @param classname the name of the type defining the getter - * @return code defining the getter call - */ - public CharSequence invokeGetter(final String name, final String classname) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("get"); - String _firstUpper = StringExtensions.toFirstUpper(name); - _builder.append(_firstUpper, ""); - _builder.append("("); - String _selfPointer = this.languageExt.selfPointer(classname, true); - _builder.append(_selfPointer, ""); - _builder.append(")"); - return _builder; - } - - /** - * @param name the name of the attribute - * @param classname the name of the type defining the getter - * @param value the value to be assigned - * @return code defining the setter call - */ - public CharSequence invokeSetter(final String name, final String classname, final String value) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("set"); - String _firstUpper = StringExtensions.toFirstUpper(name); - _builder.append(_firstUpper, ""); - _builder.append("("); - String _selfPointer = this.languageExt.selfPointer(classname, true); - _builder.append(_selfPointer, ""); - _builder.append(value, ""); - _builder.append(")"); - return _builder; - } - - /** - * @param operations a list of {@link Operation}s - * @param classname the name of the type defining the getter - * @return code declaring the operations - */ - public CharSequence operationsDeclaration(final List operations, final String classname) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/*--------------------- operations ---------------------*/"); - _builder.newLine(); - { - for(final Operation operation : operations) { - CharSequence _operationSignature = this.operationSignature(operation, classname, true); - _builder.append(_operationSignature, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - /** - * @param operations a list of {@link Operation}s - * @param classname the name of the type defining the getter - * @return code defining the operations - */ - public CharSequence operationsImplementation(final List operations, final String classname) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/*--------------------- operations ---------------------*/"); - _builder.newLine(); - { - for(final Operation operation : operations) { - CharSequence _operationSignature = this.operationSignature(operation, classname, false); - _builder.append(_operationSignature, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - AbstractGenerator _instance = AbstractGenerator.getInstance(); - DetailCode _detailCode = operation.getDetailCode(); - String _translatedCode = _instance.getTranslatedCode(_detailCode); - _builder.append(_translatedCode, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - return _builder; - } - - public CharSequence asBlock(final CharSequence str) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(str, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - return _builder; - } - - /** - * invoke user structor, if (inherited) present - C only - * - * @param cls {@link ActorClass} or {@link DataClass} - * @param args self pointer to instance - */ - public String invokeUserStructor(final RoomClass cls, final String args, final boolean ctor) { - boolean _usesInheritance = this.languageExt.usesInheritance(); - boolean _not = (!_usesInheritance); - List _structors = this.getStructors(cls, _not); - final Function1 _function = (ClassStructor it) -> { - boolean _isConstructor = it.isConstructor(); - return Boolean.valueOf((_isConstructor == ctor)); - }; - boolean _exists = IterableExtensions.exists(_structors, _function); - if (_exists) { - StringConcatenation _builder = new StringConcatenation(); - String _name = cls.getName(); - String _xifexpression = null; - if (ctor) { - _xifexpression = "ctor"; - } else { - _xifexpression = "dtor"; - } - String _memberInDeclaration = this.languageExt.memberInDeclaration(_name, _xifexpression); - _builder.append(_memberInDeclaration, ""); - _builder.append("("); - _builder.append(args, ""); - _builder.append(");"); - return _builder.toString(); - } - return ""; - } - - /** - * declaration of user constructor + destructor, if (inherited) present - C only - * - * @param cls {@link ActorClass} or {@link DataClass} - */ - public String userStructorsDeclaration(final RoomClass cls) { - String _xblockexpression = null; - { - String _name = cls.getName(); - final String namePrefix = this.languageExt.operationScope(_name, true); - final ArrayList declBlock = CollectionLiterals.newArrayList(); - declBlock.add("/*--------------------- user constructor/destructor ---------------------*/"); - boolean _usesInheritance = this.languageExt.usesInheritance(); - boolean _not = (!_usesInheritance); - List _structors = this.getStructors(cls, _not); - final Function1 _function = (ClassStructor it) -> { - return Boolean.valueOf(it.isConstructor()); - }; - boolean _exists = IterableExtensions.exists(_structors, _function); - if (_exists) { - String _name_1 = cls.getName(); - CharSequence _functionSignature = this.functionSignature(_name_1, (namePrefix + "ctor"), "void", ""); - String _plus = (_functionSignature + ";"); - declBlock.add(_plus); - } - boolean _usesInheritance_1 = this.languageExt.usesInheritance(); - boolean _not_1 = (!_usesInheritance_1); - List _structors_1 = this.getStructors(cls, _not_1); - final Function1 _function_1 = (ClassStructor it) -> { - boolean _isConstructor = it.isConstructor(); - return Boolean.valueOf((!_isConstructor)); - }; - boolean _exists_1 = IterableExtensions.exists(_structors_1, _function_1); - if (_exists_1) { - String _name_2 = cls.getName(); - CharSequence _functionSignature_1 = this.functionSignature(_name_2, (namePrefix + "dtor"), "void", ""); - String _plus_1 = (_functionSignature_1 + ";"); - declBlock.add(_plus_1); - } - _xblockexpression = IterableExtensions.join(declBlock, this.NEWLINE); - } - return _xblockexpression; - } - - /** - * implementation of user constructor + destructor, if (inherited) present - C only - * - * @param cls {@link ActorClass} or {@link DataClass} - */ - public String userStructorsImplementation(final RoomClass cls) { - String _xblockexpression = null; - { - final ArrayList declBlock = CollectionLiterals.newArrayList(); - declBlock.add("/*--------------------- user constructor/destructor ---------------------*/"); - String _userStuctorImplementation = this.userStuctorImplementation(cls, true); - declBlock.add(_userStuctorImplementation); - String _userStuctorImplementation_1 = this.userStuctorImplementation(cls, false); - declBlock.add(_userStuctorImplementation_1); - Iterable _filterNull = IterableExtensions.filterNull(declBlock); - _xblockexpression = IterableExtensions.join(_filterNull, this.NEWLINE); - } - return _xblockexpression; - } - - protected String userStuctorImplementation(final RoomClass cls, final boolean ctor) { - String _xblockexpression = null; - { - String _name = cls.getName(); - final String namePrefix = this.languageExt.operationScope(_name, false); - boolean _usesInheritance = this.languageExt.usesInheritance(); - boolean _not = (!_usesInheritance); - List _structors = this.getStructors(cls, _not); - final Function1 _function = (ClassStructor it) -> { - boolean _isConstructor = it.isConstructor(); - return Boolean.valueOf((_isConstructor == ctor)); - }; - boolean _exists = IterableExtensions.exists(_structors, _function); - boolean _not_1 = (!_exists); - if (_not_1) { - return null; - } - StringConcatenation _builder = new StringConcatenation(); - String _name_1 = cls.getName(); - String _xifexpression = null; - if (ctor) { - _xifexpression = "ctor"; - } else { - _xifexpression = "dtor"; - } - String _plus = (namePrefix + _xifexpression); - CharSequence _functionSignature = this.functionSignature(_name_1, _plus, "void", ""); - _builder.append(_functionSignature, ""); - _builder.append("{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _userStructorBody = this.userStructorBody(cls, ctor); - _builder.append(_userStructorBody, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder.toString(); - } - return _xblockexpression; - } - - /** - * implementation of user structor, if (inherited) present - */ - public String userStructorBody(final RoomClass cls, final boolean ctor) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/* user defined "); - { - if (ctor) { - _builder.append("con"); - } else { - _builder.append("de"); - } - } - _builder.append("structor body */"); - final String comment = _builder.toString(); - boolean _usesInheritance = this.languageExt.usesInheritance(); - boolean _not = (!_usesInheritance); - List _structors = this.getStructors(cls, _not); - final Function1 _function = (ClassStructor it) -> { - boolean _isConstructor = it.isConstructor(); - return Boolean.valueOf((_isConstructor == ctor)); - }; - final Iterable implementedStructors = IterableExtensions.filter(_structors, _function); - final Function1 _function_1 = (ClassStructor it) -> { - return it.getDetailCode(); - }; - Iterable _map = IterableExtensions.map(implementedStructors, _function_1); - final Function1 _function_2 = (DetailCode it) -> { - AbstractGenerator _instance = AbstractGenerator.getInstance(); - return _instance.getTranslatedCode(it); - }; - final Iterable translatedCodes = IterableExtensions.map(_map, _function_2); - final Function1 _function_3 = (String it) -> { - CharSequence _xifexpression = null; - int _size = IterableExtensions.size(translatedCodes); - boolean _greaterThan = (_size > 1); - if (_greaterThan) { - _xifexpression = this.asBlock(it); - } else { - _xifexpression = it; - } - return _xifexpression; - }; - Iterable _map_1 = IterableExtensions.map(translatedCodes, _function_3); - String _join = IterableExtensions.join(_map_1); - return ((comment + this.NEWLINE) + _join); - } - - protected List getStructors(final RoomClass cls, final boolean inherited) { - List _switchResult = null; - final RoomClass it = cls; - boolean _matched = false; - if (it instanceof ActorClass) { - if ((!inherited)) { - _matched=true; - _switchResult = ((ActorClass)it).getStructors(); - } - } - if (!_matched) { - if (it instanceof DataClass) { - if ((!inherited)) { - _matched=true; - _switchResult = ((DataClass)it).getStructors(); - } - } - } - if (!_matched) { - if (it instanceof ActorClass) { - if (inherited) { - _matched=true; - _switchResult = this._roomHelpers.getAllStructors(((ActorClass)it)); - } - } - } - if (!_matched) { - if (it instanceof DataClass) { - if (inherited) { - _matched=true; - _switchResult = this._roomHelpers.getAllStructors(((DataClass)it)); - } - } - } - return _switchResult; - } - - /** - * @param operation an {@link Operation} - * @return the operation signature (with special care for - * constructor and destructor - */ - protected CharSequence operationSignature(final Operation operation, final String classname, final boolean isDeclaration) { - CharSequence _xblockexpression = null; - { - StringConcatenation _builder = new StringConcatenation(); - { - EList _arguments = operation.getArguments(); - boolean _hasElements = false; - for(final VarDecl argument : _arguments) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - RefableType _refType = argument.getRefType(); - String _signatureString = this.signatureString(_refType); - _builder.append(_signatureString, ""); - _builder.append(" "); - String _name = argument.getName(); - _builder.append(_name, ""); - } - } - final String arguments = _builder.toString(); - RefableType _returnType = operation.getReturnType(); - final String returnType = this.signatureString(_returnType); - String _operationScope = this.languageExt.operationScope(classname, isDeclaration); - String _name_1 = operation.getName(); - String _plus = (_operationScope + _name_1); - _xblockexpression = this.functionSignature(classname, _plus, returnType, arguments); - } - return _xblockexpression; - } - - /** - * @param type a {@link RefableType} - * @return a string for the type (also for pointers) - */ - public String signatureString(final RefableType type) { - String _switchResult = null; - final RefableType it = type; - boolean _matched = false; - if (Objects.equal(it, null)) { - _matched=true; - _switchResult = "void"; - } - if (!_matched) { - boolean _isRef = it.isRef(); - if (_isRef) { - _matched=true; - DataType _type = type.getType(); - String _typeName = this._typeHelpers.typeName(_type); - String _pointerLiteral = this.languageExt.pointerLiteral(); - _switchResult = (_typeName + _pointerLiteral); - } - } - if (!_matched) { - DataType _type_1 = type.getType(); - _switchResult = this._typeHelpers.typeName(_type_1); - } - return _switchResult; - } - - public String signatureString(final Attribute attribute) { - String _switchResult = null; - final Attribute it = attribute; - boolean _matched = false; - int _size = it.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _matched=true; - RefableType _type = it.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this._typeHelpers.typeName(_type_1); - int _size_1 = it.getSize(); - RefableType _type_2 = it.getType(); - boolean _isRef = _type_2.isRef(); - _switchResult = this.languageExt.arrayType(_typeName, _size_1, _isRef); - } - if (!_matched) { - RefableType _type_3 = it.getType(); - _switchResult = this.signatureString(_type_3); - } - return _switchResult; - } - - /** - * @param attribute a {@link Attribute} - * @return a string for type name - */ - public String declarationString(final Attribute attribute) { - String _switchResult = null; - final Attribute it = attribute; - boolean _matched = false; - int _size = it.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _matched=true; - RefableType _type = it.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this._typeHelpers.typeName(_type_1); - int _size_1 = it.getSize(); - RefableType _type_2 = it.getType(); - boolean _isRef = _type_2.isRef(); - String _name = it.getName(); - _switchResult = this.languageExt.arrayDeclaration(_typeName, _size_1, _isRef, _name); - } - if (!_matched) { - RefableType _type_3 = it.getType(); - String _signatureString = this.signatureString(_type_3); - String _plus = (_signatureString + " "); - String _name_1 = it.getName(); - _switchResult = (_plus + _name_1); - } - return _switchResult; - } - - protected CharSequence functionSignature(final String className, final String fullFctName, final String returnType, final String arguments) { - StringConcatenation _builder = new StringConcatenation(); - String _accessLevelPublic = this.languageExt.accessLevelPublic(); - _builder.append(_accessLevelPublic, ""); - _builder.append(" "); - _builder.append(returnType, ""); - _builder.append(" "); - _builder.append(fullFctName, ""); - _builder.append("("); - boolean _isEmpty = arguments.isEmpty(); - boolean _not = (!_isEmpty); - String _selfPointer = this.languageExt.selfPointer(className, _not); - _builder.append(_selfPointer, ""); - _builder.append(arguments, ""); - _builder.append(")"); - return _builder; - } -} diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java deleted file mode 100644 index 730f7758f..000000000 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java +++ /dev/null @@ -1,646 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.generic; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.function.Consumer; -import javax.inject.Inject; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.etrice.core.genmodel.etricegen.AbstractInstance; -import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance; -import org.eclipse.etrice.core.genmodel.etricegen.PortInstance; -import org.eclipse.etrice.core.genmodel.etricegen.SAPInstance; -import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance; -import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ExternalPort; -import org.eclipse.etrice.core.room.GeneralProtocolClass; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.MessageHandler; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.PortClass; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RoomClass; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.SAP; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.ServiceImplementation; -import org.eclipse.etrice.core.room.StandardOperation; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; -import org.eclipse.etrice.generator.fsm.generic.FSMExtensions; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -/** - * collection of convenience functions for code generation - */ -@Singleton -@SuppressWarnings("all") -public class RoomExtensions extends FSMExtensions { - public final String NEWLINE = System.getProperty("line.separator"); - - private static String genDir = "/src-gen/"; - - private static String genInfoDir = "/src-gen-info/"; - - private static String genDocDir = "/doc-gen/"; - - @Inject - @Extension - protected RoomHelpers _roomHelpers; - - public static String setDefaultGenDir() { - return RoomExtensions.genDir = "/src-gen/"; - } - - public static String setDefaultGenInfoDir() { - return RoomExtensions.genInfoDir = "/src-gen-info/"; - } - - public static String setDefaultGenDocDir() { - return RoomExtensions.genDocDir = "/doc-gen/"; - } - - public static String setGenDir(final String dir) { - return RoomExtensions.genDir = (("/" + dir) + "/"); - } - - public static String setGenInfoDir(final String dir) { - return RoomExtensions.genInfoDir = (("/" + dir) + "/"); - } - - public static String setGenDocDir(final String dir) { - return RoomExtensions.genDocDir = (("/" + dir) + "/"); - } - - /** - * a specialized version of {@link #union(Iterable, Iterable)} - * @param in1 an iterable of type T - * @param in2 a second iterable of type T - * @return the union of the two iterables as new list - */ - public List punion(final Iterable in1, final Iterable in2) { - final ArrayList ret = new ArrayList(); - final Consumer _function = (ExternalPort e) -> { - Port _interfacePort = e.getInterfacePort(); - ret.add(_interfacePort); - }; - in2.forEach(_function); - Iterables.addAll(ret, in1); - return ret; - } - - /** - * @return the relative path to the destination folder for the generated code - */ - public String getGenerationPathSegment() { - return RoomExtensions.genDir; - } - - /** - * @return the relative path to the destination folder for the generated code - */ - public String getGenerationInfoSegment() { - return RoomExtensions.genInfoDir; - } - - /** - * @return the relative path to the destination folder for the generated documentation - */ - public String getDocGenerationPathSegment() { - return RoomExtensions.genDocDir; - } - - /** - * @param e an {@link EObject} - * @return the URI of the EObject's resource as file string - * (or an empty string if no such resource exists) - */ - public String getModelPath(final EObject e) { - Resource res = e.eResource(); - boolean _equals = Objects.equal(res, null); - if (_equals) { - return ""; - } else { - URI _uRI = res.getURI(); - return _uRI.toFileString(); - } - } - - /** - * @param rc a {@link RoomClass} - * @return the name of the room model which also serves as a package name - */ - public String getPackage(final RoomClass rc) { - EObject _eContainer = rc.eContainer(); - return ((RoomModel) _eContainer).getName(); - } - - /** - * @param rc a {@link RoomClass} - * @return the name of the room model followed by the class name and all . replaced with _ - */ - public String getFullyQualifiedName(final RoomClass rc) { - String _package = this.getPackage(rc); - String _replace = _package.replace(".", "_"); - String _plus = (_replace + "_"); - String _name = rc.getName(); - return (_plus + _name); - } - - /** - * @param packageName a dot (.) separated package anem - * @return the input with dots replaced with slashes (/) - */ - public String getPathFromPackage(final String packageName) { - String _replaceAll = packageName.replaceAll("\\.", "/"); - return (_replaceAll + "/"); - } - - /** - * @param rc a {@link RoomClass} - * @return the relative folder path of the package - * (as defined by the Java convention) - */ - public String getPath(final RoomClass rc) { - String _package = this.getPackage(rc); - return this.getPathFromPackage(_package); - } - - /** - * @param e an {@link EObject} - * @return the path of the Eclipse project containing the EObject's resource - */ - public String getProjectPath(final EObject e) { - final URI res = FileSystemHelpers.getProjectURI(e); - boolean _equals = Objects.equal(res, null); - if (_equals) { - return ""; - } - return res.toFileString(); - } - - /** - * @param e an {@link EObject} - * @return the concatenation of the object's project path - * with the {@link #getGenerationPathSegment()} - */ - public String getGenerationTargetPath(final EObject e) { - String _projectPath = this.getProjectPath(e); - String _generationPathSegment = this.getGenerationPathSegment(); - return (_projectPath + _generationPathSegment); - } - - /** - * @param e an {@link EObject} - * @return the concatenation of the object's project path - * with the {@link #getGenerationInfoSegment()} - */ - public String getGenerationInfoPath(final EObject e) { - String _projectPath = this.getProjectPath(e); - String _generationInfoSegment = this.getGenerationInfoSegment(); - return (_projectPath + _generationInfoSegment); - } - - /** - * @param e an {@link EObject} - * @return the concatenation of the objects project path - * with the {@link #getDocGenerationPathSegment()} - */ - public String getDocGenerationTargetPath(final EObject e) { - String _projectPath = this.getProjectPath(e); - String _docGenerationPathSegment = this.getDocGenerationPathSegment(); - return (_projectPath + _docGenerationPathSegment); - } - - /** - * makes a valid identifier from a path string - * @param path a slash (/) separated path - * @return the path with slashes (and colons as in replicated actors) replaced by underscores (_) - */ - public String getPathName(final String path) { - String _replaceAll = path.replaceAll("/", "_"); - return _replaceAll.replaceAll(":", "_"); - } - - /** - * @param p a {@link Port} - * @return a name for the associated port class - */ - protected String _getPortClassName(final Port p) { - String _xifexpression = null; - GeneralProtocolClass _protocol = p.getProtocol(); - if ((_protocol instanceof ProtocolClass)) { - GeneralProtocolClass _protocol_1 = p.getProtocol(); - boolean _isConjugated = p.isConjugated(); - boolean _isReplicated = p.isReplicated(); - _xifexpression = this.getPortClassName(((ProtocolClass) _protocol_1), _isConjugated, _isReplicated); - } else { - _xifexpression = ""; - } - return _xifexpression; - } - - /** - * @param p a {@link ExternalPort} - * @return a name for the associated port class - */ - protected String _getPortClassName(final ExternalPort p) { - Port _interfacePort = p.getInterfacePort(); - return this.getPortClassName(_interfacePort); - } - - /** - * @param sap a {@link SAP} - * @return a name for the associated port class - */ - protected String _getPortClassName(final SAP sap) { - ProtocolClass _protocol = sap.getProtocol(); - return this.getPortClassName(_protocol, true); - } - - /** - * @param spp a {@link SPP} - * @return a name for the associated port class - */ - protected String _getPortClassName(final SPP spp) { - ProtocolClass _protocol = spp.getProtocol(); - return this.getPortClassName(_protocol, false, true); - } - - /** - * @param svc a {@link ServiceImplementation} - * @return a name for the associated port class - */ - protected String _getPortClassName(final ServiceImplementation svc) { - SPP _spp = svc.getSpp(); - ProtocolClass _protocol = _spp.getProtocol(); - return this.getPortClassName(_protocol, false, true); - } - - /** - * @param p a {@link ProtocolClass} - * @param conj if true consider conjugate port, else regular - * @return a name for the associated port class - */ - public String getPortClassName(final ProtocolClass p, final boolean conj) { - return this.getPortClassName(p, conj, false); - } - - /** - * @param p a {@link ProtocolClass} - * @param conj if true consider conjugate port, else regular - * @param repl if true class name for replicated port - * else for plain port - * @return a name for the associated port class - */ - public String getPortClassName(final ProtocolClass p, final boolean conj, final boolean repl) { - String _name = p.getName(); - String _xifexpression = null; - if (conj) { - _xifexpression = "Conj"; - } else { - _xifexpression = ""; - } - String _plus = (_name + _xifexpression); - String _xifexpression_1 = null; - if (repl) { - _xifexpression_1 = "Repl"; - } else { - _xifexpression_1 = ""; - } - String _plus_1 = (_plus + _xifexpression_1); - return (_plus_1 + "Port"); - } - - /** - * @param pc a {@link ProtocolClass} - * @param conj flag indicating the desired {@link PortClass} - * @return the port class - */ - public PortClass getPortClass(final ProtocolClass pc, final boolean conj) { - if (conj) { - return pc.getConjugated(); - } else { - return pc.getRegular(); - } - } - - /** - * @param pc a {@link ProtocolClass} - * @param conj flag indicating the desired {@link PortClass} - * @return the port class - */ - public List getAllPortClasses(final ProtocolClass pc, final boolean conj) { - final ArrayList result = CollectionLiterals.newArrayList(); - ProtocolClass protocol = pc; - while ((!Objects.equal(protocol, null))) { - { - if (conj) { - PortClass _conjugated = protocol.getConjugated(); - boolean _notEquals = (!Objects.equal(_conjugated, null)); - if (_notEquals) { - PortClass _conjugated_1 = protocol.getConjugated(); - result.add(_conjugated_1); - } - } else { - PortClass _regular = protocol.getRegular(); - boolean _notEquals_1 = (!Objects.equal(_regular, null)); - if (_notEquals_1) { - PortClass _regular_1 = protocol.getRegular(); - result.add(_regular_1); - } - } - ProtocolClass _base = protocol.getBase(); - protocol = _base; - } - } - return result; - } - - /** - * @param pc a {@link ProtocolClass} - * @param conj flag indicating the desired communication direction - * @return true if a send handler is specified for this direction - */ - public boolean handlesSend(final ProtocolClass pc, final boolean conj) { - PortClass _portClass = this.getPortClass(pc, conj); - boolean _equals = Objects.equal(_portClass, null); - if (_equals) { - return false; - } else { - final List allMessages = this._roomHelpers.getAllMessages(pc, conj); - PortClass _portClass_1 = this.getPortClass(pc, conj); - EList _msgHandlers = _portClass_1.getMsgHandlers(); - List _safeList = RoomExtensions.getSafeList(_msgHandlers); - for (final MessageHandler hdlr : _safeList) { - Message _msg = hdlr.getMsg(); - boolean _contains = allMessages.contains(_msg); - if (_contains) { - return true; - } - } - } - return false; - } - - /** - * @param pc a {@link ProtocolClass} - * @param conj flag indicating the desired communication direction - * @return true if a receive handler is specified for this direction - */ - public boolean handlesReceive(final ProtocolClass pc, final boolean conj) { - PortClass _portClass = this.getPortClass(pc, conj); - boolean _equals = Objects.equal(_portClass, null); - if (_equals) { - return false; - } else { - final List allMessages = this._roomHelpers.getAllMessages(pc, (!conj)); - PortClass _portClass_1 = this.getPortClass(pc, conj); - EList _msgHandlers = _portClass_1.getMsgHandlers(); - List _safeList = RoomExtensions.getSafeList(_msgHandlers); - for (final MessageHandler hdlr : _safeList) { - Message _msg = hdlr.getMsg(); - boolean _contains = allMessages.contains(_msg); - if (_contains) { - return true; - } - } - } - return false; - } - - /** - * @param pc a {@link ProtocolClass} - * @param conj flag indicating the desired communication direction - * @return true if a receive handler is specified for this direction including base classes - */ - public boolean handlesReceiveIncludingSuper(final ProtocolClass pc, final boolean conj) { - final List allPortClasses = this.getAllPortClasses(pc, conj); - final List allMessages = this._roomHelpers.getAllMessages(pc, (!conj)); - for (final PortClass p : allPortClasses) { - EList _msgHandlers = p.getMsgHandlers(); - List _safeList = RoomExtensions.getSafeList(_msgHandlers); - for (final MessageHandler hdlr : _safeList) { - Message _msg = hdlr.getMsg(); - boolean _contains = allMessages.contains(_msg); - if (_contains) { - return true; - } - } - } - return false; - } - - /** - * @param iii an {@link InterfaceItemInstance} - * @return true if the interface item instance is logically conjugate - */ - public boolean isConjugated(final InterfaceItemInstance iii) { - if ((iii instanceof PortInstance)) { - Port _port = ((PortInstance) iii).getPort(); - return _port.isConjugated(); - } else { - if ((iii instanceof SAPInstance)) { - return true; - } else { - if ((iii instanceof ServiceImplInstance)) { - return false; - } else { - return false; - } - } - } - } - - /** - * @param pc a {@link ProtocolClass} - * @param conj flag indicating the desired communication direction - * @return a list of defined receive {@link MessageHandler} for this direction - */ - public List getReceiveHandlers(final ProtocolClass pc, final boolean conj) { - final ArrayList res = new ArrayList(); - PortClass _portClass = this.getPortClass(pc, conj); - boolean _notEquals = (!Objects.equal(_portClass, null)); - if (_notEquals) { - final List allMessages = this._roomHelpers.getAllMessages(pc, (!conj)); - PortClass _portClass_1 = this.getPortClass(pc, conj); - EList _msgHandlers = _portClass_1.getMsgHandlers(); - List _safeList = RoomExtensions.getSafeList(_msgHandlers); - for (final MessageHandler hdlr : _safeList) { - Message _msg = hdlr.getMsg(); - boolean _contains = allMessages.contains(_msg); - if (_contains) { - res.add(hdlr); - } - } - } - return res; - } - - /** - * @param pc a {@link ProtocolClass} - * @param conj flag indicating the desired communication direction - * @return a list of defined receive {@link MessageHandler} for this direction including base classes - */ - public List getReceiveHandlersIncludingSuper(final ProtocolClass pc, final boolean conj) { - final ArrayList res = new ArrayList(); - final List allPortClasses = this.getAllPortClasses(pc, conj); - final List allMsgs = this._roomHelpers.getAllMessages(pc, (!conj)); - for (final PortClass p : allPortClasses) { - EList _msgHandlers = p.getMsgHandlers(); - List _safeList = RoomExtensions.getSafeList(_msgHandlers); - for (final MessageHandler hdlr : _safeList) { - Message _msg = hdlr.getMsg(); - boolean _contains = allMsgs.contains(_msg); - if (_contains) { - res.add(hdlr); - } - } - } - return res; - } - - /** - * @param pc a {@link ProtocolClass} - * @param conj flag indicating the desired communication direction - * @return a list of defined send {@link MessageHandler} for this direction - */ - public List getSendHandlers(final ProtocolClass pc, final boolean conj) { - PortClass _portClass = this.getPortClass(pc, conj); - boolean _equals = Objects.equal(_portClass, null); - if (_equals) { - return Collections.emptyList(); - } else { - final ArrayList res = new ArrayList(); - final List allMessages = this._roomHelpers.getAllMessages(pc, conj); - PortClass _portClass_1 = this.getPortClass(pc, conj); - EList _msgHandlers = _portClass_1.getMsgHandlers(); - List _safeList = RoomExtensions.getSafeList(_msgHandlers); - for (final MessageHandler hdlr : _safeList) { - Message _msg = hdlr.getMsg(); - boolean _contains = allMessages.contains(_msg); - if (_contains) { - res.add(hdlr); - } - } - return res; - } - } - - /** - * @param m a {@link Message} - * @param conj flag indicating the desired communication direction - * @return a send {@link MessageHandler} for this direction if it is defined, null else - */ - public MessageHandler getSendHandler(final Message m, final boolean conj) { - EObject _eContainer = m.eContainer(); - List _sendHandlers = this.getSendHandlers(((ProtocolClass) _eContainer), conj); - final Function1 _function = (MessageHandler e) -> { - Message _msg = e.getMsg(); - return Boolean.valueOf(Objects.equal(_msg, m)); - }; - return IterableExtensions.findFirst(_sendHandlers, _function); - } - - /** - * @param m a {@link Message} - * @return true if this message is an incoming message - */ - public boolean isIncoming(final Message m) { - EObject _eContainer = m.eContainer(); - List _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(((ProtocolClass) _eContainer)); - return _allIncomingMessages.contains(m); - } - - /** - * @param m a {@link Message} - * @return a string that can be used as identifier for the message. It is prefixed with IN_ or OUT_ - * to avoid ambiguities - */ - public String getCodeName(final Message m) { - boolean _isIncoming = this.isIncoming(m); - if (_isIncoming) { - String _name = m.getName(); - return ("IN_" + _name); - } else { - String _name_1 = m.getName(); - return ("OUT_" + _name_1); - } - } - - /** - * @param ac an {@link ActorClass} - * @return true if an operation named 'stop' is defined with a void argument list and - * void return type - */ - public boolean overridesStop(final ActorClass ac) { - return (IterableExtensions.exists(ac.getOperations(), ((Function1) (StandardOperation e) -> { - return Boolean.valueOf(((Objects.equal(e.getName(), "stop") && e.getArguments().isEmpty()) && Objects.equal(e.getReturnType(), null))); - })) || ((!Objects.equal(ac.getActorBase(), null)) && this.overridesStop(ac.getActorBase()))); - } - - public BasicEList getAllSubInstances(final StructureInstance ssi) { - final BasicEList result = new BasicEList(); - final TreeIterator it = ssi.eAllContents(); - while (it.hasNext()) { - { - final EObject obj = it.next(); - if ((obj instanceof AbstractInstance)) { - result.add(((AbstractInstance) obj)); - } - } - } - return result; - } - - public static List getSafeList(final List msgHandlers) { - List _xifexpression = null; - boolean _equals = Objects.equal(msgHandlers, null); - if (_equals) { - _xifexpression = Collections.emptyList(); - } else { - _xifexpression = msgHandlers; - } - return _xifexpression; - } - - public String getPortClassName(final EObject p) { - if (p instanceof Port) { - return _getPortClassName((Port)p); - } else if (p instanceof SAP) { - return _getPortClassName((SAP)p); - } else if (p instanceof SPP) { - return _getPortClassName((SPP)p); - } else if (p instanceof ExternalPort) { - return _getPortClassName((ExternalPort)p); - } else if (p instanceof ServiceImplementation) { - return _getPortClassName((ServiceImplementation)p); - } else { - throw new IllegalArgumentException("Unhandled parameter types: " + - Arrays.asList(p).toString()); - } - } -} diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TestInstanceCreator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TestInstanceCreator.java deleted file mode 100644 index 5df095c60..000000000 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TestInstanceCreator.java +++ /dev/null @@ -1,291 +0,0 @@ -package org.eclipse.etrice.generator.generic; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.etrice.core.common.base.Annotation; -import org.eclipse.etrice.core.common.base.AnnotationType; -import org.eclipse.etrice.core.etmap.eTMap.ETMapFactory; -import org.eclipse.etrice.core.etmap.eTMap.Mapping; -import org.eclipse.etrice.core.etmap.eTMap.MappingModel; -import org.eclipse.etrice.core.etmap.eTMap.SubSystemMapping; -import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; -import org.eclipse.etrice.core.etphys.eTPhys.PhysicalModel; -import org.eclipse.etrice.core.etphys.eTPhys.PhysicalSystem; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorRef; -import org.eclipse.etrice.core.room.LogicalSystem; -import org.eclipse.etrice.core.room.RoomFactory; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.StructureClass; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.core.room.SubSystemRef; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.Functions.Function2; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; -import org.eclipse.xtext.xbase.lib.ObjectExtensions; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; - -@FinalFieldsConstructor -@SuppressWarnings("all") -public class TestInstanceCreator { - private final static String ANNOTATION_TYPE_NAME = "TestInstance"; - - @Extension - private final RoomFactory _roomFactory = RoomFactory.eINSTANCE; - - @Extension - private final ETMapFactory _eTMapFactory = ETMapFactory.eINSTANCE; - - private final ILogger logger; - - /** - * Creates instance and mapping for classes having @TestInstance annotation: - *

- * a) In case of a single SubSystemClass, a new LogicalSystem with a SubSystemRef will be created
- * b) For ActorClasses, one new SubSystem- and LogicalSystem with necessary refs will be created
- * Resulting ROOM classes are stored in new RoomModel within a new memory-only resource.
- * Resulting mapping is stored in a new MappingModel within a new memory-only resource.
- *

- * - * Note: currently only one class having @TestInstance annotation is supported - * - * @param rs ResourceSet for new resources - * @return false, if creation failed and generation should stop - */ - public List createInstancesAndMapping(final ResourceSet rs) { - final ArrayList roomModels = CollectionLiterals.newArrayList(); - final ArrayList physModels = CollectionLiterals.newArrayList(); - EList _resources = rs.getResources(); - final Consumer _function = (Resource it) -> { - EList _contents = it.getContents(); - final Function1 _function_1 = (EObject it_1) -> { - boolean _switchResult = false; - boolean _matched = false; - if (it_1 instanceof RoomModel) { - _matched=true; - _switchResult = roomModels.add(((RoomModel)it_1)); - } - if (!_matched) { - if (it_1 instanceof PhysicalModel) { - _matched=true; - _switchResult = physModels.add(((PhysicalModel)it_1)); - } - } - return Boolean.valueOf(_switchResult); - }; - IterableExtensions.forall(_contents, _function_1); - }; - _resources.forEach(_function); - ArrayList _newArrayList = CollectionLiterals.newArrayList(); - final Function2, RoomModel, ArrayList> _function_1 = (ArrayList list, RoomModel model) -> { - EList _subSystemClasses = model.getSubSystemClasses(); - final Function1 _function_2 = (SubSystemClass it) -> { - return Boolean.valueOf(this.hasTestAnnotation(it)); - }; - Iterable _filter = IterableExtensions.filter(_subSystemClasses, _function_2); - Iterables.addAll(list, _filter); - return list; - }; - final ArrayList allTestSubSystems = IterableExtensions.>fold(roomModels, _newArrayList, _function_1); - final List allAnnotatedClasses = CollectionLiterals.newArrayList(((StructureClass[])Conversions.unwrapArray(allTestSubSystems, StructureClass.class))); - final ArrayList result = CollectionLiterals.newArrayList(); - { - SubSystemClass _createSubSystemClass = this._roomFactory.createSubSystemClass(); - final Procedure1 _function_2 = (SubSystemClass it) -> { - it.setName("DerivedTestSubSystem"); - }; - final SubSystemClass derivedSubSystem = ObjectExtensions.operator_doubleArrow(_createSubSystemClass, _function_2); - final Consumer _function_3 = (RoomModel model) -> { - EList _actorRefs = derivedSubSystem.getActorRefs(); - EList _actorClasses = model.getActorClasses(); - final Function1 _function_4 = (ActorClass it) -> { - return Boolean.valueOf(this.hasTestAnnotation(it)); - }; - Iterable _filter = IterableExtensions.filter(_actorClasses, _function_4); - final Function1 _function_5 = (ActorClass ac) -> { - ActorRef _xblockexpression = null; - { - allAnnotatedClasses.add(ac); - ActorRef _createActorRef = this._roomFactory.createActorRef(); - final Procedure1 _function_6 = (ActorRef it) -> { - String _name = ac.getName(); - String _plus = ("ref_" + _name); - it.setName(_plus); - it.setType(ac); - }; - _xblockexpression = ObjectExtensions.operator_doubleArrow(_createActorRef, _function_6); - } - return _xblockexpression; - }; - Iterable _map = IterableExtensions.map(_filter, _function_5); - Iterables.addAll(_actorRefs, _map); - }; - roomModels.forEach(_function_3); - EList _actorRefs = derivedSubSystem.getActorRefs(); - boolean _isEmpty = _actorRefs.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - allTestSubSystems.add(derivedSubSystem); - } - } - boolean _isEmpty = allTestSubSystems.isEmpty(); - if (_isEmpty) { - return result; - } - int _size = allAnnotatedClasses.size(); - boolean _greaterThan = (_size > 1); - if (_greaterThan) { - final Consumer _function_2 = (StructureClass roomCls) -> { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("TestInstanceCreator: mapping failed, multiple test instances present"); - this.logger.logError(_builder.toString(), roomCls); - }; - allAnnotatedClasses.forEach(_function_2); - return null; - } - ArrayList _newArrayList_1 = CollectionLiterals.newArrayList(); - final Function2, PhysicalModel, ArrayList> _function_3 = (ArrayList list, PhysicalModel model) -> { - EList _systems = model.getSystems(); - Iterables.addAll(list, _systems); - return list; - }; - final List allPhysSystems = IterableExtensions.>fold(physModels, _newArrayList_1, _function_3); - int _size_1 = allPhysSystems.size(); - boolean _notEquals = (_size_1 != 1); - if (_notEquals) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("TestInstanceCreator: mapping failed, found "); - int _size_2 = allPhysSystems.size(); - _builder.append(_size_2, ""); - _builder.append(" physical systems"); - this.logger.logError(_builder.toString(), null); - return null; - } - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("TestInstanceCreator: creating instance and mapping for "); - StructureClass _head = IterableExtensions.head(allAnnotatedClasses); - String _name = _head.getName(); - _builder_1.append(_name, ""); - _builder_1.append(":"); - StructureClass _head_1 = IterableExtensions.head(allAnnotatedClasses); - EClass _eClass = _head_1.eClass(); - String _name_1 = _eClass.getName(); - _builder_1.append(_name_1, ""); - this.logger.logInfo(_builder_1.toString()); - final PhysicalSystem physSystem = IterableExtensions.head(allPhysSystems); - final SubSystemClass testSubSystem = IterableExtensions.head(allTestSubSystems); - LogicalSystem _createLogicalSystem = this._roomFactory.createLogicalSystem(); - final Procedure1 _function_4 = (LogicalSystem it) -> { - it.setName("DerivedTestSystem"); - }; - final LogicalSystem testSystem = ObjectExtensions.operator_doubleArrow(_createLogicalSystem, _function_4); - EList _subSystems = testSystem.getSubSystems(); - SubSystemRef _createSubSystemRef = this._roomFactory.createSubSystemRef(); - final Procedure1 _function_5 = (SubSystemRef it) -> { - String _name_2 = testSubSystem.getName(); - String _plus = ("ref_" + _name_2); - it.setName(_plus); - it.setType(testSubSystem); - }; - SubSystemRef _doubleArrow = ObjectExtensions.operator_doubleArrow(_createSubSystemRef, _function_5); - _subSystems.add(_doubleArrow); - RoomModel _createRoomModel = this._roomFactory.createRoomModel(); - final Procedure1 _function_6 = (RoomModel it) -> { - it.setName("DerivedTestRoomModel"); - EList _systems = it.getSystems(); - _systems.add(testSystem); - Resource _eResource = testSubSystem.eResource(); - boolean _tripleEquals = (_eResource == null); - if (_tripleEquals) { - EList _subSystemClasses = it.getSubSystemClasses(); - _subSystemClasses.add(testSubSystem); - } - }; - final RoomModel testRoomModel = ObjectExtensions.operator_doubleArrow(_createRoomModel, _function_6); - MappingModel _createMappingModel = this._eTMapFactory.createMappingModel(); - final Procedure1 _function_7 = (MappingModel it) -> { - it.setName("DerivedTestMappingModel"); - EList _mappings = it.getMappings(); - Mapping _createMapping = this._eTMapFactory.createMapping(); - final Procedure1 _function_8 = (Mapping it_1) -> { - it_1.setLogicalSys(testSystem); - it_1.setPhysicalSys(physSystem); - EList _subsysMappings = it_1.getSubsysMappings(); - EList _subSystems_1 = testSystem.getSubSystems(); - final Function1 _function_9 = (SubSystemRef subSysRef) -> { - SubSystemMapping _createSubSystemMapping = this._eTMapFactory.createSubSystemMapping(); - final Procedure1 _function_10 = (SubSystemMapping it_2) -> { - it_2.setLogicalSubSys(subSysRef); - EList _nodeRefs = physSystem.getNodeRefs(); - NodeRef _head_2 = IterableExtensions.head(_nodeRefs); - it_2.setNode(_head_2); - }; - return ObjectExtensions.operator_doubleArrow(_createSubSystemMapping, _function_10); - }; - List _map = ListExtensions.map(_subSystems_1, _function_9); - Iterables.addAll(_subsysMappings, _map); - }; - Mapping _doubleArrow_1 = ObjectExtensions.operator_doubleArrow(_createMapping, _function_8); - _mappings.add(_doubleArrow_1); - }; - final MappingModel testMappingModel = ObjectExtensions.operator_doubleArrow(_createMappingModel, _function_7); - Resource _xifexpression = null; - Resource _eResource = testSubSystem.eResource(); - boolean _tripleNotEquals = (_eResource != null); - if (_tripleNotEquals) { - _xifexpression = testSubSystem.eResource(); - } else { - StructureClass _head_2 = IterableExtensions.head(allAnnotatedClasses); - _xifexpression = _head_2.eResource(); - } - final Resource existingResource = _xifexpression; - URI _uRI = existingResource.getURI(); - URI _trimFileExtension = _uRI.trimFileExtension(); - final URI uriPath = _trimFileExtension.trimSegments(1); - URI _appendSegment = uriPath.appendSegment("DerivedTestMappingModel"); - URI _appendFileExtension = _appendSegment.appendFileExtension("etmap"); - Resource res = rs.createResource(_appendFileExtension); - EList _contents = res.getContents(); - _contents.add(testMappingModel); - result.add(res); - URI _appendSegment_1 = uriPath.appendSegment("DerivedTestRoomModel"); - URI _appendFileExtension_1 = _appendSegment_1.appendFileExtension("room"); - Resource _createResource = rs.createResource(_appendFileExtension_1); - res = _createResource; - EList _contents_1 = res.getContents(); - _contents_1.add(testRoomModel); - result.add(res); - return result; - } - - protected boolean hasTestAnnotation(final StructureClass cls) { - EList _annotations = cls.getAnnotations(); - final Function1 _function = (Annotation it) -> { - AnnotationType _type = it.getType(); - String _name = _type.getName(); - return Boolean.valueOf(Objects.equal(_name, TestInstanceCreator.ANNOTATION_TYPE_NAME)); - }; - return IterableExtensions.exists(_annotations, _function); - } - - public TestInstanceCreator(final ILogger logger) { - super(); - this.logger = logger; - } -} diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java deleted file mode 100644 index e3193f69f..000000000 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java +++ /dev/null @@ -1,198 +0,0 @@ -/** - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.generator.generic; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.List; -import org.eclipse.etrice.core.common.base.LiteralType; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase; -import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.EnumerationType; -import org.eclipse.etrice.core.room.ExternalType; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.PortClass; -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.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.base.IDataConfiguration; -import org.eclipse.etrice.generator.generic.ILanguageExtension; -import org.eclipse.xtext.xbase.lib.Extension; - -@Singleton -@SuppressWarnings("all") -public class TypeHelpers { - @Inject - @Extension - protected RoomHelpers _roomHelpers; - - @Inject - private ILanguageExtension languageExt; - - @Inject - private IDataConfiguration dataConfigExt; - - public String typeName(final DataType type) { - if ((type instanceof PrimitiveType)) { - return ((PrimitiveType) type).getTargetName(); - } else { - if ((type instanceof EnumerationType)) { - return this.languageExt.getTargetType(((EnumerationType) type)); - } else { - if ((type instanceof ExternalType)) { - return ((ExternalType) type).getTargetName(); - } else { - return type.getName(); - } - } - } - } - - public String getTypeName(final RefableType t) { - DataType _type = t.getType(); - return this.typeName(_type); - } - - public String getTypeName(final Message m) { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - return this.getTypeName(_refType); - } - - public String getTypeName(final Attribute att) { - RefableType _type = att.getType(); - return this.getTypeName(_type); - } - - /** - * This function returns the name of the primitive type. - * It can be overridden to map room types to the target language. This (basic) implementation returns the room type - * - * @param t - * @return - */ - public String getPrimitiveTypeName(final RefableType t) { - DataType _type = t.getType(); - return _type.getName(); - } - - public String getPrimitiveTypeName(final Message m) { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - return this.getPrimitiveTypeName(_refType); - } - - public String getPrimitiveTypeName(final Attribute att) { - RefableType _type = att.getType(); - return this.getPrimitiveTypeName(_type); - } - - public String defaultValue(final VarDecl a) { - RefableType _refType = a.getRefType(); - DataType _type = _refType.getType(); - return this.languageExt.defaultValue(_type); - } - - public String getArgumentList(final VarDecl data) { - String[] _generateArglistAndTypedData = this.languageExt.generateArglistAndTypedData(data); - return _generateArglistAndTypedData[0]; - } - - public String getTypedDataDefinition(final VarDecl data) { - String[] _generateArglistAndTypedData = this.languageExt.generateArglistAndTypedData(data); - return _generateArglistAndTypedData[1]; - } - - public String generateTypedArgumentList(final VarDecl data) { - String[] _generateArglistAndTypedData = this.languageExt.generateArglistAndTypedData(data); - return _generateArglistAndTypedData[2]; - } - - public boolean isPrimitive(final DataType type) { - return (type instanceof PrimitiveType); - } - - public boolean isBoolean(final DataType type) { - return (this.isPrimitive(type) && Objects.equal(((PrimitiveType) type).getType(), LiteralType.BOOL)); - } - - public boolean isEnumeration(final DataType type) { - return (type instanceof EnumerationType); - } - - public boolean isEnumerationOrPrimitive(final DataType type) { - return ((type instanceof EnumerationType) || (type instanceof PrimitiveType)); - } - - public boolean isDataClass(final DataType type) { - return (type instanceof DataClass); - } - - public boolean isCharacterType(final PrimitiveType type) { - LiteralType _type = type.getType(); - return Objects.equal(_type, LiteralType.CHAR); - } - - public boolean isCharacterType(final DataType type) { - return (this.isPrimitive(type) && this.isCharacterType(((PrimitiveType) type))); - } - - public String getAttrInstanceConfigValue(final List attributePath, final InstanceBase instance) { - String _switchResult = null; - boolean _matched = false; - if (instance instanceof ActorInstance) { - _matched=true; - _switchResult = this.dataConfigExt.getAttrInstanceConfigValue(((ActorInstance)instance), attributePath); - } - if (!_matched) { - if (instance instanceof InterfaceItemInstance) { - _matched=true; - _switchResult = this.dataConfigExt.getAttrInstanceConfigValue(((InterfaceItemInstance)instance), attributePath); - } - } - return _switchResult; - } - - public String getAttrClassConfigValue(final List attributePath, final ActorClass actor, final boolean inherite) { - String result = this.dataConfigExt.getAttrClassConfigValue(actor, attributePath); - if ((Objects.equal(result, null) && inherite)) { - ActorClass base = actor.getActorBase(); - while (((!Objects.equal(base, null)) && Objects.equal(result, null))) { - { - String _attrClassConfigValue = this.dataConfigExt.getAttrClassConfigValue(base, attributePath); - result = _attrClassConfigValue; - ActorClass _actorBase = base.getActorBase(); - base = _actorBase; - } - } - } - return result; - } - - public String getAttrClassConfigValue(final List attributePath, final PortClass port) { - ProtocolClass pc = this._roomHelpers.getProtocolClass(port); - boolean _equals = Objects.equal(pc, null); - if (_equals) { - return null; - } - PortClass _regular = pc.getRegular(); - boolean _equals_1 = port.equals(_regular); - return this.dataConfigExt.getAttrClassConfigValue(pc, _equals_1, attributePath); - } -} diff --git a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/CustomCompletionProposal.java b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/CustomCompletionProposal.java deleted file mode 100644 index 0b3b29f61..000000000 --- a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/CustomCompletionProposal.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) 2015 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.ui.behavior.actioneditor.sourceviewer; - -import com.google.common.base.Objects; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.xtend.lib.annotations.Delegate; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; - -@FinalFieldsConstructor -@SuppressWarnings("all") -public class CustomCompletionProposal implements ICompletionProposal { - @Delegate - private final ICompletionProposal delegate; - - private final Point selection; - - @Override - public Point getSelection(final IDocument document) { - Point _xifexpression = null; - boolean _notEquals = (!Objects.equal(this.selection, null)); - if (_notEquals) { - _xifexpression = this.selection; - } else { - _xifexpression = this.delegate.getSelection(document); - } - return _xifexpression; - } - - public CustomCompletionProposal(final ICompletionProposal delegate, final Point selection) { - super(); - this.delegate = delegate; - this.selection = selection; - } - - public void apply(final IDocument document) { - this.delegate.apply(document); - } - - public String getAdditionalProposalInfo() { - return this.delegate.getAdditionalProposalInfo(); - } - - public IContextInformation getContextInformation() { - return this.delegate.getContextInformation(); - } - - public String getDisplayString() { - return this.delegate.getDisplayString(); - } - - public Image getImage() { - return this.delegate.getImage(); - } -} diff --git a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionAssistParser.java b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionAssistParser.java deleted file mode 100644 index b617e6821..000000000 --- a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionAssistParser.java +++ /dev/null @@ -1,206 +0,0 @@ -/** - * Copyright (c) 2015 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.ui.behavior.actioneditor.sourceviewer; - -import com.google.common.base.Objects; -import java.util.LinkedList; -import java.util.List; -import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.rules.IWordDetector; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Exceptions; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@FinalFieldsConstructor -@SuppressWarnings("all") -public class DetailExpressionAssistParser { - private final IDocument document; - - private final int invocationOffset; - - private final IDetailExpressionProvider provider; - - private final IWordDetector anyIdScanner = new IWordDetector() { - @Override - public boolean isWordPart(final char c) { - return Character.isJavaIdentifierPart(c); - } - - @Override - public boolean isWordStart(final char c) { - return Character.isJavaIdentifierStart(c); - } - }; - - public String computeIdentifierPrefix(final int offset) throws BadLocationException { - int start = (offset - 1); - while (((start >= 0) && this.anyIdScanner.isWordPart(this.document.getChar(start)))) { - start--; - } - start++; - return this.document.get(start, (offset - start)); - } - - public IDetailExpressionProvider.ExpressionFeature computeExpressionFeature(final int offset) throws BadLocationException { - IDetailExpressionProvider.ExpressionPostfix postfixResult = null; - char openingChar = 0; - char closingChar = 0; - char _char = this.document.getChar((offset - 1)); - String _string = Character.valueOf(_char).toString(); - switch (_string) { - case ")": - postfixResult = IDetailExpressionProvider.ExpressionPostfix.PARENTHESES; - openingChar = '('; - closingChar = ')'; - break; - case "]": - postfixResult = IDetailExpressionProvider.ExpressionPostfix.BRACKETS; - openingChar = '['; - closingChar = ']'; - break; - default: - postfixResult = IDetailExpressionProvider.ExpressionPostfix.NONE; - break; - } - int start = offset; - boolean _notEquals = (!Objects.equal(postfixResult, IDetailExpressionProvider.ExpressionPostfix.NONE)); - if (_notEquals) { - start--; - int counter = 1; - while (((start > 0) && (counter > 0))) { - { - start--; - char _char_1 = this.document.getChar(start); - boolean _matched = false; - if (Objects.equal(_char_1, openingChar)) { - _matched=true; - counter--; - } - if (!_matched) { - if (Objects.equal(_char_1, closingChar)) { - _matched=true; - counter++; - } - } - } - } - if ((counter > 0)) { - postfixResult = null; - } - } - String idResult = null; - try { - String _computeIdentifierPrefix = this.computeIdentifierPrefix(start); - idResult = _computeIdentifierPrefix; - } catch (final Throwable _t) { - if (_t instanceof BadLocationException) { - final BadLocationException e = (BadLocationException)_t; - } else { - throw Exceptions.sneakyThrow(_t); - } - } - return new IDetailExpressionProvider.ExpressionFeature(idResult, postfixResult); - } - - /** - * Try to resolve latest complete ExpressionFeature, e.g.: - *
    - *
  • port0.m_ => port0
  • - *
  • port0. => port0
  • - *
  • port0 => null
  • - *
- */ - public IDetailExpressionProvider.ExpressionFeature resolveLatestCompleted() { - int lastSeparatorPos = (this.invocationOffset - 1); - try { - final String invocationPrefix = this.computeIdentifierPrefix(this.invocationOffset); - int _lastSeparatorPos = lastSeparatorPos; - int _length = invocationPrefix.length(); - lastSeparatorPos = (_lastSeparatorPos - _length); - } catch (final Throwable _t) { - if (_t instanceof BadLocationException) { - final BadLocationException e = (BadLocationException)_t; - } else { - throw Exceptions.sneakyThrow(_t); - } - } - final LinkedList parsedFeatures = CollectionLiterals.newLinkedList(); - try { - while ((this.document.getChar(lastSeparatorPos) == IDetailExpressionProvider.SEPARATOR)) { - { - final IDetailExpressionProvider.ExpressionFeature parseResult = this.computeExpressionFeature(lastSeparatorPos); - boolean _isValid = this.isValid(parseResult); - boolean _not = (!_isValid); - if (_not) { - return null; - } - parsedFeatures.push(parseResult); - int _lastSeparatorPos_1 = lastSeparatorPos; - String _id = parseResult.getId(); - int _length_1 = _id.length(); - int _plus = (_length_1 + 1); - lastSeparatorPos = (_lastSeparatorPos_1 - _plus); - } - } - } catch (final Throwable _t_1) { - if (_t_1 instanceof BadLocationException) { - final BadLocationException e_1 = (BadLocationException)_t_1; - } else { - throw Exceptions.sneakyThrow(_t_1); - } - } - boolean _isEmpty = parsedFeatures.isEmpty(); - if (_isEmpty) { - return null; - } - final IDetailExpressionProvider.ExpressionFeature firstParseResult = parsedFeatures.pop(); - List _initialFeatures = this.provider.getInitialFeatures(); - final Function1 _function = (IDetailExpressionProvider.ExpressionFeature it) -> { - return Boolean.valueOf(this.matches(it, firstParseResult)); - }; - IDetailExpressionProvider.ExpressionFeature lastMatch = IterableExtensions.findFirst(_initialFeatures, _function); - while (((!Objects.equal(lastMatch, null)) && (!parsedFeatures.isEmpty()))) { - { - final IDetailExpressionProvider.ExpressionFeature nextParseResult = parsedFeatures.pop(); - List _contextFeatures = this.provider.getContextFeatures(lastMatch); - final Function1 _function_1 = (IDetailExpressionProvider.ExpressionFeature it) -> { - return Boolean.valueOf(this.matches(it, nextParseResult)); - }; - IDetailExpressionProvider.ExpressionFeature _findFirst = IterableExtensions.findFirst(_contextFeatures, _function_1); - lastMatch = _findFirst; - } - } - return lastMatch; - } - - /** - * non-empty id + not-null suffix - */ - private boolean isValid(final IDetailExpressionProvider.ExpressionFeature feature) { - return ((!Strings.isEmpty(feature.getId())) && (!Objects.equal(feature.getPostfix(), null))); - } - - private boolean matches(final IDetailExpressionProvider.ExpressionFeature f1, final IDetailExpressionProvider.ExpressionFeature f2) { - return (Objects.equal(f1.getId(), f2.getId()) && Objects.equal(f1.getPostfix(), f2.getPostfix())); - } - - public DetailExpressionAssistParser(final IDocument document, final int invocationOffset, final IDetailExpressionProvider provider) { - super(); - this.document = document; - this.invocationOffset = invocationOffset; - this.provider = provider; - } -} diff --git a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionUIProvider.java b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionUIProvider.java deleted file mode 100644 index a430d9119..000000000 --- a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/xtend-gen/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/DetailExpressionUIProvider.java +++ /dev/null @@ -1,374 +0,0 @@ -/** - * Copyright (c) 2015 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.ui.behavior.actioneditor.sourceviewer; - -import com.google.common.base.Objects; -import com.google.common.base.Strings; -import com.google.inject.Inject; -import java.util.List; -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.DataType; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.Operation; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefableType; -import org.eclipse.etrice.core.room.SPP; -import org.eclipse.etrice.core.room.VarDecl; -import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider; -import org.eclipse.etrice.expressions.detailcode.RuntimeDetailExpressionProvider; -import org.eclipse.etrice.ui.behavior.actioneditor.Activator; -import org.eclipse.etrice.ui.behavior.actioneditor.sourceviewer.ActionCodeColorManager; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.xtend.lib.annotations.Delegate; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; -import org.eclipse.xtext.xbase.lib.Pair; - -@FinalFieldsConstructor -@SuppressWarnings("all") -public class DetailExpressionUIProvider implements IDetailExpressionProvider { - private final static String IMAGE_RT_METHOD = "icons/rt_method.png"; - - @Delegate - private final IDetailExpressionProvider delegate; - - @Inject - protected ILabelProvider labelProvider; - - @Inject - protected RoomHelpers roomHelpers; - - /** - * Return postfix string and its selection (relative start, length) - */ - public Pair getPostfixReplacement(final IDetailExpressionProvider.ExpressionFeature feature) { - Pair _xblockexpression = null; - { - this.assertNotNull(feature); - String[] _switchResult = null; - IDetailExpressionProvider.ExpressionPostfix _postfix = feature.getPostfix(); - if (_postfix != null) { - switch (_postfix) { - case PARENTHESES: - _switchResult = new String[] { "(", ")" }; - break; - case BRACKETS: - _switchResult = new String[] { "[", "]" }; - break; - default: - return Pair.of("", null); - } - } else { - return Pair.of("", null); - } - String[] brackets = _switchResult; - String _switchResult_1 = null; - Object _data = feature.getData(); - final Object data = _data; - boolean _matched = false; - if (data instanceof Operation) { - _matched=true; - EList _arguments = ((Operation)data).getArguments(); - final Function1 _function = (VarDecl it) -> { - return it.getName(); - }; - List _map = ListExtensions.map(_arguments, _function); - _switchResult_1 = IterableExtensions.join(_map, ", "); - } - if (!_matched) { - if (data instanceof Message) { - VarDecl _data_1 = ((Message)data).getData(); - boolean _notEquals = (!Objects.equal(_data_1, null)); - if (_notEquals) { - _matched=true; - VarDecl _data_2 = ((Message)data).getData(); - _switchResult_1 = _data_2.getName(); - } - } - } - if (!_matched) { - if (data instanceof Attribute) { - _matched=true; - } - if (!_matched) { - if (data instanceof InterfaceItem) { - _matched=true; - } - } - if (_matched) { - _switchResult_1 = "0"; - } - } - if (!_matched) { - _switchResult_1 = ""; - } - String replacement = _switchResult_1; - Point _xifexpression = null; - boolean _isEmpty = replacement.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - int _length = replacement.length(); - _xifexpression = new Point(1, _length); - } - final Point selection = _xifexpression; - final String[] _converted_brackets = (String[])brackets; - String _head = IterableExtensions.head(((Iterable)Conversions.doWrapArray(_converted_brackets))); - String _plus = (_head + replacement); - final String[] _converted_brackets_1 = (String[])brackets; - String _last = IterableExtensions.last(((Iterable)Conversions.doWrapArray(_converted_brackets_1))); - String _plus_1 = (_plus + _last); - _xblockexpression = Pair.of(_plus_1, selection); - } - return _xblockexpression; - } - - /** - * Return completion string and its selection (relative start, length) - */ - public Pair getCompletion(final IDetailExpressionProvider.ExpressionFeature feature) { - this.assertNotNull(feature); - Pair postfix = this.getPostfixReplacement(feature); - Point point = postfix.getValue(); - boolean _notEquals = (!Objects.equal(point, null)); - if (_notEquals) { - int _x = point.x; - String _id = feature.getId(); - int _length = _id.length(); - point.x = (_x + _length); - } - String _id_1 = feature.getId(); - String _key = postfix.getKey(); - String _plus = (_id_1 + _key); - return Pair.of(_plus, point); - } - - public RGB getColor(final IDetailExpressionProvider.ExpressionFeature feature) { - this.assertNotNull(feature); - RGB _switchResult = null; - Object _data = feature.getData(); - final Object data = _data; - boolean _matched = false; - if (data instanceof InterfaceItem) { - _matched=true; - _switchResult = ActionCodeColorManager.INTERFACE_ITEM; - } - if (!_matched) { - if (data instanceof Attribute) { - _matched=true; - _switchResult = ActionCodeColorManager.ATTRIBUTE; - } - } - if (!_matched) { - if (data instanceof Operation) { - _matched=true; - _switchResult = ActionCodeColorManager.OPERATION; - } - } - if (!_matched) { - if (data instanceof EObject) { - _matched=true; - _switchResult = ActionCodeColorManager.SPECIAL_FEATURE; - } - } - if (!_matched) { - if (data instanceof RuntimeDetailExpressionProvider.RuntimeMethodExpressionData) { - _matched=true; - _switchResult = ActionCodeColorManager.OPERATION; - } - } - return _switchResult; - } - - /** - * Text format: - * {@code completionInfo : typedInfo - classInfo} - */ - public String getDisplayString(final IDetailExpressionProvider.ExpressionFeature feature) { - this.assertNotNull(feature); - final Object data = feature.getData(); - String _id = feature.getId(); - Pair _postfixReplacement = this.getPostfixReplacement(feature); - String _key = _postfixReplacement.getKey(); - String completionInfo = (_id + _key); - String typedInfo = ""; - String _xifexpression = null; - if ((data instanceof EObject)) { - EClass _eClass = ((EObject)data).eClass(); - _xifexpression = _eClass.getName(); - } else { - _xifexpression = ""; - } - String classInfo = _xifexpression; - boolean _matched = false; - if (data instanceof Attribute) { - _matched=true; - RefableType _type = ((Attribute)data).getType(); - DataType _type_1 = _type.getType(); - String _name = _type_1.getName(); - typedInfo = _name; - } - if (!_matched) { - if (data instanceof InterfaceItem) { - _matched=true; - ProtocolClass _protocol = this.roomHelpers.getProtocol(((InterfaceItem)data)); - String _name = _protocol.getName(); - typedInfo = _name; - } - } - if (!_matched) { - if (data instanceof RuntimeDetailExpressionProvider.RuntimeMethodExpressionData) { - String _id_1 = feature.getId(); - boolean _equals = Objects.equal(_id_1, RuntimeDetailExpressionProvider.RT_METHOD_GET_REPLICATION); - if (_equals) { - _matched=true; - typedInfo = "int"; - } - } - } - if (!_matched) { - if (data instanceof VarDecl) { - _matched=true; - RefableType _refType = ((VarDecl)data).getRefType(); - DataType _type = _refType.getType(); - String _name = _type.getName(); - typedInfo = _name; - classInfo = ""; - } - } - if (!_matched) { - { - final String label = this.labelProvider.getText(data); - String _commonPrefix = Strings.commonPrefix(label, completionInfo); - boolean _isEmpty = _commonPrefix.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - completionInfo = label; - } - } - } - IDetailExpressionProvider.ExpressionPostfix _postfix = feature.getPostfix(); - boolean _equals = Objects.equal(_postfix, IDetailExpressionProvider.ExpressionPostfix.NONE); - if (_equals) { - boolean _matched_1 = false; - if (data instanceof SPP) { - boolean _isEventDriven = ((SPP)data).isEventDriven(); - if (_isEventDriven) { - _matched_1=true; - } - } - if (!_matched_1) { - if (data instanceof Port) { - if ((((Port)data).isReplicated() && ((Port)data).isEventDriven())) { - _matched_1=true; - } - } - } - if (_matched_1) { - completionInfo = (completionInfo + " (broadcast)"); - } - } - boolean _isEmpty = typedInfo.isEmpty(); - boolean _not = (!_isEmpty); - if (_not) { - typedInfo = (" : " + typedInfo); - } - boolean _isEmpty_1 = classInfo.isEmpty(); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - classInfo = (" - " + classInfo); - } - return ((completionInfo + typedInfo) + classInfo); - } - - public Image getImage(final IDetailExpressionProvider.ExpressionFeature feature) { - Image _xblockexpression = null; - { - this.assertNotNull(feature); - Image _switchResult = null; - Object _data = feature.getData(); - boolean _matched = false; - if (_data instanceof EObject) { - _matched=true; - Object _data_1 = feature.getData(); - _switchResult = this.labelProvider.getImage(_data_1); - } - if (!_matched) { - if (_data instanceof RuntimeDetailExpressionProvider.RuntimeMethodExpressionData) { - _matched=true; - _switchResult = Activator.getImage(DetailExpressionUIProvider.IMAGE_RT_METHOD); - } - } - _xblockexpression = _switchResult; - } - return _xblockexpression; - } - - /** - * Filter by prefix - */ - public Iterable getContextFeaturesWithPrefix(final IDetailExpressionProvider.ExpressionFeature ctx, final String prefix) { - List _contextFeatures = this.delegate.getContextFeatures(ctx); - final Function1 _function = (IDetailExpressionProvider.ExpressionFeature it) -> { - String _id = it.getId(); - return Boolean.valueOf(_id.startsWith(prefix)); - }; - return IterableExtensions.filter(_contextFeatures, _function); - } - - /** - * Filter by prefix - */ - public Iterable getInitialFeaturesWithPrefix(final String prefix) { - List _initialFeatures = this.delegate.getInitialFeatures(); - final Function1 _function = (IDetailExpressionProvider.ExpressionFeature it) -> { - String _id = it.getId(); - return Boolean.valueOf(_id.startsWith(prefix)); - }; - return IterableExtensions.filter(_initialFeatures, _function); - } - - protected void assertNotNull(final IDetailExpressionProvider.ExpressionFeature feature) { - String _id = feature.getId(); - boolean _isNullOrEmpty = Strings.isNullOrEmpty(_id); - boolean _not = (!_isNullOrEmpty); - Assert.isTrue(_not); - IDetailExpressionProvider.ExpressionPostfix _postfix = feature.getPostfix(); - Assert.isNotNull(_postfix); - Object _data = feature.getData(); - Assert.isNotNull(_data); - } - - public DetailExpressionUIProvider(final IDetailExpressionProvider delegate) { - super(); - this.delegate = delegate; - } - - public List getInitialFeatures() { - return this.delegate.getInitialFeatures(); - } - - public List getContextFeatures(final IDetailExpressionProvider.ExpressionFeature ctx) { - return this.delegate.getContextFeatures(ctx); - } -} diff --git a/releng/org.eclipse.etrice.parent/pom.xml b/releng/org.eclipse.etrice.parent/pom.xml index da916c785..a0c6d14c9 100644 --- a/releng/org.eclipse.etrice.parent/pom.xml +++ b/releng/org.eclipse.etrice.parent/pom.xml @@ -82,6 +82,8 @@ + Cp1252 + 2.10.0 1.0.0 @@ -116,7 +118,7 @@ ${tycho.version} true - + diff --git a/tests/org.eclipse.etrice.core.common.tests/xtend-gen/org/eclipse/etrice/core/common/tests/DetailCodeParseTest.java b/tests/org.eclipse.etrice.core.common.tests/xtend-gen/org/eclipse/etrice/core/common/tests/DetailCodeParseTest.java deleted file mode 100644 index ee84db5b1..000000000 --- a/tests/org.eclipse.etrice.core.common.tests/xtend-gen/org/eclipse/etrice/core/common/tests/DetailCodeParseTest.java +++ /dev/null @@ -1,325 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.common.tests; - -import com.google.inject.Inject; -import org.eclipse.etrice.core.common.BaseTestInjectorProvider; -import org.eclipse.etrice.core.common.converter.BaseConverterService; -import org.eclipse.etrice.core.common.converter.CCStringConverter; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.junit4.InjectWith; -import org.eclipse.xtext.junit4.XtextRunner; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.ObjectExtensions; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(XtextRunner.class) -@InjectWith(BaseTestInjectorProvider.class) -@SuppressWarnings("all") -public class DetailCodeParseTest { - private final String NL = Strings.newLine(); - - private final String DELIM = "\'\'\'"; - - @Inject - private BaseConverterService baseConverterService; - - protected String toValue(final String withoutDelim) { - CCStringConverter _cC_StringConverter = this.baseConverterService.getCC_StringConverter(); - String _value = _cC_StringConverter.toValue(withoutDelim, null); - final Procedure1 _function = (String convertedWithoutDelim) -> { - CCStringConverter _cC_StringConverter_1 = this.baseConverterService.getCC_StringConverter(); - final String convertedWithDelim = _cC_StringConverter_1.toValue(((this.DELIM + withoutDelim) + this.DELIM), null); - Assert.assertEquals(convertedWithoutDelim, convertedWithDelim); - }; - return ObjectExtensions.operator_doubleArrow(_value, _function); - } - - @Test - public void noLineBreak() { - StringConcatenation _builder = new StringConcatenation(); - String _value = this.toValue(_builder.toString()); - Assert.assertEquals("", _value); - StringConcatenation _builder_1 = new StringConcatenation(); - String _string = _builder_1.toString(); - StringConcatenation _builder_2 = new StringConcatenation(); - String _value_1 = this.toValue(_builder_2.toString()); - Assert.assertEquals(_string, _value_1); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append(" "); - String _value_2 = this.toValue(_builder_3.toString()); - Assert.assertEquals(" ", _value_2); - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append(" "); - String _string_1 = _builder_4.toString(); - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append(" "); - String _value_3 = this.toValue(_builder_5.toString()); - Assert.assertEquals(_string_1, _value_3); - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("\t"); - String _value_4 = this.toValue(_builder_6.toString()); - Assert.assertEquals("\t", _value_4); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("\t"); - String _string_2 = _builder_7.toString(); - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("\t"); - String _value_5 = this.toValue(_builder_8.toString()); - Assert.assertEquals(_string_2, _value_5); - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append(" "); - _builder_9.append("text "); - String _value_6 = this.toValue(_builder_9.toString()); - Assert.assertEquals(" text ", _value_6); - StringConcatenation _builder_10 = new StringConcatenation(); - _builder_10.append(" "); - _builder_10.append("text "); - String _string_3 = _builder_10.toString(); - StringConcatenation _builder_11 = new StringConcatenation(); - _builder_11.append(" "); - _builder_11.append("text "); - String _value_7 = this.toValue(_builder_11.toString()); - Assert.assertEquals(_string_3, _value_7); - String _value_8 = this.toValue("\'"); - Assert.assertEquals("\'", _value_8); - String _value_9 = this.toValue("\'\'"); - Assert.assertEquals("\'\'", _value_9); - String _value_10 = this.toValue("\""); - Assert.assertEquals("\"", _value_10); - } - - @Test - public void singleLineBreak() { - String _value = this.toValue("\r"); - Assert.assertEquals("", _value); - String _value_1 = this.toValue("\r\n"); - Assert.assertEquals("", _value_1); - String _value_2 = this.toValue("\n"); - Assert.assertEquals("", _value_2); - StringConcatenation _builder = new StringConcatenation(); - String _string = _builder.toString(); - String _value_3 = this.toValue(this.NL); - Assert.assertEquals(_string, _value_3); - final Procedure1 _function = (String text) -> { - String _value_4 = this.toValue(text); - Assert.assertEquals("", _value_4); - StringConcatenation _builder_1 = new StringConcatenation(); - String _string_1 = _builder_1.toString(); - String _value_5 = this.toValue(text); - Assert.assertEquals(_string_1, _value_5); - }; - ObjectExtensions.operator_doubleArrow( - ("\t" + this.NL), _function); - final Procedure1 _function_1 = (String text) -> { - String _value_4 = this.toValue(text); - Assert.assertEquals(("text" + this.NL), _value_4); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("text"); - _builder_1.newLine(); - String _string_1 = _builder_1.toString(); - String _value_5 = this.toValue(text); - Assert.assertEquals(_string_1, _value_5); - }; - ObjectExtensions.operator_doubleArrow( - ("text" + this.NL), _function_1); - final Procedure1 _function_2 = (String text) -> { - String _value_4 = this.toValue(text); - Assert.assertEquals((" text\t" + this.NL), _value_4); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append(" "); - _builder_1.append("text\t"); - _builder_1.newLine(); - String _string_1 = _builder_1.toString(); - String _value_5 = this.toValue(text); - Assert.assertEquals(_string_1, _value_5); - }; - ObjectExtensions.operator_doubleArrow( - (" text\t" + this.NL), _function_2); - final Procedure1 _function_3 = (String text) -> { - String _value_4 = this.toValue(text); - Assert.assertEquals(("text" + this.NL), _value_4); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("text"); - _builder_1.newLine(); - String _string_1 = _builder_1.toString(); - String _value_5 = this.toValue(text); - Assert.assertEquals(_string_1, _value_5); - }; - ObjectExtensions.operator_doubleArrow( - (("text" + this.NL) + "\t"), _function_3); - final Procedure1 _function_4 = (String text) -> { - String _value_4 = this.toValue(text); - Assert.assertEquals("text ", _value_4); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("text "); - String _string_1 = _builder_1.toString(); - String _value_5 = this.toValue(text); - Assert.assertEquals(_string_1, _value_5); - }; - ObjectExtensions.operator_doubleArrow( - (this.NL + "text "), _function_4); - final Procedure1 _function_5 = (String text) -> { - String _value_4 = this.toValue(text); - Assert.assertEquals("text", _value_4); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("text"); - String _string_1 = _builder_1.toString(); - String _value_5 = this.toValue(text); - Assert.assertEquals(_string_1, _value_5); - }; - ObjectExtensions.operator_doubleArrow( - ((" " + this.NL) + "text"), _function_5); - final Procedure1 _function_6 = (String text) -> { - String _value_4 = this.toValue(text); - Assert.assertEquals("text ", _value_4); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("text "); - String _string_1 = _builder_1.toString(); - String _value_5 = this.toValue(text); - Assert.assertEquals(_string_1, _value_5); - }; - ObjectExtensions.operator_doubleArrow( - (this.NL + " text "), _function_6); - } - - @Test - public void twoLineBreaks() { - final Procedure1 _function = (String text) -> { - String _value = this.toValue(text); - Assert.assertEquals(this.NL, _value); - StringConcatenation _builder = new StringConcatenation(); - _builder.newLine(); - String _string = _builder.toString(); - String _value_1 = this.toValue(text); - Assert.assertEquals(_string, _value_1); - }; - ObjectExtensions.operator_doubleArrow( - (this.NL + this.NL), _function); - final Procedure1 _function_1 = (String text) -> { - String _value = this.toValue(text); - Assert.assertEquals((("text" + this.NL) + this.NL), _value); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("text"); - _builder.newLine(); - _builder.newLine(); - String _string = _builder.toString(); - String _value_1 = this.toValue(text); - Assert.assertEquals(_string, _value_1); - }; - ObjectExtensions.operator_doubleArrow( - (("text" + this.NL) + this.NL), _function_1); - final Procedure1 _function_2 = (String text) -> { - String _value = this.toValue(text); - Assert.assertEquals(((("text" + this.NL) + "\t\t\t\tindent") + this.NL), _value); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("text"); - _builder.newLine(); - _builder.append("\t\t\t\t"); - _builder.append("indent"); - _builder.newLine(); - String _string = _builder.toString(); - String _value_1 = this.toValue(text); - Assert.assertEquals(_string, _value_1); - }; - ObjectExtensions.operator_doubleArrow( - ((("text" + this.NL) + "\t\t\t\tindent") + this.NL), _function_2); - final Procedure1 _function_3 = (String text) -> { - String _value = this.toValue(text); - Assert.assertEquals(("text" + this.NL), _value); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("text"); - _builder.newLine(); - String _string = _builder.toString(); - String _value_1 = this.toValue(text); - Assert.assertEquals(_string, _value_1); - }; - ObjectExtensions.operator_doubleArrow( - ((this.NL + "text") + this.NL), _function_3); - final Procedure1 _function_4 = (String text) -> { - String _value = this.toValue(text); - Assert.assertEquals(("text\t" + this.NL), _value); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("text\t"); - _builder.newLine(); - String _string = _builder.toString(); - String _value_1 = this.toValue(text); - Assert.assertEquals(_string, _value_1); - }; - ObjectExtensions.operator_doubleArrow( - ((this.NL + "\t\t\t\ttext\t") + this.NL), _function_4); - final Procedure1 _function_5 = (String text) -> { - String _value = this.toValue(text); - Assert.assertEquals((("text" + this.NL) + "text2 "), _value); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("text"); - _builder.newLine(); - _builder.append("text2 "); - String _string = _builder.toString(); - String _value_1 = this.toValue(text); - Assert.assertEquals(_string, _value_1); - }; - ObjectExtensions.operator_doubleArrow( - (((this.NL + "text") + this.NL) + "text2 "), _function_5); - final Procedure1 _function_6 = (String text) -> { - String _value = this.toValue(text); - Assert.assertEquals((("\ttext" + this.NL) + "text2 "), _value); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\t"); - _builder.append("text"); - _builder.newLine(); - _builder.append("text2 "); - String _string = _builder.toString(); - String _value_1 = this.toValue(text); - Assert.assertEquals(_string, _value_1); - }; - ObjectExtensions.operator_doubleArrow( - (((this.NL + "\ttext") + this.NL) + "text2 "), _function_6); - final Procedure1 _function_7 = (String text) -> { - String _value = this.toValue(text); - Assert.assertEquals((("text" + this.NL) + "\t\t\tindent"), _value); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("text"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("indent"); - String _string = _builder.toString(); - String _value_1 = this.toValue(text); - Assert.assertEquals(_string, _value_1); - }; - ObjectExtensions.operator_doubleArrow( - (((this.NL + "text") + this.NL) + "\t\t\tindent"), _function_7); - } - - @Test - public void multiLineBreaks() { - final Procedure1 _function = (String text) -> { - String _value = this.toValue(text); - Assert.assertEquals(((((((" " + this.NL) + this.NL) + "\t\t ") + this.NL) + "text") + this.NL), _value); - StringConcatenation _builder = new StringConcatenation(); - _builder.append(" "); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t\t "); - _builder.newLine(); - _builder.append("text"); - _builder.newLine(); - String _string = _builder.toString(); - String _value_1 = this.toValue(text); - Assert.assertEquals(_string, _value_1); - }; - ObjectExtensions.operator_doubleArrow( - (((((((this.NL + "\t\t\t ") + this.NL) + this.NL) + "\t\t ") + this.NL) + "\t\t\ttext") + this.NL), _function); - } -} diff --git a/tests/org.eclipse.etrice.core.common.tests/xtend-gen/org/eclipse/etrice/core/common/tests/RelativeFileURITest.java b/tests/org.eclipse.etrice.core.common.tests/xtend-gen/org/eclipse/etrice/core/common/tests/RelativeFileURITest.java deleted file mode 100644 index 85d976dd0..000000000 --- a/tests/org.eclipse.etrice.core.common.tests/xtend-gen/org/eclipse/etrice/core/common/tests/RelativeFileURITest.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.common.tests; - -import com.google.common.collect.Iterables; -import java.util.Collections; -import java.util.List; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.URI; -import org.eclipse.etrice.core.common.scoping.RelativeFileURIHandler; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; -import org.junit.Assert; -import org.junit.Test; - -@SuppressWarnings("all") -public class RelativeFileURITest { - private final static List ABSOLUTE_URLS = Collections.unmodifiableList(CollectionLiterals.newArrayList("file:/", "file:/bar", "file:/bar/", "file:/bar/baz", "file:/bar/baz/", "file:/c:", "file:/c:/", "file:/c:/bar", "file:/c:/bar/", "file:/c:/bar/baz", "file:/c:/bar/baz/", "file://foo", "file://foo/", "file://foo/bar", "file://foo/bar/", "file://foo/bar/baz", "file://foo/bar/baz/", "file://foo/c:", "file://foo/c:/", "file://foo/c:/bar", "file://foo/c:/bar/", "file://foo/c:/bar/baz", "file://foo/c:/bar/baz/")); - - private final static List RESOLVED_PRESERVE_ABOVE_ROOT_URIS = Collections.unmodifiableList(CollectionLiterals.newArrayList("file:/a/../g", "file:/a/../../g")); - - private final static List RESOLVED_NO_PRESERVE_ABOVE_ROOT_URIS = Collections.unmodifiableList(CollectionLiterals.newArrayList("file:/a/g", "file:/a/g/e")); - - private final static List ENCODED_URIS = Collections.unmodifiableList(CollectionLiterals.newArrayList("http://www.eclipse.org/foo", "http://server%231.eclipse.org/foo%20bar/baz#toc", "myscheme:my%20name", "file:/C:/My%20Documents/me/50%25+1.txt")); - - private final static List ENCODED_PLATFORM_PATH_URIS = Collections.unmodifiableList(CollectionLiterals.newArrayList("platform:/resource/project/myfile.txt", "platform:/resource/My%20Project%20%231/My%20File.txt", "platform:/resource/are%20you%20there%3F", "platform:/resource/are%20you%20there%3F.txt", "platform:/resource")); - - private final static List QUERIES = Collections.unmodifiableList(CollectionLiterals.newArrayList("", "?q=huh")); - - private final static List FRAGMENTS = Collections.unmodifiableList(CollectionLiterals.newArrayList("", "#toc", "#/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p", "#1:2:3")); - - private final static URI TEST_URI = URI.createURI("file:/a/b/c/d"); - - public Iterable allURIs() { - Iterable _plus = Iterables.concat(RelativeFileURITest.ABSOLUTE_URLS, RelativeFileURITest.RESOLVED_PRESERVE_ABOVE_ROOT_URIS); - Iterable _plus_1 = Iterables.concat(_plus, RelativeFileURITest.RESOLVED_NO_PRESERVE_ABOVE_ROOT_URIS); - Iterable _plus_2 = Iterables.concat(_plus_1, RelativeFileURITest.ENCODED_URIS); - final Function1>> _function = (String uri) -> { - final Function1> _function_1 = (String query) -> { - final Function1 _function_2 = (String fragment) -> { - return ((uri + query) + fragment); - }; - return ListExtensions.map(RelativeFileURITest.FRAGMENTS, _function_2); - }; - return ListExtensions.>map(RelativeFileURITest.QUERIES, _function_1); - }; - Iterable>> _map = IterableExtensions.>>map(_plus_2, _function); - Iterable> _flatten = Iterables.>concat(_map); - Iterable _flatten_1 = Iterables.concat(_flatten); - final Function1 _function_1 = (String it) -> { - return URI.createURI(it); - }; - return IterableExtensions.map(_flatten_1, _function_1); - } - - private final RelativeFileURIHandler handler = new RelativeFileURIHandler(); - - @Test - public void resolveSelf() { - Iterable _allURIs = this.allURIs(); - final Consumer _function = (URI uri) -> { - this.handler.setBaseURI(RelativeFileURITest.TEST_URI); - URI _resolve = this.handler.resolve(uri); - Assert.assertEquals(uri, _resolve); - }; - _allURIs.forEach(_function); - } - - @Test - public void roundtripResolve() { - Iterable _allURIs = this.allURIs(); - final Consumer _function = (URI uri) -> { - URI _createURI = URI.createURI("file:/a/b/c/d"); - this.handler.setBaseURI(_createURI); - URI _deresolve = this.handler.deresolve(uri); - URI _resolve = this.handler.resolve(_deresolve); - Assert.assertEquals(uri, _resolve); - }; - _allURIs.forEach(_function); - } - - @Test - public void deresolveBaseFile() { - final URI testURI = RelativeFileURITest.TEST_URI.appendFragment("1:2:3"); - String _get = RelativeFileURITest.RESOLVED_NO_PRESERVE_ABOVE_ROOT_URIS.get(0); - URI _createURI = URI.createURI(_get); - this.handler.setBaseURI(_createURI); - URI _deresolve = this.handler.deresolve(testURI); - String _string = _deresolve.toString(); - Assert.assertEquals("b/c/d#1:2:3", _string); - String _get_1 = RelativeFileURITest.RESOLVED_NO_PRESERVE_ABOVE_ROOT_URIS.get(1); - URI _createURI_1 = URI.createURI(_get_1); - this.handler.setBaseURI(_createURI_1); - URI _deresolve_1 = this.handler.deresolve(testURI); - String _string_1 = _deresolve_1.toString(); - Assert.assertEquals("../b/c/d#1:2:3", _string_1); - } - - @Test - public void interDocument() { - final URI testURI = RelativeFileURITest.TEST_URI.appendFragment("1:2:3"); - this.handler.setBaseURI(RelativeFileURITest.TEST_URI); - URI _deresolve = this.handler.deresolve(testURI); - String _string = _deresolve.toString(); - Assert.assertEquals("#1:2:3", _string); - URI _appendFragment = RelativeFileURITest.TEST_URI.appendFragment("some"); - this.handler.setBaseURI(_appendFragment); - URI _deresolve_1 = this.handler.deresolve(testURI); - String _string_1 = _deresolve_1.toString(); - Assert.assertEquals("#1:2:3", _string_1); - } -} diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/xtend-gen/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierInheritedFSM.java b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/xtend-gen/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierInheritedFSM.java deleted file mode 100644 index 38df45e96..000000000 --- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/xtend-gen/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierInheritedFSM.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Copyright (c) 2017 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - */ -package org.eclipse.etrice.core.genmodel.fsm.tests; - -import java.util.Iterator; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker; -import org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions; -import org.eclipse.etrice.core.genmodel.fsm.NullLogger; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Graph; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Link; -import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Node; -import org.eclipse.etrice.core.genmodel.fsm.tests.FsmGenTestBase; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.IteratorExtensions; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("all") -public class TestHierInheritedFSM extends FsmGenTestBase { - private GraphContainer gc; - - @Before - public void SetUp() { - GraphContainer _graphContainer = this.getGraphContainer("HierInheritedFSMExample.room", "TestActor"); - this.gc = _graphContainer; - Assert.assertNotNull("graph context was created", this.gc); - final NullLogger logger = new NullLogger(); - FsmGenChecker.check(this.gc, logger); - boolean _hasErrors = logger.hasErrors(); - Assert.assertFalse("logger has no errors", _hasErrors); - this.save(this.gc, "HierInheritedFSMExample"); - } - - @Test - public void testHierInheritedFSMItemCounts() { - Graph _graph = this.gc.getGraph(); - EList _nodes = _graph.getNodes(); - int _size = _nodes.size(); - Assert.assertEquals("number of nodes", 4, _size); - Graph _graph_1 = this.gc.getGraph(); - EList _links = _graph_1.getLinks(); - int _size_1 = _links.size(); - Assert.assertEquals("number of links", 6, _size_1); - Graph _graph_2 = this.gc.getGraph(); - Iterable _stateNodes = FsmGenExtensions.getStateNodes(_graph_2); - int _size_2 = IterableExtensions.size(_stateNodes); - Assert.assertEquals("number of states", 4, _size_2); - Graph _graph_3 = this.gc.getGraph(); - Iterable _trPointNodes = FsmGenExtensions.getTrPointNodes(_graph_3); - int _size_3 = IterableExtensions.size(_trPointNodes); - Assert.assertEquals("number of tr points", 0, _size_3); - Graph _graph_4 = this.gc.getGraph(); - Iterable _choicePointNodes = FsmGenExtensions.getChoicePointNodes(_graph_4); - int _size_4 = IterableExtensions.size(_choicePointNodes); - Assert.assertEquals("number of choice points", 0, _size_4); - } - - @Test - public void testHierInheritedFSMDeepItemCounts() { - Graph _graph = this.gc.getGraph(); - Iterator _allNodes = FsmGenExtensions.getAllNodes(_graph); - int _size = IteratorExtensions.size(_allNodes); - Assert.assertEquals("number of nodes", 12, _size); - Graph _graph_1 = this.gc.getGraph(); - Iterator _allLinks = FsmGenExtensions.getAllLinks(_graph_1); - int _size_1 = IteratorExtensions.size(_allLinks); - Assert.assertEquals("number of links", 14, _size_1); - Graph _graph_2 = this.gc.getGraph(); - Iterator _allStateNodes = FsmGenExtensions.getAllStateNodes(_graph_2); - int _size_2 = IteratorExtensions.size(_allStateNodes); - Assert.assertEquals("number of states", 10, _size_2); - Graph _graph_3 = this.gc.getGraph(); - Iterator _allTrPointNodes = FsmGenExtensions.getAllTrPointNodes(_graph_3); - int _size_3 = IteratorExtensions.size(_allTrPointNodes); - Assert.assertEquals("number of tr points", 2, _size_3); - Graph _graph_4 = this.gc.getGraph(); - Iterator _allChoicePointNodes = FsmGenExtensions.getAllChoicePointNodes(_graph_4); - int _size_4 = IteratorExtensions.size(_allChoicePointNodes); - Assert.assertEquals("number of choice points", 0, _size_4); - } - - @Test - public void testHierInheritedFSMLinks() { - Graph _graph = this.gc.getGraph(); - Iterator _allStateNodes = FsmGenExtensions.getAllStateNodes(_graph); - final Function1 _function = new Function1() { - @Override - public Boolean apply(final Node it) { - String _name = FsmGenExtensions.getName(it); - return Boolean.valueOf(_name.equals("state1_0")); - } - }; - Iterator _filter = IteratorExtensions.filter(_allStateNodes, _function); - final Node s = IteratorExtensions.head(_filter); - Assert.assertNotNull("state found", s); - EList _incoming = s.getIncoming(); - int _size = _incoming.size(); - Assert.assertEquals("incoming links", 2, _size); - EList _outgoing = s.getOutgoing(); - int _size_1 = _outgoing.size(); - Assert.assertEquals("outgoing links", 1, _size_1); - } -} diff --git a/tests/org.eclipse.etrice.core.room.tests/xtend-gen/org/eclipse/etrice/core/FormatterTest.java b/tests/org.eclipse.etrice.core.room.tests/xtend-gen/org/eclipse/etrice/core/FormatterTest.java deleted file mode 100644 index 43be83aad..000000000 --- a/tests/org.eclipse.etrice.core.room.tests/xtend-gen/org/eclipse/etrice/core/FormatterTest.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.eclipse.etrice.core; - -import com.google.common.base.Objects; -import com.google.common.io.CharStreams; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URI; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Consumer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.etrice.core.CoreTestsActivator; -import org.eclipse.etrice.core.room.tests.RoomInjectorProvider; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.junit4.InjectWith; -import org.eclipse.xtext.junit4.XtextRunner; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Exceptions; -import org.eclipse.xtext.xbase.lib.Functions.Function0; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.Functions.Function2; -import org.eclipse.xtext.xbase.lib.InputOutput; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ObjectExtensions; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.osgi.framework.Bundle; - -@RunWith(XtextRunner.class) -@InjectWith(RoomInjectorProvider.class) -@SuppressWarnings("all") -public class FormatterTest extends FormatterTester { - private final List patterns = new Function0>() { - public List apply() { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("([^\\w\\s])\\s+(\\w)"); - Pattern _compile = Pattern.compile(_builder.toString()); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("([^\\w\\s])\\s+([^\\w\\s])"); - Pattern _compile_1 = Pattern.compile(_builder_1.toString()); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("(\\w)\\s+([^\\w\\s])"); - Pattern _compile_2 = Pattern.compile(_builder_2.toString()); - return Collections.unmodifiableList(CollectionLiterals.newArrayList(_compile, _compile_1, _compile_2)); - } - }.apply(); - - @Test - public void unformatEqualsFormat() { - ArrayList _newArrayList = CollectionLiterals.newArrayList(); - final Procedure1> _function = (ArrayList contents) -> { - try { - CoreTestsActivator _instance = CoreTestsActivator.getInstance(); - Bundle _bundle = _instance.getBundle(); - final Enumeration entries = _bundle.findEntries("models/formatting/unformatEqualsFormat/", "*.room", false); - while (entries.hasMoreElements()) { - URL _nextElement = entries.nextElement(); - URL _fileURL = FileLocator.toFileURL(_nextElement); - InputStream _openStream = _fileURL.openStream(); - InputStreamReader _inputStreamReader = new InputStreamReader(_openStream); - String _string = CharStreams.toString(_inputStreamReader); - contents.add(_string); - } - } catch (Throwable _e) { - throw Exceptions.sneakyThrow(_e); - } - }; - final ArrayList expectedContents = ObjectExtensions.>operator_doubleArrow(_newArrayList, _function); - boolean _isEmpty = expectedContents.isEmpty(); - boolean _not = (!_isEmpty); - Assert.assertTrue(_not); - final Function1 _function_1 = (String content) -> { - String _xblockexpression = null; - { - final Function2 _function_2 = (String replaced, Pattern pattern) -> { - Matcher _matcher = pattern.matcher(replaced); - return _matcher.replaceAll("$1$2"); - }; - final String unformatted = IterableExtensions.fold(this.patterns, content, _function_2); - Assert.assertNotEquals(content, unformatted); - String _replace = unformatted.replace("\r\n", " "); - _xblockexpression = _replace.replace("\n", " "); - } - return _xblockexpression; - }; - final Function1 unformatter = _function_1; - final Consumer _function_2 = (String expected) -> { - String _apply = unformatter.apply(expected); - InputOutput.println(_apply); - final Procedure1 _function_3 = (FormatterTestRequest it) -> { - it.setExpectation(expected); - String _apply_1 = unformatter.apply(expected); - it.setToBeFormatted(_apply_1); - }; - this.assertFormatted(_function_3); - }; - expectedContents.forEach(_function_2); - } - - @Test - public void testManual() { - final Function1> _function = (String path) -> { - HashMap _xblockexpression = null; - { - CoreTestsActivator _instance = CoreTestsActivator.getInstance(); - Bundle _bundle = _instance.getBundle(); - final Enumeration entries = _bundle.findEntries(path, "*.room", false); - HashMap _newHashMap = CollectionLiterals.newHashMap(); - final Procedure1> _function_1 = (HashMap contentMap) -> { - try { - while (entries.hasMoreElements()) { - { - final URL entry = entries.nextElement(); - URI _uRI = entry.toURI(); - String _string = _uRI.toString(); - org.eclipse.emf.common.util.URI _createURI = org.eclipse.emf.common.util.URI.createURI(_string); - final String name = _createURI.lastSegment(); - URL _fileURL = FileLocator.toFileURL(entry); - InputStream _openStream = _fileURL.openStream(); - InputStreamReader _inputStreamReader = new InputStreamReader(_openStream); - String _string_1 = CharStreams.toString(_inputStreamReader); - contentMap.put(name, _string_1); - } - } - } catch (Throwable _e) { - throw Exceptions.sneakyThrow(_e); - } - }; - _xblockexpression = ObjectExtensions.>operator_doubleArrow(_newHashMap, _function_1); - } - return _xblockexpression; - }; - final Function1> collector = _function; - final Map unformattedContents = collector.apply("models/formatting/expected/"); - final Map expectedContents = collector.apply("models/formatting/expected/"); - Assert.assertTrue(((!unformattedContents.isEmpty()) && Objects.equal(expectedContents.keySet(), unformattedContents.keySet()))); - Set _keySet = expectedContents.keySet(); - final Consumer _function_1 = (String fileName) -> { - final Procedure1 _function_2 = (FormatterTestRequest it) -> { - String _get = expectedContents.get(fileName); - it.setExpectation(_get); - String _get_1 = unformattedContents.get(fileName); - it.setToBeFormatted(_get_1); - }; - this.assertFormatted(_function_2); - }; - _keySet.forEach(_function_1); - } -} diff --git a/tests/org.eclipse.etrice.core.room.tests/xtend-gen/org/eclipse/etrice/core/TestNames.java b/tests/org.eclipse.etrice.core.room.tests/xtend-gen/org/eclipse/etrice/core/TestNames.java deleted file mode 100644 index ce3f618d7..000000000 --- a/tests/org.eclipse.etrice.core.room.tests/xtend-gen/org/eclipse/etrice/core/TestNames.java +++ /dev/null @@ -1,179 +0,0 @@ -/** - * Copyright (c) 2015 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core; - -import com.google.common.base.Objects; -import com.google.common.collect.Iterables; -import com.google.common.collect.Maps; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.etrice.core.TestBase; -import org.eclipse.etrice.core.room.ExternalPort; -import org.eclipse.xtext.validation.AbstractValidationDiagnostic; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("all") -public class TestNames extends TestBase { - private final Map nameErrorMap = Maps.newHashMap(); - - private Resource res; - - @Before - public void SetUp() { - this.prepare(); - Resource _resource = this.getResource("NamesAreUnique.room"); - this.res = _resource; - EList _contents = this.res.getContents(); - final EObject model = IterableExtensions.head(_contents); - final Diagnostic diag = this.getDiag(model); - List _children = diag.getChildren(); - final Consumer _function = (Diagnostic it) -> { - if ((it instanceof AbstractValidationDiagnostic)) { - final EObject obj = ((AbstractValidationDiagnostic)it).getSourceEObject(); - Boolean nameError = this.nameErrorMap.get(obj); - boolean _equals = Objects.equal(nameError, null); - if (_equals) { - nameError = Boolean.valueOf(false); - } - this.nameErrorMap.put(obj, Boolean.valueOf(((nameError).booleanValue() || this.isNameErrorMessage(it)))); - } - }; - _children.forEach(_function); - } - - @Test - public void RoomClassNames() { - EObject _eObject = this.res.getEObject("ActorClass:ClassDuplicate1"); - boolean _hasNameErrorMessage = this.hasNameErrorMessage(_eObject); - Assert.assertTrue(_hasNameErrorMessage); - EObject _eObject_1 = this.res.getEObject("LogicalSystem:ClassDuplicate1"); - boolean _hasNameErrorMessage_1 = this.hasNameErrorMessage(_eObject_1); - Assert.assertTrue(_hasNameErrorMessage_1); - EObject _eObject_2 = this.res.getEObject("AnnotationType:ClassDuplicate1"); - boolean _hasNameErrorMessage_2 = this.hasNameErrorMessage(_eObject_2); - Assert.assertTrue(_hasNameErrorMessage_2); - EObject _eObject_3 = this.res.getEObject("EnumerationType:ClassDuplicate1"); - boolean _hasNameErrorMessage_3 = this.hasNameErrorMessage(_eObject_3); - Assert.assertTrue(_hasNameErrorMessage_3); - EObject _eObject_4 = this.res.getEObject("PrimitiveType:ClassDuplicate1"); - boolean _hasNameErrorMessage_4 = this.hasNameErrorMessage(_eObject_4); - Assert.assertTrue(_hasNameErrorMessage_4); - } - - @Test - public void BaseClassNames() { - final EObject ac = this.res.getEObject("ActorClass:Base"); - final EObject dc = this.res.getEObject("DataClass:DBase"); - final ArrayList items = CollectionLiterals.newArrayList(ac, dc); - EList _eContents = ac.eContents(); - Iterables.addAll(items, _eContents); - EList _eContents_1 = dc.eContents(); - Iterables.addAll(items, _eContents_1); - int _size = items.size(); - Assert.assertEquals("Unexpected item count", 15, _size); - final Consumer _function = (EObject it) -> { - boolean _hasNameErrorMessage = this.hasNameErrorMessage(it); - Assert.assertFalse(("expected no name error: " + it), _hasNameErrorMessage); - }; - items.forEach(_function); - } - - @Test - public void OverrideNames() { - final EObject ac = this.res.getEObject("ActorClass:Override"); - final EObject dc = this.res.getEObject("DataClass:DOverride"); - final ArrayList items = CollectionLiterals.newArrayList(ac, dc); - EList _eContents = ac.eContents(); - Iterables.addAll(items, _eContents); - EList _eContents_1 = dc.eContents(); - Iterables.addAll(items, _eContents_1); - int _size = items.size(); - Assert.assertEquals("Unexpected item count", 9, _size); - final Consumer _function = (EObject it) -> { - boolean _hasNameErrorMessage = this.hasNameErrorMessage(it); - Assert.assertFalse(("expected no name error: " + it), _hasNameErrorMessage); - }; - items.forEach(_function); - } - - @Test - public void InheritedNames() { - final EObject ac = this.res.getEObject("ActorClass:Sub"); - final EObject dc = this.res.getEObject("DataClass:DSub"); - final ArrayList items = CollectionLiterals.newArrayList(); - EList _eContents = ac.eContents(); - final Function1 _function = (EObject it) -> { - return Boolean.valueOf((!(it instanceof ExternalPort))); - }; - Iterable _filter = IterableExtensions.filter(_eContents, _function); - Iterables.addAll(items, _filter); - EList _eContents_1 = dc.eContents(); - Iterables.addAll(items, _eContents_1); - int _size = items.size(); - Assert.assertEquals("Unexpected item count", 13, _size); - final Consumer _function_1 = (EObject it) -> { - boolean _hasNameErrorMessage = this.hasNameErrorMessage(it); - Assert.assertTrue(("expected name error: " + it), _hasNameErrorMessage); - }; - items.forEach(_function_1); - } - - @Test - public void FlatNames() { - final EObject ac = this.res.getEObject("ActorClass:Flat"); - final EObject dc = this.res.getEObject("DataClass:DFlat"); - final EObject lc = this.res.getEObject("DataClass:LFlat"); - final EObject sc = this.res.getEObject("DataClass:SFlat"); - final EObject enum_ = this.res.getEObject("DataClass:EnumFlat"); - final ArrayList items = CollectionLiterals.newArrayList(); - EList _eContents = ac.eContents(); - final Function1 _function = (EObject it) -> { - return Boolean.valueOf((!(it instanceof ExternalPort))); - }; - Iterable _filter = IterableExtensions.filter(_eContents, _function); - Iterables.addAll(items, _filter); - EList _eContents_1 = dc.eContents(); - Iterables.addAll(items, _eContents_1); - EList _eContents_2 = lc.eContents(); - Iterables.addAll(items, _eContents_2); - EList _eContents_3 = sc.eContents(); - Iterables.addAll(items, _eContents_3); - EList _eContents_4 = enum_.eContents(); - Iterables.addAll(items, _eContents_4); - int _size = items.size(); - Assert.assertEquals("Unexpected item count", 16, _size); - final Consumer _function_1 = (EObject it) -> { - boolean _hasNameErrorMessage = this.hasNameErrorMessage(it); - Assert.assertTrue(("expected name error: " + it), _hasNameErrorMessage); - }; - items.forEach(_function_1); - } - - private boolean hasNameErrorMessage(final EObject obj) { - return (this.nameErrorMap.containsKey(obj) && (this.nameErrorMap.get(obj)).booleanValue()); - } - - protected boolean isNameErrorMessage(final Diagnostic diag) { - final String message = diag.getMessage(); - return ((diag.getSeverity() >= Diagnostic.ERROR) && (message.contains("Duplicate name") || (message.contains("Name") && message.contains("is already assigned to")))); - } -} -- cgit v1.2.3 From 9c159513eea9d2ac0588ffb0b93c51aaeff22f21 Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Sun, 10 Sep 2017 20:02:50 +0200 Subject: [releng] gradle build for generators --- .gitignore | 4 +- build.gradle | 0 gradle.properties | 3 + plugins/build.gradle | 7 ++ .../org.eclipse.etrice.core.common/build.gradle | 17 ++++ .../org.eclipse.etrice.core.config/build.gradle | 16 ++++ plugins/org.eclipse.etrice.core.etmap/build.gradle | 20 +++++ .../org.eclipse.etrice.core.etphys/build.gradle | 15 ++++ plugins/org.eclipse.etrice.core.fsm/build.gradle | 17 ++++ .../build.gradle | 17 ++++ .../org.eclipse.etrice.core.genmodel/build.gradle | 17 ++++ plugins/org.eclipse.etrice.core.room/build.gradle | 19 +++++ .../org.eclipse.etrice.generator.c/build.gradle | 30 +++++++ .../build.gradle | 22 +++++ .../org.eclipse.etrice.generator.cpp/build.gradle | 29 +++++++ .../org.eclipse.etrice.generator.doc/build.gradle | 19 +++++ .../org.eclipse.etrice.generator.fsm/build.gradle | 20 +++++ .../build.gradle | 20 +++++ .../org.eclipse.etrice.generator.java/build.gradle | 29 +++++++ plugins/org.eclipse.etrice.generator/build.gradle | 23 ++++++ pom.xml | 93 ++++++++++++++++++++++ releng/org.eclipse.etrice.parent/pom.xml | 73 ----------------- settings.gradle | 16 ++++ 23 files changed, 452 insertions(+), 74 deletions(-) create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 plugins/build.gradle create mode 100644 plugins/org.eclipse.etrice.core.common/build.gradle create mode 100644 plugins/org.eclipse.etrice.core.config/build.gradle create mode 100644 plugins/org.eclipse.etrice.core.etmap/build.gradle create mode 100644 plugins/org.eclipse.etrice.core.etphys/build.gradle create mode 100644 plugins/org.eclipse.etrice.core.fsm/build.gradle create mode 100644 plugins/org.eclipse.etrice.core.genmodel.fsm/build.gradle create mode 100644 plugins/org.eclipse.etrice.core.genmodel/build.gradle create mode 100644 plugins/org.eclipse.etrice.core.room/build.gradle create mode 100644 plugins/org.eclipse.etrice.generator.c/build.gradle create mode 100644 plugins/org.eclipse.etrice.generator.config/build.gradle create mode 100644 plugins/org.eclipse.etrice.generator.cpp/build.gradle create mode 100644 plugins/org.eclipse.etrice.generator.doc/build.gradle create mode 100644 plugins/org.eclipse.etrice.generator.fsm/build.gradle create mode 100644 plugins/org.eclipse.etrice.generator.gnuplot/build.gradle create mode 100644 plugins/org.eclipse.etrice.generator.java/build.gradle create mode 100644 plugins/org.eclipse.etrice.generator/build.gradle create mode 100644 pom.xml create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore index 5899d5def..426460ec6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ gerritKeys.pub *.xtendbin language.settings.xml target/ -xtend-gen/ \ No newline at end of file +xtend-gen/ +build/ +.gradle/ \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..e69de29bb diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..ff4df7d85 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +xtext_version = + +core_version = + +commons_io_version = + \ No newline at end of file diff --git a/plugins/build.gradle b/plugins/build.gradle new file mode 100644 index 000000000..46c7c1cde --- /dev/null +++ b/plugins/build.gradle @@ -0,0 +1,7 @@ +subprojects { + + repositories { + mavenCentral() + } + +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.common/build.gradle b/plugins/org.eclipse.etrice.core.common/build.gradle new file mode 100644 index 000000000..dc3aad1be --- /dev/null +++ b/plugins/org.eclipse.etrice.core.common/build.gradle @@ -0,0 +1,17 @@ +plugins { + id 'java' +} + +dependencies { + compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" + compile "org.eclipse.platform:org.eclipse.core.resources:$core_version" + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'src-gen', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.config/build.gradle b/plugins/org.eclipse.etrice.core.config/build.gradle new file mode 100644 index 000000000..e5d4bb91c --- /dev/null +++ b/plugins/org.eclipse.etrice.core.config/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') + compile project(':plugins:org.eclipse.etrice.core.room') +} + +sourceSets { + main { + java { + srcDirs = ['src', 'src-gen', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.etmap/build.gradle b/plugins/org.eclipse.etrice.core.etmap/build.gradle new file mode 100644 index 000000000..751a74cfa --- /dev/null +++ b/plugins/org.eclipse.etrice.core.etmap/build.gradle @@ -0,0 +1,20 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') + compile project(':plugins:org.eclipse.etrice.core.etphys') + compile project(':plugins:org.eclipse.etrice.core.room') + compile project(':plugins:org.eclipse.etrice.core.genmodel') + + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'src-gen', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.etphys/build.gradle b/plugins/org.eclipse.etrice.core.etphys/build.gradle new file mode 100644 index 000000000..857cc5786 --- /dev/null +++ b/plugins/org.eclipse.etrice.core.etphys/build.gradle @@ -0,0 +1,15 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') +} + +sourceSets { + main { + java { + srcDirs = ['src', 'src-gen', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.fsm/build.gradle b/plugins/org.eclipse.etrice.core.fsm/build.gradle new file mode 100644 index 000000000..bacf55a18 --- /dev/null +++ b/plugins/org.eclipse.etrice.core.fsm/build.gradle @@ -0,0 +1,17 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') + + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'src-gen', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.genmodel.fsm/build.gradle b/plugins/org.eclipse.etrice.core.genmodel.fsm/build.gradle new file mode 100644 index 000000000..bba13bccb --- /dev/null +++ b/plugins/org.eclipse.etrice.core.genmodel.fsm/build.gradle @@ -0,0 +1,17 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.fsm') + + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.genmodel/build.gradle b/plugins/org.eclipse.etrice.core.genmodel/build.gradle new file mode 100644 index 000000000..de3e1b9b5 --- /dev/null +++ b/plugins/org.eclipse.etrice.core.genmodel/build.gradle @@ -0,0 +1,17 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') + compile project(':plugins:org.eclipse.etrice.core.room') + compile project(':plugins:org.eclipse.etrice.core.genmodel.fsm') +} + +sourceSets { + main { + java { + srcDirs = ['src'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.room/build.gradle b/plugins/org.eclipse.etrice.core.room/build.gradle new file mode 100644 index 000000000..92072c02b --- /dev/null +++ b/plugins/org.eclipse.etrice.core.room/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') + compile project(':plugins:org.eclipse.etrice.core.fsm') + + compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'src-gen', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.c/build.gradle b/plugins/org.eclipse.etrice.generator.c/build.gradle new file mode 100644 index 000000000..c25ee5832 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.c/build.gradle @@ -0,0 +1,30 @@ +plugins { + id 'application' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.room') + compile project(':plugins:org.eclipse.etrice.core.etphys') + compile project(':plugins:org.eclipse.etrice.core.etmap') + compile project(':plugins:org.eclipse.etrice.core.fsm') + compile project(':plugins:org.eclipse.etrice.core.genmodel') + compile project(':plugins:org.eclipse.etrice.generator') + compile project(':plugins:org.eclipse.etrice.generator.fsm') + compile project(':plugins:org.eclipse.etrice.generator.config') + compile project(':plugins:org.eclipse.etrice.generator.doc') + compile project(':plugins:org.eclipse.etrice.generator.gnuplot') + + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'xtend-gen'] + } + } +} + +mainClassName = 'org.eclipse.etrice.generator.c.Main' + +distTar.enabled = false \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.config/build.gradle b/plugins/org.eclipse.etrice.generator.config/build.gradle new file mode 100644 index 000000000..5b9d89a8f --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.config/build.gradle @@ -0,0 +1,22 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') + compile project(':plugins:org.eclipse.etrice.core.room') + compile project(':plugins:org.eclipse.etrice.core.genmodel') + compile project(':plugins:org.eclipse.etrice.core.genmodel.fsm') + compile project(':plugins:org.eclipse.etrice.core.config') + compile project(':plugins:org.eclipse.etrice.generator') + + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.cpp/build.gradle b/plugins/org.eclipse.etrice.generator.cpp/build.gradle new file mode 100644 index 000000000..e3c8f948f --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.cpp/build.gradle @@ -0,0 +1,29 @@ +plugins { + id 'application' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.room') + compile project(':plugins:org.eclipse.etrice.core.etphys') + compile project(':plugins:org.eclipse.etrice.core.etmap') + compile project(':plugins:org.eclipse.etrice.core.fsm') + compile project(':plugins:org.eclipse.etrice.core.genmodel') + compile project(':plugins:org.eclipse.etrice.generator') + compile project(':plugins:org.eclipse.etrice.generator.fsm') + compile project(':plugins:org.eclipse.etrice.generator.config') + compile project(':plugins:org.eclipse.etrice.generator.doc') + + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'xtend-gen'] + } + } +} + +mainClassName = 'org.eclipse.etrice.generator.cpp.Main' + +distTar.enabled = false \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.doc/build.gradle b/plugins/org.eclipse.etrice.generator.doc/build.gradle new file mode 100644 index 000000000..2a8bb7982 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.doc/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.etmap') + compile project(':plugins:org.eclipse.etrice.core.genmodel') + compile project(':plugins:org.eclipse.etrice.core.genmodel.fsm') + compile project(':plugins:org.eclipse.etrice.generator') + compile project(':plugins:org.eclipse.etrice.generator.fsm') +} + +sourceSets { + main { + java { + srcDirs = ['src', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.fsm/build.gradle b/plugins/org.eclipse.etrice.generator.fsm/build.gradle new file mode 100644 index 000000000..e5f81ea46 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.fsm/build.gradle @@ -0,0 +1,20 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.fsm') + compile project(':plugins:org.eclipse.etrice.core.genmodel.fsm') + + compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" + compile "org.eclipse.platform:org.eclipse.core.resources:$core_version" + compile "commons-io:commons-io:$commons_io_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.gnuplot/build.gradle b/plugins/org.eclipse.etrice.generator.gnuplot/build.gradle new file mode 100644 index 000000000..87790ea12 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.gnuplot/build.gradle @@ -0,0 +1,20 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') + compile project(':plugins:org.eclipse.etrice.core.genmodel') + compile project(':plugins:org.eclipse.etrice.generator') + compile project(':plugins:org.eclipse.etrice.generator.fsm') + + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.java/build.gradle b/plugins/org.eclipse.etrice.generator.java/build.gradle new file mode 100644 index 000000000..161180d1d --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.java/build.gradle @@ -0,0 +1,29 @@ +plugins { + id 'application' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.room') + compile project(':plugins:org.eclipse.etrice.core.etphys') + compile project(':plugins:org.eclipse.etrice.core.etmap') + compile project(':plugins:org.eclipse.etrice.core.fsm') + compile project(':plugins:org.eclipse.etrice.core.genmodel') + compile project(':plugins:org.eclipse.etrice.generator') + compile project(':plugins:org.eclipse.etrice.generator.fsm') + compile project(':plugins:org.eclipse.etrice.generator.config') + compile project(':plugins:org.eclipse.etrice.generator.doc') + + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'xtend-gen'] + } + } +} + +mainClassName = 'org.eclipse.etrice.generator.java.Main' + +distTar.enabled = false \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator/build.gradle b/plugins/org.eclipse.etrice.generator/build.gradle new file mode 100644 index 000000000..d34fb39e1 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator/build.gradle @@ -0,0 +1,23 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') + compile project(':plugins:org.eclipse.etrice.core.fsm') + compile project(':plugins:org.eclipse.etrice.core.genmodel') + compile project(':plugins:org.eclipse.etrice.core.room') + compile project(':plugins:org.eclipse.etrice.core.etphys') + compile project(':plugins:org.eclipse.etrice.core.etmap') + compile project(':plugins:org.eclipse.etrice.generator.fsm') + + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'xtend-gen'] + } + } +} \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 000000000..85fcdaf0f --- /dev/null +++ b/pom.xml @@ -0,0 +1,93 @@ + + + 4.0.0 + + + org.eclipse.etrice + org.eclipse.etrice.parent + 1.0.0-SNAPSHOT + releng/org.eclipse.etrice.parent + + + org.eclipse.etrice + org.eclipse.etrice + 1.0.0-SNAPSHOT + pom + + + + + plugins/org.eclipse.etrice.abstractexec.behavior + plugins/org.eclipse.etrice.core.common + plugins/org.eclipse.etrice.core.common.ui + plugins/org.eclipse.etrice.core.config + plugins/org.eclipse.etrice.core.config.ui + plugins/org.eclipse.etrice.core.etmap + plugins/org.eclipse.etrice.core.etmap.ui + plugins/org.eclipse.etrice.core.etphys + plugins/org.eclipse.etrice.core.etphys.ui + plugins/org.eclipse.etrice.core.fsm + plugins/org.eclipse.etrice.core.fsm.ui + plugins/org.eclipse.etrice.core.genmodel + plugins/org.eclipse.etrice.core.genmodel.fsm + plugins/org.eclipse.etrice.core.room + plugins/org.eclipse.etrice.core.room.ui + plugins/org.eclipse.etrice.doc + plugins/org.eclipse.etrice.etunit.converter + plugins/org.eclipse.etrice.expressions.ui + plugins/org.eclipse.etrice.generator + plugins/org.eclipse.etrice.generator.c + plugins/org.eclipse.etrice.generator.config + plugins/org.eclipse.etrice.generator.cpp + plugins/org.eclipse.etrice.generator.doc + plugins/org.eclipse.etrice.generator.fsm + plugins/org.eclipse.etrice.generator.fsmtest + plugins/org.eclipse.etrice.generator.fsmtest.ui + plugins/org.eclipse.etrice.generator.gnuplot + plugins/org.eclipse.etrice.generator.java + plugins/org.eclipse.etrice.generator.launch + plugins/org.eclipse.etrice.generator.launch.c + plugins/org.eclipse.etrice.generator.launch.cpp + plugins/org.eclipse.etrice.generator.launch.java + plugins/org.eclipse.etrice.generator.ui + plugins/org.eclipse.etrice.generator.ui.cdt + plugins/org.eclipse.etrice.logging + plugins/org.eclipse.etrice.ui.behavior + plugins/org.eclipse.etrice.ui.behavior.actioneditor + plugins/org.eclipse.etrice.ui.behavior.fsm + plugins/org.eclipse.etrice.ui.commands + plugins/org.eclipse.etrice.ui.common + plugins/org.eclipse.etrice.ui.common.base + plugins/org.eclipse.etrice.ui.runtime + plugins/org.eclipse.etrice.ui.structure + + + tests/org.eclipse.etrice.abstractexec.behavior.tests + tests/org.eclipse.etrice.core.common.tests + tests/org.eclipse.etrice.core.config.tests + tests/org.eclipse.etrice.core.etmap.tests + tests/org.eclipse.etrice.core.etphys.tests + tests/org.eclipse.etrice.core.fsm.tests + tests/org.eclipse.etrice.core.genmodel.tests + tests/org.eclipse.etrice.core.room.tests + tests/org.eclipse.etrice.etunit.converter.tests + tests/org.eclipse.etrice.generator.fsmtest.tests + tests/org.eclipse.etrice.generator.tests + tests/org.eclipse.etrice.ui.base.tests + tests/org.eclipse.etrice.ui.behavior.tests + tests/org.eclipse.etrice.ui.structure.tests + + + features/org.eclipse.etrice.cdt-integration.feature + features/org.eclipse.etrice.feature + features/org.eclipse.etrice.fsm.feature + features/org.eclipse.etrice.tests.feature + + + releng/org.eclipse.etrice.site + + + + \ No newline at end of file diff --git a/releng/org.eclipse.etrice.parent/pom.xml b/releng/org.eclipse.etrice.parent/pom.xml index a0c6d14c9..97dc48dfb 100644 --- a/releng/org.eclipse.etrice.parent/pom.xml +++ b/releng/org.eclipse.etrice.parent/pom.xml @@ -7,79 +7,6 @@ org.eclipse.etrice.parent 1.0.0-SNAPSHOT pom - - - - ../../plugins/org.eclipse.etrice.abstractexec.behavior - ../../plugins/org.eclipse.etrice.core.common - ../../plugins/org.eclipse.etrice.core.common.ui - ../../plugins/org.eclipse.etrice.core.config - ../../plugins/org.eclipse.etrice.core.config.ui - ../../plugins/org.eclipse.etrice.core.etmap - ../../plugins/org.eclipse.etrice.core.etmap.ui - ../../plugins/org.eclipse.etrice.core.etphys - ../../plugins/org.eclipse.etrice.core.etphys.ui - ../../plugins/org.eclipse.etrice.core.fsm - ../../plugins/org.eclipse.etrice.core.fsm.ui - ../../plugins/org.eclipse.etrice.core.genmodel - ../../plugins/org.eclipse.etrice.core.genmodel.fsm - ../../plugins/org.eclipse.etrice.core.room - ../../plugins/org.eclipse.etrice.core.room.ui - ../../plugins/org.eclipse.etrice.doc - ../../plugins/org.eclipse.etrice.etunit.converter - ../../plugins/org.eclipse.etrice.expressions.ui - ../../plugins/org.eclipse.etrice.generator - ../../plugins/org.eclipse.etrice.generator.c - ../../plugins/org.eclipse.etrice.generator.config - ../../plugins/org.eclipse.etrice.generator.cpp - ../../plugins/org.eclipse.etrice.generator.doc - ../../plugins/org.eclipse.etrice.generator.fsm - ../../plugins/org.eclipse.etrice.generator.fsmtest - ../../plugins/org.eclipse.etrice.generator.fsmtest.ui - ../../plugins/org.eclipse.etrice.generator.gnuplot - ../../plugins/org.eclipse.etrice.generator.java - ../../plugins/org.eclipse.etrice.generator.launch - ../../plugins/org.eclipse.etrice.generator.launch.c - ../../plugins/org.eclipse.etrice.generator.launch.cpp - ../../plugins/org.eclipse.etrice.generator.launch.java - ../../plugins/org.eclipse.etrice.generator.ui - ../../plugins/org.eclipse.etrice.generator.ui.cdt - ../../plugins/org.eclipse.etrice.logging - ../../plugins/org.eclipse.etrice.ui.behavior - ../../plugins/org.eclipse.etrice.ui.behavior.actioneditor - ../../plugins/org.eclipse.etrice.ui.behavior.fsm - ../../plugins/org.eclipse.etrice.ui.commands - ../../plugins/org.eclipse.etrice.ui.common - ../../plugins/org.eclipse.etrice.ui.common.base - ../../plugins/org.eclipse.etrice.ui.runtime - ../../plugins/org.eclipse.etrice.ui.structure - - - ../../tests/org.eclipse.etrice.abstractexec.behavior.tests - ../../tests/org.eclipse.etrice.core.common.tests - ../../tests/org.eclipse.etrice.core.config.tests - ../../tests/org.eclipse.etrice.core.etmap.tests - ../../tests/org.eclipse.etrice.core.etphys.tests - ../../tests/org.eclipse.etrice.core.fsm.tests - ../../tests/org.eclipse.etrice.core.genmodel.tests - ../../tests/org.eclipse.etrice.core.room.tests - ../../tests/org.eclipse.etrice.etunit.converter.tests - ../../tests/org.eclipse.etrice.generator.fsmtest.tests - ../../tests/org.eclipse.etrice.generator.tests - ../../tests/org.eclipse.etrice.ui.base.tests - ../../tests/org.eclipse.etrice.ui.behavior.tests - ../../tests/org.eclipse.etrice.ui.structure.tests - - - ../../features/org.eclipse.etrice.cdt-integration.feature - ../../features/org.eclipse.etrice.feature - ../../features/org.eclipse.etrice.fsm.feature - ../../features/org.eclipse.etrice.tests.feature - - - ../../releng/org.eclipse.etrice.site - - Cp1252 diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..73dda4b9d --- /dev/null +++ b/settings.gradle @@ -0,0 +1,16 @@ +include 'plugins:org.eclipse.etrice.core.common', + 'plugins:org.eclipse.etrice.core.fsm', + 'plugins:org.eclipse.etrice.core.room', + 'plugins:org.eclipse.etrice.core.config', + 'plugins:org.eclipse.etrice.core.etphys', + 'plugins:org.eclipse.etrice.core.genmodel.fsm', + 'plugins:org.eclipse.etrice.core.genmodel', + 'plugins:org.eclipse.etrice.core.etmap', + 'plugins:org.eclipse.etrice.generator.fsm', + 'plugins:org.eclipse.etrice.generator', + 'plugins:org.eclipse.etrice.generator.config', + 'plugins:org.eclipse.etrice.generator.doc', + 'plugins:org.eclipse.etrice.generator.gnuplot', + 'plugins:org.eclipse.etrice.generator.c', + 'plugins:org.eclipse.etrice.generator.cpp', + 'plugins:org.eclipse.etrice.generator.java' \ No newline at end of file -- cgit v1.2.3 From 9e42fbde145d3de9dabbb4ee88d100ce6d5efcb7 Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Tue, 12 Sep 2017 13:52:53 +0200 Subject: [generator.common.tests] gradle build for common generator tests --- gradle.properties | 1 + .../build.gradle | 21 +++++ .../org.eclipse.etrice.core.common/build.gradle | 4 + .../org.eclipse.etrice.core.config/build.gradle | 4 + plugins/org.eclipse.etrice.core.etmap/build.gradle | 4 + .../org.eclipse.etrice.core.etphys/build.gradle | 4 + plugins/org.eclipse.etrice.core.fsm/build.gradle | 4 + .../eTrice-rt.launch | 3 + plugins/org.eclipse.etrice.core.room/build.gradle | 5 ++ .../build.gradle | 24 ++++++ .../org.eclipse.etrice.generator.c/build.gradle | 2 + .../org.eclipse.etrice.generator.cpp/build.gradle | 2 + .../org.eclipse.etrice.generator.java/build.gradle | 2 + runtime/org.eclipse.etrice.modellib.c/build.gradle | 40 +++++++++ .../org.eclipse.etrice.modellib.cpp/build.gradle | 39 +++++++++ .../org.eclipse.etrice.modellib.java/build.gradle | 32 +++++++ runtime/org.eclipse.etrice.runtime.c/build.gradle | 23 +++++ .../org.eclipse.etrice.runtime.cpp/build.gradle | 24 ++++++ .../org.eclipse.etrice.runtime.java/build.gradle | 11 +++ .../java/modelbase/RTSystemServicesProtocol.java | 75 +++++++++++------ settings.gradle | 15 +++- .../build.gradle | 34 ++++++++ .../log/c/log/testlog/readme.txt | 0 .../log/cpp/log/testlog/readme.txt | 0 .../log/java/log/testlog/readme.txt | 0 .../models/ActorCommunicationTest.room | 6 +- .../models/ChoicePointTest.room | 10 ++- .../models/ChoicePointTestExtended.room | 6 +- .../models/CompileTests.room | 12 ++- .../models/ContinuationTransitionTest.room | 4 +- .../models/DataDrivenTest.room | 8 +- .../models/DetailExpressionTest.room | 6 +- .../models/EnumTest.room | 10 ++- .../models/GenericPhysical.etphys | 43 ++++++++++ .../models/HandlerTest.room | 9 +- .../models/OperationInheritanceTest.room | 9 +- .../models/PingPongThread.etphys | 2 +- .../models/PingPongThreadReplPortTest.etmap | 2 +- .../models/PingPongThreadReplPortTest.room | 6 +- .../models/PingPongThreadTest.etmap | 2 +- .../models/PingPongThreadTest.room | 6 +- .../models/StatemachineInterfaceInheritedTest.room | 2 +- .../models/StatemachineInterfaceTest.room | 2 +- .../models/sendingData/SendingDataTestC.room | 6 +- .../models/sendingData/SendingDataTestCpp.room | 6 +- .../models/sendingData/SendingDataTestJava.room | 6 +- .../test.gradle | 98 ++++++++++++++++++++++ .../build.gradle | 32 +++++++ 48 files changed, 588 insertions(+), 78 deletions(-) create mode 100644 plugins/org.eclipse.etrice.abstractexec.behavior/build.gradle create mode 100644 plugins/org.eclipse.etrice.etunit.converter/build.gradle create mode 100644 runtime/org.eclipse.etrice.modellib.c/build.gradle create mode 100644 runtime/org.eclipse.etrice.modellib.cpp/build.gradle create mode 100644 runtime/org.eclipse.etrice.modellib.java/build.gradle create mode 100644 runtime/org.eclipse.etrice.runtime.c/build.gradle create mode 100644 runtime/org.eclipse.etrice.runtime.cpp/build.gradle create mode 100644 runtime/org.eclipse.etrice.runtime.java/build.gradle create mode 100644 tests/org.eclipse.etrice.generator.common.tests/build.gradle create mode 100644 tests/org.eclipse.etrice.generator.common.tests/log/c/log/testlog/readme.txt create mode 100644 tests/org.eclipse.etrice.generator.common.tests/log/cpp/log/testlog/readme.txt create mode 100644 tests/org.eclipse.etrice.generator.common.tests/log/java/log/testlog/readme.txt create mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys create mode 100644 tests/org.eclipse.etrice.generator.common.tests/test.gradle create mode 100644 tests/org.eclipse.etrice.generator.java.tests/build.gradle diff --git a/gradle.properties b/gradle.properties index ff4df7d85..640d2835c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ xtext_version = + +emf_version = + core_version = + commons_io_version = + \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/build.gradle b/plugins/org.eclipse.etrice.abstractexec.behavior/build.gradle new file mode 100644 index 000000000..6309d3367 --- /dev/null +++ b/plugins/org.eclipse.etrice.abstractexec.behavior/build.gradle @@ -0,0 +1,21 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') + compile project(':plugins:org.eclipse.etrice.core.fsm') + compile project(':plugins:org.eclipse.etrice.core.genmodel.fsm') + compile project(':plugins:org.eclipse.etrice.generator.fsm') + + compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src'] + } + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.common/build.gradle b/plugins/org.eclipse.etrice.core.common/build.gradle index dc3aad1be..d4a3f77d9 100644 --- a/plugins/org.eclipse.etrice.core.common/build.gradle +++ b/plugins/org.eclipse.etrice.core.common/build.gradle @@ -13,5 +13,9 @@ sourceSets { java { srcDirs = ['src', 'src-gen', 'xtend-gen'] } + resources { + srcDirs = ['src', 'src-gen'] + include '**/*.xtextbin', '**/*.tokens' + } } } \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.config/build.gradle b/plugins/org.eclipse.etrice.core.config/build.gradle index e5d4bb91c..4e10d0c3b 100644 --- a/plugins/org.eclipse.etrice.core.config/build.gradle +++ b/plugins/org.eclipse.etrice.core.config/build.gradle @@ -12,5 +12,9 @@ sourceSets { java { srcDirs = ['src', 'src-gen', 'xtend-gen'] } + resources { + srcDirs = ['src', 'src-gen'] + include '**/*.xtextbin', '**/*.tokens' + } } } \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.etmap/build.gradle b/plugins/org.eclipse.etrice.core.etmap/build.gradle index 751a74cfa..a49fa9a8b 100644 --- a/plugins/org.eclipse.etrice.core.etmap/build.gradle +++ b/plugins/org.eclipse.etrice.core.etmap/build.gradle @@ -16,5 +16,9 @@ sourceSets { java { srcDirs = ['src', 'src-gen', 'xtend-gen'] } + resources { + srcDirs = ['src', 'src-gen'] + include '**/*.xtextbin', '**/*.tokens' + } } } \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.etphys/build.gradle b/plugins/org.eclipse.etrice.core.etphys/build.gradle index 857cc5786..0044dee50 100644 --- a/plugins/org.eclipse.etrice.core.etphys/build.gradle +++ b/plugins/org.eclipse.etrice.core.etphys/build.gradle @@ -11,5 +11,9 @@ sourceSets { java { srcDirs = ['src', 'src-gen', 'xtend-gen'] } + resources { + srcDirs = ['src', 'src-gen'] + include '**/*.xtextbin', '**/*.tokens' + } } } \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.fsm/build.gradle b/plugins/org.eclipse.etrice.core.fsm/build.gradle index bacf55a18..1d29137fe 100644 --- a/plugins/org.eclipse.etrice.core.fsm/build.gradle +++ b/plugins/org.eclipse.etrice.core.fsm/build.gradle @@ -13,5 +13,9 @@ sourceSets { java { srcDirs = ['src', 'src-gen', 'xtend-gen'] } + resources { + srcDirs = ['src', 'src-gen'] + include '**/*.xtextbin', '**/*.tokens' + } } } \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.room.ui/eTrice-rt.launch b/plugins/org.eclipse.etrice.core.room.ui/eTrice-rt.launch index 63704533c..98fc0beb4 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/eTrice-rt.launch +++ b/plugins/org.eclipse.etrice.core.room.ui/eTrice-rt.launch @@ -14,6 +14,9 @@ + + + diff --git a/plugins/org.eclipse.etrice.core.room/build.gradle b/plugins/org.eclipse.etrice.core.room/build.gradle index 92072c02b..bead8b39c 100644 --- a/plugins/org.eclipse.etrice.core.room/build.gradle +++ b/plugins/org.eclipse.etrice.core.room/build.gradle @@ -5,6 +5,7 @@ plugins { dependencies { compile project(':plugins:org.eclipse.etrice.core.common') compile project(':plugins:org.eclipse.etrice.core.fsm') + runtime project(':plugins:org.eclipse.etrice.abstractexec.behavior') compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" @@ -15,5 +16,9 @@ sourceSets { java { srcDirs = ['src', 'src-gen', 'xtend-gen'] } + resources { + srcDirs = ['src', 'src-gen'] + include '**/*.xtextbin', '**/*.tokens' + } } } \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.etunit.converter/build.gradle b/plugins/org.eclipse.etrice.etunit.converter/build.gradle new file mode 100644 index 000000000..0309c7d3e --- /dev/null +++ b/plugins/org.eclipse.etrice.etunit.converter/build.gradle @@ -0,0 +1,24 @@ +plugins { + id 'application' +} + +dependencies { + compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" + compile "org.eclipse.emf:org.eclipse.emf.common:$emf_version" + compile "org.eclipse.emf:org.eclipse.emf.ecore:$emf_version" + compile "org.eclipse.emf:org.eclipse.emf.ecore.xmi:$emf_version" +} + +sourceSets { + main { + java { + srcDirs = ['src'] + } + } +} + +ext.classpath = sourceSets.main.runtimeClasspath + +mainClassName = 'org.eclipse.etrice.etunit.converter.EtUnitReportConverter' + +distTar.enabled = false \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.c/build.gradle b/plugins/org.eclipse.etrice.generator.c/build.gradle index c25ee5832..77476ec8d 100644 --- a/plugins/org.eclipse.etrice.generator.c/build.gradle +++ b/plugins/org.eclipse.etrice.generator.c/build.gradle @@ -25,6 +25,8 @@ sourceSets { } } +ext.classpath = sourceSets.main.runtimeClasspath + mainClassName = 'org.eclipse.etrice.generator.c.Main' distTar.enabled = false \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.cpp/build.gradle b/plugins/org.eclipse.etrice.generator.cpp/build.gradle index e3c8f948f..01a614f7a 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/build.gradle +++ b/plugins/org.eclipse.etrice.generator.cpp/build.gradle @@ -24,6 +24,8 @@ sourceSets { } } +ext.classpath = sourceSets.main.runtimeClasspath + mainClassName = 'org.eclipse.etrice.generator.cpp.Main' distTar.enabled = false \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.java/build.gradle b/plugins/org.eclipse.etrice.generator.java/build.gradle index 161180d1d..ab1d86cba 100644 --- a/plugins/org.eclipse.etrice.generator.java/build.gradle +++ b/plugins/org.eclipse.etrice.generator.java/build.gradle @@ -24,6 +24,8 @@ sourceSets { } } +ext.classpath = sourceSets.main.runtimeClasspath + mainClassName = 'org.eclipse.etrice.generator.java.Main' distTar.enabled = false \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.c/build.gradle b/runtime/org.eclipse.etrice.modellib.c/build.gradle new file mode 100644 index 000000000..23ad8e2b0 --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.c/build.gradle @@ -0,0 +1,40 @@ +plugins { + id 'c' +} + +def generator = ':plugins:org.eclipse.etrice.generator.c' + +task generate(type: JavaExec, group: 'build', dependsOn: "$generator:classes") { + main = project(generator).mainClassName + classpath = project(generator).classpath + inputs.dir 'model' + outputs.dir 'src-gen' + args '-lib', '-msc_instr', '-genDir', 'src-gen', + 'model/PInterrupt.room', + 'model/TcpService.room', + 'model/TimingService.room' +} + +model { + components { + etrice_modellib_c(NativeLibrarySpec) { + sources.c { + builtBy generate + source { + srcDirs = ['src-gen'] + include '**/*.c' + } + exportedHeaders { + srcDirs = ['src-gen'] + } + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'api' + } + binaries { + withType(SharedLibraryBinarySpec) { buildable = false } + all { cCompiler.args '-g3' } + } + } + } +} + +clean.delete 'src-gen' \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle new file mode 100644 index 000000000..3299defba --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle @@ -0,0 +1,39 @@ +plugins { + id 'cpp' +} + +def generator = ':plugins:org.eclipse.etrice.generator.cpp' + +task generate(type: JavaExec, group: 'build', dependsOn: "$generator:classes") { + main = project(generator).mainClassName + classpath = project(generator).classpath + inputs.dir 'model' + outputs.dir 'src-gen' + args '-lib', '-msc_instr', '-genDir', 'src-gen', + 'model/TimingService.room' +} + +model { + components { + etrice_modellib_cpp(NativeLibrarySpec) { + sources.cpp { + builtBy generate + source { + srcDirs = ['src-gen'] + include '**/*.cpp' + } + exportedHeaders { + srcDirs = ['src-gen'] + } + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'api' + lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'api' + } + binaries { + withType(SharedLibraryBinarySpec) { buildable = false } + all { cppCompiler.args '-g3' } + } + } + } +} + +clean.delete 'src-gen' \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.java/build.gradle b/runtime/org.eclipse.etrice.modellib.java/build.gradle new file mode 100644 index 000000000..f27641e6f --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.java/build.gradle @@ -0,0 +1,32 @@ +plugins { + id 'java' +} + +def generator = ':plugins:org.eclipse.etrice.generator.java' + +task generate(type: JavaExec, group: 'build', dependsOn: "$generator:classes") { + main = project(generator).mainClassName + classpath = project(generator).classpath + inputs.dir 'model' + outputs.dir 'src-gen' + args '-lib', '-msc_instr', '-genDir', 'src-gen', + 'model/ALogService.room', + 'model/TcpService.room', + 'model/TimingService.room' +} + +dependencies { + compile project(':runtime:org.eclipse.etrice.runtime.java') +} + +sourceSets { + main { + java { + srcDirs = ['src-gen'] + } + } +} + +compileJava.dependsOn generate + +clean.delete 'src-gen' \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.runtime.c/build.gradle b/runtime/org.eclipse.etrice.runtime.c/build.gradle new file mode 100644 index 000000000..ce88e15c8 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.c/build.gradle @@ -0,0 +1,23 @@ +plugins { + id 'c' +} + +model { + components { + etrice_runtime_c(NativeLibrarySpec) { + sources.c { + source { + srcDirs = ['src/common', 'src/config', 'src/platforms/MT_WIN_MinGW', 'src/util'] + include '**/*.c' + } + exportedHeaders { + srcDirs = ['src/common', 'src/config', 'src/platforms/MT_WIN_MinGW', 'src/util'] + } + } + binaries { + withType(SharedLibraryBinarySpec) { buildable = false } + all { cCompiler.args '-g3' } + } + } + } +} \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.runtime.cpp/build.gradle b/runtime/org.eclipse.etrice.runtime.cpp/build.gradle new file mode 100644 index 000000000..63e95beac --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/build.gradle @@ -0,0 +1,24 @@ +plugins { + id 'cpp' +} + +model { + components { + etrice_runtime_cpp(NativeLibrarySpec) { + sources.cpp { + source { + srcDirs = ['src', 'src-gen'] + include '**/*.cpp' + } + exportedHeaders { + srcDirs = ['src', 'src-gen'] + } + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'api' + } + binaries { + withType(SharedLibraryBinarySpec) { buildable = false } + all { cppCompiler.args '-g3' } + } + } + } +} \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.runtime.java/build.gradle b/runtime/org.eclipse.etrice.runtime.java/build.gradle new file mode 100644 index 000000000..a38c8a95f --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.java/build.gradle @@ -0,0 +1,11 @@ +plugins { + id 'java' +} + +sourceSets { + main { + java { + srcDirs = ['src', 'src-gen'] + } + } +} \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.runtime.java/src-gen/org/eclipse/etrice/runtime/java/modelbase/RTSystemServicesProtocol.java b/runtime/org.eclipse.etrice.runtime.java/src-gen/org/eclipse/etrice/runtime/java/modelbase/RTSystemServicesProtocol.java index 113008b8b..aee9ab308 100644 --- a/runtime/org.eclipse.etrice.runtime.java/src-gen/org/eclipse/etrice/runtime/java/modelbase/RTSystemServicesProtocol.java +++ b/runtime/org.eclipse.etrice.runtime.java/src-gen/org/eclipse/etrice/runtime/java/modelbase/RTSystemServicesProtocol.java @@ -1,6 +1,14 @@ package org.eclipse.etrice.runtime.java.modelbase; import org.eclipse.etrice.runtime.java.messaging.Message; +import org.eclipse.etrice.runtime.java.modelbase.EventMessage; +import org.eclipse.etrice.runtime.java.modelbase.EventWithDataMessage; +import org.eclipse.etrice.runtime.java.modelbase.IInterfaceItemOwner; +import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase; +import org.eclipse.etrice.runtime.java.modelbase.PortBase; +import org.eclipse.etrice.runtime.java.modelbase.ReplicatedPortBase; +import org.eclipse.etrice.runtime.java.debugging.DebuggingService; +import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*; @@ -34,6 +42,12 @@ public class RTSystemServicesProtocol { } public RTSystemServicesProtocolPort(IInterfaceItemOwner actor, String name, int localId, int idx) { super(actor, name, localId, idx); + DebuggingService.getInstance().addPortInstance(this); + } + + public void destroy() { + DebuggingService.getInstance().removePortInstance(this); + super.destroy(); } @Override @@ -42,14 +56,15 @@ public class RTSystemServicesProtocol { return; EventMessage msg = (EventMessage) m; if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) { - if (msg instanceof EventWithDataMessage) - getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData()); - else - getActor().receiveEvent(this, msg.getEvtId(), null); + DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]); + if (msg instanceof EventWithDataMessage) + getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData()); + else + getActor().receiveEvent(this, msg.getEvtId(), null); } } - + // sent messages } @@ -59,23 +74,23 @@ public class RTSystemServicesProtocol { public RTSystemServicesProtocolReplPort(IInterfaceItemOwner actor, String name, int localId) { super(actor, name, localId); } - + public int getReplication() { return getNInterfaceItems(); } - + public int getIndexOf(InterfaceItemBase ifitem){ return ifitem.getIdx(); - } - + } + public RTSystemServicesProtocolPort get(int idx) { return (RTSystemServicesProtocolPort) getInterfaceItem(idx); } - + protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) { return new RTSystemServicesProtocolPort(rcv, name, lid, idx); } - + // outgoing messages } @@ -88,6 +103,12 @@ public class RTSystemServicesProtocol { } public RTSystemServicesProtocolConjPort(IInterfaceItemOwner actor, String name, int localId, int idx) { super(actor, name, localId, idx); + DebuggingService.getInstance().addPortInstance(this); + } + + public void destroy() { + DebuggingService.getInstance().removePortInstance(this); + super.destroy(); } @Override @@ -96,27 +117,31 @@ public class RTSystemServicesProtocol { return; EventMessage msg = (EventMessage) m; if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) { - if (msg instanceof EventWithDataMessage) - getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData()); - else - getActor().receiveEvent(this, msg.getEvtId(), null); + DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]); + if (msg instanceof EventWithDataMessage) + getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData()); + else + getActor().receiveEvent(this, msg.getEvtId(), null); } } - + // sent messages public void executeInitialTransition() { + DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_executeInitialTransition]); if (getPeerAddress()!=null) getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), IN_executeInitialTransition)); - } + } public void startDebugging() { + DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_startDebugging]); if (getPeerAddress()!=null) getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), IN_startDebugging)); - } + } public void stopDebugging() { + DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_stopDebugging]); if (getPeerAddress()!=null) getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), IN_stopDebugging)); - } + } } // replicated port class @@ -125,23 +150,23 @@ public class RTSystemServicesProtocol { public RTSystemServicesProtocolConjReplPort(IInterfaceItemOwner actor, String name, int localId) { super(actor, name, localId); } - + public int getReplication() { return getNInterfaceItems(); } - + public int getIndexOf(InterfaceItemBase ifitem){ return ifitem.getIdx(); - } - + } + public RTSystemServicesProtocolConjPort get(int idx) { return (RTSystemServicesProtocolConjPort) getInterfaceItem(idx); } - + protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) { return new RTSystemServicesProtocolConjPort(rcv, name, lid, idx); } - + // incoming messages public void executeInitialTransition(){ for (InterfaceItemBase item : getItems()) { diff --git a/settings.gradle b/settings.gradle index 73dda4b9d..58f8783fc 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -include 'plugins:org.eclipse.etrice.core.common', +include 'plugins:org.eclipse.etrice.core.common', 'plugins:org.eclipse.etrice.core.fsm', 'plugins:org.eclipse.etrice.core.room', 'plugins:org.eclipse.etrice.core.config', @@ -13,4 +13,15 @@ include 'plugins:org.eclipse.etrice.core.common', 'plugins:org.eclipse.etrice.generator.gnuplot', 'plugins:org.eclipse.etrice.generator.c', 'plugins:org.eclipse.etrice.generator.cpp', - 'plugins:org.eclipse.etrice.generator.java' \ No newline at end of file + 'plugins:org.eclipse.etrice.generator.java', + 'plugins:org.eclipse.etrice.abstractexec.behavior', + 'plugins:org.eclipse.etrice.etunit.converter', + + 'runtime:org.eclipse.etrice.modellib.c', + 'runtime:org.eclipse.etrice.modellib.cpp', + 'runtime:org.eclipse.etrice.modellib.java', + 'runtime:org.eclipse.etrice.runtime.c', + 'runtime:org.eclipse.etrice.runtime.cpp', + 'runtime:org.eclipse.etrice.runtime.java', + + 'tests:org.eclipse.etrice.generator.common.tests' \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/build.gradle b/tests/org.eclipse.etrice.generator.common.tests/build.gradle new file mode 100644 index 000000000..7da84045e --- /dev/null +++ b/tests/org.eclipse.etrice.generator.common.tests/build.gradle @@ -0,0 +1,34 @@ +plugins { + id 'c' + id 'cpp' + id 'java-base' +} + +apply from: "test.gradle" + +def genericPhysical = 'models/GenericPhysical.etphys' + +def tests = [ + actorCommunicationTest: ['models/ActorCommunicationTest.room', genericPhysical], + choicePointTest: ['models/ChoicePointTest.room', genericPhysical], + choicePointTestExtended: ['models/ChoicePointTestExtended.room', genericPhysical], + dataDrivenTest: ['models/DataDrivenTest.room', genericPhysical], + //enumTest: ['models/EnumTest.room', genericPhysical], + compileTests: ['models/CompileTests.room', genericPhysical, 'models/DetailExpressionTest.room', 'models/StatemachineInterfaceTest.room', 'models/StatemachineInterfaceInheritedTest.room', 'models/StatemachineInterfaceTest.room', 'models/ContinuationTransitionTest.room'], + handlerTest: ['models/HandlerTest.room', genericPhysical], + operationInheritanceTest: ['models/OperationInheritanceTest.room', genericPhysical], + pingPongThreadTest: ['models/PingPongThreadTest.etmap', 'models/PingPongThreadTest.room'], + pingPongThreadReplPortTest: ['models/PingPongThreadReplPortTest.etmap', 'models/PingPongThreadReplPortTest.room'] +] + +tests.each { key, value -> + def testTasks = [ + addTest('c', key, value), + addTest('cpp', key, value), + addTest('java', key, value) + ] + + tasks.create(name: key, dependsOn: testTasks, group: 'verification') +} + +clean.delete 'src-gen', fileTree('log') { exclude '**/readme.txt' } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/log/c/log/testlog/readme.txt b/tests/org.eclipse.etrice.generator.common.tests/log/c/log/testlog/readme.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/org.eclipse.etrice.generator.common.tests/log/cpp/log/testlog/readme.txt b/tests/org.eclipse.etrice.generator.common.tests/log/cpp/log/testlog/readme.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/org.eclipse.etrice.generator.common.tests/log/java/log/testlog/readme.txt b/tests/org.eclipse.etrice.generator.common.tests/log/java/log/testlog/readme.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room index ff81f30e0..263c1b7e2 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room @@ -1,8 +1,8 @@ RoomModel ActorCommunicationTest { - import room.basic.types.* from "Types.room" - import room.basic.test.* from "Tests.room" - import room.basic.service.timing.* from "TimingService.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" + import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" SubSystemClass SubSystem_ActorCommunicationTest { @TestInstance diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room index 3274047fe..9c0ac4794 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room @@ -1,10 +1,14 @@ RoomModel ChoicePointTest { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - ActorClass CPTest_Top { + SubSystemClass SubSystem_ChoicePointTest { @TestInstance + ActorRef cptest_top : CPTest_Top + } + + ActorClass CPTest_Top { Structure { ActorRef cp_tester: CPTester ActorRef cp_user: CPUser diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room index fd23b8bde..d24f6030d 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room @@ -1,9 +1,9 @@ RoomModel ChoicePointTestExtended { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - SubSystemClass SubSystem_CPTestExtended { + SubSystemClass SubSystem_ChoicePointTestExtended { @TestInstance ActorRef tester_event: Tester_event } diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room index fe6547c4c..83befe64b 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room @@ -1,14 +1,18 @@ -RoomModel CompileTestsModel { +RoomModel CompileTests { - import room.basic.types.* from "Types.room" - import room.basic.test.* from "Tests.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" import DetailExpressionTestModel.DetailExpressionTest from "DetailExpressionTest.room" import StatemachineInterfaceTestModel.StatemachineInterfaceTest from "StatemachineInterfaceTest.room" import StatemachineInterfaceTestInheritedModel.StatemachineInterfaceInheritedTest from "StatemachineInterfaceInheritedTest.room" import ContinuationTransitionTest.ContinuationTransitionTest from "ContinuationTransitionTest.room" - ActorClass CompileTests { + SubSystemClass SubSystem_CompileTests { @TestInstance + ActorRef compileTests : CompileTests + } + + ActorClass CompileTests { Structure { Attribute caseId : int32 diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ContinuationTransitionTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ContinuationTransitionTest.room index b5d4c79e5..e17ab03dd 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ContinuationTransitionTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ContinuationTransitionTest.room @@ -1,7 +1,7 @@ RoomModel ContinuationTransitionTest { - import room.basic.types.* from "Types.room" - import room.basic.test.* from "Tests.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" ActorClass ContinuationTransitionTest { Structure { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room index 2cd9b1aba..4d3698ac2 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room @@ -1,10 +1,10 @@ RoomModel DataDrivenTest { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" - import room.basic.service.timing.* from "TimingService.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" + import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" - SubSystemClass SubSystem_DataDriven { + SubSystemClass SubSystem_DataDrivenTest { @TestInstance ActorRef appl: Appl ActorRef timing: ATimingService diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room index ad1887cd4..a3297bce9 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room @@ -1,8 +1,8 @@ RoomModel DetailExpressionTestModel { - import room.basic.types.* from "Types.room" - import room.basic.test.* from "Tests.room" - import room.basic.service.timing.* from "TimingService.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" + import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" async ActorClass DetailExpressionTest { Interface { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room index f8d9f6b22..80eaf7d66 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room @@ -1,10 +1,14 @@ RoomModel EnumTest { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - ActorClass EnumTest_Top { + SubSystemClass SubSystem_EnumTest { @TestInstance + ActorRef enumTest_top : EnumTest_Top + } + + ActorClass EnumTest_Top { Structure { ActorRef user: EnumUser } diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys b/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys new file mode 100644 index 000000000..9e9a2cc3f --- /dev/null +++ b/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys @@ -0,0 +1,43 @@ +PhysicalModel room.generic.physical { + + PhysicalSystem GenericPhysicalSystem { + NodeRef node : GenericNodeClass + } + + NodeClass GenericNodeClass { + runtime = DefaultRuntimeClass + priomin = 1 + priomax = 10 + + DefaultThread DefaultPhysicalThread { + execmode = mixed + interval = 100ms + prio = 5 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread BlockedThread { + execmode = blocked + prio = 5 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread PolledThread { + execmode = polled + interval = 100ms + prio = 5 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + } + + RuntimeClass DefaultRuntimeClass { + model = multiThreaded + } + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room index 3c4601bcd..8276547dd 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room @@ -1,11 +1,14 @@ RoomModel HandlerTest { - import room.basic.types.* from "Types.room" - import room.basic.test.* from "Tests.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" + SubSystemClass SubSystem_HandlerTest { + @TestInstance + ActorRef handlerTest_top : HandlerTest_Top + } ActorClass HandlerTest_Top { - @TestInstance Structure { ActorRef tester: Tester ActorRef handlerUser: HandlerUser diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room index d59508a84..face41b4c 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room @@ -1,11 +1,14 @@ RoomModel OperationInheritanceTest { - import room.basic.types.* from "Types.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - import room.basic.test.* from "Tests.room" + SubSystemClass SubSystem_OperationInheritanceTest { + @TestInstance + ActorRef top_test : OperationInheritanceTest + } async ActorClass OperationInheritanceTest extends BaseActor { - @TestInstance Structure { Attribute testDataClass: SubDataClass } diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys index 1215b84c6..aaf01df01 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys @@ -1,7 +1,7 @@ PhysicalModel PingPongThread { PhysicalSystem Sys { - NodeRef node1: PC + NodeRef node: PC } NodeClass PC { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap index 9b8d078af..0ea6ddfab 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap @@ -4,7 +4,7 @@ MappingModel PingPongThreadReplPortTest { import PingPongThread.* from "PingPongThread.etphys" Mapping System_PingPongReplPort -> Sys { - SubSystemMapping main -> node1 { + SubSystemMapping ref_SubSystem_PingPongThreadReplPortTest -> node { ThreadMapping mrPingThread -> DfltThread ThreadMapping mrPong1Thread -> Thread1 ThreadMapping mrPong2Thread -> Thread2 diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room index 856ba8855..4fe552769 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room @@ -1,10 +1,10 @@ RoomModel PingPongThreadReplPortTest { - import room.basic.service.timing.* from "TimingService.room" - import room.basic.types.* from "Types.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" LogicalSystem System_PingPongReplPort{ - SubSystemRef main : SubSystem_PingPongReplPort + SubSystemRef ref_SubSystem_PingPongThreadReplPortTest : SubSystem_PingPongReplPort } SubSystemClass SubSystem_PingPongReplPort { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap index 4aa1aaaeb..caaf06032 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap @@ -5,7 +5,7 @@ MappingModel PingPongThreadTest { import PingPongThread.* from "PingPongThread.etphys" Mapping System_PingPong -> Sys { - SubSystemMapping main -> node1 { + SubSystemMapping ref_SubSystem_PingPongThreadTest -> node { ThreadMapping mrPingThread -> DfltThread ThreadMapping mrPong1Thread -> Thread1 ThreadMapping mrPong2Thread -> Thread2 diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room index 68ba1634d..cf3f23e65 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room @@ -1,10 +1,10 @@ RoomModel PingPongThreadTest { - import room.basic.service.timing.* from "TimingService.room" - import room.basic.types.* from "Types.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" LogicalSystem System_PingPong{ - SubSystemRef main : SubSystem_PingPong + SubSystemRef ref_SubSystem_PingPongThreadTest : SubSystem_PingPong } SubSystemClass SubSystem_PingPong { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceInheritedTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceInheritedTest.room index a32d0f09a..4a23a2d4c 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceInheritedTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceInheritedTest.room @@ -1,6 +1,6 @@ RoomModel StatemachineInterfaceTestInheritedModel { - import room.basic.types.* from "Types.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import StatemachineInterfaceTestModel.* from "StatemachineInterfaceTest.room" ActorClass StatemachineInterfaceInheritedTest { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceTest.room index 962ecaacf..c1e2e0b0f 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceTest.room @@ -1,6 +1,6 @@ RoomModel StatemachineInterfaceTestModel { - import room.basic.types.* from "Types.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" ActorClass StatemachineInterfaceTest { Structure { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room index a44f54c1d..9c4691ee5 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room @@ -1,8 +1,8 @@ RoomModel SendingDataTestC { - import room.basic.test.* from "../Tests.room" - import room.basic.types.* from "../Types.room" - import room.basic.language.* from "../Language.room" + import room.basic.test.* from "../../../../runtime/org.eclipse.etrice.modellib.c/model/Tests.room" + import room.basic.types.* from "../../../../runtime/org.eclipse.etrice.modellib.c/model/Types.room" + import room.basic.language.* from "../../../../runtime/org.eclipse.etrice.modellib.c/model/Language.room" ActorClass SendingDataTop { @TestInstance diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room index a7e4a9a12..6094b11d8 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room @@ -1,8 +1,8 @@ RoomModel SendingDataTestCpp { - import room.basic.test.* from "../Tests.room" - import room.basic.types.* from "../Types.room" - import room.basic.language.* from "../Language.room" + import room.basic.test.* from "../../../../runtime/org.eclipse.etrice.modellib.cpp/model/Tests.room" + import room.basic.types.* from "../../../../runtime/org.eclipse.etrice.modellib.cpp/model/Types.room" + import room.basic.language.* from "../../../../runtime/org.eclipse.etrice.modellib.cpp/model/Language.room" ActorClass SendingDataTop { @TestInstance diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room index aafe3bb69..007b3242c 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room @@ -1,8 +1,8 @@ RoomModel SendingDataTestJava { - import room.basic.test.* from "../Tests.room" - import room.basic.types.* from "../Types.room" - import room.basic.language.* from "../Language.room" + import room.basic.test.* from "../../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + import room.basic.types.* from "../../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + import room.basic.language.* from "../../../../runtime/org.eclipse.etrice.modellib.java/model/Language.room" ActorClass SendingDataTop { @TestInstance diff --git a/tests/org.eclipse.etrice.generator.common.tests/test.gradle b/tests/org.eclipse.etrice.generator.common.tests/test.gradle new file mode 100644 index 000000000..e585a73a2 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.common.tests/test.gradle @@ -0,0 +1,98 @@ + +ext.addTest = { lang, name, genArgs -> + def nameCap = name.capitalize() + def langCap = lang.capitalize() + def testName = "$name$langCap" + def testNameCap = testName.capitalize() + def genDir = "src-gen/$lang/$name" + def logDir = "log/$lang" + def exeFile = "$buildDir/exe/$testName/$testName" + def mainClass = "${nameCap}.Node_node_ref_SubSystem_${nameCap}Runner" + def etuFile = "$logDir/log/testlog/${nameCap}.etu" + def xmlFile = "$logDir/log/testlog/${nameCap}.xml" + def modellib = ":runtime:org.eclipse.etrice.modellib.$lang" + def generator = ":plugins:org.eclipse.etrice.generator.$lang" + def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' + + def generateTask = tasks.create(name: "generate$testNameCap", type: JavaExec) { + dependsOn "$generator:classes" + main = project(generator).mainClassName + classpath = project(generator).classpath + args '-msc_instr', '-genDir', genDir + args genArgs + environment 'etModellib', "org.eclipse.etrice.modellib.$lang" + inputs.files genArgs + outputs.dir genDir + } + + def runTask + + if(lang == 'c' || lang == 'cpp') { + model { + components { + "$testName"(NativeExecutableSpec) { + sources."$lang" { + builtBy generateTask + source { + srcDirs = [genDir] + include "**/*.$lang" + } + exportedHeaders { + srcDirs = [genDir] + } + lib project: ":runtime:org.eclipse.etrice.modellib.$lang", library: "etrice_modellib_$lang", linkage: 'static' + if(lang == 'cpp') lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' + } + binaries.all { + cCompiler.args '-g3' + cppCompiler.args '-g3' + } + } + } + } + + runTask = tasks.create(name: "run$testNameCap", type: Exec) { + dependsOn "${testName}Executable" + commandLine exeFile, '-run_as_test' + inputs.file exeFile + outputs.file etuFile + workingDir = logDir + } + } + + else if(lang == 'java') { + def testSourceSet = sourceSets.create(name) { + java.srcDirs = [genDir] + } + + dependencies { + add "${name}Compile", project(':runtime:org.eclipse.etrice.modellib.java') + add "${name}Compile", project(':runtime:org.eclipse.etrice.runtime.java') + } + + tasks.getByName("compile${nameCap}Java").dependsOn generateTask + + runTask = tasks.create(name: "run$testName", type: JavaExec) { + dependsOn "${name}Classes" + main = mainClass + classpath = testSourceSet.runtimeClasspath + args '-run_as_test' + outputs.file etuFile + workingDir = logDir + } + } + + def convertTask = tasks.create(name: "convert$testNameCap", type: JavaExec) { + dependsOn runTask, "$etUnitConverter:classes" + main = project(etUnitConverter).mainClassName + classpath = project(etUnitConverter).classpath + args etuFile + inputs.file etuFile + outputs.file xmlFile + } + + def testTask = tasks.create(name: testName, dependsOn: convertTask, group: 'verification') + check.dependsOn testTask + return testTask +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/build.gradle b/tests/org.eclipse.etrice.generator.java.tests/build.gradle new file mode 100644 index 000000000..6e4f72074 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/build.gradle @@ -0,0 +1,32 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':runtime:org.eclipse.etrice.runtime.java') + compile project(':runtime:org.eclipse.etrice.modellib.java') +} + +sourceSets { + main { + java { + srcDirs = ['src', 'src-gen'] + } + } +} + +/*def createTestTasks(name, models, options) { + +}*/ + +task gen(type: JavaExec, dependsOn: ':plugins:org.eclipse.etrice.generator.java:classes') { + main = 'org.eclipse.etrice.generator.java.Main' + classpath = project(':plugins:org.eclipse.etrice.generator.java').sourceSets.main.runtimeClasspath + args 'ActorCommunicationTest.room' +} + +task run(type: JavaExec, dependsOn: classes) { + main = 'DynamicActorTest1.Node_node_da1TestRunner' + classpath = sourceSets.main.runtimeClasspath + args '-run_as_test' +} \ No newline at end of file -- cgit v1.2.3 From 845441c200d2780920d2e1769e7a8758e2846c76 Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Wed, 13 Sep 2017 16:46:38 +0200 Subject: [tests] gradle build for runtime and generator tests --- build.gradle | 10 + gradle.properties | 4 - .../etUnitConverter.gradle | 22 + .../org.eclipse.etrice.generator.c/build.gradle | 2 - .../org.eclipse.etrice.generator.cpp/build.gradle | 2 - .../org.eclipse.etrice.generator.java/build.gradle | 2 - .../etriceGenerator.gradle | 25 + runtime/org.eclipse.etrice.modellib.c/build.gradle | 19 +- .../src-gen/readme.txt | 4 - .../org.eclipse.etrice.modellib.cpp/build.gradle | 17 +- .../model/GenericPhysical.etphys | 6 +- .../src-gen/readme.txt | 4 - .../org.eclipse.etrice.modellib.java/build.gradle | 19 +- .../src-gen/readme.txt | 4 - runtime/org.eclipse.etrice.runtime.c/build.gradle | 11 +- settings.gradle | 9 +- .../build.gradle | 10 + .../targetModels/empty.txt | 0 .../build.gradle | 20 +- .../etriceTest.gradle | 110 ++++ .../log/c/log/testlog/readme.txt | 0 .../log/cpp/log/testlog/readme.txt | 0 .../log/java/log/testlog/readme.txt | 0 .../models/ActorCommunicationTest.room | 2 +- .../models/ChoicePointTest.room | 8 +- .../models/ChoicePointTestExtended.room | 2 +- .../models/CompileTests.room | 8 +- .../models/DataDrivenTest.room | 2 +- .../models/EnumTest.room | 8 +- .../models/GenericPhysical.etphys | 6 +- .../models/HandlerTest.room | 8 +- .../models/OperationInheritanceTest.room | 8 +- .../models/PingPongThread.etphys | 2 +- .../models/PingPongThreadReplPortTest.etmap | 2 +- .../models/PingPongThreadReplPortTest.room | 6 +- .../models/PingPongThreadTest.etmap | 2 +- .../models/PingPongThreadTest.room | 6 +- .../models/sendingData/SendingDataTestC.room | 605 --------------------- .../models/sendingData/SendingDataTestCpp.room | 605 --------------------- .../models/sendingData/SendingDataTestJava.room | 586 -------------------- .../models/staticConfig/StaticConfigTest.config | 141 ----- .../models/staticConfig/StaticConfigTest.etmap | 10 - .../models/staticConfig/StaticConfigTest_C.room | 421 -------------- .../models/staticConfig/StaticConfigTest_Java.room | 393 ------------- .../test.gradle | 98 ---- .../build.gradle | 10 + .../models/InitializationTest.room | 104 ++++ .../targetModels/InitializationTest.room | 105 ---- .../targetModels/empty.txt | 0 .../.classpath | 8 +- .../.project | 4 +- .../build.gradle | 47 +- .../models/DynamicActorTest1.etmap | 11 + .../models/DynamicActorTest1.room | 182 +++++++ .../models/DynamicActorTest2.etmap | 11 + .../models/DynamicActorTest2.room | 236 ++++++++ .../models/DynamicActorTest3.room | 235 ++++++++ .../models/DynamicActorTest4.room | 97 ++++ .../models/DynamicActorTest5.room | 149 +++++ .../models/DynamicActorTest6.room | 243 +++++++++ .../models/DynamicActorTest7.etmap | 11 + .../models/DynamicActorTest7.room | 375 +++++++++++++ .../models/DynamicConfigTest.config | 121 +++++ .../models/DynamicConfigTest.etmap | 9 + .../models/DynamicConfigTest.room | 202 +++++++ .../models/DynamicConfigTest.rt-config | 20 + .../models/StoreRestoreTest.room | 217 ++++++++ .../models/TCPTest.room | 160 ++++++ .../src/DynamicActorTest7/FilePersistor.java | 136 ----- .../ConfigSourceTestInstance.java | 16 - .../src/StaticConfigTest/External_Type_Test.java | 9 - .../src/StoreRestore/ObjectHolder.java | 32 -- .../DynamicActorTest7/FilePersistor.java | 136 +++++ .../ConfigSourceTestInstance.java | 16 + .../StaticConfigTest/External_Type_Test.java | 9 + .../StoreRestoreTest/ObjectHolder.java | 34 ++ .../targetModels/DynamicActorTest1.etmap | 11 - .../targetModels/DynamicActorTest1.room | 182 ------- .../targetModels/DynamicActorTest2.etmap | 11 - .../targetModels/DynamicActorTest2.room | 236 -------- .../targetModels/DynamicActorTest3.room | 235 -------- .../targetModels/DynamicActorTest4.room | 97 ---- .../targetModels/DynamicActorTest5.room | 149 ----- .../targetModels/DynamicActorTest6.room | 243 --------- .../targetModels/DynamicActorTest7.etmap | 11 - .../targetModels/DynamicActorTest7.room | 375 ------------- .../targetModels/DynamicConfigTest.config | 121 ----- .../targetModels/DynamicConfigTest.etmap | 9 - .../targetModels/DynamicConfigTest.room | 203 ------- .../targetModels/DynamicConfigTest.rt-config | 20 - .../targetModels/StoreRestore.room | 217 -------- .../targetModels/TCPTest.room | 160 ------ .../build.gradle | 40 ++ .../build.gradle | 40 ++ .../build.gradle | 16 + 95 files changed, 2968 insertions(+), 5582 deletions(-) delete mode 100644 gradle.properties create mode 100644 plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle create mode 100644 plugins/org.eclipse.etrice.generator/etriceGenerator.gradle delete mode 100644 runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt delete mode 100644 runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt delete mode 100644 runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt create mode 100644 tests/org.eclipse.etrice.generator.c.tests/build.gradle delete mode 100644 tests/org.eclipse.etrice.generator.c.tests/targetModels/empty.txt create mode 100644 tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/log/c/log/testlog/readme.txt delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/log/cpp/log/testlog/readme.txt delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/log/java/log/testlog/readme.txt delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.config delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.etmap delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_C.room delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_Java.room delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/test.gradle create mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/build.gradle create mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room delete mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/targetModels/InitializationTest.room delete mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/targetModels/empty.txt create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.etmap create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.etmap create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.etmap create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.config create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.etmap create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.rt-config create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/src/DynamicActorTest7/FilePersistor.java delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/src/DynamicConfigTest/ConfigSourceTestInstance.java delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/src/StaticConfigTest/External_Type_Test.java delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/src/StoreRestore/ObjectHolder.java create mode 100644 tests/org.eclipse.etrice.generator.java.tests/src/dynamicActorTest7/DynamicActorTest7/FilePersistor.java create mode 100644 tests/org.eclipse.etrice.generator.java.tests/src/dynamicConfigTest/DynamicConfigTest/ConfigSourceTestInstance.java create mode 100644 tests/org.eclipse.etrice.generator.java.tests/src/staticConfigTest/StaticConfigTest/External_Type_Test.java create mode 100644 tests/org.eclipse.etrice.generator.java.tests/src/storeRestoreTest/StoreRestoreTest/ObjectHolder.java delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.etmap delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.etmap delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest3.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest4.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest5.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest6.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.etmap delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.config delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.etmap delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.rt-config delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/StoreRestore.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/TCPTest.room create mode 100644 tests/org.eclipse.etrice.runtime.c.tests/build.gradle create mode 100644 tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle create mode 100644 tests/org.eclipse.etrice.runtime.java.tests/build.gradle diff --git a/build.gradle b/build.gradle index e69de29bb..59f1e8142 100644 --- a/build.gradle +++ b/build.gradle @@ -0,0 +1,10 @@ +ext { + xtext_version = '+' + emf_version = '+' + core_version = '+' + commons_io_version = '+' + + etUnitConverter = "$rootDir/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle" + etriceGenerator = "$rootDir/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle" + etriceTest = "$rootDir/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle" +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 640d2835c..000000000 --- a/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -xtext_version = + -emf_version = + -core_version = + -commons_io_version = + \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle new file mode 100644 index 000000000..59b455535 --- /dev/null +++ b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle @@ -0,0 +1,22 @@ + +def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' +evaluationDependsOn(etUnitConverter) + +/** + * Creates a tasks that converts etu files to xml files + * @param name: The name of the new task + * @param etuProducerTask: The task that produces the etu files + */ +ext.createEtUnitConverterTask = { name, etuProducerTask -> + def etuFiles = etuProducerTask.outputs.getFiles().collect { it.path } + def xmlFiles = etuFiles.collect { it.replace('.etu', '.xml') } + + return tasks.create(name: name, type: JavaExec, dependsOn: "$etUnitConverter:classes") { + dependsOn etuProducerTask + main = project(etUnitConverter).mainClassName + classpath = project(etUnitConverter).sourceSets.main.runtimeClasspath + args etuFiles + inputs.files etuProducerTask.outputs + outputs.files xmlFiles + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.c/build.gradle b/plugins/org.eclipse.etrice.generator.c/build.gradle index 77476ec8d..c25ee5832 100644 --- a/plugins/org.eclipse.etrice.generator.c/build.gradle +++ b/plugins/org.eclipse.etrice.generator.c/build.gradle @@ -25,8 +25,6 @@ sourceSets { } } -ext.classpath = sourceSets.main.runtimeClasspath - mainClassName = 'org.eclipse.etrice.generator.c.Main' distTar.enabled = false \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.cpp/build.gradle b/plugins/org.eclipse.etrice.generator.cpp/build.gradle index 01a614f7a..e3c8f948f 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/build.gradle +++ b/plugins/org.eclipse.etrice.generator.cpp/build.gradle @@ -24,8 +24,6 @@ sourceSets { } } -ext.classpath = sourceSets.main.runtimeClasspath - mainClassName = 'org.eclipse.etrice.generator.cpp.Main' distTar.enabled = false \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.java/build.gradle b/plugins/org.eclipse.etrice.generator.java/build.gradle index ab1d86cba..161180d1d 100644 --- a/plugins/org.eclipse.etrice.generator.java/build.gradle +++ b/plugins/org.eclipse.etrice.generator.java/build.gradle @@ -24,8 +24,6 @@ sourceSets { } } -ext.classpath = sourceSets.main.runtimeClasspath - mainClassName = 'org.eclipse.etrice.generator.java.Main' distTar.enabled = false \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle b/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle new file mode 100644 index 000000000..42556974a --- /dev/null +++ b/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle @@ -0,0 +1,25 @@ + +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.c') +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.cpp') +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.java') + +/** + * Creates an eTrice generator task + * @param name: The name of the new task + * @param models: The models passed to the generator + * @param genDir: The generation directory + * @param options: The eTrice generator options + */ +ext.createGeneratorTask = { name, lang, models, genDir = 'src-gen', options = [] -> + def generator = ":plugins:org.eclipse.etrice.generator.$lang" + + return tasks.create(name: name, type: JavaExec, dependsOn: "$generator:classes") { + main = project(generator).mainClassName + classpath = project(generator).sourceSets.main.runtimeClasspath + args '-msc_instr', '-genDir', genDir + args options + args models + inputs.files models + outputs.dir genDir + } +} \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.c/build.gradle b/runtime/org.eclipse.etrice.modellib.c/build.gradle index 23ad8e2b0..b881a7b8b 100644 --- a/runtime/org.eclipse.etrice.modellib.c/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.c/build.gradle @@ -2,18 +2,15 @@ plugins { id 'c' } -def generator = ':plugins:org.eclipse.etrice.generator.c' +apply from: etriceGenerator -task generate(type: JavaExec, group: 'build', dependsOn: "$generator:classes") { - main = project(generator).mainClassName - classpath = project(generator).classpath - inputs.dir 'model' - outputs.dir 'src-gen' - args '-lib', '-msc_instr', '-genDir', 'src-gen', - 'model/PInterrupt.room', - 'model/TcpService.room', - 'model/TimingService.room' -} +def models = [ + 'model/PInterrupt.room', + 'model/TcpService.room', + 'model/TimingService.room' +] + +createGeneratorTask('generate', 'c', models, 'src-gen', '-lib') model { components { diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt deleted file mode 100644 index 1dc2b35ab..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory is an eTrice code generation target. -It will be erased every time the generator is executed. - -DO NOT PLACE OTHER FILES HERE! diff --git a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle index 3299defba..efbb01f03 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle @@ -2,16 +2,13 @@ plugins { id 'cpp' } -def generator = ':plugins:org.eclipse.etrice.generator.cpp' +apply from: etriceGenerator -task generate(type: JavaExec, group: 'build', dependsOn: "$generator:classes") { - main = project(generator).mainClassName - classpath = project(generator).classpath - inputs.dir 'model' - outputs.dir 'src-gen' - args '-lib', '-msc_instr', '-genDir', 'src-gen', - 'model/TimingService.room' -} +def models = [ + 'model/TimingService.room' +] + +createGeneratorTask('generate', 'cpp', models, 'src-gen', '-lib') model { components { @@ -25,8 +22,8 @@ model { exportedHeaders { srcDirs = ['src-gen'] } - lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'api' lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'api' + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'api' } binaries { withType(SharedLibraryBinarySpec) { buildable = false } diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys b/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys index caec2ba71..27f442b9c 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys +++ b/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys @@ -14,7 +14,7 @@ PhysicalModel room.generic.physical { interval = 100ms prio = 0 stacksize = 1024 - msgblocksize = 128 + msgblocksize = 64 msgpoolsize = 100 } @@ -22,7 +22,7 @@ PhysicalModel room.generic.physical { execmode = blocked prio = 0 stacksize = 1024 - msgblocksize = 128 + msgblocksize = 64 msgpoolsize = 100 } @@ -31,7 +31,7 @@ PhysicalModel room.generic.physical { interval = 100ms prio = 0 stacksize = 1024 - msgblocksize = 128 + msgblocksize = 64 msgpoolsize = 100 } } diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt deleted file mode 100644 index 1dc2b35ab..000000000 --- a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory is an eTrice code generation target. -It will be erased every time the generator is executed. - -DO NOT PLACE OTHER FILES HERE! diff --git a/runtime/org.eclipse.etrice.modellib.java/build.gradle b/runtime/org.eclipse.etrice.modellib.java/build.gradle index f27641e6f..a458f33bb 100644 --- a/runtime/org.eclipse.etrice.modellib.java/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.java/build.gradle @@ -2,18 +2,13 @@ plugins { id 'java' } -def generator = ':plugins:org.eclipse.etrice.generator.java' +apply from: etriceGenerator -task generate(type: JavaExec, group: 'build', dependsOn: "$generator:classes") { - main = project(generator).mainClassName - classpath = project(generator).classpath - inputs.dir 'model' - outputs.dir 'src-gen' - args '-lib', '-msc_instr', '-genDir', 'src-gen', - 'model/ALogService.room', - 'model/TcpService.room', - 'model/TimingService.room' -} +def models = [ + 'model/ALogService.room', + 'model/TcpService.room', + 'model/TimingService.room' +] dependencies { compile project(':runtime:org.eclipse.etrice.runtime.java') @@ -27,6 +22,8 @@ sourceSets { } } +createGeneratorTask('generate', 'java', models, 'src-gen', '-lib') + compileJava.dependsOn generate clean.delete 'src-gen' \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt deleted file mode 100644 index 1dc2b35ab..000000000 --- a/runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory is an eTrice code generation target. -It will be erased every time the generator is executed. - -DO NOT PLACE OTHER FILES HERE! diff --git a/runtime/org.eclipse.etrice.runtime.c/build.gradle b/runtime/org.eclipse.etrice.runtime.c/build.gradle index ce88e15c8..56cad9f53 100644 --- a/runtime/org.eclipse.etrice.runtime.c/build.gradle +++ b/runtime/org.eclipse.etrice.runtime.c/build.gradle @@ -1,17 +1,24 @@ +import static org.apache.tools.ant.taskdefs.condition.Os.* + plugins { id 'c' } +def platform = '' + +if(isFamily(FAMILY_WINDOWS)) { platform = 'MT_WIN_MinGW' } +else if(isFamily(FAMILY_UNIX)) { platform = 'MT_POSIX_GENERIC_GCC' } + model { components { etrice_runtime_c(NativeLibrarySpec) { sources.c { source { - srcDirs = ['src/common', 'src/config', 'src/platforms/MT_WIN_MinGW', 'src/util'] + srcDirs = ['src/common', 'src/config', "src/platforms/$platform", 'src/util'] include '**/*.c' } exportedHeaders { - srcDirs = ['src/common', 'src/config', 'src/platforms/MT_WIN_MinGW', 'src/util'] + srcDirs = ['src/common', 'src/config', "src/platforms/$platform", 'src/util'] } } binaries { diff --git a/settings.gradle b/settings.gradle index 58f8783fc..ea0b4852a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -24,4 +24,11 @@ include 'plugins:org.eclipse.etrice.core.common', 'runtime:org.eclipse.etrice.runtime.cpp', 'runtime:org.eclipse.etrice.runtime.java', - 'tests:org.eclipse.etrice.generator.common.tests' \ No newline at end of file + 'tests:org.eclipse.etrice.runtime.c.tests', + 'tests:org.eclipse.etrice.runtime.cpp.tests', + 'tests:org.eclipse.etrice.runtime.java.tests', + + 'tests:org.eclipse.etrice.generator.common.tests', + 'tests:org.eclipse.etrice.generator.c.tests', + 'tests:org.eclipse.etrice.generator.cpp.tests', + 'tests:org.eclipse.etrice.generator.java.tests' \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/build.gradle b/tests/org.eclipse.etrice.generator.c.tests/build.gradle new file mode 100644 index 000000000..9f0487aa3 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.c.tests/build.gradle @@ -0,0 +1,10 @@ +plugins { + id 'c' +} + +apply from: etriceTest + +def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' + +createTest('c', 'sendingDataTest', ['models/SendingDataTest.room', genericPhysical]) +createTest('c', 'staticConfigTest', ['models/StaticConfigTest.etmap', 'models/StaticConfigTest.room', 'models/StaticConfigTest.config']) \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/targetModels/empty.txt b/tests/org.eclipse.etrice.generator.c.tests/targetModels/empty.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/org.eclipse.etrice.generator.common.tests/build.gradle b/tests/org.eclipse.etrice.generator.common.tests/build.gradle index 7da84045e..40882f479 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.common.tests/build.gradle @@ -4,7 +4,7 @@ plugins { id 'java-base' } -apply from: "test.gradle" +apply from: etriceTest def genericPhysical = 'models/GenericPhysical.etphys' @@ -13,7 +13,7 @@ def tests = [ choicePointTest: ['models/ChoicePointTest.room', genericPhysical], choicePointTestExtended: ['models/ChoicePointTestExtended.room', genericPhysical], dataDrivenTest: ['models/DataDrivenTest.room', genericPhysical], - //enumTest: ['models/EnumTest.room', genericPhysical], + /* enumTest: ['models/EnumTest.room', genericPhysical], not supported in c++ */ compileTests: ['models/CompileTests.room', genericPhysical, 'models/DetailExpressionTest.room', 'models/StatemachineInterfaceTest.room', 'models/StatemachineInterfaceInheritedTest.room', 'models/StatemachineInterfaceTest.room', 'models/ContinuationTransitionTest.room'], handlerTest: ['models/HandlerTest.room', genericPhysical], operationInheritanceTest: ['models/OperationInheritanceTest.room', genericPhysical], @@ -21,14 +21,12 @@ def tests = [ pingPongThreadReplPortTest: ['models/PingPongThreadReplPortTest.etmap', 'models/PingPongThreadReplPortTest.room'] ] -tests.each { key, value -> - def testTasks = [ - addTest('c', key, value), - addTest('cpp', key, value), - addTest('java', key, value) - ] - - tasks.create(name: key, dependsOn: testTasks, group: 'verification') +tests.each { name, models -> + createTest('c', name, models) + createTest('cpp', name, models) + createTest('java', name, models) } -clean.delete 'src-gen', fileTree('log') { exclude '**/readme.txt' } \ No newline at end of file +// Enum Test +createTest('c', 'enumTest', ['models/EnumTest.room', genericPhysical]) +createTest('java', 'enumTest', ['models/EnumTest.room', genericPhysical]) \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle b/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle new file mode 100644 index 000000000..3bb72747f --- /dev/null +++ b/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle @@ -0,0 +1,110 @@ +apply from: etriceGenerator +apply from: etUnitConverter + +def outputDir = 'output' +def srcGenDir = 'src-gen' + +clean.delete srcGenDir, outputDir + +def getMainClass(String genDir) { + // search for SubSystemRunner java file + def mainFile = fileTree(genDir, { include '**/*Runner.java' }).getSingleFile() + // relativize path to generation directory + def relPath = file(genDir).toPath().relativize(mainFile.toPath()).normalize().toString() + // remove '.java' at the end + def path = relPath.substring(0, relPath.length() - 5) + // replace all separators with '.' + def mainClass = path.replace(File.separatorChar, '.' as char) + return mainClass +} + +/** + * Creates all needed tasks for one test execution + * @param lang: The eTrice generator type ('c', 'cpp', 'java') + * @param name: The test name starting with a lower case letter + * @param models: Models that are passed to the eTrice generator + * @param options: Options that are passed to the eTrice generator + */ +ext.createTest = { lang, name, models, options = [] -> + + def nameCap = name.capitalize() + def langCap = lang.capitalize() + def testName = "$name$langCap" + def testNameCap = testName.capitalize() + def genDir = "$srcGenDir/$testName" + def workingDir = "$outputDir/$testName" + def etuFile = "$workingDir/${nameCap}.etu" + def xmlFile = "$workingDir/${nameCap}.xml" + def modellib = ":runtime:org.eclipse.etrice.modellib.$lang" + def generator = ":plugins:org.eclipse.etrice.generator.$lang" + def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' + + def generateTask = createGeneratorTask("generate$testNameCap", lang, models, genDir, options) + generateTask.environment 'etModellib', "org.eclipse.etrice.modellib.$lang" + + def runTask + + if(lang == 'c' || lang == 'cpp') { + model { + components { + "$testName"(NativeExecutableSpec) { + sources."$lang" { + builtBy generateTask + source { + srcDirs = [genDir] + include "**/*.$lang" + } + exportedHeaders { + srcDirs = [genDir] + } + lib project: ":runtime:org.eclipse.etrice.modellib.$lang", library: "etrice_modellib_$lang", linkage: 'static' + if(lang == 'cpp') lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' + } + binaries.all { + cCompiler.args '-g3' + cppCompiler.args '-g3' + } + } + } + } + + def exeFile = "$buildDir/exe/$testName/$testName" + runTask = tasks.create(name: "run$testNameCap", type: Exec) { + dependsOn "${testName}Executable" + commandLine exeFile, '-run_as_test' + inputs.file exeFile + outputs.file etuFile + it.workingDir = workingDir + } + } + + else if(lang == 'java') { + def testSourceSet = sourceSets.create(name) { + java.srcDirs = [genDir] + } + + dependencies { + add "${name}Compile", project(':runtime:org.eclipse.etrice.modellib.java') + add "${name}Compile", project(':runtime:org.eclipse.etrice.runtime.java') + } + + tasks.getByName("compile${nameCap}Java").dependsOn generateTask + + runTask = tasks.create(name: "run$testNameCap", type: JavaExec) { + dependsOn "${name}Classes" + classpath = testSourceSet.runtimeClasspath + args '-run_as_test' + outputs.file etuFile + it.workingDir = workingDir + + doFirst { main = getMainClass(genDir) } + } + } + + runTask.doFirst { file("$workingDir/log").mkdirs() } + + def convertTask = createEtUnitConverterTask("convert$testNameCap", runTask) + + check.dependsOn tasks.create(name: testName, dependsOn: convertTask, group: 'verification') +} diff --git a/tests/org.eclipse.etrice.generator.common.tests/log/c/log/testlog/readme.txt b/tests/org.eclipse.etrice.generator.common.tests/log/c/log/testlog/readme.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/org.eclipse.etrice.generator.common.tests/log/cpp/log/testlog/readme.txt b/tests/org.eclipse.etrice.generator.common.tests/log/cpp/log/testlog/readme.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/org.eclipse.etrice.generator.common.tests/log/java/log/testlog/readme.txt b/tests/org.eclipse.etrice.generator.common.tests/log/java/log/testlog/readme.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room index 263c1b7e2..924e0722f 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room @@ -63,7 +63,7 @@ RoomModel ActorCommunicationTest { } Behavior { ctor { - "etUnit_open(\"log/testlog\", \"ActorCommunicationTest\");" + "etUnit_open(\".\", \"ActorCommunicationTest\");" "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests\");" } dtor { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room index 9c0ac4794..c72dbc8de 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room @@ -3,12 +3,8 @@ RoomModel ChoicePointTest { import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - SubSystemClass SubSystem_ChoicePointTest { - @TestInstance - ActorRef cptest_top : CPTest_Top - } - ActorClass CPTest_Top { + @TestInstance Structure { ActorRef cp_tester: CPTester ActorRef cp_user: CPUser @@ -30,7 +26,7 @@ RoomModel ChoicePointTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"ChoicePointTest\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTest\", \"ChoicePointTest_case\");" + "caseId = etUnit_openAll(\".\", \"ChoicePointTest\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTest\", \"ChoicePointTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room index d24f6030d..a87545e89 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room @@ -350,7 +350,7 @@ RoomModel ChoicePointTestExtended { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"ChoicePointTestExtended\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTestExtended\", \"ChoicePointTest_case\");" + "caseId = etUnit_openAll(\".\", \"ChoicePointTestExtended\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTestExtended\", \"ChoicePointTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room index 83befe64b..16008a342 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room @@ -7,12 +7,8 @@ RoomModel CompileTests { import StatemachineInterfaceTestInheritedModel.StatemachineInterfaceInheritedTest from "StatemachineInterfaceInheritedTest.room" import ContinuationTransitionTest.ContinuationTransitionTest from "ContinuationTransitionTest.room" - SubSystemClass SubSystem_CompileTests { - @TestInstance - ActorRef compileTests : CompileTests - } - ActorClass CompileTests { + @TestInstance Structure { Attribute caseId : int32 @@ -24,7 +20,7 @@ RoomModel CompileTests { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"CompileTests\", \"org.eclipse.etrice.generator.common.tests.CompileTests\", \"CompileTests_case\");" + "caseId = etUnit_openAll(\".\", \"CompileTests\", \"org.eclipse.etrice.generator.common.tests.CompileTests\", \"CompileTests_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room index 4d3698ac2..87a002749 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room @@ -68,7 +68,7 @@ RoomModel DataDrivenTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DataDrivenTest\", \"org.eclipse.etrice.generator.common.tests.DataDrivenTest\", \"DataDrivenTest_case\");" + "caseId = etUnit_openAll(\".\", \"DataDrivenTest\", \"org.eclipse.etrice.generator.common.tests.DataDrivenTest\", \"DataDrivenTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room index 80eaf7d66..b533ebf22 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room @@ -3,12 +3,8 @@ RoomModel EnumTest { import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - SubSystemClass SubSystem_EnumTest { - @TestInstance - ActorRef enumTest_top : EnumTest_Top - } - ActorClass EnumTest_Top { + @TestInstance Structure { ActorRef user: EnumUser } @@ -36,7 +32,7 @@ RoomModel EnumTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"EnumTest\", \"org.eclipse.etrice.generator.common.tests.EnumTest\", \"EnumTest_case\");" + "caseId = etUnit_openAll(\".\", \"EnumTest\", \"org.eclipse.etrice.generator.common.tests.EnumTest\", \"EnumTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys b/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys index 9e9a2cc3f..da38a218e 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys +++ b/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys @@ -14,7 +14,7 @@ PhysicalModel room.generic.physical { interval = 100ms prio = 5 stacksize = 1024 - msgblocksize = 64 + msgblocksize = 128 msgpoolsize = 100 } @@ -22,7 +22,7 @@ PhysicalModel room.generic.physical { execmode = blocked prio = 5 stacksize = 1024 - msgblocksize = 64 + msgblocksize = 128 msgpoolsize = 100 } @@ -31,7 +31,7 @@ PhysicalModel room.generic.physical { interval = 100ms prio = 5 stacksize = 1024 - msgblocksize = 64 + msgblocksize = 128 msgpoolsize = 100 } } diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room index 8276547dd..db3dff2cd 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room @@ -3,12 +3,8 @@ RoomModel HandlerTest { import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - SubSystemClass SubSystem_HandlerTest { - @TestInstance - ActorRef handlerTest_top : HandlerTest_Top - } - ActorClass HandlerTest_Top { + @TestInstance Structure { ActorRef tester: Tester ActorRef handlerUser: HandlerUser @@ -30,7 +26,7 @@ RoomModel HandlerTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"HandlerTest\", \"org.eclipse.etrice.generator.common.tests.HandlerTest\", \"HandlerTest_case\");" + "caseId = etUnit_openAll(\".\", \"HandlerTest\", \"org.eclipse.etrice.generator.common.tests.HandlerTest\", \"HandlerTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room index face41b4c..f9fd340e8 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room @@ -3,18 +3,14 @@ RoomModel OperationInheritanceTest { import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - SubSystemClass SubSystem_OperationInheritanceTest { - @TestInstance - ActorRef top_test : OperationInheritanceTest - } - async ActorClass OperationInheritanceTest extends BaseActor { + @TestInstance Structure { Attribute testDataClass: SubDataClass } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"OperationInheritanceTest\", \"org.eclipse.etrice.generator.common.tests.OperationInheritanceTest\", \"OperationInheritanceTest_case\");" + "caseId = etUnit_openAll(\".\", \"OperationInheritanceTest\", \"org.eclipse.etrice.generator.common.tests.OperationInheritanceTest\", \"OperationInheritanceTest_case\");" "ctorRefine = 2;" } dtor { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys index aaf01df01..1215b84c6 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys @@ -1,7 +1,7 @@ PhysicalModel PingPongThread { PhysicalSystem Sys { - NodeRef node: PC + NodeRef node1: PC } NodeClass PC { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap index 0ea6ddfab..9b8d078af 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap @@ -4,7 +4,7 @@ MappingModel PingPongThreadReplPortTest { import PingPongThread.* from "PingPongThread.etphys" Mapping System_PingPongReplPort -> Sys { - SubSystemMapping ref_SubSystem_PingPongThreadReplPortTest -> node { + SubSystemMapping main -> node1 { ThreadMapping mrPingThread -> DfltThread ThreadMapping mrPong1Thread -> Thread1 ThreadMapping mrPong2Thread -> Thread2 diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room index 4fe552769..ef057dd2c 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room @@ -1,10 +1,10 @@ RoomModel PingPongThreadReplPortTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" LogicalSystem System_PingPongReplPort{ - SubSystemRef ref_SubSystem_PingPongThreadReplPortTest : SubSystem_PingPongReplPort + SubSystemRef main : SubSystem_PingPongReplPort } SubSystemClass SubSystem_PingPongReplPort { @@ -54,7 +54,7 @@ RoomModel PingPongThreadReplPortTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"PingPongThreadReplPortTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTestReplPort\", \"PingPongThreadTestReplPort_case\");" + "caseId = etUnit_openAll(\".\", \"PingPongThreadReplPortTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTestReplPort\", \"PingPongThreadTestReplPort_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap index caaf06032..4aa1aaaeb 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap @@ -5,7 +5,7 @@ MappingModel PingPongThreadTest { import PingPongThread.* from "PingPongThread.etphys" Mapping System_PingPong -> Sys { - SubSystemMapping ref_SubSystem_PingPongThreadTest -> node { + SubSystemMapping main -> node1 { ThreadMapping mrPingThread -> DfltThread ThreadMapping mrPong1Thread -> Thread1 ThreadMapping mrPong2Thread -> Thread2 diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room index cf3f23e65..e18c868d4 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room @@ -1,10 +1,10 @@ RoomModel PingPongThreadTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" LogicalSystem System_PingPong{ - SubSystemRef ref_SubSystem_PingPongThreadTest : SubSystem_PingPong + SubSystemRef main : SubSystem_PingPong } SubSystemClass SubSystem_PingPong { @@ -56,7 +56,7 @@ RoomModel PingPongThreadTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"PingPongThreadTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTest\", \"PingPongThreadTest_case\");" + "caseId = etUnit_openAll(\".\", \"PingPongThreadTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTest\", \"PingPongThreadTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room deleted file mode 100644 index 9c4691ee5..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room +++ /dev/null @@ -1,605 +0,0 @@ -RoomModel SendingDataTestC { - - import room.basic.test.* from "../../../../runtime/org.eclipse.etrice.modellib.c/model/Tests.room" - import room.basic.types.* from "../../../../runtime/org.eclipse.etrice.modellib.c/model/Types.room" - import room.basic.language.* from "../../../../runtime/org.eclipse.etrice.modellib.c/model/Language.room" - - ActorClass SendingDataTop { - @TestInstance - Structure { - ActorRef mrPing: MrPing - ActorRef mrPong: MrPong - Binding mrPong.PingPongPort and mrPing.PingPongPort - } - Behavior { } - } - - ActorClass MrPong { - Interface { - Port PingPongPort: PingPongProtocol - Port extTest: PCExternal - } - Structure { - external Port PingPongPort - external Port extTest - } - Behavior { - StateMachine { - Transition tr0: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt16(d);" - } - } - Transition tr1: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt8(d);" - } - } - Transition init: initial -> reply { } - Transition tr2: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt32(d);" - } - } - Transition tr3: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongFloat32(d);" - } - } - Transition tr4: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongFloat64(d);" - } - } - Transition tr7: reply -> cp cp0 { - triggers { - - } - } - Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32((*d)+10);" - } - } - Transition tr6: cp cp0 -> reply { - cond { - "(*d)!=5" - } - action { - "PingPongPort.pongInt32(*d);" - } - } - Transition tr9: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr11: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr5: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt64(d);" - } - } - Transition tr10: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt16(*d);" - } - } - Transition tr12: reply -> cp cp1 { - triggers { - i8ValPPD == 5" - }> - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr14: cp cp1 -> reply { - cond { - "d->i8ValPPD==7" - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr15: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplexDerived(d);" - } - } - Transition tr16: my tp0 -> my tp0 { - triggers { - - } - } - ChoicePoint cp0 - ChoicePoint cp1 - TransitionPoint tp0 - State reply - } - } - } - - ActorClass MrPing { - Interface { - conjugated Port PingPongPort: PingPongProtocol - } - Structure { - external Port PingPongPort - Attribute i8Val: int8="5" - Attribute i16Val:int16="19" - Attribute i32Val: int32 = "4711" - Attribute i64Val: int64 = "11470815" - Attribute i32Array [ 10 ]: int32="{0,1,2,3,4,5,6,7,8,9}" - Attribute f32Val: float32="3.14f" - Attribute f64Val: float64="7.987654321" - Attribute data: PingPongData - Attribute dataD: PingPongDataDerived - Attribute counter:int32 - Attribute caseId: int32 - Attribute lang: languageIndicator - Attribute resultlist [ 23 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" - } - Behavior { - StateMachine { - Transition init: initial -> tp0 of state0 { - action { - "caseId = etUnit_openAll(\"log/testlog\", \"SendingDataTestC\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" - "EXPECT_ORDER_START(caseId,resultlist,23);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "/* send the default values */" - "" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(&i16Val);" - "PingPongPort.pingInt32Ref(&i32Val);" - "i8Val++;" - "i16Val++;" - "i32Val++;" - "i64Val++;" - "f32Val+=10.1;" - "f64Val+=20.2;" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(&i16Val);" - "PingPongPort.pingInt32Ref(&i32Val);" - } - } - Transition tr0: tp1 of state0 -> tp0 of state1 - Transition tr1: tp1 of state1 -> test_finished - State state0 { - subgraph { - Transition tr0: my tp0 -> receiveFirst7 { - action { - "counter=0;" - } - } - Transition tr1: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr2: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr4: receiveFirst7 -> receiveSecond7 { - triggers { - - } - action { - "counter=0;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (d==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (d==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr6: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr5: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if ((d>3)&&(d<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr7: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if ((d>7)&&(d<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr8: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr9: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr10: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr11: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr12: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if ((d>13)&&(d<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr13: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if ((d>28)&&(d<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr14: receiveSecond7 -> my tp1 { - triggers { - - } - action { - "if (d==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr15: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (d==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (d==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr16: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==20){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - EntryPoint tp0 - ExitPoint tp1 - State receiveFirst7 - State receiveSecond7 - } - } - State test_finished { - entry { - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" - "etUnit_closeAll(caseId);" - "etUnit_testFinished(caseId);" - } - } - State state1 { - subgraph { - Transition tr0: my tp0 -> state0 { - action { - "counter=0;" - "/* send default values */" - "PingPongPort.pingComplex(&(data));" - "PingPongPort.pingComplexRef(&(data));" - } - } - Transition tr1: state0 -> state1 { - triggers { - - } - action { - "counter=0;" - "if (d->i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d->complexVal.i32Val2PPDD==80){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "dataD.i8ValPPD=11;" - "PingPongPort.pingComplexDerived(&(dataD));" - } - } - Transition tr2: state0 -> state0 { - triggers { - - } - action { - "counter++;" - "if (d->i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: state1 -> my tp1 { - triggers { - - } - action { - "if (d->i8ValPPD==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d->i32Val3PPDe==150){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - EntryPoint tp0 - ExitPoint tp1 - State state0 - State state1 - } - } - } - } - } - - ProtocolClass PingPongProtocol { - incoming { - Message pingInt8(d: int8) - Message pingInt16(d: int16) - Message pingInt32(d: int32) - Message pingInt64(d: int64) - Message pingFloat32(d: float32) - Message pingFloat64(d: float64) - Message pingInt16Ref(d: int16 ref) - Message pingInt32Ref(d: int32 ref) - Message pingComplex(d: PingPongData) - Message pingComplexRef(d: PingPongData ref) - Message pingComplexDerived(d:PingPongDataDerived) - } - outgoing { - Message pongInt8(d: int8) - Message pongInt16(d: int16) - Message pongInt32(d: int32) - Message pongInt64(d:int64) - Message pongFloat32(d: float32) - Message pongFloat64(d: float64) - Message pongComplex(d: PingPongData) - Message pongComplexDerived(d: PingPongDataDerived) - } - } - - ProtocolClass PCExternal { - usercode1 { - "typedef int extMsg;" - } - incoming { - Message in1(can: DExtMsg) - } - } - - DataClass PingPongData { - Attribute i8ValPPD: int8 = "10" - Attribute i8ValRefPPD: int8 ref - Attribute i32ArrayPPD [ 3 ]: int32 = "{200,300,400}" - Attribute i8ArrayRefPPD [ 2 ]: int8 ref - Attribute complexVal: PingPongDataDeep - } - - DataClass PingPongDataDeep { - Attribute i32Val1PPDD: int32 - Attribute i32Val2PPDD: int32 = "80" - } - - DataClass PingPongDataDerived extends PingPongData { - Attribute i32Val3PPDe: int32 = "150" - } - - ExternalType DExtMsg -> "extMsg" -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room deleted file mode 100644 index 6094b11d8..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room +++ /dev/null @@ -1,605 +0,0 @@ -RoomModel SendingDataTestCpp { - - import room.basic.test.* from "../../../../runtime/org.eclipse.etrice.modellib.cpp/model/Tests.room" - import room.basic.types.* from "../../../../runtime/org.eclipse.etrice.modellib.cpp/model/Types.room" - import room.basic.language.* from "../../../../runtime/org.eclipse.etrice.modellib.cpp/model/Language.room" - - ActorClass SendingDataTop { - @TestInstance - Structure { - ActorRef mrPing: MrPing - ActorRef mrPong: MrPong - Binding mrPong.PingPongPort and mrPing.PingPongPort - } - Behavior { } - } - - ActorClass MrPong { - Interface { - Port PingPongPort: PingPongProtocol - Port extTest: PCExternal - } - Structure { - external Port PingPongPort - external Port extTest - } - Behavior { - StateMachine { - Transition tr0: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt16(d);" - } - } - Transition tr1: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt8(d);" - } - } - Transition init: initial -> reply { } - Transition tr2: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt32(d);" - } - } - Transition tr3: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongFloat32(d);" - } - } - Transition tr4: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongFloat64(d);" - } - } - Transition tr7: reply -> cp cp0 { - triggers { - - } - } - Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32((*d)+10);" - } - } - Transition tr6: cp cp0 -> reply { - cond { - "(*d)!=5" - } - action { - "PingPongPort.pongInt32(*d);" - } - } - Transition tr9: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr11: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplex(*d);" - } - } - Transition tr5: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt64(d);" - } - } - Transition tr10: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt16(*d);" - } - } - Transition tr12: reply -> cp cp1 { - triggers { - i8ValPPD == 5" - }> - } - action { - "PingPongPort.pongComplex(*d);" - } - } - Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(*d);" - } - } - Transition tr14: cp cp1 -> reply { - cond { - "d->i8ValPPD==7" - } - action { - "PingPongPort.pongComplex(*d);" - } - } - Transition tr15: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplexDerived(d);" - } - } - Transition tr16: my tp0 -> my tp0 { - triggers { - - } - } - ChoicePoint cp0 - ChoicePoint cp1 - TransitionPoint tp0 - State reply - } - } - } - - ActorClass MrPing { - Interface { - conjugated Port PingPongPort: PingPongProtocol - } - Structure { - external Port PingPongPort - Attribute i8Val: int8="5" - Attribute i16Val:int16="19" - Attribute i32Val: int32 = "4711" - Attribute i64Val: int64 = "11470815" - Attribute i32Array [ 10 ]: int32 = "{0,1,2,3,4,5,6,7,8,9}" - Attribute f32Val: float32="3.14f" - Attribute f64Val: float64="7.987654321" - Attribute data: PingPongData - Attribute dataD: PingPongDataDerived - Attribute counter:int32 - Attribute caseId: int32 - Attribute lang: languageIndicator - Attribute resultlist [ 23 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" - } - Behavior { - StateMachine { - Transition init: initial -> tp0 of state0 { - action { - "caseId = etUnit_openAll(\"log/testlog\", \"SendingDataTestCpp\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" - "EXPECT_ORDER_START(caseId,resultlist,23);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "/* send the default values */" - "" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(&i16Val);" - "PingPongPort.pingInt32Ref(&i32Val);" - "i8Val++;" - "i16Val++;" - "i32Val++;" - "i64Val++;" - "f32Val+=10.1;" - "f64Val+=20.2;" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(&i16Val);" - "PingPongPort.pingInt32Ref(&i32Val);" - } - } - Transition tr0: tp1 of state0 -> tp0 of state1 - Transition tr1: tp1 of state1 -> test_finished - State state0 { - subgraph { - Transition tr0: my tp0 -> receiveFirst7 { - action { - "counter=0;" - } - } - Transition tr1: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr2: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr4: receiveFirst7 -> receiveSecond7 { - triggers { - - } - action { - "counter=0;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (d==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (d==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr6: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr5: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if ((d>3)&&(d<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr7: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if ((d>7)&&(d<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr8: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr9: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr10: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr11: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr12: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if ((d>13)&&(d<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr13: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if ((d>28)&&(d<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr14: receiveSecond7 -> my tp1 { - triggers { - - } - action { - "if (d==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr15: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (d==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (d==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr16: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==20){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - EntryPoint tp0 - ExitPoint tp1 - State receiveFirst7 - State receiveSecond7 - } - } - State test_finished { - entry { - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" - "etUnit_closeAll(caseId);" - "etUnit_testFinished(caseId);" - } - } - State state1 { - subgraph { - Transition tr0: my tp0 -> state0 { - action { - "counter=0;" - "/* send default values */" - "PingPongPort.pingComplex(data);" - "PingPongPort.pingComplexRef(&data);" - } - } - Transition tr1: state0 -> state1 { - triggers { - - } - action { - "counter=0;" - "if (d.i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d.complexVal.i32Val2PPDD==80){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "dataD.i8ValPPD=11;" - "PingPongPort.pingComplexDerived(dataD);" - } - } - Transition tr2: state0 -> state0 { - triggers { - - } - action { - "counter++;" - "if (d.i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: state1 -> my tp1 { - triggers { - - } - action { - "if (d.i8ValPPD==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d.i32Val3PPDe==150){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - EntryPoint tp0 - ExitPoint tp1 - State state0 - State state1 - } - } - } - } - } - - ProtocolClass PingPongProtocol { - incoming { - Message pingInt8(d: int8) - Message pingInt16(d: int16) - Message pingInt32(d: int32) - Message pingInt64(d: int64) - Message pingFloat32(d: float32) - Message pingFloat64(d: float64) - Message pingInt16Ref(d: int16 ref) - Message pingInt32Ref(d: int32 ref) - Message pingComplex(d: PingPongData) - Message pingComplexRef(d: PingPongData ref) - Message pingComplexDerived(d:PingPongDataDerived) - } - outgoing { - Message pongInt8(d: int8) - Message pongInt16(d: int16) - Message pongInt32(d: int32) - Message pongInt64(d:int64) - Message pongFloat32(d: float32) - Message pongFloat64(d: float64) - Message pongComplex(d: PingPongData) - Message pongComplexDerived(d: PingPongDataDerived) - } - } - - ProtocolClass PCExternal { - usercode1 { - "typedef int extMsg;" - } - incoming { - Message in1(can: DExtMsg) - } - } - - DataClass PingPongData { - Attribute i8ValPPD: int8 = "10" - Attribute i8ValRefPPD: int8 ref - Attribute i32ArrayPPD [ 3 ]: int32 = "{200,300,400}" - Attribute i8ArrayRefPPD [ 2 ]: int8 ref - Attribute complexVal: PingPongDataDeep - } - - DataClass PingPongDataDeep { - Attribute i32Val1PPDD: int32 - Attribute i32Val2PPDD: int32 = "80" - } - - DataClass PingPongDataDerived extends PingPongData { - Attribute i32Val3PPDe: int32 = "150" - } - - ExternalType DExtMsg -> "extMsg" -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room deleted file mode 100644 index 007b3242c..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room +++ /dev/null @@ -1,586 +0,0 @@ -RoomModel SendingDataTestJava { - - import room.basic.test.* from "../../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - import room.basic.types.* from "../../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" - import room.basic.language.* from "../../../../runtime/org.eclipse.etrice.modellib.java/model/Language.room" - - ActorClass SendingDataTop { - @TestInstance - Structure { - ActorRef mrPing: MrPing - ActorRef mrPong: MrPong - Binding mrPong.PingPongPort and mrPing.PingPongPort - } - Behavior { } - } - - ActorClass MrPong { - Interface { - Port PingPongPort: PingPongProtocol - } - Structure { - external Port PingPongPort - } - Behavior { - StateMachine { - Transition tr0: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt16(d);" - } - } - Transition tr1: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt8(d);" - } - } - Transition init: initial -> reply { } - Transition tr2: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt32(d);" - } - } - Transition tr3: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongFloat32(d);" - } - } - Transition tr4: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongFloat64(d);" - } - } - Transition tr7: reply -> cp cp0 { - triggers { - - } - } - Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32(d+10);" - } - } - Transition tr6: cp cp0 -> reply { - cond { - "d!=5" - } - action { - "PingPongPort.pongInt32(d);" - } - } - Transition tr9: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr11: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr5: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt64(d);" - } - } - Transition tr10: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt16(d);" - } - } - Transition tr12: reply -> cp cp1 { - triggers { - - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr14: cp cp1 -> reply { - cond { - "d.i8Val==7" - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr15: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplexDerived(d);" - } - } - ChoicePoint cp0 - ChoicePoint cp1 - State reply - } - } - } - - ActorClass MrPing { - Interface { - conjugated Port PingPongPort: PingPongProtocol - } - Structure { - external Port PingPongPort - Attribute i8Val: int8="5" - Attribute i16Val:int16="19" - Attribute i32Val: int32 = "4711" - Attribute i64Val: int64 = "11470815" - Attribute i32Array [ 10 ]: int32="{0,1,2,3,4,5,6,7,8,9}" - Attribute f32Val: float32="3.14" - Attribute f64Val: float64="7.987654321" - Attribute data: PingPongData - Attribute dataD: PingPongDataDerived - Attribute counter:int32 - Attribute caseId: int32 - Attribute lang: languageIndicator - Attribute resultlist [ 18 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" - } - Behavior { - StateMachine { - Transition init: initial -> tp0 of state0 { - action { - "caseId = etUnit_openAll(\"log/testlog\", \"SendingDataTestJava\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" - "EXPECT_ORDER_START(caseId,resultlist,23);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "// send the default values" - "" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(i16Val);" - "PingPongPort.pingInt32Ref(i32Val);" - "i8Val++;" - "i16Val++;" - "i32Val++;" - "i64Val++;" - "f32Val+=10.1;" - "f64Val+=20.2;" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(i16Val);" - "PingPongPort.pingInt32Ref(i32Val);" - } - } - Transition tr0: tp1 of state0 -> tp0 of state1 - Transition tr1: tp1 of state1 -> test_finished - State state0 { - subgraph { - Transition tr0: my tp0 -> receiveFirst7 { - action { - "counter=0;" - } - } - Transition tr1: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr2: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr4: receiveFirst7 -> receiveSecond7 { - triggers { - - } - action { - "counter=0;" - "if (lang == 1){" - "// Java cannot send references of primitive types" - "\tif (d==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "// C" - "\tif (d==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr6: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (d==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr5: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if ((d>3)&&(d<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr7: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if ((d>7)&&(d<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr8: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr9: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr10: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr11: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr12: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if ((d>13)&&(d<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr13: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if ((d>28)&&(d<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr14: receiveSecond7 -> my tp1 { - triggers { - - } - action { - "if (d==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr15: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (lang == 1){" - "// Java cannot send references of primitive types" - "\tif (d==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "// C" - "\tif (d==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr16: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (d==20){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - EntryPoint tp0 - ExitPoint tp1 - State receiveFirst7 - State receiveSecond7 - } - } - State test_finished { - entry { - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" - "etUnit_closeAll(caseId);" - "etUnit_testFinished(caseId);" - } - } - State state1 { - subgraph { - Transition tr0: my tp0 -> state0 { - action { - "counter=0;" - "// send default values" - "PingPongPort.pingComplex(data);" - "PingPongPort.pingComplexRef(data);" - } - } - Transition tr1: state0 -> state1 { - triggers { - - } - action { - "counter=0;" - "if (d.i8Val==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d.complexVal.i32Val2==80){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "dataD.i8Val=11;" - "PingPongPort.pingComplexDerived(dataD);" - } - } - Transition tr2: state0 -> state0 { - triggers { - - } - action { - "counter++;" - "if (d.i8Val==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: state1 -> my tp1 { - triggers { - - } - action { - "if (d.i8Val==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d.i32Val3==150){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - EntryPoint tp0 - ExitPoint tp1 - State state0 - State state1 - } - } - } - } - } - - ProtocolClass PingPongProtocol { - incoming { - Message pingInt8(d: int8) - Message pingInt16(d: int16) - Message pingInt32(d: int32) - Message pingInt64(d: int64) - Message pingFloat32(d: float32) - Message pingFloat64(d: float64) - Message pingInt16Ref(d: int16 ref) - Message pingInt32Ref(d: int32 ref) - Message pingComplex(d: PingPongData) - Message pingComplexRef(d: PingPongData ref) - Message pingComplexDerived(d:PingPongDataDerived) - } - outgoing { - Message pongInt8(d: int8) - Message pongInt16(d: int16) - Message pongInt32(d: int32) - Message pongInt64(d:int64) - Message pongFloat32(d: float32) - Message pongFloat64(d: float64) - Message pongComplex(d: PingPongData) - Message pongComplexDerived(d: PingPongDataDerived) - } - } - - DataClass PingPongData { - Attribute i8Val: int8 = "10" - Attribute i8ValRef: int8 ref - Attribute i32Array [ 3 ]: int32 = "{200,300,400}" - Attribute i8ArrayRef [ 2 ]: int8 ref - Attribute complexVal: PingPongDataDeep - } - - DataClass PingPongDataDeep { - Attribute i32Val1: int32 - Attribute i32Val2: int32 = "80" - } - - DataClass PingPongDataDerived extends PingPongData { - Attribute i32Val3: int32 = "150" - } -} diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.config b/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.config deleted file mode 100644 index 426adc5e6..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.config +++ /dev/null @@ -1,141 +0,0 @@ -ConfigModel StaticTestConfig { - - import StaticConfigTest.* from "StaticConfigTest.room" - - ActorClassConfig Tester_ac { - // nothing - } - - ActorClassConfig Testee_1_ac { - Attr data_1 { - Attr bool_c = false - Attr bool_i = false - Attr int8_c = 24 - Attr int8_i = 24 - Attr int16_c = 48 - Attr int16_i = 48 - Attr int32_c = 96 - Attr int32_i = 96 - Attr int64_c = 192 - Attr int64_i = 192 - Attr float32_c = 9.6 - Attr float32_i = 9.6 - Attr float64_c = 19.2 - Attr float64_i = 19.2 - Attr char_c = "C" - Attr char_i = "C" - Attr string_c = ":)" - Attr string_i = ":)" - - Attr bool_array_c = true, false - Attr bool_array_i = true, false - Attr int8_array_c = 24, 48 - Attr int8_array_i = 24, 48 - Attr int16_array_c = 48, 96 - Attr int16_array_i = 48, 96 - Attr int32_array_c = 96, 192 - Attr int32_array_i = 96, 192 - Attr int64_array_c = 192, 384 - Attr int64_array_i = 192, 384 - Attr float32_array_c = 9.6 - Attr float32_array_i = 9.6 - Attr float64_array_c = 19.2 - Attr float64_array_i = 19.2 - Attr char_array_c = "Claz" - Attr char_array_i = "Claz" - - Attr data_2 { - Attr int32_c = 42 - Attr int32_i = 42 - } - } - Attr enumval1 = Enum_1.two - Attr enumval2 = Enum_2.three - } - - ActorClassConfig Testee_Super2_ac { - Attr float64_super_c = 2.2 - Attr float64_super_i = 2.2 - } - - ActorClassConfig Testee_2_ac { - Attr int32_own_c = 12 - Attr int32_own_i = 12 - } - - ProtocolClassConfig TestProtocolAttributes { - regular Port{ - Attr float_c = 3.0 - Attr float_i = 3.0 - } - conjugate Port { - Attr array2_c = 16, 32 - Attr array2_i = 16, 32 - } - } - - ProtocolClassConfig TestProtocolWithDataClass { - conjugate Port { - Attr sap_data_2{ - Attr int32_c = 2 - Attr int32_i = 2 - } - } - } - - ActorInstanceConfig System_StaticConfigTest/main/top/tester { - // nothing - } - - ActorInstanceConfig System_StaticConfigTest/main/top/testee_1 { - Attr data_1 { - Attr bool_i = true - Attr int8_i = 2 - Attr int16_i = 4 - Attr int32_i = 8 - Attr int64_i = 16 - Attr float32_i = 1.6 - Attr float64_i = 3.2 - Attr char_i = "I" - Attr string_i = ":]" - - Attr bool_array_i = true, true - Attr int8_array_i = 2, 6 - Attr int16_array_i = 4, 12 - Attr int32_array_i = 8, 24 - Attr int64_array_i = 16, 48 - Attr float32_array_i = 1.6 - Attr float64_array_i = 3.2 - Attr char_array_i = "Inst" - - Attr data_2 { - Attr int32_i = 43 - } - } - InterfaceItem conj_port { - Attr array2_i = 1, 2 - } - } - - - ActorInstanceConfig System_StaticConfigTest/main/top/tester/testee_super2{ - Attr float64_super_i = 3.3 - InterfaceItem reg_port { - Attr float_i = 25.0 - } - } - - ActorInstanceConfig System_StaticConfigTest/main/top/testee_1/testee_2 { - Attr float64_super_i = 4.4 - Attr int32_own_i = 13 - InterfaceItem reg_port { - Attr float_i = 50.0 - } - InterfaceItem sap { - Attr sap_data_2 { - Attr int32_i = 3 - } - } - } - -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.etmap b/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.etmap deleted file mode 100644 index e437b5710..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.etmap +++ /dev/null @@ -1,10 +0,0 @@ -MappingModel StaticConfigTest { - - import StaticConfigTest.* from "StaticConfigTest.room" - import room.generic.physical.* from "../GenericPhysical.etphys" - - Mapping System_StaticConfigTest -> GenericPhysicalSystem { - SubSystemMapping main -> node {} - } - -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_C.room b/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_C.room deleted file mode 100644 index 5a1f04db5..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_C.room +++ /dev/null @@ -1,421 +0,0 @@ -RoomModel StaticConfigTest { - - import room.basic.types.* from "../Types.room" - import room.basic.service.timing.* from "../TimingService.room" - - LogicalSystem System_StaticConfigTest { - SubSystemRef main : SubSystem_StaticConfigTest - } - - SubSystemClass SubSystem_StaticConfigTest { - LayerConnection ref top satisfied_by timer.timer - ActorRef top: Top_ac - ActorRef timer : ATimingService - } - - ActorClass Top_ac { - Structure { - ActorRef testee_1: Testee_1_ac - ActorRef tester: Tester_ac - LayerConnection ref testee_1 satisfied_by tester.spp - SAP timer : PTimer - } - Behavior { - ctor { - "etUnit_open(\"log/testlog\", \"StaticConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.StaticConfigTest\");" - } - dtor { - "etUnit_closeTestSuite();" - "etUnit_close();" - } - StateMachine { - Transition init: initial -> state0 { - action { - "timer.startTimeout(1000);" - } - } - Transition tr0: state0 -> state0 { - triggers { - - } - action { - "etUnit_testFinished(-1);" - } - } - State state0 - } - } - } - - ActorClass Tester_ac { - Interface { - SPP spp: TestProtocolWithDataClass - } - Structure { - ServiceImplementation of spp - Attribute caseId: int32 - - // none config test - Attribute data_3: Data_3_dc - ActorRef testee_super2: Testee_Super2_ac - } - Behavior { - StateMachine { - Transition init: initial -> s1 { } - State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Tester_ac\");" - "Data_3_dc_varCheck3(&(data_3), caseId);" - "etUnit_closeTestCase(caseId);" - } - } - } - } - } - - ActorClass Testee_1_ac { - Interface { - conjugated Port conj_port: TestProtocolAttributes - } - Structure { - usercode1 { - "#include \"etUnit/etUnit.h\"" - } - external Port conj_port - Attribute caseId: int32 - Attribute data_1: Data_1_dc - Attribute enumval1: Enum_1 = "one" - Attribute enumval2: Enum_2 = "four" - ActorRef testee_2: Testee_2_ac - } - Behavior { - StateMachine { - Transition init: initial -> s1 { } - State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_1_ac\");" - "Data_1_dc_varCheck1(&(data_1), caseId);" - "EXPECT_FALSE(caseId,\"testee_1:data_1:1\", data_1.bool_c);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:2\", data_1.int8_c == 24);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:3\", data_1.int16_c == 48);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:4\", data_1.int32_c == 96);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:5\", data_1.int64_c == 192);" - "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:6\", 9.6f, data_1.float32_c, 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId,\"testee_1:data_1:7\", 19.2, data_1.float64_c, 0.1);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:8\", data_1.char_c == \'C\');" - "EXPECT_TRUE(caseId,\"testee_1:varCheck:8.1\", strcmp(data_1.string_c, \":)\") == 0 );" - "EXPECT_TRUE(caseId,\"testee_1:data_1:10\", data_1.bool_i);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:11\", data_1.int8_i == 2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:12\", data_1.int16_i == 4);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:13\", data_1.int32_i == 8);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:14\", data_1.int64_i == 16);" - "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:15\", 1.6f, data_1.float32_i, 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId,\"testee_1:data_1:16\", 3.2, data_1.float64_i, 0.1);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:17\", data_1.char_i == \'I\');" - "EXPECT_TRUE(caseId,\"testee_1:varCheck:18\", strcmp(data_1.string_i, \":]\") == 0 );" - - // Array - "EXPECT_TRUE(caseId,\"testee_1:data_1:19\", data_1.bool_array_c[0] == ET_TRUE && data_1.bool_array_c[1] == ET_FALSE);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:20\", data_1.int8_array_c[0] == 24 && data_1.int8_array_c[1] == 48);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:21\", data_1.int16_array_c[0] == 48 && data_1.int16_array_c[1] == 96);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:22\", data_1.int32_array_c[0] == 96 && data_1.int32_array_c[1] == 192);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:23\", data_1.int64_array_c[0] == 192 && data_1.int64_array_c[1] == 384);" - "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:24_1\", 9.6f, data_1.float32_array_c[0], 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:24_2\", 9.6f, data_1.float32_array_c[1], 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:25_1\", 19.2, data_1.float64_array_c[0], 0.1);" - "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:25_2\", 19.2, data_1.float64_array_c[1], 0.1);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:26\", strcmp(data_1.char_array_c, \"Claz\") == 0);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:27\", data_1.bool_array_i[0] == ET_TRUE && data_1.bool_array_i[1] == ET_TRUE);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:28\", data_1.int8_array_i[0] == 2 && data_1.int8_array_i[1] == 6);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:29\", data_1.int16_array_i[0] == 4 && data_1.int16_array_i[1] == 12);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:30\", data_1.int32_array_i[0] == 8 && data_1.int32_array_i[1] == 24);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:31\", data_1.int64_array_i[0] == 16 && data_1.int64_array_i[1] == 48);" - "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:32_1\", 1.6f, data_1.float32_array_i[0], 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:32_2\", 1.6f, data_1.float32_array_i[1], 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:33_1\", 3.2, data_1.float64_array_i[0], 0.1);" - "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:33_2\", 3.2, data_1.float64_array_i[1], 0.1);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:34\", strcmp(data_1.char_array_i, \"Inst\") == 0);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:35\", data_1.data_2.int32_c == 42);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:36\", data_1.data_2.int32_i == 43);" - - // conj_port - "EXPECT_TRUE(caseId,\"testee_1:conj_port:36\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_r[0] == 11);" - "EXPECT_TRUE(caseId,\"testee_1:conj_port:37\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_r[1] == 22);" - "EXPECT_TRUE(caseId,\"testee_1:conj_port:38\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_c[0] == 16);" - "EXPECT_TRUE(caseId,\"testee_1:conj_port:39\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_c[1] == 32);" - "EXPECT_TRUE(caseId,\"testee_1:conj_port:40\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_i[0] == 1);" - "EXPECT_TRUE(caseId,\"testee_1:conj_port:41\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_i[1] == 2);" - "etUnit_testFinished(caseId);" - - // enums - "EXPECT_TRUE(caseId,\"testee_1:enumval1\", enumval1 == Enum_1.two);" - "EXPECT_TRUE(caseId,\"testee_1:enumval2\", enumval2 == Enum_2.three);" - "etUnit_closeTestCase(caseId);" - } - } - } - } - } - - ActorClass Testee_Super2_ac { - Interface { - Port reg_port: TestProtocolAttributes - } - Structure { - usercode1 { - "#include \"etUnit/etUnit.h\"" - } - external Port reg_port - Attribute caseId: int32 - - // test - Attribute data_2: Data_2_dc - Attribute float64_super_r: float64 = "1.1" - Attribute float64_super_c: float64 = "1.1" - Attribute float64_super_i: float64 = "1.1" - } - Behavior { - ctor { - "testInstanceConfig();" - } - Operation testInstanceConfig(){ - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_Super2_ac\");" - "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_Super2_ac:1\", 1.1, float64_super_r, 0.1);" - "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_Super2_ac:2\", 2.2, float64_super_c, 0.1);" - "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_Super2_ac:3\", 3.3, float64_super_i, 0.1);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:7\", 25.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);" - // reg_port - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:5\", 4.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:6\", 3.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);" - "etUnit_closeTestCase(caseId);" - } - } - } - - ActorClass Testee_2_ac extends Testee_Super2_ac { - Structure { - SAP sap: TestProtocolWithDataClass - Attribute int32_own_r: int32 = "11" - Attribute int32_own_c: int32 = "11" - Attribute int32_own_i: int32 = "11" - } - Behavior { - override Operation testInstanceConfig(){ - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_2_ac\");" - "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_2_ac:2\", 4.4, float64_super_i, 0.1);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:9\", 50.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);" - } - StateMachine { - Transition init: initial -> s1 { } - State s1 { - entry { - "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_2_ac:1\", 2.2, float64_super_c, 0.1);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:3\", int32_own_r == 11);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:4\", int32_own_c == 12);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:5\", int32_own_i == 13);" - - // reg_port - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:6\", 4.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:7\", 3.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);" - - // sap - "Data_3_dc_varCheck3(&(((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_3), caseId);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:10\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_r == 1);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:11\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_c == 2);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:12\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_i == 3);" - "etUnit_closeTestCase(caseId);" - } - } - } - } - } - - ProtocolClass TestProtocolAttributes { - incoming { - Message dummy() - } - regular PortClass - { - Attribute float_r: float32 = "4" - Attribute float_c: float32 = "16" - Attribute float_i: float32 = "256" - } - conjugated PortClass - { - Attribute array2_r [ 2 ]: int64 = "{11,22}" - Attribute array2_c [ 2 ]: int64 = "{0,0}" - Attribute array2_i [ 2 ]: int64 = "{0,0}" - } - } - - ProtocolClass TestProtocolWithDataClass { - usercode1 { - "#include \"Data_2_dc.h\"" - "#include \"Data_3_dc.h\"" - } - incoming { - Message dummy() - } - - //SAP - conjugated PortClass - { - Attribute sap_data_2: Data_2_dc - - // none config test - Attribute sap_data_3: Data_3_dc - } - } - - ExternalType extType -> "int" default "999" - - DataClass Data_Super1_dc { - // PrimitiveType - Attribute bool_r: boolean = "false" - Attribute bool_c: boolean = "false" - Attribute bool_i: boolean = "false" - // Array - Attribute bool_array_r [ 2 ]: boolean = "{ ET_FALSE, false }" - Attribute bool_array_c [ 2 ]: boolean = "{ false, false }" - Attribute bool_array_i [ 2 ]: boolean = "{ false, false }" - } - - DataClass Data_1_dc extends Data_Super1_dc{ - usercode1 { - "#include \"etUnit/etUnit.h\"" - } - - Attribute int8_r: int8 = "8" - Attribute int8_c: int8 = "8" - Attribute int8_i: int8 = "8" - Attribute int16_r: int16 = "16" - Attribute int16_c: int16 = "16" - Attribute int16_i: int16 = "16" - Attribute int32_r: int32 = "32" - Attribute int32_c: int32 = "32" - Attribute int32_i: int32 = "32" - Attribute int64_r: int64 = "64" - Attribute int64_c: int64 = "64" - Attribute int64_i: int64 = "64" - Attribute float32_r: float32 = "3.2" - Attribute float32_c: float32 = "3.2" - Attribute float32_i: float32 = "3.2" - Attribute float64_r: float64 = "6.4" - Attribute float64_c: float64 = "6.4" - Attribute float64_i: float64 = "6.4" - Attribute char_r: char = "R" - Attribute char_c: char = 'R' - Attribute char_i: char = "R" - Attribute string_r: string = ":/" - Attribute string_c: string = ":/" - Attribute string_i: string = ":/" - - // Array - Attribute int8_array_r [ 2 ]: int8 = "{ 8, 16 }" - Attribute int8_array_c [ 2 ]: int8 = "{ 8, 16 }" - Attribute int8_array_i [ 2 ]: int8 = "{ 8, 16 }" - Attribute int16_array_r [ 2 ]: int16 = "{ 16, 32 }" - Attribute int16_array_c [ 2 ]: int16 = "{ 16, 32 }" - Attribute int16_array_i [ 2 ]: int16 = "{ 16, 32 }" - Attribute int32_array_r [ 2 ]: int32 = "{ 32, 64 }" - Attribute int32_array_c [ 2 ]: int32 = "{ 32, 64 }" - Attribute int32_array_i [ 2 ]: int32 = "{ 32, 64 }" - Attribute int64_array_r [ 2 ]: int64 = "{ 64, 128 }" - Attribute int64_array_c [ 2 ]: int64 = "{ 64, 128 }" - Attribute int64_array_i [ 2 ]: int64 = "{ 64, 128 }" - Attribute float32_array_r [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float32_array_c [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float32_array_i [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float64_array_r [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute float64_array_c [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute float64_array_i [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute char_array_r [ 5 ]: char = "ROOM" - Attribute char_array_c [ 5 ]: char = "ROOM" - Attribute char_array_i [ 5 ]: char = "ROOM" - - // ComplexType - Attribute data_2: Data_2_dc - - Operation varCheck1(caseId: int32) { - "Data_2_dc_varCheck2(&(data_2), caseId);" - - // PrimitiveType - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:1\", bool_r == ET_FALSE);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:2\", int8_r == 8);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:3\", int16_r == 16);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:4\", int32_r == 32);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:5\", int64_r == 64);" - "EXPECT_EQUAL_FLOAT32(caseId,\"Data_1_dc:varCheck:6\", 3.2f, float32_r, 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId,\"Data_1_dc:varCheck:7\", 6.4, float64_r, 0.1);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", char_r == \'R\');" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", strcmp(string_r, \":/\") == 0 );" - - // Array - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:10\", bool_array_r[0] == ET_FALSE && bool_array_r[1] == ET_FALSE);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:11\", int8_array_r[0] == 8 && int8_array_r[1] == 16);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:12\", int16_array_r[0] == 16 && int16_array_r[1] == 32);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:13\", int32_array_r[0] == 32 && int32_array_r[1] == 64);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:24\", int64_array_r[0] == 64 && int64_array_r[1] == 128);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Data_1_dc:varCheck:25_1\", 3.2f, float32_array_r[0], 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Data_1_dc:varCheck:25_2\", 6.4f, float32_array_r[1], 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId, \"Data_1_dc:varCheck:26_1\", 6.4, float64_array_r[0], 0.1);" - "EXPECT_EQUAL_FLOAT64(caseId, \"Data_1_dc:varCheck:26_2\", 12.8, float64_array_r[1], 0.1);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:27\", strcmp(char_array_r, \"ROOM\")==0);" - } - } - - DataClass Data_2_dc { - usercode1 { - "#include \"etUnit/etUnit.h\"" - } - Attribute int32_r: int32 = "1" - Attribute int32_c: int32 = "1" - Attribute int32_i: int32 = "1" - Operation varCheck2(caseId: int32): void { - "EXPECT_TRUE(caseId, \"Data_2_dc:1\", int32_r == 1);" - } - } - - DataClass Data_3_dc { - usercode1 { - "#include \"etUnit/etUnit.h\"" - } - - // none config test - Attribute primitive_ref: int32 ref - Attribute primitive_ref_array [ 2 ]: int32 ref - Attribute dataClass_array [ 2 ]: Data_2_dc - Attribute dataClass_ref: Data_2_dc ref - Attribute dataClass_ref_array [ 2 ]: Data_2_dc ref - Attribute ext_type: extType - Attribute ext_type_array [ 2 ]: extType - Attribute ext_type_ref: extType ref - Attribute ext_type_ref_array [ 2 ]: extType ref - Operation varCheck3(caseId: int32): void { - "EXPECT_TRUE(caseId, \"Data_3_dc:1\", primitive_ref == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:2\", primitive_ref_array[0] == NULL && primitive_ref_array[1] == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:3\", dataClass_ref == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_array[0].int32_r == 1 && dataClass_array[0].int32_c == 1 && dataClass_array[0].int32_i == 1);" - "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_array[1].int32_r == 1 && dataClass_array[1].int32_c == 1 && dataClass_array[1].int32_i == 1);" - "EXPECT_TRUE(caseId, \"Data_3_dc:5\", dataClass_ref == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:6\", dataClass_ref_array[0] == NULL && dataClass_ref_array[1] == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:7\", ext_type == 999);" - "EXPECT_TRUE(caseId, \"Data_3_dc:8\", ext_type_array[0] == 999 && ext_type_array[1] == 999);" - "EXPECT_TRUE(caseId, \"Data_3_dc:9\", ext_type_ref == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:10\", ext_type_ref_array[0] == NULL && dataClass_ref_array[1] == NULL);" - } - } - - Enumeration Enum_1 { - zero, - one, - two - } - - Enumeration Enum_2 of int16 { - three=3, - four - } - -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_Java.room b/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_Java.room deleted file mode 100644 index 96e43a311..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_Java.room +++ /dev/null @@ -1,393 +0,0 @@ -RoomModel StaticConfigTest { - - import room.basic.types.* from "../Types.room" - import room.basic.service.timing.* from "../TimingService.room" - - LogicalSystem System_StaticConfigTest { - SubSystemRef main : SubSystem_StaticConfigTest - } - - SubSystemClass SubSystem_StaticConfigTest { - LayerConnection ref top satisfied_by timer.timer - ActorRef top: Top_ac - ActorRef timer : ATimingService - } - - ActorClass Top_ac { - Structure { - LayerConnection ref testee_1 satisfied_by tester.spp - ActorRef testee_1: Testee_1_ac - ActorRef tester: Tester_ac - SAP timer : PTimer - } - Behavior { - ctor { - "etUnit_open(\"log/testlog\", \"StaticConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.StaticConfigTest\");" - } - dtor { - "etUnit_closeTestSuite();" - "etUnit_close();" - } - StateMachine { - Transition init: initial -> state0 { - action { - "timer.startTimeout(1000);" - } - } - Transition tr0: state0 -> state0 { - triggers { - - } - action { - "etUnit_testFinished(-1);" - } - } - State state0 - } - } - } - - ActorClass Tester_ac { - Interface { - SPP spp: TestProtocolWithDataClass - } - Structure { - ServiceImplementation of spp - ActorRef testee_super2: Testee_Super2_ac - Attribute caseId: int32 - - // none config test - Attribute data_3: Data_3_dc - } - Behavior { - StateMachine { - Transition init: initial -> s1 - State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Tester_ac\");" - "data_3.varCheck3(caseId);" - "SubSystemClassBase subSystem = (SubSystemClassBase) RTServices.getInstance().getSubSystem();" - "Testee_Super2_ac testee_super2 = (Testee_Super2_ac) subSystem.getInstance(\"/System_StaticConfigTest/main/top/tester/testee_super2\");" - "int caseId_2 = etUnit_openTestCase(\"AttrConfigTest_case_Testee_Super2_ac\");" - "testee_super2.getReg_port().varCheck(caseId_2);" - "EXPECT_TRUE(caseId_2, \"Tester_ac:1\", testee_super2.getFloat64_super_r() == 1.1);" - "EXPECT_TRUE(caseId_2, \"Tester_ac:2\", testee_super2.getFloat64_super_c() == 2.2);" - "EXPECT_TRUE(caseId_2, \"Tester_ac:3\", testee_super2.getFloat64_super_i() == 3.3);" - "EXPECT_EQUAL_FLOAT32(caseId,\"Tester_ac:4\", 25.f, testee_super2.getReg_port().getFloat_i(), 0.1f);" - "etUnit_closeTestCase(caseId);" - "etUnit_closeTestCase(caseId_2);" - } - } - } - } - } - - ActorClass Testee_1_ac { - Interface { - conjugated Port conj_port: TestProtocolAttributes - } - Structure { - ActorRef testee_2: Testee_2_ac - Attribute caseId: int32 - Attribute data_1: Data_1_dc - Attribute enumval1: Enum_1 = "one" - Attribute enumval2: Enum_2 = "four" - external Port conj_port - } - Behavior { - StateMachine { - Transition init: initial -> s1 - State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_1_ac\");" - "conj_port.varCheck();" - "data_1.varCheck1(caseId);" - "EXPECT_FALSE(caseId,\"testee_1:data_1:1\", getData_1().getBool_c());" - "EXPECT_TRUE(caseId,\"testee_1:data_1:2\", getData_1().getInt8_c() == 24);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:3\", getData_1().getInt16_c() == 48);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:4\", getData_1().getInt32_c() == 96);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:5\", getData_1().getInt64_c() == 192);" - "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:6\", 9.6f, getData_1().getFloat32_c(), 0.1f);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:7\", getData_1().getFloat64_c() == 19.2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:8\", getData_1().getChar_c() == \'C\');" - "EXPECT_TRUE(caseId,\"testee_1:data_1:9\", getData_1().getString_c().equals(\":)\"));" - "EXPECT_TRUE(caseId,\"testee_1:data_1:10\", getData_1().getBool_i());" - "EXPECT_TRUE(caseId,\"testee_1:data_1:11\", getData_1().getInt8_i() == 2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:12\", getData_1().getInt16_i() == 4);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:13\", getData_1().getInt32_i() == 8);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:14\", getData_1().getInt64_i() == 16);" - "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:15\", 1.6f, getData_1().getFloat32_i(), 0.1f);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:16\", getData_1().getFloat64_i() == 3.2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:17\", getData_1().getChar_i() == \'I\');" - "EXPECT_TRUE(caseId,\"testee_1:data_1:18\", getData_1().getString_i().equals(\":]\"));" - - // Array - "EXPECT_TRUE(caseId,\"testee_1:data_1:19\", getData_1().getBool_array_c()[0] == true && getData_1().getBool_array_c()[1] == false);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:20\", getData_1().getInt8_array_c()[0] == 24 && getData_1().getInt8_array_c()[1] == 48);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:21\", getData_1().getInt16_array_c()[0] == 48 && getData_1().getInt16_array_c()[1] == 96);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:22\", getData_1().getInt32_array_c()[0] == 96 && getData_1().getInt32_array_c()[1] == 192);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:23\", getData_1().getInt64_array_c()[0] == 192 && getData_1().getInt64_array_c()[1] == 384);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:24\", getData_1().getFloat32_array_c()[0] == 9.6f && getData_1().getFloat32_array_c()[1] == 9.6f);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:25\", getData_1().getFloat64_array_c()[0] == 19.2 && getData_1().getFloat64_array_c()[1] == 19.2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:26\", String.valueOf(getData_1().getChar_array_c()).equals(\"Claz\"));" - "EXPECT_TRUE(caseId,\"testee_1:data_1:27\", getData_1().getBool_array_i()[0] == true && getData_1().getBool_array_i()[1] == true);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:28\", getData_1().getInt8_array_i()[0] == 2 && getData_1().getInt8_array_i()[1] == 6);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:29\", getData_1().getInt16_array_i()[0] == 4 && getData_1().getInt16_array_i()[1] == 12);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:30\", getData_1().getInt32_array_i()[0] == 8 && getData_1().getInt32_array_i()[1] == 24);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:31\", getData_1().getInt64_array_i()[0] == 16 && getData_1().getInt64_array_i()[1] == 48);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:32\", getData_1().getFloat32_array_i()[0] == 1.6f && getData_1().getFloat32_array_i()[1] == 1.6f);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:33\", getData_1().getFloat64_array_i()[0] == 3.2 && getData_1().getFloat64_array_i()[1] == 3.2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:34\", String.valueOf(getData_1().getChar_array_i()).equals(\"Inst\"));" - "EXPECT_TRUE(caseId,\"testee_1:data_1:35\", getData_1().getData_2().getInt32_c() == 42);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:36\", getData_1().getData_2().getInt32_i() == 43);" - - // enums - "EXPECT_TRUE(caseId,\"testee_1:enumval1\", getEnumval1() == Enum_1.two);" - "EXPECT_TRUE(caseId,\"testee_1:enumval2\", getEnumval2() == Enum_2.three);" - "etUnit_closeTestCase(caseId);" - } - } - } - } - } - - ActorClass Testee_Super2_ac { - Interface { - Port reg_port: TestProtocolAttributes - } - Structure { - Attribute caseId: int32 - - // test - Attribute data_2: Data_2_dc - Attribute float64_super_r: float64 = "1.1" - Attribute float64_super_c: float64 = "1.1" - Attribute float64_super_i: float64 = "1.1" - external Port reg_port - } - } - - ActorClass Testee_2_ac extends Testee_Super2_ac { - Structure { - Attribute int32_own_r: int32 = "11" - Attribute int32_own_c: int32 = "11" - Attribute int32_own_i: int32 = "11" - SAP sap: TestProtocolWithDataClass - } - Behavior { - StateMachine { - Transition init: initial -> s1 - State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_2_ac\");" - "sap.varCheck(caseId);" - "reg_port.varCheck(caseId);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:1\", float64_super_c == 2.2);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:2\", float64_super_i == 4.4);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:3\", int32_own_r == 11);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:4\", int32_own_c == 12);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:5\", int32_own_i == 13);" - "EXPECT_EQUAL_FLOAT32(caseId,\"Testee_2_ac:reg_port:6\", 50.f, reg_port.getFloat_i(), 0.1f);" - "etUnit_closeTestCase(caseId);" - } - } - } - } - } - - ProtocolClass TestProtocolAttributes { - incoming { - Message dummy() - } - regular PortClass - { - Operation varCheck(caseId: int32) { - "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocolAttributes:1\", 4.f, float_r, 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocolAttributes:2\", 3.f, float_c, 0.1f);" - } - Attribute float_r: float32 = "4" - Attribute float_c: float32 = "16" - Attribute float_i: float32 = "256" - } - conjugated PortClass - { - Operation varCheck() { - "int caseId = etUnit_openTestCase(\"ConfigTest_case_PortProtocol_conjugated\");" - "EXPECT_TRUE(caseId,\"array2_r[0]: <|MODEL_LOCATION|>\", array2_r[0] == 11);" - "EXPECT_TRUE(caseId,\"array2_r[1]: <|MODEL_LOCATION|>\", array2_r[1] == 22);" - "EXPECT_TRUE(caseId,\"array2_c[0]: <|MODEL_LOCATION|>\", array2_c[0] == 16);" - "EXPECT_TRUE(caseId,\"array2_c[1]: <|MODEL_LOCATION|>\", array2_c[1] == 32);" - "EXPECT_TRUE(caseId,\"array2_i[0]: <|MODEL_LOCATION|>\", array2_i[0] == 1);" - "EXPECT_TRUE(caseId,\"array2_i[1]: <|MODEL_LOCATION|>\", array2_i[1] == 2);" - "etUnit_closeTestCase(caseId);" - } - Attribute array2_r [ 2 ]: int64 = "{11,22}" - Attribute array2_c [ 2 ]: int64 = "{0,0}" - Attribute array2_i [ 2 ]: int64 = "{0,0}" - } - } - - ProtocolClass TestProtocolWithDataClass { - incoming { - Message dummy() - } - - //SAP - conjugated PortClass - { - Operation varCheck(caseId: int32) { - "sap_data_2.varCheck2(caseId);" - "sap_data_3.varCheck3(caseId);" - "EXPECT_TRUE(caseId, \"TestProtocolWithDataClass:1\", getSap_data_2().getInt32_c() == 2);" - "EXPECT_TRUE(caseId, \"TestProtocolWithDataClass:1\", getSap_data_2().getInt32_i() == 3);" - } - Attribute sap_data_2: Data_2_dc - - // none config test - Attribute sap_data_3: Data_3_dc - } - } - - DataClass Data_Super1_dc { - - // PrimitiveType - Attribute bool_r: boolean = "false" - Attribute bool_c: boolean = "false" - Attribute bool_i: boolean = "false" - Attribute int8_r: int8 = "8" - Attribute int8_c: int8 = "8" - Attribute int8_i: int8 = "8" - - // Array - Attribute bool_array_r [ 2 ]: boolean = "{ FALSE, false }" - Attribute bool_array_c [ 2 ]: boolean = "{ false, false }" - Attribute bool_array_i [ 2 ]: boolean = "{ false, false }" - Attribute int8_array_r [ 2 ]: int8 = "{ 8, 16 }" - Attribute int8_array_c [ 2 ]: int8 = "{ 8, 16 }" - Attribute int8_array_i [ 2 ]: int8 = "{ 8, 16 }" - } - - DataClass Data_1_dc extends Data_Super1_dc { - Operation varCheck1(caseId: int32) { - "data_2.varCheck2(caseId);" - - // PrimitiveType - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:1\", bool_r == false);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:2\", int8_r == 8);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:3\", int16_r == 16);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:4\", int32_r == 32);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:5\", int64_r == 64);" - "EXPECT_EQUAL_FLOAT32(caseId,\"Data_1_dc:varCheck:6\", 3.2f, float32_r, 0.1f);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:7\", float64_r == 6.4);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", char_r == \'R\');" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:9\", string_r.equals(\":/\"));" - - // Array - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:10\", bool_array_r[0] == false && bool_array_r[1] == false);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:11\", int8_array_r[0] == 8 && int8_array_r[1] == 16);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:12\", int16_array_r[0] == 16 && int16_array_r[1] == 32);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:13\", int32_array_r[0] == 32 && int32_array_r[1] == 64);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:24\", int64_array_r[0] == 64 && int64_array_r[1] == 128);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:25\", float32_array_r[0] == 3.2f && float32_array_r[1] == 6.4f);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:26\", float64_array_r[0] == 6.4 && float64_array_r[1] == 12.8);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:27\", String.valueOf(char_array_r).equals(\"ROOM\"));" - } - Attribute int16_r: int16 = "16" - Attribute int16_c: int16 = "16" - Attribute int16_i: int16 = "16" - Attribute int32_r: int32 = "32" - Attribute int32_c: int32 = "32" - Attribute int32_i: int32 = "32" - Attribute int64_r: int64 = "64" - Attribute int64_c: int64 = "64" - Attribute int64_i: int64 = "64" - Attribute float32_r: float32 = "3.2" - Attribute float32_c: float32 = "3.2" - Attribute float32_i: float32 = "3.2" - Attribute float64_r: float64 = "6.4" - Attribute float64_c: float64 = "6.4" - Attribute float64_i: float64 = "6.4" - Attribute char_r: char = "R" - Attribute char_c: char = 'R' - Attribute char_i: char = "R" - Attribute string_r: string = ":/" - Attribute string_c: string = ":/" - Attribute string_i: string = ":/" - - // Array - Attribute int16_array_r [ 2 ]: int16 = "{ 16, 32 }" - Attribute int16_array_c [ 2 ]: int16 = "{ 16, 32 }" - Attribute int16_array_i [ 2 ]: int16 = "{ 16, 32 }" - Attribute int32_array_r [ 2 ]: int32 = "{ 32, 64 }" - Attribute int32_array_c [ 2 ]: int32 = "{ 32, 64 }" - Attribute int32_array_i [ 2 ]: int32 = "{ 32, 64 }" - Attribute int64_array_r [ 2 ]: int64 = "{ 64, 128 }" - Attribute int64_array_c [ 2 ]: int64 = "{ 64, 128 }" - Attribute int64_array_i [ 2 ]: int64 = "{ 64, 128 }" - Attribute float32_array_r [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float32_array_c [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float32_array_i [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float64_array_r [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute float64_array_c [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute float64_array_i [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute char_array_r [ 5 ]: char = "ROOM" - Attribute char_array_c [ 5 ]: char = "ROOM" - Attribute char_array_i [ 5 ]: char = "ROOM" - - // ComplexType - Attribute data_2: Data_2_dc - } - - DataClass Data_2_dc { - Operation varCheck2(caseId: int32) { - "EXPECT_TRUE(caseId, \"Data_2_dc:1\", int32_r == 1);" - } - Attribute int32_r: int32 = "1" - Attribute int32_c: int32 = "1" - Attribute int32_i: int32 = "1" - } - - DataClass Data_3_dc { - Operation varCheck3(caseId: int32) { - "EXPECT_TRUE(caseId, \"Data_3_dc:1\", dataClass_ref == null);" - "EXPECT_TRUE(caseId, \"Data_3_dc:2\", dataClass_array[0].getInt32_r() == 1);" - "EXPECT_TRUE(caseId, \"Data_3_dc:3\", dataClass_array[1].getInt32_c() == 1);" - "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_ref_array[0] == null && dataClass_ref_array[1] == null);" - "EXPECT_TRUE(caseId, \"Data_3_dc:5\", ext_type instanceof External_Type_Test);" - "EXPECT_TRUE(caseId, \"Data_3_dc:6\", ext_type_array[0] instanceof External_Type_Test && ext_type_array[1] instanceof External_Type_Test);" - "EXPECT_TRUE(caseId, \"Data_3_dc:7\", ext_type_ref == null);" - "EXPECT_TRUE(caseId, \"Data_3_dc:8\", ext_type_ref_array[0] == null && ext_type_ref_array[1] == null);" - "EXPECT_TRUE(caseId, \"Data_3_dc:9\", primitive_array_ref instanceof byte[]);" - "EXPECT_TRUE(caseId, \"Data_3_dc:10\", string_ref == null);" - } -// none config test - Attribute dataClass_array [ 2 ]: Data_2_dc - Attribute dataClass_ref: Data_2_dc ref - Attribute dataClass_ref_array [ 2 ]: Data_2_dc ref - Attribute ext_type: extType - Attribute ext_type_array [ 2 ]: extType - Attribute ext_type_ref: extType ref - Attribute ext_type_ref_array [ 2 ]: extType ref - Attribute primitive_array_ref [ 2 ]: int8 ref - Attribute string_ref: string ref - - // no check at all - Attribute primitive1_ref: int8 ref - Attribute primitive3_ref: char ref - } - - ExternalType extType -> "External_Type_Test" - - Enumeration Enum_1 { - zero, - one, - two - } - - Enumeration Enum_2 of int16 { - three=3, - four - } - -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/test.gradle b/tests/org.eclipse.etrice.generator.common.tests/test.gradle deleted file mode 100644 index e585a73a2..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/test.gradle +++ /dev/null @@ -1,98 +0,0 @@ - -ext.addTest = { lang, name, genArgs -> - def nameCap = name.capitalize() - def langCap = lang.capitalize() - def testName = "$name$langCap" - def testNameCap = testName.capitalize() - def genDir = "src-gen/$lang/$name" - def logDir = "log/$lang" - def exeFile = "$buildDir/exe/$testName/$testName" - def mainClass = "${nameCap}.Node_node_ref_SubSystem_${nameCap}Runner" - def etuFile = "$logDir/log/testlog/${nameCap}.etu" - def xmlFile = "$logDir/log/testlog/${nameCap}.xml" - def modellib = ":runtime:org.eclipse.etrice.modellib.$lang" - def generator = ":plugins:org.eclipse.etrice.generator.$lang" - def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' - - def generateTask = tasks.create(name: "generate$testNameCap", type: JavaExec) { - dependsOn "$generator:classes" - main = project(generator).mainClassName - classpath = project(generator).classpath - args '-msc_instr', '-genDir', genDir - args genArgs - environment 'etModellib', "org.eclipse.etrice.modellib.$lang" - inputs.files genArgs - outputs.dir genDir - } - - def runTask - - if(lang == 'c' || lang == 'cpp') { - model { - components { - "$testName"(NativeExecutableSpec) { - sources."$lang" { - builtBy generateTask - source { - srcDirs = [genDir] - include "**/*.$lang" - } - exportedHeaders { - srcDirs = [genDir] - } - lib project: ":runtime:org.eclipse.etrice.modellib.$lang", library: "etrice_modellib_$lang", linkage: 'static' - if(lang == 'cpp') lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' - lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' - } - binaries.all { - cCompiler.args '-g3' - cppCompiler.args '-g3' - } - } - } - } - - runTask = tasks.create(name: "run$testNameCap", type: Exec) { - dependsOn "${testName}Executable" - commandLine exeFile, '-run_as_test' - inputs.file exeFile - outputs.file etuFile - workingDir = logDir - } - } - - else if(lang == 'java') { - def testSourceSet = sourceSets.create(name) { - java.srcDirs = [genDir] - } - - dependencies { - add "${name}Compile", project(':runtime:org.eclipse.etrice.modellib.java') - add "${name}Compile", project(':runtime:org.eclipse.etrice.runtime.java') - } - - tasks.getByName("compile${nameCap}Java").dependsOn generateTask - - runTask = tasks.create(name: "run$testName", type: JavaExec) { - dependsOn "${name}Classes" - main = mainClass - classpath = testSourceSet.runtimeClasspath - args '-run_as_test' - outputs.file etuFile - workingDir = logDir - } - } - - def convertTask = tasks.create(name: "convert$testNameCap", type: JavaExec) { - dependsOn runTask, "$etUnitConverter:classes" - main = project(etUnitConverter).mainClassName - classpath = project(etUnitConverter).classpath - args etuFile - inputs.file etuFile - outputs.file xmlFile - } - - def testTask = tasks.create(name: testName, dependsOn: convertTask, group: 'verification') - check.dependsOn testTask - return testTask -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle b/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle new file mode 100644 index 000000000..f5680e988 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle @@ -0,0 +1,10 @@ +plugins { + id 'cpp' +} + +apply from: etriceTest + +def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' + +createTest('cpp', 'sendingDataTest', ['models/SendingDataTest.room', genericPhysical]) +createTest('cpp', 'initializationTest', ['models/InitializationTest.room', genericPhysical]) \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room b/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room new file mode 100644 index 000000000..633aa3b95 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room @@ -0,0 +1,104 @@ +RoomModel InitializationTest { + + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.cpp/model/Types.room" + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.cpp/model/Tests.room" + + async ActorClass InitializationTest { + @TestInstance + Structure { + usercode1 { + "struct structType {" + " int32 number;" + " structType* refStruct;" + "} typedef structType;" + "" + "class ClassType {" + "public:" + " ClassType(bool boolAttr, int32 number) : boolAttr(boolAttr), number(number) {}" + "" + " bool boolAttr;" + " int32 number;" + "};" + } + Attribute caseId : int16 + + // c/c++ struct + Attribute structAttr1: structType + Attribute structAttr2: structType = "{2, NULL}" + Attribute arrayStructAttr[2]: structType = "{{1, NULL}, {2, NULL}}" + + // static array + Attribute arrayInt32Attr1[5]: int32 + Attribute arrayInt32Attr2[5]: int32 = "" + Attribute arrayInt32Attr3[5]: int32 = "1" + Attribute arrayInt32Attr4[5]: int32 = "{1, 2, 3, 4, 5}" + + // data class + Attribute dataClassAttr1 : SubDataClass + Attribute dataClassAttr2 : SubDataClass = "true, 2" + // Attribute arrayDataClassAttr[2]: SubDataClass // = "..." init NOT possible + + // external class + Attribute extClassAttr1 : ClassType + Attribute extClassAttr2 : ClassType = "true, 2" + // Attribute arrayExtClassAttr[2] : ClassType // = "..." init NOT possible + } + Behavior { + ctor { + "caseId = etUnit_openAll(\".\", \"InitializationTest\", \"org.eclipse.etrice.generator.cpp.tests.InitializationTest\", \"InitializationTest_case\");" + "testInitValues(caseId);" + } + dtor { + "etUnit_closeAll(caseId);" + } + Operation testInitValues(caseId : int16) { + "// c/c++ struct" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, structAttr1.number);" + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", structAttr1.refStruct == NULL);" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, structAttr2.number);" + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", structAttr2.refStruct == NULL);" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, arrayStructAttr[0].number);" + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", arrayStructAttr[0].refStruct == NULL);" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, arrayStructAttr[1].number);" + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", arrayStructAttr[1].refStruct == NULL);" + "// static array" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 0, arrayInt32Attr1[0]);" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, arrayInt32Attr3[0]);" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, arrayInt32Attr4[0]);" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 5, arrayInt32Attr4[4]);" + "// data class" + "EXPECT_FALSE(caseId, \"<|MODEL_LOCATION|>\", dataClassAttr1.boolAttr);" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 0, dataClassAttr1.number);" + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", dataClassAttr2.boolAttr);" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, dataClassAttr2.number);" + "// external class" + "EXPECT_FALSE(caseId, \"<|MODEL_LOCATION|>\", extClassAttr1.boolAttr);" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 0, extClassAttr1.number);" + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", extClassAttr2.boolAttr);" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, extClassAttr2.number);" + } + + StateMachine { + State finish { + entry { + "etUnit_testFinished(caseId);" + } + } + Transition init: initial -> finish + } + } + } + + DataClass BaseDataClass { + Attribute boolAttr : boolean + } + + DataClass SubDataClass extends BaseDataClass { + Attribute number : int32 + } + + ExternalType ClassType -> "ClassType" default "false, 0" + ExternalType structType -> "structType" default "{1, NULL}" + + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/InitializationTest.room b/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/InitializationTest.room deleted file mode 100644 index 05a85ba8f..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/InitializationTest.room +++ /dev/null @@ -1,105 +0,0 @@ -RoomModel InitializationTest { - - import room.basic.types.* from "Types.room" - - import room.basic.test.* from "Tests.room" - - async ActorClass InitializationTest { - @TestInstance - Structure { - usercode1 { - "struct structType {" - " int32 number;" - " structType* refStruct;" - "} typedef structType;" - "" - "class ClassType {" - "public:" - " ClassType(bool boolAttr, int32 number) : boolAttr(boolAttr), number(number) {}" - "" - " bool boolAttr;" - " int32 number;" - "};" - } - Attribute caseId : int16 - - // c/c++ struct - Attribute structAttr1: structType - Attribute structAttr2: structType = "{2, NULL}" - Attribute arrayStructAttr[2]: structType = "{{1, NULL}, {2, NULL}}" - - // static array - Attribute arrayInt32Attr1[5]: int32 - Attribute arrayInt32Attr2[5]: int32 = "" - Attribute arrayInt32Attr3[5]: int32 = "1" - Attribute arrayInt32Attr4[5]: int32 = "{1, 2, 3, 4, 5}" - - // data class - Attribute dataClassAttr1 : SubDataClass - Attribute dataClassAttr2 : SubDataClass = "true, 2" - // Attribute arrayDataClassAttr[2]: SubDataClass // = "..." init NOT possible - - // external class - Attribute extClassAttr1 : ClassType - Attribute extClassAttr2 : ClassType = "true, 2" - // Attribute arrayExtClassAttr[2] : ClassType // = "..." init NOT possible - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"InitializationTest\", \"org.eclipse.etrice.generator.cpp.tests.InitializationTest\", \"InitializationTest_case\");" - "testInitValues(caseId);" - } - dtor { - "etUnit_closeAll(caseId);" - } - Operation testInitValues(caseId : int16) { - "// c/c++ struct" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, structAttr1.number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", structAttr1.refStruct == NULL);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, structAttr2.number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", structAttr2.refStruct == NULL);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, arrayStructAttr[0].number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", arrayStructAttr[0].refStruct == NULL);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, arrayStructAttr[1].number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", arrayStructAttr[1].refStruct == NULL);" - "// static array" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 0, arrayInt32Attr1[0]);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, arrayInt32Attr3[0]);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, arrayInt32Attr4[0]);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 5, arrayInt32Attr4[4]);" - "// data class" - "EXPECT_FALSE(caseId, \"<|MODEL_LOCATION|>\", dataClassAttr1.boolAttr);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 0, dataClassAttr1.number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", dataClassAttr2.boolAttr);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, dataClassAttr2.number);" - "// external class" - "EXPECT_FALSE(caseId, \"<|MODEL_LOCATION|>\", extClassAttr1.boolAttr);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 0, extClassAttr1.number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", extClassAttr2.boolAttr);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, extClassAttr2.number);" - } - - StateMachine { - State finish { - entry { - "etUnit_testFinished(caseId);" - } - } - Transition init: initial -> finish - } - } - } - - DataClass BaseDataClass { - Attribute boolAttr : boolean - } - - DataClass SubDataClass extends BaseDataClass { - Attribute number : int32 - } - - ExternalType ClassType -> "ClassType" default "false, 0" - ExternalType structType -> "structType" default "{1, NULL}" - - -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/empty.txt b/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/empty.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/org.eclipse.etrice.generator.java.tests/.classpath b/tests/org.eclipse.etrice.generator.java.tests/.classpath index e536cf5fa..65add28fb 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/.classpath +++ b/tests/org.eclipse.etrice.generator.java.tests/.classpath @@ -1,8 +1,12 @@ - + + + + + - + diff --git a/tests/org.eclipse.etrice.generator.java.tests/.project b/tests/org.eclipse.etrice.generator.java.tests/.project index e76db8475..8373cc3a2 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/.project +++ b/tests/org.eclipse.etrice.generator.java.tests/.project @@ -6,12 +6,12 @@ - org.eclipse.xtext.ui.shared.xtextBuilder + org.eclipse.jdt.core.javabuilder - org.eclipse.xtext.ui.shared.xtextNature + org.eclipse.jdt.core.javanature diff --git a/tests/org.eclipse.etrice.generator.java.tests/build.gradle b/tests/org.eclipse.etrice.generator.java.tests/build.gradle index 6e4f72074..0ce79733a 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.java.tests/build.gradle @@ -1,32 +1,29 @@ plugins { - id 'java' + id 'java-base' } -dependencies { - compile project(':runtime:org.eclipse.etrice.runtime.java') - compile project(':runtime:org.eclipse.etrice.modellib.java') -} +apply from: etriceTest -sourceSets { - main { - java { - srcDirs = ['src', 'src-gen'] - } - } -} +def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' -/*def createTestTasks(name, models, options) { - -}*/ +createTest('java', 'sendingDataTest', ['models/SendingDataTest.room', genericPhysical]) +createTest('java', 'staticConfigTest', ['models/StaticConfigTest.etmap', 'models/StaticConfigTest.room', 'models/StaticConfigTest.config']) +sourceSets.staticConfigTest.java.srcDir 'src/staticConfigTest' -task gen(type: JavaExec, dependsOn: ':plugins:org.eclipse.etrice.generator.java:classes') { - main = 'org.eclipse.etrice.generator.java.Main' - classpath = project(':plugins:org.eclipse.etrice.generator.java').sourceSets.main.runtimeClasspath - args 'ActorCommunicationTest.room' -} +createTest('java', 'dynamicActorTest1', ['models/DynamicActorTest1.etmap', 'models/DynamicActorTest1.room']) +createTest('java', 'dynamicActorTest2', ['models/DynamicActorTest2.etmap', 'models/DynamicActorTest2.room']) +createTest('java', 'dynamicActorTest3', ['models/DynamicActorTest3.room', genericPhysical]) +createTest('java', 'dynamicActorTest4', ['models/DynamicActorTest4.room', genericPhysical]) +createTest('java', 'dynamicActorTest5', ['models/DynamicActorTest5.room', genericPhysical]) +createTest('java', 'dynamicActorTest6', ['models/DynamicActorTest6.room', genericPhysical]) + +createTest('java', 'tCPTest', ['models/TCPTest.room', genericPhysical]) -task run(type: JavaExec, dependsOn: classes) { - main = 'DynamicActorTest1.Node_node_da1TestRunner' - classpath = sourceSets.main.runtimeClasspath - args '-run_as_test' -} \ No newline at end of file +/* These are not working yet (problem when genererating with -persistable -storeObjects the Modellib is overriden) :(( +def genOptions = ['-persistable', '-storeDataObj'] +createTest('java', 'dynamicActorTest7', ['models/DynamicActorTest7.etmap', 'models/DynamicActorTest7.room'], genOptions) +sourceSets.dynamicActorTest7.java.srcDir 'src/dynamicActorTest7' +createTest('java', 'dynamicConfigTest', ['models/DynamicConfigTest.etmap', 'models/DynamicConfigTest.room'], genOptions) +sourceSets.dynamicConfigTest.java.srcDir 'src/dynamicConfigTest' +createTest('java', 'storeRestoreTest', ['models/StoreRestoreTest.room', genericPhysical], genOptions) +sourceSets.storeRestoreTest.java.srcDir 'src/storeRestoreTest' */ \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.etmap new file mode 100644 index 000000000..760374536 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.etmap @@ -0,0 +1,11 @@ +MappingModel DynamicActorTest1 { + import DynamicActorTest1.* from "DynamicActorTest1.room" + import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + + Mapping JavaGenTests -> GenericPhysicalSystem { + SubSystemMapping da1Test -> node { + ThreadMapping defaultThread -> DefaultPhysicalThread + } + } + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room new file mode 100644 index 000000000..8701a556f --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room @@ -0,0 +1,182 @@ +RoomModel DynamicActorTest1 { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + + LogicalSystem JavaGenTests { + SubSystemRef da1Test : SubSystem_DynamicActorTest1 + } + + SubSystemClass SubSystem_DynamicActorTest1 { + ActorRef appl : Appl + + LogicalThread defaultThread + } + + ActorClass Appl { + Structure { + ActorRef cont: Container + } + Behavior { } + } + + ActorClass Container { + Structure { + conjugated Port p0: PC + Attribute caseId: int32 + optional ActorRef opt: Optional + + Binding p0 and opt.p0 + } + Behavior { + ctor { + "caseId = etUnit_openAll(\".\", \"DynamicActorTest1\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest1\", \"DynamicActorTest1_case\");" + } + dtor { + "etUnit_closeAll(caseId);" + } + + StateMachine { + Transition init: initial -> CreateOptional2 { } + Transition tr0: CreateOptional2 -> CreateOptional1 { + triggers { + + } + action { + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC3:/JavaGenTests/da1Test/appl/cont/opt/sub2/deep_sub\"));" + "opt.destroyOptionalActor();" + } + } + Transition tr2: CreateOptional1 -> ReceivedHelloAgain { + triggers { + + } + action { + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC1:/JavaGenTests/da1Test/appl/cont/opt/sub1\"));" + "opt.destroyOptionalActor();" + } + } + State CreateOptional2 { + entry { + "opt.createOptionalActor(\"Optional2\", getThread());" + "p0.sayHello();" + } + } + State CreateOptional1 { + entry { + "opt.createOptionalActor(\"Optional1\", getThread());" + "p0.sayHello();" + } + } + State ReceivedHelloAgain { + entry { + "IRTObject opt = getChild(\"opt\");" + "int size = opt.getChildren().size();" + "" + "// we expect the RTSystemPort and the InterfaceItemBroker" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, size);" + "" + "etUnit_testFinished(caseId);" + } + } + } + } + } + + // the class that is referenced as optional by the Container + // since it is abstract it just serves as an interface + abstract ActorClass Optional { + Interface { + Port p0: PC + } + Structure { } + Behavior { } + } + + // a sub class of Optional which is valid as optional actor + ActorClass Optional1 extends Optional { + Structure { + ActorRef sub1: AC1 + Binding p0 and sub1.p0 + } + Behavior { } + } + + // a sub class of Optional which is valid as optional actor + ActorClass Optional2 extends Optional { + Structure { + ActorRef sub2: AC2 + Binding p0 and sub2.p0 + } + Behavior { } + } + + // the following actor classes are part of the possible optional instance sub trees + + ActorClass AC1 { + Interface { + Port p0: PC + } + Structure { + external Port p0 + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + action { + "p0.hello(\"AC1:\"+getInstancePath());" + } + } + State Ready + } + } + } + + ActorClass AC2 { + Interface { + Port p0: PC + } + Structure { + ActorRef deep_sub: AC3 + Binding p0 and deep_sub.p0 + } + Behavior { } + } + + ActorClass AC3 { + Interface { + Port p0: PC + } + Structure { + external Port p0 + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + action { + "p0.hello(\"AC3:\"+getInstancePath());" + } + } + State Ready + } + } + } + + // a simple protocol that is used to demonstrate that actors are connected + ProtocolClass PC { + incoming { + Message sayHello() + } + outgoing { + Message hello(txt: string) + } + } +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.etmap new file mode 100644 index 000000000..e13a69c66 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.etmap @@ -0,0 +1,11 @@ +MappingModel DynamicActorTest1 { + import DynamicActorTest2.* from "DynamicActorTest2.room" + import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + + Mapping JavaGenTests -> GenericPhysicalSystem { + SubSystemMapping da2Test -> node { + ThreadMapping defaultThread -> DefaultPhysicalThread + } + } + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room new file mode 100644 index 000000000..ba0f65f9b --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room @@ -0,0 +1,236 @@ +RoomModel DynamicActorTest2 { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + + LogicalSystem JavaGenTests { + SubSystemRef da2Test : SubSystem_DynamicActorTest2 + } + + SubSystemClass SubSystem_DynamicActorTest2 { + ActorRef appl : Appl + + LogicalThread defaultThread + } + + ActorClass Appl { + Structure { + ActorRef cont: Container + } + Behavior { } + } + + ActorClass Container { + Structure { + conjugated Port p0[*]: PC + Attribute caseId: int32 + optional ActorRef optarray[*]: Optional + + Binding p0 and optarray.p0 + } + Behavior { + ctor { + "caseId = etUnit_openAll(\".\", \"DynamicActorTest2\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest2\", \"DynamicActorTest2_case\");" + } + dtor { + "etUnit_closeAll(caseId);" + } + + StateMachine { + Transition init: initial -> CreateOptional2 { } + Transition tr0: CreateOptional2 -> CreateOptional1 { + triggers { + + } + action { + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:0/sub2/deep_sub\"));" + } + } + Transition tr2: CreateOptional1 -> ReceivedHelloAgain { + triggers { + + } + action { + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:0/sub2/deep_sub\"));" + } + } + Transition tr1: ReceivedHelloAgain -> Destroy0 { + triggers { + + } + action { + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC1:/JavaGenTests/da2Test/appl/cont/optarray:1/sub1\"));" + } + } + Transition tr3: Destroy0 -> Destroy1Create2 { + triggers { + + } + action { + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC1:/JavaGenTests/da2Test/appl/cont/optarray:1/sub1\"));" + } + } + Transition tr4: Destroy1Create2 -> Done { + triggers { + + } + action { + "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:1/sub2/deep_sub\"));" + } + } + State CreateOptional2 { + entry { + "optarray.createOptionalActor(\"Optional2\", getThread());" + "p0.sayHello();" + } + } + State CreateOptional1 { + entry { + "optarray.createOptionalActor(\"Optional1\", getThread());" + "p0.sayHello();" + } + } + State ReceivedHelloAgain + State Destroy0 { + entry { + "optarray.destroyOptionalActor(0);" + "p0.sayHello();" + } + } + State Destroy1Create2 { + entry { + "optarray.destroyOptionalActor(1);" + "" + "IRTObject opt = getChild(\"optarray\");" + "int size = opt.getChildren().size();" + "" + "// we expect the RTSystemPort and the InterfaceItemBroker" + "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, size);" + "" + "optarray.createOptionalActor(\"Optional2\", getThread());" + "p0.sayHello();" + } + } + State Done { + entry { + "IRTObject opt = getChild(\"optarray\");" + "int size = opt.getChildren().size();" + "" + "// we expect the RTSystemPort and the InterfaceItemBroker" + "// plus an instance of Optional2" + "// plus 3 sub ports of RTSystemPort" + "EXPECT_EQUAL_INT32(caseId, \"\", 6, size);" + "" + "// we grab the leaf actor of the optional sub tree" + "IRTObject leafActor = getObject(\"/JavaGenTests/da2Test/appl/cont/optarray/optarray:1/sub2/deep_sub\");" + "size = leafActor.getChildren().size();" + "" + "// we expect an RTSystemPort and p0" + "EXPECT_EQUAL_INT32(caseId, \"\", 2, size);" + "" + "EXPECT_TRUE(caseId, \"\", leafActor.getInstancePath().equals(\"/JavaGenTests/da2Test/appl/cont/optarray:1/sub2/deep_sub\"));" + "" + "etUnit_testFinished(caseId);" + } + } + } + } + } + + // the class that is referenced as optional by the Container + // since it is abstract it just serves as an interface + abstract ActorClass Optional { + Interface { + Port p0: PC + } + Structure { } + Behavior { } + } + + // a sub class of Optional which is valid as optional actor + ActorClass Optional1 extends Optional { + Structure { + ActorRef sub1: AC1 + Binding p0 and sub1.p0 + } + Behavior { } + } + + // a sub class of Optional which is valid as optional actor + ActorClass Optional2 extends Optional { + Structure { + ActorRef sub2: AC2 + Binding p0 and sub2.p0 + } + Behavior { } + } + + // the following actor classes are part of the possible optional instance sub trees + + ActorClass AC1 { + Interface { + Port p0: PC + } + Structure { + external Port p0 + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + action { + "p0.hello(\"AC1:\"+getInstancePath());" + } + } + State Ready + } + } + } + + ActorClass AC2 { + Interface { + Port p0: PC + } + Structure { + ActorRef deep_sub: AC3 + Binding p0 and deep_sub.p0 + } + Behavior { } + } + + ActorClass AC3 { + Interface { + Port p0: PC + } + Structure { + external Port p0 + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + action { + "p0.hello(\"AC3:\"+getInstancePath());" + } + } + State Ready + } + } + } + + // a simple protocol that is used to demonstrate that actors are connected + ProtocolClass PC { + incoming { + Message sayHello() + } + outgoing { + Message hello(txt: string) + } + } +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room new file mode 100644 index 000000000..e757ba820 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room @@ -0,0 +1,235 @@ +RoomModel DynamicActorTest3 { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + + ActorClass Appl { + @TestInstance + Structure { + ActorRef cont: Controller + } + Behavior { } + } + + ActorClass Controller { + Structure { + conjugated Port pwrk: PWorker + conjugated Port opt: PC + Attribute caseId: int32 + ActorRef worker: Worker + Binding pwrk and worker.fct + Binding opt and worker.opt + } + Behavior { + ctor { + "caseId = etUnit_openAll(\".\", \"DynamicActorTest3\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest3\", \"DynamicActorTest3_case\");" + } + dtor { + "etUnit_closeAll(caseId);" + } + StateMachine { + Transition init: initial -> createOpt1 { } + Transition tr0: createOpt1 -> SendHello { + triggers { + + } + } + Transition tr1: SendHello -> TryCreateInvalid { + triggers { + + } + action { + "System.out.println(\"controller received \"+txt);" + } + } + Transition tr2: createOpt1 -> UnexpectedError { + triggers { + + } + } + Transition tr3: TryCreateInvalid -> ExpectedError { + triggers { + + } + } + State createOpt1 { + entry { + "pwrk.create(\"Optional1\");" + } + } + State SendHello { + entry { + "opt.sayHello();" + } + } + State TryCreateInvalid { + entry { + "pwrk.create(\"Optional\");" + } + } + State UnexpectedError + State ExpectedError { + entry { + "etUnit_testFinished(caseId);" + } + } + } + } + } + + ActorClass Worker { + Interface { + Port fct: PWorker + Port opt: PC + } + Structure { + external Port fct + optional ActorRef optRef: Optional + Binding opt and optRef.p0 + } + Behavior { + // this method prints the passed message and then dumps the object tree consisting of actors and ports + Operation dumpTree(msg: string) { + "System.out.println(msg);" + "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" + } + + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + action { + "if (optRef.createOptionalActor(ac, getThread()))" + "\tfct.ok();" + "else" + "\tfct.error();" + } + } + State Ready + } + } + } + + // the class that is referenced as optional by the Worker + // since it is abstract it just serves as an interface + abstract ActorClass Optional { + Interface { + Port p0: PC + } + Structure { } + Behavior { } + } + + // a sub class of Optional which is valid as optional actor + ActorClass Optional1 extends Optional { + Structure { + ActorRef sub1: AC1 + Binding p0 and sub1.p0 + } + Behavior { } + } + + // a sub class of Optional which is valid as optional actor + ActorClass Optional2 extends Optional { + Structure { + ActorRef sub2: AC2 + Binding p0 and sub2.p0 + } + Behavior { } + } + + // the following actor classes are part of the possible optional instance sub trees + + ActorClass AC1 { + Interface { + Port p0: PC + } + Structure { + external Port p0 + conjugated Port hlp: PC + ActorRef helper: AC3 + Binding hlp and helper.p0 + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> AskHelper { + triggers { + + } + } + Transition tr1: AskHelper -> Ready { + triggers { + + } + action { + "System.out.println(\"helper said \"+txt);" + "p0.hello(\"this is AC1, instance \"+getInstancePath());" + } + } + State Ready + State AskHelper { + entry { + "hlp.sayHello();" + } + } + } + } + } + + ActorClass AC2 { + Interface { + Port p0: PC + } + Structure { + ActorRef deep_sub: AC3 + Binding p0 and deep_sub.p0 + } + Behavior { } + } + + ActorClass AC3 { + Interface { + Port p0: PC + } + Structure { + external Port p0 + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + action { + "p0.hello(\"this is AC3, instance \"+getInstancePath());" + } + } + State Ready + } + } + } + + // a simple protocol that is used to demonstrate that actors are connected + ProtocolClass PC { + incoming { + Message sayHello() + } + outgoing { + Message hello(txt: string) + } + } + + ProtocolClass PWorker { + incoming { + Message create(ac: string) + } + outgoing { + Message ok() + Message error() + } + } +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room new file mode 100644 index 000000000..7c3b95b27 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room @@ -0,0 +1,97 @@ +RoomModel DynamicActorTest4 { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + + ActorClass Appl { + @TestInstance + Structure { + ActorRef cont: Container + } + Behavior { } + } + + ActorClass Container { + Structure { + conjugated Port p0: PC + Attribute caseId: int32 + optional ActorRef opt: Optional + + Binding p0 and opt.p0 + } + Behavior { + ctor { + "caseId = etUnit_openAll(\".\", \"DynamicActorTest4\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest4\", \"DynamicActorTest4_case\");" + } + dtor { + "etUnit_closeAll(caseId);" + } + + // this method prints the passed message and then dumps the object tree consisting of actors and ports + Operation dumpTree(msg: string) { + "System.out.println(msg);" + "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" + } + + StateMachine { + Transition init: initial -> CreateOptional { } + Transition tr0: CreateOptional -> Done { + triggers { + + } + action { + "System.out.println(txt+\"\\n\");" + "opt.destroyOptionalActor();" + "dumpTree(\"after deletion of Optional2\");" + } + } + State CreateOptional { + entry { + "opt.createOptionalActor(\"Optional\", getThread());" + "p0.sayHello();" + } + } + State Done { + entry { + "etUnit_testFinished(caseId);" + } + } + } + } + } + + // the class that is referenced as optional by the Container + // It has an external end port and implements the behavior itself + ActorClass Optional { + Interface { + Port p0: PC + } + Structure { + external Port p0 + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + action { + "p0.hello(\"this is AC1, instance \"+getInstancePath());" + } + } + State Ready + } + } + } + + // a simple protocol that is used to demonstrate that actors are connected + ProtocolClass PC { + incoming { + Message sayHello() + } + outgoing { + Message hello(txt: string) + } + } +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room new file mode 100644 index 000000000..7b761f781 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room @@ -0,0 +1,149 @@ +RoomModel DynamicActorTest5 { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + + ActorClass Appl { + @TestInstance + Structure { + ActorRef cont: Container + } + Behavior { } + } + + ActorClass Container { + Structure { + conjugated Port p0: PC + Attribute caseId: int32 + optional ActorRef opt: Optional2 + + Binding p0 and opt.p0 + } + Behavior { + ctor { + "caseId = etUnit_openAll(\".\", \"DynamicActorTest5\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest5\", \"DynamicActorTest5_case\");" + } + dtor { + "etUnit_closeAll(caseId);" + } + + // this method prints the passed message and then dumps the object tree consisting of actors and ports + Operation dumpTree(msg: string) { + "System.out.println(msg);" + "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" + } + + StateMachine { + Transition init: initial -> CreateOptional2 { } + Transition tr0: CreateOptional2 -> Done { + triggers { + + } + action { + "dumpTree(\"after received hello\");" + "" + "System.out.println(\"received \"+txt);" + "" + "etUnit_testFinished(caseId);" + } + } + State CreateOptional2 { + entry { + "opt.createOptionalActor(\"Optional2\", getThread());" + "dumpTree(\"after creation of Optional2\");" + "" + "// at this point the port isn\'t connected since" + "// the init message isn\'t processed yet" + "// - so no peer port exists" + "p0.sayHello();" + } + } + State Done + } + } + } + + ActorClass Optional1 { + Interface { + Port p0: PC + } + Structure { + ActorRef sub1: AC1 + Binding p0 and sub1.p0 + } + Behavior { } + } + + ActorClass Optional2 { + Interface { + Port p0: PC + } + Structure { + ActorRef sub2: AC2 + Binding p0 and sub2.p0 + } + Behavior { } + } + + // the following actor classes are part of the possible optional instance sub trees + + ActorClass AC1 { + Interface { + Port p0: PC + } + Structure { + external Port p0 + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + State Ready { + entry { + "p0.hello(\"this is AC1, instance \"+getInstancePath());" + } + } + } + } + } + + ActorClass AC2 { + Interface { + Port p0: PC + } + Structure { + ActorRef deep_sub: AC3 + Binding p0 and deep_sub.p0 + } + Behavior { } + } + + ActorClass AC3 { + Interface { + Port p0: PC + } + Structure { + optional ActorRef nestedOpt: Optional1 + Binding p0 and nestedOpt.p0 + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + State Ready { + entry { + "nestedOpt.createOptionalActor(\"Optional1\", getThread());" + } + } + } + } + } + + // a simple protocol that is used to demonstrate that actors are connected + ProtocolClass PC { + incoming { + Message sayHello() + } + outgoing { + Message hello(txt: string) + } + } +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room new file mode 100644 index 000000000..a38e80330 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room @@ -0,0 +1,243 @@ +RoomModel DynamicActorTest6 { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + + ActorClass Appl { + @TestInstance + Structure { + ActorRef ctrl: Controller + } + Behavior { } + } + + ActorClass Controller { + Structure { + conjugated Port pcont: PCtrl + conjugated Port pout: PC + conjugated Port pin: PC + Attribute caseId: int32 + ActorRef cont: Container + Binding pcont and cont.fct + Binding pout and cont.pin + Binding pin and cont.pout + } + Behavior { + ctor { + "caseId = etUnit_openAll(\".\", \"DynamicActorTest6\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest6\", \"DynamicActorTest6_case\");" + } + dtor { + "etUnit_closeAll(caseId);" + } + StateMachine { + Transition init: initial -> CreateOptionals { } + Transition tr0: CreateOptionals -> Sending { + triggers { + + } + } + Transition tr1: Sending -> Destroy { + triggers { + + } + action { + "System.out.println(\"Controller received: \"+txt);" + } + } + Transition tr2: Destroy -> CreateAgain { + triggers { + + } + } + Transition tr3: CreateAgain -> SendAgain { + triggers { + + } + } + Transition tr4: SendAgain -> Done { + triggers { + + } + action { + "System.out.println(\"Controller received: \"+txt);" + } + } + State CreateOptionals { + entry { + "pcont.createOpts();" + } + } + State Sending { + entry { + "pout.sayHello();" + } + } + State Done { + entry { + "etUnit_testFinished(caseId);" + } + } + State Destroy { + entry { + "pcont.destroyOpts();" + } + } + State CreateAgain { + entry { + "pcont.createOpts();" + } + } + State SendAgain { + entry { + "pout.sayHello();" + } + } + } + } + } + + ActorClass Container { + Interface { + Port fct: PCtrl + Port pout: PC + Port pin: PC + } + Structure { + external Port fct + optional ActorRef opt1: Optional1 + optional ActorRef opt2: Optional2 + Binding opt1.pout and opt2.pin + Binding pin and opt1.pin + Binding pout and opt2.pout + } + Behavior { + // this method prints the passed message and then dumps the object tree consisting of actors and ports + Operation dumpTree(msg: string) { + "System.out.println(msg);" + "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" + } + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + action { + "opt1.createOptionalActor(\"Optional1\", getThread());" + "opt2.createOptionalActor(\"Optional2\", getThread());" + "dumpTree(\"after creation of op1 and opt2\");" + "fct.done();" + } + } + Transition tr1: Ready -> Ready { + triggers { + + } + action { + "opt1.destroyOptionalActor();" + "opt2.destroyOptionalActor();" + "fct.done();" + } + } + State Ready + } + } + } + + ActorClass Optional1 { + Interface { + Port pout: PC + Port pin: PC + } + Structure { + ActorRef sub1: AC1 + Binding pin and sub1.pin + Binding pout and sub1.pout + } + Behavior { } + } + + ActorClass Optional2 { + Interface { + Port pout: PC + conjugated Port pin: PC + } + Structure { + ActorRef sub2: AC2 + Binding pout and sub2.pout + Binding pin and sub2.pin + } + Behavior { } + } + + ActorClass AC1 { + Interface { + Port pout: PC + Port pin: PC + } + Structure { + external Port pout + external Port pin + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + action { + "pout.hello(\"this is AC1, instance \"+getInstancePath());" + } + } + State Ready + } + } + } + + ActorClass AC2 { + Interface { + Port pout: PC + conjugated Port pin: PC + } + Structure { + external Port pout + external Port pin + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + action { + "System.out.println(\"AC2 received \"+txt);" + "" + "pout.hello(\"AC2: forwarding \"+txt);" + } + } + State Ready + } + } + } + + ProtocolClass PC { + incoming { + Message sayHello() + } + outgoing { + Message hello(txt: string) + } + } + + ProtocolClass PCtrl { + incoming { + Message createOpts() + Message destroyOpts() + } + outgoing { + Message done() + } + } +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.etmap new file mode 100644 index 000000000..4bd054cd2 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.etmap @@ -0,0 +1,11 @@ +MappingModel DynamicActorTest1 { + import DynamicActorTest7.* from "DynamicActorTest7.room" + import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + + Mapping JavaGenTests -> GenericPhysicalSystem { + SubSystemMapping da7Test -> node { + ThreadMapping defaultThread -> DefaultPhysicalThread + } + } + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room new file mode 100644 index 000000000..32648c0e6 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room @@ -0,0 +1,375 @@ +RoomModel DynamicActorTest7 { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + + LogicalSystem JavaGenTests { + SubSystemRef da7Test : SubSystem_DynamicActorTest7 + } + + SubSystemClass SubSystem_DynamicActorTest7 { + ActorRef main : Appl + + LogicalThread defaultThread + } + + ActorClass Appl { + Structure { + ActorRef cont: Container + } + Behavior { } + } + + ActorClass Container { + Structure { + usercode1 { + "import java.io.File;" + } + usercode2 { + "private static final String FIRST_OPT_OBJ = \"firstOpt.obj\";" + "private static final String SECOND_OPT_OBJ = \"secondOpt.obj\";" + } + conjugated Port op: PStep + conjugated Port opa [*]: PStep + + Attribute caseId: int32 + + optional ActorRef opt: Optional + optional ActorRef optarr [*]: Optional + + Binding op and opt.fct + Binding opa and optarr.fct + } + Behavior { + ctor { + "caseId = etUnit_openAll(\".\", \"DynamicActorTest7\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest7\", \"DynamicActorTest7_case\");" + } + dtor { + "etUnit_closeAll(caseId);" + } + Operation clean() { + "File f = new File(FIRST_OPT_OBJ);" + "if (f.exists())" + "\tf.delete();" + } + StateMachine { + Transition init: initial -> Init { } + Transition tr0: Init -> DestroyAndCreate { + triggers { + + } + action { + "System.out.println(\"received \"+txt);" + } + } + Transition tr1: DestroyAndCreate -> DestroyAndRestore { + triggers { + + } + action { + "System.out.println(\"received \"+txt);" + } + } + Transition tr2: DestroyAndRestore -> LoadInArray { + triggers { + + } + action { + "System.out.println(\"received \"+txt);" + } + } + Transition tr3: LoadInArray -> ReceivedHello { + triggers { + + } + action { + "System.out.println(\"received \"+txt);" + } + } + Transition tr4: ReceivedHello -> Done { + triggers { + + } + action { + "System.out.println(\"received \"+txt);" + } + } + State Init { + entry { + "clean();" + "FilePersistor.createAndLoad(opt, getThread(), FIRST_OPT_OBJ, \"Optional1\");" + "op.step();" + "op.step();" + "op.sayHello();" + } + } + State DestroyAndCreate { + entry { + "FilePersistor.saveAndDestroy(opt, FIRST_OPT_OBJ);" + "FilePersistor.createAndLoad(opt, getThread(), SECOND_OPT_OBJ, \"Optional2\");" + "op.step();" + "op.step();" + "op.sayHello();" + } + } + State DestroyAndRestore { + entry { + "FilePersistor.saveAndDestroy(opt, SECOND_OPT_OBJ);" + "FilePersistor.createAndLoad(opt, getThread(), FIRST_OPT_OBJ, \"Optional1\");" + "op.sayHello();" + } + } + State Done { + entry { + "IRTObject object = getObject(\"/JavaGenTests/da7Test/main/cont/optarr/optarr:0/sub\");" + "EXPECT_TRUE(caseId, \"object 0 of optarr is an instance of actor class Sub1\", object instanceof Sub1);" + "" + "Sub1 inst = (Sub1) object;" + "EXPECT_EQUAL_INT32(caseId, \"state\", Sub1.STATE_Step3_StepA, inst.getState());" + "EXPECT_EQUAL_INT32(caseId, \"current value of ival\", 123, inst.getIval());" + "EXPECT_EQUAL_INT16(caseId, \"current value of sval\", (short)456, inst.getSval());" + "EXPECT_EQUAL_INT8(caseId, \"current value of bval\", (byte)3, inst.getBval());" + "EXPECT_TRUE(caseId, \"changed string\", \"changed\".equals(inst.getSome()[1].getStr()));" + "EXPECT_EQUAL_FLOAT32(caseId, \"current vaue of\", 3.14159f, inst.getDerived().getSome().getFval()[2], 0.001f);" + "EXPECT_EQUAL_UINT8(caseId, \"current value of cval\", 'x', inst.getCval());" + "" + "etUnit_testFinished(caseId);" + } + } + State LoadInArray { + entry { + "FilePersistor.createAndLoad(optarr, getThread(), FIRST_OPT_OBJ, \"Optional1\");" + "FilePersistor.createAndLoad(optarr, getThread(), SECOND_OPT_OBJ, \"Optional2\");" + "opa.sayHello();" + } + } + State ReceivedHello + } + } + } + + abstract ActorClass Optional { + Interface { + Port fct: PStep + } + Structure { } + Behavior { } + } + + ActorClass Optional1 extends Optional { + Structure { + ActorRef ^sub: Sub1 + Binding fct and ^sub.fct + } + Behavior { } + } + + ActorClass Optional2 extends Optional { + Structure { + ActorRef ^sub: Sub2 + Binding fct and ^sub.fct + } + Behavior { } + } + + ActorClass Sub1Base { + Structure { + Attribute cval: char + } + } + + ActorClass Sub1 extends Sub1Base { + Interface { + Port fct: PStep + } + Structure { + external Port fct + conjugated Port dp: PStep + + Attribute ival: int32 + Attribute sval: int16 + Attribute bval: int8 + Attribute some[3]: SomeData + Attribute other: OtherData + Attribute derived: DerivedData + + ActorRef deep: DeepSub1 + Binding dp and deep.fct + } + Behavior { + StateMachine { + Transition init: initial -> Step1 { } + Transition tr0: Step1 -> Step2 { + triggers { + + } + action { + "dp.step();" + } + } + Transition tr1: Step2 -> Step3 { + triggers { + + } + action { + "dp.step();" + } + } + Transition tr2: my tp0 -> my tp0 { + triggers { + + } + action { + "fct.hello(getClassName()+\", state=\"+stateStrings[getState()]+\", path= \"+getInstancePath());" + } + } + handler TransitionPoint tp0 + State Step1 { + entry { + "ival = 1;" + "sval = 2;" + "bval = 3;" + "cval = 'x';" + } + } + State Step2 { + entry { + "ival = 123;" + "some[1].str = \"changed\";" + "derived.some.fval[2] = 3.14159f;" + } + } + State Step3 { + subgraph { + Transition init: initial -> StepA { } + Transition tr0: StepA -> StepB { + triggers { + + } + action { + "dp.step();" + } + } + Transition tr1: StepB -> StepC { + triggers { + + } + action { + "dp.step();" + } + } + State StepA { + entry { + "sval = 456;" + } + } + State StepB { + entry { + "bval = 13;" + } + } + State StepC + } + } + } + } + } + + ActorClass DeepSub1 { + Interface { + Port fct: PStep + } + Structure { + external Port fct + } + Behavior { + StateMachine { + Transition init: initial -> Step1 { } + Transition tr0: Step1 -> Step2 { + triggers { + + } + } + Transition tr1: Step2 -> Step3 { + triggers { + + } + } + Transition tr2: Step3 -> Step5 { + triggers { + + } + } + Transition tr3: Step5 -> Step6 { + triggers { + + } + } + Transition tr4: Step6 -> Step7 { + triggers { + + } + } + State Step1 + State Step2 + State Step3 + State Step5 + State Step6 + State Step7 + } + } + } + + ActorClass Sub2 { + Interface { + Port fct: PStep + } + Structure { + external Port fct + } + Behavior { + StateMachine { + Transition init: initial -> Ready { } + Transition tr0: Ready -> Ready { + triggers { + + } + } + Transition tr1: Ready -> Ready { + triggers { + + } + action { + "fct.hello(getClassName()+\", state=\"+stateStrings[getState()]+\", path= \"+getInstancePath());" + } + } + State Ready + } + } + } + + ProtocolClass PStep { + incoming { + Message step() + Message sayHello() + } + outgoing { + Message hello(txt: string) + } + } + + DataClass SomeData { + Attribute fval[3]: float32 = "1.0" + Attribute dval: float64 = "123.4" + Attribute str: string = "\"Text\"" + } + + DataClass OtherData { + Attribute some: SomeData + Attribute bval: boolean = "false" + } + + DataClass DerivedData extends OtherData { + Attribute cval[3]: char = "{'a', 'b', 'c'}" + } +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.config b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.config new file mode 100644 index 000000000..13fd8a62b --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.config @@ -0,0 +1,121 @@ +ConfigModel DynamicConfigTest { + + import DynamicConfigTest.* from "DynamicConfigTest.room" + + + SubSystemConfig System_DynamicConfigTest / main { + dynamic configuration { + user import "" + user constructor "ConfigSourceTestInstance.getInstance()" + polling interval 200 ms + } + } + + ActorClassConfig Testee_ac { + Attr aBool = false + Attr aInt8 = 0 { + min = -1 max = 59 + } + Attr aInt16 = 0 { + min = -1 max = 59 + } + Attr aInt32 = 0 { + min = -1 max = 59 + } + Attr aInt64 = 0 { + min = -1 max = 59 + } + Attr aFloat32 = 0.0 { + min = -1.0 max = 59.0 + } + Attr aFloat64 = 0.0 { + min = -1.0 max = 59.0 + } + Attr aChar = '' + Attr aString = "" + Attr aBool_array = false + Attr aInt8_array = 0 { + min = -1 max = 59 + } + Attr aInt16_array = 0 { + min = -1 max = 59 + } + Attr aInt32_array = 0 { + min = -1 max = 59 + } + Attr aInt64_array = 0 { + min = -1 max = 59 + } + Attr aFloat32_array = 0.0 { + min = -1.0 max = 59.0 + } + Attr aFloat64_array = 0.0 { + min = -1.0 max = 59.0 + } + Attr aChar_array + Attr dc { + Attr nested { + Attr aInt32 = 0 { + min = -1 max = 59 + } + } + } + } + + ActorInstanceConfig System_DynamicConfigTest / main / testee { + Attr aInt8 { + dynamic configuration read + } + Attr aInt16 { + dynamic configuration read + } + Attr aInt32 { + dynamic configuration read + } + Attr aInt64 { + dynamic configuration read + } + Attr aFloat32 { + dynamic configuration read + } + Attr aFloat64 { + dynamic configuration read + } + Attr aBool { + dynamic configuration read + } + Attr aChar { + dynamic configuration read + } + Attr aString { + dynamic configuration read + } + Attr aInt8_array { + dynamic configuration read + } + Attr aInt16_array { + dynamic configuration read + } + Attr aInt32_array { + dynamic configuration read + } + Attr aInt64_array { + dynamic configuration read + } + Attr aFloat32_array { + dynamic configuration read + } + Attr aFloat64_array { + dynamic configuration read + } + Attr aBool_array { + dynamic configuration read + } + Attr aChar_array { + dynamic configuration read + } + Attr dc { + dynamic configuration read + } + } +} diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.etmap new file mode 100644 index 000000000..3ec15a8f2 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.etmap @@ -0,0 +1,9 @@ +MappingModel DynamicConfigTest { + + import DynamicConfigTest.* from "DynamicConfigTest.room" + import room.generic.physical.* from "GenericPhysical.etphys" + + Mapping System_DynamicConfigTest -> GenericPhysicalSystem { + SubSystemMapping main -> node {} + } +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room new file mode 100644 index 000000000..f7ab9895d --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room @@ -0,0 +1,202 @@ +RoomModel DynamicConfigTest { + + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + import room.basic.service.timing.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/TimingService.room" + + LogicalSystem System_DynamicConfigTest{ + SubSystemRef main : SubSystem_DynamicConfigTest + } + + SubSystemClass SubSystem_DynamicConfigTest { + ActorRef testee: Testee_ac + ActorRef timingService: ATimingService + LayerConnection ref testee satisfied_by timingService.timer + } + + ActorClass Testee_ac { + Structure { + usercode1 { + "import java.util.HashMap;" + "import java.util.Map;" + "import org.eclipse.etrice.runtime.java.config.IConfigSource;" + } + SAP timer: PTimer + Attribute caseId: int32 + Attribute testId: int32 = "1" + + // no dynConfig + Attribute sString: string + + // dynConfig + Attribute aInt8: int8 + Attribute aInt16: int16 + Attribute aInt32: int32 + Attribute aInt64: int64 + Attribute aBool: boolean + Attribute aFloat32: float32 + Attribute aFloat64: float64 + Attribute aChar: char + Attribute aString: string + Attribute aInt8_array [ 2 ]: int8 + Attribute aInt16_array [ 2 ]: int16 + Attribute aInt32_array [ 2 ]: int32 + Attribute aInt64_array [ 2 ]: int64 + Attribute aBool_array [ 2 ]: boolean + Attribute aFloat32_array [ 2 ]: float32 + Attribute aFloat64_array [ 2 ]: float64 + Attribute aChar_array [ 2 ]: char + Attribute dc: Data_dc + } + Behavior { + ctor { + "etUnit_open(\".\", \"DynamicConfigTest\");" + "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.DynamicConfigTest\");" + "caseId = etUnit_openTestCase(\"DynamicConfigTest_case_Testee_ac\");" + } + dtor { + "etUnit_closeTestCase(caseId);" + "etUnit_closeTestSuite();" + "etUnit_close();" + } + StateMachine { + Transition t0: initial -> ChangeConfigValid { } + Transition t1: ChangeConfigValid -> Test { + triggers { + + } + action { + "testId++;" + } + } + Transition t2: Test -> ChangeConfigInvalid { + triggers { + + } + } + Transition t3: ChangeConfigInvalid -> Test { + triggers { + + } + action { + "testId++;" + } + } + Transition t4: Test -> Done { + triggers { + + } + } + Transition tr0: Test -> ChangeConfigValid { + triggers { + + } + } + State ChangeConfigValid { + entry { + "IConfigSource source = ConfigSourceTestInstance.getInstance();" + "String path = this.getInstancePath();" + "Map testValues = new HashMap();" + "testValues.put(path+\"/aInt8\", 50);" + "testValues.put(path+\"/aInt16\", 51);" + "testValues.put(path+\"/aInt32\", 52);" + "testValues.put(path+\"/aInt64\", 53);" + "testValues.put(path+\"/aFloat32\", 5.4f);" + "testValues.put(path+\"/aFloat64\", 5.5);" + "testValues.put(path+\"/aChar\", 'B');" + "testValues.put(path+\"/aString\", \"Do-NOT-UPDATE-me\");" + "testValues.put(path+\"/aBool\", true);" + "testValues.put(path+\"/dc/nested/aInt32\", 56);" + "testValues.put(path+\"/dc/aString\", \"Okay\");" + "testValues.put(path+\"/aInt8_array\", new Byte[]{50,40});" + "testValues.put(path+\"/aInt16_array\", new Short[]{51,41});" + "testValues.put(path+\"/aInt32_array\", new Integer[]{52,42});" + "testValues.put(path+\"/aInt64_array\", new Long[]{53L,43L});" + "testValues.put(path+\"/aFloat32_array\", new Float[]{5.4f, 4.4f});" + "testValues.put(path+\"/aFloat64_array\", new Double[]{5.5, 4.5});" + "testValues.put(path+\"/aChar_array\", \"BB\");" + "testValues.put(path+\"/aBool_array\", new Boolean[]{true, false});" + "source.writeValues(testValues);" + "timer.startTimer(400);" + } + } + State ChangeConfigInvalid { + entry { + // do not update aString + "getAStringLock().forbidUpdate();" + + "IConfigSource source = ConfigSourceTestInstance.getInstance();" + "String path = this.getInstancePath();" + "Map testValues = new HashMap();" + "testValues.put(path+\"/aInt8\", 128);" + "testValues.put(path+\"/aInt16\", 61);" + "testValues.put(path+\"/aInt32\", -2);" + "testValues.put(path+\"/aInt64\", Long.MAX_VALUE);" + "testValues.put(path+\"/aFloat32\", -100f);" + "testValues.put(path+\"/aFloat64\", 100d);" + "testValues.put(path+\"/aChar\", \"string\");" + "testValues.put(path+\"/aString\", \"VALID-String\");" + "testValues.put(path+\"/aBool\", \"true\");" + "testValues.put(path+\"/dc/aString\", 0.89898);" + "testValues.put(path+\"/dc/nested/aInt32\", 62);" + "testValues.put(path+\"/aInt8_array\", 128);" + "testValues.put(path+\"/aInt16_array\", new Short[]{-1,-2});" + "testValues.put(path+\"/aInt32_array\", new Integer[]{60,59});" + "testValues.put(path+\"/aInt64_array\", new Long[]{60000L,60000L});" + "testValues.put(path+\"/aFloat32_array\", new Float[]{0f, -2f});" + "testValues.put(path+\"/aFloat64_array\", \"string\");" + "testValues.put(path+\"/aChar_array\", \"BBB\");" + "testValues.put(path+\"/aBool_array\", 500);" + "source.writeValues(testValues);" + "timer.startTimer(400);" + } + } + State Test { + entry { + "EXPECT_EQUAL_INT8(caseId, \"1:Testee_ac\", (byte)50, getAInt8());" + "EXPECT_EQUAL_INT16(caseId, \"2:Testee_ac\", (short)51, getAInt16());" + "EXPECT_EQUAL_INT32(caseId, \"3:Testee_ac\", 52, getAInt32());" + "EXPECT_TRUE(caseId, \"4:Testee_ac\", getAInt64() == 53L);" + "EXPECT_EQUAL_FLOAT32(caseId, \"5:Testee_ac\", 5.4f, getAFloat32(), 0.1f);" + "EXPECT_TRUE(caseId, \"6:Testee_ac\", getAFloat64() == 5.5);" + "EXPECT_TRUE(caseId, \"7:Testee_ac\", getAChar() == 'B');" + "EXPECT_TRUE(caseId, \"8:Testee_ac\", \"Do-NOT-UPDATE-me\".equals(getAString()));" + "EXPECT_TRUE(caseId, \"9:Testee_ac\", getABool() == true);" + "EXPECT_TRUE(caseId, \"10:Testee_ac\", getAInt8_array()[0] == 50 && getAInt8_array()[1] == 40);" + "EXPECT_TRUE(caseId, \"11:Testee_ac\", getAInt16_array()[0] == 51 && getAInt16_array()[1] == 41);" + "EXPECT_TRUE(caseId, \"12:Testee_ac\", getAInt32_array()[0] == 52 && getAInt32_array()[1] == 42);" + "EXPECT_TRUE(caseId, \"13:Testee_ac\", getAInt64_array()[0] == 53L && getAInt64_array()[1] == 43L);" + "EXPECT_EQUAL_FLOAT32(caseId, \"14.1:Testee_ac\", 5.4f, getAFloat32_array()[0], 0.1f);" + "EXPECT_EQUAL_FLOAT32(caseId, \"14.2:Testee_ac\", 4.4f, getAFloat32_array()[1], 0.1f);" + "EXPECT_TRUE(caseId, \"15:Testee_ac\", getAFloat64_array()[0] == 5.5 && getAFloat64_array()[1] == 4.5);" + "EXPECT_TRUE(caseId, \"16:Testee_ac\", String.valueOf(getAChar_array()).equals(\"BB\"));" + "EXPECT_TRUE(caseId, \"18:Testee_ac\", getABool_array()[0] == true && getABool_array()[1] == false);" + "EXPECT_TRUE(caseId, \"19:Testee_ac\", \"Okay\".equals(getDc().getAString()));" + "EXPECT_TRUE(caseId, \"20:Testee_ac\", getDc().getNested().getAInt32() == 56);" + "timer.startTimer(1);" + } + } + State Done { + entry { + "\tetUnit_testFinished(caseId);" + } + } + } + } + } + + DataClass Data_dc { + Attribute aString:string + Attribute nested: Data_nested_dc + } + + DataClass Data_nested_dc { + Attribute aInt32: int32 + } + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.rt-config b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.rt-config new file mode 100644 index 000000000..c27ad68cf --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.rt-config @@ -0,0 +1,20 @@ +/System_DynConfigTest/subSystem/testee/aBool=true +/System_DynConfigTest/subSystem/testee/aBool_array={ true,false } +/System_DynConfigTest/subSystem/testee/aChar="B" +/System_DynConfigTest/subSystem/testee/aChar_array="BB" +/System_DynConfigTest/subSystem/testee/aFloat32=5.4 +/System_DynConfigTest/subSystem/testee/aFloat32_array={ 5.4,4.4 } +/System_DynConfigTest/subSystem/testee/aFloat64=5.5 +/System_DynConfigTest/subSystem/testee/aFloat64_array={ 5.5,4.5 } +/System_DynConfigTest/subSystem/testee/aInt16=51 +/System_DynConfigTest/subSystem/testee/aInt16_array={ 51,41 } +/System_DynConfigTest/subSystem/testee/aInt32=52 +/System_DynConfigTest/subSystem/testee/aInt32_array={ 52,42 } +/System_DynConfigTest/subSystem/testee/aInt64=53 +/System_DynConfigTest/subSystem/testee/aInt64_array={ 53,43 } +/System_DynConfigTest/subSystem/testee/aInt8=50 +/System_DynConfigTest/subSystem/testee/aInt8_array={ 50,40 } +/System_DynConfigTest/subSystem/testee/aString="Do-NOT-UPDATE-me" +/System_DynConfigTest/subSystem/testee/dc/aString="Okay" +/System_DynConfigTest/subSystem/testee/dc/nested/aInt32=56 +polling_timer[ms]=200 diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room new file mode 100644 index 000000000..bf9b8f9c5 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room @@ -0,0 +1,217 @@ +RoomModel StoreRestoreTest { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + + ActorClass StoreRestore_Top { + @TestInstance + Structure { + ActorRef tester: Tester + ActorRef testee: Testee + Binding tester.prt and testee.prt + } + Behavior { } + } + + ActorClass Testee { + Interface { + Port prt: PC + } + Structure { + usercode1 { "import StoreRestore.ObjectHolder;" } + + external Port prt + + Attribute ival: int16 + Attribute iarr [ 3 ]: int32 + Attribute sdval: SomeData + Attribute sdarr [ 5 ]: SomeData + Attribute cdval: ComplexData + } + Behavior { + Operation doStore() { + "System.out.println(\"doStore()\");" + "IActorClassDataObject dataObject = newDataObject();" + "store(dataObject);" + "ObjectHolder.setObject(dataObject);" + } + Operation doRestore() { + "System.out.println(\"doRestore()\");" + "IActorClassDataObject dataObject = ObjectHolder.getObject();" + "restore(dataObject);" + } + StateMachine { + Transition tr0: my tp0 -> Restore { + triggers { + + } + } + Transition init: initial -> Begin { } + Transition tr1: Begin -> Store { + triggers { + + } + } + Transition tr2: Store -> state2 { + triggers { + + } + } + Transition tr3: state2 -> state3 { + triggers { + + } + } + TransitionPoint tp0 + State Begin { + entry { + "ival = 3;" + } + } + State Store { + entry { + "System.out.println(\"<|MODEL_LOCATION|>\");" + "setFinalAction(new SingleFinalAction() {" + "\tpublic void run() {" + "\t\tdoStore();" + "\t}" + "});" + } + } + State state2 { + entry { + "prt.valueIs(ival);" + "" + "ival = 123;" + } + } + State Restore { + entry { + "System.out.println(\"<|MODEL_LOCATION|>\");" + "setFinalAction(new SingleFinalAction() {" + "\tpublic void run() {" + "\t\tdoRestore();" + "\t}" + "});" + } + } + State state3 { + entry { + "ival = 456;" + "" + "prt.answer();" + } + } + } + } + } + + ActorClass Tester { + Interface { + conjugated Port prt: PC + } + Structure { + external Port prt + + Attribute caseId: int32 + Attribute counter: int32 = "0" + } + Behavior { + ctor { + "caseId = etUnit_openAll(\".\", \"StoreRestoreTest\", \"org.eclipse.etrice.generator.common.tests.StoreRestoreTest\", \"StoreRestoreTest_case\");" + } + dtor { + "etUnit_closeAll(caseId);" + } + + StateMachine { + Transition init: initial -> Prepare { } + Transition tr1: Loop2 -> cp cp0 { + triggers { + + } + } + Transition tr2: cp cp0 -> Done + Transition tr3: cp cp0 -> Loop { + cond { + "++counter<10" + } + } + Transition tr0: Prepare -> Prepare2 { + triggers { + + } + action { + "EXPECT_EQUAL_INT16(caseId, \"check old value <|MODEL_LOCATION|>\", (short)3, val);" + } + } + Transition tr4: Prepare2 -> Loop { + triggers { + + } + } + Transition tr5: Loop -> Loop2 { + triggers { + + } + action { + "EXPECT_EQUAL_INT16(caseId, \"check old value <|MODEL_LOCATION|>\", (short)3, val);" + } + } + ChoicePoint cp0 + State Prepare { + entry { + "prt.step();" + "prt.step();" + } + } + State Loop { + entry { + "prt.restore();" + "" + "prt.step();" + "prt.step();" + } + } + State Done { + entry { + "etUnit_testFinished(caseId);" + } + } + State Prepare2 { + entry { + "prt.step();" + } + } + State Loop2 { + entry { + "prt.step();" + } + } + } + } + } + + ProtocolClass PC { + incoming { + Message step() + Message restore() + } + outgoing { + Message answer() + Message valueIs(val: int16) + } + } + + DataClass SomeData { + Attribute ival: int16 + Attribute iarr [ 3 ]: int32 + } + + DataClass ComplexData { + Attribute sdval: SomeData + Attribute sdarr [ 5 ]: SomeData + } + + PrimitiveType int16: ptInteger -> 'short' (Short) default '0' + PrimitiveType int32: ptInteger -> 'int' (Integer) default '0' +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room new file mode 100644 index 000000000..6671d6d3d --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room @@ -0,0 +1,160 @@ +RoomModel TCPTest { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + import room.basic.service.tcp.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/TcpService.room" + + ActorClass TCPTestTop { + @TestInstance + Structure { + ActorRef ref0: ATcpServer + ActorRef ref1 [ 5 ]: ATcpClient + ActorRef ref2: Tester + Binding ref2.p1 and ref0.PayloadPort + Binding ref2.p0 and ref0.ControlPort + Binding ref2.p2 and ref1.ControlPort + Binding ref2.p3 and ref1.PayloadPort + } + Behavior { } + } + + ActorClass Tester { + Interface { + conjugated Port p0: PTcpControl + conjugated Port p1: PTcpPayload + conjugated Port p2 [*]: PTcpControl + conjugated Port p3 [5]: PTcpPayload + } + Structure { + external Port p0 + external Port p1 + external Port p2 + external Port p3 + Attribute controlData:DTcpControl + Attribute testData:DTcpPayload + Attribute counter:int32 + Attribute resultPattern:int32 + Attribute pattern:int32 + Attribute caseId: int32 + Attribute resultlist[3]: int16 = "{1,2,3}" + + } + Behavior { + ctor { + "caseId = etUnit_openAll(\".\", \"TCPTest\", \"org.eclipse.etrice.generator.common.tests.TCPTest\", \"TCPTest_case\");" + } + dtor { + "etUnit_closeAll(caseId);" + } + StateMachine { + Transition init: initial -> state0 { + action { + "EXPECT_ORDER_START(caseId,resultlist,3);" + "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" + "// open Server" + "controlData.setIPAddr(\"127.0.0.1\");" + "controlData.setTcpPort(4711);" + "p0.open(controlData);" + } + } + Transition tr0: state0 -> state1 { + triggers { + + } + action { + "// open 5 clients" + "for (int i=0;i cp cp0 { + triggers { + + } + action { + "counter++;" + } + } + Transition tr4: cp cp0 -> state1 + Transition tr5: cp cp0 -> state2 { + cond { + "counter>=p2.getReplication()" + } + action { + "String s=new String (\"Test!\");" + "testData.setData(s.getBytes());" + "testData.setLength(s.length());" + "testData.setConnectionId(0);" + "for (int i=0; i cp cp2 { + triggers { + + } + action { + "resultPattern+=p3.getIndexOf(ifitem);" + "//System.out.printf(\"c:%d, Idx:%d!\\n\", counter,p3.getIndexOf(ifitem));" + "counter++;" + } + } + Transition tr9: cp cp2 -> state2 + Transition tr10: cp cp2 -> cp cp1 { + cond { + "counter>=p2.getReplication()" + } + action { + "int i;" + "p0.close();" + "// close all clients" + "p2.close();" + "pattern=0;" + "for (i=0;i state2 { + triggers { + + } + action { + "p1.send(data);" + } + } + Transition tr2: cp cp1 -> test_failed + Transition tr6: cp cp1 -> test_ok { + cond { + "pattern==resultPattern" + } + } + ChoicePoint cp0 + ChoicePoint cp2 + ChoicePoint cp1 + State state0 + State state1 + State state2 + State test_ok { + entry { + "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" + "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 3);" + "etUnit_testFinished(caseId);" + } + } + State test_failed { + entry { + "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 3);" + "etUnit_testFinished(caseId);" + } + } + } + } + } +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/DynamicActorTest7/FilePersistor.java b/tests/org.eclipse.etrice.generator.java.tests/src/DynamicActorTest7/FilePersistor.java deleted file mode 100644 index eb1530117..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/src/DynamicActorTest7/FilePersistor.java +++ /dev/null @@ -1,136 +0,0 @@ -package DynamicActorTest7; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.eclipse.etrice.runtime.java.modelbase.ReplicatedOptionalActorInterfaceBase; -import org.eclipse.etrice.runtime.java.modelbase.ScalarOptionalActorInterfaceBase; - -public class FilePersistor { - - public static boolean createAndLoad(ScalarOptionalActorInterfaceBase opt, int thread, String fname, String actorClass) { - boolean success = false; - FileInputStream fin = null; - ObjectInputStream ois = null; - try { - fin = new FileInputStream(fname); - ois = new ObjectInputStream(fin); - - success = opt.createOptionalActor(actorClass, thread, ois); - } - catch (FileNotFoundException e) { - success = opt.createOptionalActor(actorClass, thread); - } - catch (IOException e) { - e.printStackTrace(); - } - finally { - try { - if (ois!=null) - ois.close(); - if (fin!=null) - fin.close(); - } - catch (IOException e) { - e.printStackTrace(); - } - } - - return success; - } - - public static boolean saveAndDestroy(ScalarOptionalActorInterfaceBase opt, String fname) { - boolean success = false; - FileOutputStream fout = null; - ObjectOutputStream oos = null; - try { - fout = new FileOutputStream(fname); - oos = new ObjectOutputStream(fout); - success = opt.destroyOptionalActor(oos); - } - catch (FileNotFoundException e) { - success = opt.destroyOptionalActor(); - } - catch (IOException e) { - e.printStackTrace(); - } - finally { - try { - if (oos!=null) - oos.close(); - if (fout!=null) - fout.close(); - } - catch (IOException e) { - e.printStackTrace(); - } - } - - return success; - } - - public static int createAndLoad(ReplicatedOptionalActorInterfaceBase opt, int thread, String fname, String actorClass) { - int idx = -1; - FileInputStream fin = null; - ObjectInputStream ois = null; - try { - fin = new FileInputStream(fname); - ois = new ObjectInputStream(fin); - - idx = opt.createOptionalActor(actorClass, thread, ois); - } - catch (FileNotFoundException e) { - idx = opt.createOptionalActor(actorClass, thread); - } - catch (IOException e) { - e.printStackTrace(); - } - finally { - try { - if (ois!=null) - ois.close(); - if (fin!=null) - fin.close(); - } - catch (IOException e) { - e.printStackTrace(); - } - } - - return idx; - } - - public static boolean saveAndDestroy(ReplicatedOptionalActorInterfaceBase opt, String fname, int idx) { - boolean success = false; - FileOutputStream fout = null; - ObjectOutputStream oos = null; - try { - fout = new FileOutputStream(fname); - oos = new ObjectOutputStream(fout); - success = opt.destroyOptionalActor(idx, oos); - } - catch (FileNotFoundException e) { - success = opt.destroyOptionalActor(idx); - } - catch (IOException e) { - e.printStackTrace(); - } - finally { - try { - if (oos!=null) - oos.close(); - if (fout!=null) - fout.close(); - } - catch (IOException e) { - e.printStackTrace(); - } - } - - return success; - } -} diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/DynamicConfigTest/ConfigSourceTestInstance.java b/tests/org.eclipse.etrice.generator.java.tests/src/DynamicConfigTest/ConfigSourceTestInstance.java deleted file mode 100644 index 5d7b3f846..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/src/DynamicConfigTest/ConfigSourceTestInstance.java +++ /dev/null @@ -1,16 +0,0 @@ -package DynamicConfigTest; - -import org.eclipse.etrice.runtime.java.config.ConfigSourceFile; -import org.eclipse.etrice.runtime.java.config.IConfigSource; - -public class ConfigSourceTestInstance { - - private static IConfigSource instance = null; - - public static IConfigSource getInstance(){ - if(instance == null){ - instance = new ConfigSourceFile("models/DynamicConfigTest_Java.rt-config"); - } - return instance; - } -} diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/StaticConfigTest/External_Type_Test.java b/tests/org.eclipse.etrice.generator.java.tests/src/StaticConfigTest/External_Type_Test.java deleted file mode 100644 index 1798235ce..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/src/StaticConfigTest/External_Type_Test.java +++ /dev/null @@ -1,9 +0,0 @@ -package StaticConfigTest; - -public class External_Type_Test { - - // deep copy - public External_Type_Test deepCopy() { - return new External_Type_Test(); - } -} diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/StoreRestore/ObjectHolder.java b/tests/org.eclipse.etrice.generator.java.tests/src/StoreRestore/ObjectHolder.java deleted file mode 100644 index 18df93cb5..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/src/StoreRestore/ObjectHolder.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * hrentz (initial contribution) - * - *******************************************************************************/ - -package StoreRestore; - -import org.eclipse.etrice.runtime.java.modelbase.IActorClassDataObject; - -/** - * @author hrentz - * - */ -public class ObjectHolder { - - private static IActorClassDataObject object = null; - - public static IActorClassDataObject getObject() { - return object; - } - - public static void setObject(IActorClassDataObject object) { - ObjectHolder.object = object; - } -} diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/dynamicActorTest7/DynamicActorTest7/FilePersistor.java b/tests/org.eclipse.etrice.generator.java.tests/src/dynamicActorTest7/DynamicActorTest7/FilePersistor.java new file mode 100644 index 000000000..eb1530117 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/src/dynamicActorTest7/DynamicActorTest7/FilePersistor.java @@ -0,0 +1,136 @@ +package DynamicActorTest7; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +import org.eclipse.etrice.runtime.java.modelbase.ReplicatedOptionalActorInterfaceBase; +import org.eclipse.etrice.runtime.java.modelbase.ScalarOptionalActorInterfaceBase; + +public class FilePersistor { + + public static boolean createAndLoad(ScalarOptionalActorInterfaceBase opt, int thread, String fname, String actorClass) { + boolean success = false; + FileInputStream fin = null; + ObjectInputStream ois = null; + try { + fin = new FileInputStream(fname); + ois = new ObjectInputStream(fin); + + success = opt.createOptionalActor(actorClass, thread, ois); + } + catch (FileNotFoundException e) { + success = opt.createOptionalActor(actorClass, thread); + } + catch (IOException e) { + e.printStackTrace(); + } + finally { + try { + if (ois!=null) + ois.close(); + if (fin!=null) + fin.close(); + } + catch (IOException e) { + e.printStackTrace(); + } + } + + return success; + } + + public static boolean saveAndDestroy(ScalarOptionalActorInterfaceBase opt, String fname) { + boolean success = false; + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try { + fout = new FileOutputStream(fname); + oos = new ObjectOutputStream(fout); + success = opt.destroyOptionalActor(oos); + } + catch (FileNotFoundException e) { + success = opt.destroyOptionalActor(); + } + catch (IOException e) { + e.printStackTrace(); + } + finally { + try { + if (oos!=null) + oos.close(); + if (fout!=null) + fout.close(); + } + catch (IOException e) { + e.printStackTrace(); + } + } + + return success; + } + + public static int createAndLoad(ReplicatedOptionalActorInterfaceBase opt, int thread, String fname, String actorClass) { + int idx = -1; + FileInputStream fin = null; + ObjectInputStream ois = null; + try { + fin = new FileInputStream(fname); + ois = new ObjectInputStream(fin); + + idx = opt.createOptionalActor(actorClass, thread, ois); + } + catch (FileNotFoundException e) { + idx = opt.createOptionalActor(actorClass, thread); + } + catch (IOException e) { + e.printStackTrace(); + } + finally { + try { + if (ois!=null) + ois.close(); + if (fin!=null) + fin.close(); + } + catch (IOException e) { + e.printStackTrace(); + } + } + + return idx; + } + + public static boolean saveAndDestroy(ReplicatedOptionalActorInterfaceBase opt, String fname, int idx) { + boolean success = false; + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try { + fout = new FileOutputStream(fname); + oos = new ObjectOutputStream(fout); + success = opt.destroyOptionalActor(idx, oos); + } + catch (FileNotFoundException e) { + success = opt.destroyOptionalActor(idx); + } + catch (IOException e) { + e.printStackTrace(); + } + finally { + try { + if (oos!=null) + oos.close(); + if (fout!=null) + fout.close(); + } + catch (IOException e) { + e.printStackTrace(); + } + } + + return success; + } +} diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/dynamicConfigTest/DynamicConfigTest/ConfigSourceTestInstance.java b/tests/org.eclipse.etrice.generator.java.tests/src/dynamicConfigTest/DynamicConfigTest/ConfigSourceTestInstance.java new file mode 100644 index 000000000..5d7b3f846 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/src/dynamicConfigTest/DynamicConfigTest/ConfigSourceTestInstance.java @@ -0,0 +1,16 @@ +package DynamicConfigTest; + +import org.eclipse.etrice.runtime.java.config.ConfigSourceFile; +import org.eclipse.etrice.runtime.java.config.IConfigSource; + +public class ConfigSourceTestInstance { + + private static IConfigSource instance = null; + + public static IConfigSource getInstance(){ + if(instance == null){ + instance = new ConfigSourceFile("models/DynamicConfigTest_Java.rt-config"); + } + return instance; + } +} diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/staticConfigTest/StaticConfigTest/External_Type_Test.java b/tests/org.eclipse.etrice.generator.java.tests/src/staticConfigTest/StaticConfigTest/External_Type_Test.java new file mode 100644 index 000000000..1798235ce --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/src/staticConfigTest/StaticConfigTest/External_Type_Test.java @@ -0,0 +1,9 @@ +package StaticConfigTest; + +public class External_Type_Test { + + // deep copy + public External_Type_Test deepCopy() { + return new External_Type_Test(); + } +} diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/storeRestoreTest/StoreRestoreTest/ObjectHolder.java b/tests/org.eclipse.etrice.generator.java.tests/src/storeRestoreTest/StoreRestoreTest/ObjectHolder.java new file mode 100644 index 000000000..ef6d75958 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/src/storeRestoreTest/StoreRestoreTest/ObjectHolder.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * hrentz (initial contribution) + * + *******************************************************************************/ + +package StoreRestoreTest; + +import org.eclipse.etrice.runtime.java.modelbase.IActorClassDataObject; + +import StoreRestoreTest.ObjectHolder; + +/** + * @author hrentz + * + */ +public class ObjectHolder { + + private static IActorClassDataObject object = null; + + public static IActorClassDataObject getObject() { + return object; + } + + public static void setObject(IActorClassDataObject object) { + ObjectHolder.object = object; + } +} diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.etmap b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.etmap deleted file mode 100644 index e50d57a44..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.etmap +++ /dev/null @@ -1,11 +0,0 @@ -MappingModel DynamicActorTest1 { - import DynamicActorTest1.* from "DynamicActorTest1.room" - import room.generic.physical.* from "GenericPhysical.etphys" - - Mapping JavaGenTests -> GenericPhysicalSystem { - SubSystemMapping da1Test -> node { - ThreadMapping defaultThread -> DefaultPhysicalThread - } - } - -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.room deleted file mode 100644 index 65fccd5ca..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.room +++ /dev/null @@ -1,182 +0,0 @@ -RoomModel DynamicActorTest1 { - - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" - - LogicalSystem JavaGenTests { - SubSystemRef da1Test : SubSystem_DynamicActorTest1 - } - - SubSystemClass SubSystem_DynamicActorTest1 { - ActorRef appl : Appl - - LogicalThread defaultThread - } - - ActorClass Appl { - Structure { - ActorRef cont: Container - } - Behavior { } - } - - ActorClass Container { - Structure { - conjugated Port p0: PC - Attribute caseId: int32 - optional ActorRef opt: Optional - - Binding p0 and opt.p0 - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest1\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest1\", \"DynamicActorTest1_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - - StateMachine { - Transition init: initial -> CreateOptional2 { } - Transition tr0: CreateOptional2 -> CreateOptional1 { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC3:/JavaGenTests/da1Test/appl/cont/opt/sub2/deep_sub\"));" - "opt.destroyOptionalActor();" - } - } - Transition tr2: CreateOptional1 -> ReceivedHelloAgain { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC1:/JavaGenTests/da1Test/appl/cont/opt/sub1\"));" - "opt.destroyOptionalActor();" - } - } - State CreateOptional2 { - entry { - "opt.createOptionalActor(\"Optional2\", getThread());" - "p0.sayHello();" - } - } - State CreateOptional1 { - entry { - "opt.createOptionalActor(\"Optional1\", getThread());" - "p0.sayHello();" - } - } - State ReceivedHelloAgain { - entry { - "IRTObject opt = getChild(\"opt\");" - "int size = opt.getChildren().size();" - "" - "// we expect the RTSystemPort and the InterfaceItemBroker" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, size);" - "" - "etUnit_testFinished(caseId);" - } - } - } - } - } - - // the class that is referenced as optional by the Container - // since it is abstract it just serves as an interface - abstract ActorClass Optional { - Interface { - Port p0: PC - } - Structure { } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional1 extends Optional { - Structure { - ActorRef sub1: AC1 - Binding p0 and sub1.p0 - } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional2 extends Optional { - Structure { - ActorRef sub2: AC2 - Binding p0 and sub2.p0 - } - Behavior { } - } - - // the following actor classes are part of the possible optional instance sub trees - - ActorClass AC1 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"AC1:\"+getInstancePath());" - } - } - State Ready - } - } - } - - ActorClass AC2 { - Interface { - Port p0: PC - } - Structure { - ActorRef deep_sub: AC3 - Binding p0 and deep_sub.p0 - } - Behavior { } - } - - ActorClass AC3 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"AC3:\"+getInstancePath());" - } - } - State Ready - } - } - } - - // a simple protocol that is used to demonstrate that actors are connected - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.etmap b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.etmap deleted file mode 100644 index dcc7fb88d..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.etmap +++ /dev/null @@ -1,11 +0,0 @@ -MappingModel DynamicActorTest1 { - import DynamicActorTest2.* from "DynamicActorTest2.room" - import room.generic.physical.* from "GenericPhysical.etphys" - - Mapping JavaGenTests -> GenericPhysicalSystem { - SubSystemMapping da2Test -> node { - ThreadMapping defaultThread -> DefaultPhysicalThread - } - } - -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.room deleted file mode 100644 index e4c9a709c..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.room +++ /dev/null @@ -1,236 +0,0 @@ -RoomModel DynamicActorTest2 { - - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" - - LogicalSystem JavaGenTests { - SubSystemRef da2Test : SubSystem_DynamicActorTest2 - } - - SubSystemClass SubSystem_DynamicActorTest2 { - ActorRef appl : Appl - - LogicalThread defaultThread - } - - ActorClass Appl { - Structure { - ActorRef cont: Container - } - Behavior { } - } - - ActorClass Container { - Structure { - conjugated Port p0[*]: PC - Attribute caseId: int32 - optional ActorRef optarray[*]: Optional - - Binding p0 and optarray.p0 - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest2\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest2\", \"DynamicActorTest2_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - - StateMachine { - Transition init: initial -> CreateOptional2 { } - Transition tr0: CreateOptional2 -> CreateOptional1 { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:0/sub2/deep_sub\"));" - } - } - Transition tr2: CreateOptional1 -> ReceivedHelloAgain { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:0/sub2/deep_sub\"));" - } - } - Transition tr1: ReceivedHelloAgain -> Destroy0 { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC1:/JavaGenTests/da2Test/appl/cont/optarray:1/sub1\"));" - } - } - Transition tr3: Destroy0 -> Destroy1Create2 { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC1:/JavaGenTests/da2Test/appl/cont/optarray:1/sub1\"));" - } - } - Transition tr4: Destroy1Create2 -> Done { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", txt.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:1/sub2/deep_sub\"));" - } - } - State CreateOptional2 { - entry { - "optarray.createOptionalActor(\"Optional2\", getThread());" - "p0.sayHello();" - } - } - State CreateOptional1 { - entry { - "optarray.createOptionalActor(\"Optional1\", getThread());" - "p0.sayHello();" - } - } - State ReceivedHelloAgain - State Destroy0 { - entry { - "optarray.destroyOptionalActor(0);" - "p0.sayHello();" - } - } - State Destroy1Create2 { - entry { - "optarray.destroyOptionalActor(1);" - "" - "IRTObject opt = getChild(\"optarray\");" - "int size = opt.getChildren().size();" - "" - "// we expect the RTSystemPort and the InterfaceItemBroker" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, size);" - "" - "optarray.createOptionalActor(\"Optional2\", getThread());" - "p0.sayHello();" - } - } - State Done { - entry { - "IRTObject opt = getChild(\"optarray\");" - "int size = opt.getChildren().size();" - "" - "// we expect the RTSystemPort and the InterfaceItemBroker" - "// plus an instance of Optional2" - "// plus 3 sub ports of RTSystemPort" - "EXPECT_EQUAL_INT32(caseId, \"\", 6, size);" - "" - "// we grab the leaf actor of the optional sub tree" - "IRTObject leafActor = getObject(\"/JavaGenTests/da2Test/appl/cont/optarray/optarray:1/sub2/deep_sub\");" - "size = leafActor.getChildren().size();" - "" - "// we expect an RTSystemPort and p0" - "EXPECT_EQUAL_INT32(caseId, \"\", 2, size);" - "" - "EXPECT_TRUE(caseId, \"\", leafActor.getInstancePath().equals(\"/JavaGenTests/da2Test/appl/cont/optarray:1/sub2/deep_sub\"));" - "" - "etUnit_testFinished(caseId);" - } - } - } - } - } - - // the class that is referenced as optional by the Container - // since it is abstract it just serves as an interface - abstract ActorClass Optional { - Interface { - Port p0: PC - } - Structure { } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional1 extends Optional { - Structure { - ActorRef sub1: AC1 - Binding p0 and sub1.p0 - } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional2 extends Optional { - Structure { - ActorRef sub2: AC2 - Binding p0 and sub2.p0 - } - Behavior { } - } - - // the following actor classes are part of the possible optional instance sub trees - - ActorClass AC1 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"AC1:\"+getInstancePath());" - } - } - State Ready - } - } - } - - ActorClass AC2 { - Interface { - Port p0: PC - } - Structure { - ActorRef deep_sub: AC3 - Binding p0 and deep_sub.p0 - } - Behavior { } - } - - ActorClass AC3 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"AC3:\"+getInstancePath());" - } - } - State Ready - } - } - } - - // a simple protocol that is used to demonstrate that actors are connected - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest3.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest3.room deleted file mode 100644 index 985383f18..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest3.room +++ /dev/null @@ -1,235 +0,0 @@ -RoomModel DynamicActorTest3 { - - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" - - ActorClass Appl { - @TestInstance - Structure { - ActorRef cont: Controller - } - Behavior { } - } - - ActorClass Controller { - Structure { - conjugated Port pwrk: PWorker - conjugated Port opt: PC - Attribute caseId: int32 - ActorRef worker: Worker - Binding pwrk and worker.fct - Binding opt and worker.opt - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest3\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest3\", \"DynamicActorTest3_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - StateMachine { - Transition init: initial -> createOpt1 { } - Transition tr0: createOpt1 -> SendHello { - triggers { - - } - } - Transition tr1: SendHello -> TryCreateInvalid { - triggers { - - } - action { - "System.out.println(\"controller received \"+txt);" - } - } - Transition tr2: createOpt1 -> UnexpectedError { - triggers { - - } - } - Transition tr3: TryCreateInvalid -> ExpectedError { - triggers { - - } - } - State createOpt1 { - entry { - "pwrk.create(\"Optional1\");" - } - } - State SendHello { - entry { - "opt.sayHello();" - } - } - State TryCreateInvalid { - entry { - "pwrk.create(\"Optional\");" - } - } - State UnexpectedError - State ExpectedError { - entry { - "etUnit_testFinished(caseId);" - } - } - } - } - } - - ActorClass Worker { - Interface { - Port fct: PWorker - Port opt: PC - } - Structure { - external Port fct - optional ActorRef optRef: Optional - Binding opt and optRef.p0 - } - Behavior { - // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "if (optRef.createOptionalActor(ac, getThread()))" - "\tfct.ok();" - "else" - "\tfct.error();" - } - } - State Ready - } - } - } - - // the class that is referenced as optional by the Worker - // since it is abstract it just serves as an interface - abstract ActorClass Optional { - Interface { - Port p0: PC - } - Structure { } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional1 extends Optional { - Structure { - ActorRef sub1: AC1 - Binding p0 and sub1.p0 - } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional2 extends Optional { - Structure { - ActorRef sub2: AC2 - Binding p0 and sub2.p0 - } - Behavior { } - } - - // the following actor classes are part of the possible optional instance sub trees - - ActorClass AC1 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - conjugated Port hlp: PC - ActorRef helper: AC3 - Binding hlp and helper.p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> AskHelper { - triggers { - - } - } - Transition tr1: AskHelper -> Ready { - triggers { - - } - action { - "System.out.println(\"helper said \"+txt);" - "p0.hello(\"this is AC1, instance \"+getInstancePath());" - } - } - State Ready - State AskHelper { - entry { - "hlp.sayHello();" - } - } - } - } - } - - ActorClass AC2 { - Interface { - Port p0: PC - } - Structure { - ActorRef deep_sub: AC3 - Binding p0 and deep_sub.p0 - } - Behavior { } - } - - ActorClass AC3 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"this is AC3, instance \"+getInstancePath());" - } - } - State Ready - } - } - } - - // a simple protocol that is used to demonstrate that actors are connected - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } - - ProtocolClass PWorker { - incoming { - Message create(ac: string) - } - outgoing { - Message ok() - Message error() - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest4.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest4.room deleted file mode 100644 index c26a065a0..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest4.room +++ /dev/null @@ -1,97 +0,0 @@ -RoomModel DynamicActorTest4 { - - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" - - ActorClass Appl { - @TestInstance - Structure { - ActorRef cont: Container - } - Behavior { } - } - - ActorClass Container { - Structure { - conjugated Port p0: PC - Attribute caseId: int32 - optional ActorRef opt: Optional - - Binding p0 and opt.p0 - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest4\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest4\", \"DynamicActorTest4_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - - // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - - StateMachine { - Transition init: initial -> CreateOptional { } - Transition tr0: CreateOptional -> Done { - triggers { - - } - action { - "System.out.println(txt+\"\\n\");" - "opt.destroyOptionalActor();" - "dumpTree(\"after deletion of Optional2\");" - } - } - State CreateOptional { - entry { - "opt.createOptionalActor(\"Optional\", getThread());" - "p0.sayHello();" - } - } - State Done { - entry { - "etUnit_testFinished(caseId);" - } - } - } - } - } - - // the class that is referenced as optional by the Container - // It has an external end port and implements the behavior itself - ActorClass Optional { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"this is AC1, instance \"+getInstancePath());" - } - } - State Ready - } - } - } - - // a simple protocol that is used to demonstrate that actors are connected - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest5.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest5.room deleted file mode 100644 index e2d22dbe6..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest5.room +++ /dev/null @@ -1,149 +0,0 @@ -RoomModel DynamicActorTest5 { - - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" - - ActorClass Appl { - @TestInstance - Structure { - ActorRef cont: Container - } - Behavior { } - } - - ActorClass Container { - Structure { - conjugated Port p0: PC - Attribute caseId: int32 - optional ActorRef opt: Optional2 - - Binding p0 and opt.p0 - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest5\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest5\", \"DynamicActorTest5_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - - // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - - StateMachine { - Transition init: initial -> CreateOptional2 { } - Transition tr0: CreateOptional2 -> Done { - triggers { - - } - action { - "dumpTree(\"after received hello\");" - "" - "System.out.println(\"received \"+txt);" - "" - "etUnit_testFinished(caseId);" - } - } - State CreateOptional2 { - entry { - "opt.createOptionalActor(\"Optional2\", getThread());" - "dumpTree(\"after creation of Optional2\");" - "" - "// at this point the port isn\'t connected since" - "// the init message isn\'t processed yet" - "// - so no peer port exists" - "p0.sayHello();" - } - } - State Done - } - } - } - - ActorClass Optional1 { - Interface { - Port p0: PC - } - Structure { - ActorRef sub1: AC1 - Binding p0 and sub1.p0 - } - Behavior { } - } - - ActorClass Optional2 { - Interface { - Port p0: PC - } - Structure { - ActorRef sub2: AC2 - Binding p0 and sub2.p0 - } - Behavior { } - } - - // the following actor classes are part of the possible optional instance sub trees - - ActorClass AC1 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - State Ready { - entry { - "p0.hello(\"this is AC1, instance \"+getInstancePath());" - } - } - } - } - } - - ActorClass AC2 { - Interface { - Port p0: PC - } - Structure { - ActorRef deep_sub: AC3 - Binding p0 and deep_sub.p0 - } - Behavior { } - } - - ActorClass AC3 { - Interface { - Port p0: PC - } - Structure { - optional ActorRef nestedOpt: Optional1 - Binding p0 and nestedOpt.p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - State Ready { - entry { - "nestedOpt.createOptionalActor(\"Optional1\", getThread());" - } - } - } - } - } - - // a simple protocol that is used to demonstrate that actors are connected - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest6.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest6.room deleted file mode 100644 index 2b4d94f18..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest6.room +++ /dev/null @@ -1,243 +0,0 @@ -RoomModel DynamicActorTest6 { - - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" - - ActorClass Appl { - @TestInstance - Structure { - ActorRef ctrl: Controller - } - Behavior { } - } - - ActorClass Controller { - Structure { - conjugated Port pcont: PCtrl - conjugated Port pout: PC - conjugated Port pin: PC - Attribute caseId: int32 - ActorRef cont: Container - Binding pcont and cont.fct - Binding pout and cont.pin - Binding pin and cont.pout - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest6\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest6\", \"DynamicActorTest6_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - StateMachine { - Transition init: initial -> CreateOptionals { } - Transition tr0: CreateOptionals -> Sending { - triggers { - - } - } - Transition tr1: Sending -> Destroy { - triggers { - - } - action { - "System.out.println(\"Controller received: \"+txt);" - } - } - Transition tr2: Destroy -> CreateAgain { - triggers { - - } - } - Transition tr3: CreateAgain -> SendAgain { - triggers { - - } - } - Transition tr4: SendAgain -> Done { - triggers { - - } - action { - "System.out.println(\"Controller received: \"+txt);" - } - } - State CreateOptionals { - entry { - "pcont.createOpts();" - } - } - State Sending { - entry { - "pout.sayHello();" - } - } - State Done { - entry { - "etUnit_testFinished(caseId);" - } - } - State Destroy { - entry { - "pcont.destroyOpts();" - } - } - State CreateAgain { - entry { - "pcont.createOpts();" - } - } - State SendAgain { - entry { - "pout.sayHello();" - } - } - } - } - } - - ActorClass Container { - Interface { - Port fct: PCtrl - Port pout: PC - Port pin: PC - } - Structure { - external Port fct - optional ActorRef opt1: Optional1 - optional ActorRef opt2: Optional2 - Binding opt1.pout and opt2.pin - Binding pin and opt1.pin - Binding pout and opt2.pout - } - Behavior { - // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "opt1.createOptionalActor(\"Optional1\", getThread());" - "opt2.createOptionalActor(\"Optional2\", getThread());" - "dumpTree(\"after creation of op1 and opt2\");" - "fct.done();" - } - } - Transition tr1: Ready -> Ready { - triggers { - - } - action { - "opt1.destroyOptionalActor();" - "opt2.destroyOptionalActor();" - "fct.done();" - } - } - State Ready - } - } - } - - ActorClass Optional1 { - Interface { - Port pout: PC - Port pin: PC - } - Structure { - ActorRef sub1: AC1 - Binding pin and sub1.pin - Binding pout and sub1.pout - } - Behavior { } - } - - ActorClass Optional2 { - Interface { - Port pout: PC - conjugated Port pin: PC - } - Structure { - ActorRef sub2: AC2 - Binding pout and sub2.pout - Binding pin and sub2.pin - } - Behavior { } - } - - ActorClass AC1 { - Interface { - Port pout: PC - Port pin: PC - } - Structure { - external Port pout - external Port pin - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "pout.hello(\"this is AC1, instance \"+getInstancePath());" - } - } - State Ready - } - } - } - - ActorClass AC2 { - Interface { - Port pout: PC - conjugated Port pin: PC - } - Structure { - external Port pout - external Port pin - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "System.out.println(\"AC2 received \"+txt);" - "" - "pout.hello(\"AC2: forwarding \"+txt);" - } - } - State Ready - } - } - } - - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } - - ProtocolClass PCtrl { - incoming { - Message createOpts() - Message destroyOpts() - } - outgoing { - Message done() - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.etmap b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.etmap deleted file mode 100644 index cb52ba408..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.etmap +++ /dev/null @@ -1,11 +0,0 @@ -MappingModel DynamicActorTest1 { - import DynamicActorTest7.* from "DynamicActorTest7.room" - import room.generic.physical.* from "GenericPhysical.etphys" - - Mapping JavaGenTests -> GenericPhysicalSystem { - SubSystemMapping da7Test -> node { - ThreadMapping defaultThread -> DefaultPhysicalThread - } - } - -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.room deleted file mode 100644 index 15630c617..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.room +++ /dev/null @@ -1,375 +0,0 @@ -RoomModel DynamicActorTest7 { - - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" - - LogicalSystem JavaGenTests { - SubSystemRef da7Test : SubSystem_DynamicActorTest7 - } - - SubSystemClass SubSystem_DynamicActorTest7 { - ActorRef main : Appl - - LogicalThread defaultThread - } - - ActorClass Appl { - Structure { - ActorRef cont: Container - } - Behavior { } - } - - ActorClass Container { - Structure { - usercode1 { - "import java.io.File;" - } - usercode2 { - "private static final String FIRST_OPT_OBJ = \"firstOpt.obj\";" - "private static final String SECOND_OPT_OBJ = \"secondOpt.obj\";" - } - conjugated Port op: PStep - conjugated Port opa [*]: PStep - - Attribute caseId: int32 - - optional ActorRef opt: Optional - optional ActorRef optarr [*]: Optional - - Binding op and opt.fct - Binding opa and optarr.fct - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest7\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest7\", \"DynamicActorTest7_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - Operation clean() { - "File f = new File(FIRST_OPT_OBJ);" - "if (f.exists())" - "\tf.delete();" - } - StateMachine { - Transition init: initial -> Init { } - Transition tr0: Init -> DestroyAndCreate { - triggers { - - } - action { - "System.out.println(\"received \"+txt);" - } - } - Transition tr1: DestroyAndCreate -> DestroyAndRestore { - triggers { - - } - action { - "System.out.println(\"received \"+txt);" - } - } - Transition tr2: DestroyAndRestore -> LoadInArray { - triggers { - - } - action { - "System.out.println(\"received \"+txt);" - } - } - Transition tr3: LoadInArray -> ReceivedHello { - triggers { - - } - action { - "System.out.println(\"received \"+txt);" - } - } - Transition tr4: ReceivedHello -> Done { - triggers { - - } - action { - "System.out.println(\"received \"+txt);" - } - } - State Init { - entry { - "clean();" - "FilePersistor.createAndLoad(opt, getThread(), FIRST_OPT_OBJ, \"Optional1\");" - "op.step();" - "op.step();" - "op.sayHello();" - } - } - State DestroyAndCreate { - entry { - "FilePersistor.saveAndDestroy(opt, FIRST_OPT_OBJ);" - "FilePersistor.createAndLoad(opt, getThread(), SECOND_OPT_OBJ, \"Optional2\");" - "op.step();" - "op.step();" - "op.sayHello();" - } - } - State DestroyAndRestore { - entry { - "FilePersistor.saveAndDestroy(opt, SECOND_OPT_OBJ);" - "FilePersistor.createAndLoad(opt, getThread(), FIRST_OPT_OBJ, \"Optional1\");" - "op.sayHello();" - } - } - State Done { - entry { - "IRTObject object = getObject(\"/JavaGenTests/da7Test/main/cont/optarr/optarr:0/sub\");" - "EXPECT_TRUE(caseId, \"object 0 of optarr is an instance of actor class Sub1\", object instanceof Sub1);" - "" - "Sub1 inst = (Sub1) object;" - "EXPECT_EQUAL_INT32(caseId, \"state\", Sub1.STATE_Step3_StepA, inst.getState());" - "EXPECT_EQUAL_INT32(caseId, \"current value of ival\", 123, inst.getIval());" - "EXPECT_EQUAL_INT16(caseId, \"current value of sval\", (short)456, inst.getSval());" - "EXPECT_EQUAL_INT8(caseId, \"current value of bval\", (byte)3, inst.getBval());" - "EXPECT_TRUE(caseId, \"changed string\", \"changed\".equals(inst.getSome()[1].getStr()));" - "EXPECT_EQUAL_FLOAT32(caseId, \"current vaue of\", 3.14159f, inst.getDerived().getSome().getFval()[2], 0.001f);" - "EXPECT_EQUAL_UINT8(caseId, \"current value of cval\", 'x', inst.getCval());" - "" - "etUnit_testFinished(caseId);" - } - } - State LoadInArray { - entry { - "FilePersistor.createAndLoad(optarr, getThread(), FIRST_OPT_OBJ, \"Optional1\");" - "FilePersistor.createAndLoad(optarr, getThread(), SECOND_OPT_OBJ, \"Optional2\");" - "opa.sayHello();" - } - } - State ReceivedHello - } - } - } - - abstract ActorClass Optional { - Interface { - Port fct: PStep - } - Structure { } - Behavior { } - } - - ActorClass Optional1 extends Optional { - Structure { - ActorRef ^sub: Sub1 - Binding fct and ^sub.fct - } - Behavior { } - } - - ActorClass Optional2 extends Optional { - Structure { - ActorRef ^sub: Sub2 - Binding fct and ^sub.fct - } - Behavior { } - } - - ActorClass Sub1Base { - Structure { - Attribute cval: char - } - } - - ActorClass Sub1 extends Sub1Base { - Interface { - Port fct: PStep - } - Structure { - external Port fct - conjugated Port dp: PStep - - Attribute ival: int32 - Attribute sval: int16 - Attribute bval: int8 - Attribute some[3]: SomeData - Attribute other: OtherData - Attribute derived: DerivedData - - ActorRef deep: DeepSub1 - Binding dp and deep.fct - } - Behavior { - StateMachine { - Transition init: initial -> Step1 { } - Transition tr0: Step1 -> Step2 { - triggers { - - } - action { - "dp.step();" - } - } - Transition tr1: Step2 -> Step3 { - triggers { - - } - action { - "dp.step();" - } - } - Transition tr2: my tp0 -> my tp0 { - triggers { - - } - action { - "fct.hello(getClassName()+\", state=\"+stateStrings[getState()]+\", path= \"+getInstancePath());" - } - } - handler TransitionPoint tp0 - State Step1 { - entry { - "ival = 1;" - "sval = 2;" - "bval = 3;" - "cval = 'x';" - } - } - State Step2 { - entry { - "ival = 123;" - "some[1].str = \"changed\";" - "derived.some.fval[2] = 3.14159f;" - } - } - State Step3 { - subgraph { - Transition init: initial -> StepA { } - Transition tr0: StepA -> StepB { - triggers { - - } - action { - "dp.step();" - } - } - Transition tr1: StepB -> StepC { - triggers { - - } - action { - "dp.step();" - } - } - State StepA { - entry { - "sval = 456;" - } - } - State StepB { - entry { - "bval = 13;" - } - } - State StepC - } - } - } - } - } - - ActorClass DeepSub1 { - Interface { - Port fct: PStep - } - Structure { - external Port fct - } - Behavior { - StateMachine { - Transition init: initial -> Step1 { } - Transition tr0: Step1 -> Step2 { - triggers { - - } - } - Transition tr1: Step2 -> Step3 { - triggers { - - } - } - Transition tr2: Step3 -> Step5 { - triggers { - - } - } - Transition tr3: Step5 -> Step6 { - triggers { - - } - } - Transition tr4: Step6 -> Step7 { - triggers { - - } - } - State Step1 - State Step2 - State Step3 - State Step5 - State Step6 - State Step7 - } - } - } - - ActorClass Sub2 { - Interface { - Port fct: PStep - } - Structure { - external Port fct - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - } - Transition tr1: Ready -> Ready { - triggers { - - } - action { - "fct.hello(getClassName()+\", state=\"+stateStrings[getState()]+\", path= \"+getInstancePath());" - } - } - State Ready - } - } - } - - ProtocolClass PStep { - incoming { - Message step() - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } - - DataClass SomeData { - Attribute fval[3]: float32 = "1.0" - Attribute dval: float64 = "123.4" - Attribute str: string = "\"Text\"" - } - - DataClass OtherData { - Attribute some: SomeData - Attribute bval: boolean = "false" - } - - DataClass DerivedData extends OtherData { - Attribute cval[3]: char = "{'a', 'b', 'c'}" - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.config b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.config deleted file mode 100644 index 13fd8a62b..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.config +++ /dev/null @@ -1,121 +0,0 @@ -ConfigModel DynamicConfigTest { - - import DynamicConfigTest.* from "DynamicConfigTest.room" - - - SubSystemConfig System_DynamicConfigTest / main { - dynamic configuration { - user import "" - user constructor "ConfigSourceTestInstance.getInstance()" - polling interval 200 ms - } - } - - ActorClassConfig Testee_ac { - Attr aBool = false - Attr aInt8 = 0 { - min = -1 max = 59 - } - Attr aInt16 = 0 { - min = -1 max = 59 - } - Attr aInt32 = 0 { - min = -1 max = 59 - } - Attr aInt64 = 0 { - min = -1 max = 59 - } - Attr aFloat32 = 0.0 { - min = -1.0 max = 59.0 - } - Attr aFloat64 = 0.0 { - min = -1.0 max = 59.0 - } - Attr aChar = '' - Attr aString = "" - Attr aBool_array = false - Attr aInt8_array = 0 { - min = -1 max = 59 - } - Attr aInt16_array = 0 { - min = -1 max = 59 - } - Attr aInt32_array = 0 { - min = -1 max = 59 - } - Attr aInt64_array = 0 { - min = -1 max = 59 - } - Attr aFloat32_array = 0.0 { - min = -1.0 max = 59.0 - } - Attr aFloat64_array = 0.0 { - min = -1.0 max = 59.0 - } - Attr aChar_array - Attr dc { - Attr nested { - Attr aInt32 = 0 { - min = -1 max = 59 - } - } - } - } - - ActorInstanceConfig System_DynamicConfigTest / main / testee { - Attr aInt8 { - dynamic configuration read - } - Attr aInt16 { - dynamic configuration read - } - Attr aInt32 { - dynamic configuration read - } - Attr aInt64 { - dynamic configuration read - } - Attr aFloat32 { - dynamic configuration read - } - Attr aFloat64 { - dynamic configuration read - } - Attr aBool { - dynamic configuration read - } - Attr aChar { - dynamic configuration read - } - Attr aString { - dynamic configuration read - } - Attr aInt8_array { - dynamic configuration read - } - Attr aInt16_array { - dynamic configuration read - } - Attr aInt32_array { - dynamic configuration read - } - Attr aInt64_array { - dynamic configuration read - } - Attr aFloat32_array { - dynamic configuration read - } - Attr aFloat64_array { - dynamic configuration read - } - Attr aBool_array { - dynamic configuration read - } - Attr aChar_array { - dynamic configuration read - } - Attr dc { - dynamic configuration read - } - } -} diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.etmap b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.etmap deleted file mode 100644 index 3ec15a8f2..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.etmap +++ /dev/null @@ -1,9 +0,0 @@ -MappingModel DynamicConfigTest { - - import DynamicConfigTest.* from "DynamicConfigTest.room" - import room.generic.physical.* from "GenericPhysical.etphys" - - Mapping System_DynamicConfigTest -> GenericPhysicalSystem { - SubSystemMapping main -> node {} - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.room deleted file mode 100644 index 6e0550ec5..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.room +++ /dev/null @@ -1,203 +0,0 @@ -RoomModel DynamicConfigTest { - - import room.basic.types.* from "Types.room" - - import room.basic.service.timing.* from "TimingService.room" - - LogicalSystem System_DynamicConfigTest{ - SubSystemRef main : SubSystem_DynamicConfigTest - } - - SubSystemClass SubSystem_DynamicConfigTest { - ActorRef testee: Testee_ac - ActorRef timingService: ATimingService - LayerConnection ref testee satisfied_by timingService.timer - } - - ActorClass Testee_ac { - Structure { - usercode1 { - "import java.util.HashMap;" - "import java.util.Map;" - "import org.eclipse.etrice.runtime.java.config.IConfigSource;" - } - SAP timer: PTimer - Attribute caseId: int32 - Attribute testId: int32 = "1" - - // no dynConfig - Attribute sString: string - - // dynConfig - Attribute aInt8: int8 - Attribute aInt16: int16 - Attribute aInt32: int32 - Attribute aInt64: int64 - Attribute aBool: boolean - Attribute aFloat32: float32 - Attribute aFloat64: float64 - Attribute aChar: char - Attribute aString: string - Attribute aInt8_array [ 2 ]: int8 - Attribute aInt16_array [ 2 ]: int16 - Attribute aInt32_array [ 2 ]: int32 - Attribute aInt64_array [ 2 ]: int64 - Attribute aBool_array [ 2 ]: boolean - Attribute aFloat32_array [ 2 ]: float32 - Attribute aFloat64_array [ 2 ]: float64 - Attribute aChar_array [ 2 ]: char - Attribute dc: Data_dc - } - Behavior { - ctor { - "etUnit_open(\"log/testlog\", \"DynamicConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.DynamicConfigTest\");" - "caseId = etUnit_openTestCase(\"DynamicConfigTest_case_Testee_ac\");" - } - dtor { - "etUnit_closeTestCase(caseId);" - "etUnit_closeTestSuite();" - "etUnit_close();" - } - StateMachine { - Transition t0: initial -> ChangeConfigValid { } - Transition t1: ChangeConfigValid -> Test { - triggers { - - } - action { - "testId++;" - } - } - Transition t2: Test -> ChangeConfigInvalid { - triggers { - - } - } - Transition t3: ChangeConfigInvalid -> Test { - triggers { - - } - action { - "testId++;" - } - } - Transition t4: Test -> Done { - triggers { - - } - } - Transition tr0: Test -> ChangeConfigValid { - triggers { - - } - } - State ChangeConfigValid { - entry { - "IConfigSource source = ConfigSourceTestInstance.getInstance();" - "String path = this.getInstancePath();" - "Map testValues = new HashMap();" - "testValues.put(path+\"/aInt8\", 50);" - "testValues.put(path+\"/aInt16\", 51);" - "testValues.put(path+\"/aInt32\", 52);" - "testValues.put(path+\"/aInt64\", 53);" - "testValues.put(path+\"/aFloat32\", 5.4f);" - "testValues.put(path+\"/aFloat64\", 5.5);" - "testValues.put(path+\"/aChar\", 'B');" - "testValues.put(path+\"/aString\", \"Do-NOT-UPDATE-me\");" - "testValues.put(path+\"/aBool\", true);" - "testValues.put(path+\"/dc/nested/aInt32\", 56);" - "testValues.put(path+\"/dc/aString\", \"Okay\");" - "testValues.put(path+\"/aInt8_array\", new Byte[]{50,40});" - "testValues.put(path+\"/aInt16_array\", new Short[]{51,41});" - "testValues.put(path+\"/aInt32_array\", new Integer[]{52,42});" - "testValues.put(path+\"/aInt64_array\", new Long[]{53L,43L});" - "testValues.put(path+\"/aFloat32_array\", new Float[]{5.4f, 4.4f});" - "testValues.put(path+\"/aFloat64_array\", new Double[]{5.5, 4.5});" - "testValues.put(path+\"/aChar_array\", \"BB\");" - "testValues.put(path+\"/aBool_array\", new Boolean[]{true, false});" - "source.writeValues(testValues);" - "timer.startTimer(400);" - } - } - State ChangeConfigInvalid { - entry { - // do not update aString - "getAStringLock().forbidUpdate();" - - "IConfigSource source = ConfigSourceTestInstance.getInstance();" - "String path = this.getInstancePath();" - "Map testValues = new HashMap();" - "testValues.put(path+\"/aInt8\", 128);" - "testValues.put(path+\"/aInt16\", 61);" - "testValues.put(path+\"/aInt32\", -2);" - "testValues.put(path+\"/aInt64\", Long.MAX_VALUE);" - "testValues.put(path+\"/aFloat32\", -100f);" - "testValues.put(path+\"/aFloat64\", 100d);" - "testValues.put(path+\"/aChar\", \"string\");" - "testValues.put(path+\"/aString\", \"VALID-String\");" - "testValues.put(path+\"/aBool\", \"true\");" - "testValues.put(path+\"/dc/aString\", 0.89898);" - "testValues.put(path+\"/dc/nested/aInt32\", 62);" - "testValues.put(path+\"/aInt8_array\", 128);" - "testValues.put(path+\"/aInt16_array\", new Short[]{-1,-2});" - "testValues.put(path+\"/aInt32_array\", new Integer[]{60,59});" - "testValues.put(path+\"/aInt64_array\", new Long[]{60000L,60000L});" - "testValues.put(path+\"/aFloat32_array\", new Float[]{0f, -2f});" - "testValues.put(path+\"/aFloat64_array\", \"string\");" - "testValues.put(path+\"/aChar_array\", \"BBB\");" - "testValues.put(path+\"/aBool_array\", 500);" - "source.writeValues(testValues);" - "timer.startTimer(400);" - } - } - State Test { - entry { - "EXPECT_EQUAL_INT8(caseId, \"1:Testee_ac\", (byte)50, getAInt8());" - "EXPECT_EQUAL_INT16(caseId, \"2:Testee_ac\", (short)51, getAInt16());" - "EXPECT_EQUAL_INT32(caseId, \"3:Testee_ac\", 52, getAInt32());" - "EXPECT_TRUE(caseId, \"4:Testee_ac\", getAInt64() == 53L);" - "EXPECT_EQUAL_FLOAT32(caseId, \"5:Testee_ac\", 5.4f, getAFloat32(), 0.1f);" - "EXPECT_TRUE(caseId, \"6:Testee_ac\", getAFloat64() == 5.5);" - "EXPECT_TRUE(caseId, \"7:Testee_ac\", getAChar() == 'B');" - "EXPECT_TRUE(caseId, \"8:Testee_ac\", \"Do-NOT-UPDATE-me\".equals(getAString()));" - "EXPECT_TRUE(caseId, \"9:Testee_ac\", getABool() == true);" - "EXPECT_TRUE(caseId, \"10:Testee_ac\", getAInt8_array()[0] == 50 && getAInt8_array()[1] == 40);" - "EXPECT_TRUE(caseId, \"11:Testee_ac\", getAInt16_array()[0] == 51 && getAInt16_array()[1] == 41);" - "EXPECT_TRUE(caseId, \"12:Testee_ac\", getAInt32_array()[0] == 52 && getAInt32_array()[1] == 42);" - "EXPECT_TRUE(caseId, \"13:Testee_ac\", getAInt64_array()[0] == 53L && getAInt64_array()[1] == 43L);" - "EXPECT_EQUAL_FLOAT32(caseId, \"14.1:Testee_ac\", 5.4f, getAFloat32_array()[0], 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"14.2:Testee_ac\", 4.4f, getAFloat32_array()[1], 0.1f);" - "EXPECT_TRUE(caseId, \"15:Testee_ac\", getAFloat64_array()[0] == 5.5 && getAFloat64_array()[1] == 4.5);" - "EXPECT_TRUE(caseId, \"16:Testee_ac\", String.valueOf(getAChar_array()).equals(\"BB\"));" - "EXPECT_TRUE(caseId, \"18:Testee_ac\", getABool_array()[0] == true && getABool_array()[1] == false);" - "EXPECT_TRUE(caseId, \"19:Testee_ac\", \"Okay\".equals(getDc().getAString()));" - "EXPECT_TRUE(caseId, \"20:Testee_ac\", getDc().getNested().getAInt32() == 56);" - "timer.startTimer(1);" - } - } - State Done { - entry { - "\tetUnit_testFinished(caseId);" - } - } - } - } - } - - DataClass Data_dc { - Attribute aString:string - Attribute nested: Data_nested_dc - } - - DataClass Data_nested_dc { - Attribute aInt32: int32 - } - -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.rt-config b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.rt-config deleted file mode 100644 index c27ad68cf..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.rt-config +++ /dev/null @@ -1,20 +0,0 @@ -/System_DynConfigTest/subSystem/testee/aBool=true -/System_DynConfigTest/subSystem/testee/aBool_array={ true,false } -/System_DynConfigTest/subSystem/testee/aChar="B" -/System_DynConfigTest/subSystem/testee/aChar_array="BB" -/System_DynConfigTest/subSystem/testee/aFloat32=5.4 -/System_DynConfigTest/subSystem/testee/aFloat32_array={ 5.4,4.4 } -/System_DynConfigTest/subSystem/testee/aFloat64=5.5 -/System_DynConfigTest/subSystem/testee/aFloat64_array={ 5.5,4.5 } -/System_DynConfigTest/subSystem/testee/aInt16=51 -/System_DynConfigTest/subSystem/testee/aInt16_array={ 51,41 } -/System_DynConfigTest/subSystem/testee/aInt32=52 -/System_DynConfigTest/subSystem/testee/aInt32_array={ 52,42 } -/System_DynConfigTest/subSystem/testee/aInt64=53 -/System_DynConfigTest/subSystem/testee/aInt64_array={ 53,43 } -/System_DynConfigTest/subSystem/testee/aInt8=50 -/System_DynConfigTest/subSystem/testee/aInt8_array={ 50,40 } -/System_DynConfigTest/subSystem/testee/aString="Do-NOT-UPDATE-me" -/System_DynConfigTest/subSystem/testee/dc/aString="Okay" -/System_DynConfigTest/subSystem/testee/dc/nested/aInt32=56 -polling_timer[ms]=200 diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/StoreRestore.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/StoreRestore.room deleted file mode 100644 index 6c5a11105..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/StoreRestore.room +++ /dev/null @@ -1,217 +0,0 @@ -RoomModel StoreRestore { - - import room.basic.test.* from "Tests.room" - - ActorClass StoreRestore_Top { - @TestInstance - Structure { - ActorRef tester: Tester - ActorRef testee: Testee - Binding tester.prt and testee.prt - } - Behavior { } - } - - ActorClass Testee { - Interface { - Port prt: PC - } - Structure { - usercode1 { "import StoreRestore.ObjectHolder;" } - - external Port prt - - Attribute ival: int16 - Attribute iarr [ 3 ]: int32 - Attribute sdval: SomeData - Attribute sdarr [ 5 ]: SomeData - Attribute cdval: ComplexData - } - Behavior { - Operation doStore() { - "System.out.println(\"doStore()\");" - "IActorClassDataObject dataObject = newDataObject();" - "store(dataObject);" - "ObjectHolder.setObject(dataObject);" - } - Operation doRestore() { - "System.out.println(\"doRestore()\");" - "IActorClassDataObject dataObject = ObjectHolder.getObject();" - "restore(dataObject);" - } - StateMachine { - Transition tr0: my tp0 -> Restore { - triggers { - - } - } - Transition init: initial -> Begin { } - Transition tr1: Begin -> Store { - triggers { - - } - } - Transition tr2: Store -> state2 { - triggers { - - } - } - Transition tr3: state2 -> state3 { - triggers { - - } - } - TransitionPoint tp0 - State Begin { - entry { - "ival = 3;" - } - } - State Store { - entry { - "System.out.println(\"<|MODEL_LOCATION|>\");" - "setFinalAction(new SingleFinalAction() {" - "\tpublic void run() {" - "\t\tdoStore();" - "\t}" - "});" - } - } - State state2 { - entry { - "prt.valueIs(ival);" - "" - "ival = 123;" - } - } - State Restore { - entry { - "System.out.println(\"<|MODEL_LOCATION|>\");" - "setFinalAction(new SingleFinalAction() {" - "\tpublic void run() {" - "\t\tdoRestore();" - "\t}" - "});" - } - } - State state3 { - entry { - "ival = 456;" - "" - "prt.answer();" - } - } - } - } - } - - ActorClass Tester { - Interface { - conjugated Port prt: PC - } - Structure { - external Port prt - - Attribute caseId: int32 - Attribute counter: int32 = "0" - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"StoreRestore\", \"org.eclipse.etrice.generator.common.tests.StoreRestore\", \"StoreRestore_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - - StateMachine { - Transition init: initial -> Prepare { } - Transition tr1: Loop2 -> cp cp0 { - triggers { - - } - } - Transition tr2: cp cp0 -> Done - Transition tr3: cp cp0 -> Loop { - cond { - "++counter<10" - } - } - Transition tr0: Prepare -> Prepare2 { - triggers { - - } - action { - "EXPECT_EQUAL_INT16(caseId, \"check old value <|MODEL_LOCATION|>\", (short)3, val);" - } - } - Transition tr4: Prepare2 -> Loop { - triggers { - - } - } - Transition tr5: Loop -> Loop2 { - triggers { - - } - action { - "EXPECT_EQUAL_INT16(caseId, \"check old value <|MODEL_LOCATION|>\", (short)3, val);" - } - } - ChoicePoint cp0 - State Prepare { - entry { - "prt.step();" - "prt.step();" - } - } - State Loop { - entry { - "prt.restore();" - "" - "prt.step();" - "prt.step();" - } - } - State Done { - entry { - "etUnit_testFinished(caseId);" - } - } - State Prepare2 { - entry { - "prt.step();" - } - } - State Loop2 { - entry { - "prt.step();" - } - } - } - } - } - - ProtocolClass PC { - incoming { - Message step() - Message restore() - } - outgoing { - Message answer() - Message valueIs(val: int16) - } - } - - DataClass SomeData { - Attribute ival: int16 - Attribute iarr [ 3 ]: int32 - } - - DataClass ComplexData { - Attribute sdval: SomeData - Attribute sdarr [ 5 ]: SomeData - } - - PrimitiveType int16: ptInteger -> 'short' (Short) default '0' - PrimitiveType int32: ptInteger -> 'int' (Integer) default '0' -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/TCPTest.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/TCPTest.room deleted file mode 100644 index d234bfe2b..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/TCPTest.room +++ /dev/null @@ -1,160 +0,0 @@ -RoomModel TCPTest { - - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" - import room.basic.service.tcp.* from "TcpService.room" - - ActorClass TCPTestTop { - @TestInstance - Structure { - ActorRef ref0: ATcpServer - ActorRef ref1 [ 5 ]: ATcpClient - ActorRef ref2: Tester - Binding ref2.p1 and ref0.PayloadPort - Binding ref2.p0 and ref0.ControlPort - Binding ref2.p2 and ref1.ControlPort - Binding ref2.p3 and ref1.PayloadPort - } - Behavior { } - } - - ActorClass Tester { - Interface { - conjugated Port p0: PTcpControl - conjugated Port p1: PTcpPayload - conjugated Port p2 [*]: PTcpControl - conjugated Port p3 [5]: PTcpPayload - } - Structure { - external Port p0 - external Port p1 - external Port p2 - external Port p3 - Attribute controlData:DTcpControl - Attribute testData:DTcpPayload - Attribute counter:int32 - Attribute resultPattern:int32 - Attribute pattern:int32 - Attribute caseId: int32 - Attribute resultlist[3]: int16 = "{1,2,3}" - - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"TCPTest\", \"org.eclipse.etrice.generator.common.tests.TCPTest\", \"TCPTest_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - StateMachine { - Transition init: initial -> state0 { - action { - "EXPECT_ORDER_START(caseId,resultlist,3);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "// open Server" - "controlData.setIPAddr(\"127.0.0.1\");" - "controlData.setTcpPort(4711);" - "p0.open(controlData);" - } - } - Transition tr0: state0 -> state1 { - triggers { - - } - action { - "// open 5 clients" - "for (int i=0;i cp cp0 { - triggers { - - } - action { - "counter++;" - } - } - Transition tr4: cp cp0 -> state1 - Transition tr5: cp cp0 -> state2 { - cond { - "counter>=p2.getReplication()" - } - action { - "String s=new String (\"Test!\");" - "testData.setData(s.getBytes());" - "testData.setLength(s.length());" - "testData.setConnectionId(0);" - "for (int i=0; i cp cp2 { - triggers { - - } - action { - "resultPattern+=p3.getIndexOf(ifitem);" - "//System.out.printf(\"c:%d, Idx:%d!\\n\", counter,p3.getIndexOf(ifitem));" - "counter++;" - } - } - Transition tr9: cp cp2 -> state2 - Transition tr10: cp cp2 -> cp cp1 { - cond { - "counter>=p2.getReplication()" - } - action { - "int i;" - "p0.close();" - "// close all clients" - "p2.close();" - "pattern=0;" - "for (i=0;i state2 { - triggers { - - } - action { - "p1.send(data);" - } - } - Transition tr2: cp cp1 -> test_failed - Transition tr6: cp cp1 -> test_ok { - cond { - "pattern==resultPattern" - } - } - ChoicePoint cp0 - ChoicePoint cp2 - ChoicePoint cp1 - State state0 - State state1 - State state2 - State test_ok { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 3);" - "etUnit_testFinished(caseId);" - } - } - State test_failed { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 3);" - "etUnit_testFinished(caseId);" - } - } - } - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle new file mode 100644 index 000000000..cf2f3e1e4 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle @@ -0,0 +1,40 @@ +plugins { + id 'c' +} + +apply from: etUnitConverter + +model { + components { + etrice_runtime_c_tests(NativeExecutableSpec) { + sources.c { + source { + srcDirs = ['src'] + include '**/*.c' + } + exportedHeaders { + srcDirs = ['src'] + } + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' + } + } + } +} + +def exeFile = "$buildDir/exe/etrice_runtime_c_tests/etrice_runtime_c_tests" +def etuFileRuntimeTest = 'log/testlog/TestCRuntime.etu' +def etuFileEtUnitTest = 'log/testlog/TestEtUnitSpecial.etu' + +clean.delete 'log' + +task run(type: Exec, dependsOn: assemble, group: 'verification') { + commandLine exeFile + inputs.file exeFile + outputs.files etuFileRuntimeTest, etuFileEtUnitTest + + doFirst { file('log/testlog').mkdirs() } +} + +createEtUnitConverterTask('convert', run) + +check.dependsOn convert \ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle new file mode 100644 index 000000000..74624fe04 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle @@ -0,0 +1,40 @@ +plugins { + id 'cpp' +} + +apply from: etUnitConverter + +model { + components { + etrice_runtime_cpp_tests(NativeExecutableSpec) { + sources.cpp { + source { + srcDirs = ['src'] + include '**/*.cpp' + } + exportedHeaders { + srcDirs = ['src'] + } + lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' + } + } + } +} + +def exeFile = "$buildDir/exe/etrice_runtime_cpp_tests/etrice_runtime_cpp_tests" +def etuFile = 'log/testlog/TestCppRuntime.etu' + +clean.delete 'log' + +task run(type: Exec, dependsOn: assemble, group: 'verification') { + commandLine exeFile + inputs.file exeFile + outputs.files etuFile + + doFirst { file('log/testlog').mkdirs() } +} + +createEtUnitConverterTask('convert', run) + +check.dependsOn convert \ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.java.tests/build.gradle b/tests/org.eclipse.etrice.runtime.java.tests/build.gradle new file mode 100644 index 000000000..8b221bf37 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.java.tests/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'java' +} + +repositories { + mavenCentral() +} + +dependencies { + testCompile project(':runtime:org.eclipse.etrice.runtime.java') + testCompile 'junit:junit:4.12' +} + +sourceSets.test.java.srcDirs = ['src'] + +test.reports.html.enabled = false \ No newline at end of file -- cgit v1.2.3 From d4cd43005dc9479d21b819f31dcc6cb51e020131 Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Wed, 13 Sep 2017 16:56:05 +0200 Subject: [generator.tests] fixed gitignores and added missing models --- .../.gitignore | 8 +- .../models/SendingDataTest.room | 605 +++++++++++++++++++++ .../models/StaticConfigTest.config | 141 +++++ .../models/StaticConfigTest.etmap | 10 + .../models/StaticConfigTest.room | 421 ++++++++++++++ .../.gitignore | 2 + .../.gitignore | 8 +- .../models/SendingDataTest.room | 605 +++++++++++++++++++++ .../.gitignore | 10 +- .../models/SendingDataTest.room | 586 ++++++++++++++++++++ .../models/StaticConfigTest.config | 141 +++++ .../models/StaticConfigTest.etmap | 10 + .../models/StaticConfigTest.room | 393 +++++++++++++ 13 files changed, 2920 insertions(+), 20 deletions(-) create mode 100644 tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room create mode 100644 tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.config create mode 100644 tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.etmap create mode 100644 tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room create mode 100644 tests/org.eclipse.etrice.generator.common.tests/.gitignore create mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.config create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.etmap create mode 100644 tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room diff --git a/tests/org.eclipse.etrice.generator.c.tests/.gitignore b/tests/org.eclipse.etrice.generator.c.tests/.gitignore index 4f0e85af9..d2726d181 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/.gitignore +++ b/tests/org.eclipse.etrice.generator.c.tests/.gitignore @@ -1,6 +1,2 @@ -bin -models -output -results -src-gen -log \ No newline at end of file +src-gen/ +output/ \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room new file mode 100644 index 000000000..3494a48cf --- /dev/null +++ b/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room @@ -0,0 +1,605 @@ +RoomModel SendingDataTest { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Types.room" + import room.basic.language.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Language.room" + + ActorClass SendingDataTop { + @TestInstance + Structure { + ActorRef mrPing: MrPing + ActorRef mrPong: MrPong + Binding mrPong.PingPongPort and mrPing.PingPongPort + } + Behavior { } + } + + ActorClass MrPong { + Interface { + Port PingPongPort: PingPongProtocol + Port extTest: PCExternal + } + Structure { + external Port PingPongPort + external Port extTest + } + Behavior { + StateMachine { + Transition tr0: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt16(d);" + } + } + Transition tr1: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt8(d);" + } + } + Transition init: initial -> reply { } + Transition tr2: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt32(d);" + } + } + Transition tr3: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongFloat32(d);" + } + } + Transition tr4: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongFloat64(d);" + } + } + Transition tr7: reply -> cp cp0 { + triggers { + + } + } + Transition tr8: cp cp0 -> reply { + action { + "PingPongPort.pongInt32((*d)+10);" + } + } + Transition tr6: cp cp0 -> reply { + cond { + "(*d)!=5" + } + action { + "PingPongPort.pongInt32(*d);" + } + } + Transition tr9: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr11: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr5: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt64(d);" + } + } + Transition tr10: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt16(*d);" + } + } + Transition tr12: reply -> cp cp1 { + triggers { + i8ValPPD == 5" + }> + } + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr13: cp cp1 -> reply { + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr14: cp cp1 -> reply { + cond { + "d->i8ValPPD==7" + } + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr15: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongComplexDerived(d);" + } + } + Transition tr16: my tp0 -> my tp0 { + triggers { + + } + } + ChoicePoint cp0 + ChoicePoint cp1 + TransitionPoint tp0 + State reply + } + } + } + + ActorClass MrPing { + Interface { + conjugated Port PingPongPort: PingPongProtocol + } + Structure { + external Port PingPongPort + Attribute i8Val: int8="5" + Attribute i16Val:int16="19" + Attribute i32Val: int32 = "4711" + Attribute i64Val: int64 = "11470815" + Attribute i32Array [ 10 ]: int32="{0,1,2,3,4,5,6,7,8,9}" + Attribute f32Val: float32="3.14f" + Attribute f64Val: float64="7.987654321" + Attribute data: PingPongData + Attribute dataD: PingPongDataDerived + Attribute counter:int32 + Attribute caseId: int32 + Attribute lang: languageIndicator + Attribute resultlist [ 23 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" + } + Behavior { + StateMachine { + Transition init: initial -> tp0 of state0 { + action { + "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" + "EXPECT_ORDER_START(caseId,resultlist,23);" + "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" + "/* send the default values */" + "" + "PingPongPort.pingInt8(i8Val);" + "PingPongPort.pingInt16(i16Val);" + "PingPongPort.pingInt32(i32Val);" + "PingPongPort.pingInt64(i64Val);" + "PingPongPort.pingFloat32(f32Val);" + "PingPongPort.pingFloat64(f64Val);" + "PingPongPort.pingInt16Ref(&i16Val);" + "PingPongPort.pingInt32Ref(&i32Val);" + "i8Val++;" + "i16Val++;" + "i32Val++;" + "i64Val++;" + "f32Val+=10.1;" + "f64Val+=20.2;" + "PingPongPort.pingInt8(i8Val);" + "PingPongPort.pingInt16(i16Val);" + "PingPongPort.pingInt32(i32Val);" + "PingPongPort.pingInt64(i64Val);" + "PingPongPort.pingFloat32(f32Val);" + "PingPongPort.pingFloat64(f64Val);" + "PingPongPort.pingInt16Ref(&i16Val);" + "PingPongPort.pingInt32Ref(&i32Val);" + } + } + Transition tr0: tp1 of state0 -> tp0 of state1 + Transition tr1: tp1 of state1 -> test_finished + State state0 { + subgraph { + Transition tr0: my tp0 -> receiveFirst7 { + action { + "counter=0;" + } + } + Transition tr1: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==5){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr2: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==19){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr3: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==4711){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr4: receiveFirst7 -> receiveSecond7 { + triggers { + + } + action { + "counter=0;" + "if (lang == 1){" + "/* Java cannot send references of primitive types */" + "\tif (d==4711){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "} " + "if (lang == 2){" + "/* C */" + "\tif (d==4712){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "}" + } + } + Transition tr6: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==11470815){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr5: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if ((d>3)&&(d<4)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr7: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if ((d>7)&&(d<8)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr8: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==6){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr9: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==20){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr10: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==4712){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr11: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==11470816){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr12: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if ((d>13)&&(d<14)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr13: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if ((d>28)&&(d<29)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr14: receiveSecond7 -> my tp1 { + triggers { + + } + action { + "if (d==4712){\t" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr15: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (lang == 1){" + "/* Java cannot send references of primitive types */" + "\tif (d==19){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "} " + "if (lang == 2){" + "/* C */" + "\tif (d==20){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "}" + } + } + Transition tr16: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==20){\t" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + EntryPoint tp0 + ExitPoint tp1 + State receiveFirst7 + State receiveSecond7 + } + } + State test_finished { + entry { + "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" + "etUnit_closeAll(caseId);" + "etUnit_testFinished(caseId);" + } + } + State state1 { + subgraph { + Transition tr0: my tp0 -> state0 { + action { + "counter=0;" + "/* send default values */" + "PingPongPort.pingComplex(&(data));" + "PingPongPort.pingComplexRef(&(data));" + } + } + Transition tr1: state0 -> state1 { + triggers { + + } + action { + "counter=0;" + "if (d->i8ValPPD==10){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + "" + "if (d->complexVal.i32Val2PPDD==80){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + "" + "dataD.i8ValPPD=11;" + "PingPongPort.pingComplexDerived(&(dataD));" + } + } + Transition tr2: state0 -> state0 { + triggers { + + } + action { + "counter++;" + "if (d->i8ValPPD==10){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr3: state1 -> my tp1 { + triggers { + + } + action { + "if (d->i8ValPPD==11){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + "" + "if (d->i32Val3PPDe==150){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + EntryPoint tp0 + ExitPoint tp1 + State state0 + State state1 + } + } + } + } + } + + ProtocolClass PingPongProtocol { + incoming { + Message pingInt8(d: int8) + Message pingInt16(d: int16) + Message pingInt32(d: int32) + Message pingInt64(d: int64) + Message pingFloat32(d: float32) + Message pingFloat64(d: float64) + Message pingInt16Ref(d: int16 ref) + Message pingInt32Ref(d: int32 ref) + Message pingComplex(d: PingPongData) + Message pingComplexRef(d: PingPongData ref) + Message pingComplexDerived(d:PingPongDataDerived) + } + outgoing { + Message pongInt8(d: int8) + Message pongInt16(d: int16) + Message pongInt32(d: int32) + Message pongInt64(d:int64) + Message pongFloat32(d: float32) + Message pongFloat64(d: float64) + Message pongComplex(d: PingPongData) + Message pongComplexDerived(d: PingPongDataDerived) + } + } + + ProtocolClass PCExternal { + usercode1 { + "typedef int extMsg;" + } + incoming { + Message in1(can: DExtMsg) + } + } + + DataClass PingPongData { + Attribute i8ValPPD: int8 = "10" + Attribute i8ValRefPPD: int8 ref + Attribute i32ArrayPPD [ 3 ]: int32 = "{200,300,400}" + Attribute i8ArrayRefPPD [ 2 ]: int8 ref + Attribute complexVal: PingPongDataDeep + } + + DataClass PingPongDataDeep { + Attribute i32Val1PPDD: int32 + Attribute i32Val2PPDD: int32 = "80" + } + + DataClass PingPongDataDerived extends PingPongData { + Attribute i32Val3PPDe: int32 = "150" + } + + ExternalType DExtMsg -> "extMsg" +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.config b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.config new file mode 100644 index 000000000..426adc5e6 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.config @@ -0,0 +1,141 @@ +ConfigModel StaticTestConfig { + + import StaticConfigTest.* from "StaticConfigTest.room" + + ActorClassConfig Tester_ac { + // nothing + } + + ActorClassConfig Testee_1_ac { + Attr data_1 { + Attr bool_c = false + Attr bool_i = false + Attr int8_c = 24 + Attr int8_i = 24 + Attr int16_c = 48 + Attr int16_i = 48 + Attr int32_c = 96 + Attr int32_i = 96 + Attr int64_c = 192 + Attr int64_i = 192 + Attr float32_c = 9.6 + Attr float32_i = 9.6 + Attr float64_c = 19.2 + Attr float64_i = 19.2 + Attr char_c = "C" + Attr char_i = "C" + Attr string_c = ":)" + Attr string_i = ":)" + + Attr bool_array_c = true, false + Attr bool_array_i = true, false + Attr int8_array_c = 24, 48 + Attr int8_array_i = 24, 48 + Attr int16_array_c = 48, 96 + Attr int16_array_i = 48, 96 + Attr int32_array_c = 96, 192 + Attr int32_array_i = 96, 192 + Attr int64_array_c = 192, 384 + Attr int64_array_i = 192, 384 + Attr float32_array_c = 9.6 + Attr float32_array_i = 9.6 + Attr float64_array_c = 19.2 + Attr float64_array_i = 19.2 + Attr char_array_c = "Claz" + Attr char_array_i = "Claz" + + Attr data_2 { + Attr int32_c = 42 + Attr int32_i = 42 + } + } + Attr enumval1 = Enum_1.two + Attr enumval2 = Enum_2.three + } + + ActorClassConfig Testee_Super2_ac { + Attr float64_super_c = 2.2 + Attr float64_super_i = 2.2 + } + + ActorClassConfig Testee_2_ac { + Attr int32_own_c = 12 + Attr int32_own_i = 12 + } + + ProtocolClassConfig TestProtocolAttributes { + regular Port{ + Attr float_c = 3.0 + Attr float_i = 3.0 + } + conjugate Port { + Attr array2_c = 16, 32 + Attr array2_i = 16, 32 + } + } + + ProtocolClassConfig TestProtocolWithDataClass { + conjugate Port { + Attr sap_data_2{ + Attr int32_c = 2 + Attr int32_i = 2 + } + } + } + + ActorInstanceConfig System_StaticConfigTest/main/top/tester { + // nothing + } + + ActorInstanceConfig System_StaticConfigTest/main/top/testee_1 { + Attr data_1 { + Attr bool_i = true + Attr int8_i = 2 + Attr int16_i = 4 + Attr int32_i = 8 + Attr int64_i = 16 + Attr float32_i = 1.6 + Attr float64_i = 3.2 + Attr char_i = "I" + Attr string_i = ":]" + + Attr bool_array_i = true, true + Attr int8_array_i = 2, 6 + Attr int16_array_i = 4, 12 + Attr int32_array_i = 8, 24 + Attr int64_array_i = 16, 48 + Attr float32_array_i = 1.6 + Attr float64_array_i = 3.2 + Attr char_array_i = "Inst" + + Attr data_2 { + Attr int32_i = 43 + } + } + InterfaceItem conj_port { + Attr array2_i = 1, 2 + } + } + + + ActorInstanceConfig System_StaticConfigTest/main/top/tester/testee_super2{ + Attr float64_super_i = 3.3 + InterfaceItem reg_port { + Attr float_i = 25.0 + } + } + + ActorInstanceConfig System_StaticConfigTest/main/top/testee_1/testee_2 { + Attr float64_super_i = 4.4 + Attr int32_own_i = 13 + InterfaceItem reg_port { + Attr float_i = 50.0 + } + InterfaceItem sap { + Attr sap_data_2 { + Attr int32_i = 3 + } + } + } + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.etmap b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.etmap new file mode 100644 index 000000000..c0f26f88d --- /dev/null +++ b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.etmap @@ -0,0 +1,10 @@ +MappingModel StaticConfigTest { + + import StaticConfigTest.* from "StaticConfigTest.room" + import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + + Mapping System_StaticConfigTest -> GenericPhysicalSystem { + SubSystemMapping main -> node {} + } + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room new file mode 100644 index 000000000..ac8dc0a46 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room @@ -0,0 +1,421 @@ +RoomModel StaticConfigTest { + + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Types.room" + import room.basic.service.timing.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/TimingService.room" + + LogicalSystem System_StaticConfigTest { + SubSystemRef main : SubSystem_StaticConfigTest + } + + SubSystemClass SubSystem_StaticConfigTest { + LayerConnection ref top satisfied_by timer.timer + ActorRef top: Top_ac + ActorRef timer : ATimingService + } + + ActorClass Top_ac { + Structure { + ActorRef testee_1: Testee_1_ac + ActorRef tester: Tester_ac + LayerConnection ref testee_1 satisfied_by tester.spp + SAP timer : PTimer + } + Behavior { + ctor { + "etUnit_open(\".\", \"StaticConfigTest\");" + "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.StaticConfigTest\");" + } + dtor { + "etUnit_closeTestSuite();" + "etUnit_close();" + } + StateMachine { + Transition init: initial -> state0 { + action { + "timer.startTimeout(1000);" + } + } + Transition tr0: state0 -> state0 { + triggers { + + } + action { + "etUnit_testFinished(-1);" + } + } + State state0 + } + } + } + + ActorClass Tester_ac { + Interface { + SPP spp: TestProtocolWithDataClass + } + Structure { + ServiceImplementation of spp + Attribute caseId: int32 + + // none config test + Attribute data_3: Data_3_dc + ActorRef testee_super2: Testee_Super2_ac + } + Behavior { + StateMachine { + Transition init: initial -> s1 { } + State s1 { + entry { + "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Tester_ac\");" + "Data_3_dc_varCheck3(&(data_3), caseId);" + "etUnit_closeTestCase(caseId);" + } + } + } + } + } + + ActorClass Testee_1_ac { + Interface { + conjugated Port conj_port: TestProtocolAttributes + } + Structure { + usercode1 { + "#include \"etUnit/etUnit.h\"" + } + external Port conj_port + Attribute caseId: int32 + Attribute data_1: Data_1_dc + Attribute enumval1: Enum_1 = "one" + Attribute enumval2: Enum_2 = "four" + ActorRef testee_2: Testee_2_ac + } + Behavior { + StateMachine { + Transition init: initial -> s1 { } + State s1 { + entry { + "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_1_ac\");" + "Data_1_dc_varCheck1(&(data_1), caseId);" + "EXPECT_FALSE(caseId,\"testee_1:data_1:1\", data_1.bool_c);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:2\", data_1.int8_c == 24);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:3\", data_1.int16_c == 48);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:4\", data_1.int32_c == 96);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:5\", data_1.int64_c == 192);" + "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:6\", 9.6f, data_1.float32_c, 0.1f);" + "EXPECT_EQUAL_FLOAT64(caseId,\"testee_1:data_1:7\", 19.2, data_1.float64_c, 0.1);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:8\", data_1.char_c == \'C\');" + "EXPECT_TRUE(caseId,\"testee_1:varCheck:8.1\", strcmp(data_1.string_c, \":)\") == 0 );" + "EXPECT_TRUE(caseId,\"testee_1:data_1:10\", data_1.bool_i);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:11\", data_1.int8_i == 2);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:12\", data_1.int16_i == 4);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:13\", data_1.int32_i == 8);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:14\", data_1.int64_i == 16);" + "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:15\", 1.6f, data_1.float32_i, 0.1f);" + "EXPECT_EQUAL_FLOAT64(caseId,\"testee_1:data_1:16\", 3.2, data_1.float64_i, 0.1);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:17\", data_1.char_i == \'I\');" + "EXPECT_TRUE(caseId,\"testee_1:varCheck:18\", strcmp(data_1.string_i, \":]\") == 0 );" + + // Array + "EXPECT_TRUE(caseId,\"testee_1:data_1:19\", data_1.bool_array_c[0] == ET_TRUE && data_1.bool_array_c[1] == ET_FALSE);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:20\", data_1.int8_array_c[0] == 24 && data_1.int8_array_c[1] == 48);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:21\", data_1.int16_array_c[0] == 48 && data_1.int16_array_c[1] == 96);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:22\", data_1.int32_array_c[0] == 96 && data_1.int32_array_c[1] == 192);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:23\", data_1.int64_array_c[0] == 192 && data_1.int64_array_c[1] == 384);" + "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:24_1\", 9.6f, data_1.float32_array_c[0], 0.1f);" + "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:24_2\", 9.6f, data_1.float32_array_c[1], 0.1f);" + "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:25_1\", 19.2, data_1.float64_array_c[0], 0.1);" + "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:25_2\", 19.2, data_1.float64_array_c[1], 0.1);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:26\", strcmp(data_1.char_array_c, \"Claz\") == 0);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:27\", data_1.bool_array_i[0] == ET_TRUE && data_1.bool_array_i[1] == ET_TRUE);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:28\", data_1.int8_array_i[0] == 2 && data_1.int8_array_i[1] == 6);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:29\", data_1.int16_array_i[0] == 4 && data_1.int16_array_i[1] == 12);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:30\", data_1.int32_array_i[0] == 8 && data_1.int32_array_i[1] == 24);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:31\", data_1.int64_array_i[0] == 16 && data_1.int64_array_i[1] == 48);" + "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:32_1\", 1.6f, data_1.float32_array_i[0], 0.1f);" + "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:32_2\", 1.6f, data_1.float32_array_i[1], 0.1f);" + "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:33_1\", 3.2, data_1.float64_array_i[0], 0.1);" + "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:33_2\", 3.2, data_1.float64_array_i[1], 0.1);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:34\", strcmp(data_1.char_array_i, \"Inst\") == 0);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:35\", data_1.data_2.int32_c == 42);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:36\", data_1.data_2.int32_i == 43);" + + // conj_port + "EXPECT_TRUE(caseId,\"testee_1:conj_port:36\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_r[0] == 11);" + "EXPECT_TRUE(caseId,\"testee_1:conj_port:37\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_r[1] == 22);" + "EXPECT_TRUE(caseId,\"testee_1:conj_port:38\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_c[0] == 16);" + "EXPECT_TRUE(caseId,\"testee_1:conj_port:39\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_c[1] == 32);" + "EXPECT_TRUE(caseId,\"testee_1:conj_port:40\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_i[0] == 1);" + "EXPECT_TRUE(caseId,\"testee_1:conj_port:41\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_i[1] == 2);" + "etUnit_testFinished(caseId);" + + // enums + "EXPECT_TRUE(caseId,\"testee_1:enumval1\", enumval1 == Enum_1.two);" + "EXPECT_TRUE(caseId,\"testee_1:enumval2\", enumval2 == Enum_2.three);" + "etUnit_closeTestCase(caseId);" + } + } + } + } + } + + ActorClass Testee_Super2_ac { + Interface { + Port reg_port: TestProtocolAttributes + } + Structure { + usercode1 { + "#include \"etUnit/etUnit.h\"" + } + external Port reg_port + Attribute caseId: int32 + + // test + Attribute data_2: Data_2_dc + Attribute float64_super_r: float64 = "1.1" + Attribute float64_super_c: float64 = "1.1" + Attribute float64_super_i: float64 = "1.1" + } + Behavior { + ctor { + "testInstanceConfig();" + } + Operation testInstanceConfig(){ + "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_Super2_ac\");" + "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_Super2_ac:1\", 1.1, float64_super_r, 0.1);" + "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_Super2_ac:2\", 2.2, float64_super_c, 0.1);" + "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_Super2_ac:3\", 3.3, float64_super_i, 0.1);" + "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:7\", 25.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);" + // reg_port + "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:5\", 4.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);" + "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:6\", 3.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);" + "etUnit_closeTestCase(caseId);" + } + } + } + + ActorClass Testee_2_ac extends Testee_Super2_ac { + Structure { + SAP sap: TestProtocolWithDataClass + Attribute int32_own_r: int32 = "11" + Attribute int32_own_c: int32 = "11" + Attribute int32_own_i: int32 = "11" + } + Behavior { + override Operation testInstanceConfig(){ + "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_2_ac\");" + "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_2_ac:2\", 4.4, float64_super_i, 0.1);" + "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:9\", 50.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);" + } + StateMachine { + Transition init: initial -> s1 { } + State s1 { + entry { + "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_2_ac:1\", 2.2, float64_super_c, 0.1);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:3\", int32_own_r == 11);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:4\", int32_own_c == 12);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:5\", int32_own_i == 13);" + + // reg_port + "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:6\", 4.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);" + "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:7\", 3.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);" + + // sap + "Data_3_dc_varCheck3(&(((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_3), caseId);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:10\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_r == 1);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:11\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_c == 2);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:12\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_i == 3);" + "etUnit_closeTestCase(caseId);" + } + } + } + } + } + + ProtocolClass TestProtocolAttributes { + incoming { + Message dummy() + } + regular PortClass + { + Attribute float_r: float32 = "4" + Attribute float_c: float32 = "16" + Attribute float_i: float32 = "256" + } + conjugated PortClass + { + Attribute array2_r [ 2 ]: int64 = "{11,22}" + Attribute array2_c [ 2 ]: int64 = "{0,0}" + Attribute array2_i [ 2 ]: int64 = "{0,0}" + } + } + + ProtocolClass TestProtocolWithDataClass { + usercode1 { + "#include \"Data_2_dc.h\"" + "#include \"Data_3_dc.h\"" + } + incoming { + Message dummy() + } + + //SAP + conjugated PortClass + { + Attribute sap_data_2: Data_2_dc + + // none config test + Attribute sap_data_3: Data_3_dc + } + } + + ExternalType extType -> "int" default "999" + + DataClass Data_Super1_dc { + // PrimitiveType + Attribute bool_r: boolean = "false" + Attribute bool_c: boolean = "false" + Attribute bool_i: boolean = "false" + // Array + Attribute bool_array_r [ 2 ]: boolean = "{ ET_FALSE, false }" + Attribute bool_array_c [ 2 ]: boolean = "{ false, false }" + Attribute bool_array_i [ 2 ]: boolean = "{ false, false }" + } + + DataClass Data_1_dc extends Data_Super1_dc{ + usercode1 { + "#include \"etUnit/etUnit.h\"" + } + + Attribute int8_r: int8 = "8" + Attribute int8_c: int8 = "8" + Attribute int8_i: int8 = "8" + Attribute int16_r: int16 = "16" + Attribute int16_c: int16 = "16" + Attribute int16_i: int16 = "16" + Attribute int32_r: int32 = "32" + Attribute int32_c: int32 = "32" + Attribute int32_i: int32 = "32" + Attribute int64_r: int64 = "64" + Attribute int64_c: int64 = "64" + Attribute int64_i: int64 = "64" + Attribute float32_r: float32 = "3.2" + Attribute float32_c: float32 = "3.2" + Attribute float32_i: float32 = "3.2" + Attribute float64_r: float64 = "6.4" + Attribute float64_c: float64 = "6.4" + Attribute float64_i: float64 = "6.4" + Attribute char_r: char = "R" + Attribute char_c: char = 'R' + Attribute char_i: char = "R" + Attribute string_r: string = ":/" + Attribute string_c: string = ":/" + Attribute string_i: string = ":/" + + // Array + Attribute int8_array_r [ 2 ]: int8 = "{ 8, 16 }" + Attribute int8_array_c [ 2 ]: int8 = "{ 8, 16 }" + Attribute int8_array_i [ 2 ]: int8 = "{ 8, 16 }" + Attribute int16_array_r [ 2 ]: int16 = "{ 16, 32 }" + Attribute int16_array_c [ 2 ]: int16 = "{ 16, 32 }" + Attribute int16_array_i [ 2 ]: int16 = "{ 16, 32 }" + Attribute int32_array_r [ 2 ]: int32 = "{ 32, 64 }" + Attribute int32_array_c [ 2 ]: int32 = "{ 32, 64 }" + Attribute int32_array_i [ 2 ]: int32 = "{ 32, 64 }" + Attribute int64_array_r [ 2 ]: int64 = "{ 64, 128 }" + Attribute int64_array_c [ 2 ]: int64 = "{ 64, 128 }" + Attribute int64_array_i [ 2 ]: int64 = "{ 64, 128 }" + Attribute float32_array_r [ 2 ]: float32 = "{ 3.2, 6.4 }" + Attribute float32_array_c [ 2 ]: float32 = "{ 3.2, 6.4 }" + Attribute float32_array_i [ 2 ]: float32 = "{ 3.2, 6.4 }" + Attribute float64_array_r [ 2 ]: float64 = "{ 6.4, 12.8 }" + Attribute float64_array_c [ 2 ]: float64 = "{ 6.4, 12.8 }" + Attribute float64_array_i [ 2 ]: float64 = "{ 6.4, 12.8 }" + Attribute char_array_r [ 5 ]: char = "ROOM" + Attribute char_array_c [ 5 ]: char = "ROOM" + Attribute char_array_i [ 5 ]: char = "ROOM" + + // ComplexType + Attribute data_2: Data_2_dc + + Operation varCheck1(caseId: int32) { + "Data_2_dc_varCheck2(&(data_2), caseId);" + + // PrimitiveType + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:1\", bool_r == ET_FALSE);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:2\", int8_r == 8);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:3\", int16_r == 16);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:4\", int32_r == 32);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:5\", int64_r == 64);" + "EXPECT_EQUAL_FLOAT32(caseId,\"Data_1_dc:varCheck:6\", 3.2f, float32_r, 0.1f);" + "EXPECT_EQUAL_FLOAT64(caseId,\"Data_1_dc:varCheck:7\", 6.4, float64_r, 0.1);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", char_r == \'R\');" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", strcmp(string_r, \":/\") == 0 );" + + // Array + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:10\", bool_array_r[0] == ET_FALSE && bool_array_r[1] == ET_FALSE);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:11\", int8_array_r[0] == 8 && int8_array_r[1] == 16);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:12\", int16_array_r[0] == 16 && int16_array_r[1] == 32);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:13\", int32_array_r[0] == 32 && int32_array_r[1] == 64);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:24\", int64_array_r[0] == 64 && int64_array_r[1] == 128);" + "EXPECT_EQUAL_FLOAT32(caseId, \"Data_1_dc:varCheck:25_1\", 3.2f, float32_array_r[0], 0.1f);" + "EXPECT_EQUAL_FLOAT32(caseId, \"Data_1_dc:varCheck:25_2\", 6.4f, float32_array_r[1], 0.1f);" + "EXPECT_EQUAL_FLOAT64(caseId, \"Data_1_dc:varCheck:26_1\", 6.4, float64_array_r[0], 0.1);" + "EXPECT_EQUAL_FLOAT64(caseId, \"Data_1_dc:varCheck:26_2\", 12.8, float64_array_r[1], 0.1);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:27\", strcmp(char_array_r, \"ROOM\")==0);" + } + } + + DataClass Data_2_dc { + usercode1 { + "#include \"etUnit/etUnit.h\"" + } + Attribute int32_r: int32 = "1" + Attribute int32_c: int32 = "1" + Attribute int32_i: int32 = "1" + Operation varCheck2(caseId: int32): void { + "EXPECT_TRUE(caseId, \"Data_2_dc:1\", int32_r == 1);" + } + } + + DataClass Data_3_dc { + usercode1 { + "#include \"etUnit/etUnit.h\"" + } + + // none config test + Attribute primitive_ref: int32 ref + Attribute primitive_ref_array [ 2 ]: int32 ref + Attribute dataClass_array [ 2 ]: Data_2_dc + Attribute dataClass_ref: Data_2_dc ref + Attribute dataClass_ref_array [ 2 ]: Data_2_dc ref + Attribute ext_type: extType + Attribute ext_type_array [ 2 ]: extType + Attribute ext_type_ref: extType ref + Attribute ext_type_ref_array [ 2 ]: extType ref + Operation varCheck3(caseId: int32): void { + "EXPECT_TRUE(caseId, \"Data_3_dc:1\", primitive_ref == NULL);" + "EXPECT_TRUE(caseId, \"Data_3_dc:2\", primitive_ref_array[0] == NULL && primitive_ref_array[1] == NULL);" + "EXPECT_TRUE(caseId, \"Data_3_dc:3\", dataClass_ref == NULL);" + "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_array[0].int32_r == 1 && dataClass_array[0].int32_c == 1 && dataClass_array[0].int32_i == 1);" + "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_array[1].int32_r == 1 && dataClass_array[1].int32_c == 1 && dataClass_array[1].int32_i == 1);" + "EXPECT_TRUE(caseId, \"Data_3_dc:5\", dataClass_ref == NULL);" + "EXPECT_TRUE(caseId, \"Data_3_dc:6\", dataClass_ref_array[0] == NULL && dataClass_ref_array[1] == NULL);" + "EXPECT_TRUE(caseId, \"Data_3_dc:7\", ext_type == 999);" + "EXPECT_TRUE(caseId, \"Data_3_dc:8\", ext_type_array[0] == 999 && ext_type_array[1] == 999);" + "EXPECT_TRUE(caseId, \"Data_3_dc:9\", ext_type_ref == NULL);" + "EXPECT_TRUE(caseId, \"Data_3_dc:10\", ext_type_ref_array[0] == NULL && dataClass_ref_array[1] == NULL);" + } + } + + Enumeration Enum_1 { + zero, + one, + two + } + + Enumeration Enum_2 of int16 { + three=3, + four + } + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/.gitignore b/tests/org.eclipse.etrice.generator.common.tests/.gitignore new file mode 100644 index 000000000..d2726d181 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.common.tests/.gitignore @@ -0,0 +1,2 @@ +src-gen/ +output/ \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore b/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore index 4f0e85af9..d2726d181 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore +++ b/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore @@ -1,6 +1,2 @@ -bin -models -output -results -src-gen -log \ No newline at end of file +src-gen/ +output/ \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room new file mode 100644 index 000000000..623003187 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room @@ -0,0 +1,605 @@ +RoomModel SendingDataTest { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.cpp/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.cpp/model/Types.room" + import room.basic.language.* from "../../../runtime/org.eclipse.etrice.modellib.cpp/model/Language.room" + + ActorClass SendingDataTop { + @TestInstance + Structure { + ActorRef mrPing: MrPing + ActorRef mrPong: MrPong + Binding mrPong.PingPongPort and mrPing.PingPongPort + } + Behavior { } + } + + ActorClass MrPong { + Interface { + Port PingPongPort: PingPongProtocol + Port extTest: PCExternal + } + Structure { + external Port PingPongPort + external Port extTest + } + Behavior { + StateMachine { + Transition tr0: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt16(d);" + } + } + Transition tr1: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt8(d);" + } + } + Transition init: initial -> reply { } + Transition tr2: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt32(d);" + } + } + Transition tr3: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongFloat32(d);" + } + } + Transition tr4: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongFloat64(d);" + } + } + Transition tr7: reply -> cp cp0 { + triggers { + + } + } + Transition tr8: cp cp0 -> reply { + action { + "PingPongPort.pongInt32((*d)+10);" + } + } + Transition tr6: cp cp0 -> reply { + cond { + "(*d)!=5" + } + action { + "PingPongPort.pongInt32(*d);" + } + } + Transition tr9: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr11: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongComplex(*d);" + } + } + Transition tr5: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt64(d);" + } + } + Transition tr10: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt16(*d);" + } + } + Transition tr12: reply -> cp cp1 { + triggers { + i8ValPPD == 5" + }> + } + action { + "PingPongPort.pongComplex(*d);" + } + } + Transition tr13: cp cp1 -> reply { + action { + "PingPongPort.pongComplex(*d);" + } + } + Transition tr14: cp cp1 -> reply { + cond { + "d->i8ValPPD==7" + } + action { + "PingPongPort.pongComplex(*d);" + } + } + Transition tr15: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongComplexDerived(d);" + } + } + Transition tr16: my tp0 -> my tp0 { + triggers { + + } + } + ChoicePoint cp0 + ChoicePoint cp1 + TransitionPoint tp0 + State reply + } + } + } + + ActorClass MrPing { + Interface { + conjugated Port PingPongPort: PingPongProtocol + } + Structure { + external Port PingPongPort + Attribute i8Val: int8="5" + Attribute i16Val:int16="19" + Attribute i32Val: int32 = "4711" + Attribute i64Val: int64 = "11470815" + Attribute i32Array [ 10 ]: int32 = "{0,1,2,3,4,5,6,7,8,9}" + Attribute f32Val: float32="3.14f" + Attribute f64Val: float64="7.987654321" + Attribute data: PingPongData + Attribute dataD: PingPongDataDerived + Attribute counter:int32 + Attribute caseId: int32 + Attribute lang: languageIndicator + Attribute resultlist [ 23 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" + } + Behavior { + StateMachine { + Transition init: initial -> tp0 of state0 { + action { + "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" + "EXPECT_ORDER_START(caseId,resultlist,23);" + "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" + "/* send the default values */" + "" + "PingPongPort.pingInt8(i8Val);" + "PingPongPort.pingInt16(i16Val);" + "PingPongPort.pingInt32(i32Val);" + "PingPongPort.pingInt64(i64Val);" + "PingPongPort.pingFloat32(f32Val);" + "PingPongPort.pingFloat64(f64Val);" + "PingPongPort.pingInt16Ref(&i16Val);" + "PingPongPort.pingInt32Ref(&i32Val);" + "i8Val++;" + "i16Val++;" + "i32Val++;" + "i64Val++;" + "f32Val+=10.1;" + "f64Val+=20.2;" + "PingPongPort.pingInt8(i8Val);" + "PingPongPort.pingInt16(i16Val);" + "PingPongPort.pingInt32(i32Val);" + "PingPongPort.pingInt64(i64Val);" + "PingPongPort.pingFloat32(f32Val);" + "PingPongPort.pingFloat64(f64Val);" + "PingPongPort.pingInt16Ref(&i16Val);" + "PingPongPort.pingInt32Ref(&i32Val);" + } + } + Transition tr0: tp1 of state0 -> tp0 of state1 + Transition tr1: tp1 of state1 -> test_finished + State state0 { + subgraph { + Transition tr0: my tp0 -> receiveFirst7 { + action { + "counter=0;" + } + } + Transition tr1: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==5){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr2: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==19){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr3: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==4711){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr4: receiveFirst7 -> receiveSecond7 { + triggers { + + } + action { + "counter=0;" + "if (lang == 1){" + "/* Java cannot send references of primitive types */" + "\tif (d==4711){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "} " + "if (lang == 2){" + "/* C */" + "\tif (d==4712){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "}" + } + } + Transition tr6: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==11470815){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr5: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if ((d>3)&&(d<4)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr7: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if ((d>7)&&(d<8)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr8: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==6){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr9: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==20){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr10: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==4712){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr11: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==11470816){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr12: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if ((d>13)&&(d<14)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr13: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if ((d>28)&&(d<29)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr14: receiveSecond7 -> my tp1 { + triggers { + + } + action { + "if (d==4712){\t" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr15: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (lang == 1){" + "/* Java cannot send references of primitive types */" + "\tif (d==19){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "} " + "if (lang == 2){" + "/* C */" + "\tif (d==20){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "}" + } + } + Transition tr16: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==20){\t" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + EntryPoint tp0 + ExitPoint tp1 + State receiveFirst7 + State receiveSecond7 + } + } + State test_finished { + entry { + "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" + "etUnit_closeAll(caseId);" + "etUnit_testFinished(caseId);" + } + } + State state1 { + subgraph { + Transition tr0: my tp0 -> state0 { + action { + "counter=0;" + "/* send default values */" + "PingPongPort.pingComplex(data);" + "PingPongPort.pingComplexRef(&data);" + } + } + Transition tr1: state0 -> state1 { + triggers { + + } + action { + "counter=0;" + "if (d.i8ValPPD==10){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + "" + "if (d.complexVal.i32Val2PPDD==80){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + "" + "dataD.i8ValPPD=11;" + "PingPongPort.pingComplexDerived(dataD);" + } + } + Transition tr2: state0 -> state0 { + triggers { + + } + action { + "counter++;" + "if (d.i8ValPPD==10){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr3: state1 -> my tp1 { + triggers { + + } + action { + "if (d.i8ValPPD==11){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + "" + "if (d.i32Val3PPDe==150){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + EntryPoint tp0 + ExitPoint tp1 + State state0 + State state1 + } + } + } + } + } + + ProtocolClass PingPongProtocol { + incoming { + Message pingInt8(d: int8) + Message pingInt16(d: int16) + Message pingInt32(d: int32) + Message pingInt64(d: int64) + Message pingFloat32(d: float32) + Message pingFloat64(d: float64) + Message pingInt16Ref(d: int16 ref) + Message pingInt32Ref(d: int32 ref) + Message pingComplex(d: PingPongData) + Message pingComplexRef(d: PingPongData ref) + Message pingComplexDerived(d:PingPongDataDerived) + } + outgoing { + Message pongInt8(d: int8) + Message pongInt16(d: int16) + Message pongInt32(d: int32) + Message pongInt64(d:int64) + Message pongFloat32(d: float32) + Message pongFloat64(d: float64) + Message pongComplex(d: PingPongData) + Message pongComplexDerived(d: PingPongDataDerived) + } + } + + ProtocolClass PCExternal { + usercode1 { + "typedef int extMsg;" + } + incoming { + Message in1(can: DExtMsg) + } + } + + DataClass PingPongData { + Attribute i8ValPPD: int8 = "10" + Attribute i8ValRefPPD: int8 ref + Attribute i32ArrayPPD [ 3 ]: int32 = "{200,300,400}" + Attribute i8ArrayRefPPD [ 2 ]: int8 ref + Attribute complexVal: PingPongDataDeep + } + + DataClass PingPongDataDeep { + Attribute i32Val1PPDD: int32 + Attribute i32Val2PPDD: int32 = "80" + } + + DataClass PingPongDataDerived extends PingPongData { + Attribute i32Val3PPDe: int32 = "150" + } + + ExternalType DExtMsg -> "extMsg" +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/.gitignore b/tests/org.eclipse.etrice.generator.java.tests/.gitignore index 074d50426..d2726d181 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/.gitignore +++ b/tests/org.eclipse.etrice.generator.java.tests/.gitignore @@ -1,8 +1,2 @@ -bin -models -output -results -src-gen -log -/tmp/ -/*.obj +src-gen/ +output/ \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room new file mode 100644 index 000000000..ce9056bdb --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room @@ -0,0 +1,586 @@ +RoomModel SendingDataTest { + + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + import room.basic.language.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Language.room" + + ActorClass SendingDataTop { + @TestInstance + Structure { + ActorRef mrPing: MrPing + ActorRef mrPong: MrPong + Binding mrPong.PingPongPort and mrPing.PingPongPort + } + Behavior { } + } + + ActorClass MrPong { + Interface { + Port PingPongPort: PingPongProtocol + } + Structure { + external Port PingPongPort + } + Behavior { + StateMachine { + Transition tr0: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt16(d);" + } + } + Transition tr1: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt8(d);" + } + } + Transition init: initial -> reply { } + Transition tr2: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt32(d);" + } + } + Transition tr3: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongFloat32(d);" + } + } + Transition tr4: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongFloat64(d);" + } + } + Transition tr7: reply -> cp cp0 { + triggers { + + } + } + Transition tr8: cp cp0 -> reply { + action { + "PingPongPort.pongInt32(d+10);" + } + } + Transition tr6: cp cp0 -> reply { + cond { + "d!=5" + } + action { + "PingPongPort.pongInt32(d);" + } + } + Transition tr9: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr11: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr5: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt64(d);" + } + } + Transition tr10: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongInt16(d);" + } + } + Transition tr12: reply -> cp cp1 { + triggers { + + } + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr13: cp cp1 -> reply { + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr14: cp cp1 -> reply { + cond { + "d.i8Val==7" + } + action { + "PingPongPort.pongComplex(d);" + } + } + Transition tr15: reply -> reply { + triggers { + + } + action { + "PingPongPort.pongComplexDerived(d);" + } + } + ChoicePoint cp0 + ChoicePoint cp1 + State reply + } + } + } + + ActorClass MrPing { + Interface { + conjugated Port PingPongPort: PingPongProtocol + } + Structure { + external Port PingPongPort + Attribute i8Val: int8="5" + Attribute i16Val:int16="19" + Attribute i32Val: int32 = "4711" + Attribute i64Val: int64 = "11470815" + Attribute i32Array [ 10 ]: int32="{0,1,2,3,4,5,6,7,8,9}" + Attribute f32Val: float32="3.14" + Attribute f64Val: float64="7.987654321" + Attribute data: PingPongData + Attribute dataD: PingPongDataDerived + Attribute counter:int32 + Attribute caseId: int32 + Attribute lang: languageIndicator + Attribute resultlist [ 18 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" + } + Behavior { + StateMachine { + Transition init: initial -> tp0 of state0 { + action { + "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" + "EXPECT_ORDER_START(caseId,resultlist,23);" + "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" + "// send the default values" + "" + "PingPongPort.pingInt8(i8Val);" + "PingPongPort.pingInt16(i16Val);" + "PingPongPort.pingInt32(i32Val);" + "PingPongPort.pingInt64(i64Val);" + "PingPongPort.pingFloat32(f32Val);" + "PingPongPort.pingFloat64(f64Val);" + "PingPongPort.pingInt16Ref(i16Val);" + "PingPongPort.pingInt32Ref(i32Val);" + "i8Val++;" + "i16Val++;" + "i32Val++;" + "i64Val++;" + "f32Val+=10.1;" + "f64Val+=20.2;" + "PingPongPort.pingInt8(i8Val);" + "PingPongPort.pingInt16(i16Val);" + "PingPongPort.pingInt32(i32Val);" + "PingPongPort.pingInt64(i64Val);" + "PingPongPort.pingFloat32(f32Val);" + "PingPongPort.pingFloat64(f64Val);" + "PingPongPort.pingInt16Ref(i16Val);" + "PingPongPort.pingInt32Ref(i32Val);" + } + } + Transition tr0: tp1 of state0 -> tp0 of state1 + Transition tr1: tp1 of state1 -> test_finished + State state0 { + subgraph { + Transition tr0: my tp0 -> receiveFirst7 { + action { + "counter=0;" + } + } + Transition tr1: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==5){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr2: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==19){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr3: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==4711){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr4: receiveFirst7 -> receiveSecond7 { + triggers { + + } + action { + "counter=0;" + "if (lang == 1){" + "// Java cannot send references of primitive types" + "\tif (d==4711){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "} " + "if (lang == 2){" + "// C" + "\tif (d==4712){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "}" + } + } + Transition tr6: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (d==11470815){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr5: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if ((d>3)&&(d<4)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr7: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if ((d>7)&&(d<8)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr8: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==6){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr9: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==20){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr10: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==4712){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr11: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==11470816){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr12: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if ((d>13)&&(d<14)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr13: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if ((d>28)&&(d<29)){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr14: receiveSecond7 -> my tp1 { + triggers { + + } + action { + "if (d==4712){\t" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr15: receiveFirst7 -> receiveFirst7 { + triggers { + + } + action { + "counter++;" + "if (lang == 1){" + "// Java cannot send references of primitive types" + "\tif (d==19){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "} " + "if (lang == 2){" + "// C" + "\tif (d==20){\t" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" + "\t}else{" + "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "\t}" + "}" + } + } + Transition tr16: receiveSecond7 -> receiveSecond7 { + triggers { + + } + action { + "counter++;" + "if (d==20){\t" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + EntryPoint tp0 + ExitPoint tp1 + State receiveFirst7 + State receiveSecond7 + } + } + State test_finished { + entry { + "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" + "etUnit_closeAll(caseId);" + "etUnit_testFinished(caseId);" + } + } + State state1 { + subgraph { + Transition tr0: my tp0 -> state0 { + action { + "counter=0;" + "// send default values" + "PingPongPort.pingComplex(data);" + "PingPongPort.pingComplexRef(data);" + } + } + Transition tr1: state0 -> state1 { + triggers { + + } + action { + "counter=0;" + "if (d.i8Val==10){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + "" + "if (d.complexVal.i32Val2==80){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + "" + "dataD.i8Val=11;" + "PingPongPort.pingComplexDerived(dataD);" + } + } + Transition tr2: state0 -> state0 { + triggers { + + } + action { + "counter++;" + "if (d.i8Val==10){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + Transition tr3: state1 -> my tp1 { + triggers { + + } + action { + "if (d.i8Val==11){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + "" + "if (d.i32Val3==150){" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" + "}else{" + "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" + "}" + } + } + EntryPoint tp0 + ExitPoint tp1 + State state0 + State state1 + } + } + } + } + } + + ProtocolClass PingPongProtocol { + incoming { + Message pingInt8(d: int8) + Message pingInt16(d: int16) + Message pingInt32(d: int32) + Message pingInt64(d: int64) + Message pingFloat32(d: float32) + Message pingFloat64(d: float64) + Message pingInt16Ref(d: int16 ref) + Message pingInt32Ref(d: int32 ref) + Message pingComplex(d: PingPongData) + Message pingComplexRef(d: PingPongData ref) + Message pingComplexDerived(d:PingPongDataDerived) + } + outgoing { + Message pongInt8(d: int8) + Message pongInt16(d: int16) + Message pongInt32(d: int32) + Message pongInt64(d:int64) + Message pongFloat32(d: float32) + Message pongFloat64(d: float64) + Message pongComplex(d: PingPongData) + Message pongComplexDerived(d: PingPongDataDerived) + } + } + + DataClass PingPongData { + Attribute i8Val: int8 = "10" + Attribute i8ValRef: int8 ref + Attribute i32Array [ 3 ]: int32 = "{200,300,400}" + Attribute i8ArrayRef [ 2 ]: int8 ref + Attribute complexVal: PingPongDataDeep + } + + DataClass PingPongDataDeep { + Attribute i32Val1: int32 + Attribute i32Val2: int32 = "80" + } + + DataClass PingPongDataDerived extends PingPongData { + Attribute i32Val3: int32 = "150" + } +} diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.config b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.config new file mode 100644 index 000000000..426adc5e6 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.config @@ -0,0 +1,141 @@ +ConfigModel StaticTestConfig { + + import StaticConfigTest.* from "StaticConfigTest.room" + + ActorClassConfig Tester_ac { + // nothing + } + + ActorClassConfig Testee_1_ac { + Attr data_1 { + Attr bool_c = false + Attr bool_i = false + Attr int8_c = 24 + Attr int8_i = 24 + Attr int16_c = 48 + Attr int16_i = 48 + Attr int32_c = 96 + Attr int32_i = 96 + Attr int64_c = 192 + Attr int64_i = 192 + Attr float32_c = 9.6 + Attr float32_i = 9.6 + Attr float64_c = 19.2 + Attr float64_i = 19.2 + Attr char_c = "C" + Attr char_i = "C" + Attr string_c = ":)" + Attr string_i = ":)" + + Attr bool_array_c = true, false + Attr bool_array_i = true, false + Attr int8_array_c = 24, 48 + Attr int8_array_i = 24, 48 + Attr int16_array_c = 48, 96 + Attr int16_array_i = 48, 96 + Attr int32_array_c = 96, 192 + Attr int32_array_i = 96, 192 + Attr int64_array_c = 192, 384 + Attr int64_array_i = 192, 384 + Attr float32_array_c = 9.6 + Attr float32_array_i = 9.6 + Attr float64_array_c = 19.2 + Attr float64_array_i = 19.2 + Attr char_array_c = "Claz" + Attr char_array_i = "Claz" + + Attr data_2 { + Attr int32_c = 42 + Attr int32_i = 42 + } + } + Attr enumval1 = Enum_1.two + Attr enumval2 = Enum_2.three + } + + ActorClassConfig Testee_Super2_ac { + Attr float64_super_c = 2.2 + Attr float64_super_i = 2.2 + } + + ActorClassConfig Testee_2_ac { + Attr int32_own_c = 12 + Attr int32_own_i = 12 + } + + ProtocolClassConfig TestProtocolAttributes { + regular Port{ + Attr float_c = 3.0 + Attr float_i = 3.0 + } + conjugate Port { + Attr array2_c = 16, 32 + Attr array2_i = 16, 32 + } + } + + ProtocolClassConfig TestProtocolWithDataClass { + conjugate Port { + Attr sap_data_2{ + Attr int32_c = 2 + Attr int32_i = 2 + } + } + } + + ActorInstanceConfig System_StaticConfigTest/main/top/tester { + // nothing + } + + ActorInstanceConfig System_StaticConfigTest/main/top/testee_1 { + Attr data_1 { + Attr bool_i = true + Attr int8_i = 2 + Attr int16_i = 4 + Attr int32_i = 8 + Attr int64_i = 16 + Attr float32_i = 1.6 + Attr float64_i = 3.2 + Attr char_i = "I" + Attr string_i = ":]" + + Attr bool_array_i = true, true + Attr int8_array_i = 2, 6 + Attr int16_array_i = 4, 12 + Attr int32_array_i = 8, 24 + Attr int64_array_i = 16, 48 + Attr float32_array_i = 1.6 + Attr float64_array_i = 3.2 + Attr char_array_i = "Inst" + + Attr data_2 { + Attr int32_i = 43 + } + } + InterfaceItem conj_port { + Attr array2_i = 1, 2 + } + } + + + ActorInstanceConfig System_StaticConfigTest/main/top/tester/testee_super2{ + Attr float64_super_i = 3.3 + InterfaceItem reg_port { + Attr float_i = 25.0 + } + } + + ActorInstanceConfig System_StaticConfigTest/main/top/testee_1/testee_2 { + Attr float64_super_i = 4.4 + Attr int32_own_i = 13 + InterfaceItem reg_port { + Attr float_i = 50.0 + } + InterfaceItem sap { + Attr sap_data_2 { + Attr int32_i = 3 + } + } + } + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.etmap new file mode 100644 index 000000000..c0f26f88d --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.etmap @@ -0,0 +1,10 @@ +MappingModel StaticConfigTest { + + import StaticConfigTest.* from "StaticConfigTest.room" + import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + + Mapping System_StaticConfigTest -> GenericPhysicalSystem { + SubSystemMapping main -> node {} + } + +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room new file mode 100644 index 000000000..3d3ba6b49 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room @@ -0,0 +1,393 @@ +RoomModel StaticConfigTest { + + import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + import room.basic.service.timing.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/TimingService.room" + + LogicalSystem System_StaticConfigTest { + SubSystemRef main : SubSystem_StaticConfigTest + } + + SubSystemClass SubSystem_StaticConfigTest { + LayerConnection ref top satisfied_by timer.timer + ActorRef top: Top_ac + ActorRef timer : ATimingService + } + + ActorClass Top_ac { + Structure { + LayerConnection ref testee_1 satisfied_by tester.spp + ActorRef testee_1: Testee_1_ac + ActorRef tester: Tester_ac + SAP timer : PTimer + } + Behavior { + ctor { + "etUnit_open(\".\", \"StaticConfigTest\");" + "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.StaticConfigTest\");" + } + dtor { + "etUnit_closeTestSuite();" + "etUnit_close();" + } + StateMachine { + Transition init: initial -> state0 { + action { + "timer.startTimeout(1000);" + } + } + Transition tr0: state0 -> state0 { + triggers { + + } + action { + "etUnit_testFinished(-1);" + } + } + State state0 + } + } + } + + ActorClass Tester_ac { + Interface { + SPP spp: TestProtocolWithDataClass + } + Structure { + ServiceImplementation of spp + ActorRef testee_super2: Testee_Super2_ac + Attribute caseId: int32 + + // none config test + Attribute data_3: Data_3_dc + } + Behavior { + StateMachine { + Transition init: initial -> s1 + State s1 { + entry { + "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Tester_ac\");" + "data_3.varCheck3(caseId);" + "SubSystemClassBase subSystem = (SubSystemClassBase) RTServices.getInstance().getSubSystem();" + "Testee_Super2_ac testee_super2 = (Testee_Super2_ac) subSystem.getInstance(\"/System_StaticConfigTest/main/top/tester/testee_super2\");" + "int caseId_2 = etUnit_openTestCase(\"AttrConfigTest_case_Testee_Super2_ac\");" + "testee_super2.getReg_port().varCheck(caseId_2);" + "EXPECT_TRUE(caseId_2, \"Tester_ac:1\", testee_super2.getFloat64_super_r() == 1.1);" + "EXPECT_TRUE(caseId_2, \"Tester_ac:2\", testee_super2.getFloat64_super_c() == 2.2);" + "EXPECT_TRUE(caseId_2, \"Tester_ac:3\", testee_super2.getFloat64_super_i() == 3.3);" + "EXPECT_EQUAL_FLOAT32(caseId,\"Tester_ac:4\", 25.f, testee_super2.getReg_port().getFloat_i(), 0.1f);" + "etUnit_closeTestCase(caseId);" + "etUnit_closeTestCase(caseId_2);" + } + } + } + } + } + + ActorClass Testee_1_ac { + Interface { + conjugated Port conj_port: TestProtocolAttributes + } + Structure { + ActorRef testee_2: Testee_2_ac + Attribute caseId: int32 + Attribute data_1: Data_1_dc + Attribute enumval1: Enum_1 = "one" + Attribute enumval2: Enum_2 = "four" + external Port conj_port + } + Behavior { + StateMachine { + Transition init: initial -> s1 + State s1 { + entry { + "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_1_ac\");" + "conj_port.varCheck();" + "data_1.varCheck1(caseId);" + "EXPECT_FALSE(caseId,\"testee_1:data_1:1\", getData_1().getBool_c());" + "EXPECT_TRUE(caseId,\"testee_1:data_1:2\", getData_1().getInt8_c() == 24);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:3\", getData_1().getInt16_c() == 48);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:4\", getData_1().getInt32_c() == 96);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:5\", getData_1().getInt64_c() == 192);" + "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:6\", 9.6f, getData_1().getFloat32_c(), 0.1f);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:7\", getData_1().getFloat64_c() == 19.2);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:8\", getData_1().getChar_c() == \'C\');" + "EXPECT_TRUE(caseId,\"testee_1:data_1:9\", getData_1().getString_c().equals(\":)\"));" + "EXPECT_TRUE(caseId,\"testee_1:data_1:10\", getData_1().getBool_i());" + "EXPECT_TRUE(caseId,\"testee_1:data_1:11\", getData_1().getInt8_i() == 2);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:12\", getData_1().getInt16_i() == 4);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:13\", getData_1().getInt32_i() == 8);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:14\", getData_1().getInt64_i() == 16);" + "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:15\", 1.6f, getData_1().getFloat32_i(), 0.1f);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:16\", getData_1().getFloat64_i() == 3.2);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:17\", getData_1().getChar_i() == \'I\');" + "EXPECT_TRUE(caseId,\"testee_1:data_1:18\", getData_1().getString_i().equals(\":]\"));" + + // Array + "EXPECT_TRUE(caseId,\"testee_1:data_1:19\", getData_1().getBool_array_c()[0] == true && getData_1().getBool_array_c()[1] == false);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:20\", getData_1().getInt8_array_c()[0] == 24 && getData_1().getInt8_array_c()[1] == 48);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:21\", getData_1().getInt16_array_c()[0] == 48 && getData_1().getInt16_array_c()[1] == 96);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:22\", getData_1().getInt32_array_c()[0] == 96 && getData_1().getInt32_array_c()[1] == 192);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:23\", getData_1().getInt64_array_c()[0] == 192 && getData_1().getInt64_array_c()[1] == 384);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:24\", getData_1().getFloat32_array_c()[0] == 9.6f && getData_1().getFloat32_array_c()[1] == 9.6f);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:25\", getData_1().getFloat64_array_c()[0] == 19.2 && getData_1().getFloat64_array_c()[1] == 19.2);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:26\", String.valueOf(getData_1().getChar_array_c()).equals(\"Claz\"));" + "EXPECT_TRUE(caseId,\"testee_1:data_1:27\", getData_1().getBool_array_i()[0] == true && getData_1().getBool_array_i()[1] == true);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:28\", getData_1().getInt8_array_i()[0] == 2 && getData_1().getInt8_array_i()[1] == 6);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:29\", getData_1().getInt16_array_i()[0] == 4 && getData_1().getInt16_array_i()[1] == 12);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:30\", getData_1().getInt32_array_i()[0] == 8 && getData_1().getInt32_array_i()[1] == 24);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:31\", getData_1().getInt64_array_i()[0] == 16 && getData_1().getInt64_array_i()[1] == 48);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:32\", getData_1().getFloat32_array_i()[0] == 1.6f && getData_1().getFloat32_array_i()[1] == 1.6f);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:33\", getData_1().getFloat64_array_i()[0] == 3.2 && getData_1().getFloat64_array_i()[1] == 3.2);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:34\", String.valueOf(getData_1().getChar_array_i()).equals(\"Inst\"));" + "EXPECT_TRUE(caseId,\"testee_1:data_1:35\", getData_1().getData_2().getInt32_c() == 42);" + "EXPECT_TRUE(caseId,\"testee_1:data_1:36\", getData_1().getData_2().getInt32_i() == 43);" + + // enums + "EXPECT_TRUE(caseId,\"testee_1:enumval1\", getEnumval1() == Enum_1.two);" + "EXPECT_TRUE(caseId,\"testee_1:enumval2\", getEnumval2() == Enum_2.three);" + "etUnit_closeTestCase(caseId);" + } + } + } + } + } + + ActorClass Testee_Super2_ac { + Interface { + Port reg_port: TestProtocolAttributes + } + Structure { + Attribute caseId: int32 + + // test + Attribute data_2: Data_2_dc + Attribute float64_super_r: float64 = "1.1" + Attribute float64_super_c: float64 = "1.1" + Attribute float64_super_i: float64 = "1.1" + external Port reg_port + } + } + + ActorClass Testee_2_ac extends Testee_Super2_ac { + Structure { + Attribute int32_own_r: int32 = "11" + Attribute int32_own_c: int32 = "11" + Attribute int32_own_i: int32 = "11" + SAP sap: TestProtocolWithDataClass + } + Behavior { + StateMachine { + Transition init: initial -> s1 + State s1 { + entry { + "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_2_ac\");" + "sap.varCheck(caseId);" + "reg_port.varCheck(caseId);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:1\", float64_super_c == 2.2);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:2\", float64_super_i == 4.4);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:3\", int32_own_r == 11);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:4\", int32_own_c == 12);" + "EXPECT_TRUE(caseId, \"Testee_2_ac:5\", int32_own_i == 13);" + "EXPECT_EQUAL_FLOAT32(caseId,\"Testee_2_ac:reg_port:6\", 50.f, reg_port.getFloat_i(), 0.1f);" + "etUnit_closeTestCase(caseId);" + } + } + } + } + } + + ProtocolClass TestProtocolAttributes { + incoming { + Message dummy() + } + regular PortClass + { + Operation varCheck(caseId: int32) { + "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocolAttributes:1\", 4.f, float_r, 0.1f);" + "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocolAttributes:2\", 3.f, float_c, 0.1f);" + } + Attribute float_r: float32 = "4" + Attribute float_c: float32 = "16" + Attribute float_i: float32 = "256" + } + conjugated PortClass + { + Operation varCheck() { + "int caseId = etUnit_openTestCase(\"ConfigTest_case_PortProtocol_conjugated\");" + "EXPECT_TRUE(caseId,\"array2_r[0]: <|MODEL_LOCATION|>\", array2_r[0] == 11);" + "EXPECT_TRUE(caseId,\"array2_r[1]: <|MODEL_LOCATION|>\", array2_r[1] == 22);" + "EXPECT_TRUE(caseId,\"array2_c[0]: <|MODEL_LOCATION|>\", array2_c[0] == 16);" + "EXPECT_TRUE(caseId,\"array2_c[1]: <|MODEL_LOCATION|>\", array2_c[1] == 32);" + "EXPECT_TRUE(caseId,\"array2_i[0]: <|MODEL_LOCATION|>\", array2_i[0] == 1);" + "EXPECT_TRUE(caseId,\"array2_i[1]: <|MODEL_LOCATION|>\", array2_i[1] == 2);" + "etUnit_closeTestCase(caseId);" + } + Attribute array2_r [ 2 ]: int64 = "{11,22}" + Attribute array2_c [ 2 ]: int64 = "{0,0}" + Attribute array2_i [ 2 ]: int64 = "{0,0}" + } + } + + ProtocolClass TestProtocolWithDataClass { + incoming { + Message dummy() + } + + //SAP + conjugated PortClass + { + Operation varCheck(caseId: int32) { + "sap_data_2.varCheck2(caseId);" + "sap_data_3.varCheck3(caseId);" + "EXPECT_TRUE(caseId, \"TestProtocolWithDataClass:1\", getSap_data_2().getInt32_c() == 2);" + "EXPECT_TRUE(caseId, \"TestProtocolWithDataClass:1\", getSap_data_2().getInt32_i() == 3);" + } + Attribute sap_data_2: Data_2_dc + + // none config test + Attribute sap_data_3: Data_3_dc + } + } + + DataClass Data_Super1_dc { + + // PrimitiveType + Attribute bool_r: boolean = "false" + Attribute bool_c: boolean = "false" + Attribute bool_i: boolean = "false" + Attribute int8_r: int8 = "8" + Attribute int8_c: int8 = "8" + Attribute int8_i: int8 = "8" + + // Array + Attribute bool_array_r [ 2 ]: boolean = "{ FALSE, false }" + Attribute bool_array_c [ 2 ]: boolean = "{ false, false }" + Attribute bool_array_i [ 2 ]: boolean = "{ false, false }" + Attribute int8_array_r [ 2 ]: int8 = "{ 8, 16 }" + Attribute int8_array_c [ 2 ]: int8 = "{ 8, 16 }" + Attribute int8_array_i [ 2 ]: int8 = "{ 8, 16 }" + } + + DataClass Data_1_dc extends Data_Super1_dc { + Operation varCheck1(caseId: int32) { + "data_2.varCheck2(caseId);" + + // PrimitiveType + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:1\", bool_r == false);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:2\", int8_r == 8);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:3\", int16_r == 16);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:4\", int32_r == 32);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:5\", int64_r == 64);" + "EXPECT_EQUAL_FLOAT32(caseId,\"Data_1_dc:varCheck:6\", 3.2f, float32_r, 0.1f);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:7\", float64_r == 6.4);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", char_r == \'R\');" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:9\", string_r.equals(\":/\"));" + + // Array + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:10\", bool_array_r[0] == false && bool_array_r[1] == false);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:11\", int8_array_r[0] == 8 && int8_array_r[1] == 16);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:12\", int16_array_r[0] == 16 && int16_array_r[1] == 32);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:13\", int32_array_r[0] == 32 && int32_array_r[1] == 64);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:24\", int64_array_r[0] == 64 && int64_array_r[1] == 128);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:25\", float32_array_r[0] == 3.2f && float32_array_r[1] == 6.4f);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:26\", float64_array_r[0] == 6.4 && float64_array_r[1] == 12.8);" + "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:27\", String.valueOf(char_array_r).equals(\"ROOM\"));" + } + Attribute int16_r: int16 = "16" + Attribute int16_c: int16 = "16" + Attribute int16_i: int16 = "16" + Attribute int32_r: int32 = "32" + Attribute int32_c: int32 = "32" + Attribute int32_i: int32 = "32" + Attribute int64_r: int64 = "64" + Attribute int64_c: int64 = "64" + Attribute int64_i: int64 = "64" + Attribute float32_r: float32 = "3.2" + Attribute float32_c: float32 = "3.2" + Attribute float32_i: float32 = "3.2" + Attribute float64_r: float64 = "6.4" + Attribute float64_c: float64 = "6.4" + Attribute float64_i: float64 = "6.4" + Attribute char_r: char = "R" + Attribute char_c: char = 'R' + Attribute char_i: char = "R" + Attribute string_r: string = ":/" + Attribute string_c: string = ":/" + Attribute string_i: string = ":/" + + // Array + Attribute int16_array_r [ 2 ]: int16 = "{ 16, 32 }" + Attribute int16_array_c [ 2 ]: int16 = "{ 16, 32 }" + Attribute int16_array_i [ 2 ]: int16 = "{ 16, 32 }" + Attribute int32_array_r [ 2 ]: int32 = "{ 32, 64 }" + Attribute int32_array_c [ 2 ]: int32 = "{ 32, 64 }" + Attribute int32_array_i [ 2 ]: int32 = "{ 32, 64 }" + Attribute int64_array_r [ 2 ]: int64 = "{ 64, 128 }" + Attribute int64_array_c [ 2 ]: int64 = "{ 64, 128 }" + Attribute int64_array_i [ 2 ]: int64 = "{ 64, 128 }" + Attribute float32_array_r [ 2 ]: float32 = "{ 3.2, 6.4 }" + Attribute float32_array_c [ 2 ]: float32 = "{ 3.2, 6.4 }" + Attribute float32_array_i [ 2 ]: float32 = "{ 3.2, 6.4 }" + Attribute float64_array_r [ 2 ]: float64 = "{ 6.4, 12.8 }" + Attribute float64_array_c [ 2 ]: float64 = "{ 6.4, 12.8 }" + Attribute float64_array_i [ 2 ]: float64 = "{ 6.4, 12.8 }" + Attribute char_array_r [ 5 ]: char = "ROOM" + Attribute char_array_c [ 5 ]: char = "ROOM" + Attribute char_array_i [ 5 ]: char = "ROOM" + + // ComplexType + Attribute data_2: Data_2_dc + } + + DataClass Data_2_dc { + Operation varCheck2(caseId: int32) { + "EXPECT_TRUE(caseId, \"Data_2_dc:1\", int32_r == 1);" + } + Attribute int32_r: int32 = "1" + Attribute int32_c: int32 = "1" + Attribute int32_i: int32 = "1" + } + + DataClass Data_3_dc { + Operation varCheck3(caseId: int32) { + "EXPECT_TRUE(caseId, \"Data_3_dc:1\", dataClass_ref == null);" + "EXPECT_TRUE(caseId, \"Data_3_dc:2\", dataClass_array[0].getInt32_r() == 1);" + "EXPECT_TRUE(caseId, \"Data_3_dc:3\", dataClass_array[1].getInt32_c() == 1);" + "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_ref_array[0] == null && dataClass_ref_array[1] == null);" + "EXPECT_TRUE(caseId, \"Data_3_dc:5\", ext_type instanceof External_Type_Test);" + "EXPECT_TRUE(caseId, \"Data_3_dc:6\", ext_type_array[0] instanceof External_Type_Test && ext_type_array[1] instanceof External_Type_Test);" + "EXPECT_TRUE(caseId, \"Data_3_dc:7\", ext_type_ref == null);" + "EXPECT_TRUE(caseId, \"Data_3_dc:8\", ext_type_ref_array[0] == null && ext_type_ref_array[1] == null);" + "EXPECT_TRUE(caseId, \"Data_3_dc:9\", primitive_array_ref instanceof byte[]);" + "EXPECT_TRUE(caseId, \"Data_3_dc:10\", string_ref == null);" + } +// none config test + Attribute dataClass_array [ 2 ]: Data_2_dc + Attribute dataClass_ref: Data_2_dc ref + Attribute dataClass_ref_array [ 2 ]: Data_2_dc ref + Attribute ext_type: extType + Attribute ext_type_array [ 2 ]: extType + Attribute ext_type_ref: extType ref + Attribute ext_type_ref_array [ 2 ]: extType ref + Attribute primitive_array_ref [ 2 ]: int8 ref + Attribute string_ref: string ref + + // no check at all + Attribute primitive1_ref: int8 ref + Attribute primitive3_ref: char ref + } + + ExternalType extType -> "External_Type_Test" + + Enumeration Enum_1 { + zero, + one, + two + } + + Enumeration Enum_2 of int16 { + three=3, + four + } + +} \ No newline at end of file -- cgit v1.2.3 From c6d7647c8c42a751c2ff5ec9c10faeb6569463c5 Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Thu, 14 Sep 2017 11:10:30 +0200 Subject: [tests] fixed test suite names --- build.gradle | 4 +- .../etUnitConverter.gradle | 9 +- .../etGenerator.gradle | 25 +++++ .../etriceGenerator.gradle | 25 ----- runtime/org.eclipse.etrice.modellib.c/build.gradle | 2 +- .../org.eclipse.etrice.modellib.cpp/build.gradle | 2 +- .../org.eclipse.etrice.modellib.java/build.gradle | 2 +- .../build.gradle | 2 +- .../models/SendingDataTest.room | 2 +- .../models/StaticConfigTest.room | 2 +- .../build.gradle | 2 +- .../etTest.gradle | 108 ++++++++++++++++++++ .../etriceTest.gradle | 110 --------------------- .../models/ActorCommunicationTest.room | 2 +- .../build.gradle | 2 +- .../models/SendingDataTest.room | 2 +- .../build.gradle | 2 +- .../models/DynamicActorTest1.room | 2 +- .../models/DynamicActorTest2.room | 2 +- .../models/DynamicActorTest3.room | 2 +- .../models/DynamicActorTest4.room | 2 +- .../models/DynamicActorTest5.room | 2 +- .../models/DynamicActorTest6.room | 2 +- .../models/DynamicActorTest7.room | 2 +- .../models/DynamicConfigTest.room | 2 +- .../models/SendingDataTest.room | 2 +- .../models/StaticConfigTest.room | 2 +- .../models/StoreRestoreTest.room | 2 +- .../models/TCPTest.room | 2 +- .../build.gradle | 3 +- .../src/runtime/RunCRuntimeTestcases.c | 2 +- .../src/runtime/TestEtDatatypes.c | 2 +- .../src/runtime/TestEtMemory.c | 2 +- .../src/runtime/TestEtMessage.c | 2 +- .../src/runtime/TestEtMessageQueue.c | 2 +- .../src/runtime/TestEtMessageService.c | 2 +- .../src/runtime/TestEtQueue.c | 2 +- .../src/runtime/TestEtTimer.c | 2 +- .../src/runtime/TestEtUnit.c | 2 +- .../src/runtime/helpers/TestEtTimeHelpers.c | 2 +- .../build.gradle | 3 +- .../src/containers/MapTest.h | 2 +- .../src/containers/PairTest.h | 2 +- .../src/containers/SetTest.h | 2 +- .../src/containers/StaticArrayTest.h | 2 +- .../src/containers/StaticDequeTest.h | 2 +- .../src/containers/StaticStringTest.h | 2 +- .../src/containers/StringTest.h | 2 +- .../src/containers/VectorTest.h | 2 +- .../src/debugging/DebuggingServiceTest.h | 2 +- .../src/debugging/MSCFilterTest.h | 2 +- .../src/debugging/MSCFunctionObjectTest.h | 2 +- .../src/debugging/MSCLoggerTest.h | 2 +- .../src/messaging/AddressTest.h | 2 +- .../src/messaging/MessageDispatcherTest.h | 2 +- .../src/messaging/MessageSeQueueTest.h | 2 +- .../src/messaging/MessageServiceControllerTest.cpp | 2 +- .../src/messaging/MessageServiceTest.cpp | 2 +- .../src/messaging/MessageTest.h | 2 +- .../src/messaging/RTObjectTest.h | 2 +- .../src/messaging/StaticMessageMemoryTest.h | 2 +- 61 files changed, 196 insertions(+), 197 deletions(-) create mode 100644 plugins/org.eclipse.etrice.generator/etGenerator.gradle delete mode 100644 plugins/org.eclipse.etrice.generator/etriceGenerator.gradle create mode 100644 tests/org.eclipse.etrice.generator.common.tests/etTest.gradle delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle diff --git a/build.gradle b/build.gradle index 59f1e8142..95680d357 100644 --- a/build.gradle +++ b/build.gradle @@ -5,6 +5,6 @@ ext { commons_io_version = '+' etUnitConverter = "$rootDir/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle" - etriceGenerator = "$rootDir/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle" - etriceTest = "$rootDir/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle" + etGenerator = "$rootDir/plugins/org.eclipse.etrice.generator/etGenerator.gradle" + etTest = "$rootDir/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle" } \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle index 59b455535..7055f05ff 100644 --- a/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle +++ b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle @@ -5,18 +5,17 @@ evaluationDependsOn(etUnitConverter) /** * Creates a tasks that converts etu files to xml files * @param name: The name of the new task - * @param etuProducerTask: The task that produces the etu files + * @param etuFiles: The etu files to be converted */ -ext.createEtUnitConverterTask = { name, etuProducerTask -> - def etuFiles = etuProducerTask.outputs.getFiles().collect { it.path } +ext.createEtUnitConverterTask = { name, etuFiles, suiteName = null -> def xmlFiles = etuFiles.collect { it.replace('.etu', '.xml') } return tasks.create(name: name, type: JavaExec, dependsOn: "$etUnitConverter:classes") { - dependsOn etuProducerTask main = project(etUnitConverter).mainClassName classpath = project(etUnitConverter).sourceSets.main.runtimeClasspath + if(suiteName != null) args '-suite', suiteName args etuFiles - inputs.files etuProducerTask.outputs + inputs.files etuFiles outputs.files xmlFiles } } \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator/etGenerator.gradle b/plugins/org.eclipse.etrice.generator/etGenerator.gradle new file mode 100644 index 000000000..42556974a --- /dev/null +++ b/plugins/org.eclipse.etrice.generator/etGenerator.gradle @@ -0,0 +1,25 @@ + +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.c') +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.cpp') +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.java') + +/** + * Creates an eTrice generator task + * @param name: The name of the new task + * @param models: The models passed to the generator + * @param genDir: The generation directory + * @param options: The eTrice generator options + */ +ext.createGeneratorTask = { name, lang, models, genDir = 'src-gen', options = [] -> + def generator = ":plugins:org.eclipse.etrice.generator.$lang" + + return tasks.create(name: name, type: JavaExec, dependsOn: "$generator:classes") { + main = project(generator).mainClassName + classpath = project(generator).sourceSets.main.runtimeClasspath + args '-msc_instr', '-genDir', genDir + args options + args models + inputs.files models + outputs.dir genDir + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle b/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle deleted file mode 100644 index 42556974a..000000000 --- a/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle +++ /dev/null @@ -1,25 +0,0 @@ - -evaluationDependsOn(':plugins:org.eclipse.etrice.generator.c') -evaluationDependsOn(':plugins:org.eclipse.etrice.generator.cpp') -evaluationDependsOn(':plugins:org.eclipse.etrice.generator.java') - -/** - * Creates an eTrice generator task - * @param name: The name of the new task - * @param models: The models passed to the generator - * @param genDir: The generation directory - * @param options: The eTrice generator options - */ -ext.createGeneratorTask = { name, lang, models, genDir = 'src-gen', options = [] -> - def generator = ":plugins:org.eclipse.etrice.generator.$lang" - - return tasks.create(name: name, type: JavaExec, dependsOn: "$generator:classes") { - main = project(generator).mainClassName - classpath = project(generator).sourceSets.main.runtimeClasspath - args '-msc_instr', '-genDir', genDir - args options - args models - inputs.files models - outputs.dir genDir - } -} \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.c/build.gradle b/runtime/org.eclipse.etrice.modellib.c/build.gradle index b881a7b8b..f11e40692 100644 --- a/runtime/org.eclipse.etrice.modellib.c/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.c/build.gradle @@ -2,7 +2,7 @@ plugins { id 'c' } -apply from: etriceGenerator +apply from: etGenerator def models = [ 'model/PInterrupt.room', diff --git a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle index efbb01f03..3330c2406 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle @@ -2,7 +2,7 @@ plugins { id 'cpp' } -apply from: etriceGenerator +apply from: etGenerator def models = [ 'model/TimingService.room' diff --git a/runtime/org.eclipse.etrice.modellib.java/build.gradle b/runtime/org.eclipse.etrice.modellib.java/build.gradle index a458f33bb..004c8614f 100644 --- a/runtime/org.eclipse.etrice.modellib.java/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.java/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java' } -apply from: etriceGenerator +apply from: etGenerator def models = [ 'model/ALogService.room', diff --git a/tests/org.eclipse.etrice.generator.c.tests/build.gradle b/tests/org.eclipse.etrice.generator.c.tests/build.gradle index 9f0487aa3..f706476a9 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.c.tests/build.gradle @@ -2,7 +2,7 @@ plugins { id 'c' } -apply from: etriceTest +apply from: etTest def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room index 3494a48cf..332f1c847 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room +++ b/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room @@ -186,7 +186,7 @@ RoomModel SendingDataTest { StateMachine { Transition init: initial -> tp0 of state0 { action { - "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" + "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.c.tests.SendingDataTest\", \"SendingDataTest_case\");" "EXPECT_ORDER_START(caseId,resultlist,23);" "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" "/* send the default values */" diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room index ac8dc0a46..3c8518ee0 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room +++ b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room @@ -23,7 +23,7 @@ RoomModel StaticConfigTest { Behavior { ctor { "etUnit_open(\".\", \"StaticConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.StaticConfigTest\");" + "etUnit_openTestSuite(\"org.eclipse.etrice.generator.c.tests.StaticConfigTest\");" } dtor { "etUnit_closeTestSuite();" diff --git a/tests/org.eclipse.etrice.generator.common.tests/build.gradle b/tests/org.eclipse.etrice.generator.common.tests/build.gradle index 40882f479..8e6530812 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.common.tests/build.gradle @@ -4,7 +4,7 @@ plugins { id 'java-base' } -apply from: etriceTest +apply from: etTest def genericPhysical = 'models/GenericPhysical.etphys' diff --git a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle b/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle new file mode 100644 index 000000000..7df62b1f4 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle @@ -0,0 +1,108 @@ +apply from: etGenerator +apply from: etUnitConverter + +def outputDir = 'output' +def srcGenDir = 'src-gen' + +clean.delete srcGenDir, outputDir + +def getMainClass(String genDir) { + // search for SubSystemRunner java file + def mainFile = fileTree(genDir, { include '**/*Runner.java' }).getSingleFile() + // relativize path to generation directory + def relPath = file(genDir).toPath().relativize(mainFile.toPath()).normalize().toString() + // remove '.java' at the end + def path = relPath.substring(0, relPath.length() - 5) + // replace all separators with '.' + def mainClass = path.replace(File.separatorChar, '.' as char) + return mainClass +} + +/** + * Creates all needed tasks for one test execution + * @param lang: The eTrice generator type ('c', 'cpp', 'java') + * @param name: The test name starting with a lower case letter + * @param models: Models that are passed to the eTrice generator + * @param options: Options that are passed to the eTrice generator + */ +ext.createTest = { lang, name, models, options = [] -> + + def nameCap = name.capitalize() + def langCap = lang.capitalize() + def testName = "$name$langCap" + def testNameCap = testName.capitalize() + def suiteName = "${project.name}.$testNameCap" + def genDir = "$srcGenDir/$testName" + def workingDir = "$outputDir/$testName" + def etuFile = "$workingDir/${nameCap}.etu" + + def generateTask = createGeneratorTask("generate$testNameCap", lang, models, genDir, options) + generateTask.environment 'etModellib', "org.eclipse.etrice.modellib.$lang" + + def runTask + + if(lang == 'c' || lang == 'cpp') { + model { + components { + "$testName"(NativeExecutableSpec) { + sources."$lang" { + builtBy generateTask + source { + srcDirs = [genDir] + include "**/*.$lang" + } + exportedHeaders { + srcDirs = [genDir] + } + lib project: ":runtime:org.eclipse.etrice.modellib.$lang", library: "etrice_modellib_$lang", linkage: 'static' + if(lang == 'cpp') lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' + } + binaries.all { + cCompiler.args '-g3' + cppCompiler.args '-g3' + } + } + } + } + + def exeFile = "$buildDir/exe/$testName/$testName" + runTask = tasks.create(name: "run$testNameCap", type: Exec) { + dependsOn "${testName}Executable" + commandLine exeFile, '-run_as_test' + inputs.file exeFile + outputs.file etuFile + it.workingDir = workingDir + } + } + + else if(lang == 'java') { + def testSourceSet = sourceSets.create(name) { + java.srcDirs = [genDir] + } + + dependencies { + add "${name}Compile", project(':runtime:org.eclipse.etrice.modellib.java') + add "${name}Compile", project(':runtime:org.eclipse.etrice.runtime.java') + } + + tasks.getByName("compile${nameCap}Java").dependsOn generateTask + + runTask = tasks.create(name: "run$testNameCap", type: JavaExec) { + dependsOn "${name}Classes" + classpath = testSourceSet.runtimeClasspath + args '-run_as_test' + outputs.file etuFile + it.workingDir = workingDir + + doFirst { main = getMainClass(genDir) } + } + } + + runTask.doFirst { file("$workingDir/log").mkdirs() } + + def convertTask = createEtUnitConverterTask("convert$testNameCap", etuFile, suiteName) + convertTask.dependsOn runTask + + check.dependsOn tasks.create(name: testName, dependsOn: convertTask, group: 'verification') +} diff --git a/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle b/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle deleted file mode 100644 index 3bb72747f..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle +++ /dev/null @@ -1,110 +0,0 @@ -apply from: etriceGenerator -apply from: etUnitConverter - -def outputDir = 'output' -def srcGenDir = 'src-gen' - -clean.delete srcGenDir, outputDir - -def getMainClass(String genDir) { - // search for SubSystemRunner java file - def mainFile = fileTree(genDir, { include '**/*Runner.java' }).getSingleFile() - // relativize path to generation directory - def relPath = file(genDir).toPath().relativize(mainFile.toPath()).normalize().toString() - // remove '.java' at the end - def path = relPath.substring(0, relPath.length() - 5) - // replace all separators with '.' - def mainClass = path.replace(File.separatorChar, '.' as char) - return mainClass -} - -/** - * Creates all needed tasks for one test execution - * @param lang: The eTrice generator type ('c', 'cpp', 'java') - * @param name: The test name starting with a lower case letter - * @param models: Models that are passed to the eTrice generator - * @param options: Options that are passed to the eTrice generator - */ -ext.createTest = { lang, name, models, options = [] -> - - def nameCap = name.capitalize() - def langCap = lang.capitalize() - def testName = "$name$langCap" - def testNameCap = testName.capitalize() - def genDir = "$srcGenDir/$testName" - def workingDir = "$outputDir/$testName" - def etuFile = "$workingDir/${nameCap}.etu" - def xmlFile = "$workingDir/${nameCap}.xml" - def modellib = ":runtime:org.eclipse.etrice.modellib.$lang" - def generator = ":plugins:org.eclipse.etrice.generator.$lang" - def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' - - def generateTask = createGeneratorTask("generate$testNameCap", lang, models, genDir, options) - generateTask.environment 'etModellib', "org.eclipse.etrice.modellib.$lang" - - def runTask - - if(lang == 'c' || lang == 'cpp') { - model { - components { - "$testName"(NativeExecutableSpec) { - sources."$lang" { - builtBy generateTask - source { - srcDirs = [genDir] - include "**/*.$lang" - } - exportedHeaders { - srcDirs = [genDir] - } - lib project: ":runtime:org.eclipse.etrice.modellib.$lang", library: "etrice_modellib_$lang", linkage: 'static' - if(lang == 'cpp') lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' - lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' - } - binaries.all { - cCompiler.args '-g3' - cppCompiler.args '-g3' - } - } - } - } - - def exeFile = "$buildDir/exe/$testName/$testName" - runTask = tasks.create(name: "run$testNameCap", type: Exec) { - dependsOn "${testName}Executable" - commandLine exeFile, '-run_as_test' - inputs.file exeFile - outputs.file etuFile - it.workingDir = workingDir - } - } - - else if(lang == 'java') { - def testSourceSet = sourceSets.create(name) { - java.srcDirs = [genDir] - } - - dependencies { - add "${name}Compile", project(':runtime:org.eclipse.etrice.modellib.java') - add "${name}Compile", project(':runtime:org.eclipse.etrice.runtime.java') - } - - tasks.getByName("compile${nameCap}Java").dependsOn generateTask - - runTask = tasks.create(name: "run$testNameCap", type: JavaExec) { - dependsOn "${name}Classes" - classpath = testSourceSet.runtimeClasspath - args '-run_as_test' - outputs.file etuFile - it.workingDir = workingDir - - doFirst { main = getMainClass(genDir) } - } - } - - runTask.doFirst { file("$workingDir/log").mkdirs() } - - def convertTask = createEtUnitConverterTask("convert$testNameCap", runTask) - - check.dependsOn tasks.create(name: testName, dependsOn: convertTask, group: 'verification') -} diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room index 924e0722f..e9929261f 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room @@ -64,7 +64,7 @@ RoomModel ActorCommunicationTest { Behavior { ctor { "etUnit_open(\".\", \"ActorCommunicationTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests\");" + "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.ActorCommunicationTest\");" } dtor { "etUnit_closeTestSuite();" diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle b/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle index f5680e988..1860582d3 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle @@ -2,7 +2,7 @@ plugins { id 'cpp' } -apply from: etriceTest +apply from: etTest def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room index 623003187..c1558d539 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room +++ b/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room @@ -186,7 +186,7 @@ RoomModel SendingDataTest { StateMachine { Transition init: initial -> tp0 of state0 { action { - "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" + "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.cpp.tests.SendingDataTest\", \"SendingDataTest_case\");" "EXPECT_ORDER_START(caseId,resultlist,23);" "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" "/* send the default values */" diff --git a/tests/org.eclipse.etrice.generator.java.tests/build.gradle b/tests/org.eclipse.etrice.generator.java.tests/build.gradle index 0ce79733a..006dc073d 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.java.tests/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java-base' } -apply from: etriceTest +apply from: etTest def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room index 8701a556f..59c71cd68 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room @@ -30,7 +30,7 @@ RoomModel DynamicActorTest1 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest1\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest1\", \"DynamicActorTest1_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest1\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest1\", \"DynamicActorTest1_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room index ba0f65f9b..f47a1ec41 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room @@ -30,7 +30,7 @@ RoomModel DynamicActorTest2 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest2\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest2\", \"DynamicActorTest2_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest2\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest2\", \"DynamicActorTest2_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room index e757ba820..410f28772 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room @@ -22,7 +22,7 @@ RoomModel DynamicActorTest3 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest3\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest3\", \"DynamicActorTest3_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest3\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest3\", \"DynamicActorTest3_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room index 7c3b95b27..57a67add5 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room @@ -21,7 +21,7 @@ RoomModel DynamicActorTest4 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest4\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest4\", \"DynamicActorTest4_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest4\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest4\", \"DynamicActorTest4_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room index 7b761f781..7c7b8c4a1 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room @@ -21,7 +21,7 @@ RoomModel DynamicActorTest5 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest5\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest5\", \"DynamicActorTest5_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest5\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest5\", \"DynamicActorTest5_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room index a38e80330..905f8c05d 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room @@ -24,7 +24,7 @@ RoomModel DynamicActorTest6 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest6\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest6\", \"DynamicActorTest6_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest6\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest6\", \"DynamicActorTest6_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room index 32648c0e6..8a5c7bba8 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room @@ -42,7 +42,7 @@ RoomModel DynamicActorTest7 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest7\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest7\", \"DynamicActorTest7_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest7\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest7\", \"DynamicActorTest7_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room index f7ab9895d..112e47693 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room @@ -50,7 +50,7 @@ RoomModel DynamicConfigTest { Behavior { ctor { "etUnit_open(\".\", \"DynamicConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.DynamicConfigTest\");" + "etUnit_openTestSuite(\"org.eclipse.etrice.generator.java.tests.DynamicConfigTest\");" "caseId = etUnit_openTestCase(\"DynamicConfigTest_case_Testee_ac\");" } dtor { diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room index ce9056bdb..2fdd40bdb 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room @@ -178,7 +178,7 @@ RoomModel SendingDataTest { StateMachine { Transition init: initial -> tp0 of state0 { action { - "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" + "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.java.tests.SendingDataTest\", \"SendingDataTest_case\");" "EXPECT_ORDER_START(caseId,resultlist,23);" "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" "// send the default values" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room index 3d3ba6b49..c76fe713e 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room @@ -23,7 +23,7 @@ RoomModel StaticConfigTest { Behavior { ctor { "etUnit_open(\".\", \"StaticConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.StaticConfigTest\");" + "etUnit_openTestSuite(\"org.eclipse.etrice.generator.java.tests.StaticConfigTest\");" } dtor { "etUnit_closeTestSuite();" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room index bf9b8f9c5..757233bf1 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room @@ -117,7 +117,7 @@ RoomModel StoreRestoreTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"StoreRestoreTest\", \"org.eclipse.etrice.generator.common.tests.StoreRestoreTest\", \"StoreRestoreTest_case\");" + "caseId = etUnit_openAll(\".\", \"StoreRestoreTest\", \"org.eclipse.etrice.generator.java.tests.StoreRestoreTest\", \"StoreRestoreTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room index 6671d6d3d..9227b9a29 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room @@ -41,7 +41,7 @@ RoomModel TCPTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"TCPTest\", \"org.eclipse.etrice.generator.common.tests.TCPTest\", \"TCPTest_case\");" + "caseId = etUnit_openAll(\".\", \"TCPTest\", \"org.eclipse.etrice.generator.java.tests.TCPTest\", \"TCPTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle index cf2f3e1e4..4b711fc94 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle @@ -35,6 +35,7 @@ task run(type: Exec, dependsOn: assemble, group: 'verification') { doFirst { file('log/testlog').mkdirs() } } -createEtUnitConverterTask('convert', run) +createEtUnitConverterTask('convert', [etuFileRuntimeTest, etuFileEtUnitTest]) +convert.dependsOn run check.dependsOn convert \ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c index 0a932fb44..16ad8a4da 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c @@ -56,7 +56,7 @@ void RunCRuntimeTestcases(void){ /* special situation for testing openAll and closeAll of etUnit * this has to be done outside of etUnit_open and etUnit_close */ - id = etUnit_openAll("log/testlog","TestEtUnitSpecial", "etUnit", "openAll and closeAll"); + id = etUnit_openAll("log/testlog","TestEtUnitSpecial", "etUnit", "org.eclipse.etrice.runtime.c.tests.openAll_and_closeAll"); EXPECT_TRUE(id, "Open and Close", ET_TRUE); etUnit_closeAll(id); diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.c index 84cbb0ff9..267feb3be 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.c @@ -85,7 +85,7 @@ void TestEtDatatypes_FLOAT(etInt16 id) { } void TestEtDatatypes_runSuite(void) { - etUnit_openTestSuite("TestDatatypes"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.tests.TestDatatypes"); ADD_TESTCASE(TestEtDatatypes_IntegerSize); ADD_TESTCASE(TestEtDatatypes_IntegerSign); ADD_TESTCASE(TestEtDatatypes_Boolean); diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMemory.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMemory.c index a46c00f17..f93239901 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMemory.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMemory.c @@ -185,7 +185,7 @@ static void TestEtMemory_testFreeListOverflow(etInt16 id) { } void TestEtMemory_runSuite(void){ - etUnit_openTestSuite("TestMemory"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.tests.TestMemory"); ADD_TESTCASE(TestEtMemory_testFixedSize); ADD_TESTCASE(TestEtMemory_testFreeList); ADD_TESTCASE(TestEtMemory_testFreeListOverflow); diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessage.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessage.c index 84e4022df..2ac07f2f3 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessage.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessage.c @@ -38,7 +38,7 @@ void TestEtMessage_testBasicMessage(etInt16 id){ } void TestEtMessage_runSuite(void){ - etUnit_openTestSuite("TestMessage"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.tests.TestMessage"); ADD_TESTCASE(TestEtMessage_testBasicMessage); etUnit_closeTestSuite(); } diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageQueue.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageQueue.c index f7cb75c4e..a2deeb162 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageQueue.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageQueue.c @@ -92,7 +92,7 @@ void TestEtMessageQueue_testMassiveMessaging(etInt16 id){ } void TestEtMessageQueue_runSuite(void){ - etUnit_openTestSuite("TestEtMessageQueue"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.tests.TestEtMessageQueue"); ADD_TESTCASE(TestEtMessageQueue_testPushPop); ADD_TESTCASE(TestEtMessageQueue_testMassiveMessaging); etUnit_closeTestSuite(); diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c index 0867bf366..6fdf18a58 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c @@ -293,7 +293,7 @@ void TestEtMessageService_getMessagePoolLowWaterMark(etInt16 id){ void TestEtMessageService_runSuite(void){ - etUnit_openTestSuite("TestEtMessageService"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.tests.TestEtMessageService"); ADD_TESTCASE(TestEtMessageService_init); ADD_TESTCASE(TestEtMessageService_GetPushPopReturn); ADD_TESTCASE(TestEtMessageService_GetReturn); diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtQueue.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtQueue.c index c32de2627..dc1ea3ffa 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtQueue.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtQueue.c @@ -62,7 +62,7 @@ static void TestEtQueue_test(etInt16 id){ } void TestEtQueue_runSuite(void){ - etUnit_openTestSuite("TestQueue"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.tests.TestQueue"); ADD_TESTCASE(TestEtQueue_test); etUnit_closeTestSuite(); } diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtTimer.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtTimer.c index fb574e6b2..f031baaa9 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtTimer.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtTimer.c @@ -116,7 +116,7 @@ static void TestEtTimer_multiTimer (etInt16 id) { } void TestEtTimer_runSuite(void){ - etUnit_openTestSuite("TestEtTimer"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.tests.TestEtTimer"); ADD_TESTCASE(TestEtTimer_lifecycle); ADD_TESTCASE(TestEtTimer_multiTimer); etUnit_closeTestSuite(); diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtUnit.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtUnit.c index 4bf2c137e..5a39e30c9 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtUnit.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtUnit.c @@ -59,7 +59,7 @@ void TestEtUnit_Expect_Order(etInt16 id){ } void TestEtUnit_runSuite(void){ - etUnit_openTestSuite("TestEtUnit"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.tests.TestEtUnit"); ADD_TESTCASE(TestEtUnit_Expect_Order); ADD_TESTCASE(TestEtUnit_Expect); etUnit_closeTestSuite(); diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/helpers/TestEtTimeHelpers.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/helpers/TestEtTimeHelpers.c index c1693cafa..8cc33d926 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/helpers/TestEtTimeHelpers.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/helpers/TestEtTimeHelpers.c @@ -171,7 +171,7 @@ static void TestEtTimeHelpers_subtract (etInt16 id) { } void TestEtTimeHelpers_runSuite(void){ - etUnit_openTestSuite("TestEtTimeHelpers"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.tests.TestEtTimeHelpers"); ADD_TESTCASE(TestEtTimeHelpers_convertToMSec); ADD_TESTCASE(TestEtTimeHelpers_convertToEtTime); ADD_TESTCASE(TestEtTimeHelpers_copy); diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle index 74624fe04..d9d197a0c 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle @@ -35,6 +35,7 @@ task run(type: Exec, dependsOn: assemble, group: 'verification') { doFirst { file('log/testlog').mkdirs() } } -createEtUnitConverterTask('convert', run) +createEtUnitConverterTask('convert', etuFile) +convert.dependsOn run check.dependsOn convert \ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/MapTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/MapTest.h index fceac394e..895d805fd 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/MapTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/MapTest.h @@ -20,7 +20,7 @@ class MapTest : public etTestSuite { public: MapTest() : - etTestSuite("MapTest"){ + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.MapTest"){ } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/PairTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/PairTest.h index 145d1cc4a..b6b71d114 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/PairTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/PairTest.h @@ -20,7 +20,7 @@ class PairTest : public etTestSuite { public: PairTest() : - etTestSuite("PairTest"){ + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.PairTest"){ } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/SetTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/SetTest.h index b76490d58..59d31826e 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/SetTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/SetTest.h @@ -20,7 +20,7 @@ class SetTest : public etTestSuite { public: SetTest() : - etTestSuite("SetTest"){ + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.SetTest"){ } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticArrayTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticArrayTest.h index af59bb9e6..9b29cdc1a 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticArrayTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticArrayTest.h @@ -20,7 +20,7 @@ class StaticArrayTest : public etTestSuite { public: StaticArrayTest() : - etTestSuite("StaticArrayTest"){ + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.StaticArrayTest"){ } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticDequeTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticDequeTest.h index b09d7bba0..41ceeea85 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticDequeTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticDequeTest.h @@ -17,7 +17,7 @@ class StaticDequeTest : public etTestSuite { public: - StaticDequeTest(void) : etTestSuite("StaticDequeTest") {} + StaticDequeTest(void) : etTestSuite("org.eclipse.etrice.runtime.cpp.tests.StaticDequeTest") {} protected: void runAllTestCases(void); diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticStringTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticStringTest.h index fcbc86beb..096c27da7 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticStringTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StaticStringTest.h @@ -20,7 +20,7 @@ class StaticStringTest : public etTestSuite { public: StaticStringTest() : - etTestSuite("StaticStringTest"){ + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.StaticStringTest"){ } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StringTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StringTest.h index 7a7cb4871..1210fd26d 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StringTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/StringTest.h @@ -20,7 +20,7 @@ class StringTest : public etTestSuite { public: StringTest() : - etTestSuite("StringTest"){ + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.StringTest"){ } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/VectorTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/VectorTest.h index d997a9cc3..5bc8f60aa 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/VectorTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/containers/VectorTest.h @@ -20,7 +20,7 @@ class VectorTest : public etTestSuite { public: VectorTest() : - etTestSuite("VectorTest"){ + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.VectorTest"){ } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.h index 212d38e8f..f00650d82 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.h @@ -23,7 +23,7 @@ using namespace etRuntime; class DebuggingServiceTest: public etTestSuite { public: DebuggingServiceTest() : - etTestSuite("DebuggingServiceTest") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.DebuggingServiceTest") { } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFilterTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFilterTest.h index f1de8d669..8b5879d16 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFilterTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFilterTest.h @@ -18,7 +18,7 @@ class MSCFilterTest: public etTestSuite { public: MSCFilterTest() : - etTestSuite("MSCFilterTest") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.MSCFilterTest") { } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFunctionObjectTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFunctionObjectTest.h index 3415f4c8b..86a8ac5d0 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFunctionObjectTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFunctionObjectTest.h @@ -18,7 +18,7 @@ class MSCFunctionObjectTest: public etTestSuite { public: MSCFunctionObjectTest() : - etTestSuite("MSFunctionObjectTest") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.MSFunctionObjectTest") { } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCLoggerTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCLoggerTest.h index 0a2491a01..b19e5bf77 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCLoggerTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCLoggerTest.h @@ -18,7 +18,7 @@ class MSCLoggerTest: public etTestSuite { public: MSCLoggerTest(void) : - etTestSuite("MSCLoggerTest") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.MSCLoggerTest") { } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/AddressTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/AddressTest.h index 6266c84d4..557b98918 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/AddressTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/AddressTest.h @@ -20,7 +20,7 @@ class AddressTest: public etTestSuite { public: AddressTest(void) : - etTestSuite("AddressTest") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.AddressTest") { } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageDispatcherTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageDispatcherTest.h index beab56e2a..0972986f8 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageDispatcherTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageDispatcherTest.h @@ -20,7 +20,7 @@ class MessageDispatcherTest: public etTestSuite { public: MessageDispatcherTest(void) : - etTestSuite("MessageDispatcherTest") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.MessageDispatcherTest") { } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageSeQueueTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageSeQueueTest.h index d5053d12a..37634f32d 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageSeQueueTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageSeQueueTest.h @@ -18,7 +18,7 @@ class MessageSeQueueTest: public etTestSuite { public: MessageSeQueueTest(void) : - etTestSuite("MessageSeQueueTest") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.MessageSeQueueTest") { } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageServiceControllerTest.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageServiceControllerTest.cpp index 439d9c079..c0950fbe0 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageServiceControllerTest.cpp +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageServiceControllerTest.cpp @@ -20,7 +20,7 @@ using namespace etRuntime; MessageServiceControllerTest::MessageServiceControllerTest() : - etTestSuite("MessageServiceControllerTest") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.MessageServiceControllerTest") { etTime interval; interval.sec = 5; diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageServiceTest.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageServiceTest.cpp index 728b8efff..e90143afd 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageServiceTest.cpp +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageServiceTest.cpp @@ -19,7 +19,7 @@ using namespace etRuntime; MessageServiceTest::MessageServiceTest() : - etTestSuite("MessageServiceTest"), m_senderTerminated(0) { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.MessageServiceTest"), m_senderTerminated(0) { RTServices::getInstance().getMsgSvcCtrl().resetAll(); diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageTest.h index 213e8ae3a..7d20118b4 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageTest.h @@ -18,7 +18,7 @@ class MessageTest: public etTestSuite { public: MessageTest(void) : - etTestSuite("MessageTest") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.MessageTest") { } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/RTObjectTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/RTObjectTest.h index 3bd46eaf1..7922c8c14 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/RTObjectTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/RTObjectTest.h @@ -18,7 +18,7 @@ class RTObjectTest: public etTestSuite { public: RTObjectTest(void) : - etTestSuite("RTObject Test") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.RTObject Test") { } protected: diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/StaticMessageMemoryTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/StaticMessageMemoryTest.h index 44b74d060..3cf26bd52 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/StaticMessageMemoryTest.h +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/StaticMessageMemoryTest.h @@ -18,7 +18,7 @@ class StaticMessageMemoryTest: public etTestSuite { public: StaticMessageMemoryTest(void) : - etTestSuite("StaticMessageMemoryTest") { + etTestSuite("org.eclipse.etrice.runtime.cpp.tests.StaticMessageMemoryTest") { } protected: -- cgit v1.2.3 From 3c6f55530705ea9c6c4e3a18b6593c153e1e0e41 Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Sat, 16 Sep 2017 13:58:00 +0200 Subject: [releng] eclipse signing added gradle wrapper --- .gitignore | 3 +- build.gradle | 5 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54708 bytes gradle/wrapper/gradle-wrapper.properties | 5 + gradlew | 172 +++++++++++++++++++++ gradlew.bat | 84 ++++++++++ plugins/build.gradle | 32 +++- .../etUnitConverter.gradle | 6 +- releng/org.eclipse.etrice.parent/pom.xml | 67 ++++++++ .../.gitignore | 3 +- .../models/SendingDataTest.room | 2 +- .../models/StaticConfigTest.room | 2 +- .../.gitignore | 3 +- .../etTest.gradle | 6 +- .../models/ActorCommunicationTest.room | 2 +- .../models/ChoicePointTest.room | 2 +- .../models/ChoicePointTestExtended.room | 2 +- .../models/CompileTests.room | 2 +- .../models/DataDrivenTest.room | 2 +- .../models/EnumTest.room | 2 +- .../models/HandlerTest.room | 2 +- .../models/OperationInheritanceTest.room | 2 +- .../models/PingPongThreadReplPortTest.room | 2 +- .../models/PingPongThreadTest.room | 2 +- .../.gitignore | 3 +- .../models/InitializationTest.room | 2 +- .../models/SendingDataTest.room | 2 +- .../.gitignore | 3 +- .../models/DynamicActorTest1.room | 2 +- .../models/DynamicActorTest2.room | 2 +- .../models/DynamicActorTest3.room | 2 +- .../models/DynamicActorTest4.room | 2 +- .../models/DynamicActorTest5.room | 2 +- .../models/DynamicActorTest6.room | 2 +- .../models/DynamicActorTest7.room | 2 +- .../models/DynamicConfigTest.room | 2 +- .../models/SendingDataTest.room | 2 +- .../models/StaticConfigTest.room | 2 +- .../models/StoreRestoreTest.room | 2 +- .../models/TCPTest.room | 2 +- .../build.gradle | 9 +- .../src/runtime/RunCRuntimeTestcases.c | 6 +- .../src/runtime/util/TestUtil.c | 2 +- .../build.gradle | 7 +- .../src/RunAllTestCases.cpp | 2 +- .../src/debugging/DebuggingServiceTest.cpp | 2 +- .../src/debugging/MSCFunctionObjectTest.cpp | 2 +- .../src/debugging/MSCLoggerTest.cpp | 2 +- .../build.gradle | 5 +- tests/pom.xml | 1 + 50 files changed, 426 insertions(+), 56 deletions(-) create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat diff --git a/.gitignore b/.gitignore index 426460ec6..9805706a8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ language.settings.xml target/ xtend-gen/ build/ -.gradle/ \ No newline at end of file +.gradle/ +log/ \ No newline at end of file diff --git a/build.gradle b/build.gradle index 95680d357..2d21c1458 100644 --- a/build.gradle +++ b/build.gradle @@ -7,4 +7,9 @@ ext { etUnitConverter = "$rootDir/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle" etGenerator = "$rootDir/plugins/org.eclipse.etrice.generator/etGenerator.gradle" etTest = "$rootDir/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle" +} + +allprojects { + group = 'org.eclipse.etrice' + version = '1.0.0-SNAPSHOT' } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..7a3265ee9 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..f16d26666 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip diff --git a/gradlew b/gradlew new file mode 100644 index 000000000..cccdd3d51 --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 000000000..f9553162f --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/plugins/build.gradle b/plugins/build.gradle index 46c7c1cde..3c483f924 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -1,7 +1,37 @@ subprojects { - repositories { + maven { + name 'Protos Nexus' + url 'http://10.8.1.101:8081/repository/maven-public' + } mavenCentral() } + apply plugin: 'maven-publish' + + publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + repositories { + maven { + name 'maven-snapshots' + url "http://10.8.1.101:8081/repository/maven-snapshots" + credentials { + username project.properties.nexusUser + password project.properties.nexusPassword + } + } + /*maven { + name 'maven-releases' + url "http://10.8.1.101:8081/repository/maven-releases" + credentials { + username properties.nexusUser + password properties.nexusPassword + } + }*/ + } + } } \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle index 7055f05ff..35fa139f0 100644 --- a/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle +++ b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle @@ -5,15 +5,15 @@ evaluationDependsOn(etUnitConverter) /** * Creates a tasks that converts etu files to xml files * @param name: The name of the new task - * @param etuFiles: The etu files to be converted + * @param options: The options passed to the converter */ -ext.createEtUnitConverterTask = { name, etuFiles, suiteName = null -> +ext.createEtUnitConverterTask = { name, etuFiles, options = [] -> def xmlFiles = etuFiles.collect { it.replace('.etu', '.xml') } return tasks.create(name: name, type: JavaExec, dependsOn: "$etUnitConverter:classes") { main = project(etUnitConverter).mainClassName classpath = project(etUnitConverter).sourceSets.main.runtimeClasspath - if(suiteName != null) args '-suite', suiteName + args options args etuFiles inputs.files etuFiles outputs.files xmlFiles diff --git a/releng/org.eclipse.etrice.parent/pom.xml b/releng/org.eclipse.etrice.parent/pom.xml index 97dc48dfb..7b5e74df8 100644 --- a/releng/org.eclipse.etrice.parent/pom.xml +++ b/releng/org.eclipse.etrice.parent/pom.xml @@ -13,10 +13,12 @@ 2.10.0 1.0.0 + 1.1.4 http://download.eclipse.org/releases/oxygen http://download.eclipse.org/cbi/updates/license http://download.eclipse.org/tools/orbit/R-builds/R20170516192513/repository + https://repo.eclipse.org/content/repositories/cbi-releases @@ -37,6 +39,37 @@ + + + cbi + ${cbi.url} + + + + + + sign + + + + org.eclipse.cbi.maven.plugins + eclipse-jarsigner-plugin + ${cbi.version} + + + sign + verify + + sign + + + + + + + + + @@ -65,6 +98,40 @@ xtend-gen + diff --git a/tests/org.eclipse.etrice.generator.c.tests/.gitignore b/tests/org.eclipse.etrice.generator.c.tests/.gitignore index d2726d181..b45c5f774 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/.gitignore +++ b/tests/org.eclipse.etrice.generator.c.tests/.gitignore @@ -1,2 +1 @@ -src-gen/ -output/ \ No newline at end of file +src-gen/ \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room index 332f1c847..8091671e9 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room +++ b/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room @@ -186,7 +186,7 @@ RoomModel SendingDataTest { StateMachine { Transition init: initial -> tp0 of state0 { action { - "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.c.tests.SendingDataTest\", \"SendingDataTest_case\");" + "caseId = etUnit_openAll(\"log\", \"SendingDataTest\", \"org.eclipse.etrice.generator.c.tests.SendingDataTest\", \"SendingDataTest_case\");" "EXPECT_ORDER_START(caseId,resultlist,23);" "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" "/* send the default values */" diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room index 3c8518ee0..484f8ac0e 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room +++ b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room @@ -22,7 +22,7 @@ RoomModel StaticConfigTest { } Behavior { ctor { - "etUnit_open(\".\", \"StaticConfigTest\");" + "etUnit_open(\"log\", \"StaticConfigTest\");" "etUnit_openTestSuite(\"org.eclipse.etrice.generator.c.tests.StaticConfigTest\");" } dtor { diff --git a/tests/org.eclipse.etrice.generator.common.tests/.gitignore b/tests/org.eclipse.etrice.generator.common.tests/.gitignore index d2726d181..b45c5f774 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/.gitignore +++ b/tests/org.eclipse.etrice.generator.common.tests/.gitignore @@ -1,2 +1 @@ -src-gen/ -output/ \ No newline at end of file +src-gen/ \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle b/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle index 7df62b1f4..86b7145c8 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle +++ b/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle @@ -1,7 +1,7 @@ apply from: etGenerator apply from: etUnitConverter -def outputDir = 'output' +def outputDir = 'log' def srcGenDir = 'src-gen' clean.delete srcGenDir, outputDir @@ -34,7 +34,7 @@ ext.createTest = { lang, name, models, options = [] -> def suiteName = "${project.name}.$testNameCap" def genDir = "$srcGenDir/$testName" def workingDir = "$outputDir/$testName" - def etuFile = "$workingDir/${nameCap}.etu" + def etuFile = "$workingDir/log/${nameCap}.etu" def generateTask = createGeneratorTask("generate$testNameCap", lang, models, genDir, options) generateTask.environment 'etModellib', "org.eclipse.etrice.modellib.$lang" @@ -101,7 +101,7 @@ ext.createTest = { lang, name, models, options = [] -> runTask.doFirst { file("$workingDir/log").mkdirs() } - def convertTask = createEtUnitConverterTask("convert$testNameCap", etuFile, suiteName) + def convertTask = createEtUnitConverterTask("convert$testNameCap", etuFile, ['-suite', suiteName]) convertTask.dependsOn runTask check.dependsOn tasks.create(name: testName, dependsOn: convertTask, group: 'verification') diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room index e9929261f..9b51b0972 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room @@ -63,7 +63,7 @@ RoomModel ActorCommunicationTest { } Behavior { ctor { - "etUnit_open(\".\", \"ActorCommunicationTest\");" + "etUnit_open(\"log\", \"ActorCommunicationTest\");" "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.ActorCommunicationTest\");" } dtor { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room index c72dbc8de..92fc9fcbb 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room @@ -26,7 +26,7 @@ RoomModel ChoicePointTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"ChoicePointTest\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTest\", \"ChoicePointTest_case\");" + "caseId = etUnit_openAll(\"log\", \"ChoicePointTest\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTest\", \"ChoicePointTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room index a87545e89..fe184e51e 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room @@ -350,7 +350,7 @@ RoomModel ChoicePointTestExtended { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"ChoicePointTestExtended\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTestExtended\", \"ChoicePointTest_case\");" + "caseId = etUnit_openAll(\"log\", \"ChoicePointTestExtended\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTestExtended\", \"ChoicePointTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room index 16008a342..2819b53fd 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room @@ -20,7 +20,7 @@ RoomModel CompileTests { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"CompileTests\", \"org.eclipse.etrice.generator.common.tests.CompileTests\", \"CompileTests_case\");" + "caseId = etUnit_openAll(\"log\", \"CompileTests\", \"org.eclipse.etrice.generator.common.tests.CompileTests\", \"CompileTests_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room index 87a002749..92141b100 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room @@ -68,7 +68,7 @@ RoomModel DataDrivenTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DataDrivenTest\", \"org.eclipse.etrice.generator.common.tests.DataDrivenTest\", \"DataDrivenTest_case\");" + "caseId = etUnit_openAll(\"log\", \"DataDrivenTest\", \"org.eclipse.etrice.generator.common.tests.DataDrivenTest\", \"DataDrivenTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room index b533ebf22..fa39886e8 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room @@ -32,7 +32,7 @@ RoomModel EnumTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"EnumTest\", \"org.eclipse.etrice.generator.common.tests.EnumTest\", \"EnumTest_case\");" + "caseId = etUnit_openAll(\"log\", \"EnumTest\", \"org.eclipse.etrice.generator.common.tests.EnumTest\", \"EnumTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room index db3dff2cd..381ad7633 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room @@ -26,7 +26,7 @@ RoomModel HandlerTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"HandlerTest\", \"org.eclipse.etrice.generator.common.tests.HandlerTest\", \"HandlerTest_case\");" + "caseId = etUnit_openAll(\"log\", \"HandlerTest\", \"org.eclipse.etrice.generator.common.tests.HandlerTest\", \"HandlerTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room index f9fd340e8..f98190fcc 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room @@ -10,7 +10,7 @@ RoomModel OperationInheritanceTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"OperationInheritanceTest\", \"org.eclipse.etrice.generator.common.tests.OperationInheritanceTest\", \"OperationInheritanceTest_case\");" + "caseId = etUnit_openAll(\"log\", \"OperationInheritanceTest\", \"org.eclipse.etrice.generator.common.tests.OperationInheritanceTest\", \"OperationInheritanceTest_case\");" "ctorRefine = 2;" } dtor { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room index ef057dd2c..f0e904bdb 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room @@ -54,7 +54,7 @@ RoomModel PingPongThreadReplPortTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"PingPongThreadReplPortTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTestReplPort\", \"PingPongThreadTestReplPort_case\");" + "caseId = etUnit_openAll(\"log\", \"PingPongThreadReplPortTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTestReplPort\", \"PingPongThreadTestReplPort_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room index e18c868d4..8a4f147ab 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room @@ -56,7 +56,7 @@ RoomModel PingPongThreadTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"PingPongThreadTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTest\", \"PingPongThreadTest_case\");" + "caseId = etUnit_openAll(\"log\", \"PingPongThreadTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTest\", \"PingPongThreadTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore b/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore index d2726d181..b45c5f774 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore +++ b/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore @@ -1,2 +1 @@ -src-gen/ -output/ \ No newline at end of file +src-gen/ \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room b/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room index 633aa3b95..7d1ccfb7f 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room +++ b/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room @@ -45,7 +45,7 @@ RoomModel InitializationTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"InitializationTest\", \"org.eclipse.etrice.generator.cpp.tests.InitializationTest\", \"InitializationTest_case\");" + "caseId = etUnit_openAll(\"log\", \"InitializationTest\", \"org.eclipse.etrice.generator.cpp.tests.InitializationTest\", \"InitializationTest_case\");" "testInitValues(caseId);" } dtor { diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room index c1558d539..b38d93c30 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room +++ b/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room @@ -186,7 +186,7 @@ RoomModel SendingDataTest { StateMachine { Transition init: initial -> tp0 of state0 { action { - "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.cpp.tests.SendingDataTest\", \"SendingDataTest_case\");" + "caseId = etUnit_openAll(\"log\", \"SendingDataTest\", \"org.eclipse.etrice.generator.cpp.tests.SendingDataTest\", \"SendingDataTest_case\");" "EXPECT_ORDER_START(caseId,resultlist,23);" "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" "/* send the default values */" diff --git a/tests/org.eclipse.etrice.generator.java.tests/.gitignore b/tests/org.eclipse.etrice.generator.java.tests/.gitignore index d2726d181..b45c5f774 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/.gitignore +++ b/tests/org.eclipse.etrice.generator.java.tests/.gitignore @@ -1,2 +1 @@ -src-gen/ -output/ \ No newline at end of file +src-gen/ \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room index 59c71cd68..9f393fd1a 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room @@ -30,7 +30,7 @@ RoomModel DynamicActorTest1 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest1\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest1\", \"DynamicActorTest1_case\");" + "caseId = etUnit_openAll(\"log\", \"DynamicActorTest1\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest1\", \"DynamicActorTest1_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room index f47a1ec41..9893c7dbf 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room @@ -30,7 +30,7 @@ RoomModel DynamicActorTest2 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest2\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest2\", \"DynamicActorTest2_case\");" + "caseId = etUnit_openAll(\"log\", \"DynamicActorTest2\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest2\", \"DynamicActorTest2_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room index 410f28772..152b36811 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room @@ -22,7 +22,7 @@ RoomModel DynamicActorTest3 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest3\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest3\", \"DynamicActorTest3_case\");" + "caseId = etUnit_openAll(\"log\", \"DynamicActorTest3\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest3\", \"DynamicActorTest3_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room index 57a67add5..3deb03ddd 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room @@ -21,7 +21,7 @@ RoomModel DynamicActorTest4 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest4\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest4\", \"DynamicActorTest4_case\");" + "caseId = etUnit_openAll(\"log\", \"DynamicActorTest4\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest4\", \"DynamicActorTest4_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room index 7c7b8c4a1..0a4d3d8c0 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room @@ -21,7 +21,7 @@ RoomModel DynamicActorTest5 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest5\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest5\", \"DynamicActorTest5_case\");" + "caseId = etUnit_openAll(\"log\", \"DynamicActorTest5\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest5\", \"DynamicActorTest5_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room index 905f8c05d..174b03d01 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room @@ -24,7 +24,7 @@ RoomModel DynamicActorTest6 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest6\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest6\", \"DynamicActorTest6_case\");" + "caseId = etUnit_openAll(\"log\", \"DynamicActorTest6\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest6\", \"DynamicActorTest6_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room index 8a5c7bba8..ec9aff939 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room @@ -42,7 +42,7 @@ RoomModel DynamicActorTest7 { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"DynamicActorTest7\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest7\", \"DynamicActorTest7_case\");" + "caseId = etUnit_openAll(\"log\", \"DynamicActorTest7\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest7\", \"DynamicActorTest7_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room index 112e47693..9835b42af 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room @@ -49,7 +49,7 @@ RoomModel DynamicConfigTest { } Behavior { ctor { - "etUnit_open(\".\", \"DynamicConfigTest\");" + "etUnit_open(\"log\", \"DynamicConfigTest\");" "etUnit_openTestSuite(\"org.eclipse.etrice.generator.java.tests.DynamicConfigTest\");" "caseId = etUnit_openTestCase(\"DynamicConfigTest_case_Testee_ac\");" } diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room index 2fdd40bdb..39a66aeee 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room @@ -178,7 +178,7 @@ RoomModel SendingDataTest { StateMachine { Transition init: initial -> tp0 of state0 { action { - "caseId = etUnit_openAll(\".\", \"SendingDataTest\", \"org.eclipse.etrice.generator.java.tests.SendingDataTest\", \"SendingDataTest_case\");" + "caseId = etUnit_openAll(\"log\", \"SendingDataTest\", \"org.eclipse.etrice.generator.java.tests.SendingDataTest\", \"SendingDataTest_case\");" "EXPECT_ORDER_START(caseId,resultlist,23);" "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" "// send the default values" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room index c76fe713e..b6242c9a1 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room @@ -22,7 +22,7 @@ RoomModel StaticConfigTest { } Behavior { ctor { - "etUnit_open(\".\", \"StaticConfigTest\");" + "etUnit_open(\"log\", \"StaticConfigTest\");" "etUnit_openTestSuite(\"org.eclipse.etrice.generator.java.tests.StaticConfigTest\");" } dtor { diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room index 757233bf1..7fab6d5cc 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room @@ -117,7 +117,7 @@ RoomModel StoreRestoreTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"StoreRestoreTest\", \"org.eclipse.etrice.generator.java.tests.StoreRestoreTest\", \"StoreRestoreTest_case\");" + "caseId = etUnit_openAll(\"log\", \"StoreRestoreTest\", \"org.eclipse.etrice.generator.java.tests.StoreRestoreTest\", \"StoreRestoreTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room index 9227b9a29..5e2b2c4f3 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room @@ -41,7 +41,7 @@ RoomModel TCPTest { } Behavior { ctor { - "caseId = etUnit_openAll(\".\", \"TCPTest\", \"org.eclipse.etrice.generator.java.tests.TCPTest\", \"TCPTest_case\");" + "caseId = etUnit_openAll(\"log\", \"TCPTest\", \"org.eclipse.etrice.generator.java.tests.TCPTest\", \"TCPTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle index 4b711fc94..4a21f68db 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle @@ -17,13 +17,16 @@ model { } lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' } + binaries { + all { cppCompiler.args '-g3' } + } } } } def exeFile = "$buildDir/exe/etrice_runtime_c_tests/etrice_runtime_c_tests" -def etuFileRuntimeTest = 'log/testlog/TestCRuntime.etu' -def etuFileEtUnitTest = 'log/testlog/TestEtUnitSpecial.etu' +def etuFileRuntimeTest = 'log/TestCRuntime.etu' +def etuFileEtUnitTest = 'log/TestEtUnitSpecial.etu' clean.delete 'log' @@ -32,7 +35,7 @@ task run(type: Exec, dependsOn: assemble, group: 'verification') { inputs.file exeFile outputs.files etuFileRuntimeTest, etuFileEtUnitTest - doFirst { file('log/testlog').mkdirs() } + doFirst { file('log').mkdirs() } } createEtUnitConverterTask('convert', [etuFileRuntimeTest, etuFileEtUnitTest]) diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c index 16ad8a4da..d011b03e8 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c @@ -38,8 +38,8 @@ void RunCRuntimeTestcases(void){ etInt16 id; - etMSCLogger_open("log/testlog", "test.log"); - etUnit_open("log/testlog","TestCRuntime"); + etMSCLogger_open("log", "test.log"); + etUnit_open("log","TestCRuntime"); TestEtQueue_runSuite(); TestEtMemory_runSuite(); @@ -56,7 +56,7 @@ void RunCRuntimeTestcases(void){ /* special situation for testing openAll and closeAll of etUnit * this has to be done outside of etUnit_open and etUnit_close */ - id = etUnit_openAll("log/testlog","TestEtUnitSpecial", "etUnit", "org.eclipse.etrice.runtime.c.tests.openAll_and_closeAll"); + id = etUnit_openAll("log","TestEtUnitSpecial", "etUnit", "org.eclipse.etrice.runtime.c.tests.openAll_and_closeAll"); EXPECT_TRUE(id, "Open and Close", ET_TRUE); etUnit_closeAll(id); diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c index da583e1de..6c6a5f4ea 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c @@ -49,7 +49,7 @@ static void TestRandomGenerator (etInt16 id) { #endif void TestUtil_runSuite(void){ - etUnit_openTestSuite("TestUtil"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.TestUtil"); #ifdef ET_FLOAT64 ADD_TESTCASE(TestRandomGenerator); diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle index d9d197a0c..6d0932b11 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle @@ -18,12 +18,15 @@ model { lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' } + binaries { + all { cppCompiler.args '-g3' } + } } } } def exeFile = "$buildDir/exe/etrice_runtime_cpp_tests/etrice_runtime_cpp_tests" -def etuFile = 'log/testlog/TestCppRuntime.etu' +def etuFile = 'log/TestCppRuntime.etu' clean.delete 'log' @@ -32,7 +35,7 @@ task run(type: Exec, dependsOn: assemble, group: 'verification') { inputs.file exeFile outputs.files etuFile - doFirst { file('log/testlog').mkdirs() } + doFirst { file('log').mkdirs() } } createEtUnitConverterTask('convert', etuFile) diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/RunAllTestCases.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/RunAllTestCases.cpp index 322ca7a2c..86376c989 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/RunAllTestCases.cpp +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/RunAllTestCases.cpp @@ -35,7 +35,7 @@ int main() { - etUnit_open("log/testlog", "TestCppRuntime"); + etUnit_open("log", "TestCppRuntime"); // Test containers StaticArrayTest staticArrayTest; diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.cpp index b04d03034..38ba09935 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.cpp +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.cpp @@ -32,7 +32,7 @@ void DebuggingServiceTest::testLogging() { Port port1(&actor1, "TestPort1"); Port port2(&actor2, "TestPort2"); DebuggingService& dbgSvc = DebuggingService::getInstance(); - dbgSvc.getAsyncLogger().setMSC("DebuggingServiceTest", "log/testlog/"); + dbgSvc.getAsyncLogger().setMSC("DebuggingServiceTest", "log/"); dbgSvc.getAsyncLogger().open(); InterfaceItemBase::connect(&subSystem, port1.getInstancePath(), diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFunctionObjectTest.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFunctionObjectTest.cpp index b7c8567f0..4096678fc 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFunctionObjectTest.cpp +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCFunctionObjectTest.cpp @@ -19,7 +19,7 @@ using namespace etRuntime; void MSCFunctionObjectTest::test() { DebuggingService::getInstance().getSyncLogger().setMSC( - "MSCFunctionObjectTest", "log/testlog/"); + "MSCFunctionObjectTest", "log/"); DebuggingService::getInstance().getSyncLogger().open(); DebuggingService::getInstance().getSyncLogger().setObjectName("main"); MSCFunctionObject* obj = new MSCFunctionObject("MSCFunctionObjectTest", diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCLoggerTest.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCLoggerTest.cpp index 01be8e936..6b2a68037 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCLoggerTest.cpp +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/MSCLoggerTest.cpp @@ -19,7 +19,7 @@ using namespace etRuntime; void MSCLoggerTest::testLogger() { MSCLogger logger; - logger.setMSC("MSCTest", "log/testlog/"); + logger.setMSC("MSCTest", "log/"); logger.open(); logger.addMessageAsyncOut("Source", "Target", "MessageAsync"); logger.addMessageAsyncIn("Source", "Target", "MessageAsync"); diff --git a/tests/org.eclipse.etrice.runtime.java.tests/build.gradle b/tests/org.eclipse.etrice.runtime.java.tests/build.gradle index 8b221bf37..63cdcb3bd 100644 --- a/tests/org.eclipse.etrice.runtime.java.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.java.tests/build.gradle @@ -13,4 +13,7 @@ dependencies { sourceSets.test.java.srcDirs = ['src'] -test.reports.html.enabled = false \ No newline at end of file +test.reports.html.enabled = false +test.reports.junitXml.destination = file('log') + +clean.delete 'log' \ No newline at end of file diff --git a/tests/pom.xml b/tests/pom.xml index 2614046e0..9ee1ea0a3 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -22,6 +22,7 @@ ${tycho.version} false + log -- cgit v1.2.3 From 2f77828fb75778938869e8d29c26340221f5f89b Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Sat, 16 Sep 2017 15:40:29 +0200 Subject: [releng] changed to eclipse maven central proxy repository --- build.gradle | 6 +++++ plugins/build.gradle | 28 ++++++++-------------- .../src/runtime/RunCRuntimeTestcases.c | 2 +- .../src/runtime/util/TestUtil.c | 2 +- .../build.gradle | 4 ---- .../runtime/java/debugging/MSCLoggerTest.java | 2 +- .../etrice/runtime/java/etunit/EtUnitTest.java | 4 ++-- 7 files changed, 21 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index 2d21c1458..89db21087 100644 --- a/build.gradle +++ b/build.gradle @@ -12,4 +12,10 @@ ext { allprojects { group = 'org.eclipse.etrice' version = '1.0.0-SNAPSHOT' + + repositories { + maven { + url 'https://repo.eclipse.org/content/repositories/maven_central/' + } + } } \ No newline at end of file diff --git a/plugins/build.gradle b/plugins/build.gradle index 3c483f924..fb1a53d72 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -1,12 +1,4 @@ subprojects { - repositories { - maven { - name 'Protos Nexus' - url 'http://10.8.1.101:8081/repository/maven-public' - } - mavenCentral() - } - apply plugin: 'maven-publish' publishing { @@ -17,21 +9,21 @@ subprojects { } repositories { maven { - name 'maven-snapshots' - url "http://10.8.1.101:8081/repository/maven-snapshots" + name 'snapshots' + url "https://repo.eclipse.org/content/repositories/etrice-snapshots" credentials { - username project.properties.nexusUser - password project.properties.nexusPassword + username project.properties.eclipseRepoUsername + password project.properties.eclipseRepoPassword } } - /*maven { - name 'maven-releases' - url "http://10.8.1.101:8081/repository/maven-releases" + maven { + name 'releases' + url "https://repo.eclipse.org/content/repositories/etrice-releases" credentials { - username properties.nexusUser - password properties.nexusPassword + username project.properties.eclipseRepoUsername + password project.properties.eclipseRepoPassword } - }*/ + } } } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c index d011b03e8..8aed2e209 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c @@ -56,7 +56,7 @@ void RunCRuntimeTestcases(void){ /* special situation for testing openAll and closeAll of etUnit * this has to be done outside of etUnit_open and etUnit_close */ - id = etUnit_openAll("log","TestEtUnitSpecial", "etUnit", "org.eclipse.etrice.runtime.c.tests.openAll_and_closeAll"); + id = etUnit_openAll("log","TestEtUnitSpecial", "org.eclipse.etrice.runtime.c.tests.etUnit", "openAll_and_closeAll"); EXPECT_TRUE(id, "Open and Close", ET_TRUE); etUnit_closeAll(id); diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c index 6c6a5f4ea..335a792c5 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c @@ -49,7 +49,7 @@ static void TestRandomGenerator (etInt16 id) { #endif void TestUtil_runSuite(void){ - etUnit_openTestSuite("org.eclipse.etrice.runtime.c.TestUtil"); + etUnit_openTestSuite("org.eclipse.etrice.runtime.c.tests.TestUtil"); #ifdef ET_FLOAT64 ADD_TESTCASE(TestRandomGenerator); diff --git a/tests/org.eclipse.etrice.runtime.java.tests/build.gradle b/tests/org.eclipse.etrice.runtime.java.tests/build.gradle index 63cdcb3bd..ad80588e9 100644 --- a/tests/org.eclipse.etrice.runtime.java.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.java.tests/build.gradle @@ -2,10 +2,6 @@ plugins { id 'java' } -repositories { - mavenCentral() -} - dependencies { testCompile project(':runtime:org.eclipse.etrice.runtime.java') testCompile 'junit:junit:4.12' diff --git a/tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/debugging/MSCLoggerTest.java b/tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/debugging/MSCLoggerTest.java index 055a31f46..704bfe90b 100644 --- a/tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/debugging/MSCLoggerTest.java +++ b/tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/debugging/MSCLoggerTest.java @@ -16,7 +16,7 @@ public class MSCLoggerTest extends TestCase { public void testMSCLogger() { MSCLogger logger = new MSCLogger(); - logger.setMSC("MSC1", ".\\"); + logger.setMSC("MSC1", "./"); logger.open(); logger.addMessageAsyncOut("Inst1", "Inst2", "msg1"); logger.addMessageAsyncIn("Inst1", "Inst2", "msg1"); diff --git a/tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/etunit/EtUnitTest.java b/tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/etunit/EtUnitTest.java index 99c7f60d8..1916f84ab 100644 --- a/tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/etunit/EtUnitTest.java +++ b/tests/org.eclipse.etrice.runtime.java.tests/src/org/eclipse/etrice/runtime/java/etunit/EtUnitTest.java @@ -80,7 +80,7 @@ public class EtUnitTest extends TestCase { } public void testSuite() throws IOException { - etUnit_open(null, "test"); + etUnit_open("log", "test"); etUnit_openTestSuite("TestEtUnit"); int id = etUnit_openTestCase("doTestExpect"); @@ -96,7 +96,7 @@ public class EtUnitTest extends TestCase { ArrayList lines = new ArrayList(); { - FileReader fr = new FileReader("test.etu"); + FileReader fr = new FileReader("log/test.etu"); BufferedReader br = new BufferedReader(fr); String line; while ((line=br.readLine())!=null) -- cgit v1.2.3 From a68a06f09a4026660d6839b31829a547c3e21285 Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Sat, 16 Sep 2017 16:33:04 +0200 Subject: [tests] fixed missing linker library flags for linux Change-Id: Id72e4694a0ca249c68fe935036a9944630212c63 --- runtime/org.eclipse.etrice.runtime.c/build.gradle | 1 - tests/org.eclipse.etrice.generator.common.tests/etTest.gradle | 3 +++ tests/org.eclipse.etrice.runtime.c.tests/build.gradle | 7 ++++++- tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle | 7 ++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/runtime/org.eclipse.etrice.runtime.c/build.gradle b/runtime/org.eclipse.etrice.runtime.c/build.gradle index 56cad9f53..27ae8fc4d 100644 --- a/runtime/org.eclipse.etrice.runtime.c/build.gradle +++ b/runtime/org.eclipse.etrice.runtime.c/build.gradle @@ -5,7 +5,6 @@ plugins { } def platform = '' - if(isFamily(FAMILY_WINDOWS)) { platform = 'MT_WIN_MinGW' } else if(isFamily(FAMILY_UNIX)) { platform = 'MT_POSIX_GENERIC_GCC' } diff --git a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle b/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle index 86b7145c8..e17d1d8d7 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle +++ b/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle @@ -1,3 +1,5 @@ +import static org.apache.tools.ant.taskdefs.condition.Os.* + apply from: etGenerator apply from: etUnitConverter @@ -61,6 +63,7 @@ ext.createTest = { lang, name, models, options = [] -> binaries.all { cCompiler.args '-g3' cppCompiler.args '-g3' + if(isFamily(FAMILY_UNIX)) { linker.args '-lpthread', '-lrt', '-lm' } } } } diff --git a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle index 4a21f68db..1321f31f4 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle @@ -1,3 +1,5 @@ +import static org.apache.tools.ant.taskdefs.condition.Os.* + plugins { id 'c' } @@ -18,7 +20,10 @@ model { lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' } binaries { - all { cppCompiler.args '-g3' } + all { + cCompiler.args '-g3' + if(isFamily(FAMILY_UNIX)) { linker.args '-lpthread', '-lrt', '-lm' } + } } } } diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle index 6d0932b11..3105e15ff 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle @@ -1,3 +1,5 @@ +import static org.apache.tools.ant.taskdefs.condition.Os.* + plugins { id 'cpp' } @@ -19,7 +21,10 @@ model { lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' } binaries { - all { cppCompiler.args '-g3' } + all { + cppCompiler.args '-g3' + if(isFamily(FAMILY_UNIX)) { linker.args '-lpthread', '-lrt', '-lm' } + } } } } -- cgit v1.2.3 From 26e553de11a137a1487074bce959a3b4423f2e1c Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Sun, 17 Sep 2017 11:41:11 +0200 Subject: [tests] fixed gradle build scripts Change-Id: I404a3d5ef3d690c039ed7400ac6cad964a6e139d --- build.gradle | 10 +++++----- plugins/build.gradle | 4 ++-- plugins/org.eclipse.etrice.abstractexec.behavior/build.gradle | 2 +- plugins/org.eclipse.etrice.core.common/build.gradle | 4 ++-- plugins/org.eclipse.etrice.core.room/build.gradle | 2 +- plugins/org.eclipse.etrice.etunit.converter/build.gradle | 8 ++++---- .../org.eclipse.etrice.etunit.converter/etUnitConverter.gradle | 3 +++ plugins/org.eclipse.etrice.generator.fsm/build.gradle | 4 ++-- plugins/org.eclipse.etrice.generator/etGenerator.gradle | 2 +- tests/org.eclipse.etrice.generator.common.tests/etTest.gradle | 2 +- tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle | 2 +- .../src/debugging/DebuggingServiceTest.cpp | 9 ++++++--- .../src/messaging/MessageDispatcherTest.cpp | 7 +++++++ 13 files changed, 36 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 89db21087..ad62af5de 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ ext { - xtext_version = '+' - emf_version = '+' - core_version = '+' - commons_io_version = '+' + core_runtime_version = '3.12.0' + core_resources_version = '3.11.1' + xtext_version = '2.12.0' + commons_io_version = '2.5' etUnitConverter = "$rootDir/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle" etGenerator = "$rootDir/plugins/org.eclipse.etrice.generator/etGenerator.gradle" @@ -11,7 +11,7 @@ ext { allprojects { group = 'org.eclipse.etrice' - version = '1.0.0-SNAPSHOT' + version = '1.1.1-SNAPSHOT' repositories { maven { diff --git a/plugins/build.gradle b/plugins/build.gradle index fb1a53d72..8eea3b54b 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -10,7 +10,7 @@ subprojects { repositories { maven { name 'snapshots' - url "https://repo.eclipse.org/content/repositories/etrice-snapshots" + url 'https://repo.eclipse.org/content/repositories/etrice-snapshots' credentials { username project.properties.eclipseRepoUsername password project.properties.eclipseRepoPassword @@ -18,7 +18,7 @@ subprojects { } maven { name 'releases' - url "https://repo.eclipse.org/content/repositories/etrice-releases" + url 'https://repo.eclipse.org/content/repositories/etrice-releases' credentials { username project.properties.eclipseRepoUsername password project.properties.eclipseRepoPassword diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/build.gradle b/plugins/org.eclipse.etrice.abstractexec.behavior/build.gradle index 6309d3367..c15063587 100644 --- a/plugins/org.eclipse.etrice.abstractexec.behavior/build.gradle +++ b/plugins/org.eclipse.etrice.abstractexec.behavior/build.gradle @@ -8,7 +8,7 @@ dependencies { compile project(':plugins:org.eclipse.etrice.core.genmodel.fsm') compile project(':plugins:org.eclipse.etrice.generator.fsm') - compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" + compile "org.eclipse.platform:org.eclipse.core.runtime:$core_runtime_version" compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" } diff --git a/plugins/org.eclipse.etrice.core.common/build.gradle b/plugins/org.eclipse.etrice.core.common/build.gradle index d4a3f77d9..f89b435a6 100644 --- a/plugins/org.eclipse.etrice.core.common/build.gradle +++ b/plugins/org.eclipse.etrice.core.common/build.gradle @@ -3,8 +3,8 @@ plugins { } dependencies { - compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" - compile "org.eclipse.platform:org.eclipse.core.resources:$core_version" + compile "org.eclipse.platform:org.eclipse.core.runtime:$core_runtime_version" + compile "org.eclipse.platform:org.eclipse.core.resources:$core_resources_version" compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" } diff --git a/plugins/org.eclipse.etrice.core.room/build.gradle b/plugins/org.eclipse.etrice.core.room/build.gradle index bead8b39c..20efac29c 100644 --- a/plugins/org.eclipse.etrice.core.room/build.gradle +++ b/plugins/org.eclipse.etrice.core.room/build.gradle @@ -7,7 +7,7 @@ dependencies { compile project(':plugins:org.eclipse.etrice.core.fsm') runtime project(':plugins:org.eclipse.etrice.abstractexec.behavior') - compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" + compile "org.eclipse.platform:org.eclipse.core.runtime:$core_runtime_version" compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" } diff --git a/plugins/org.eclipse.etrice.etunit.converter/build.gradle b/plugins/org.eclipse.etrice.etunit.converter/build.gradle index 0309c7d3e..e44d587c1 100644 --- a/plugins/org.eclipse.etrice.etunit.converter/build.gradle +++ b/plugins/org.eclipse.etrice.etunit.converter/build.gradle @@ -3,10 +3,10 @@ plugins { } dependencies { - compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" - compile "org.eclipse.emf:org.eclipse.emf.common:$emf_version" - compile "org.eclipse.emf:org.eclipse.emf.ecore:$emf_version" - compile "org.eclipse.emf:org.eclipse.emf.ecore.xmi:$emf_version" + compile "org.eclipse.platform:org.eclipse.core.runtime:$core_runtime_version" + compile "org.eclipse.emf:org.eclipse.emf.common:$xtext_version" + compile "org.eclipse.emf:org.eclipse.emf.ecore:$xtext_version" + compile "org.eclipse.emf:org.eclipse.emf.ecore.xmi:$xtext_version" } sourceSets { diff --git a/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle index 35fa139f0..0c38bedbc 100644 --- a/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle +++ b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle @@ -5,6 +5,7 @@ evaluationDependsOn(etUnitConverter) /** * Creates a tasks that converts etu files to xml files * @param name: The name of the new task + * @param etuFiles: A list of etu files * @param options: The options passed to the converter */ ext.createEtUnitConverterTask = { name, etuFiles, options = [] -> @@ -17,5 +18,7 @@ ext.createEtUnitConverterTask = { name, etuFiles, options = [] -> args etuFiles inputs.files etuFiles outputs.files xmlFiles + inputs.files.each { println it } + outputs.files.each { println it } } } \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.fsm/build.gradle b/plugins/org.eclipse.etrice.generator.fsm/build.gradle index e5f81ea46..74ebd8be6 100644 --- a/plugins/org.eclipse.etrice.generator.fsm/build.gradle +++ b/plugins/org.eclipse.etrice.generator.fsm/build.gradle @@ -6,8 +6,8 @@ dependencies { compile project(':plugins:org.eclipse.etrice.core.fsm') compile project(':plugins:org.eclipse.etrice.core.genmodel.fsm') - compile "org.eclipse.platform:org.eclipse.core.runtime:$core_version" - compile "org.eclipse.platform:org.eclipse.core.resources:$core_version" + compile "org.eclipse.platform:org.eclipse.core.runtime:$core_runtime_version" + compile "org.eclipse.platform:org.eclipse.core.resources:$core_resources_version" compile "commons-io:commons-io:$commons_io_version" } diff --git a/plugins/org.eclipse.etrice.generator/etGenerator.gradle b/plugins/org.eclipse.etrice.generator/etGenerator.gradle index 42556974a..399088d2f 100644 --- a/plugins/org.eclipse.etrice.generator/etGenerator.gradle +++ b/plugins/org.eclipse.etrice.generator/etGenerator.gradle @@ -6,7 +6,7 @@ evaluationDependsOn(':plugins:org.eclipse.etrice.generator.java') /** * Creates an eTrice generator task * @param name: The name of the new task - * @param models: The models passed to the generator + * @param models: A list of models passed to the generator * @param genDir: The generation directory * @param options: The eTrice generator options */ diff --git a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle b/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle index e17d1d8d7..544b6f8f0 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle +++ b/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle @@ -104,7 +104,7 @@ ext.createTest = { lang, name, models, options = [] -> runTask.doFirst { file("$workingDir/log").mkdirs() } - def convertTask = createEtUnitConverterTask("convert$testNameCap", etuFile, ['-suite', suiteName]) + def convertTask = createEtUnitConverterTask("convert$testNameCap", [etuFile], ['-suite', suiteName]) convertTask.dependsOn runTask check.dependsOn tasks.create(name: testName, dependsOn: convertTask, group: 'verification') diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle index 3105e15ff..f4a919d3e 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle @@ -43,7 +43,7 @@ task run(type: Exec, dependsOn: assemble, group: 'verification') { doFirst { file('log').mkdirs() } } -createEtUnitConverterTask('convert', etuFile) +createEtUnitConverterTask('convert', [etuFile]) convert.dependsOn run check.dependsOn convert \ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.cpp index 38ba09935..8f5d71694 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.cpp +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/debugging/DebuggingServiceTest.cpp @@ -13,6 +13,7 @@ #include "debugging/DebuggingServiceTest.h" #include "common/debugging/DebuggingService.h" #include "common/messaging/MessageService.h" +#include "common/messaging/MessageServiceController.h" #include "common/messaging/RTServices.h" #include "common/messaging/StaticMessageMemory.h" #include "etUnit/etUnit.h" @@ -22,10 +23,11 @@ using namespace etRuntime; void DebuggingServiceTest::testLogging() { + MessageServiceController& msgSvcCtrl = RTServices::getInstance().getMsgSvcCtrl(); MessageService msgSvc(NULL, IMessageService::BLOCKED, 0, 0, "TestMessageService", new StaticMessageMemory(NULL, "TestMemory", 64, 100)); - RTServices::getInstance().getMsgSvcCtrl().addMsgSvc(msgSvc); - RTServices::getInstance().getMsgSvcCtrl().start(); + msgSvcCtrl.addMsgSvc(msgSvc); + msgSvcCtrl.start(); SubSystemClass subSystem(NULL, "TestSubSystem"); ActorClass actor1(&subSystem, "TestActor1"); ActorClass actor2(&subSystem, "TestActor2"); @@ -59,7 +61,8 @@ void DebuggingServiceTest::testLogging() { dbgSvc.removePortInstance(port2); dbgSvc.getAsyncLogger().close(); - RTServices::getInstance().getMsgSvcCtrl().stop(); + msgSvcCtrl.stop(); + msgSvcCtrl.removeMsgSvc(msgSvc); const char* failMsg = "DebuggingServiceTest failed"; Vector& result = dbgSvc.getAsyncLogger().getCommandList(); diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageDispatcherTest.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageDispatcherTest.cpp index 0c04fd125..c59d7639e 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageDispatcherTest.cpp +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/MessageDispatcherTest.cpp @@ -15,6 +15,8 @@ #include "common/messaging/MessageDispatcher.h" #include "common/messaging/MessageService.h" #include "common/messaging/StaticMessageMemory.h" +#include "common/messaging/MessageServiceController.h" +#include "common/messaging/RTServices.h" using namespace etRuntime; @@ -70,8 +72,11 @@ void MessageDispatcherTest::testDispatching() { const char *failMsg = "MessageDispatcher dispatching test failed"; // Test dispatching Messages + MessageServiceController& msgSvcCtrl = RTServices::getInstance().getMsgSvcCtrl(); MessageService msgSvc(NULL, IMessageService::BLOCKED, 1, 2, "Test MessageService", new StaticMessageMemory(NULL, "TestMemory", 64, 100)); + msgSvcCtrl.addMsgSvc(msgSvc); + msgSvcCtrl.start(); MessageDispatcher msgDisp(&msgSvc, Address(1, 2, 0), "TestMessageDispatcher"); Address addr1 = msgDisp.getFreeAddress(); Address addr2 = msgDisp.getFreeAddress(); @@ -133,6 +138,8 @@ void MessageDispatcherTest::testDispatching() { msgDisp.removePollingMessageReceiver(recv1); msgDisp.removePollingMessageReceiver(recv2); msgDisp.removePollingMessageReceiver(recv3); + msgSvcCtrl.stop(); + msgSvcCtrl.removeMsgSvc(msgSvc); } void MessageDispatcherTest::runAllTestCases() { -- cgit v1.2.3 From 216b91e9103d80043239ecda7052fecb0999b085 Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Sun, 17 Sep 2017 17:00:32 +0200 Subject: cleaned up build Change-Id: If73690f1c77f6716758f60019c3d8886d899894f --- build.gradle | 4 - .../org.eclipse.etrice.feature/build_local.xml | 13 - ...g.eclipse.etrice.feature build_local.xml.launch | 15 - features/pom.xml | 3 +- gradle/etGenerator.gradle | 25 ++ gradle/etTest.gradle | 111 +++++++ gradle/etUnitConverter.gradle | 22 ++ gradle/publish.gradle | 27 ++ plugins/build.gradle | 29 -- .../buildEtUnitConverter.xml | 27 -- .../etUnitConverter.gradle | 24 -- .../export_c_generator.launch | 25 -- .../export_c_generator.xml | 109 ------- ...aunch standalone C-generator on modellib.launch | 7 - .../export_cpp_generator.launch | 25 -- .../export_cpp_generator.xml | 105 ------- ...nch standalone CPP-generator on modellib.launch | 7 - ...ch standalone Java-generator on modellib.launch | 7 - .../export_java_generator.launch | 25 -- .../export_java_generator.xml | 105 ------- .../etGenerator.gradle | 25 -- .../buckminster.cspex | 42 --- plugins/org.eclipse.etrice.ui.runtime/build.gradle | 31 ++ .../contents/org.eclipse.etrice.examples.c.zip | Bin 104131 -> 0 bytes .../contents/org.eclipse.etrice.examples.java.zip | Bin 210088 -> 0 bytes .../contents/org.eclipse.etrice.modellib.c.zip | Bin 194420 -> 0 bytes .../contents/org.eclipse.etrice.modellib.cpp.zip | Bin 15875 -> 0 bytes .../contents/org.eclipse.etrice.modellib.java.zip | Bin 47905 -> 0 bytes .../contents/org.eclipse.etrice.runtime.c.zip | Bin 200344 -> 0 bytes .../contents/org.eclipse.etrice.runtime.cpp.zip | Bin 87358 -> 0 bytes .../contents/org.eclipse.etrice.runtime.java.zip | Bin 70307 -> 0 bytes .../contents/org.eclipse.etrice.template.c.zip | Bin 12275 -> 0 bytes .../contents/org.eclipse.etrice.template.cpp.zip | Bin 14006 -> 0 bytes .../contents/org.eclipse.etrice.tutorials.c.zip | Bin 20906 -> 0 bytes .../contents/org.eclipse.etrice.tutorials.cpp.zip | Bin 22173 -> 0 bytes .../contents/org.eclipse.etrice.tutorials.java.zip | Bin 17881 -> 0 bytes plugins/org.eclipse.etrice.ui.runtime/pom.xml | 36 +++ plugins/pom.xml | 3 +- pom.xml | 3 +- releng/org.eclipse.etrice.parent/pom.xml | 4 +- releng/org.eclipse.etrice.parent/pom_old.xml | 344 +++++++++++++++++++++ releng/org.eclipse.etrice.site/category.xml | 4 +- releng/org.eclipse.etrice.site/feature.properties | 30 -- releng/org.eclipse.etrice.site/feature.xml | 45 --- releng/org.eclipse.etrice.site/pom.xml | 21 +- .../buckminster.cspec | 1 - runtime/org.eclipse.etrice.modellib.c/build.gradle | 2 +- .../doc-gen/images/ATimingService_behavior.jpg | Bin 22267 -> 0 bytes .../doc-gen/images/ATimingService_structure.jpg | Bin 15075 -> 0 bytes .../doc-gen/images/dot2jpg.bat | 0 .../doc-gen/readme.txt | 4 - .../doc-gen/room.basic.service.tcp.tex | 91 ------ .../doc-gen/room.basic.service.tcp/ATcpClient.tex | 76 ----- .../doc-gen/room.basic.service.tcp/ATcpServer.tex | 76 ----- .../doc-gen/room.basic.service.tcp/DTcpControl.tex | 13 - .../doc-gen/room.basic.service.tcp/DTcpPayload.tex | 35 --- .../doc-gen/room.basic.service.tcp/PTcpControl.tex | 24 -- .../doc-gen/room.basic.service.tcp/PTcpPayload.tex | 18 -- .../doc-gen/room.basic.service.timing.pdf | Bin 116055 -> 0 bytes .../doc-gen/room.basic.service.timing.tex | 85 ----- .../room.basic.service.timing/ATimingService.tex | 97 ------ .../doc-gen/room.basic.service.timing/PTimer.tex | 22 -- .../doc-gen/room.basic.types.pdf | Bin 45320 -> 0 bytes .../doc-gen/room.basic.types.tex | 80 ----- .../buckminster.cspec | 1 - .../org.eclipse.etrice.modellib.cpp/build.gradle | 2 +- .../buckminster.cspec | 2 - .../org.eclipse.etrice.modellib.java/build.gradle | 2 +- runtime/org.eclipse.etrice.modellib.java/pom.xml | 35 --- .../org.eclipse.etrice.runtime.c/buckminster.cspec | 1 - .../buckminster.cspec | 1 - .../buckminster.cspec | 1 - runtime/org.eclipse.etrice.runtime.java/pom.xml | 74 ----- .../org.eclipse.etrice.generator.c.tests/Makefile | 14 - .../buckminster.cspec | 10 - .../build.gradle | 2 +- .../org.eclipse.etrice.generator.c.tests/make.xml | 100 ------ ...clipse.etrice.generator.c.tests make.xml.launch | 42 --- .../buckminster.cspec | 1 - .../build.gradle | 2 +- .../common.xml | 217 ------------- .../etTest.gradle | 111 ------- .../Makefile | 16 - .../buckminster.cspec | 10 - .../build.gradle | 2 +- .../make.xml | 122 -------- ...ipse.etrice.generator.cpp.tests make.xml.launch | 36 --- .../buckminster.cspec | 10 - .../build.gradle | 2 +- .../make.xml | 129 -------- ...pse.etrice.generator.java.tests make.xml.launch | 42 --- tests/org.eclipse.etrice.runtime.c.tests/Makefile | 13 - .../buckminster.cspec | 10 - .../build.gradle | 2 +- tests/org.eclipse.etrice.runtime.c.tests/make.xml | 68 ---- ....eclipse.etrice.runtime.c.tests make.xml.launch | 41 --- .../org.eclipse.etrice.runtime.cpp.tests/Makefile | 14 - .../buckminster.cspec | 10 - .../build.gradle | 2 +- .../org.eclipse.etrice.runtime.cpp.tests/make.xml | 68 ---- ...clipse.etrice.runtime.cpp.tests make.xml.launch | 38 --- .../buckminster.cspec | 6 - tests/pom.xml | 3 +- 103 files changed, 623 insertions(+), 2566 deletions(-) delete mode 100644 features/org.eclipse.etrice.feature/build_local.xml delete mode 100644 features/org.eclipse.etrice.feature/org.eclipse.etrice.feature build_local.xml.launch create mode 100644 gradle/etGenerator.gradle create mode 100644 gradle/etTest.gradle create mode 100644 gradle/etUnitConverter.gradle create mode 100644 gradle/publish.gradle delete mode 100644 plugins/build.gradle delete mode 100644 plugins/org.eclipse.etrice.etunit.converter/buildEtUnitConverter.xml delete mode 100644 plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle delete mode 100644 plugins/org.eclipse.etrice.generator.c/export_c_generator.launch delete mode 100644 plugins/org.eclipse.etrice.generator.c/export_c_generator.xml delete mode 100644 plugins/org.eclipse.etrice.generator.c/launch standalone C-generator on modellib.launch delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/export_cpp_generator.launch delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/export_cpp_generator.xml delete mode 100644 plugins/org.eclipse.etrice.generator.cpp/launch standalone CPP-generator on modellib.launch delete mode 100644 plugins/org.eclipse.etrice.generator.gnuplot/launch standalone Java-generator on modellib.launch delete mode 100644 plugins/org.eclipse.etrice.generator.java/export_java_generator.launch delete mode 100644 plugins/org.eclipse.etrice.generator.java/export_java_generator.xml delete mode 100644 plugins/org.eclipse.etrice.generator/etGenerator.gradle delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/buckminster.cspex create mode 100644 plugins/org.eclipse.etrice.ui.runtime/build.gradle delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip delete mode 100644 plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip create mode 100644 plugins/org.eclipse.etrice.ui.runtime/pom.xml create mode 100644 releng/org.eclipse.etrice.parent/pom_old.xml delete mode 100644 releng/org.eclipse.etrice.site/feature.properties delete mode 100644 releng/org.eclipse.etrice.site/feature.xml delete mode 100644 runtime/org.eclipse.etrice.modellib.c/buckminster.cspec delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/images/ATimingService_behavior.jpg delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/images/ATimingService_structure.jpg delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/images/dot2jpg.bat delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/readme.txt delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/ATcpClient.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/ATcpServer.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/DTcpControl.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/DTcpPayload.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/PTcpControl.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/PTcpPayload.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing.pdf delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing/ATimingService.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing/PTimer.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.types.pdf delete mode 100644 runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.types.tex delete mode 100644 runtime/org.eclipse.etrice.modellib.cpp/buckminster.cspec delete mode 100644 runtime/org.eclipse.etrice.modellib.java/buckminster.cspec delete mode 100644 runtime/org.eclipse.etrice.modellib.java/pom.xml delete mode 100644 runtime/org.eclipse.etrice.runtime.c/buckminster.cspec delete mode 100644 runtime/org.eclipse.etrice.runtime.cpp/buckminster.cspec delete mode 100644 runtime/org.eclipse.etrice.runtime.java/buckminster.cspec delete mode 100644 runtime/org.eclipse.etrice.runtime.java/pom.xml delete mode 100644 tests/org.eclipse.etrice.generator.c.tests/Makefile delete mode 100644 tests/org.eclipse.etrice.generator.c.tests/buckminster.cspec delete mode 100644 tests/org.eclipse.etrice.generator.c.tests/make.xml delete mode 100644 tests/org.eclipse.etrice.generator.c.tests/org.eclipse.etrice.generator.c.tests make.xml.launch delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/buckminster.cspec delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/common.xml delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/etTest.gradle delete mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/Makefile delete mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/buckminster.cspec delete mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/make.xml delete mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/buckminster.cspec delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/make.xml delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/org.eclipse.etrice.generator.java.tests make.xml.launch delete mode 100644 tests/org.eclipse.etrice.runtime.c.tests/Makefile delete mode 100644 tests/org.eclipse.etrice.runtime.c.tests/buckminster.cspec delete mode 100644 tests/org.eclipse.etrice.runtime.c.tests/make.xml delete mode 100644 tests/org.eclipse.etrice.runtime.c.tests/org.eclipse.etrice.runtime.c.tests make.xml.launch delete mode 100644 tests/org.eclipse.etrice.runtime.cpp.tests/Makefile delete mode 100644 tests/org.eclipse.etrice.runtime.cpp.tests/buckminster.cspec delete mode 100644 tests/org.eclipse.etrice.runtime.cpp.tests/make.xml delete mode 100644 tests/org.eclipse.etrice.runtime.cpp.tests/org.eclipse.etrice.runtime.cpp.tests make.xml.launch delete mode 100644 tests/org.eclipse.etrice.runtime.java.tests/buckminster.cspec diff --git a/build.gradle b/build.gradle index ad62af5de..b52ba603f 100644 --- a/build.gradle +++ b/build.gradle @@ -3,10 +3,6 @@ ext { core_resources_version = '3.11.1' xtext_version = '2.12.0' commons_io_version = '2.5' - - etUnitConverter = "$rootDir/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle" - etGenerator = "$rootDir/plugins/org.eclipse.etrice.generator/etGenerator.gradle" - etTest = "$rootDir/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle" } allprojects { diff --git a/features/org.eclipse.etrice.feature/build_local.xml b/features/org.eclipse.etrice.feature/build_local.xml deleted file mode 100644 index 6d1758762..000000000 --- a/features/org.eclipse.etrice.feature/build_local.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/features/org.eclipse.etrice.feature/org.eclipse.etrice.feature build_local.xml.launch b/features/org.eclipse.etrice.feature/org.eclipse.etrice.feature build_local.xml.launch deleted file mode 100644 index d8fbfae19..000000000 --- a/features/org.eclipse.etrice.feature/org.eclipse.etrice.feature build_local.xml.launch +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/features/pom.xml b/features/pom.xml index 70f4af747..01951fa06 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -6,11 +6,10 @@ org.eclipse.etrice org.eclipse.etrice.parent - 1.0.0-SNAPSHOT + 1.1.1-SNAPSHOT ../releng/org.eclipse.etrice.parent org.eclipse.etrice org.eclipse.etrice.features - 1.0.0-SNAPSHOT pom \ No newline at end of file diff --git a/gradle/etGenerator.gradle b/gradle/etGenerator.gradle new file mode 100644 index 000000000..399088d2f --- /dev/null +++ b/gradle/etGenerator.gradle @@ -0,0 +1,25 @@ + +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.c') +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.cpp') +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.java') + +/** + * Creates an eTrice generator task + * @param name: The name of the new task + * @param models: A list of models passed to the generator + * @param genDir: The generation directory + * @param options: The eTrice generator options + */ +ext.createGeneratorTask = { name, lang, models, genDir = 'src-gen', options = [] -> + def generator = ":plugins:org.eclipse.etrice.generator.$lang" + + return tasks.create(name: name, type: JavaExec, dependsOn: "$generator:classes") { + main = project(generator).mainClassName + classpath = project(generator).sourceSets.main.runtimeClasspath + args '-msc_instr', '-genDir', genDir + args options + args models + inputs.files models + outputs.dir genDir + } +} \ No newline at end of file diff --git a/gradle/etTest.gradle b/gradle/etTest.gradle new file mode 100644 index 000000000..2112b083f --- /dev/null +++ b/gradle/etTest.gradle @@ -0,0 +1,111 @@ +import static org.apache.tools.ant.taskdefs.condition.Os.* + +apply from: "$rootDir/gradle/etGenerator.gradle" +apply from: "$rootDir/gradle/etUnitConverter.gradle" + +def outputDir = 'log' +def srcGenDir = 'src-gen' + +clean.delete srcGenDir, outputDir + +def getMainClass(String genDir) { + // search for SubSystemRunner java file + def mainFile = fileTree(genDir, { include '**/*Runner.java' }).getSingleFile() + // relativize path to generation directory + def relPath = file(genDir).toPath().relativize(mainFile.toPath()).normalize().toString() + // remove '.java' at the end + def path = relPath.substring(0, relPath.length() - 5) + // replace all separators with '.' + def mainClass = path.replace(File.separatorChar, '.' as char) + return mainClass +} + +/** + * Creates all needed tasks for one test execution + * @param lang: The eTrice generator type ('c', 'cpp', 'java') + * @param name: The test name starting with a lower case letter + * @param models: Models that are passed to the eTrice generator + * @param options: Options that are passed to the eTrice generator + */ +ext.createTest = { lang, name, models, options = [] -> + + def nameCap = name.capitalize() + def langCap = lang.capitalize() + def testName = "$name$langCap" + def testNameCap = testName.capitalize() + def suiteName = "${project.name}.$testNameCap" + def genDir = "$srcGenDir/$testName" + def workingDir = "$outputDir/$testName" + def etuFile = "$workingDir/log/${nameCap}.etu" + + def generateTask = createGeneratorTask("generate$testNameCap", lang, models, genDir, options) + generateTask.environment 'etModellib', "org.eclipse.etrice.modellib.$lang" + + def runTask + + if(lang == 'c' || lang == 'cpp') { + model { + components { + "$testName"(NativeExecutableSpec) { + sources."$lang" { + builtBy generateTask + source { + srcDirs = [genDir] + include "**/*.$lang" + } + exportedHeaders { + srcDirs = [genDir] + } + lib project: ":runtime:org.eclipse.etrice.modellib.$lang", library: "etrice_modellib_$lang", linkage: 'static' + if(lang == 'cpp') lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' + } + binaries.all { + cCompiler.args '-g3' + cppCompiler.args '-g3' + if(isFamily(FAMILY_UNIX)) { linker.args '-lpthread', '-lrt', '-lm' } + } + } + } + } + + def exeFile = "$buildDir/exe/$testName/$testName" + runTask = tasks.create(name: "run$testNameCap", type: Exec) { + dependsOn "${testName}Executable" + commandLine exeFile, '-run_as_test' + inputs.file exeFile + outputs.file etuFile + it.workingDir = workingDir + } + } + + else if(lang == 'java') { + def testSourceSet = sourceSets.create(name) { + java.srcDirs = [genDir] + } + + dependencies { + add "${name}Compile", project(':runtime:org.eclipse.etrice.modellib.java') + add "${name}Compile", project(':runtime:org.eclipse.etrice.runtime.java') + } + + tasks.getByName("compile${nameCap}Java").dependsOn generateTask + + runTask = tasks.create(name: "run$testNameCap", type: JavaExec) { + dependsOn "${name}Classes" + classpath = testSourceSet.runtimeClasspath + args '-run_as_test' + outputs.file etuFile + it.workingDir = workingDir + + doFirst { main = getMainClass(genDir) } + } + } + + runTask.doFirst { file("$workingDir/log").mkdirs() } + + def convertTask = createEtUnitConverterTask("convert$testNameCap", [etuFile], ['-suite', suiteName]) + convertTask.dependsOn runTask + + check.dependsOn tasks.create(name: testName, dependsOn: convertTask, group: 'verification') +} diff --git a/gradle/etUnitConverter.gradle b/gradle/etUnitConverter.gradle new file mode 100644 index 000000000..cd1369bde --- /dev/null +++ b/gradle/etUnitConverter.gradle @@ -0,0 +1,22 @@ + +def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' +evaluationDependsOn(etUnitConverter) + +/** + * Creates a tasks that converts etu files to xml files + * @param name: The name of the new task + * @param etuFiles: A list of etu files + * @param options: The options passed to the converter + */ +ext.createEtUnitConverterTask = { name, etuFiles, options = [] -> + def xmlFiles = etuFiles.collect { it.replace('.etu', '.xml') } + + return tasks.create(name: name, type: JavaExec, dependsOn: "$etUnitConverter:classes") { + main = project(etUnitConverter).mainClassName + classpath = project(etUnitConverter).sourceSets.main.runtimeClasspath + args options + args etuFiles + inputs.files etuFiles + outputs.files xmlFiles + } +} \ No newline at end of file diff --git a/gradle/publish.gradle b/gradle/publish.gradle new file mode 100644 index 000000000..1bcf65198 --- /dev/null +++ b/gradle/publish.gradle @@ -0,0 +1,27 @@ +apply plugin: 'maven-publish' + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + repositories { + maven { + name 'snapshots' + url 'https://repo.eclipse.org/content/repositories/etrice-snapshots' + credentials { + username project.properties.eclipseRepoUsername + password project.properties.eclipseRepoPassword + } + } + maven { + name 'releases' + url 'https://repo.eclipse.org/content/repositories/etrice-releases' + credentials { + username project.properties.eclipseRepoUsername + password project.properties.eclipseRepoPassword + } + } + } +} \ No newline at end of file diff --git a/plugins/build.gradle b/plugins/build.gradle deleted file mode 100644 index 8eea3b54b..000000000 --- a/plugins/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -subprojects { - apply plugin: 'maven-publish' - - publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } - repositories { - maven { - name 'snapshots' - url 'https://repo.eclipse.org/content/repositories/etrice-snapshots' - credentials { - username project.properties.eclipseRepoUsername - password project.properties.eclipseRepoPassword - } - } - maven { - name 'releases' - url 'https://repo.eclipse.org/content/repositories/etrice-releases' - credentials { - username project.properties.eclipseRepoUsername - password project.properties.eclipseRepoPassword - } - } - } - } -} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.etunit.converter/buildEtUnitConverter.xml b/plugins/org.eclipse.etrice.etunit.converter/buildEtUnitConverter.xml deleted file mode 100644 index 08a01f0f5..000000000 --- a/plugins/org.eclipse.etrice.etunit.converter/buildEtUnitConverter.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle deleted file mode 100644 index 0c38bedbc..000000000 --- a/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle +++ /dev/null @@ -1,24 +0,0 @@ - -def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' -evaluationDependsOn(etUnitConverter) - -/** - * Creates a tasks that converts etu files to xml files - * @param name: The name of the new task - * @param etuFiles: A list of etu files - * @param options: The options passed to the converter - */ -ext.createEtUnitConverterTask = { name, etuFiles, options = [] -> - def xmlFiles = etuFiles.collect { it.replace('.etu', '.xml') } - - return tasks.create(name: name, type: JavaExec, dependsOn: "$etUnitConverter:classes") { - main = project(etUnitConverter).mainClassName - classpath = project(etUnitConverter).sourceSets.main.runtimeClasspath - args options - args etuFiles - inputs.files etuFiles - outputs.files xmlFiles - inputs.files.each { println it } - outputs.files.each { println it } - } -} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.c/export_c_generator.launch b/plugins/org.eclipse.etrice.generator.c/export_c_generator.launch deleted file mode 100644 index 682c81bc4..000000000 --- a/plugins/org.eclipse.etrice.generator.c/export_c_generator.launch +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/org.eclipse.etrice.generator.c/export_c_generator.xml b/plugins/org.eclipse.etrice.generator.c/export_c_generator.xml deleted file mode 100644 index 8fda95f52..000000000 --- a/plugins/org.eclipse.etrice.generator.c/export_c_generator.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/org.eclipse.etrice.generator.c/launch standalone C-generator on modellib.launch b/plugins/org.eclipse.etrice.generator.c/launch standalone C-generator on modellib.launch deleted file mode 100644 index 4e4d32119..000000000 --- a/plugins/org.eclipse.etrice.generator.c/launch standalone C-generator on modellib.launch +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/plugins/org.eclipse.etrice.generator.cpp/export_cpp_generator.launch b/plugins/org.eclipse.etrice.generator.cpp/export_cpp_generator.launch deleted file mode 100644 index 8b56bff81..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/export_cpp_generator.launch +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/org.eclipse.etrice.generator.cpp/export_cpp_generator.xml b/plugins/org.eclipse.etrice.generator.cpp/export_cpp_generator.xml deleted file mode 100644 index ca070d72c..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/export_cpp_generator.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/org.eclipse.etrice.generator.cpp/launch standalone CPP-generator on modellib.launch b/plugins/org.eclipse.etrice.generator.cpp/launch standalone CPP-generator on modellib.launch deleted file mode 100644 index 891d8c8d3..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/launch standalone CPP-generator on modellib.launch +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/plugins/org.eclipse.etrice.generator.gnuplot/launch standalone Java-generator on modellib.launch b/plugins/org.eclipse.etrice.generator.gnuplot/launch standalone Java-generator on modellib.launch deleted file mode 100644 index 2f5a00f4c..000000000 --- a/plugins/org.eclipse.etrice.generator.gnuplot/launch standalone Java-generator on modellib.launch +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/plugins/org.eclipse.etrice.generator.java/export_java_generator.launch b/plugins/org.eclipse.etrice.generator.java/export_java_generator.launch deleted file mode 100644 index 40a551039..000000000 --- a/plugins/org.eclipse.etrice.generator.java/export_java_generator.launch +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/org.eclipse.etrice.generator.java/export_java_generator.xml b/plugins/org.eclipse.etrice.generator.java/export_java_generator.xml deleted file mode 100644 index cf80a1b26..000000000 --- a/plugins/org.eclipse.etrice.generator.java/export_java_generator.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/org.eclipse.etrice.generator/etGenerator.gradle b/plugins/org.eclipse.etrice.generator/etGenerator.gradle deleted file mode 100644 index 399088d2f..000000000 --- a/plugins/org.eclipse.etrice.generator/etGenerator.gradle +++ /dev/null @@ -1,25 +0,0 @@ - -evaluationDependsOn(':plugins:org.eclipse.etrice.generator.c') -evaluationDependsOn(':plugins:org.eclipse.etrice.generator.cpp') -evaluationDependsOn(':plugins:org.eclipse.etrice.generator.java') - -/** - * Creates an eTrice generator task - * @param name: The name of the new task - * @param models: A list of models passed to the generator - * @param genDir: The generation directory - * @param options: The eTrice generator options - */ -ext.createGeneratorTask = { name, lang, models, genDir = 'src-gen', options = [] -> - def generator = ":plugins:org.eclipse.etrice.generator.$lang" - - return tasks.create(name: name, type: JavaExec, dependsOn: "$generator:classes") { - main = project(generator).mainClassName - classpath = project(generator).sourceSets.main.runtimeClasspath - args '-msc_instr', '-genDir', genDir - args options - args models - inputs.files models - outputs.dir genDir - } -} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.ui.runtime/buckminster.cspex b/plugins/org.eclipse.etrice.ui.runtime/buckminster.cspex deleted file mode 100644 index ec40e4849..000000000 --- a/plugins/org.eclipse.etrice.ui.runtime/buckminster.cspex +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/org.eclipse.etrice.ui.runtime/build.gradle b/plugins/org.eclipse.etrice.ui.runtime/build.gradle new file mode 100644 index 000000000..91ceac59a --- /dev/null +++ b/plugins/org.eclipse.etrice.ui.runtime/build.gradle @@ -0,0 +1,31 @@ +!!!! This script is currently not in use, see maven pom instead !!!! + +plugins { + id 'base' +} + +def projects = [ + 'org.eclipse.etrice.runtime.c': '../../runtime', + 'org.eclipse.etrice.modellib.c': '../../runtime', + 'org.eclipse.etrice.tutorials.c': '../../examples', + 'org.eclipse.etrice.examples.c': '../../examples', + 'org.eclipse.etrice.template.c': '../../examples', + + 'org.eclipse.etrice.runtime.cpp': '../../runtime', + 'org.eclipse.etrice.modellib.cpp': '../../runtime', + 'org.eclipse.etrice.tutorials.cpp': '../../examples', + 'org.eclipse.etrice.template.cpp': '../../examples', + + 'org.eclipse.etrice.runtime.java': '../../runtime', + 'org.eclipse.etrice.modellib.java': '../../runtime', + 'org.eclipse.etrice.tutorials.java': '../../examples', + 'org.eclipse.etrice.examples.java': '../../examples' +] + +projects.each { name, path -> + build.dependsOn tasks.create(name: "zip_$name", type: Zip) { + destinationDir = file('contents') + archiveName = "${name}.zip" + from "$path/$name" + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip deleted file mode 100644 index 3ecace8a9..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip deleted file mode 100644 index acc143640..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip deleted file mode 100644 index 01b556e8a..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip deleted file mode 100644 index cd2962219..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip deleted file mode 100644 index 5df63c0f7..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip deleted file mode 100644 index 1914fe307..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip deleted file mode 100644 index 32cf6d8f7..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip deleted file mode 100644 index db59e9965..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip deleted file mode 100644 index 24536ada3..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip deleted file mode 100644 index 79db259db..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip deleted file mode 100644 index 56e9239e0..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip deleted file mode 100644 index bad2140fb..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip deleted file mode 100644 index a86dfd48d..000000000 Binary files a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip and /dev/null differ diff --git a/plugins/org.eclipse.etrice.ui.runtime/pom.xml b/plugins/org.eclipse.etrice.ui.runtime/pom.xml new file mode 100644 index 000000000..b4f90a7bf --- /dev/null +++ b/plugins/org.eclipse.etrice.ui.runtime/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + org.eclipse.etrice + org.eclipse.etrice.parent + 1.1.1-SNAPSHOT + ../../releng/org.eclipse.etrice.parent/pom.xml + + org.eclipse.etrice + org.eclipse.etrice.ui.runtime + eclipse-plugin + + + + + maven-antrun-plugin + 1.8 + + + generate-resources + + + + + + + run + + + + + + + diff --git a/plugins/pom.xml b/plugins/pom.xml index cd18cfb23..c76bced7b 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -6,11 +6,10 @@ org.eclipse.etrice org.eclipse.etrice.parent - 1.0.0-SNAPSHOT + 1.1.1-SNAPSHOT ../releng/org.eclipse.etrice.parent org.eclipse.etrice org.eclipse.etrice.plugins - 1.0.0-SNAPSHOT pom \ No newline at end of file diff --git a/pom.xml b/pom.xml index 85fcdaf0f..2390c681b 100644 --- a/pom.xml +++ b/pom.xml @@ -7,13 +7,12 @@ org.eclipse.etrice org.eclipse.etrice.parent - 1.0.0-SNAPSHOT + 1.1.1-SNAPSHOT releng/org.eclipse.etrice.parent org.eclipse.etrice org.eclipse.etrice - 1.0.0-SNAPSHOT pom diff --git a/releng/org.eclipse.etrice.parent/pom.xml b/releng/org.eclipse.etrice.parent/pom.xml index 7b5e74df8..088c469c5 100644 --- a/releng/org.eclipse.etrice.parent/pom.xml +++ b/releng/org.eclipse.etrice.parent/pom.xml @@ -5,13 +5,13 @@ 4.0.0 org.eclipse.etrice org.eclipse.etrice.parent - 1.0.0-SNAPSHOT + 1.1.1-SNAPSHOT pom Cp1252 - 2.10.0 + 2.12.0 1.0.0 1.1.4 diff --git a/releng/org.eclipse.etrice.parent/pom_old.xml b/releng/org.eclipse.etrice.parent/pom_old.xml new file mode 100644 index 000000000..1eb825362 --- /dev/null +++ b/releng/org.eclipse.etrice.parent/pom_old.xml @@ -0,0 +1,344 @@ + + + 4.0.0 + + org.eclipse.etrice + java-generator + 1.1.1-SNAPSHOT + pom + + eTrice Java generator + + code generator from ROOM (Real-Time Object Oriented Modeling) + models to the Java target language + http://eclipse.org/etrice + 2010 + + + Cp1252 + + ${project.version} + + 0.19.0 + ${tycho.version} + + + http://download.eclipse.org/releases/luna + + http://download.eclipse.org/tools/orbit/downloads/drops/R20130118183705/repository + + + + Protos Software GmbH + http://www.protos.de + + + + + Eclipse Public License - v 1.0 + http://www.eclipse.org/legal/epl-v10.html + + + + + Bugzilla + https://bugs.eclipse.org/bugs/enter_bug.cgi?product=eTrice + + + + Hudson + https://hudson.eclipse.org/etrice/job/etrice-maven3/ + + + + http://git.eclipse.org/c/etrice/org.eclipse.etrice.git/ + http://git.eclipse.org/gitroot/etrice/org.eclipse.etrice.git + ssh://userid@git.eclipse.org/gitroot/etrice/org.eclipse.etrice.git + + + + + Thomas Schuetz + + + Henrik Rentz-Reichert + + + Thomas Jung + + + Juergen Haug + + + Eyrak Paen + + + Peter Karlitschek + + + + + + eclipse + p2 + ${eclipse-repo.url} + + + orbit + p2 + ${orbit-site} + + + repository.jboss.org-public + JBoss.org Maven repository + https://repository.jboss.org/nexus/content/groups/public + + + + + + repo.eclipse.org.cbi-releases + https://repo.eclipse.org/content/repositories/cbi-releases/ + + + + + ../../plugins/org.eclipse.etrice.core.common + ../../plugins/org.eclipse.etrice.core.fsm + ../../plugins/org.eclipse.etrice.core.room + ../../plugins/org.eclipse.etrice.core.config + ../../plugins/org.eclipse.etrice.core.etphys + ../../plugins/org.eclipse.etrice.core.etmap + ../../plugins/org.eclipse.etrice.core.genmodel.fsm + ../../plugins/org.eclipse.etrice.core.genmodel + ../../plugins/org.eclipse.etrice.generator.fsm + ../../plugins/org.eclipse.etrice.generator + ../../plugins/org.eclipse.etrice.generator.config + ../../plugins/org.eclipse.etrice.generator.doc + ../../plugins/org.eclipse.etrice.generator.java + ../../plugins/org.eclipse.etrice.generator.java.mvn + ../../runtime/org.eclipse.etrice.modellib.java + ../../runtime/org.eclipse.etrice.runtime.java + + + + + fast + + true + + + + full + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + + generated + a + Generated: + + + ordered + X + Ordered: + + + model + X + Model: + + + parameter + X + Parameter: + + + + + + attach-javadocs + + jar + + + + + + + + + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho.version} + true + + + + + + maven-compiler-plugin + 3.1 + + 1.6 + 1.6 + + + + org.eclipse.tycho + target-platform-configuration + ${tycho.version} + + + org.eclipse.tycho + tycho-compiler-plugin + ${tycho.version} + + + + **/*.ecore + + + + ISO-8859-1 + + + + + org.eclipse.tycho + tycho-packaging-plugin + ${tycho.version} + + + org.eclipse.tycho.extras + tycho-buildtimestamp-jgit + ${tycho-extras.version} + + + + false + 'v'yyyyMMdd-HHmm + jgit + + + + + + org.eclipse.tycho + tycho-p2-director-plugin + ${tycho.version} + + + org.eclipse.tycho + tycho-p2-repository-plugin + ${tycho.version} + + + org.eclipse.tycho + tycho-p2-plugin + ${tycho.version} + + warn + none + + + http://download.eclipse.org/eclipse/updates/4.2 + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.eclipse.tycho + + + tycho-packaging-plugin + + + [0.19.0,) + + + validate-id + validate-version + build-qualifier + + + + + + + + + + org.eclipse.tycho + + + tycho-compiler-plugin + + + [0.19.0,) + + + compile + + + + + + + + + + + + + + + + + repo.eclipse.org + eTrice Repository - Releases + https://repo.eclipse.org/content/repositories/etrice-releases/ + + + repo.eclipse.org + eTrice Repository - Snapshots + https://repo.eclipse.org/content/repositories/etrice-snapshots/ + true + + + diff --git a/releng/org.eclipse.etrice.site/category.xml b/releng/org.eclipse.etrice.site/category.xml index b09fe076d..134e911aa 100644 --- a/releng/org.eclipse.etrice.site/category.xml +++ b/releng/org.eclipse.etrice.site/category.xml @@ -1,9 +1,9 @@ - + - + diff --git a/releng/org.eclipse.etrice.site/feature.properties b/releng/org.eclipse.etrice.site/feature.properties deleted file mode 100644 index fcf39670f..000000000 --- a/releng/org.eclipse.etrice.site/feature.properties +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2010 - 2011 Protos Software GmbH. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Thomas Schuetz and Henrik Rentz-Reichert - initial API and implementation - -# NLS_MESSAGEFORMAT_VAR - -# ============================================================================== -# Do not change the properties between this line and the last line containing: -# %%% END OF TRANSLATED PROPERTIES %%% -# Instead, either redefine an existing property, or create a new property, -# append it to the end of the file, and change the code to use the new name. -# ============================================================================== - -providerName = Eclipse eTrice -featureName = eTrice Site -description = eTrice modeling tools for event driven real-time systems based on the modeling language ROOM - -# Label for the update site (on download1.eclipse.org) -updateSiteName=Eclipse Modeling Project Updates - - -# ============================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# The above properties have been shipped for translation. -# ============================================================================== diff --git a/releng/org.eclipse.etrice.site/feature.xml b/releng/org.eclipse.etrice.site/feature.xml deleted file mode 100644 index 1d2897daf..000000000 --- a/releng/org.eclipse.etrice.site/feature.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - %description - - - - (c) 2010 - 2011 Protos Software GmbH. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Eclipse Public License -v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/epl-v10.html - - - - - - - - - - - - diff --git a/releng/org.eclipse.etrice.site/pom.xml b/releng/org.eclipse.etrice.site/pom.xml index 77bcbfd22..078dc6cb5 100644 --- a/releng/org.eclipse.etrice.site/pom.xml +++ b/releng/org.eclipse.etrice.site/pom.xml @@ -1,15 +1,14 @@ - 4.0.0 - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + 4.0.0 + + org.eclipse.etrice + org.eclipse.etrice.parent + 1.1.1-SNAPSHOT + ../../releng/org.eclipse.etrice.parent/pom.xml + org.eclipse.etrice - org.eclipse.etrice.parent - 1.0.0-SNAPSHOT - ../../releng/org.eclipse.etrice.parent/pom.xml - - org.eclipse.etrice - org.eclipse.etrice.site - 1.0.0-SNAPSHOT - eclipse-repository + org.eclipse.etrice.site + eclipse-repository diff --git a/runtime/org.eclipse.etrice.modellib.c/buckminster.cspec b/runtime/org.eclipse.etrice.modellib.c/buckminster.cspec deleted file mode 100644 index 6449d924a..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/buckminster.cspec +++ /dev/null @@ -1 +0,0 @@ - diff --git a/runtime/org.eclipse.etrice.modellib.c/build.gradle b/runtime/org.eclipse.etrice.modellib.c/build.gradle index f11e40692..255601442 100644 --- a/runtime/org.eclipse.etrice.modellib.c/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.c/build.gradle @@ -2,7 +2,7 @@ plugins { id 'c' } -apply from: etGenerator +apply from: "$rootDir/gradle/etGenerator.gradle" def models = [ 'model/PInterrupt.room', diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/images/ATimingService_behavior.jpg b/runtime/org.eclipse.etrice.modellib.c/doc-gen/images/ATimingService_behavior.jpg deleted file mode 100644 index 5599e352e..000000000 Binary files a/runtime/org.eclipse.etrice.modellib.c/doc-gen/images/ATimingService_behavior.jpg and /dev/null differ diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/images/ATimingService_structure.jpg b/runtime/org.eclipse.etrice.modellib.c/doc-gen/images/ATimingService_structure.jpg deleted file mode 100644 index d2ea00fa1..000000000 Binary files a/runtime/org.eclipse.etrice.modellib.c/doc-gen/images/ATimingService_structure.jpg and /dev/null differ diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/images/dot2jpg.bat b/runtime/org.eclipse.etrice.modellib.c/doc-gen/images/dot2jpg.bat deleted file mode 100644 index e69de29bb..000000000 diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.c/doc-gen/readme.txt deleted file mode 100644 index 1dc2b35ab..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory is an eTrice code generation target. -It will be erased every time the generator is executed. - -DO NOT PLACE OTHER FILES HERE! diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp.tex deleted file mode 100644 index ad3903f17..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp.tex +++ /dev/null @@ -1,91 +0,0 @@ -\documentclass[titlepage]{article} -\usepackage{import} -\usepackage{graphicx} -\usepackage{xr} -\usepackage{hyperref} -\IfFileExists{../doc/userinputs.tex}{\subimport{../doc/}{userinputs.tex}}{} %hook for conditional user-specific inputs, includes, macros, ... -\usepackage[a4paper,text={160mm,255mm},centering,headsep=5mm,footskip=10mm]{geometry} -\usepackage{nonfloat} -\parindent 0pt -\makeatletter -\newcommand\level[1]{% - \ifcase#1\relax\expandafter\chapter\or - \expandafter\section\or - \expandafter\subsection\or - \expandafter\subsubsection\else - \def\next{\@level{#1}}\expandafter\next - \fi} - -\newcommand{\@level}[1]{% -\@startsection{level#1} - {#1} - {\z@}% - {-3.25ex\@plus -1ex \@minus -.2ex}% - {1.5ex \@plus .2ex}% - {\normalfont\normalsize\bfseries}} - -\newdimen\@leveldim - \newdimen\@dotsdim - {\normalfont\normalsize - \sbox\z@{0}\global\@leveldim=\wd\z@ - \sbox\z@{.}\global\@dotsdim=\wd\z@ - } -\newcounter{level4}[subsubsection] - \@namedef{thelevel4}{\thesubsubsection.\arabic{level4}} - \@namedef{level4mark}#1{} - \def\l@section{\@dottedtocline{1}{0pt}{\dimexpr\@leveldim*4+\@dotsdim*1+6pt\relax}} - \def\l@subsection{\@dottedtocline{2}{0pt}{\dimexpr\@leveldim*5+\@dotsdim*2+6pt\relax}} - \def\l@subsubsection{\@dottedtocline{3}{0pt}{\dimexpr\@leveldim*6+\@dotsdim*3+6pt\relax}} - \@namedef{l@level4}{\@dottedtocline{4}{0pt}{\dimexpr\@leveldim*7+\@dotsdim*4+6pt\relax}} - -\count@=4 - \def\@ncp#1{\number\numexpr\count@+#1\relax} - \loop\ifnum\count@<100 - \begingroup\edef\x{\endgroup - \noexpand\newcounter{level\@ncp{1}}[level\number\count@] - \noexpand\@namedef{thelevel\@ncp{1}}{% - \noexpand\@nameuse{thelevel\@ncp{0}}.\noexpand\arabic{level\@ncp{0}}} - \noexpand\@namedef{level\@ncp{1}mark}####1{}% - \noexpand\@namedef{l@level\@ncp{1}}% - {\noexpand\@dottedtocline{\@ncp{1}}{0pt}{\the\dimexpr\@leveldim*\@ncp{5}+\@dotsdim*\@ncp{0}\relax}}}% - \x - \advance\count@\@ne - \repeat - \makeatother - \setcounter{secnumdepth}{100} - \setcounter{tocdepth}{100} - - -\title{room.basic.service.tcp Model Documentation} -\date{\today} -\author{generated by eTrice} - -\begin{document} - -\pagestyle{plain} -\maketitle -\tableofcontents - -\newpage -\listoffigures -\newpage -\section{Model Description} - - - - -\section{Protocol Classes} -\subimport*{room.basic.service.tcp/}{PTcpControl.tex} -\subimport*{room.basic.service.tcp/}{PTcpPayload.tex} -\newpage - - -\section{Data Classes} -\subimport*{room.basic.service.tcp/}{DTcpControl.tex} -\subimport*{room.basic.service.tcp/}{DTcpPayload.tex} -\newpage - -\section{Actor Classes} -\subimport*{room.basic.service.tcp/}{ATcpServer.tex} -\subimport*{room.basic.service.tcp/}{ATcpClient.tex} -\end{document} diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/ATcpClient.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/ATcpClient.tex deleted file mode 100644 index cabf2e955..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/ATcpClient.tex +++ /dev/null @@ -1,76 +0,0 @@ -\level{2}{ATcpClient} - - -\level{3}{Ports} -\begin{tabular}[ht]{|l|l|l|l|l|p{5cm}|} -\hline -\textbf{Name} & \textbf{Protocol} & \textbf{Type} & \textbf{Kind} & \textbf{Multiplicity} & \textbf{Description}\\ -\hline -controlPort & PTcpControl & reg. & external & 1 & \\ -\hline -payloadPort & PTcpPayload & reg. & external & 1 & \\ -\hline -\end{tabular} - -\level{3}{Behavior} -\level{4}{Top Level} - -\begin{par} - -\end{par} - - -\level{3}{Attributes} -\begin{tabular}[ht]{|l|l|p{8cm}|} -\hline -\textbf{Name} & \textbf{Type} & \textbf{Description}\\ -\hline -lastError & int32 & \\ -\hline -payload & DTcpPayload & \\ -\hline -client & etSocketConnectionData & \\ -\hline -\end{tabular} - -\level{3}{Operations} -\begin{tabular}[ht]{|l|l|} -\hline - Name: & ATcpClient\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & \\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & ATcpClient\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & \\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & hasError\\ - \hline - ReturnType: & boolean\\ - \hline - Arguments: & \\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & setErrorCode\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & value:int32\\ - \hline -\end{tabular} -\newline\newline\newline diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/ATcpServer.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/ATcpServer.tex deleted file mode 100644 index 076c42260..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/ATcpServer.tex +++ /dev/null @@ -1,76 +0,0 @@ -\level{2}{ATcpServer} - - -\level{3}{Ports} -\begin{tabular}[ht]{|l|l|l|l|l|p{5cm}|} -\hline -\textbf{Name} & \textbf{Protocol} & \textbf{Type} & \textbf{Kind} & \textbf{Multiplicity} & \textbf{Description}\\ -\hline -controlPort & PTcpControl & reg. & external & 1 & \\ -\hline -payloadPort & PTcpPayload & reg. & external & 1 & \\ -\hline -\end{tabular} - -\level{3}{Behavior} -\level{4}{Top Level} - -\begin{par} - -\end{par} - - -\level{3}{Attributes} -\begin{tabular}[ht]{|l|l|p{8cm}|} -\hline -\textbf{Name} & \textbf{Type} & \textbf{Description}\\ -\hline -lastError & int32 & \\ -\hline -payloadPortReplocation & int32 & \\ -\hline -server & etSocketServerData & \\ -\hline -\end{tabular} - -\level{3}{Operations} -\begin{tabular}[ht]{|l|l|} -\hline - Name: & ATcpServer\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & \\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & ATcpServer\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & \\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & hasError\\ - \hline - ReturnType: & boolean\\ - \hline - Arguments: & \\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & setErrorCode\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & value:int32\\ - \hline -\end{tabular} -\newline\newline\newline diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/DTcpControl.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/DTcpControl.tex deleted file mode 100644 index f15d98420..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/DTcpControl.tex +++ /dev/null @@ -1,13 +0,0 @@ -\level{2} {DTcpControl} -\level{3}{Attributes} -\begin{tabular}[ht]{|l|l|p{8cm}|} -\hline -\textbf{Name} & \textbf{Type} & \textbf{Description}\\ -\hline -IPAddr & string & \\ -\hline -TcpPort & int32 & \\ -\hline -\end{tabular} - -\level{3}{Operations} diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/DTcpPayload.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/DTcpPayload.tex deleted file mode 100644 index fd80f9c2c..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/DTcpPayload.tex +++ /dev/null @@ -1,35 +0,0 @@ -\level{2} {DTcpPayload} -\level{3}{Attributes} -\begin{tabular}[ht]{|l|l|p{8cm}|} -\hline -\textbf{Name} & \textbf{Type} & \textbf{Description}\\ -\hline -connectionId & int32 & \\ -\hline -length & int32 & \\ -\hline -data & int8 & \\ -\hline -\end{tabular} - -\level{3}{Operations} -\begin{tabular}[ht]{|l|l|} -\hline - Name: & setAsString\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & value:charPtr\\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & getAsString\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & value:charPtr\\ - \hline -\end{tabular} -\newline\newline\newline diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/PTcpControl.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/PTcpControl.tex deleted file mode 100644 index d6f4ed000..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/PTcpControl.tex +++ /dev/null @@ -1,24 +0,0 @@ -\level{2} {PTcpControl} -\level{3}{Incoming Messages} - -\begin{tabular}[ht]{|l|l|l|p{8cm}|} -\hline -Message & Data & Type & Description\\ -\hline -connect & data & DTcpControl & \\ -\hline -disconnect & & & \\ -\hline -\end{tabular} -\level{3}{Outgoing Messages} -\begin{tabular}[ht]{|l|l|l|p{8cm}|} -\hline -Message & Data & Type & Description\\ -\hline -connected & & & \\ -\hline -disconnected & & & \\ -\hline -error & & & \\ -\hline -\end{tabular} diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/PTcpPayload.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/PTcpPayload.tex deleted file mode 100644 index 4c4931872..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.tcp/PTcpPayload.tex +++ /dev/null @@ -1,18 +0,0 @@ -\level{2} {PTcpPayload} -\level{3}{Incoming Messages} - -\begin{tabular}[ht]{|l|l|l|p{8cm}|} -\hline -Message & Data & Type & Description\\ -\hline -dataPackage & data & DTcpPayload & \\ -\hline -\end{tabular} -\level{3}{Outgoing Messages} -\begin{tabular}[ht]{|l|l|l|p{8cm}|} -\hline -Message & Data & Type & Description\\ -\hline -dataPackage & data & DTcpPayload & \\ -\hline -\end{tabular} diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing.pdf b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing.pdf deleted file mode 100644 index fb9df2de3..000000000 Binary files a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing.pdf and /dev/null differ diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing.tex deleted file mode 100644 index fcda0bc46..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing.tex +++ /dev/null @@ -1,85 +0,0 @@ -\documentclass[titlepage]{article} -\usepackage{import} -\usepackage{graphicx} -\usepackage{xr} -\usepackage{hyperref} -\IfFileExists{../doc/userinputs.tex}{\subimport{../doc/}{userinputs.tex}}{} %hook for conditional user-specific inputs, includes, macros, ... -\usepackage[a4paper,text={160mm,255mm},centering,headsep=5mm,footskip=10mm]{geometry} -\usepackage{nonfloat} -\parindent 0pt -\makeatletter -\newcommand\level[1]{% - \ifcase#1\relax\expandafter\chapter\or - \expandafter\section\or - \expandafter\subsection\or - \expandafter\subsubsection\else - \def\next{\@level{#1}}\expandafter\next - \fi} - -\newcommand{\@level}[1]{% -\@startsection{level#1} - {#1} - {\z@}% - {-3.25ex\@plus -1ex \@minus -.2ex}% - {1.5ex \@plus .2ex}% - {\normalfont\normalsize\bfseries}} - -\newdimen\@leveldim - \newdimen\@dotsdim - {\normalfont\normalsize - \sbox\z@{0}\global\@leveldim=\wd\z@ - \sbox\z@{.}\global\@dotsdim=\wd\z@ - } -\newcounter{level4}[subsubsection] - \@namedef{thelevel4}{\thesubsubsection.\arabic{level4}} - \@namedef{level4mark}#1{} - \def\l@section{\@dottedtocline{1}{0pt}{\dimexpr\@leveldim*4+\@dotsdim*1+6pt\relax}} - \def\l@subsection{\@dottedtocline{2}{0pt}{\dimexpr\@leveldim*5+\@dotsdim*2+6pt\relax}} - \def\l@subsubsection{\@dottedtocline{3}{0pt}{\dimexpr\@leveldim*6+\@dotsdim*3+6pt\relax}} - \@namedef{l@level4}{\@dottedtocline{4}{0pt}{\dimexpr\@leveldim*7+\@dotsdim*4+6pt\relax}} - -\count@=4 - \def\@ncp#1{\number\numexpr\count@+#1\relax} - \loop\ifnum\count@<100 - \begingroup\edef\x{\endgroup - \noexpand\newcounter{level\@ncp{1}}[level\number\count@] - \noexpand\@namedef{thelevel\@ncp{1}}{% - \noexpand\@nameuse{thelevel\@ncp{0}}.\noexpand\arabic{level\@ncp{0}}} - \noexpand\@namedef{level\@ncp{1}mark}####1{}% - \noexpand\@namedef{l@level\@ncp{1}}% - {\noexpand\@dottedtocline{\@ncp{1}}{0pt}{\the\dimexpr\@leveldim*\@ncp{5}+\@dotsdim*\@ncp{0}\relax}}}% - \x - \advance\count@\@ne - \repeat - \makeatother - \setcounter{secnumdepth}{100} - \setcounter{tocdepth}{100} - - -\title{room.basic.service.timing Model Documentation} -\date{\today} -\author{generated by eTrice} - -\begin{document} - -\pagestyle{plain} -\maketitle -\tableofcontents - -\newpage -\listoffigures -\newpage -\section{Model Description} - - - - -\section{Protocol Classes} -\subimport*{room.basic.service.timing/}{PTimer.tex} -\newpage - - - -\section{Actor Classes} -\subimport*{room.basic.service.timing/}{ATimingService.tex} -\end{document} diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing/ATimingService.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing/ATimingService.tex deleted file mode 100644 index 861041016..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing/ATimingService.tex +++ /dev/null @@ -1,97 +0,0 @@ -\level{2}{ATimingService} - -\level{3}{Structure} -{ -\centering{} -\includegraphics[width=1.0\textwidth]{./images/ATimingService_structure.jpg} -\figcaption{ATimingService Structure} -} - - -\level{3}{Behavior} -\level{4}{Top Level} -{ -\centering{} -\includegraphics[width=1.0\textwidth]{./images/ATimingService_behavior.jpg} -\figcaption{ATimingService Top State} -} - -\begin{par} - -\end{par} - - -\level{3}{Attributes} -\begin{tabular}[ht]{|l|l|p{8cm}|} -\hline -\textbf{Name} & \textbf{Type} & \textbf{Description}\\ -\hline -tcbs & tcb & \\ -\hline -usedTcbsRoot & tcb & \\ -\hline -freeTcbsRoot & tcb & \\ -\hline -\end{tabular} - -\level{3}{Operations} -\begin{tabular}[ht]{|l|l|} -\hline - Name: & getTcb\\ - \hline - ReturnType: & tcb\\ - \hline - Arguments: & \\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & returnTcb\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & block:tcb\\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & removeTcbFromUsedList\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & idx:int32\\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & putTcbToUsedList\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & block:tcb\\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & isTimeGreater\\ - \hline - ReturnType: & boolean\\ - \hline - Arguments: & t1:targetTime, t2:targetTime\\ - \hline -\end{tabular} -\newline\newline\newline -\begin{tabular}[ht]{|l|l|} -\hline - Name: & addTime\\ - \hline - ReturnType: & void\\ - \hline - Arguments: & t1:targetTime, t2:targetTime\\ - \hline -\end{tabular} -\newline\newline\newline diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing/PTimer.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing/PTimer.tex deleted file mode 100644 index 9319ec255..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.service.timing/PTimer.tex +++ /dev/null @@ -1,22 +0,0 @@ -\level{2} {PTimer} -\level{3}{Incoming Messages} - -\begin{tabular}[ht]{|l|l|l|p{8cm}|} -\hline -Message & Data & Type & Description\\ -\hline -startTimer & time & uint32 & \\ -\hline -startTimeout & time & uint32 & \\ -\hline -kill & & & \\ -\hline -\end{tabular} -\level{3}{Outgoing Messages} -\begin{tabular}[ht]{|l|l|l|p{8cm}|} -\hline -Message & Data & Type & Description\\ -\hline -timeout & & & \\ -\hline -\end{tabular} diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.types.pdf b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.types.pdf deleted file mode 100644 index 4b999f165..000000000 Binary files a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.types.pdf and /dev/null differ diff --git a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.types.tex b/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.types.tex deleted file mode 100644 index 5cb44f958..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/doc-gen/room.basic.types.tex +++ /dev/null @@ -1,80 +0,0 @@ -\documentclass[titlepage]{article} -\usepackage{import} -\usepackage{graphicx} -\usepackage{xr} -\usepackage{hyperref} -\IfFileExists{../doc/userinputs.tex}{\subimport{../doc/}{userinputs.tex}}{} %hook for conditional user-specific inputs, includes, macros, ... -\usepackage[a4paper,text={160mm,255mm},centering,headsep=5mm,footskip=10mm]{geometry} -\usepackage{nonfloat} -\parindent 0pt -\makeatletter -\newcommand\level[1]{% - \ifcase#1\relax\expandafter\chapter\or - \expandafter\section\or - \expandafter\subsection\or - \expandafter\subsubsection\else - \def\next{\@level{#1}}\expandafter\next - \fi} - -\newcommand{\@level}[1]{% -\@startsection{level#1} - {#1} - {\z@}% - {-3.25ex\@plus -1ex \@minus -.2ex}% - {1.5ex \@plus .2ex}% - {\normalfont\normalsize\bfseries}} - -\newdimen\@leveldim - \newdimen\@dotsdim - {\normalfont\normalsize - \sbox\z@{0}\global\@leveldim=\wd\z@ - \sbox\z@{.}\global\@dotsdim=\wd\z@ - } -\newcounter{level4}[subsubsection] - \@namedef{thelevel4}{\thesubsubsection.\arabic{level4}} - \@namedef{level4mark}#1{} - \def\l@section{\@dottedtocline{1}{0pt}{\dimexpr\@leveldim*4+\@dotsdim*1+6pt\relax}} - \def\l@subsection{\@dottedtocline{2}{0pt}{\dimexpr\@leveldim*5+\@dotsdim*2+6pt\relax}} - \def\l@subsubsection{\@dottedtocline{3}{0pt}{\dimexpr\@leveldim*6+\@dotsdim*3+6pt\relax}} - \@namedef{l@level4}{\@dottedtocline{4}{0pt}{\dimexpr\@leveldim*7+\@dotsdim*4+6pt\relax}} - -\count@=4 - \def\@ncp#1{\number\numexpr\count@+#1\relax} - \loop\ifnum\count@<100 - \begingroup\edef\x{\endgroup - \noexpand\newcounter{level\@ncp{1}}[level\number\count@] - \noexpand\@namedef{thelevel\@ncp{1}}{% - \noexpand\@nameuse{thelevel\@ncp{0}}.\noexpand\arabic{level\@ncp{0}}} - \noexpand\@namedef{level\@ncp{1}mark}####1{}% - \noexpand\@namedef{l@level\@ncp{1}}% - {\noexpand\@dottedtocline{\@ncp{1}}{0pt}{\the\dimexpr\@leveldim*\@ncp{5}+\@dotsdim*\@ncp{0}\relax}}}% - \x - \advance\count@\@ne - \repeat - \makeatother - \setcounter{secnumdepth}{100} - \setcounter{tocdepth}{100} - - -\title{room.basic.types Model Documentation} -\date{\today} -\author{generated by eTrice} - -\begin{document} - -\pagestyle{plain} -\maketitle -\tableofcontents - -\newpage -\listoffigures -\newpage -\section{Model Description} - - - - - - - -\end{document} diff --git a/runtime/org.eclipse.etrice.modellib.cpp/buckminster.cspec b/runtime/org.eclipse.etrice.modellib.cpp/buckminster.cspec deleted file mode 100644 index 3e51044d1..000000000 --- a/runtime/org.eclipse.etrice.modellib.cpp/buckminster.cspec +++ /dev/null @@ -1 +0,0 @@ - diff --git a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle index 3330c2406..8ae584694 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle @@ -2,7 +2,7 @@ plugins { id 'cpp' } -apply from: etGenerator +apply from: "$rootDir/gradle/etGenerator.gradle" def models = [ 'model/TimingService.room' diff --git a/runtime/org.eclipse.etrice.modellib.java/buckminster.cspec b/runtime/org.eclipse.etrice.modellib.java/buckminster.cspec deleted file mode 100644 index a4c43f534..000000000 --- a/runtime/org.eclipse.etrice.modellib.java/buckminster.cspec +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/runtime/org.eclipse.etrice.modellib.java/build.gradle b/runtime/org.eclipse.etrice.modellib.java/build.gradle index 004c8614f..9d3ddffb5 100644 --- a/runtime/org.eclipse.etrice.modellib.java/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.java/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java' } -apply from: etGenerator +apply from: "$rootDir/gradle/etGenerator.gradle" def models = [ 'model/ALogService.room', diff --git a/runtime/org.eclipse.etrice.modellib.java/pom.xml b/runtime/org.eclipse.etrice.modellib.java/pom.xml deleted file mode 100644 index 33abbe471..000000000 --- a/runtime/org.eclipse.etrice.modellib.java/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - - org.eclipse.etrice.modellib.java - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent - - - - src-gen - - - src-gen - - **/*.java - - - - model - - - - - - org.eclipse.etrice - org.eclipse.etrice.runtime.java - 1.1.1-SNAPSHOT - - - \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.runtime.c/buckminster.cspec b/runtime/org.eclipse.etrice.runtime.c/buckminster.cspec deleted file mode 100644 index be9cea325..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/buckminster.cspec +++ /dev/null @@ -1 +0,0 @@ - diff --git a/runtime/org.eclipse.etrice.runtime.cpp/buckminster.cspec b/runtime/org.eclipse.etrice.runtime.cpp/buckminster.cspec deleted file mode 100644 index 14afaf1da..000000000 --- a/runtime/org.eclipse.etrice.runtime.cpp/buckminster.cspec +++ /dev/null @@ -1 +0,0 @@ - diff --git a/runtime/org.eclipse.etrice.runtime.java/buckminster.cspec b/runtime/org.eclipse.etrice.runtime.java/buckminster.cspec deleted file mode 100644 index 06938d6ea..000000000 --- a/runtime/org.eclipse.etrice.runtime.java/buckminster.cspec +++ /dev/null @@ -1 +0,0 @@ - diff --git a/runtime/org.eclipse.etrice.runtime.java/pom.xml b/runtime/org.eclipse.etrice.runtime.java/pom.xml deleted file mode 100644 index e9dba60dc..000000000 --- a/runtime/org.eclipse.etrice.runtime.java/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - 4.0.0 - - org.eclipse.etrice.runtime.java - - - org.eclipse.etrice - java-generator - 1.1.1-SNAPSHOT - ../../releng/org.eclipse.etrice.parent - - - - src - - - org.codehaus.mojo - build-helper-maven-plugin - 1.4 - - - add-generated-source - generate-sources - - add-source - - - - ${basedir}/src-gen - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.codehaus.mojo - - - build-helper-maven-plugin - - - [1.4,) - - - add-source - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/Makefile b/tests/org.eclipse.etrice.generator.c.tests/Makefile deleted file mode 100644 index 9a1750a43..000000000 --- a/tests/org.eclipse.etrice.generator.c.tests/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# for make.xml - -#include ${MODELLIB_ROOTDIR}/buildTools/modellib.mk -include ${RUNTIME_ROOTDIR}/buildTools/runtime.mk - -# --- -IN_TARGET := ${APP_TARGET} -IN_BUILD_DIR := ${APP_BUILD_DIR} -IN_INCDIRS += ${APP_SRCDIRS_REC} -IN_SRCDIRS_REC += ${APP_SRCDIRS_REC} -#--- - -# Create rules -include ${RUNTIME_ROOTDIR}/buildTools/Makefile.mk \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/buckminster.cspec b/tests/org.eclipse.etrice.generator.c.tests/buckminster.cspec deleted file mode 100644 index c3cb872da..000000000 --- a/tests/org.eclipse.etrice.generator.c.tests/buckminster.cspec +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/build.gradle b/tests/org.eclipse.etrice.generator.c.tests/build.gradle index f706476a9..e5ed184c3 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.c.tests/build.gradle @@ -2,7 +2,7 @@ plugins { id 'c' } -apply from: etTest +apply from: "$rootDir/gradle/etTest.gradle" def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' diff --git a/tests/org.eclipse.etrice.generator.c.tests/make.xml b/tests/org.eclipse.etrice.generator.c.tests/make.xml deleted file mode 100644 index 07e2df06e..000000000 --- a/tests/org.eclipse.etrice.generator.c.tests/make.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - done with ${ant.project.name} - - - - - - - - - - - - - - - - - - - - runtime.platform = ${runtime.platform} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.c.tests/org.eclipse.etrice.generator.c.tests make.xml.launch b/tests/org.eclipse.etrice.generator.c.tests/org.eclipse.etrice.generator.c.tests make.xml.launch deleted file mode 100644 index 92ce070b0..000000000 --- a/tests/org.eclipse.etrice.generator.c.tests/org.eclipse.etrice.generator.c.tests make.xml.launch +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.common.tests/buckminster.cspec b/tests/org.eclipse.etrice.generator.common.tests/buckminster.cspec deleted file mode 100644 index b9bd37b93..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/buckminster.cspec +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/org.eclipse.etrice.generator.common.tests/build.gradle b/tests/org.eclipse.etrice.generator.common.tests/build.gradle index 8e6530812..9fd487354 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.common.tests/build.gradle @@ -4,7 +4,7 @@ plugins { id 'java-base' } -apply from: etTest +apply from: "$rootDir/gradle/etTest.gradle" def genericPhysical = 'models/GenericPhysical.etphys' diff --git a/tests/org.eclipse.etrice.generator.common.tests/common.xml b/tests/org.eclipse.etrice.generator.common.tests/common.xml deleted file mode 100644 index 63b4ab7d3..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/common.xml +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - - - - - - - - - - - - - done with ${ant.project.name} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ant.project.name = ${ant.project.name} - runtime.path = ${runtime.path} - testlog.path = ${testlog.path} - test.results = ${test.results} - output = ${output} - bin.path = ${bin.path} - target.platform = ${target.platform} - modellib.path = ${modellib.path} - models.path = ${models.path} - basedir = ${basedir} - - org.eclipse.emf.ecore = ${org.eclipse.emf.ecore} - org.eclipse.emf.common = ${org.eclipse.emf.common} - org.eclipse.emf.ecore.xmi = ${org.eclipse.emf.ecore.xmi} - com.google.inject = ${com.google.inject} - com.google.guava = ${com.google.guava} - org.eclipse.equinox.common = ${org.eclipse.equinox.common} - org.eclipse.xtext = ${org.eclipse.xtext} - org.eclipse.xtext.util = ${org.eclipse.xtext.util} - org.eclipse.xtext.common.types = ${org.eclipse.xtext.common.types} - org.eclipse.xtend.lib = ${org.eclipse.xtend.lib} - org.eclipse.xtext.xbase.lib = ${org.eclipse.xtext.xbase.lib} - org.apache.log4j = ${org.apache.log4j} - org.antlr.runtime = ${org.antlr.runtime} - javax.inject = ${javax.inject} - - - etrice.clspath = ${classpathProp} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle b/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle deleted file mode 100644 index 544b6f8f0..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle +++ /dev/null @@ -1,111 +0,0 @@ -import static org.apache.tools.ant.taskdefs.condition.Os.* - -apply from: etGenerator -apply from: etUnitConverter - -def outputDir = 'log' -def srcGenDir = 'src-gen' - -clean.delete srcGenDir, outputDir - -def getMainClass(String genDir) { - // search for SubSystemRunner java file - def mainFile = fileTree(genDir, { include '**/*Runner.java' }).getSingleFile() - // relativize path to generation directory - def relPath = file(genDir).toPath().relativize(mainFile.toPath()).normalize().toString() - // remove '.java' at the end - def path = relPath.substring(0, relPath.length() - 5) - // replace all separators with '.' - def mainClass = path.replace(File.separatorChar, '.' as char) - return mainClass -} - -/** - * Creates all needed tasks for one test execution - * @param lang: The eTrice generator type ('c', 'cpp', 'java') - * @param name: The test name starting with a lower case letter - * @param models: Models that are passed to the eTrice generator - * @param options: Options that are passed to the eTrice generator - */ -ext.createTest = { lang, name, models, options = [] -> - - def nameCap = name.capitalize() - def langCap = lang.capitalize() - def testName = "$name$langCap" - def testNameCap = testName.capitalize() - def suiteName = "${project.name}.$testNameCap" - def genDir = "$srcGenDir/$testName" - def workingDir = "$outputDir/$testName" - def etuFile = "$workingDir/log/${nameCap}.etu" - - def generateTask = createGeneratorTask("generate$testNameCap", lang, models, genDir, options) - generateTask.environment 'etModellib', "org.eclipse.etrice.modellib.$lang" - - def runTask - - if(lang == 'c' || lang == 'cpp') { - model { - components { - "$testName"(NativeExecutableSpec) { - sources."$lang" { - builtBy generateTask - source { - srcDirs = [genDir] - include "**/*.$lang" - } - exportedHeaders { - srcDirs = [genDir] - } - lib project: ":runtime:org.eclipse.etrice.modellib.$lang", library: "etrice_modellib_$lang", linkage: 'static' - if(lang == 'cpp') lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' - lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' - } - binaries.all { - cCompiler.args '-g3' - cppCompiler.args '-g3' - if(isFamily(FAMILY_UNIX)) { linker.args '-lpthread', '-lrt', '-lm' } - } - } - } - } - - def exeFile = "$buildDir/exe/$testName/$testName" - runTask = tasks.create(name: "run$testNameCap", type: Exec) { - dependsOn "${testName}Executable" - commandLine exeFile, '-run_as_test' - inputs.file exeFile - outputs.file etuFile - it.workingDir = workingDir - } - } - - else if(lang == 'java') { - def testSourceSet = sourceSets.create(name) { - java.srcDirs = [genDir] - } - - dependencies { - add "${name}Compile", project(':runtime:org.eclipse.etrice.modellib.java') - add "${name}Compile", project(':runtime:org.eclipse.etrice.runtime.java') - } - - tasks.getByName("compile${nameCap}Java").dependsOn generateTask - - runTask = tasks.create(name: "run$testNameCap", type: JavaExec) { - dependsOn "${name}Classes" - classpath = testSourceSet.runtimeClasspath - args '-run_as_test' - outputs.file etuFile - it.workingDir = workingDir - - doFirst { main = getMainClass(genDir) } - } - } - - runTask.doFirst { file("$workingDir/log").mkdirs() } - - def convertTask = createEtUnitConverterTask("convert$testNameCap", [etuFile], ['-suite', suiteName]) - convertTask.dependsOn runTask - - check.dependsOn tasks.create(name: testName, dependsOn: convertTask, group: 'verification') -} diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/Makefile b/tests/org.eclipse.etrice.generator.cpp.tests/Makefile deleted file mode 100644 index b6b863770..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# for make.xml - -#include ${CPP_MODELLIB_ROOTDIR}/buildTools/modellib.mk -include ${CPP_RUNTIME_ROOTDIR}/buildTools/runtime.mk - -# --- -IN_TARGET := ${APP_TARGET} -IN_BUILD_DIR := ${APP_BUILD_DIR} -IN_INCDIRS += ${APP_SRCDIRS_REC} -IN_SRCDIRS_REC += ${APP_SRCDIRS_REC} -CC = ${CXX} -IN_CFLAGS += -std=c++98 -O0 -g3 -pedantic -Wall -#--- - -# Create rules -include ${RUNTIME_ROOTDIR}/buildTools/Makefile.mk \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/buckminster.cspec b/tests/org.eclipse.etrice.generator.cpp.tests/buckminster.cspec deleted file mode 100644 index 39f8c66f3..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/buckminster.cspec +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle b/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle index 1860582d3..aede47920 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle @@ -2,7 +2,7 @@ plugins { id 'cpp' } -apply from: etTest +apply from: "$rootDir/gradle/etTest.gradle" def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/make.xml b/tests/org.eclipse.etrice.generator.cpp.tests/make.xml deleted file mode 100644 index af3fe27d6..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/make.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - runtime.platform = ${runtime.platform} - - - - - - - - - - - generating @{testId} - - - building @{testId} - - - running @{testId} - - - converting @{testId} - - - copying result @{testId} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch b/tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch deleted file mode 100644 index 6849d0869..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.java.tests/buckminster.cspec b/tests/org.eclipse.etrice.generator.java.tests/buckminster.cspec deleted file mode 100644 index b4b3128c9..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/buckminster.cspec +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.java.tests/build.gradle b/tests/org.eclipse.etrice.generator.java.tests/build.gradle index 006dc073d..0c8b984e7 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.java.tests/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java-base' } -apply from: etTest +apply from: "$rootDir/gradle/etTest.gradle" def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' diff --git a/tests/org.eclipse.etrice.generator.java.tests/make.xml b/tests/org.eclipse.etrice.generator.java.tests/make.xml deleted file mode 100644 index a75d0330c..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/make.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - done with ${ant.project.name} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${toString:runnerFileSet} - - - - - - - - run @{testId} - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.java.tests/org.eclipse.etrice.generator.java.tests make.xml.launch b/tests/org.eclipse.etrice.generator.java.tests/org.eclipse.etrice.generator.java.tests make.xml.launch deleted file mode 100644 index 7ad38f90f..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/org.eclipse.etrice.generator.java.tests make.xml.launch +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.runtime.c.tests/Makefile b/tests/org.eclipse.etrice.runtime.c.tests/Makefile deleted file mode 100644 index 1f9507676..000000000 --- a/tests/org.eclipse.etrice.runtime.c.tests/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# for make.xml -include ${RUNTIME_ROOTDIR}/buildTools/runtime.mk - -# --- -IN_TARGET := $(notdir $(shell pwd)).exe -IN_BUILD_DIR := ./bin -IN_INCDIRS += ./src -IN_SRCDIRS_REC += ./src -#--- - - -# Create rules -include ${RUNTIME_ROOTDIR}/buildTools/Makefile.mk \ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.c.tests/buckminster.cspec b/tests/org.eclipse.etrice.runtime.c.tests/buckminster.cspec deleted file mode 100644 index f803be39c..000000000 --- a/tests/org.eclipse.etrice.runtime.c.tests/buckminster.cspec +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle index 1321f31f4..32ebe4192 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle @@ -4,7 +4,7 @@ plugins { id 'c' } -apply from: etUnitConverter +apply from: "$rootDir/gradle/etUnitConverter.gradle" model { components { diff --git a/tests/org.eclipse.etrice.runtime.c.tests/make.xml b/tests/org.eclipse.etrice.runtime.c.tests/make.xml deleted file mode 100644 index a37d667b1..000000000 --- a/tests/org.eclipse.etrice.runtime.c.tests/make.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - runtime.platform = ${runtime.platform} - - - - - - done with ${ant.project.name} - - - - - - - - - - - - - - - - - start RuntimeTest - - end RuntimeTest - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.runtime.c.tests/org.eclipse.etrice.runtime.c.tests make.xml.launch b/tests/org.eclipse.etrice.runtime.c.tests/org.eclipse.etrice.runtime.c.tests make.xml.launch deleted file mode 100644 index 37fbb50c8..000000000 --- a/tests/org.eclipse.etrice.runtime.c.tests/org.eclipse.etrice.runtime.c.tests make.xml.launch +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/Makefile b/tests/org.eclipse.etrice.runtime.cpp.tests/Makefile deleted file mode 100644 index 6d6a9607b..000000000 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -include ${CPP_RUNTIME_ROOTDIR}/buildTools/runtime.mk - -# --- -IN_TARGET := $(notdir $(shell pwd)).exe -IN_BUILD_DIR := ./bin -IN_INCDIRS += ./src -IN_SRCDIRS_REC += ./src -CC = ${CXX} -IN_CFLAGS += -std=c++98 -O0 -g3 -pedantic -Wall -#--- - - -# Create rules -include ${RUNTIME_ROOTDIR}/buildTools/Makefile.mk diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/buckminster.cspec b/tests/org.eclipse.etrice.runtime.cpp.tests/buckminster.cspec deleted file mode 100644 index 74fcad21d..000000000 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/buckminster.cspec +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle index f4a919d3e..c3bcbb50b 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle @@ -4,7 +4,7 @@ plugins { id 'cpp' } -apply from: etUnitConverter +apply from: "$rootDir/gradle/etUnitConverter.gradle" model { components { diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/make.xml b/tests/org.eclipse.etrice.runtime.cpp.tests/make.xml deleted file mode 100644 index e8c7725d1..000000000 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/make.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - runtime.platform = ${runtime.platform} - - - - - - done with ${ant.project.name} - - - - - - - - - - - - - - - - - - start RuntimeTest - - end RuntimeTest - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/org.eclipse.etrice.runtime.cpp.tests make.xml.launch b/tests/org.eclipse.etrice.runtime.cpp.tests/org.eclipse.etrice.runtime.cpp.tests make.xml.launch deleted file mode 100644 index 8d344f97e..000000000 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/org.eclipse.etrice.runtime.cpp.tests make.xml.launch +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.runtime.java.tests/buckminster.cspec b/tests/org.eclipse.etrice.runtime.java.tests/buckminster.cspec deleted file mode 100644 index c02254993..000000000 --- a/tests/org.eclipse.etrice.runtime.java.tests/buckminster.cspec +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/pom.xml b/tests/pom.xml index 9ee1ea0a3..4376835cb 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -6,12 +6,11 @@ org.eclipse.etrice org.eclipse.etrice.parent - 1.0.0-SNAPSHOT + 1.1.1-SNAPSHOT ../releng/org.eclipse.etrice.parent org.eclipse.etrice org.eclipse.etrice.tests - 1.0.0-SNAPSHOT pom -- cgit v1.2.3