summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjung2012-09-15 15:20:59 (EDT)
committertjung2012-09-15 15:20:59 (EDT)
commitb2439cde88607b99bccba4a18c5680ed18b27a08 (patch)
tree0238f5f9b9e05348db4ea80280680c24838879ca
parentd26072a00a2647cabfcda4dbf78291fb07ec2fdd (diff)
downloadorg.eclipse.etrice-b2439cde88607b99bccba4a18c5680ed18b27a08.zip
org.eclipse.etrice-b2439cde88607b99bccba4a18c5680ed18b27a08.tar.gz
org.eclipse.etrice-b2439cde88607b99bccba4a18c5680ed18b27a08.tar.bz2
[doc] tutorial remove C comment added
-rw-r--r--plugins/org.eclipse.etrice.doc/build/etrice.textile331
-rw-r--r--plugins/org.eclipse.etrice.doc/build/etrice.xml421
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/034-getting-started_C.textile9
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/036-tutorial-remove-comment_C.textile297
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/etrice-index.txt1
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC01.pngbin0 -> 5063 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC02.pngbin0 -> 18713 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC03.pngbin0 -> 17936 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC04.pngbin0 -> 51681 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC05.pngbin0 -> 9897 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC06.pngbin0 -> 117517 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC07.pngbin0 -> 9964 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC08.pngbin0 -> 73392 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Buildandrunthemodel.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Buildandrunthemodel2.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/help/CreatealaunchconfigurationtostarttheCcodegenerator.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Createanewmodelfromscratch.html4
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Createanewmodelfromscratch4.html6
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Createastatemachine.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/help/CreatetheHelloWorldmodel.html7
-rw-r--r--plugins/org.eclipse.etrice.doc/help/DataClass.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/help/FiniteStateMachines.html6
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Generatethecode.html4
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Layering2.html4
-rw-r--r--plugins/org.eclipse.etrice.doc/help/OpentheMessageSequenceChart.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Ports.html6
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Protocols.html4
-rw-r--r--plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceC.html134
-rw-r--r--plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceJava.html129
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Setuptheincludepath.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Summary.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Summary4.html12
-rw-r--r--plugins/org.eclipse.etrice.doc/help/TutorialHelloWorldC.html108
-rw-r--r--plugins/org.eclipse.etrice.doc/help/TutorialHelloWorldJava.html85
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Whydoesitworkandwhyisitsafe.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/help/WorkingwiththeeTriceTutorials.html6
-rw-r--r--plugins/org.eclipse.etrice.doc/html/etrice.html567
-rw-r--r--plugins/org.eclipse.etrice.doc/manual/etrice.pdfbin6728345 -> 6996203 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/toc.xml40
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java444
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java817
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java972
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/.cproject10
43 files changed, 1608 insertions, 2834 deletions
diff --git a/plugins/org.eclipse.etrice.doc/build/etrice.textile b/plugins/org.eclipse.etrice.doc/build/etrice.textile
index e9fc4fe..fb6487d 100644
--- a/plugins/org.eclipse.etrice.doc/build/etrice.textile
+++ b/plugins/org.eclipse.etrice.doc/build/etrice.textile
@@ -213,13 +213,13 @@ With this execution model also lower levels of a software system, such as device
h1. Working with the eTrice Tutorials
-The eTrice Tutorials will help you to learn and understand the eTrice Tool and concepts. ETrice supports several target languages. The concepts will not be explained in each language.
+The eTrice Tutorials will help you to learn and understand the eTrice tool and concepts. ETrice supports several target languages. The concepts will not be explained for each language.
Most of the common concepts will be described for Java as target language. To start with a new language the first steps to setup the workspace and to generate and run the first model will be described also. Target language specific aspects will be described as well.
-Therefore the best way to start with eTrice is to perform the Java Tutorials and after that switch to your target language.
+Therefore the best way to start with eTrice is to follow the Java Tutorials and after that switch to your target language.
-h1. Setting up the Workspace (Java)
+h1. Setting up the Workspace for Java Projects
ETrice generates code out of ROOM models. The code generator and the generated code relies on a runtime framework and on some ready to use model parts. This parts provide services like:
@@ -262,7 +262,7 @@ To stop the application type _quit_ in the console window.
Performing the tutorials will setup an dedicated project for each tutorial. Therefore there are some slight changes especially whenever a path must be set (e.g. to the model library) within your own projects. All this is described in the tutorials.
-h1. Tutorial HelloWorld (Java)
+h1. Tutorial HelloWorld for Java
h2. Scope
@@ -956,7 +956,7 @@ This method is synchronized. That means, regardless who sends the message, the q
-h1. Setting up the Workspace ( C )
+h1. Setting up the Workspace for C Projects
Before you can start with C, some preconditions must be fulfilled:
@@ -983,7 +983,7 @@ From the main menu select _File->New->C Project_.
!images/032-SetupWorkspaceC02.png!
-Name the Project. Select an _Executable->Hello World ANSI C_ as Project type, _MinGW GCC_ as Tool chain and click _Finish_.
+Name the project. Select an _Executable->Hello World ANSI C_ as project type, _MinGW GCC_ as tool chain and click _Finish_.
!images/032-SetupWorkspaceC04.png!
@@ -1008,7 +1008,7 @@ The C runtime system contains some basic functionalities to run the generated mo
After changing the configuration, the runtime must be built.
-Open the properties of the _org.eclipse.runtime.c_ project and select _C/C++ Build->Settins->Tool Settings_ and select _Includes_.
+Open the properties of the _org.eclipse.runtime.c_ project and select _C/C++ Build->Settings->Tool Settings_ and select _Includes_.
!images/032-SetupWorkspaceC08.png!
@@ -1032,11 +1032,11 @@ The runtime library should be created.
For the tutorials one runtime library should be sufficient. For embedded projects it might be necessary to build project specific runtime libraries. In this case a separate project for the runtime should be created. Symbolic links to the sources might be used to avoid duplicate files. Just the configuration file must be duplicated. A specific library file must exist within the project. Such specific runtime libraries might be referenced from several applications.
-h1. Tutorial HelloWorld ( C )
+h1. Tutorial HelloWorld for C
h2. Scope
-In this tutorial you will learn how to create a model for C from scratch. There are some more steps to do in C as in Java. The goal is to get familiar with the additional steps. The Java tutorial is a prerequisite for the following explanations.
+In this tutorial you will learn how to create a model for C from scratch. There are some more steps to do in C compared to Java. The goal is to get familiar with the additional steps. The Java tutorial is a prerequisite for the following explanations.
You will perform the following steps:
# create a new model from scratch for C
@@ -1046,12 +1046,12 @@ You will perform the following steps:
# generate the source code
# run the model
-Make sure that you have set up the workspace as described in _Setting up the workspace ( C )_.
+Make sure that you have set up the workspace as described in _Setting up the Workspace for C Projects_.
h2. Create a new model from scratch
-Before you can create a new C-model, you have to create a new C project as described in _Setting up the workspace ( C )_.
+Before you can create a new C-model, you have to create a new C project as described in _Setting up the Workspace for C Projects_.
Remember:
- select the _C/C++_ perspective
- From the main menue select _File->New->C Project_
@@ -1089,9 +1089,7 @@ Creating the model is not the focus of this tutorial. Therefore copy and paste t
Recognize the C specific parts:
- Import CTypes instead of JavaTypes
- The action code contains C instead of Java. Later versions will contain a common action language, but for the moment the action language is target specific.
-- The application must be shutdown on model level (see also _etRuntimeConfig.h_)
-
-ToDo: shutdown must not depend on the subsystem.
+- The application must be shutdown on model level (see also _etRuntimeConfig.h_).
bc..
RoomModel HelloWorldCModel {
@@ -1107,7 +1105,7 @@ RoomModel HelloWorldCModel {
State state0 {
entry {
"printf(\"HelloWorldC !\\n\");"
- "HelloWorldCSubSysClass_shutdown();//exit(0);"
+ "SubSysClass_shutdown();"
"\t\t\t\t\t\t"
}
}
@@ -1148,7 +1146,7 @@ Apply your changes. The new configuration should now exist in your workspace.
h2. Generate the code
-Now you can generate the code as you know it from Java. Right click to the launch configuration and run it as _gen_HelloWorldC_.
+Now you can generate the code as you know it from Java. Right click on the launch configuration and run it as _gen_HelloWorldC_.
!images/034-HelloWorldC12.png!
@@ -1180,7 +1178,306 @@ h2. Summary
You are now familiar with all necessary steps to create, build and run an eTrice C model from scratch. You are able to create a launch configuration to start the code generator and to perform all necessary settings to compile and link the application.
-The next tutorial provides an exercise to get more familiar with these working steps.
+The next tutorial provides an exercise to get more familiar with these working steps.
+
+h1. Tutorial Remove C-Comment ( C )
+
+h2. Scope
+
+In this tutorial you will create a more complex model. The model implements a simple parser that removes comments (block comments and line comments) from a C source file. Therefore we will create two actors. One actor is responsible to perform the file operations, whether the second actor implements the parser.
+
+You will perform the following steps:
+
+# create a new model from scratch for C
+# define a protocol
+# define your own data type
+# create the structure and the behavior by yourself
+# generate, build and run the model
+
+Make sure that you have set up the workspace as described in _Setting up the Workspace for C Projects_.
+
+h2. Create a new model from scratch
+
+Remember the following steps from the previous tutorials:
+- select the _C/C++_ perspective
+- From the main menue select _File->New->C Project_
+- Name the project _RemoveComment_
+- Project type is _Executable / Empty C Project_
+- Toolchain is _MinGW_
+- Add the folder _model_
+- Add the model file and name it _RemoveComment.room_
+- Add the Xtext nature.
+
+The workspace should look like this:
+
+!images/036-RemoveCommentC01.png!
+
+Create a launch configuration for the C generator and add the include path and library as described in _HelloWorldC_.
+
+The workspace should look like this:
+
+!images/036-RemoveCommentC02.png!
+
+Now the model is created and all settings for the code generator, compiler and linker are done.
+
+
+h2. Create your own data type
+
+The planed application should read a C source file and remove the comments. Therefore we need a file descriptor which is not part of the basic C types. The type for the file descriptor for MinGW is _FILE_. To make this type available on the model level, you have to declare the type in CTypes.room. To not interfere with other models, make a copy of _CTypes.room_ from _org.eclipse.modellib.c_ to your model folder.
+
+!images/036-RemoveCommentC03.png!
+
+Open _Ctypes.room_ and take a look at the declaration of _string_ (last line) which is not a basic C type.
+
+_PrimitiveType string:ptCharacter -> charPtr default "0"_
+
+With this declaration, you make the _string_ keyword available on model level as a primitive type. This type will be translated to _charPtr_ in your C sources. _charPtr_ is defined in _etDatatypes.h_. This header file is platform specific (_generic_). With this mechanism you can define your own type system on model level and map the model types to specific target/platform types.
+
+Add the following line in _CTypes.room_:
+
+bc..
+PrimitiveType file:ptInteger -> FILE default "0"
+bq.
+
+_FILE_ is the native type for MinGW. Therefore you donīt need a mapping within _etDatatypes.h_. If your model should be portable across different platforms you should not take this shortcut.
+
+h2. Create the model
+
+Due to the former tutorials you should be familiar with the steps to create the model with protocols, actors and state machines.
+
+The basic idea of the exercise is to create a file reader actor, which is responsible to open, close and read characters from the source file. Another actor receives the characters and filters the comments (parser). The remaining characters (pure source code) should be print out.
+
+Remember the logical steps:
+- create the model by the help of content assist (CTRL Space)
+- name the model, subsystem and top level actor
+- define the protocol (in this case it should be able to send a char, and to request the next char from the file reader)
+- create the structure (file reader and parser with an appropriate port, create the references and connect the ports)
+- create the state machines
+
+Try to create the model by yourself and take the following solution as an example.
+
+Structure:
+
+!images/036-RemoveCommentC04.png!
+
+File reader FSM:
+
+!images/036-RemoveCommentC05.png!
+
+Parser FSM:
+
+!images/036-RemoveCommentC06.png!
+
+Complete model:
+
+bc..
+RoomModel RemoveComment {
+ import room.basic.types.c.* from "CTypes.room"
+ SubSystemClass RemoveCommentSubSys {
+ ActorRef Topref:ATop
+ }
+ ActorClass ATop {
+ Structure {
+ ActorRef reader: AFileReader
+ ActorRef cParser: ACParser
+ Binding reader.outPort and cParser.readerPort
+ }
+ Behavior { }
+ }
+ ActorClass AFileReader{
+ Interface {
+ Port outPort: FileReaderProtocol
+ }
+ Structure {
+ usercode3{"#include <stdio.h>"
+ }
+ external Port outPort
+ Attribute f:file ref
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> reading {
+ action {
+ "if ((f = fopen(\"test.txt\",\"r\")) != 0) {"
+ "\tprintf(\"file open ok !\\r\\n\");"
+ "\t}"
+ "\telse {"
+ "\tprintf(\"file not found !\\r\\n\");"
+ "\tSubSysClass_shutdown();"
+ "\t}"
+ }
+ }
+ Transition tr0: reading -> reading {
+ triggers {
+ <getNextChar: outPort>
+ }
+ action {
+ "int8 c;"
+ "if ((c=fgetc(f)) != EOF) {"
+ "\toutPort.nextChar(c);"
+ "\t}"
+ "\telse {"
+ "\tfclose(f);"
+ "\tprintf(\"file closed !\\r\\n\");"
+ "\tSubSysClass_shutdown();"
+ "\t}"
+ }
+ }
+ State reading
+ }
+ }
+ }
+ ActorClass ACParser{
+ Interface {
+ conjugated Port readerPort: FileReaderProtocol
+ }
+ Structure {
+ external Port readerPort
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> code {
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr0: code -> cp cp0 {
+ triggers {
+ <nextChar: readerPort>
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr1: cp cp0 -> code {
+ action {
+ "printf(\"%c\",c);"
+ }
+ }
+ Transition tr2: cp cp0 -> firstSlash {
+ cond {
+ "c==\'/\'"
+ }
+ }
+ Transition tr3: firstSlash -> cp cp1 {
+ triggers {
+ <nextChar: readerPort>
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr4: cp cp1 -> cp cp4
+ Transition tr5: cp cp1 -> blockComment {
+ cond {
+ "c==\'*\'"
+ }
+ }
+ Transition tr6: blockComment -> cp cp2 {
+ triggers {
+ <nextChar: readerPort>
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr7: cp cp2 -> blockComment
+ Transition tr8: cp cp2 -> firstStar {
+ cond {
+ "c==\'*\'"
+ }
+ }
+ Transition tr9: firstStar -> cp cp3 {
+ triggers {
+ <nextChar: readerPort>
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr10: cp cp3 -> blockComment
+ Transition tr11: cp cp3 -> code {
+ cond {
+ "c==\'/\'"
+ }
+ }
+ Transition tr12: cp cp4 -> code {
+ action {
+ "printf(\"%c%c\",\'/\',c);"
+ }
+ }
+ Transition tr13: cp cp4 -> lineComment {
+ cond {
+ "c==\'/\'"
+ }
+ }
+ Transition tr14: cp cp5 -> lineComment
+ Transition tr15: lineComment -> cp cp5 {
+ triggers {
+ <nextChar: readerPort>
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr16: cp cp5 -> code {
+ cond {
+ "c==\'\\n\'"
+ }
+ }
+ ChoicePoint cp0
+ ChoicePoint cp1
+ ChoicePoint cp2
+ ChoicePoint cp3
+ ChoicePoint cp4
+ ChoicePoint cp5
+ State code
+ State firstSlash
+ State blockComment
+ State firstStar
+ State lineComment
+ }
+ }
+ }
+
+ ProtocolClass FileReaderProtocol {
+ incoming {
+ Message getNextChar()
+ }
+ outgoing {
+ Message nextChar(c:char)
+ }
+ }
+}
+bq.
+
+Take a look at the file attribute of the file reader.
+
+bc..
+Attribute f:file ref
+bq.
+
+_fopen_ expects a _FILE *_. _f:file ref_ declares a variable _f_ from type reference to _file_, which is a pointer to _FILE_.
+
+
+h2. Generate, build and run the model
+
+Before you can run the model you should copy one of the generated C source files into the project folder and name it _test.txt_.
+
+!images/036-RemoveCommentC07.png!
+
+Generate, build and run the model.
+
+Your output should start like this:
+
+!images/036-RemoveCommentC08.png!
+
+
+h2. Summary
+
+This tutorial should help you to train the necessary steps to create a C model. By the way you have seen how to create your own type system for a real embedded project. An additional aspect was to show how simple it is to separate different aspects of the required functionality by the use of actors and protocols and make them reusable.
+
+
h1. ROOM Concepts
This chapter gives an overview over the ROOM language elements and their textual and graphical notation.
diff --git a/plugins/org.eclipse.etrice.doc/build/etrice.xml b/plugins/org.eclipse.etrice.doc/build/etrice.xml
index 1a9530d..23b4c9c 100644
--- a/plugins/org.eclipse.etrice.doc/build/etrice.xml
+++ b/plugins/org.eclipse.etrice.doc/build/etrice.xml
@@ -389,12 +389,12 @@
</chapter>
<chapter id="WorkingwiththeeTriceTutorials">
<title>Working with the eTrice Tutorials</title>
- <para>The eTrice Tutorials will help you to learn and understand the eTrice Tool and concepts. ETrice supports several target languages. The concepts will not be explained in each language. </para>
+ <para>The eTrice Tutorials will help you to learn and understand the eTrice tool and concepts. ETrice supports several target languages. The concepts will not be explained for each language. </para>
<para>Most of the common concepts will be described for Java as target language. To start with a new language the first steps to setup the workspace and to generate and run the first model will be described also. Target language specific aspects will be described as well.</para>
- <para>Therefore the best way to start with eTrice is to perform the Java Tutorials and after that switch to your target language. </para>
+ <para>Therefore the best way to start with eTrice is to follow the Java Tutorials and after that switch to your target language. </para>
</chapter>
- <chapter id="SettinguptheWorkspaceJava">
- <title>Setting up the Workspace (Java)</title>
+ <chapter id="SettinguptheWorkspaceforJavaProjects">
+ <title>Setting up the Workspace for Java Projects</title>
<para>ETrice generates code out of ROOM models. The code generator and the generated code relies on a runtime framework and on some ready to use model parts. This parts provide services like:</para>
<itemizedlist>
<listitem>
@@ -489,8 +489,8 @@
</para>
<para>Performing the tutorials will setup an dedicated project for each tutorial. Therefore there are some slight changes especially whenever a path must be set (e.g. to the model library) within your own projects. All this is described in the tutorials.</para>
</chapter>
- <chapter id="TutorialHelloWorldJava">
- <title>Tutorial HelloWorld (Java)</title>
+ <chapter id="TutorialHelloWorldforJava">
+ <title>Tutorial HelloWorld for Java</title>
<section id="Scope">
<title>Scope</title>
<para>In this tutorial you will build your first very simple eTrice model. The goal is to learn the work flow of eTrice and to understand a few basic features of ROOM. You will perform the following steps:</para>
@@ -1713,8 +1713,8 @@ carLights.setState(TrafficLight3.OFF);
<para>This method is synchronized. That means, regardless who sends the message, the queue is secured. If we later on (e.g. for performance reasons in C/C++) distinguish between internal and external senders (same thread or not), care must be taken to use the external (secure) queue.</para>
</section>
</chapter>
- <chapter id="SettinguptheWorkspaceC">
- <title>Setting up the Workspace ( C )</title>
+ <chapter id="SettinguptheWorkspaceforCProjects">
+ <title>Setting up the Workspace for C Projects</title>
<para>Before you can start with C, some preconditions must be fulfilled:</para>
<para>- A C compiler must be installed on your machine (all tests and tutorials are based on MinGW)
- The CDT-Eclipse plug in must be installed as the C development environment.</para>
@@ -1755,9 +1755,9 @@ carLights.setState(TrafficLight3.OFF);
</imageobject>
</mediaobject>
</para>
- <para>Name the Project. Select an
- <emphasis>Executable-&gt;Hello World ANSI C</emphasis> as Project type,
- <emphasis>MinGW GCC</emphasis> as Tool chain and click
+ <para>Name the project. Select an
+ <emphasis>Executable-&gt;Hello World ANSI C</emphasis> as project type,
+ <emphasis>MinGW GCC</emphasis> as tool chain and click
<emphasis>Finish</emphasis>.
</para>
<para>
@@ -1808,7 +1808,7 @@ carLights.setState(TrafficLight3.OFF);
<para>After changing the configuration, the runtime must be built.</para>
<para>Open the properties of the
<emphasis>org.eclipse.runtime.c</emphasis> project and select
- <emphasis>C/C++ Build-&gt;Settins-&gt;Tool Settings</emphasis> and select
+ <emphasis>C/C++ Build-&gt;Settings-&gt;Tool Settings</emphasis> and select
<emphasis>Includes</emphasis>.
</para>
<para>
@@ -1856,11 +1856,11 @@ carLights.setState(TrafficLight3.OFF);
<para>For the tutorials one runtime library should be sufficient. For embedded projects it might be necessary to build project specific runtime libraries. In this case a separate project for the runtime should be created. Symbolic links to the sources might be used to avoid duplicate files. Just the configuration file must be duplicated. A specific library file must exist within the project. Such specific runtime libraries might be referenced from several applications. </para>
</section>
</chapter>
- <chapter id="TutorialHelloWorldC">
- <title>Tutorial HelloWorld ( C )</title>
+ <chapter id="TutorialHelloWorldforC">
+ <title>Tutorial HelloWorld for C</title>
<section id="Scope5">
<title>Scope</title>
- <para>In this tutorial you will learn how to create a model for C from scratch. There are some more steps to do in C as in Java. The goal is to get familiar with the additional steps. The Java tutorial is a prerequisite for the following explanations.
+ <para>In this tutorial you will learn how to create a model for C from scratch. There are some more steps to do in C compared to Java. The goal is to get familiar with the additional steps. The Java tutorial is a prerequisite for the following explanations.
You will perform the following steps:</para>
<orderedlist>
<listitem>
@@ -1883,13 +1883,13 @@ carLights.setState(TrafficLight3.OFF);
</listitem>
</orderedlist>
<para>Make sure that you have set up the workspace as described in
- <emphasis>Setting up the workspace ( C )</emphasis>.
+ <emphasis>Setting up the Workspace for C Projects</emphasis>.
</para>
</section>
<section id="Createanewmodelfromscratch4">
<title>Create a new model from scratch</title>
<para>Before you can create a new C-model, you have to create a new C project as described in
- <emphasis>Setting up the workspace ( C )</emphasis>.
+ <emphasis>Setting up the Workspace for C Projects</emphasis>.
Remember:
- select the
<emphasis>C/C++</emphasis> perspective
@@ -1961,9 +1961,8 @@ carLights.setState(TrafficLight3.OFF);
- Import CTypes instead of JavaTypes
- The action code contains C instead of Java. Later versions will contain a common action language, but for the moment the action language is target specific.
- The application must be shutdown on model level (see also
- <emphasis>etRuntimeConfig.h</emphasis>)
+ <emphasis>etRuntimeConfig.h</emphasis>).
</para>
- <para>ToDo: shutdown must not depend on the subsystem.</para>
<literallayout><code>RoomModel HelloWorldCModel {
import room.basic.types.c.* from "../../org.eclipse.etrice.modellib.c/model/CTypes.room"
SubSystemClass HelloWorldCSubSysClass {
@@ -1977,7 +1976,7 @@ carLights.setState(TrafficLight3.OFF);
State state0 {
entry {
"printf(\"HelloWorldC !\\n\");"
- "HelloWorldCSubSysClass_shutdown();//exit(0);"
+ "SubSysClass_shutdown();"
"\t\t\t\t\t\t"
}
}
@@ -2060,7 +2059,7 @@ carLights.setState(TrafficLight3.OFF);
</section>
<section id="Generatethecode">
<title>Generate the code</title>
- <para>Now you can generate the code as you know it from Java. Right click to the launch configuration and run it as _gen_HelloWorldC_.</para>
+ <para>Now you can generate the code as you know it from Java. Right click on the launch configuration and run it as _gen_HelloWorldC_.</para>
<para>
<mediaobject>
<imageobject>
@@ -2118,13 +2117,383 @@ carLights.setState(TrafficLight3.OFF);
<section id="Summary4">
<title>Summary</title>
<para>You are now familiar with all necessary steps to create, build and run an eTrice C model from scratch. You are able to create a launch configuration to start the code generator and to perform all necessary settings to compile and link the application. </para>
- <para>The next tutorial provides an exercise to get more familiar with these working steps.
- h1. ROOM Concepts</para>
- <para>This chapter gives an overview over the ROOM language elements and their textual and graphical notation.
- The formal ROOM grammar based on Xtext (EBNF) you can find here:
- <ulink url="http://git.eclipse.org/c/etrice/org.eclipse.etrice.git/tree/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext">ROOM Grammar</ulink>
+ <para>The next tutorial provides an exercise to get more familiar with these working steps.</para>
+ </section>
+ </chapter>
+ <chapter id="TutorialRemoveCCommentC">
+ <title>Tutorial Remove C-Comment ( C )</title>
+ <section id="Scope6">
+ <title>Scope</title>
+ <para>In this tutorial you will create a more complex model. The model implements a simple parser that removes comments (block comments and line comments) from a C source file. Therefore we will create two actors. One actor is responsible to perform the file operations, whether the second actor implements the parser.</para>
+ <para>You will perform the following steps:</para>
+ <orderedlist>
+ <listitem>
+ <para>create a new model from scratch for C</para>
+ </listitem>
+ <listitem>
+ <para>define a protocol</para>
+ </listitem>
+ <listitem>
+ <para>define your own data type</para>
+ </listitem>
+ <listitem>
+ <para>create the structure and the behavior by yourself</para>
+ </listitem>
+ <listitem>
+ <para>generate, build and run the model</para>
+ </listitem>
+ </orderedlist>
+ <para>Make sure that you have set up the workspace as described in
+ <emphasis>Setting up the Workspace for C Projects</emphasis>.
</para>
</section>
+ <section id="Createanewmodelfromscratch5">
+ <title>Create a new model from scratch</title>
+ <para>Remember the following steps from the previous tutorials:
+ - select the
+ <emphasis>C/C++</emphasis> perspective
+ - From the main menue select
+ <emphasis>File-&gt;New-&gt;C Project</emphasis>
+ - Name the project
+ <emphasis>RemoveComment</emphasis>
+ - Project type is
+ <emphasis>Executable / Empty C Project</emphasis>
+ - Toolchain is
+ <emphasis>MinGW</emphasis>
+ - Add the folder
+ <emphasis>model</emphasis>
+ - Add the model file and name it
+ <emphasis>RemoveComment.room</emphasis>
+ - Add the Xtext nature.
+ </para>
+ <para>The workspace should look like this:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/036-RemoveCommentC01.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>Create a launch configuration for the C generator and add the include path and library as described in
+ <emphasis>HelloWorldC</emphasis>.
+ </para>
+ <para>The workspace should look like this:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/036-RemoveCommentC02.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>Now the model is created and all settings for the code generator, compiler and linker are done.</para>
+ </section>
+ <section id="Createyourowndatatype">
+ <title>Create your own data type</title>
+ <para>The planed application should read a C source file and remove the comments. Therefore we need a file descriptor which is not part of the basic C types. The type for the file descriptor for MinGW is
+ <emphasis>FILE</emphasis>. To make this type available on the model level, you have to declare the type in CTypes.room. To not interfere with other models, make a copy of
+ <emphasis>CTypes.room</emphasis> from
+ <emphasis>org.eclipse.modellib.c</emphasis> to your model folder.
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/036-RemoveCommentC03.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>Open
+ <emphasis>Ctypes.room</emphasis> and take a look at the declaration of
+ <emphasis>string</emphasis> (last line) which is not a basic C type.
+ </para>
+ <para>
+ <emphasis>PrimitiveType string:ptCharacter -&gt; charPtr default "0"</emphasis>
+ </para>
+ <para>With this declaration, you make the
+ <emphasis>string</emphasis> keyword available on model level as a primitive type. This type will be translated to
+ <emphasis>charPtr</emphasis> in your C sources.
+ <emphasis>charPtr</emphasis> is defined in
+ <emphasis>etDatatypes.h</emphasis>. This header file is platform specific (
+ <emphasis>generic</emphasis>). With this mechanism you can define your own type system on model level and map the model types to specific target/platform types.
+ </para>
+ <para>Add the following line in
+ <emphasis>CTypes.room</emphasis>:
+ </para>
+ <literallayout><code>PrimitiveType file:ptInteger -&gt; FILE default "0"
+</code></literallayout>
+ <blockquote>
+ <para></para>
+ </blockquote>
+ <para>
+ <emphasis>FILE</emphasis> is the native type for MinGW. Therefore you donÂīt need a mapping within
+ <emphasis>etDatatypes.h</emphasis>. If your model should be portable across different platforms you should not take this shortcut.
+ </para>
+ </section>
+ <section id="Createthemodel">
+ <title>Create the model</title>
+ <para>Due to the former tutorials you should be familiar with the steps to create the model with protocols, actors and state machines.</para>
+ <para>The basic idea of the exercise is to create a file reader actor, which is responsible to open, close and read characters from the source file. Another actor receives the characters and filters the comments (parser). The remaining characters (pure source code) should be print out. </para>
+ <para>Remember the logical steps:
+ - create the model by the help of content assist (CTRL Space)
+ - name the model, subsystem and top level actor
+ - define the protocol (in this case it should be able to send a char, and to request the next char from the file reader)
+ - create the structure (file reader and parser with an appropriate port, create the references and connect the ports)
+ - create the state machines</para>
+ <para>Try to create the model by yourself and take the following solution as an example.</para>
+ <para>Structure:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/036-RemoveCommentC04.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>File reader FSM:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/036-RemoveCommentC05.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>Parser FSM:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/036-RemoveCommentC06.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>Complete model:</para>
+ <literallayout><code>RoomModel RemoveComment {
+ import room.basic.types.c.* from "CTypes.room"
+ SubSystemClass RemoveCommentSubSys {
+ ActorRef Topref:ATop
+ }
+ ActorClass ATop {
+ Structure {
+ ActorRef reader: AFileReader
+ ActorRef cParser: ACParser
+ Binding reader.outPort and cParser.readerPort
+ }
+ Behavior { }
+ }
+ ActorClass AFileReader{
+ Interface {
+ Port outPort: FileReaderProtocol
+ }
+ Structure {
+ usercode3{"#include &lt;stdio.h&gt;"
+ }
+ external Port outPort
+ Attribute f:file ref
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -&gt; reading {
+ action {
+ "if ((f = fopen(\"test.txt\",\"r\")) != 0) {"
+ "\tprintf(\"file open ok !\\r\\n\");"
+ "\t}"
+ "\telse {"
+ "\tprintf(\"file not found !\\r\\n\");"
+ "\tSubSysClass_shutdown();"
+ "\t}"
+ }
+ }
+ Transition tr0: reading -&gt; reading {
+ triggers {
+ &lt;getNextChar: outPort&gt;
+ }
+ action {
+ "int8 c;"
+ "if ((c=fgetc(f)) != EOF) {"
+ "\toutPort.nextChar(c);"
+ "\t}"
+ "\telse {"
+ "\tfclose(f);"
+ "\tprintf(\"file closed !\\r\\n\");"
+ "\tSubSysClass_shutdown();"
+ "\t}"
+ }
+ }
+ State reading
+ }
+ }
+ }
+ ActorClass ACParser{
+ Interface {
+ conjugated Port readerPort: FileReaderProtocol
+ }
+ Structure {
+ external Port readerPort
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -&gt; code {
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr0: code -&gt; cp cp0 {
+ triggers {
+ &lt;nextChar: readerPort&gt;
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr1: cp cp0 -&gt; code {
+ action {
+ "printf(\"%c\",c);"
+ }
+ }
+ Transition tr2: cp cp0 -&gt; firstSlash {
+ cond {
+ "c==\'/\'"
+ }
+ }
+ Transition tr3: firstSlash -&gt; cp cp1 {
+ triggers {
+ &lt;nextChar: readerPort&gt;
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr4: cp cp1 -&gt; cp cp4
+ Transition tr5: cp cp1 -&gt; blockComment {
+ cond {
+ "c==\'*\'"
+ }
+ }
+ Transition tr6: blockComment -&gt; cp cp2 {
+ triggers {
+ &lt;nextChar: readerPort&gt;
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr7: cp cp2 -&gt; blockComment
+ Transition tr8: cp cp2 -&gt; firstStar {
+ cond {
+ "c==\'*\'"
+ }
+ }
+ Transition tr9: firstStar -&gt; cp cp3 {
+ triggers {
+ &lt;nextChar: readerPort&gt;
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr10: cp cp3 -&gt; blockComment
+ Transition tr11: cp cp3 -&gt; code {
+ cond {
+ "c==\'/\'"
+ }
+ }
+ Transition tr12: cp cp4 -&gt; code {
+ action {
+ "printf(\"%c%c\",\'/\',c);"
+ }
+ }
+ Transition tr13: cp cp4 -&gt; lineComment {
+ cond {
+ "c==\'/\'"
+ }
+ }
+ Transition tr14: cp cp5 -&gt; lineComment
+ Transition tr15: lineComment -&gt; cp cp5 {
+ triggers {
+ &lt;nextChar: readerPort&gt;
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr16: cp cp5 -&gt; code {
+ cond {
+ "c==\'\\n\'"
+ }
+ }
+ ChoicePoint cp0
+ ChoicePoint cp1
+ ChoicePoint cp2
+ ChoicePoint cp3
+ ChoicePoint cp4
+ ChoicePoint cp5
+ State code
+ State firstSlash
+ State blockComment
+ State firstStar
+ State lineComment
+ }
+ }
+ }
+
+ ProtocolClass FileReaderProtocol {
+ incoming {
+ Message getNextChar()
+ }
+ outgoing {
+ Message nextChar(c:char)
+ }
+ }
+}
+</code></literallayout>
+ <blockquote>
+ <para></para>
+ </blockquote>
+ <para>Take a look at the file attribute of the file reader. </para>
+ <literallayout><code>Attribute f:file ref
+</code></literallayout>
+ <blockquote>
+ <para></para>
+ </blockquote>
+ <para>
+ <emphasis>fopen</emphasis> expects a
+ <emphasis>FILE *</emphasis>.
+ <emphasis>f:file ref</emphasis> declares a variable
+ <emphasis>f</emphasis> from type reference to
+ <emphasis>file</emphasis>, which is a pointer to
+ <emphasis>FILE</emphasis>.
+ </para>
+ </section>
+ <section id="Generatebuildandrunthemodel">
+ <title>Generate, build and run the model</title>
+ <para>Before you can run the model you should copy one of the generated C source files into the project folder and name it
+ <emphasis>test.txt</emphasis>.
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/036-RemoveCommentC07.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>Generate, build and run the model.</para>
+ <para>Your output should start like this:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/036-RemoveCommentC08.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </section>
+ <section id="Summary5">
+ <title>Summary</title>
+ <para>This tutorial should help you to train the necessary steps to create a C model. By the way you have seen how to create your own type system for a real embedded project. An additional aspect was to show how simple it is to separate different aspects of the required functionality by the use of actors and protocols and make them reusable.</para>
+ </section>
+ </chapter>
+ <chapter id="ROOMConcepts">
+ <title>ROOM Concepts</title>
+ <para>This chapter gives an overview over the ROOM language elements and their textual and graphical notation.
+ The formal ROOM grammar based on Xtext (EBNF) you can find here:
+ <ulink url="http://git.eclipse.org/c/etrice/org.eclipse.etrice.git/tree/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext">ROOM Grammar</ulink>
+ </para>
<section id="Actors">
<title>Actors</title>
<section id="Description">
diff --git a/plugins/org.eclipse.etrice.doc/doc/034-getting-started_C.textile b/plugins/org.eclipse.etrice.doc/doc/034-getting-started_C.textile
index 4dd229b..3dd6f46 100644
--- a/plugins/org.eclipse.etrice.doc/doc/034-getting-started_C.textile
+++ b/plugins/org.eclipse.etrice.doc/doc/034-getting-started_C.textile
@@ -55,9 +55,7 @@ Creating the model is not the focus of this tutorial. Therefore copy and paste t
Recognize the C specific parts:
- Import CTypes instead of JavaTypes
- The action code contains C instead of Java. Later versions will contain a common action language, but for the moment the action language is target specific.
-- The application must be shutdown on model level (see also _etRuntimeConfig.h_)
-
-ToDo: shutdown must not depend on the subsystem.
+- The application must be shutdown on model level (see also _etRuntimeConfig.h_).
bc..
RoomModel HelloWorldCModel {
@@ -73,7 +71,7 @@ RoomModel HelloWorldCModel {
State state0 {
entry {
"printf(\"HelloWorldC !\\n\");"
- "HelloWorldCSubSysClass_shutdown();//exit(0);"
+ "SubSysClass_shutdown();"
"\t\t\t\t\t\t"
}
}
@@ -146,4 +144,5 @@ h2. Summary
You are now familiar with all necessary steps to create, build and run an eTrice C model from scratch. You are able to create a launch configuration to start the code generator and to perform all necessary settings to compile and link the application.
-The next tutorial provides an exercise to get more familiar with these working steps. \ No newline at end of file
+The next tutorial provides an exercise to get more familiar with these working steps.
+ \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.doc/doc/036-tutorial-remove-comment_C.textile b/plugins/org.eclipse.etrice.doc/doc/036-tutorial-remove-comment_C.textile
new file mode 100644
index 0000000..da55ab4
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/036-tutorial-remove-comment_C.textile
@@ -0,0 +1,297 @@
+h1. Tutorial Remove C-Comment ( C )
+
+h2. Scope
+
+In this tutorial you will create a more complex model. The model implements a simple parser that removes comments (block comments and line comments) from a C source file. Therefore we will create two actors. One actor is responsible to perform the file operations, whether the second actor implements the parser.
+
+You will perform the following steps:
+
+# create a new model from scratch for C
+# define a protocol
+# define your own data type
+# create the structure and the behavior by yourself
+# generate, build and run the model
+
+Make sure that you have set up the workspace as described in _Setting up the Workspace for C Projects_.
+
+h2. Create a new model from scratch
+
+Remember the following steps from the previous tutorials:
+- select the _C/C++_ perspective
+- From the main menue select _File->New->C Project_
+- Name the project _RemoveComment_
+- Project type is _Executable / Empty C Project_
+- Toolchain is _MinGW_
+- Add the folder _model_
+- Add the model file and name it _RemoveComment.room_
+- Add the Xtext nature.
+
+The workspace should look like this:
+
+!images/036-RemoveCommentC01.png!
+
+Create a launch configuration for the C generator and add the include path and library as described in _HelloWorldC_.
+
+The workspace should look like this:
+
+!images/036-RemoveCommentC02.png!
+
+Now the model is created and all settings for the code generator, compiler and linker are done.
+
+
+h2. Create your own data type
+
+The planed application should read a C source file and remove the comments. Therefore we need a file descriptor which is not part of the basic C types. The type for the file descriptor for MinGW is _FILE_. To make this type available on the model level, you have to declare the type in CTypes.room. To not interfere with other models, make a copy of _CTypes.room_ from _org.eclipse.modellib.c_ to your model folder.
+
+!images/036-RemoveCommentC03.png!
+
+Open _Ctypes.room_ and take a look at the declaration of _string_ (last line) which is not a basic C type.
+
+_PrimitiveType string:ptCharacter -> charPtr default "0"_
+
+With this declaration, you make the _string_ keyword available on model level as a primitive type. This type will be translated to _charPtr_ in your C sources. _charPtr_ is defined in _etDatatypes.h_. This header file is platform specific (_generic_). With this mechanism you can define your own type system on model level and map the model types to specific target/platform types.
+
+Add the following line in _CTypes.room_:
+
+bc..
+PrimitiveType file:ptInteger -> FILE default "0"
+bq.
+
+_FILE_ is the native type for MinGW. Therefore you donīt need a mapping within _etDatatypes.h_. If your model should be portable across different platforms you should not take this shortcut.
+
+h2. Create the model
+
+Due to the former tutorials you should be familiar with the steps to create the model with protocols, actors and state machines.
+
+The basic idea of the exercise is to create a file reader actor, which is responsible to open, close and read characters from the source file. Another actor receives the characters and filters the comments (parser). The remaining characters (pure source code) should be print out.
+
+Remember the logical steps:
+- create the model by the help of content assist (CTRL Space)
+- name the model, subsystem and top level actor
+- define the protocol (in this case it should be able to send a char, and to request the next char from the file reader)
+- create the structure (file reader and parser with an appropriate port, create the references and connect the ports)
+- create the state machines
+
+Try to create the model by yourself and take the following solution as an example.
+
+Structure:
+
+!images/036-RemoveCommentC04.png!
+
+File reader FSM:
+
+!images/036-RemoveCommentC05.png!
+
+Parser FSM:
+
+!images/036-RemoveCommentC06.png!
+
+Complete model:
+
+bc..
+RoomModel RemoveComment {
+ import room.basic.types.c.* from "CTypes.room"
+ SubSystemClass RemoveCommentSubSys {
+ ActorRef Topref:ATop
+ }
+ ActorClass ATop {
+ Structure {
+ ActorRef reader: AFileReader
+ ActorRef cParser: ACParser
+ Binding reader.outPort and cParser.readerPort
+ }
+ Behavior { }
+ }
+ ActorClass AFileReader{
+ Interface {
+ Port outPort: FileReaderProtocol
+ }
+ Structure {
+ usercode3{"#include <stdio.h>"
+ }
+ external Port outPort
+ Attribute f:file ref
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> reading {
+ action {
+ "if ((f = fopen(\"test.txt\",\"r\")) != 0) {"
+ "\tprintf(\"file open ok !\\r\\n\");"
+ "\t}"
+ "\telse {"
+ "\tprintf(\"file not found !\\r\\n\");"
+ "\tSubSysClass_shutdown();"
+ "\t}"
+ }
+ }
+ Transition tr0: reading -> reading {
+ triggers {
+ <getNextChar: outPort>
+ }
+ action {
+ "int8 c;"
+ "if ((c=fgetc(f)) != EOF) {"
+ "\toutPort.nextChar(c);"
+ "\t}"
+ "\telse {"
+ "\tfclose(f);"
+ "\tprintf(\"file closed !\\r\\n\");"
+ "\tSubSysClass_shutdown();"
+ "\t}"
+ }
+ }
+ State reading
+ }
+ }
+ }
+ ActorClass ACParser{
+ Interface {
+ conjugated Port readerPort: FileReaderProtocol
+ }
+ Structure {
+ external Port readerPort
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> code {
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr0: code -> cp cp0 {
+ triggers {
+ <nextChar: readerPort>
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr1: cp cp0 -> code {
+ action {
+ "printf(\"%c\",c);"
+ }
+ }
+ Transition tr2: cp cp0 -> firstSlash {
+ cond {
+ "c==\'/\'"
+ }
+ }
+ Transition tr3: firstSlash -> cp cp1 {
+ triggers {
+ <nextChar: readerPort>
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr4: cp cp1 -> cp cp4
+ Transition tr5: cp cp1 -> blockComment {
+ cond {
+ "c==\'*\'"
+ }
+ }
+ Transition tr6: blockComment -> cp cp2 {
+ triggers {
+ <nextChar: readerPort>
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr7: cp cp2 -> blockComment
+ Transition tr8: cp cp2 -> firstStar {
+ cond {
+ "c==\'*\'"
+ }
+ }
+ Transition tr9: firstStar -> cp cp3 {
+ triggers {
+ <nextChar: readerPort>
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr10: cp cp3 -> blockComment
+ Transition tr11: cp cp3 -> code {
+ cond {
+ "c==\'/\'"
+ }
+ }
+ Transition tr12: cp cp4 -> code {
+ action {
+ "printf(\"%c%c\",\'/\',c);"
+ }
+ }
+ Transition tr13: cp cp4 -> lineComment {
+ cond {
+ "c==\'/\'"
+ }
+ }
+ Transition tr14: cp cp5 -> lineComment
+ Transition tr15: lineComment -> cp cp5 {
+ triggers {
+ <nextChar: readerPort>
+ }
+ action {
+ "readerPort.getNextChar();"
+ }
+ }
+ Transition tr16: cp cp5 -> code {
+ cond {
+ "c==\'\\n\'"
+ }
+ }
+ ChoicePoint cp0
+ ChoicePoint cp1
+ ChoicePoint cp2
+ ChoicePoint cp3
+ ChoicePoint cp4
+ ChoicePoint cp5
+ State code
+ State firstSlash
+ State blockComment
+ State firstStar
+ State lineComment
+ }
+ }
+ }
+
+ ProtocolClass FileReaderProtocol {
+ incoming {
+ Message getNextChar()
+ }
+ outgoing {
+ Message nextChar(c:char)
+ }
+ }
+}
+bq.
+
+Take a look at the file attribute of the file reader.
+
+bc..
+Attribute f:file ref
+bq.
+
+_fopen_ expects a _FILE *_. _f:file ref_ declares a variable _f_ from type reference to _file_, which is a pointer to _FILE_.
+
+
+h2. Generate, build and run the model
+
+Before you can run the model you should copy one of the generated C source files into the project folder and name it _test.txt_.
+
+!images/036-RemoveCommentC07.png!
+
+Generate, build and run the model.
+
+Your output should start like this:
+
+!images/036-RemoveCommentC08.png!
+
+
+h2. Summary
+
+This tutorial should help you to train the necessary steps to create a C model. By the way you have seen how to create your own type system for a real embedded project. An additional aspect was to show how simple it is to separate different aspects of the required functionality by the use of actors and protocols and make them reusable.
+
diff --git a/plugins/org.eclipse.etrice.doc/doc/etrice-index.txt b/plugins/org.eclipse.etrice.doc/doc/etrice-index.txt
index 785a293..6691874 100644
--- a/plugins/org.eclipse.etrice.doc/doc/etrice-index.txt
+++ b/plugins/org.eclipse.etrice.doc/doc/etrice-index.txt
@@ -9,5 +9,6 @@
030-tutorial-ped-lights.textile
032-Setting-up-the-Workspace_C.textile
034-getting-started_C.textile
+036-tutorial-remove-comment_C.textile
040-room-concepts.textile
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC01.png b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC01.png
new file mode 100644
index 0000000..6649d44
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC01.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC02.png b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC02.png
new file mode 100644
index 0000000..2db8c38
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC02.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC03.png b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC03.png
new file mode 100644
index 0000000..4c2eff6
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC03.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC04.png b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC04.png
new file mode 100644
index 0000000..4e653c8
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC04.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC05.png b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC05.png
new file mode 100644
index 0000000..d13bb83
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC05.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC06.png b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC06.png
new file mode 100644
index 0000000..eaadb73
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC06.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC07.png b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC07.png
new file mode 100644
index 0000000..050ea63
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC07.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC08.png b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC08.png
new file mode 100644
index 0000000..1fc9ca1
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/036-RemoveCommentC08.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/help/Buildandrunthemodel.html b/plugins/org.eclipse.etrice.doc/help/Buildandrunthemodel.html
index 23dd953..a9eb29c 100644
--- a/plugins/org.eclipse.etrice.doc/help/Buildandrunthemodel.html
+++ b/plugins/org.eclipse.etrice.doc/help/Buildandrunthemodel.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldJava.html" title="Tutorial HelloWorld (Java)">
+<link rel="up" href="TutorialHelloWorldforJava.html" title="Tutorial HelloWorld for Java">
<link rel="prev" href="Createastatemachine.html" title="Create a state machine">
<link rel="next" href="OpentheMessageSequenceChart.html" title="Open the Message Sequence Chart">
</head>
diff --git a/plugins/org.eclipse.etrice.doc/help/Buildandrunthemodel2.html b/plugins/org.eclipse.etrice.doc/help/Buildandrunthemodel2.html
index ea2c524..548c79f 100644
--- a/plugins/org.eclipse.etrice.doc/help/Buildandrunthemodel2.html
+++ b/plugins/org.eclipse.etrice.doc/help/Buildandrunthemodel2.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="TutorialHelloWorldforC.html" title="Tutorial HelloWorld for C">
<link rel="prev" href="Setuptheincludepath.html" title="Setup the include path">
<link rel="next" href="Summary4.html" title="Summary">
</head>
diff --git a/plugins/org.eclipse.etrice.doc/help/CreatealaunchconfigurationtostarttheCcodegenerator.html b/plugins/org.eclipse.etrice.doc/help/CreatealaunchconfigurationtostarttheCcodegenerator.html
index 5bc1ac9..ebb1d2c 100644
--- a/plugins/org.eclipse.etrice.doc/help/CreatealaunchconfigurationtostarttheCcodegenerator.html
+++ b/plugins/org.eclipse.etrice.doc/help/CreatealaunchconfigurationtostarttheCcodegenerator.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="TutorialHelloWorldforC.html" title="Tutorial HelloWorld for C">
<link rel="prev" href="CreatetheHelloWorldmodel.html" title="Create the HelloWorld model">
<link rel="next" href="Generatethecode.html" title="Generate the code">
</head>
diff --git a/plugins/org.eclipse.etrice.doc/help/Createanewmodelfromscratch.html b/plugins/org.eclipse.etrice.doc/help/Createanewmodelfromscratch.html
index 30c4ad1..b303120 100644
--- a/plugins/org.eclipse.etrice.doc/help/Createanewmodelfromscratch.html
+++ b/plugins/org.eclipse.etrice.doc/help/Createanewmodelfromscratch.html
@@ -5,8 +5,8 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldJava.html" title="Tutorial HelloWorld (Java)">
-<link rel="prev" href="TutorialHelloWorldJava.html" title="Tutorial HelloWorld (Java)">
+<link rel="up" href="TutorialHelloWorldforJava.html" title="Tutorial HelloWorld for Java">
+<link rel="prev" href="TutorialHelloWorldforJava.html" title="Tutorial HelloWorld for Java">
<link rel="next" href="Createastatemachine.html" title="Create a state machine">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
diff --git a/plugins/org.eclipse.etrice.doc/help/Createanewmodelfromscratch4.html b/plugins/org.eclipse.etrice.doc/help/Createanewmodelfromscratch4.html
index d759ed6..a975042 100644
--- a/plugins/org.eclipse.etrice.doc/help/Createanewmodelfromscratch4.html
+++ b/plugins/org.eclipse.etrice.doc/help/Createanewmodelfromscratch4.html
@@ -5,8 +5,8 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
-<link rel="prev" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="TutorialHelloWorldforC.html" title="Tutorial HelloWorld for C">
+<link rel="prev" href="TutorialHelloWorldforC.html" title="Tutorial HelloWorld for C">
<link rel="next" href="CreatetheHelloWorldmodel.html" title="Create the HelloWorld model">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -21,7 +21,7 @@
</div>
</div>
<p>Before you can create a new C-model, you have to create a new C project as described in
- <span class="emphasis"><em>Setting up the workspace ( C )</em></span>.
+ <span class="emphasis"><em>Setting up the Workspace for C Projects</em></span>.
Remember:
- select the
<span class="emphasis"><em>C/C++</em></span> perspective
diff --git a/plugins/org.eclipse.etrice.doc/help/Createastatemachine.html b/plugins/org.eclipse.etrice.doc/help/Createastatemachine.html
index a4cfc83..10494a7 100644
--- a/plugins/org.eclipse.etrice.doc/help/Createastatemachine.html
+++ b/plugins/org.eclipse.etrice.doc/help/Createastatemachine.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldJava.html" title="Tutorial HelloWorld (Java)">
+<link rel="up" href="TutorialHelloWorldforJava.html" title="Tutorial HelloWorld for Java">
<link rel="prev" href="Createanewmodelfromscratch.html" title="Create a new model from scratch">
<link rel="next" href="Buildandrunthemodel.html" title="Build and run the model">
</head>
diff --git a/plugins/org.eclipse.etrice.doc/help/CreatetheHelloWorldmodel.html b/plugins/org.eclipse.etrice.doc/help/CreatetheHelloWorldmodel.html
index 0405c7c..164749a 100644
--- a/plugins/org.eclipse.etrice.doc/help/CreatetheHelloWorldmodel.html
+++ b/plugins/org.eclipse.etrice.doc/help/CreatetheHelloWorldmodel.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="TutorialHelloWorldforC.html" title="Tutorial HelloWorld for C">
<link rel="prev" href="Createanewmodelfromscratch4.html" title="Create a new model from scratch">
<link rel="next" href="CreatealaunchconfigurationtostarttheCcodegenerator.html" title="Create a launch configuration to start the C code generator">
</head>
@@ -26,9 +26,8 @@
- Import CTypes instead of JavaTypes
- The action code contains C instead of Java. Later versions will contain a common action language, but for the moment the action language is target specific.
- The application must be shutdown on model level (see also
- <span class="emphasis"><em>etRuntimeConfig.h</em></span>)
+ <span class="emphasis"><em>etRuntimeConfig.h</em></span>).
</p>
-<p>ToDo: shutdown must not depend on the subsystem.</p>
<div class="literallayout">
<p>
<code class="code">RoomModel&nbsp;HelloWorldCModel&nbsp;{<br>
@@ -44,7 +43,7 @@
State&nbsp;state0&nbsp;{<br>
entry&nbsp;{<br>
"printf(\"HelloWorldC&nbsp;!\\n\");"<br>
- "HelloWorldCSubSysClass_shutdown();//exit(0);"<br>
+ "SubSysClass_shutdown();"<br>
"\t\t\t\t\t\t"<br>
}<br>
}<br>
diff --git a/plugins/org.eclipse.etrice.doc/help/DataClass.html b/plugins/org.eclipse.etrice.doc/help/DataClass.html
index fddb2f5..3516841 100644
--- a/plugins/org.eclipse.etrice.doc/help/DataClass.html
+++ b/plugins/org.eclipse.etrice.doc/help/DataClass.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="ROOMConcepts.html" title="ROOM Concepts">
<link rel="prev" href="Ports.html" title="Ports">
<link rel="next" href="Layering2.html" title="Layering">
</head>
diff --git a/plugins/org.eclipse.etrice.doc/help/FiniteStateMachines.html b/plugins/org.eclipse.etrice.doc/help/FiniteStateMachines.html
index 127a882..5a22092 100644
--- a/plugins/org.eclipse.etrice.doc/help/FiniteStateMachines.html
+++ b/plugins/org.eclipse.etrice.doc/help/FiniteStateMachines.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="ROOMConcepts.html" title="ROOM Concepts">
<link rel="prev" href="Layering2.html" title="Layering">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -70,7 +70,7 @@
</div>
</div>
<p>The simpler flat finite state machines are composed of the following elements:</p>
-<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10F0A">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N11019">
<tr>
<td align="center">
@@ -184,7 +184,7 @@
</div>
<p>The hierarchical finite state machine adds the notion of a sub state machine nested in a state.
A few modeling elements are added to the set listed above:</p>
-<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10FC9">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N110D8">
<tr>
<td align="center">
diff --git a/plugins/org.eclipse.etrice.doc/help/Generatethecode.html b/plugins/org.eclipse.etrice.doc/help/Generatethecode.html
index 0b26d62..28a19d9 100644
--- a/plugins/org.eclipse.etrice.doc/help/Generatethecode.html
+++ b/plugins/org.eclipse.etrice.doc/help/Generatethecode.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="TutorialHelloWorldforC.html" title="Tutorial HelloWorld for C">
<link rel="prev" href="CreatealaunchconfigurationtostarttheCcodegenerator.html" title="Create a launch configuration to start the C code generator">
<link rel="next" href="Setuptheincludepath.html" title="Setup the include path">
</head>
@@ -20,7 +20,7 @@
</div>
</div>
</div>
-<p>Now you can generate the code as you know it from Java. Right click to the launch configuration and run it as _gen_HelloWorldC_.</p>
+<p>Now you can generate the code as you know it from Java. Right click on the launch configuration and run it as _gen_HelloWorldC_.</p>
<p>
</p>
diff --git a/plugins/org.eclipse.etrice.doc/help/Layering2.html b/plugins/org.eclipse.etrice.doc/help/Layering2.html
index f094f39..acbcbff 100644
--- a/plugins/org.eclipse.etrice.doc/help/Layering2.html
+++ b/plugins/org.eclipse.etrice.doc/help/Layering2.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="ROOMConcepts.html" title="ROOM Concepts">
<link rel="prev" href="DataClass.html" title="DataClass">
<link rel="next" href="FiniteStateMachines.html" title="Finite State Machines">
</head>
@@ -53,7 +53,7 @@
</div>
</div>
</div>
-<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10E5A">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10F69">
<tr>
<td align="center">
diff --git a/plugins/org.eclipse.etrice.doc/help/OpentheMessageSequenceChart.html b/plugins/org.eclipse.etrice.doc/help/OpentheMessageSequenceChart.html
index 580b166..792ea73 100644
--- a/plugins/org.eclipse.etrice.doc/help/OpentheMessageSequenceChart.html
+++ b/plugins/org.eclipse.etrice.doc/help/OpentheMessageSequenceChart.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldJava.html" title="Tutorial HelloWorld (Java)">
+<link rel="up" href="TutorialHelloWorldforJava.html" title="Tutorial HelloWorld for Java">
<link rel="prev" href="Buildandrunthemodel.html" title="Build and run the model">
<link rel="next" href="Summary.html" title="Summary">
</head>
diff --git a/plugins/org.eclipse.etrice.doc/help/Ports.html b/plugins/org.eclipse.etrice.doc/help/Ports.html
index 8e52220..e81373a 100644
--- a/plugins/org.eclipse.etrice.doc/help/Ports.html
+++ b/plugins/org.eclipse.etrice.doc/help/Ports.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="ROOMConcepts.html" title="ROOM Concepts">
<link rel="prev" href="Protocols.html" title="Protocols">
<link rel="next" href="DataClass.html" title="DataClass">
</head>
@@ -111,7 +111,7 @@
</li>
</ul>
</div>
-<table title="Class Port Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10C5F">
+<table title="Class Port Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10D6E">
<tr>
<td align="center">
@@ -309,7 +309,7 @@
</div>
</div>
<p>These symbols can only appear on the border of an ActorReference symbol. Since the type of port is defined in the ActorClass, no textual notation for the Reference Ports exists.</p>
-<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10D97">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10EA6">
<tr>
<td align="center">
diff --git a/plugins/org.eclipse.etrice.doc/help/Protocols.html b/plugins/org.eclipse.etrice.doc/help/Protocols.html
index f49ff31..92caf7c 100644
--- a/plugins/org.eclipse.etrice.doc/help/Protocols.html
+++ b/plugins/org.eclipse.etrice.doc/help/Protocols.html
@@ -5,8 +5,8 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
-<link rel="prev" href="Actors.html" title="Actors">
+<link rel="up" href="ROOMConcepts.html" title="ROOM Concepts">
+<link rel="prev" href="ROOMConcepts.html" title="ROOM Concepts">
<link rel="next" href="Ports.html" title="Ports">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
diff --git a/plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceC.html b/plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceC.html
deleted file mode 100644
index f8e3186..0000000
--- a/plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceC.html
+++ /dev/null
@@ -1,134 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Setting up the Workspace ( C )</title>
-<link href="book.css" rel="stylesheet" type="text/css">
-<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
-<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="index.html" title="eTrice User Guide">
-<link rel="prev" href="Whydoesitworkandwhyisitsafe.html" title="Why does it work and why is it safe?">
-<link rel="next" href="BuildingtheCruntimesystem.html" title="Building the C runtime system">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<h1 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">Setting up the Workspace ( C )</h1>
-<div class="chapter" title="Setting up the Workspace ( C )">
-<div class="titlepage">
-<div>
-<div>
-<h2 class="title">
-<a name="SettinguptheWorkspaceC"></a>Setting up the Workspace ( C )</h2>
-</div>
-</div>
-</div>
-<div class="toc">
-<dl>
-<dt>
-<span class="section"><a href="SettinguptheWorkspaceC.html#Testingtheenvironment">Testing the environment</a></span>
-</dt>
-<dt>
-<span class="section"><a href="BuildingtheCruntimesystem.html">Building the C runtime system</a></span>
-</dt>
-</dl>
-</div>
-<p>Before you can start with C, some preconditions must be fulfilled:</p>
-<p>- A C compiler must be installed on your machine (all tests and tutorials are based on MinGW)
- - The CDT-Eclipse plug in must be installed as the C development environment.</p>
-<p>Once the CDT is installed, the C runtime and model library must be imported.
- (
- <span class="emphasis"><em>File-&gt;New-&gt;Project-&gt;eTrice</em></span> select
- <span class="emphasis"><em>eTrice C runtime</em></span> /
- <span class="emphasis"><em>eTrice C modellib</em></span>)
- </p>
-<p>The resulting workspace should look like this:</p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/032-SetupWorkspaceC01.png"></div>
-<p>
-
-</p>
-<div class="section" title="Testing the environment">
-<div class="titlepage">
-<div>
-<div>
-<h2 class="title" style="clear: both">
-<a name="Testingtheenvironment"></a>Testing the environment</h2>
-</div>
-</div>
-</div>
-<p>To verify the C tool chain you should generate and run the Hello World example program of the CDT.
- Activate the
- <span class="emphasis"><em>C/C++</em></span> perspective.
- </p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/032-SetupWorkspaceC03.png"></div>
-<p>
-
-</p>
-<p>From the main menu select
- <span class="emphasis"><em>File-&gt;New-&gt;C Project</em></span>.
- </p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/032-SetupWorkspaceC02.png"></div>
-<p>
-
-</p>
-<p>Name the Project. Select an
- <span class="emphasis"><em>Executable-&gt;Hello World ANSI C</em></span> as Project type,
- <span class="emphasis"><em>MinGW GCC</em></span> as Tool chain and click
- <span class="emphasis"><em>Finish</em></span>.
- </p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/032-SetupWorkspaceC04.png"></div>
-<p>
-
-</p>
-<p>Select the new project and click the build button (or right click the project and select
- <span class="emphasis"><em>Build Project</em></span>)
- </p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/032-SetupWorkspaceC05.png"></div>
-<p>
-
-</p>
-<p>The binary should be generated. Run the binary as
- <span class="emphasis"><em>Local C/C++ Application</em></span>
-
-</p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/032-SetupWorkspaceC06.png"></div>
-<p>
-
-</p>
-<p>Verify the output.</p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/032-SetupWorkspaceC07.png"></div>
-<p>
-
-</p>
-<p>Remember these steps. In the following Tutorials these steps will be referenced as
- <span class="emphasis"><em>build and run</em></span>.
- </p>
-</div>
-</div>
-</body>
-</html>
diff --git a/plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceJava.html b/plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceJava.html
deleted file mode 100644
index 84a721d..0000000
--- a/plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceJava.html
+++ /dev/null
@@ -1,129 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Setting up the Workspace (Java)</title>
-<link href="book.css" rel="stylesheet" type="text/css">
-<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
-<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="index.html" title="eTrice User Guide">
-<link rel="prev" href="WorkingwiththeeTriceTutorials.html" title="Working with the eTrice Tutorials">
-<link rel="next" href="TutorialHelloWorldJava.html" title="Tutorial HelloWorld (Java)">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<h1 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">Setting up the Workspace (Java)</h1>
-<div class="chapter" title="Setting up the Workspace (Java)">
-<div class="titlepage">
-<div>
-<div>
-<h2 class="title">
-<a name="SettinguptheWorkspaceJava"></a>Setting up the Workspace (Java)</h2>
-</div>
-</div>
-</div>
-<p>ETrice generates code out of ROOM models. The code generator and the generated code relies on a runtime framework and on some ready to use model parts. This parts provide services like:</p>
-<div class="itemizedlist">
-<ul class="itemizedlist" type="disc">
-<li class="listitem">
-<p>messaging</p>
-</li>
-<li class="listitem">
-<p>logging</p>
-</li>
-<li class="listitem">
-<p>timing</p>
-</li>
-</ul>
-</div>
-<p>Additionally some tutorial models will be provided to make it easy to start with eTrice. All this parts must be available in our workspace before you can start working. After installation of eclipse (juno) and the eTrice plug in, your workspace should look like this: </p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/013-SetupWorkspace01.png"></div>
-<p>
-
-</p>
-<p>Just the
- <span class="emphasis"><em>eTrice</em></span> menu item is visible from the eTrice tool.
- From the
- <span class="emphasis"><em>File</em></span> menu select
- <span class="emphasis"><em>File-&gt;New-&gt;Project</em></span>
-
-</p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/013-SetupWorkspace02.png"></div>
-<p>
-
-</p>
-<p>Open the
- <span class="emphasis"><em>eTrice</em></span> tab and select
- <span class="emphasis"><em>eTrice Java Runtime</em></span>
-
-</p>
-<p>Press
- <span class="emphasis"><em>Next</em></span> and
- <span class="emphasis"><em>Finish</em></span> to install the Runtime into your workspace.
- </p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/013-SetupWorkspace03.png"></div>
-<p>
-
-</p>
-<p>Do the same steps for
- <span class="emphasis"><em>eTrice Java Modellib</em></span> and
- <span class="emphasis"><em>eTrice Java Tutorials</em></span>. To avoid temporary error markers you should keep the proposed order of installation. The resulting workspace should look like this:
- </p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/013-SetupWorkspace04.png"></div>
-<p>
-
-</p>
-<p>Now workspace is set up and you can perform the tutorials or start with your work.</p>
-<p>The tutorial models are available in the
- <span class="emphasis"><em>org.eclipse.etrice.tutorials</em></span> project. All tutorials are ready to generate and run without any changes. To start the code generator simply run
- <span class="bold"><strong>gen_org.eclipse.etrice.tutorials.launch</strong></span> as
- <span class="bold"><strong>gen_org.eclipse.etrice.tutorials.launch</strong></span>:
- </p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/013-SetupWorkspace05.png"></div>
-<p>
-
-</p>
-<p>After generation for each tutorial a java file called
- <span class="bold"><strong>SubSystem_ModelnameRunner.java</strong></span> is generated. To run the model simply run this file as a java application:
- </p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/013-SetupWorkspace06.png"></div>
-<p>
-
-</p>
-<p>To stop the application type
- <span class="emphasis"><em>quit</em></span> in the console window.
- </p>
-<p>
-
-</p>
-<div class="mediaobject">
-<img src="images/013-SetupWorkspace07.png"></div>
-<p>
-
-</p>
-<p>Performing the tutorials will setup an dedicated project for each tutorial. Therefore there are some slight changes especially whenever a path must be set (e.g. to the model library) within your own projects. All this is described in the tutorials.</p>
-</div>
-</body>
-</html>
diff --git a/plugins/org.eclipse.etrice.doc/help/Setuptheincludepath.html b/plugins/org.eclipse.etrice.doc/help/Setuptheincludepath.html
index 30009b5..5ce646b 100644
--- a/plugins/org.eclipse.etrice.doc/help/Setuptheincludepath.html
+++ b/plugins/org.eclipse.etrice.doc/help/Setuptheincludepath.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="TutorialHelloWorldforC.html" title="Tutorial HelloWorld for C">
<link rel="prev" href="Generatethecode.html" title="Generate the code">
<link rel="next" href="Buildandrunthemodel2.html" title="Build and run the model">
</head>
diff --git a/plugins/org.eclipse.etrice.doc/help/Summary.html b/plugins/org.eclipse.etrice.doc/help/Summary.html
index dfdbee9..fbb6888 100644
--- a/plugins/org.eclipse.etrice.doc/help/Summary.html
+++ b/plugins/org.eclipse.etrice.doc/help/Summary.html
@@ -5,7 +5,7 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldJava.html" title="Tutorial HelloWorld (Java)">
+<link rel="up" href="TutorialHelloWorldforJava.html" title="Tutorial HelloWorld for Java">
<link rel="prev" href="OpentheMessageSequenceChart.html" title="Open the Message Sequence Chart">
<link rel="next" href="TutorialBlinkyJava.html" title="Tutorial Blinky (Java)">
</head>
diff --git a/plugins/org.eclipse.etrice.doc/help/Summary4.html b/plugins/org.eclipse.etrice.doc/help/Summary4.html
index 37643db..8eaf2a4 100644
--- a/plugins/org.eclipse.etrice.doc/help/Summary4.html
+++ b/plugins/org.eclipse.etrice.doc/help/Summary4.html
@@ -5,9 +5,9 @@
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
+<link rel="up" href="TutorialHelloWorldforC.html" title="Tutorial HelloWorld for C">
<link rel="prev" href="Buildandrunthemodel2.html" title="Build and run the model">
-<link rel="next" href="Actors.html" title="Actors">
+<link rel="next" href="TutorialRemoveCCommentC.html" title="Tutorial Remove C-Comment ( C )">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<h1 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">Summary</h1>
@@ -21,13 +21,7 @@
</div>
</div>
<p>You are now familiar with all necessary steps to create, build and run an eTrice C model from scratch. You are able to create a launch configuration to start the code generator and to perform all necessary settings to compile and link the application. </p>
-<p>The next tutorial provides an exercise to get more familiar with these working steps.
- h1. ROOM Concepts</p>
-<p>This chapter gives an overview over the ROOM language elements and their textual and graphical notation.
- The formal ROOM grammar based on Xtext (EBNF) you can find here:
- <a class="ulink" href="http://git.eclipse.org/c/etrice/org.eclipse.etrice.git/tree/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext" target="_new">ROOM Grammar</a>
-
-</p>
+<p>The next tutorial provides an exercise to get more familiar with these working steps.</p>
</div>
</body>
</html>
diff --git a/plugins/org.eclipse.etrice.doc/help/TutorialHelloWorldC.html b/plugins/org.eclipse.etrice.doc/help/TutorialHelloWorldC.html
deleted file mode 100644
index bae1158..0000000
--- a/plugins/org.eclipse.etrice.doc/help/TutorialHelloWorldC.html
+++ /dev/null
@@ -1,108 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Tutorial HelloWorld ( C )</title>
-<link href="book.css" rel="stylesheet" type="text/css">
-<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
-<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="index.html" title="eTrice User Guide">
-<link rel="prev" href="BuildingtheCruntimesystem.html" title="Building the C runtime system">
-<link rel="next" href="Createanewmodelfromscratch4.html" title="Create a new model from scratch">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<h1 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">Tutorial HelloWorld ( C )</h1>
-<div class="chapter" title="Tutorial HelloWorld ( C )">
-<div class="titlepage">
-<div>
-<div>
-<h2 class="title">
-<a name="TutorialHelloWorldC"></a>Tutorial HelloWorld ( C )</h2>
-</div>
-</div>
-</div>
-<div class="toc">
-<dl>
-<dt>
-<span class="section"><a href="TutorialHelloWorldC.html#Scope5">Scope</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Createanewmodelfromscratch4.html">Create a new model from scratch</a></span>
-</dt>
-<dt>
-<span class="section"><a href="CreatetheHelloWorldmodel.html">Create the HelloWorld model</a></span>
-</dt>
-<dt>
-<span class="section"><a href="CreatealaunchconfigurationtostarttheCcodegenerator.html">Create a launch configuration to start the C code generator</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Generatethecode.html">Generate the code</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Setuptheincludepath.html">Setup the include path</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Buildandrunthemodel2.html">Build and run the model</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Summary4.html">Summary</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Actors.html">Actors</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Protocols.html">Protocols</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Ports.html">Ports</a></span>
-</dt>
-<dt>
-<span class="section"><a href="DataClass.html">DataClass</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Layering2.html">Layering</a></span>
-</dt>
-<dt>
-<span class="section"><a href="FiniteStateMachines.html">Finite State Machines</a></span>
-</dt>
-</dl>
-</div>
-<div class="section" title="Scope">
-<div class="titlepage">
-<div>
-<div>
-<h2 class="title" style="clear: both">
-<a name="Scope5"></a>Scope</h2>
-</div>
-</div>
-</div>
-<p>In this tutorial you will learn how to create a model for C from scratch. There are some more steps to do in C as in Java. The goal is to get familiar with the additional steps. The Java tutorial is a prerequisite for the following explanations.
- You will perform the following steps:</p>
-<div class="orderedlist">
-<ol class="orderedlist" type="1">
-<li class="listitem">
-<p>create a new model from scratch for C</p>
-</li>
-<li class="listitem">
-<p>create structure and behavior similar to Java</p>
-</li>
-<li class="listitem">
-<p>create a launch configuration for the C code generator</p>
-</li>
-<li class="listitem">
-<p>setup the C environment</p>
-</li>
-<li class="listitem">
-<p>generate the source code</p>
-</li>
-<li class="listitem">
-<p>run the model</p>
-</li>
-</ol>
-</div>
-<p>Make sure that you have set up the workspace as described in
- <span class="emphasis"><em>Setting up the workspace ( C )</em></span>.
- </p>
-</div>
-</div>
-</body>
-</html>
diff --git a/plugins/org.eclipse.etrice.doc/help/TutorialHelloWorldJava.html b/plugins/org.eclipse.etrice.doc/help/TutorialHelloWorldJava.html
deleted file mode 100644
index aaf5e95..0000000
--- a/plugins/org.eclipse.etrice.doc/help/TutorialHelloWorldJava.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Tutorial HelloWorld (Java)</title>
-<link href="book.css" rel="stylesheet" type="text/css">
-<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
-<link rel="home" href="index.html" title="eTrice User Guide">
-<link rel="up" href="index.html" title="eTrice User Guide">
-<link rel="prev" href="SettinguptheWorkspaceJava.html" title="Setting up the Workspace (Java)">
-<link rel="next" href="Createanewmodelfromscratch.html" title="Create a new model from scratch">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<h1 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">Tutorial HelloWorld (Java)</h1>
-<div class="chapter" title="Tutorial HelloWorld (Java)">
-<div class="titlepage">
-<div>
-<div>
-<h2 class="title">
-<a name="TutorialHelloWorldJava"></a>Tutorial HelloWorld (Java)</h2>
-</div>
-</div>
-</div>
-<div class="toc">
-<dl>
-<dt>
-<span class="section"><a href="TutorialHelloWorldJava.html#Scope">Scope</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Createanewmodelfromscratch.html">Create a new model from scratch</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Createastatemachine.html">Create a state machine</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Buildandrunthemodel.html">Build and run the model</a></span>
-</dt>
-<dt>
-<span class="section"><a href="OpentheMessageSequenceChart.html">Open the Message Sequence Chart</a></span>
-</dt>
-<dt>
-<span class="section"><a href="Summary.html">Summary</a></span>
-</dt>
-</dl>
-</div>
-<div class="section" title="Scope">
-<div class="titlepage">
-<div>
-<div>
-<h2 class="title" style="clear: both">
-<a name="Scope"></a>Scope</h2>
-</div>
-</div>
-</div>
-<p>In this tutorial you will build your first very simple eTrice model. The goal is to learn the work flow of eTrice and to understand a few basic features of ROOM. You will perform the following steps:</p>
-<div class="orderedlist">
-<ol class="orderedlist" type="1">
-<li class="listitem">
-<p>create a new model from scratch</p>
-</li>
-<li class="listitem">
-<p>add a very simple state machine to an actor</p>
-</li>
-<li class="listitem">
-<p>generate the source code</p>
-</li>
-<li class="listitem">
-<p>run the model</p>
-</li>
-<li class="listitem">
-<p>open the message sequence chart</p>
-</li>
-</ol>
-</div>
-<p>Make sure that you have set up the workspace as described in
- <span class="emphasis"><em>Setting up the workspace</em></span>.
- </p>
-<p>
-
-<a class="ulink" href="http://eclipse.org/etrice/images/015-HelloWorld01.avi" target="_new">video hello world</a>
-
-</p>
-</div>
-</div>
-</body>
-</html>
diff --git a/plugins/org.eclipse.etrice.doc/help/Whydoesitworkandwhyisitsafe.html b/plugins/org.eclipse.etrice.doc/help/Whydoesitworkandwhyisitsafe.html
index a489455..1659eea 100644
--- a/plugins/org.eclipse.etrice.doc/help/Whydoesitworkandwhyisitsafe.html
+++ b/plugins/org.eclipse.etrice.doc/help/Whydoesitworkandwhyisitsafe.html
@@ -7,7 +7,7 @@
<link rel="home" href="index.html" title="eTrice User Guide">
<link rel="up" href="TutorialPedestrianLightsJava.html" title="Tutorial Pedestrian Lights (Java)">
<link rel="prev" href="Setupthemodel.html" title="Setup the model">
-<link rel="next" href="SettinguptheWorkspaceC.html" title="Setting up the Workspace ( C )">
+<link rel="next" href="SettinguptheWorkspaceforCProjects.html" title="Setting up the Workspace for C Projects">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<h1 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">Why does it work and why is it safe?</h1>
diff --git a/plugins/org.eclipse.etrice.doc/help/WorkingwiththeeTriceTutorials.html b/plugins/org.eclipse.etrice.doc/help/WorkingwiththeeTriceTutorials.html
index 4e74857..52cf8cf 100644
--- a/plugins/org.eclipse.etrice.doc/help/WorkingwiththeeTriceTutorials.html
+++ b/plugins/org.eclipse.etrice.doc/help/WorkingwiththeeTriceTutorials.html
@@ -7,7 +7,7 @@
<link rel="home" href="index.html" title="eTrice User Guide">
<link rel="up" href="index.html" title="eTrice User Guide">
<link rel="prev" href="ExecutionModels.html" title="Execution Models">
-<link rel="next" href="SettinguptheWorkspaceJava.html" title="Setting up the Workspace (Java)">
+<link rel="next" href="SettinguptheWorkspaceforJavaProjects.html" title="Setting up the Workspace for Java Projects">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<h1 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">Working with the eTrice Tutorials</h1>
@@ -20,9 +20,9 @@
</div>
</div>
</div>
-<p>The eTrice Tutorials will help you to learn and understand the eTrice Tool and concepts. ETrice supports several target languages. The concepts will not be explained in each language. </p>
+<p>The eTrice Tutorials will help you to learn and understand the eTrice tool and concepts. ETrice supports several target languages. The concepts will not be explained for each language. </p>
<p>Most of the common concepts will be described for Java as target language. To start with a new language the first steps to setup the workspace and to generate and run the first model will be described also. Target language specific aspects will be described as well.</p>
-<p>Therefore the best way to start with eTrice is to perform the Java Tutorials and after that switch to your target language. </p>
+<p>Therefore the best way to start with eTrice is to follow the Java Tutorials and after that switch to your target language. </p>
</div>
</body>
</html>
diff --git a/plugins/org.eclipse.etrice.doc/html/etrice.html b/plugins/org.eclipse.etrice.doc/html/etrice.html
index 80cf207..763c40d 100644
--- a/plugins/org.eclipse.etrice.doc/html/etrice.html
+++ b/plugins/org.eclipse.etrice.doc/html/etrice.html
@@ -54,10 +54,10 @@
<span class="chapter"><a href="#WorkingwiththeeTriceTutorials">3. Working with the eTrice Tutorials</a></span>
</dt>
<dt>
-<span class="chapter"><a href="#SettinguptheWorkspaceJava">4. Setting up the Workspace (Java)</a></span>
+<span class="chapter"><a href="#SettinguptheWorkspaceforJavaProjects">4. Setting up the Workspace for Java Projects</a></span>
</dt>
<dt>
-<span class="chapter"><a href="#TutorialHelloWorldJava">5. Tutorial HelloWorld (Java)</a></span>
+<span class="chapter"><a href="#TutorialHelloWorldforJava">5. Tutorial HelloWorld for Java</a></span>
</dt>
<dd>
<dl>
@@ -163,7 +163,7 @@
</dl>
</dd>
<dt>
-<span class="chapter"><a href="#SettinguptheWorkspaceC">9. Setting up the Workspace ( C )</a></span>
+<span class="chapter"><a href="#SettinguptheWorkspaceforCProjects">9. Setting up the Workspace for C Projects</a></span>
</dt>
<dd>
<dl>
@@ -176,7 +176,7 @@
</dl>
</dd>
<dt>
-<span class="chapter"><a href="#TutorialHelloWorldC">10. Tutorial HelloWorld ( C )</a></span>
+<span class="chapter"><a href="#TutorialHelloWorldforC">10. Tutorial HelloWorld for C</a></span>
</dt>
<dd>
<dl>
@@ -204,6 +204,38 @@
<dt>
<span class="section"><a href="#Summary4">Summary</a></span>
</dt>
+</dl>
+</dd>
+<dt>
+<span class="chapter"><a href="#TutorialRemoveCCommentC">11. Tutorial Remove C-Comment ( C )</a></span>
+</dt>
+<dd>
+<dl>
+<dt>
+<span class="section"><a href="#Scope6">Scope</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Createanewmodelfromscratch5">Create a new model from scratch</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Createyourowndatatype">Create your own data type</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Createthemodel">Create the model</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Generatebuildandrunthemodel">Generate, build and run the model</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Summary5">Summary</a></span>
+</dt>
+</dl>
+</dd>
+<dt>
+<span class="chapter"><a href="#ROOMConcepts">12. ROOM Concepts</a></span>
+</dt>
+<dd>
+<dl>
<dt>
<span class="section"><a href="#Actors">Actors</a></span>
</dt>
@@ -818,16 +850,16 @@
</div>
</div>
</div>
-<p>The eTrice Tutorials will help you to learn and understand the eTrice Tool and concepts. ETrice supports several target languages. The concepts will not be explained in each language. </p>
+<p>The eTrice Tutorials will help you to learn and understand the eTrice tool and concepts. ETrice supports several target languages. The concepts will not be explained for each language. </p>
<p>Most of the common concepts will be described for Java as target language. To start with a new language the first steps to setup the workspace and to generate and run the first model will be described also. Target language specific aspects will be described as well.</p>
-<p>Therefore the best way to start with eTrice is to perform the Java Tutorials and after that switch to your target language. </p>
+<p>Therefore the best way to start with eTrice is to follow the Java Tutorials and after that switch to your target language. </p>
</div>
-<div class="chapter" title="Chapter&nbsp;4.&nbsp;Setting up the Workspace (Java)">
+<div class="chapter" title="Chapter&nbsp;4.&nbsp;Setting up the Workspace for Java Projects">
<div class="titlepage">
<div>
<div>
<h2 class="title">
-<a name="SettinguptheWorkspaceJava"></a>Chapter&nbsp;4.&nbsp;Setting up the Workspace (Java)</h2>
+<a name="SettinguptheWorkspaceforJavaProjects"></a>Chapter&nbsp;4.&nbsp;Setting up the Workspace for Java Projects</h2>
</div>
</div>
</div>
@@ -936,12 +968,12 @@
</p>
<p>Performing the tutorials will setup an dedicated project for each tutorial. Therefore there are some slight changes especially whenever a path must be set (e.g. to the model library) within your own projects. All this is described in the tutorials.</p>
</div>
-<div class="chapter" title="Chapter&nbsp;5.&nbsp;Tutorial HelloWorld (Java)">
+<div class="chapter" title="Chapter&nbsp;5.&nbsp;Tutorial HelloWorld for Java">
<div class="titlepage">
<div>
<div>
<h2 class="title">
-<a name="TutorialHelloWorldJava"></a>Chapter&nbsp;5.&nbsp;Tutorial HelloWorld (Java)</h2>
+<a name="TutorialHelloWorldforJava"></a>Chapter&nbsp;5.&nbsp;Tutorial HelloWorld for Java</h2>
</div>
</div>
</div>
@@ -2588,12 +2620,12 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
<p>This method is synchronized. That means, regardless who sends the message, the queue is secured. If we later on (e.g. for performance reasons in C/C++) distinguish between internal and external senders (same thread or not), care must be taken to use the external (secure) queue.</p>
</div>
</div>
-<div class="chapter" title="Chapter&nbsp;9.&nbsp;Setting up the Workspace ( C )">
+<div class="chapter" title="Chapter&nbsp;9.&nbsp;Setting up the Workspace for C Projects">
<div class="titlepage">
<div>
<div>
<h2 class="title">
-<a name="SettinguptheWorkspaceC"></a>Chapter&nbsp;9.&nbsp;Setting up the Workspace ( C )</h2>
+<a name="SettinguptheWorkspaceforCProjects"></a>Chapter&nbsp;9.&nbsp;Setting up the Workspace for C Projects</h2>
</div>
</div>
</div>
@@ -2647,9 +2679,9 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
<p>
</p>
-<p>Name the Project. Select an
- <span class="emphasis"><em>Executable-&gt;Hello World ANSI C</em></span> as Project type,
- <span class="emphasis"><em>MinGW GCC</em></span> as Tool chain and click
+<p>Name the project. Select an
+ <span class="emphasis"><em>Executable-&gt;Hello World ANSI C</em></span> as project type,
+ <span class="emphasis"><em>MinGW GCC</em></span> as tool chain and click
<span class="emphasis"><em>Finish</em></span>.
</p>
<p>
@@ -2712,7 +2744,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
<p>After changing the configuration, the runtime must be built.</p>
<p>Open the properties of the
<span class="emphasis"><em>org.eclipse.runtime.c</em></span> project and select
- <span class="emphasis"><em>C/C++ Build-&gt;Settins-&gt;Tool Settings</em></span> and select
+ <span class="emphasis"><em>C/C++ Build-&gt;Settings-&gt;Tool Settings</em></span> and select
<span class="emphasis"><em>Includes</em></span>.
</p>
<p>
@@ -2767,12 +2799,12 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
<p>For the tutorials one runtime library should be sufficient. For embedded projects it might be necessary to build project specific runtime libraries. In this case a separate project for the runtime should be created. Symbolic links to the sources might be used to avoid duplicate files. Just the configuration file must be duplicated. A specific library file must exist within the project. Such specific runtime libraries might be referenced from several applications. </p>
</div>
</div>
-<div class="chapter" title="Chapter&nbsp;10.&nbsp;Tutorial HelloWorld ( C )">
+<div class="chapter" title="Chapter&nbsp;10.&nbsp;Tutorial HelloWorld for C">
<div class="titlepage">
<div>
<div>
<h2 class="title">
-<a name="TutorialHelloWorldC"></a>Chapter&nbsp;10.&nbsp;Tutorial HelloWorld ( C )</h2>
+<a name="TutorialHelloWorldforC"></a>Chapter&nbsp;10.&nbsp;Tutorial HelloWorld for C</h2>
</div>
</div>
</div>
@@ -2785,7 +2817,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
</div>
</div>
-<p>In this tutorial you will learn how to create a model for C from scratch. There are some more steps to do in C as in Java. The goal is to get familiar with the additional steps. The Java tutorial is a prerequisite for the following explanations.
+<p>In this tutorial you will learn how to create a model for C from scratch. There are some more steps to do in C compared to Java. The goal is to get familiar with the additional steps. The Java tutorial is a prerequisite for the following explanations.
You will perform the following steps:</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
@@ -2810,7 +2842,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</ol>
</div>
<p>Make sure that you have set up the workspace as described in
- <span class="emphasis"><em>Setting up the workspace ( C )</em></span>.
+ <span class="emphasis"><em>Setting up the Workspace for C Projects</em></span>.
</p>
</div>
<div class="section" title="Create a new model from scratch">
@@ -2823,7 +2855,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
</div>
<p>Before you can create a new C-model, you have to create a new C project as described in
- <span class="emphasis"><em>Setting up the workspace ( C )</em></span>.
+ <span class="emphasis"><em>Setting up the Workspace for C Projects</em></span>.
Remember:
- select the
<span class="emphasis"><em>C/C++</em></span> perspective
@@ -2908,9 +2940,8 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
- Import CTypes instead of JavaTypes
- The action code contains C instead of Java. Later versions will contain a common action language, but for the moment the action language is target specific.
- The application must be shutdown on model level (see also
- <span class="emphasis"><em>etRuntimeConfig.h</em></span>)
+ <span class="emphasis"><em>etRuntimeConfig.h</em></span>).
</p>
-<p>ToDo: shutdown must not depend on the subsystem.</p>
<div class="literallayout">
<p>
<code class="code">RoomModel&nbsp;HelloWorldCModel&nbsp;{<br>
@@ -2926,7 +2957,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
State&nbsp;state0&nbsp;{<br>
entry&nbsp;{<br>
"printf(\"HelloWorldC&nbsp;!\\n\");"<br>
- "HelloWorldCSubSysClass_shutdown();//exit(0);"<br>
+ "SubSysClass_shutdown();"<br>
"\t\t\t\t\t\t"<br>
}<br>
}<br>
@@ -3036,7 +3067,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
</div>
</div>
-<p>Now you can generate the code as you know it from Java. Right click to the launch configuration and run it as _gen_HelloWorldC_.</p>
+<p>Now you can generate the code as you know it from Java. Right click on the launch configuration and run it as _gen_HelloWorldC_.</p>
<p>
</p>
@@ -3120,14 +3151,476 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
</div>
<p>You are now familiar with all necessary steps to create, build and run an eTrice C model from scratch. You are able to create a launch configuration to start the code generator and to perform all necessary settings to compile and link the application. </p>
-<p>The next tutorial provides an exercise to get more familiar with these working steps.
- h1. ROOM Concepts</p>
-<p>This chapter gives an overview over the ROOM language elements and their textual and graphical notation.
- The formal ROOM grammar based on Xtext (EBNF) you can find here:
- <a class="ulink" href="http://git.eclipse.org/c/etrice/org.eclipse.etrice.git/tree/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext" target="_new">ROOM Grammar</a>
+<p>The next tutorial provides an exercise to get more familiar with these working steps.</p>
+</div>
+</div>
+<div class="chapter" title="Chapter&nbsp;11.&nbsp;Tutorial Remove C-Comment ( C )">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title">
+<a name="TutorialRemoveCCommentC"></a>Chapter&nbsp;11.&nbsp;Tutorial Remove C-Comment ( C )</h2>
+</div>
+</div>
+</div>
+<div class="section" title="Scope">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Scope6"></a>Scope</h2>
+</div>
+</div>
+</div>
+<p>In this tutorial you will create a more complex model. The model implements a simple parser that removes comments (block comments and line comments) from a C source file. Therefore we will create two actors. One actor is responsible to perform the file operations, whether the second actor implements the parser.</p>
+<p>You will perform the following steps:</p>
+<div class="orderedlist">
+<ol class="orderedlist" type="1">
+<li class="listitem">
+<p>create a new model from scratch for C</p>
+</li>
+<li class="listitem">
+<p>define a protocol</p>
+</li>
+<li class="listitem">
+<p>define your own data type</p>
+</li>
+<li class="listitem">
+<p>create the structure and the behavior by yourself</p>
+</li>
+<li class="listitem">
+<p>generate, build and run the model</p>
+</li>
+</ol>
+</div>
+<p>Make sure that you have set up the workspace as described in
+ <span class="emphasis"><em>Setting up the Workspace for C Projects</em></span>.
+ </p>
+</div>
+<div class="section" title="Create a new model from scratch">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Createanewmodelfromscratch5"></a>Create a new model from scratch</h2>
+</div>
+</div>
+</div>
+<p>Remember the following steps from the previous tutorials:
+ - select the
+ <span class="emphasis"><em>C/C++</em></span> perspective
+ - From the main menue select
+ <span class="emphasis"><em>File-&gt;New-&gt;C Project</em></span>
+ - Name the project
+ <span class="emphasis"><em>RemoveComment</em></span>
+ - Project type is
+ <span class="emphasis"><em>Executable / Empty C Project</em></span>
+ - Toolchain is
+ <span class="emphasis"><em>MinGW</em></span>
+ - Add the folder
+ <span class="emphasis"><em>model</em></span>
+ - Add the model file and name it
+ <span class="emphasis"><em>RemoveComment.room</em></span>
+ - Add the Xtext nature.
+ </p>
+<p>The workspace should look like this:</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/036-RemoveCommentC01.png"></div>
+<p>
</p>
+<p>Create a launch configuration for the C generator and add the include path and library as described in
+ <span class="emphasis"><em>HelloWorldC</em></span>.
+ </p>
+<p>The workspace should look like this:</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/036-RemoveCommentC02.png"></div>
+<p>
+
+</p>
+<p>Now the model is created and all settings for the code generator, compiler and linker are done.</p>
+</div>
+<div class="section" title="Create your own data type">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Createyourowndatatype"></a>Create your own data type</h2>
+</div>
</div>
+</div>
+<p>The planed application should read a C source file and remove the comments. Therefore we need a file descriptor which is not part of the basic C types. The type for the file descriptor for MinGW is
+ <span class="emphasis"><em>FILE</em></span>. To make this type available on the model level, you have to declare the type in CTypes.room. To not interfere with other models, make a copy of
+ <span class="emphasis"><em>CTypes.room</em></span> from
+ <span class="emphasis"><em>org.eclipse.modellib.c</em></span> to your model folder.
+ </p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/036-RemoveCommentC03.png"></div>
+<p>
+
+</p>
+<p>Open
+ <span class="emphasis"><em>Ctypes.room</em></span> and take a look at the declaration of
+ <span class="emphasis"><em>string</em></span> (last line) which is not a basic C type.
+ </p>
+<p>
+
+<span class="emphasis"><em>PrimitiveType string:ptCharacter -&gt; charPtr default "0"</em></span>
+
+</p>
+<p>With this declaration, you make the
+ <span class="emphasis"><em>string</em></span> keyword available on model level as a primitive type. This type will be translated to
+ <span class="emphasis"><em>charPtr</em></span> in your C sources.
+ <span class="emphasis"><em>charPtr</em></span> is defined in
+ <span class="emphasis"><em>etDatatypes.h</em></span>. This header file is platform specific (
+ <span class="emphasis"><em>generic</em></span>). With this mechanism you can define your own type system on model level and map the model types to specific target/platform types.
+ </p>
+<p>Add the following line in
+ <span class="emphasis"><em>CTypes.room</em></span>:
+ </p>
+<div class="literallayout">
+<p>
+<code class="code">PrimitiveType&nbsp;file:ptInteger&nbsp;-&gt;&nbsp;FILE&nbsp;default&nbsp;"0"<br>
+
+</code>
+</p>
+</div>
+<div class="blockquote">
+<blockquote class="blockquote">
+<p></p>
+</blockquote>
+</div>
+<p>
+
+<span class="emphasis"><em>FILE</em></span> is the native type for MinGW. Therefore you don&acute;t need a mapping within
+ <span class="emphasis"><em>etDatatypes.h</em></span>. If your model should be portable across different platforms you should not take this shortcut.
+ </p>
+</div>
+<div class="section" title="Create the model">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Createthemodel"></a>Create the model</h2>
+</div>
+</div>
+</div>
+<p>Due to the former tutorials you should be familiar with the steps to create the model with protocols, actors and state machines.</p>
+<p>The basic idea of the exercise is to create a file reader actor, which is responsible to open, close and read characters from the source file. Another actor receives the characters and filters the comments (parser). The remaining characters (pure source code) should be print out. </p>
+<p>Remember the logical steps:
+ - create the model by the help of content assist (CTRL Space)
+ - name the model, subsystem and top level actor
+ - define the protocol (in this case it should be able to send a char, and to request the next char from the file reader)
+ - create the structure (file reader and parser with an appropriate port, create the references and connect the ports)
+ - create the state machines</p>
+<p>Try to create the model by yourself and take the following solution as an example.</p>
+<p>Structure:</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/036-RemoveCommentC04.png"></div>
+<p>
+
+</p>
+<p>File reader FSM:</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/036-RemoveCommentC05.png"></div>
+<p>
+
+</p>
+<p>Parser FSM:</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/036-RemoveCommentC06.png"></div>
+<p>
+
+</p>
+<p>Complete model:</p>
+<div class="literallayout">
+<p>
+<code class="code">RoomModel&nbsp;RemoveComment&nbsp;{<br>
+ import&nbsp;room.basic.types.c.*&nbsp;from&nbsp;"CTypes.room"<br>
+ SubSystemClass&nbsp;RemoveCommentSubSys&nbsp;{<br>
+ ActorRef&nbsp;Topref:ATop&nbsp;<br>
+ }<br>
+ ActorClass&nbsp;ATop&nbsp;{<br>
+ Structure&nbsp;{<br>
+ ActorRef&nbsp;reader:&nbsp;AFileReader<br>
+ ActorRef&nbsp;cParser:&nbsp;ACParser<br>
+ Binding&nbsp;reader.outPort&nbsp;and&nbsp;cParser.readerPort<br>
+ }<br>
+ Behavior&nbsp;{&nbsp;}<br>
+ }<br>
+ ActorClass&nbsp;AFileReader{<br>
+ Interface&nbsp;{<br>
+ Port&nbsp;outPort:&nbsp;FileReaderProtocol<br>
+ }<br>
+ Structure&nbsp;{<br>
+ usercode3{"#include&nbsp;&lt;stdio.h&gt;"<br>
+ }<br>
+ external&nbsp;Port&nbsp;outPort<br>
+ Attribute&nbsp;f:file&nbsp;ref<br>
+ }<br>
+ Behavior&nbsp;{<br>
+ StateMachine&nbsp;{<br>
+ Transition&nbsp;init:&nbsp;initial&nbsp;-&gt;&nbsp;reading&nbsp;{<br>
+ action&nbsp;{<br>
+ "if&nbsp;((f&nbsp;=&nbsp;fopen(\"test.txt\",\"r\"))&nbsp;!=&nbsp;0)&nbsp;{"<br>
+ "\tprintf(\"file&nbsp;open&nbsp;ok&nbsp;!\\r\\n\");"<br>
+ "\t}"<br>
+ "\telse&nbsp;{"<br>
+ "\tprintf(\"file&nbsp;not&nbsp;found&nbsp;!\\r\\n\");"<br>
+ "\tSubSysClass_shutdown();"<br>
+ "\t}"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr0:&nbsp;reading&nbsp;-&gt;&nbsp;reading&nbsp;{<br>
+ triggers&nbsp;{<br>
+ &lt;getNextChar:&nbsp;outPort&gt;<br>
+ }<br>
+ action&nbsp;{<br>
+ "int8&nbsp;c;"<br>
+ "if&nbsp;((c=fgetc(f))&nbsp;!=&nbsp;EOF)&nbsp;{"<br>
+ "\toutPort.nextChar(c);"<br>
+ "\t}"<br>
+ "\telse&nbsp;{"<br>
+ "\tfclose(f);"<br>
+ "\tprintf(\"file&nbsp;closed&nbsp;!\\r\\n\");"<br>
+ "\tSubSysClass_shutdown();"<br>
+ "\t}"<br>
+ }<br>
+ }<br>
+ State&nbsp;reading<br>
+ }<br>
+ }<br>
+ }<br>
+ ActorClass&nbsp;ACParser{<br>
+ Interface&nbsp;{<br>
+ conjugated&nbsp;Port&nbsp;readerPort:&nbsp;FileReaderProtocol<br>
+ }<br>
+ Structure&nbsp;{<br>
+ external&nbsp;Port&nbsp;readerPort<br>
+ }<br>
+ Behavior&nbsp;{<br>
+ StateMachine&nbsp;{<br>
+ Transition&nbsp;init:&nbsp;initial&nbsp;-&gt;&nbsp;code&nbsp;{<br>
+ action&nbsp;{<br>
+ "readerPort.getNextChar();"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr0:&nbsp;code&nbsp;-&gt;&nbsp;cp&nbsp;cp0&nbsp;{<br>
+ triggers&nbsp;{<br>
+ &lt;nextChar:&nbsp;readerPort&gt;<br>
+ }<br>
+ action&nbsp;{<br>
+ "readerPort.getNextChar();"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr1:&nbsp;cp&nbsp;cp0&nbsp;-&gt;&nbsp;code&nbsp;{<br>
+ action&nbsp;{<br>
+ "printf(\"%c\",c);"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr2:&nbsp;cp&nbsp;cp0&nbsp;-&gt;&nbsp;firstSlash&nbsp;{<br>
+ cond&nbsp;{<br>
+ "c==\'/\'"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr3:&nbsp;firstSlash&nbsp;-&gt;&nbsp;cp&nbsp;cp1&nbsp;{<br>
+ triggers&nbsp;{<br>
+ &lt;nextChar:&nbsp;readerPort&gt;<br>
+ }<br>
+ action&nbsp;{<br>
+ "readerPort.getNextChar();"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr4:&nbsp;cp&nbsp;cp1&nbsp;-&gt;&nbsp;cp&nbsp;cp4<br>
+ Transition&nbsp;tr5:&nbsp;cp&nbsp;cp1&nbsp;-&gt;&nbsp;blockComment&nbsp;{<br>
+ cond&nbsp;{<br>
+ "c==\'*\'"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr6:&nbsp;blockComment&nbsp;-&gt;&nbsp;cp&nbsp;cp2&nbsp;{<br>
+ triggers&nbsp;{<br>
+ &lt;nextChar:&nbsp;readerPort&gt;<br>
+ }<br>
+ action&nbsp;{<br>
+ "readerPort.getNextChar();"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr7:&nbsp;cp&nbsp;cp2&nbsp;-&gt;&nbsp;blockComment<br>
+ Transition&nbsp;tr8:&nbsp;cp&nbsp;cp2&nbsp;-&gt;&nbsp;firstStar&nbsp;{<br>
+ cond&nbsp;{<br>
+ "c==\'*\'"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr9:&nbsp;firstStar&nbsp;-&gt;&nbsp;cp&nbsp;cp3&nbsp;{<br>
+ triggers&nbsp;{<br>
+ &lt;nextChar:&nbsp;readerPort&gt;<br>
+ }<br>
+ action&nbsp;{<br>
+ "readerPort.getNextChar();"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr10:&nbsp;cp&nbsp;cp3&nbsp;-&gt;&nbsp;blockComment<br>
+ Transition&nbsp;tr11:&nbsp;cp&nbsp;cp3&nbsp;-&gt;&nbsp;code&nbsp;{<br>
+ cond&nbsp;{<br>
+ "c==\'/\'"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr12:&nbsp;cp&nbsp;cp4&nbsp;-&gt;&nbsp;code&nbsp;{<br>
+ action&nbsp;{<br>
+ "printf(\"%c%c\",\'/\',c);"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr13:&nbsp;cp&nbsp;cp4&nbsp;-&gt;&nbsp;lineComment&nbsp;{<br>
+ cond&nbsp;{<br>
+ "c==\'/\'"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr14:&nbsp;cp&nbsp;cp5&nbsp;-&gt;&nbsp;lineComment<br>
+ Transition&nbsp;tr15:&nbsp;lineComment&nbsp;-&gt;&nbsp;cp&nbsp;cp5&nbsp;{<br>
+ triggers&nbsp;{<br>
+ &lt;nextChar:&nbsp;readerPort&gt;<br>
+ }<br>
+ action&nbsp;{<br>
+ "readerPort.getNextChar();"<br>
+ }<br>
+ }<br>
+ Transition&nbsp;tr16:&nbsp;cp&nbsp;cp5&nbsp;-&gt;&nbsp;code&nbsp;{<br>
+ cond&nbsp;{<br>
+ "c==\'\\n\'"<br>
+ }<br>
+ }<br>
+ ChoicePoint&nbsp;cp0<br>
+ ChoicePoint&nbsp;cp1<br>
+ ChoicePoint&nbsp;cp2<br>
+ ChoicePoint&nbsp;cp3<br>
+ ChoicePoint&nbsp;cp4<br>
+ ChoicePoint&nbsp;cp5<br>
+ State&nbsp;code<br>
+ State&nbsp;firstSlash<br>
+ State&nbsp;blockComment<br>
+ State&nbsp;firstStar<br>
+ State&nbsp;lineComment<br>
+ }<br>
+ }<br>
+ }<br>
+
+<br>
+ ProtocolClass&nbsp;FileReaderProtocol&nbsp;{<br>
+ incoming&nbsp;{<br>
+ Message&nbsp;getNextChar()<br>
+ }<br>
+ outgoing&nbsp;{<br>
+ Message&nbsp;nextChar(c:char)<br>
+ }<br>
+ }<br>
+}<br>
+
+</code>
+</p>
+</div>
+<div class="blockquote">
+<blockquote class="blockquote">
+<p></p>
+</blockquote>
+</div>
+<p>Take a look at the file attribute of the file reader. </p>
+<div class="literallayout">
+<p>
+<code class="code">Attribute&nbsp;f:file&nbsp;ref<br>
+
+</code>
+</p>
+</div>
+<div class="blockquote">
+<blockquote class="blockquote">
+<p></p>
+</blockquote>
+</div>
+<p>
+
+<span class="emphasis"><em>fopen</em></span> expects a
+ <span class="emphasis"><em>FILE *</em></span>.
+ <span class="emphasis"><em>f:file ref</em></span> declares a variable
+ <span class="emphasis"><em>f</em></span> from type reference to
+ <span class="emphasis"><em>file</em></span>, which is a pointer to
+ <span class="emphasis"><em>FILE</em></span>.
+ </p>
+</div>
+<div class="section" title="Generate, build and run the model">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Generatebuildandrunthemodel"></a>Generate, build and run the model</h2>
+</div>
+</div>
+</div>
+<p>Before you can run the model you should copy one of the generated C source files into the project folder and name it
+ <span class="emphasis"><em>test.txt</em></span>.
+ </p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/036-RemoveCommentC07.png"></div>
+<p>
+
+</p>
+<p>Generate, build and run the model.</p>
+<p>Your output should start like this:</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/036-RemoveCommentC08.png"></div>
+<p>
+
+</p>
+</div>
+<div class="section" title="Summary">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Summary5"></a>Summary</h2>
+</div>
+</div>
+</div>
+<p>This tutorial should help you to train the necessary steps to create a C model. By the way you have seen how to create your own type system for a real embedded project. An additional aspect was to show how simple it is to separate different aspects of the required functionality by the use of actors and protocols and make them reusable.</p>
+</div>
+</div>
+<div class="chapter" title="Chapter&nbsp;12.&nbsp;ROOM Concepts">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title">
+<a name="ROOMConcepts"></a>Chapter&nbsp;12.&nbsp;ROOM Concepts</h2>
+</div>
+</div>
+</div>
+<p>This chapter gives an overview over the ROOM language elements and their textual and graphical notation.
+ The formal ROOM grammar based on Xtext (EBNF) you can find here:
+ <a class="ulink" href="http://git.eclipse.org/c/etrice/org.eclipse.etrice.git/tree/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext" target="_new">ROOM Grammar</a>
+
+</p>
<div class="section" title="Actors">
<div class="titlepage">
<div>
@@ -3183,7 +3676,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
</div>
</div>
-<table title="Actor Class Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10AD3">
+<table title="Actor Class Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10BE2">
<tr>
<td align="center">
@@ -3266,7 +3759,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
<span class="bold"><strong>Bindings</strong></span> connect Ports inside an ActorClass.
</p>
<p>Example:</p>
-<table title="Actor Class Example" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10B58">
+<table title="Actor Class Example" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10C67">
<tr>
<td align="center">
@@ -3548,7 +4041,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</li>
</ul>
</div>
-<table title="Class Port Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10C5F">
+<table title="Class Port Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10D6E">
<tr>
<td align="center">
@@ -3746,7 +4239,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
</div>
<p>These symbols can only appear on the border of an ActorReference symbol. Since the type of port is defined in the ActorClass, no textual notation for the Reference Ports exists.</p>
-<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10D97">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10EA6">
<tr>
<td align="center">
@@ -3903,7 +4396,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
</div>
</div>
-<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10E5A">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10F69">
<tr>
<td align="center">
@@ -4034,7 +4527,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
</div>
<p>The simpler flat finite state machines are composed of the following elements:</p>
-<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10F0A">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N11019">
<tr>
<td align="center">
@@ -4148,7 +4641,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
<p>The hierarchical finite state machine adds the notion of a sub state machine nested in a state.
A few modeling elements are added to the set listed above:</p>
-<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10FC9">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N110D8">
<tr>
<td align="center">
diff --git a/plugins/org.eclipse.etrice.doc/manual/etrice.pdf b/plugins/org.eclipse.etrice.doc/manual/etrice.pdf
index cf466ca..35cf9cb 100644
--- a/plugins/org.eclipse.etrice.doc/manual/etrice.pdf
+++ b/plugins/org.eclipse.etrice.doc/manual/etrice.pdf
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/toc.xml b/plugins/org.eclipse.etrice.doc/toc.xml
index 1609ac3..3ce4d10 100644
--- a/plugins/org.eclipse.etrice.doc/toc.xml
+++ b/plugins/org.eclipse.etrice.doc/toc.xml
@@ -28,9 +28,9 @@
</topic>
</topic>
<topic href="help/WorkingwiththeeTriceTutorials.html" label="Working with the eTrice Tutorials"></topic>
-<topic href="help/SettinguptheWorkspaceJava.html" label="Setting up the Workspace (Java)"></topic>
-<topic href="help/TutorialHelloWorldJava.html" label="Tutorial HelloWorld (Java)">
-<topic href="help/TutorialHelloWorldJava.html#Scope" label="Scope"></topic>
+<topic href="help/SettinguptheWorkspaceforJavaProjects.html" label="Setting up the Workspace for Java Projects"></topic>
+<topic href="help/TutorialHelloWorldforJava.html" label="Tutorial HelloWorld for Java">
+<topic href="help/TutorialHelloWorldforJava.html#Scope" label="Scope"></topic>
<topic href="help/Createanewmodelfromscratch.html" label="Create a new model from scratch"></topic>
<topic href="help/Createastatemachine.html" label="Create a state machine"></topic>
<topic href="help/Buildandrunthemodel.html" label="Build and run the model"></topic>
@@ -66,12 +66,12 @@
<topic href="help/Setupthemodel.html" label="Setup the model"></topic>
<topic href="help/Whydoesitworkandwhyisitsafe.html" label="Why does it work and why is it safe?"></topic>
</topic>
-<topic href="help/SettinguptheWorkspaceC.html" label="Setting up the Workspace ( C )">
-<topic href="help/SettinguptheWorkspaceC.html#Testingtheenvironment" label="Testing the environment"></topic>
+<topic href="help/SettinguptheWorkspaceforCProjects.html" label="Setting up the Workspace for C Projects">
+<topic href="help/SettinguptheWorkspaceforCProjects.html#Testingtheenvironment" label="Testing the environment"></topic>
<topic href="help/BuildingtheCruntimesystem.html" label="Building the C runtime system"></topic>
</topic>
-<topic href="help/TutorialHelloWorldC.html" label="Tutorial HelloWorld ( C )">
-<topic href="help/TutorialHelloWorldC.html#Scope5" label="Scope"></topic>
+<topic href="help/TutorialHelloWorldforC.html" label="Tutorial HelloWorld for C">
+<topic href="help/TutorialHelloWorldforC.html#Scope5" label="Scope"></topic>
<topic href="help/Createanewmodelfromscratch4.html" label="Create a new model from scratch"></topic>
<topic href="help/CreatetheHelloWorldmodel.html" label="Create the HelloWorld model"></topic>
<topic href="help/CreatealaunchconfigurationtostarttheCcodegenerator.html" label="Create a launch configuration to start the C code generator"></topic>
@@ -79,14 +79,24 @@
<topic href="help/Setuptheincludepath.html" label="Setup the include path"></topic>
<topic href="help/Buildandrunthemodel2.html" label="Build and run the model"></topic>
<topic href="help/Summary4.html" label="Summary"></topic>
-<topic href="help/Actors.html" label="Actors">
-<topic href="help/Actors.html#Description" label="Description"></topic>
-<topic href="help/Actors.html#Motivation" label="Motivation"></topic>
-<topic href="help/Actors.html#Notation" label="Notation"></topic>
-<topic href="help/Actors.html#Details" label="Details">
-<topic href="help/Actors.html#ActorClassesActorReferencesPortsandBindings" label="Actor Classes, Actor References, Ports and Bindings"></topic>
-<topic href="help/Actors.html#Attributes" label="Attributes"></topic>
-<topic href="help/Actors.html#Operations" label="Operations"></topic>
+</topic>
+<topic href="help/TutorialRemoveCCommentC.html" label="Tutorial Remove C-Comment ( C )">
+<topic href="help/TutorialRemoveCCommentC.html#Scope6" label="Scope"></topic>
+<topic href="help/Createanewmodelfromscratch5.html" label="Create a new model from scratch"></topic>
+<topic href="help/Createyourowndatatype.html" label="Create your own data type"></topic>
+<topic href="help/Createthemodel.html" label="Create the model"></topic>
+<topic href="help/Generatebuildandrunthemodel.html" label="Generate, build and run the model"></topic>
+<topic href="help/Summary5.html" label="Summary"></topic>
+</topic>
+<topic href="help/ROOMConcepts.html" label="ROOM Concepts">
+<topic href="help/ROOMConcepts.html#Actors" label="Actors">
+<topic href="help/ROOMConcepts.html#Description" label="Description"></topic>
+<topic href="help/ROOMConcepts.html#Motivation" label="Motivation"></topic>
+<topic href="help/ROOMConcepts.html#Notation" label="Notation"></topic>
+<topic href="help/ROOMConcepts.html#Details" label="Details">
+<topic href="help/ROOMConcepts.html#ActorClassesActorReferencesPortsandBindings" label="Actor Classes, Actor References, Ports and Bindings"></topic>
+<topic href="help/ROOMConcepts.html#Attributes" label="Attributes"></topic>
+<topic href="help/ROOMConcepts.html#Operations" label="Operations"></topic>
</topic>
</topic>
<topic href="help/Protocols.html" label="Protocols">
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 238102d..0000000
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java
+++ /dev/null
@@ -1,444 +0,0 @@
-package org.eclipse.etrice.generator.java.gen;
-
-import com.google.common.base.Objects;
-import com.google.inject.Inject;
-import java.util.HashSet;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.etrice.core.config.AttrClassConfig;
-import org.eclipse.etrice.core.config.AttrInstanceConfig;
-import org.eclipse.etrice.core.config.LiteralArray;
-import org.eclipse.etrice.core.config.NumberLiteral;
-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.PrimitiveType;
-import org.eclipse.etrice.core.room.RefableType;
-import org.eclipse.etrice.generator.generic.ConfigExtension;
-import org.eclipse.etrice.generator.generic.ProcedureHelpers;
-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.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.StringExtensions;
-
-@SuppressWarnings("all")
-public class ConfigGenAddon {
- @Inject
- private JavaExtensions stdExt;
-
- @Inject
- private TypeHelpers typeHelpers;
-
- @Inject
- private ProcedureHelpers helpers;
-
- @Inject
- private ConfigExtension configExt;
-
- public CharSequence applyInstanceConfig(final String instance, final String className, final List<AttrInstanceConfig> attrConfigs) {
- StringConcatenation _builder = new StringConcatenation();
- {
- for(final AttrInstanceConfig attrConfig : attrConfigs) {
- Attribute a = attrConfig.getAttribute();
- _builder.newLineIfNotEmpty();
- RefableType _refType = a.getRefType();
- DataType aType = _refType.getType();
- _builder.newLineIfNotEmpty();
- {
- boolean _isPrimitive = this.typeHelpers.isPrimitive(aType);
- if (_isPrimitive) {
- LiteralArray _value = attrConfig.getValue();
- String[] values = _value==null?(String[])null:this.configExt.getValues(_value);
- _builder.newLineIfNotEmpty();
- {
- boolean _equals = Objects.equal(values, null);
- if (_equals) {
- } else {
- boolean _or = false;
- int _size = a.getSize();
- boolean _equals_1 = (_size == 0);
- if (_equals_1) {
- _or = true;
- } else {
- boolean _isCharacterType = this.typeHelpers.isCharacterType(aType);
- _or = (_equals_1 || _isCharacterType);
- }
- if (_or) {
- _builder.append(instance, "");
- _builder.append(".");
- String _name = a.getName();
- final String[] _converted_values = (String[])values;
- String _get = ((List<String>)Conversions.doWrapArray(_converted_values)).get(0);
- String _valueLiteral = this.stdExt.toValueLiteral(((PrimitiveType) aType), _get);
- CharSequence _invokeSetter = this.helpers.invokeSetter(_name, className, _valueLiteral);
- _builder.append(_invokeSetter, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- } else {
- int _size_1 = a.getSize();
- final String[] _converted_values_1 = (String[])values;
- int _size_2 = ((List<String>)Conversions.doWrapArray(_converted_values_1)).size();
- boolean _equals_2 = (_size_1 == _size_2);
- if (_equals_2) {
- _builder.append(instance, "");
- _builder.append(".");
- String _name_1 = a.getName();
- String _typeName = this.typeHelpers.typeName(aType);
- String _plus = ("new " + _typeName);
- String _plus_1 = (_plus + "[]");
- String _arrayValueLiteral = this.configExt.toArrayValueLiteral(((PrimitiveType) aType), values);
- String _plus_2 = (_plus_1 + _arrayValueLiteral);
- CharSequence _invokeSetter_1 = this.helpers.invokeSetter(_name_1, className, _plus_2);
- _builder.append(_invokeSetter_1, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- } else {
- _builder.append("{");
- _builder.newLine();
- _builder.append("\t");
- String _typeName_1 = this.typeHelpers.typeName(aType);
- _builder.append(_typeName_1, " ");
- _builder.append("[] array = ");
- _builder.append(instance, " ");
- _builder.append(".");
- String _name_2 = a.getName();
- CharSequence _invokeGetter = this.helpers.invokeGetter(_name_2, className);
- _builder.append(_invokeGetter, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("for (int i=0;i<");
- int _size_3 = a.getSize();
- _builder.append(_size_3, " ");
- _builder.append(";i++){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("array[i] = ");
- final String[] _converted_values_2 = (String[])values;
- String _get_1 = ((List<String>)Conversions.doWrapArray(_converted_values_2)).get(0);
- String _valueLiteral_1 = this.stdExt.toValueLiteral(((PrimitiveType) aType), _get_1);
- _builder.append(_valueLiteral_1, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- }
- }
- }
- }
- } else {
- boolean _isDataClass = this.typeHelpers.isDataClass(aType);
- if (_isDataClass) {
- String _plus_3 = (instance + ".");
- String _name_3 = a.getName();
- CharSequence _invokeGetter_1 = this.helpers.invokeGetter(_name_3, className);
- String _plus_4 = (_plus_3 + _invokeGetter_1);
- String _typeName_2 = this.typeHelpers.typeName(aType);
- EList<AttrInstanceConfig> _attributes = attrConfig.getAttributes();
- CharSequence _applyInstanceConfig = this.applyInstanceConfig(_plus_4, _typeName_2, _attributes);
- _builder.append(_applyInstanceConfig, "");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- }
- return _builder;
- }
-
- public CharSequence genDynConfigGetterSetter(final ActorClass ac) {
- StringConcatenation _builder = new StringConcatenation();
- {
- HashSet<Attribute> _dynConfigAttributes = this.configExt.getDynConfigAttributes(ac, true, false);
- for(final Attribute a : _dynConfigAttributes) {
- _builder.append("public ");
- RefableType _refType = a.getRefType();
- DataType _type = _refType.getType();
- String _typeName = this.typeHelpers.typeName(_type);
- _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, " ");
- _builder.append(" == null)");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("return ");
- String _name_2 = a.getName();
- _builder.append(_name_2, " ");
- _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, " ");
- _builder.append("){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t\t");
- _builder.append("return ");
- String _name_4 = a.getName();
- _builder.append(_name_4, " ");
- _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 _refType_1 = a.getRefType();
- DataType _type_1 = _refType_1.getType();
- String _typeName_1 = this.typeHelpers.typeName(_type_1);
- _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, " ");
- _builder.append(" == null)");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("this.");
- String _name_8 = a.getName();
- _builder.append(_name_8, " ");
- _builder.append(" = ");
- String _name_9 = a.getName();
- _builder.append(_name_9, " ");
- _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, " ");
- _builder.append("){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t\t");
- _builder.append("this.");
- String _name_11 = a.getName();
- _builder.append(_name_11, " ");
- _builder.append(" = ");
- String _name_12 = a.getName();
- _builder.append(_name_12, " ");
- _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, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("}\t");
- _builder.newLine();
- }
- }
- {
- HashSet<Attribute> _dynConfigAttributes_1 = this.configExt.getDynConfigAttributes(ac, false, true);
- for(final Attribute a_1 : _dynConfigAttributes_1) {
- _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 _refType_2 = a_1.getRefType();
- DataType _type_2 = _refType_2.getType();
- String _typeName_2 = this.typeHelpers.typeName(_type_2);
- _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, " ");
- _builder.append("(");
- String _name_18 = a_1.getName();
- _builder.append(_name_18, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("variableService.write(this.getInstancePath()+\"/");
- String _name_19 = a_1.getName();
- _builder.append(_name_19, " ");
- _builder.append("\", ");
- String _name_20 = a_1.getName();
- _builder.append(_name_20, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- _builder.append("}");
- _builder.newLine();
- }
- }
- return _builder;
- }
-
- public CharSequence genMinMaxConstants(final ActorClass ac) {
- CharSequence _xblockexpression = null;
- {
- List<AttrClassConfig> _allAttrConfigFlat = this.configExt.getAllAttrConfigFlat(ac);
- final Function1<AttrClassConfig,Boolean> _function = new Function1<AttrClassConfig,Boolean>() {
- public Boolean apply(final AttrClassConfig c) {
- boolean _or = false;
- NumberLiteral _min = c.getMin();
- boolean _notEquals = (!Objects.equal(_min, null));
- if (_notEquals) {
- _or = true;
- } else {
- NumberLiteral _max = c.getMax();
- boolean _notEquals_1 = (!Objects.equal(_max, null));
- _or = (_notEquals || _notEquals_1);
- }
- return Boolean.valueOf(_or);
- }
- };
- Iterable<AttrClassConfig> attrConfigs = IterableExtensions.<AttrClassConfig>filter(_allAttrConfigFlat, _function);
- StringConcatenation _builder = new StringConcatenation();
- {
- boolean _isEmpty = IterableExtensions.isEmpty(attrConfigs);
- boolean _not = (!_isEmpty);
- if (_not) {
- _builder.append("//--------------------- attribute specifications");
- _builder.newLine();
- }
- }
- _builder.append("\t");
- _builder.newLine();
- {
- for(final AttrClassConfig c : attrConfigs) {
- Attribute _attribute = c.getAttribute();
- RefableType _refType = _attribute.getRefType();
- DataType _type = _refType.getType();
- PrimitiveType aType = ((PrimitiveType) _type);
- _builder.newLineIfNotEmpty();
- {
- NumberLiteral _min = c.getMin();
- boolean _notEquals = (!Objects.equal(_min, null));
- if (_notEquals) {
- _builder.append("public static ");
- String _minMaxType = this.getMinMaxType(aType);
- _builder.append(_minMaxType, "");
- _builder.append(" MIN");
- List<String> _path = this.configExt.getPath(c, false, false, true, true);
- String _path_1 = this.configExt.toPath(_path, "_");
- _builder.append(_path_1, "");
- _builder.append(" = ");
- NumberLiteral _min_1 = c.getMin();
- String _value = this.configExt.getValue(_min_1);
- String _valueLiteral = this.stdExt.toValueLiteral(aType, _value);
- _builder.append(_valueLiteral, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- {
- NumberLiteral _max = c.getMax();
- boolean _notEquals_1 = (!Objects.equal(_max, null));
- if (_notEquals_1) {
- _builder.append("public static ");
- String _minMaxType_1 = this.getMinMaxType(aType);
- _builder.append(_minMaxType_1, "");
- _builder.append(" MAX");
- List<String> _path_2 = this.configExt.getPath(c, false, false, true, true);
- String _path_3 = this.configExt.toPath(_path_2, "_");
- _builder.append(_path_3, "");
- _builder.append(" = ");
- NumberLiteral _max_1 = c.getMax();
- String _value_1 = this.configExt.getValue(_max_1);
- String _valueLiteral_1 = this.stdExt.toValueLiteral(aType, _value_1);
- _builder.append(_valueLiteral_1, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- _xblockexpression = (_builder);
- }
- return _xblockexpression;
- }
-
- private String getMinMaxType(final PrimitiveType type) {
- String _typeName = this.typeHelpers.typeName(type);
- final String _switchValue = _typeName;
- boolean _matched = false;
- if (!_matched) {
- if (Objects.equal(_switchValue,"byte")) {
- _matched=true;
- return "int";
- }
- }
- if (!_matched) {
- if (Objects.equal(_switchValue,"short")) {
- _matched=true;
- return "int";
- }
- }
- if (!_matched) {
- if (Objects.equal(_switchValue,"float")) {
- _matched=true;
- return "double";
- }
- }
- return this.typeHelpers.typeName(type);
- }
-}
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java
deleted file mode 100644
index 8e14ef1..0000000
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java
+++ /dev/null
@@ -1,817 +0,0 @@
-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.emf.ecore.EObject;
-import org.eclipse.etrice.core.config.AttrInstanceConfig;
-import org.eclipse.etrice.core.config.PortInstanceConfig;
-import org.eclipse.etrice.core.genmodel.base.ILogger;
-import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
-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.InterfaceItem;
-import org.eclipse.etrice.core.room.LogicalThread;
-import org.eclipse.etrice.core.room.RoomModel;
-import org.eclipse.etrice.core.room.SubSystemClass;
-import org.eclipse.etrice.generator.base.Indexed;
-import org.eclipse.etrice.generator.generic.ConfigExtension;
-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.ConfigGenAddon;
-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.generator.JavaIoFileSystemAccess;
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-
-@Singleton
-@SuppressWarnings("all")
-public class SubSystemClassGen {
- @Inject
- private JavaIoFileSystemAccess fileAccess;
-
- @Inject
- private JavaExtensions _javaExtensions;
-
- @Inject
- private RoomExtensions _roomExtensions;
-
- @Inject
- private ConfigExtension _configExtension;
-
- @Inject
- private ConfigGenAddon configAddon;
-
- @Inject
- private ProcedureHelpers _procedureHelpers;
-
- @Inject
- private TypeHelpers _typeHelpers;
-
- @Inject
- private VariableServiceGen varService;
-
- @Inject
- private ILogger logger;
-
- public void doGenerate(final Root root) {
- EList<SubSystemInstance> _subSystemInstances = root.getSubSystemInstances();
- for (final SubSystemInstance ssi : _subSystemInstances) {
- {
- SubSystemClass _subSystemClass = ssi.getSubSystemClass();
- String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass);
- SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass();
- String _path = this._roomExtensions.getPath(_subSystemClass_1);
- String path = (_generationTargetPath + _path);
- SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass();
- String file = this._javaExtensions.getJavaFileName(_subSystemClass_2);
- String _plus = ("generating SubSystemClass implementation: \'" + file);
- 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);
- SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass();
- CharSequence _generate = this.generate(root, ssi, _subSystemClass_3);
- this.fileAccess.generateFile(file, _generate);
- SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass();
- boolean _hasVariableService = this._configExtension.hasVariableService(_subSystemClass_4);
- if (_hasVariableService) {
- this.varService.doGenerate(root, ssi);
- }
- }
- }
- }
-
- public CharSequence generate(final Root root, final SubSystemInstance comp, final SubSystemClass cc) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("package ");
- String _package = this._roomExtensions.getPackage(cc);
- _builder.append(_package, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- {
- boolean _hasVariableService = this._configExtension.hasVariableService(cc);
- if (_hasVariableService) {
- _builder.append("import org.eclipse.etrice.runtime.java.config.VariableService;");
- }
- }
- _builder.newLineIfNotEmpty();
- _builder.append("import org.eclipse.etrice.runtime.java.messaging.MessageService;");
- _builder.newLine();
- _builder.append("import org.eclipse.etrice.runtime.java.messaging.RTServices;");
- _builder.newLine();
- _builder.append("import org.eclipse.etrice.runtime.java.messaging.Address;");
- _builder.newLine();
- _builder.append("import org.eclipse.etrice.runtime.java.messaging.IRTObject;");
- _builder.newLine();
- _builder.append("import org.eclipse.etrice.runtime.java.messaging.RTSystemServicesProtocol.*;");
- _builder.newLine();
- _builder.append("import org.eclipse.etrice.runtime.java.modelbase.ActorClassBase;");
- _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.newLine();
- EList<RoomModel> models = root.getReferencedModels(cc);
- _builder.newLineIfNotEmpty();
- {
- for(final RoomModel model : models) {
- _builder.append("import ");
- String _name = model.getName();
- _builder.append(_name, "");
- _builder.append(".*;");
- }
- }
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.newLine();
- CharSequence _userCode = this._procedureHelpers.userCode(cc, 1);
- _builder.append(_userCode, "");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("public class ");
- String _name_1 = comp.getName();
- _builder.append(_name_1, "");
- _builder.append(" extends SubSystemClassBase{");
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("\t");
- CharSequence _userCode_1 = this._procedureHelpers.userCode(cc, 2);
- _builder.append(_userCode_1, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("public ");
- String _name_2 = comp.getName();
- _builder.append(_name_2, " ");
- _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.append("\t");
- _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.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("@Override\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("public void instantiateMessageServices(){");
- _builder.newLine();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("RTServices.getInstance().getMsgSvcCtrl().addMsgSvc(new MessageService(this, new Address(0, 0, 0),\"MessageService_Main\"));");
- _builder.newLine();
- {
- EList<LogicalThread> _threads = cc.getThreads();
- for(final LogicalThread thread : _threads) {
- _builder.append("\t\t");
- _builder.append("RTServices.getInstance().getMsgSvcCtrl().addMsgSvc(new MessageService(this, new Address(0, ");
- EList<LogicalThread> _threads_1 = cc.getThreads();
- int _indexOf = _threads_1.indexOf(thread);
- int _plus = (_indexOf + 1);
- _builder.append(_plus, " ");
- _builder.append(", 0),\"MessageService_");
- String _name_3 = thread.getName();
- _builder.append(_name_3, " ");
- _builder.append("\", ");
- int _prio = thread.getPrio();
- _builder.append(_prio, " ");
- _builder.append("));");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t\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.append("\t\t");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("// all addresses");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("// Addresses for the Subsystem Systemport");
- _builder.newLine();
- {
- EList<ActorInstance> _allContainedInstances = comp.getAllContainedInstances();
- int _maxObjId = comp.getMaxObjId();
- Iterable<Indexed<ActorInstance>> _indexed = Indexed.<ActorInstance>indexed(_allContainedInstances, _maxObjId);
- for(final Indexed<ActorInstance> ai : _indexed) {
- _builder.append("\t\t");
- _builder.append("Address addr_item_SystemPort_");
- EList<ActorInstance> _allContainedInstances_1 = comp.getAllContainedInstances();
- ActorInstance _value = ai.getValue();
- int _indexOf_1 = _allContainedInstances_1.indexOf(_value);
- _builder.append(_indexOf_1, " ");
- _builder.append(" = new Address(0,0,");
- int _index1 = ai.getIndex1();
- _builder.append(_index1, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t\t");
- _builder.newLine();
- {
- EList<ActorInstance> _allContainedInstances_2 = comp.getAllContainedInstances();
- for(final ActorInstance ai_1 : _allContainedInstances_2) {
- _builder.append("\t\t");
- _builder.append("// actor instance ");
- String _path = ai_1.getPath();
- _builder.append(_path, " ");
- _builder.append(" itself => Systemport Address");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("// TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport)");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("Address addr_item_");
- String _path_1 = ai_1.getPath();
- String _pathName = this._roomExtensions.getPathName(_path_1);
- _builder.append(_pathName, " ");
- _builder.append(" = new Address(0,");
- int _threadId = ai_1.getThreadId();
- _builder.append(_threadId, " ");
- _builder.append(",");
- int _objId = ai_1.getObjId();
- _builder.append(_objId, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("// interface items of ");
- String _path_2 = ai_1.getPath();
- _builder.append(_path_2, " ");
- _builder.newLineIfNotEmpty();
- {
- EList<InterfaceItemInstance> _orderedIfItemInstances = ai_1.getOrderedIfItemInstances();
- for(final InterfaceItemInstance pi : _orderedIfItemInstances) {
- {
- boolean _isReplicated = pi.isReplicated();
- if (_isReplicated) {
- {
- EList<InterfaceItemInstance> _peers = pi.getPeers();
- for(final InterfaceItemInstance peer : _peers) {
- _builder.append("\t\t");
- EList<InterfaceItemInstance> _peers_1 = pi.getPeers();
- int i = _peers_1.indexOf(peer);
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("Address addr_item_");
- String _path_3 = pi.getPath();
- String _pathName_1 = this._roomExtensions.getPathName(_path_3);
- _builder.append(_pathName_1, " ");
- _builder.append("_");
- _builder.append(i, " ");
- _builder.append(" = new Address(0,");
- int _threadId_1 = pi.getThreadId();
- _builder.append(_threadId_1, " ");
- _builder.append(",");
- int _objId_1 = pi.getObjId();
- int _plus_1 = (_objId_1 + i);
- _builder.append(_plus_1, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- }
- }
- } else {
- _builder.append("\t\t");
- _builder.append("Address addr_item_");
- String _path_4 = pi.getPath();
- String _pathName_2 = this._roomExtensions.getPathName(_path_4);
- _builder.append(_pathName_2, " ");
- _builder.append(" = new Address(0,");
- int _threadId_2 = ai_1.getThreadId();
- _builder.append(_threadId_2, " ");
- _builder.append(",");
- int _objId_2 = pi.getObjId();
- _builder.append(_objId_2, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- }
- }
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("// instantiate all actor instances");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("instances = new ActorClassBase[");
- EList<ActorInstance> _allContainedInstances_3 = comp.getAllContainedInstances();
- int _size = _allContainedInstances_3.size();
- _builder.append(_size, " ");
- _builder.append("];");
- _builder.newLineIfNotEmpty();
- {
- EList<ActorInstance> _allContainedInstances_4 = comp.getAllContainedInstances();
- for(final ActorInstance ai_2 : _allContainedInstances_4) {
- _builder.append("\t\t");
- _builder.append("instances[");
- EList<ActorInstance> _allContainedInstances_5 = comp.getAllContainedInstances();
- int _indexOf_2 = _allContainedInstances_5.indexOf(ai_2);
- _builder.append(_indexOf_2, " ");
- _builder.append("] = new ");
- ActorClass _actorClass = ai_2.getActorClass();
- String _name_4 = _actorClass.getName();
- _builder.append(_name_4, " ");
- _builder.append("(");
- _builder.newLineIfNotEmpty();
- {
- EObject _eContainer = ai_2.eContainer();
- if ((_eContainer instanceof SubSystemInstance)) {
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("this,");
- _builder.newLine();
- } else {
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("instances[");
- EList<ActorInstance> _allContainedInstances_6 = comp.getAllContainedInstances();
- EObject _eContainer_1 = ai_2.eContainer();
- int _indexOf_3 = _allContainedInstances_6.indexOf(_eContainer_1);
- _builder.append(_indexOf_3, " ");
- _builder.append("],");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("\"");
- String _name_5 = ai_2.getName();
- _builder.append(_name_5, " ");
- _builder.append("\",");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("// own interface item addresses");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("new Address[][] {{addr_item_");
- String _path_5 = ai_2.getPath();
- String _pathName_3 = this._roomExtensions.getPathName(_path_5);
- _builder.append(_pathName_3, " ");
- _builder.append("}");
- {
- EList<InterfaceItemInstance> _orderedIfItemInstances_1 = ai_2.getOrderedIfItemInstances();
- boolean _isEmpty = _orderedIfItemInstances_1.isEmpty();
- boolean _not = (!_isEmpty);
- if (_not) {
- _builder.append(",");
- }
- }
- _builder.newLineIfNotEmpty();
- {
- EList<InterfaceItemInstance> _orderedIfItemInstances_2 = ai_2.getOrderedIfItemInstances();
- boolean _hasElements = false;
- for(final InterfaceItemInstance pi_1 : _orderedIfItemInstances_2) {
- if (!_hasElements) {
- _hasElements = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- {
- boolean _isReplicated_1 = pi_1.isReplicated();
- if (_isReplicated_1) {
- {
- EList<InterfaceItemInstance> _peers_2 = pi_1.getPeers();
- boolean _isEmpty_1 = _peers_2.isEmpty();
- if (_isEmpty_1) {
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("null");
- _builder.newLine();
- } else {
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("{");
- _builder.newLine();
- {
- EList<InterfaceItemInstance> _peers_3 = pi_1.getPeers();
- boolean _hasElements_1 = false;
- for(final InterfaceItemInstance peer_1 : _peers_3) {
- if (!_hasElements_1) {
- _hasElements_1 = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("addr_item_");
- String _path_6 = pi_1.getPath();
- String _pathName_4 = this._roomExtensions.getPathName(_path_6);
- _builder.append(_pathName_4, " ");
- _builder.append("_");
- EList<InterfaceItemInstance> _peers_4 = pi_1.getPeers();
- int _indexOf_4 = _peers_4.indexOf(peer_1);
- _builder.append(_indexOf_4, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- }
- }
- } else {
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("{");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("addr_item_");
- String _path_7 = pi_1.getPath();
- String _pathName_5 = this._roomExtensions.getPathName(_path_7);
- _builder.append(_pathName_5, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- }
- }
- }
- }
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("},");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("// peer interface item addresses");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("new Address[][] {{addr_item_SystemPort_");
- EList<ActorInstance> _allContainedInstances_7 = comp.getAllContainedInstances();
- int _indexOf_5 = _allContainedInstances_7.indexOf(ai_2);
- _builder.append(_indexOf_5, " ");
- _builder.append("}");
- {
- EList<InterfaceItemInstance> _orderedIfItemInstances_3 = ai_2.getOrderedIfItemInstances();
- boolean _isEmpty_2 = _orderedIfItemInstances_3.isEmpty();
- boolean _not_1 = (!_isEmpty_2);
- if (_not_1) {
- _builder.append(",");
- }
- }
- _builder.newLineIfNotEmpty();
- {
- EList<InterfaceItemInstance> _orderedIfItemInstances_4 = ai_2.getOrderedIfItemInstances();
- boolean _hasElements_2 = false;
- for(final InterfaceItemInstance pi_2 : _orderedIfItemInstances_4) {
- if (!_hasElements_2) {
- _hasElements_2 = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- {
- boolean _and = false;
- boolean _isReplicated_2 = pi_2.isReplicated();
- if (!_isReplicated_2) {
- _and = false;
- } else {
- EList<InterfaceItemInstance> _peers_5 = pi_2.getPeers();
- boolean _isEmpty_3 = _peers_5.isEmpty();
- _and = (_isReplicated_2 && _isEmpty_3);
- }
- if (_and) {
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("null");
- _builder.newLine();
- } else {
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("{");
- _builder.newLine();
- {
- EList<InterfaceItemInstance> _peers_6 = pi_2.getPeers();
- boolean _isEmpty_4 = _peers_6.isEmpty();
- if (_isEmpty_4) {
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("null");
- _builder.newLine();
- } else {
- {
- EList<InterfaceItemInstance> _peers_7 = pi_2.getPeers();
- boolean _hasElements_3 = false;
- for(final InterfaceItemInstance pp : _peers_7) {
- if (!_hasElements_3) {
- _hasElements_3 = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- {
- boolean _isReplicated_3 = pp.isReplicated();
- if (_isReplicated_3) {
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("addr_item_");
- String _path_8 = pp.getPath();
- String _pathName_6 = this._roomExtensions.getPathName(_path_8);
- _builder.append(_pathName_6, " ");
- _builder.append("_");
- EList<InterfaceItemInstance> _peers_8 = pp.getPeers();
- int _indexOf_6 = _peers_8.indexOf(pi_2);
- _builder.append(_indexOf_6, " ");
- _builder.newLineIfNotEmpty();
- } else {
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("addr_item_");
- String _path_9 = pp.getPath();
- String _pathName_7 = this._roomExtensions.getPathName(_path_9);
- _builder.append(_pathName_7, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- }
- }
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- }
- }
- }
- }
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- {
- List<AttrInstanceConfig> _configAttributes = this._configExtension.getConfigAttributes(ai_2);
- final Function1<AttrInstanceConfig,Boolean> _function = new Function1<AttrInstanceConfig,Boolean>() {
- public Boolean apply(final AttrInstanceConfig c) {
- boolean _isDynConfig = c.isDynConfig();
- return Boolean.valueOf(_isDynConfig);
- }
- };
- boolean _exists = IterableExtensions.<AttrInstanceConfig>exists(_configAttributes, _function);
- if (_exists) {
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append(", variableService");
- _builder.newLine();
- }
- }
- _builder.append("\t\t");
- _builder.append("); ");
- _builder.newLine();
- }
- }
- _builder.append("\t\t");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("// apply instance attribute configurations");
- _builder.newLine();
- {
- EList<ActorInstance> _allContainedInstances_8 = comp.getAllContainedInstances();
- for(final ActorInstance ai_3 : _allContainedInstances_8) {
- {
- boolean _and_1 = false;
- List<AttrInstanceConfig> _configAttributes_1 = this._configExtension.getConfigAttributes(ai_3);
- boolean _isEmpty_5 = _configAttributes_1.isEmpty();
- if (!_isEmpty_5) {
- _and_1 = false;
- } else {
- List<PortInstanceConfig> _configPorts = this._configExtension.getConfigPorts(ai_3);
- boolean _isEmpty_6 = _configPorts.isEmpty();
- _and_1 = (_isEmpty_5 && _isEmpty_6);
- }
- boolean _not_2 = (!_and_1);
- if (_not_2) {
- _builder.append("\t\t");
- _builder.append("{");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t");
- ActorClass _actorClass_1 = ai_3.getActorClass();
- String _name_6 = _actorClass_1.getName();
- _builder.append(_name_6, " ");
- _builder.append(" inst = (");
- ActorClass _actorClass_2 = ai_3.getActorClass();
- String _name_7 = _actorClass_2.getName();
- _builder.append(_name_7, " ");
- _builder.append(") instances[");
- EList<ActorInstance> _allContainedInstances_9 = comp.getAllContainedInstances();
- int _indexOf_7 = _allContainedInstances_9.indexOf(ai_3);
- _builder.append(_indexOf_7, " ");
- _builder.append("];");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- ActorClass _actorClass_3 = ai_3.getActorClass();
- String _name_8 = _actorClass_3.getName();
- List<AttrInstanceConfig> _configAttributes_2 = this._configExtension.getConfigAttributes(ai_3);
- CharSequence _applyInstanceConfig = this.configAddon.applyInstanceConfig("inst", _name_8, _configAttributes_2);
- _builder.append(_applyInstanceConfig, " ");
- _builder.newLineIfNotEmpty();
- {
- List<PortInstanceConfig> _configPorts_1 = this._configExtension.getConfigPorts(ai_3);
- for(final PortInstanceConfig portConfig : _configPorts_1) {
- _builder.append("\t\t");
- _builder.append("\t");
- InterfaceItem _item = portConfig.getItem();
- String _name_9 = _item.getName();
- ActorClass _actorClass_4 = ai_3.getActorClass();
- String _name_10 = _actorClass_4.getName();
- CharSequence _invokeGetter = this._procedureHelpers.invokeGetter(_name_9, _name_10);
- String _plus_2 = ("inst." + _invokeGetter);
- InterfaceItem _item_1 = portConfig.getItem();
- String _portClassName = this._roomExtensions.getPortClassName(_item_1);
- EList<AttrInstanceConfig> _attributes = portConfig.getAttributes();
- CharSequence _applyInstanceConfig_1 = this.configAddon.applyInstanceConfig(_plus_2, _portClassName, _attributes);
- _builder.append(_applyInstanceConfig_1, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- }
- }
- }
- }
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("// create the subsystem system port\t");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("RTSystemPort = new RTSystemServicesProtocolConjPortRepl(this, \"RTSystemPort\",");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("0, //local ID");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("// own addresses");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("new Address[]{");
- _builder.newLine();
- {
- EList<ActorInstance> _allContainedInstances_10 = comp.getAllContainedInstances();
- boolean _hasElements_4 = false;
- for(final ActorInstance ai_4 : _allContainedInstances_10) {
- if (!_hasElements_4) {
- _hasElements_4 = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- _builder.append("\t\t\t\t\t");
- _builder.append("addr_item_SystemPort_");
- EList<ActorInstance> _allContainedInstances_11 = comp.getAllContainedInstances();
- int _indexOf_8 = _allContainedInstances_11.indexOf(ai_4);
- _builder.append(_indexOf_8, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t\t\t\t");
- _builder.append("},");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("// peer addresses");
- _builder.newLine();
- _builder.append("\t\t\t\t");
- _builder.append("new Address[]{");
- _builder.newLine();
- {
- EList<ActorInstance> _allContainedInstances_12 = comp.getAllContainedInstances();
- boolean _hasElements_5 = false;
- for(final ActorInstance ai_5 : _allContainedInstances_12) {
- if (!_hasElements_5) {
- _hasElements_5 = true;
- } else {
- _builder.appendImmediate(",", " ");
- }
- _builder.append("\t\t\t\t\t");
- _builder.append("addr_item_");
- String _path_10 = ai_5.getPath();
- String _pathName_8 = this._roomExtensions.getPathName(_path_10);
- _builder.append(_pathName_8, " ");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t\t\t\t");
- _builder.append("});");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.newLine();
- {
- boolean _hasVariableService_1 = this._configExtension.hasVariableService(cc);
- if (_hasVariableService_1) {
- _builder.append("\t\t");
- _builder.append("private VariableService variableService;");
- _builder.newLine();
- }
- }
- _builder.append("\t\t");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("@Override");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("public void init(){");
- _builder.newLine();
- {
- boolean _hasVariableService_2 = this._configExtension.hasVariableService(cc);
- if (_hasVariableService_2) {
- _builder.append("\t\t\t");
- _builder.append("variableService = new ");
- String _name_11 = comp.getName();
- _builder.append(_name_11, " ");
- _builder.append("VariableService(this);");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t\t\t");
- _builder.append("super.init();");
- _builder.newLine();
- {
- boolean _hasVariableService_3 = this._configExtension.hasVariableService(cc);
- if (_hasVariableService_3) {
- _builder.append("\t\t\t");
- _builder.append("variableService.init();");
- _builder.newLine();
- }
- }
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("@Override");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("public void stop(){");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("super.stop();");
- _builder.newLine();
- {
- boolean _hasVariableService_4 = this._configExtension.hasVariableService(cc);
- if (_hasVariableService_4) {
- _builder.append("\t\t\t");
- _builder.append("variableService.stop();");
- _builder.newLine();
- }
- }
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.newLine();
- _builder.append("};");
- _builder.newLine();
- return _builder;
- }
-}
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 bee7d72..0000000
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java
+++ /dev/null
@@ -1,972 +0,0 @@
-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.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.config.ActorClassConfig;
-import org.eclipse.etrice.core.config.ActorInstanceConfig;
-import org.eclipse.etrice.core.config.AttrClassConfig;
-import org.eclipse.etrice.core.config.AttrInstanceConfig;
-import org.eclipse.etrice.core.config.DynamicConfig;
-import org.eclipse.etrice.core.config.NumberLiteral;
-import org.eclipse.etrice.core.config.RefPath;
-import org.eclipse.etrice.core.config.SubSystemConfig;
-import org.eclipse.etrice.core.genmodel.base.ILogger;
-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.generator.generic.ConfigExtension;
-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.generator.JavaIoFileSystemAccess;
-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.Procedures.Procedure1;
-import org.eclipse.xtext.xbase.lib.StringExtensions;
-
-@Singleton
-@SuppressWarnings("all")
-public class VariableServiceGen {
- @Inject
- private JavaIoFileSystemAccess fileAccess;
-
- @Inject
- private JavaExtensions stdExt;
-
- @Inject
- private RoomExtensions roomExt;
-
- @Inject
- private ConfigExtension configExt;
-
- @Inject
- private ProcedureHelpers helpers;
-
- @Inject
- private TypeHelpers _typeHelpers;
-
- @Inject
- private ILogger logger;
-
- public void doGenerate(final Root root, final SubSystemInstance ssi) {
- SubSystemClass _subSystemClass = ssi.getSubSystemClass();
- String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass);
- SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass();
- String _path = this.roomExt.getPath(_subSystemClass_1);
- String path = (_generationTargetPath + _path);
- SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass();
- String _name = _subSystemClass_2.getName();
- String file = (_name + "VariableService.java");
- String _plus = ("generating VariableService implementation: \'" + file);
- 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);
- SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass();
- CharSequence _generate = this.generate(root, ssi, _subSystemClass_3);
- this.fileAccess.generateFile(file, _generate);
- }
-
- private CharSequence generate(final Root root, final SubSystemInstance comp, final SubSystemClass cc) {
- StringConcatenation _builder = new StringConcatenation();
- SubSystemConfig _subSystemConfig = this.configExt.getSubSystemConfig(cc);
- final DynamicConfig dynConfig = _subSystemConfig.getDynConfig();
- _builder.newLineIfNotEmpty();
- _builder.newLine();
- _builder.append("package ");
- String _package = this.roomExt.getPackage(cc);
- _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.VariableService;");
- _builder.newLine();
- {
- String _userCode1 = dynConfig.getUserCode1();
- boolean _notEquals = (!Objects.equal(_userCode1, null));
- if (_notEquals) {
- String _userCode1_1 = dynConfig.getUserCode1();
- _builder.append(_userCode1_1, "");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- } else {
- _builder.append("import org.eclipse.etrice.runtime.java.config.ConfigSourceFile;");
- _builder.newLine();
- }
- }
- List<ActorInstance> ais = this.dynConfigsAIs(comp);
- _builder.newLineIfNotEmpty();
- {
- HashSet<RoomModel> _roomModels = this.getRoomModels(ais);
- 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 ");
- String _name_1 = comp.getName();
- String _plus = (_name_1 + "VariableService");
- _builder.append(_plus, "");
- _builder.append(" extends VariableService{");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("private ");
- String _name_2 = cc.getName();
- _builder.append(_name_2, " ");
- _builder.append(" subSystem;");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("// Actor instances");
- _builder.newLine();
- {
- for(final ActorInstance ai : ais) {
- _builder.append("\t");
- _builder.append("private ");
- ActorClass _actorClass = ai.getActorClass();
- String _name_3 = _actorClass.getName();
- _builder.append(_name_3, " ");
- _builder.append(" ");
- String _path = ai.getPath();
- String[] _split = _path.split("/");
- Iterable<String> _drop = IterableExtensions.<String>drop(((Iterable<String>)Conversions.doWrapArray(_split)), 2);
- String _path_1 = this.configExt.toPath(_drop, "_");
- _builder.append(_path_1, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- _builder.append("\t");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("public ");
- String _name_4 = comp.getName();
- String _plus_1 = (_name_4 + "VariableService");
- _builder.append(_plus_1, " ");
- _builder.append("(");
- String _name_5 = cc.getName();
- _builder.append(_name_5, " ");
- _builder.append(" subSystem) {");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("super(");
- {
- String _filePath = dynConfig.getFilePath();
- boolean _notEquals_1 = (!Objects.equal(_filePath, null));
- if (_notEquals_1) {
- _builder.append("new ConfigSourceFile(\"");
- String _filePath_1 = dynConfig.getFilePath();
- _builder.append(_filePath_1, " ");
- _builder.append("\")");
- } else {
- String _userCode2 = dynConfig.getUserCode2();
- _builder.append(_userCode2, " ");
- }
- }
- _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();
- {
- for(final ActorInstance ai_1 : ais) {
- _builder.append("\t\t");
- String _path_2 = ai_1.getPath();
- String[] _split_1 = _path_2.split("/");
- Iterable<String> _drop_1 = IterableExtensions.<String>drop(((Iterable<String>)Conversions.doWrapArray(_split_1)), 2);
- String _path_3 = this.configExt.toPath(_drop_1, "_");
- _builder.append(_path_3, " ");
- _builder.append(" = (");
- ActorClass _actorClass_1 = ai_1.getActorClass();
- String _name_6 = _actorClass_1.getName();
- _builder.append(_name_6, " ");
- _builder.append(")subSystem.getInstance(\"");
- String _path_4 = ai_1.getPath();
- _builder.append(_path_4, " ");
- _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<String, Object> values) {");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("Object object;");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("String id = null;");
- _builder.newLine();
- {
- Iterable<AttrInstanceConfig> _attrDynConfigs = this.configExt.getAttrDynConfigs(cc, true, false);
- for(final AttrInstanceConfig attrConfig : _attrDynConfigs) {
- _builder.append("\t\t");
- EObject _eContainer = attrConfig.eContainer();
- RefPath _path_5 = ((ActorInstanceConfig) _eContainer).getPath();
- EList<String> _refs = _path_5.getRefs();
- String aiName = this.configExt.toPath(_refs, "_");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("try{");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("boolean changed = false;");
- _builder.newLine();
- {
- Map<Attribute,List<String>> _allAttributes = this.getAllAttributes(attrConfig);
- Set<Entry<Attribute,List<String>>> _entrySet = _allAttributes.entrySet();
- for(final Entry<Attribute,List<String>> entry : _entrySet) {
- _builder.append("\t\t");
- _builder.append("\t");
- Attribute a = entry.getKey();
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- List<String> _path_6 = this.configExt.getPath(attrConfig, true, true, true, false);
- String _path_7 = this.configExt.toPath(_path_6, "/");
- List<String> _value = entry.getValue();
- String _path_8 = this.configExt.toPath(_value, "/");
- String _plus_2 = (_path_7 + _path_8);
- String _plus_3 = (_plus_2 + "/");
- String _name_7 = a.getName();
- String aPath = (_plus_3 + _name_7);
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("id = \"");
- _builder.append(aPath, " ");
- _builder.append("\";");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- {
- int _size = a.getSize();
- boolean _equals = (_size == 0);
- if (_equals) {
- RefableType _refType = a.getRefType();
- DataType _type = _refType.getType();
- String _typeName = this._typeHelpers.typeName(_type);
- String _wrapper = this.stdExt.toWrapper(_typeName);
- _builder.append(_wrapper, " ");
- } else {
- RefableType _refType_1 = a.getRefType();
- DataType _type_1 = _refType_1.getType();
- String _typeName_1 = this._typeHelpers.typeName(_type_1);
- _builder.append(_typeName_1, " ");
- _builder.append("[]");
- }
- }
- _builder.append(" _");
- String _name_8 = a.getName();
- _builder.append(_name_8, " ");
- _builder.append(" = null;");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("object = values.get(id);");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("if(object != null){");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("\t");
- _builder.append("_");
- String _name_9 = a.getName();
- _builder.append(_name_9, " ");
- _builder.append(" = ensure");
- RefableType _refType_2 = a.getRefType();
- DataType _type_2 = _refType_2.getType();
- String _typeName_2 = this._typeHelpers.typeName(_type_2);
- String _firstUpper = StringExtensions.toFirstUpper(_typeName_2);
- _builder.append(_firstUpper, " ");
- {
- 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, " ");
- }
- }
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("\t");
- EObject _eContainer_1 = attrConfig.eContainer();
- ActorClassConfig _actorClassConfig = this.configExt.getActorClassConfig(((ActorInstanceConfig) _eContainer_1));
- CharSequence _genMinMaxCheck = this.genMinMaxCheck(attrConfig, _actorClassConfig);
- _builder.append(_genMinMaxCheck, " ");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("\t");
- _builder.append("if(!");
- {
- int _size_4 = a.getSize();
- boolean _equals_1 = (_size_4 == 0);
- if (_equals_1) {
- _builder.append("_");
- String _name_10 = a.getName();
- _builder.append(_name_10, " ");
- _builder.append(".equals(");
- } else {
- _builder.append("Arrays.equals(_");
- String _name_11 = a.getName();
- _builder.append(_name_11, " ");
- _builder.append(", ");
- }
- }
- _builder.append("(");
- {
- int _size_5 = a.getSize();
- boolean _equals_2 = (_size_5 == 0);
- if (_equals_2) {
- RefableType _refType_3 = a.getRefType();
- DataType _type_3 = _refType_3.getType();
- String _typeName_3 = this._typeHelpers.typeName(_type_3);
- String _wrapper_1 = this.stdExt.toWrapper(_typeName_3);
- _builder.append(_wrapper_1, " ");
- } else {
- RefableType _refType_4 = a.getRefType();
- DataType _type_4 = _refType_4.getType();
- String _typeName_4 = this._typeHelpers.typeName(_type_4);
- _builder.append(_typeName_4, " ");
- _builder.append("[]");
- }
- }
- _builder.append(")getDiffMap().get(id)))");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("\t\t");
- _builder.append("changed = true;");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("} else");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("\t");
- _builder.append("warning(id, \"is missing\");");
- _builder.newLine();
- }
- }
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("if(changed)");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t\t");
- _builder.append("synchronized(");
- _builder.append(aiName, " ");
- _builder.append(".");
- Attribute _attribute = attrConfig.getAttribute();
- String _name_12 = _attribute.getName();
- String _plus_4 = (_name_12 + "Lock");
- CharSequence _invokeGetter = this.helpers.invokeGetter(_plus_4, null);
- _builder.append(_invokeGetter, " ");
- _builder.append("){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t\t\t");
- _builder.append("if(");
- _builder.append(aiName, " ");
- _builder.append(".");
- Attribute _attribute_1 = attrConfig.getAttribute();
- String _name_13 = _attribute_1.getName();
- String _plus_5 = (_name_13 + "Lock");
- CharSequence _invokeGetter_1 = this.helpers.invokeGetter(_plus_5, null);
- _builder.append(_invokeGetter_1, " ");
- _builder.append(".isUpdate()){");
- _builder.newLineIfNotEmpty();
- {
- Map<Attribute,List<String>> _allAttributes_1 = this.getAllAttributes(attrConfig);
- Set<Entry<Attribute,List<String>>> _entrySet_1 = _allAttributes_1.entrySet();
- for(final Entry<Attribute,List<String>> entry_1 : _entrySet_1) {
- _builder.append("\t\t");
- _builder.append("\t\t\t\t");
- _builder.append("if(_");
- Attribute _key = entry_1.getKey();
- String _name_14 = _key.getName();
- _builder.append(_name_14, " ");
- _builder.append(" != null){");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t\t\t\t");
- _builder.append("\t");
- _builder.append(aiName, " ");
- List<String> _value_1 = entry_1.getValue();
- String _invoke = this.toInvoke(_value_1);
- _builder.append(_invoke, " ");
- _builder.append(".");
- Attribute _key_1 = entry_1.getKey();
- String _name_15 = _key_1.getName();
- Attribute _key_2 = entry_1.getKey();
- String _name_16 = _key_2.getName();
- String _plus_6 = ("_" + _name_16);
- CharSequence _invokeSetter = this.helpers.invokeSetter(_name_15, null, _plus_6);
- _builder.append(_invokeSetter, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t\t\t\t");
- _builder.append("\t");
- _builder.append("getDiffMap().put(\"");
- List<String> _path_9 = this.configExt.getPath(attrConfig, true, true, true, false);
- String _path_10 = this.configExt.toPath(_path_9, "/");
- List<String> _value_2 = entry_1.getValue();
- String _path_11 = this.configExt.toPath(_value_2, "/");
- String _plus_7 = (_path_10 + _path_11);
- String _plus_8 = (_plus_7 + "/");
- Attribute _key_3 = entry_1.getKey();
- String _name_17 = _key_3.getName();
- String _plus_9 = (_plus_8 + _name_17);
- _builder.append(_plus_9, " ");
- _builder.append("\", _");
- Attribute _key_4 = entry_1.getKey();
- String _name_18 = _key_4.getName();
- _builder.append(_name_18, " ");
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t\t\t\t");
- _builder.append("}");
- _builder.newLine();
- }
- }
- _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<String, Object> getAttributeValues(){");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("Map<String, Object> values = new HashMap<String, Object>();");
- _builder.newLine();
- {
- Iterable<AttrInstanceConfig> _attrDynConfigs_1 = this.configExt.getAttrDynConfigs(cc, true, false);
- for(final AttrInstanceConfig attrConfig_1 : _attrDynConfigs_1) {
- _builder.append("\t\t");
- EObject _eContainer_2 = attrConfig_1.eContainer();
- RefPath _path_12 = ((ActorInstanceConfig) _eContainer_2).getPath();
- EList<String> _refs_1 = _path_12.getRefs();
- String aiName_1 = this.configExt.toPath(_refs_1, "_");
- _builder.newLineIfNotEmpty();
- {
- Map<Attribute,List<String>> _allAttributes_2 = this.getAllAttributes(attrConfig_1);
- Set<Entry<Attribute,List<String>>> _entrySet_2 = _allAttributes_2.entrySet();
- for(final Entry<Attribute,List<String>> entry_2 : _entrySet_2) {
- _builder.append("\t\t");
- Attribute _key_5 = entry_2.getKey();
- int _size_6 = _key_5.getSize();
- boolean array = (_size_6 > 0);
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- List<String> _path_13 = this.configExt.getPath(attrConfig_1, true, true, true, false);
- String _path_14 = this.configExt.toPath(_path_13, "/");
- List<String> _value_3 = entry_2.getValue();
- String _path_15 = this.configExt.toPath(_value_3, "/");
- String _plus_10 = (_path_14 + _path_15);
- String _plus_11 = (_plus_10 + "/");
- Attribute _key_6 = entry_2.getKey();
- String _name_19 = _key_6.getName();
- String aPath_1 = (_plus_11 + _name_19);
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("values.put(\"");
- _builder.append(aPath_1, " ");
- _builder.append("\", ");
- {
- if (array) {
- _builder.append("toObjectArray(");
- }
- }
- _builder.append(aiName_1, " ");
- List<String> _value_4 = entry_2.getValue();
- String _invoke_1 = this.toInvoke(_value_4);
- _builder.append(_invoke_1, " ");
- _builder.append(".");
- Attribute _key_7 = entry_2.getKey();
- String _name_20 = _key_7.getName();
- CharSequence _invokeGetter_2 = this.helpers.invokeGetter(_name_20, null);
- _builder.append(_invokeGetter_2, " ");
- {
- if (array) {
- _builder.append(")");
- }
- }
- _builder.append(");");
- _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<String, Object> writeMap) {");
- _builder.newLine();
- {
- HashSet<DataClass> _dynDataClasses = this.getDynDataClasses(comp);
- for(final DataClass dc : _dynDataClasses) {
- _builder.append("\t\t");
- _builder.append("if(dcObject.getClass().equals(");
- String _typeName_5 = this._typeHelpers.typeName(dc);
- _builder.append(_typeName_5, " ");
- _builder.append(".class))");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- _builder.append("writeDataClass(id, (");
- String _typeName_6 = this._typeHelpers.typeName(dc);
- _builder.append(_typeName_6, " ");
- _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<DataClass> _allDynDataClasses = this.getAllDynDataClasses(comp);
- for(final DataClass dc_1 : _allDynDataClasses) {
- _builder.append("\t");
- _builder.append("private void writeDataClass(String id, ");
- String _typeName_7 = this._typeHelpers.typeName(dc_1);
- _builder.append(_typeName_7, " ");
- _builder.append(" object, Map<String, Object> map){");
- _builder.newLineIfNotEmpty();
- {
- EList<Attribute> _attributes = dc_1.getAttributes();
- for(final Attribute a_1 : _attributes) {
- {
- RefableType _refType_5 = a_1.getRefType();
- DataType _type_5 = _refType_5.getType();
- boolean _isPrimitive = this._typeHelpers.isPrimitive(_type_5);
- if (_isPrimitive) {
- _builder.append("\t");
- _builder.append("\t");
- _builder.append("map.put(id+\"/");
- String _name_21 = a_1.getName();
- _builder.append(_name_21, " ");
- _builder.append("\", ");
- {
- int _size_7 = a_1.getSize();
- boolean _greaterThan_2 = (_size_7 > 0);
- if (_greaterThan_2) {
- _builder.append("toObjectArray(");
- }
- }
- _builder.append("object.");
- String _name_22 = a_1.getName();
- CharSequence _invokeGetter_3 = this.helpers.invokeGetter(_name_22, null);
- _builder.append(_invokeGetter_3, " ");
- {
- int _size_8 = a_1.getSize();
- boolean _greaterThan_3 = (_size_8 > 0);
- if (_greaterThan_3) {
- _builder.append(")");
- }
- }
- _builder.append(");");
- _builder.newLineIfNotEmpty();
- } else {
- _builder.append("\t");
- _builder.append("\t");
- _builder.append("writeDataClass(id+\"/");
- String _name_23 = a_1.getName();
- _builder.append(_name_23, " ");
- _builder.append("\", object.");
- String _name_24 = a_1.getName();
- CharSequence _invokeGetter_4 = this.helpers.invokeGetter(_name_24, null);
- _builder.append(_invokeGetter_4, " ");
- _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 ");
- int _polling = dynConfig.getPolling();
- _builder.append(_polling, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("\t");
- _builder.newLine();
- _builder.append("}");
- _builder.newLine();
- return _builder;
- }
-
- private CharSequence genMinMaxCheck(final AttrInstanceConfig instConf, final ActorClassConfig acConf) {
- CharSequence _xblockexpression = null;
- {
- List<String> _path = this.configExt.getPath(instConf, false, false, true, true);
- AttrClassConfig config = acConf==null?(AttrClassConfig)null:this.resolve(acConf, ((String[])Conversions.unwrapArray(_path, String.class)));
- boolean _and = false;
- NumberLiteral _min = config==null?(NumberLiteral)null:config.getMin();
- boolean _equals = Objects.equal(_min, null);
- if (!_equals) {
- _and = false;
- } else {
- NumberLiteral _max = config==null?(NumberLiteral)null:config.getMax();
- boolean _equals_1 = Objects.equal(_max, null);
- _and = (_equals && _equals_1);
- }
- if (_and) {
- StringConcatenation _builder = new StringConcatenation();
- return _builder;
- }
- List<String> _path_1 = this.configExt.getPath(config, false, false, true, true);
- String path = this.configExt.toPath(_path_1, "_");
- EObject _eContainer = config.eContainer();
- ActorClass _actor = ((ActorClassConfig) _eContainer).getActor();
- String acName = _actor.getName();
- StringConcatenation _builder_1 = new StringConcatenation();
- _builder_1.append("checkMinMax(_");
- Attribute _attribute = config.getAttribute();
- String _name = _attribute.getName();
- _builder_1.append(_name, "");
- _builder_1.append(", ");
- {
- NumberLiteral _min_1 = config.getMin();
- boolean _notEquals = (!Objects.equal(_min_1, null));
- if (_notEquals) {
- _builder_1.append(acName, "");
- _builder_1.append(".MIN");
- _builder_1.append(path, "");
- } else {
- _builder_1.append("null");
- }
- }
- _builder_1.append(", ");
- {
- NumberLiteral _max_1 = config.getMax();
- boolean _notEquals_1 = (!Objects.equal(_max_1, null));
- if (_notEquals_1) {
- _builder_1.append(acName, "");
- _builder_1.append(".MAX");
- _builder_1.append(path, "");
- } else {
- _builder_1.append("null");
- }
- }
- _builder_1.append(");");
- _builder_1.newLineIfNotEmpty();
- _xblockexpression = (_builder_1);
- }
- return _xblockexpression;
- }
-
- private Map<Attribute,List<String>> getAllAttributes(final AttrInstanceConfig config) {
- HashMap<Attribute,List<String>> _hashMap = new HashMap<Attribute,List<String>>();
- HashMap<Attribute,List<String>> map = _hashMap;
- Attribute _attribute = config.getAttribute();
- RefableType _refType = _attribute.getRefType();
- DataType _type = _refType.getType();
- boolean _isPrimitive = this._typeHelpers.isPrimitive(_type);
- if (_isPrimitive) {
- Attribute _attribute_1 = config.getAttribute();
- ArrayList<String> _arrayList = new ArrayList<String>();
- map.put(_attribute_1, _arrayList);
- } else {
- Attribute _attribute_2 = config.getAttribute();
- LinkedList<String> _linkedList = new LinkedList<String>();
- this.getAllAttributes(_attribute_2, _linkedList, map);
- }
- return map;
- }
-
- private void getAllAttributes(final Attribute attribute, final List<String> path, final Map<Attribute,List<String>> map) {
- RefableType _refType = attribute.getRefType();
- DataType _type = _refType.getType();
- boolean _isPrimitive = this._typeHelpers.isPrimitive(_type);
- if (_isPrimitive) {
- map.put(attribute, path);
- } else {
- RefableType _refType_1 = attribute.getRefType();
- DataType _type_1 = _refType_1.getType();
- boolean _isDataClass = this._typeHelpers.isDataClass(_type_1);
- if (_isDataClass) {
- ArrayList<String> _arrayList = new ArrayList<String>(path);
- ArrayList<String> new_path = _arrayList;
- String _name = attribute.getName();
- new_path.add(_name);
- RefableType _refType_2 = attribute.getRefType();
- DataType _type_2 = _refType_2.getType();
- List<Attribute> _allAttributes = this.roomExt.getAllAttributes(((DataClass) _type_2));
- for (final Attribute dc : _allAttributes) {
- this.getAllAttributes(dc, new_path, map);
- }
- }
- }
- }
-
- private String toInvoke(final List<String> path) {
- StringBuilder _stringBuilder = new StringBuilder();
- StringBuilder builder = _stringBuilder;
- for (final String p : path) {
- CharSequence _invokeGetter = this.helpers.invokeGetter(p, null);
- String _plus = ("." + _invokeGetter);
- builder.append(_plus);
- }
- return builder.toString();
- }
-
- private List<ActorInstance> dynConfigsAIs(final SubSystemInstance comp) {
- HashSet<String> _hashSet = new HashSet<String>();
- final HashSet<String> aiPaths = _hashSet;
- SubSystemClass _subSystemClass = comp.getSubSystemClass();
- Iterable<AttrInstanceConfig> _attrDynConfigs = this.configExt.getAttrDynConfigs(_subSystemClass, true, false);
- for (final AttrInstanceConfig attrConfig : _attrDynConfigs) {
- List<String> _path = this.configExt.getPath(attrConfig, true, true, false, false);
- String _path_1 = this.configExt.toPath(_path, "/");
- aiPaths.add(_path_1);
- }
- ArrayList<ActorInstance> _arrayList = new ArrayList<ActorInstance>();
- ArrayList<ActorInstance> ais = _arrayList;
- EList<ActorInstance> _allContainedInstances = comp.getAllContainedInstances();
- for (final ActorInstance ai : _allContainedInstances) {
- String _path_2 = ai.getPath();
- boolean _contains = aiPaths.contains(_path_2);
- if (_contains) {
- ais.add(ai);
- }
- }
- return ais;
- }
-
- private HashSet<DataClass> getDynDataClasses(final SubSystemInstance comp) {
- HashSet<DataClass> _hashSet = new HashSet<DataClass>();
- HashSet<DataClass> dcs = _hashSet;
- SubSystemClass _subSystemClass = comp.getSubSystemClass();
- Iterable<AttrInstanceConfig> _attrDynConfigs = this.configExt.getAttrDynConfigs(_subSystemClass, false, true);
- for (final AttrInstanceConfig config : _attrDynConfigs) {
- Attribute _attribute = config.getAttribute();
- RefableType _refType = _attribute.getRefType();
- DataType _type = _refType.getType();
- boolean _isDataClass = this._typeHelpers.isDataClass(_type);
- if (_isDataClass) {
- Attribute _attribute_1 = config.getAttribute();
- RefableType _refType_1 = _attribute_1.getRefType();
- DataType _type_1 = _refType_1.getType();
- dcs.add(((DataClass) _type_1));
- }
- }
- return dcs;
- }
-
- private HashSet<DataClass> getAllDynDataClasses(final SubSystemInstance comp) {
- HashSet<DataClass> _hashSet = new HashSet<DataClass>();
- HashSet<DataClass> dcs = _hashSet;
- LinkedList<DataClass> _linkedList = new LinkedList<DataClass>();
- LinkedList<DataClass> stack = _linkedList;
- HashSet<DataClass> _dynDataClasses = this.getDynDataClasses(comp);
- stack.addAll(_dynDataClasses);
- Iterables.<DataClass>addAll(dcs, stack);
- boolean _isEmpty = stack.isEmpty();
- boolean _not = (!_isEmpty);
- boolean _while = _not;
- while (_while) {
- {
- DataClass dc = stack.pop();
- List<Attribute> _allAttributes = this.roomExt.getAllAttributes(dc);
- for (final Attribute a : _allAttributes) {
- RefableType _refType = a.getRefType();
- DataType _type = _refType.getType();
- boolean _isDataClass = this._typeHelpers.isDataClass(_type);
- if (_isDataClass) {
- RefableType _refType_1 = a.getRefType();
- DataType _type_1 = _refType_1.getType();
- dcs.add(((DataClass) _type_1));
- RefableType _refType_2 = a.getRefType();
- DataType _type_2 = _refType_2.getType();
- stack.push(((DataClass) _type_2));
- }
- }
- }
- boolean _isEmpty_1 = stack.isEmpty();
- boolean _not_1 = (!_isEmpty_1);
- _while = _not_1;
- }
- return dcs;
- }
-
- private AttrClassConfig resolve(final ActorClassConfig config, final String[] path) {
- EList<AttrClassConfig> _attributes = config.getAttributes();
- final Function1<AttrClassConfig,Boolean> _function = new Function1<AttrClassConfig,Boolean>() {
- public Boolean apply(final AttrClassConfig c) {
- Attribute _attribute = c.getAttribute();
- String _name = _attribute.getName();
- String _head = IterableExtensions.<String>head(((Iterable<String>)Conversions.doWrapArray(path)));
- boolean _equals = _name.equals(_head);
- return Boolean.valueOf(_equals);
- }
- };
- AttrClassConfig result = IterableExtensions.<AttrClassConfig>findFirst(_attributes, _function);
- Iterable<String> _tail = IterableExtensions.<String>tail(((Iterable<String>)Conversions.doWrapArray(path)));
- for (final String ref : _tail) {
- {
- EList<AttrClassConfig> _attributes_1 = result==null?(EList<AttrClassConfig>)null:result.getAttributes();
- final Function1<AttrClassConfig,Boolean> _function_1 = new Function1<AttrClassConfig,Boolean>() {
- public Boolean apply(final AttrClassConfig c) {
- Attribute _attribute = c.getAttribute();
- String _name = _attribute.getName();
- boolean _equals = _name.equals(ref);
- return Boolean.valueOf(_equals);
- }
- };
- AttrClassConfig _findFirst = IterableExtensions.<AttrClassConfig>findFirst(_attributes_1, _function_1);
- result = _findFirst;
- boolean _equals = Objects.equal(result, null);
- if (_equals) {
- return null;
- }
- }
- }
- return result;
- }
-
- private HashSet<RoomModel> getRoomModels(final List<ActorInstance> ais) {
- HashSet<RoomModel> _hashSet = new HashSet<RoomModel>();
- final HashSet<RoomModel> models = _hashSet;
- final Procedure1<ActorInstance> _function = new Procedure1<ActorInstance>() {
- public void apply(final ActorInstance ai) {
- ActorClass _actorClass = ai.getActorClass();
- EObject _eContainer = _actorClass.eContainer();
- models.add(((RoomModel) _eContainer));
- }
- };
- IterableExtensions.<ActorInstance>forEach(ais, _function);
- return models;
- }
-}
diff --git a/runtime/org.eclipse.etrice.runtime.c/.cproject b/runtime/org.eclipse.etrice.runtime.c/.cproject
index becaa71..4383b57 100644
--- a/runtime/org.eclipse.etrice.runtime.c/.cproject
+++ b/runtime/org.eclipse.etrice.runtime.c/.cproject
@@ -43,7 +43,6 @@
<option id="gnu.c.compiler.option.include.paths.790097072" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/platforms/generic}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/config}&quot;"/>
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/config}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/common}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.361048721" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
@@ -119,8 +118,13 @@
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
</storageModule>
- <storageModule moduleId="refreshScope" versionNumber="1">
- <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.c"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Release">
+ <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.c"/>
+ </configuration>
+ <configuration configurationName="Debug">
+ <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.c"/>
+ </configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>