summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjung2012-09-08 15:03:33 (EDT)
committertjung2012-09-08 15:03:33 (EDT)
commit26a574d7b5cb4e75471b38780ab4cf5c510574e0 (patch)
treef546427be259db73cf98b653eee57be25a0463a7
parenta2d26a7a7bc5746c2f6f1493e9385fa75b5f126d (diff)
downloadorg.eclipse.etrice-26a574d7b5cb4e75471b38780ab4cf5c510574e0.zip
org.eclipse.etrice-26a574d7b5cb4e75471b38780ab4cf5c510574e0.tar.gz
org.eclipse.etrice-26a574d7b5cb4e75471b38780ab4cf5c510574e0.tar.bz2
[tutorials] Hello World added
-rw-r--r--plugins/org.eclipse.etrice.doc/build/etrice.textile139
-rw-r--r--plugins/org.eclipse.etrice.doc/build/etrice.xml231
-rw-r--r--plugins/org.eclipse.etrice.doc/help/FiniteStateMachines.html4
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Layering2.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/help/Ports.html4
-rw-r--r--plugins/org.eclipse.etrice.doc/help/ROOMConcepts.html6
-rw-r--r--plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceC.html2
-rw-r--r--plugins/org.eclipse.etrice.doc/html/etrice.html402
-rw-r--r--plugins/org.eclipse.etrice.doc/manual/etrice.pdfbin5404056 -> 5745411 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/toc.xml13
10 files changed, 784 insertions, 19 deletions
diff --git a/plugins/org.eclipse.etrice.doc/build/etrice.textile b/plugins/org.eclipse.etrice.doc/build/etrice.textile
index 8308e3c..ab07f12 100644
--- a/plugins/org.eclipse.etrice.doc/build/etrice.textile
+++ b/plugins/org.eclipse.etrice.doc/build/etrice.textile
@@ -999,6 +999,145 @@ Verify the output.
Remember these steps. In the following Tutorials these steps will be referenced as _build and run_.
+h1. Tutorial HelloWorld ( 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.
+You will perform the following steps:
+
+# create a new model from scratch for C
+# create structure and behavior similar to Java
+# create a launch configuration for the C code generator
+# generate the source code
+# run the model
+
+Make sure that you have set up the workspace as described in _Setting up the workspace ( C )_.
+
+
+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 )_.
+Remember:
+- select the _C/C++_ perspective
+- From the main menue select _File->New->C Project_
+- Name the project _HelloWorldC_
+- Project type is _Executable / Empty C Project_
+- Toolchain is _MinGW_
+
+The workspace should look like this:
+
+!images/034-HelloWorldC01.png!
+
+The next step is to add the model folder:
+Right click on the new project. Select _New->Folder_ and name it _model_.
+
+!images/034-HelloWorldC02.png!
+
+Add the model file to the folder. Right click on the new folder. Select _New->file_ and name it _HelloWorldC.room_.
+
+!images/034-HelloWorldC03.png!
+
+Due to the file ending _.room_ the tool will ask you to add the Xtext nature. Answer with _Yes_.
+
+!images/034-HelloWorldC04.png!
+
+The workspace should look like this:
+
+!images/034-HelloWorldC05.png!
+
+
+
+h2. Create the HelloWorld model
+
+Once the model file is created and the Xtext nature is added, you can create the model as you did it for Java.
+Creating the model is not the focus of this tutorial. Therefore copy and paste the following code into your model file. Optionally you can open and layout the diagrams.
+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.
+
+ToDo: shutdown must be not depend on the subsystem.
+
+bc..
+RoomModel HelloWorldCModel {
+ import room.basic.types.c.* from "../../org.eclipse.etrice.modellib.c/model/CTypes.room"
+ SubSystemClass HelloWorldCSubSysClass {
+ ActorRef HelloETriceTopRef:AHelloWorldCTop
+ }
+ ActorClass AHelloWorldCTop {
+ Structure { }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> state0 { }
+ State state0 {
+ entry {
+ "printf(\"HelloETrice !\\n\");"
+ "HelloETriceSubSysClass_shutdown();//exit(0);"
+ "\t\t\t\t\t\t"
+ }
+ }
+ }
+ }
+ }
+}
+bq.
+
+h2. Create a launch configuration to start the C codegenerator
+
+h2. Generate the code
+
+h2. Setup the include path
+
+h2. Run the model
+
+h2. Summary
+
+
+We will implement the Hello World code on the initial transition of the _HelloWorldTop_ actor. Therefore open the state machine editor by right clicking the _HelloWorldTop_ actor in the outline view and select _Edit Behavior_.
+
+!images/015-HelloWorld03.png!
+
+The state machine editor will be opened. Drag and drop an _Initial Point_ from the tool box to the diagram into the top level state. Drag and drop a _State_ from the tool box to the diagram. Confirm the dialogue with _ok_. Select the _Transition_ in the tool box and draw the transition from the _Initial Point_ to the State. Open the transition dialogue by double clicking the transition arrow and fill in the action code.
+
+bc. System.out.println("Hello World !");
+
+The result should look like this:
+
+!images/015-HelloWorld04.png!
+
+Save the diagram and inspect the model file. Note that the textual representation was created after saving the diagram.
+
+!images/015-HelloWorld05.png!
+
+
+h2. Build and run the model
+
+Now the model is finished and source code can be generated. The project wizard has created a launch configuration that is responsible for generating the source code. From _HelloWorld/_ right click *gen_HelloWorld.launch* and run it as gen_HelloWorld. All model files in the model directory will be generated.
+
+!images/015-HelloWorld06.png!
+
+The code will be generated to the src-gen directory. The main function will be contained in *SubSystem_HelloWorldRunner.java*. Select this file and run it as Java application.
+
+!images/015-HelloWorld07.png!
+
+
+The Hello World application starts and the string will be printed on the console window. To stop the application the user must type _quit_ in the console window.
+
+!images/015-HelloWorld08.png!
+
+h2. Open the Message Sequence Chart
+
+During runtime the application produced a MSC and wrote it to a file. Open HelloWorld/tmp/log/SubSystem_HelloWorld_Async.seq using Trace2UML (it is open source and can be obtained from http://trace2uml.tigris.org/). You should see something like this:
+
+!images/015-HelloWorld09.png!
+
+
+h2. Summary
+
+Now you have generated your first eTrice model from scratch. You can switch between diagram editor and model (.room file) and you can see what will be generated during editing and saving the diagram files.
+You should take a look at the generated source files to understand how the state machine is generated and the life cycle of the application. The next tutorials will deal with more complex hierarchies in structure and behavior.
+
+
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 5fb59af..79dad76 100644
--- a/plugins/org.eclipse.etrice.doc/build/etrice.xml
+++ b/plugins/org.eclipse.etrice.doc/build/etrice.xml
@@ -1795,6 +1795,237 @@ carLights.setState(TrafficLight3.OFF);
</para>
</section>
</chapter>
+ <chapter id="TutorialHelloWorldC">
+ <title>Tutorial HelloWorld ( 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.
+ You will perform the following steps:</para>
+ <orderedlist>
+ <listitem>
+ <para>create a new model from scratch for C</para>
+ </listitem>
+ <listitem>
+ <para>create structure and behavior similar to Java</para>
+ </listitem>
+ <listitem>
+ <para>create a launch configuration for the C code generator</para>
+ </listitem>
+ <listitem>
+ <para>generate the source code</para>
+ </listitem>
+ <listitem>
+ <para>run the model</para>
+ </listitem>
+ </orderedlist>
+ <para>Make sure that you have set up the workspace as described in
+ <emphasis>Setting up the workspace ( C )</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>.
+ Remember:
+ - select the
+ <emphasis>C/C++</emphasis> perspective
+ - From the main menue select
+ <emphasis>File-&gt;New-&gt;C Project</emphasis>
+ - Name the project
+ <emphasis>HelloWorldC</emphasis>
+ - Project type is
+ <emphasis>Executable / Empty C Project</emphasis>
+ - Toolchain is
+ <emphasis>MinGW</emphasis>
+ </para>
+ <para>The workspace should look like this:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/034-HelloWorldC01.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>The next step is to add the model folder:
+ Right click on the new project. Select
+ <emphasis>New-&gt;Folder</emphasis> and name it
+ <emphasis>model</emphasis>.
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/034-HelloWorldC02.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>Add the model file to the folder. Right click on the new folder. Select
+ <emphasis>New-&gt;file</emphasis> and name it
+ <emphasis>HelloWorldC.room</emphasis>.
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/034-HelloWorldC03.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>Due to the file ending
+ <emphasis>.room</emphasis> the tool will ask you to add the Xtext nature. Answer with
+ <emphasis>Yes</emphasis>.
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/034-HelloWorldC04.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>The workspace should look like this:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/034-HelloWorldC05.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </section>
+ <section id="CreatetheHelloWorldmodel">
+ <title>Create the HelloWorld model</title>
+ <para>Once the model file is created and the Xtext nature is added, you can create the model as you did it for Java.
+ Creating the model is not the focus of this tutorial. Therefore copy and paste the following code into your model file. Optionally you can open and layout the diagrams.
+ 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.</para>
+ <para>ToDo: shutdown must be 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 {
+ ActorRef HelloETriceTopRef:AHelloWorldCTop
+ }
+ ActorClass AHelloWorldCTop {
+ Structure { }
+ Behavior {
+ StateMachine {
+ Transition init: initial -&gt; state0 { }
+ State state0 {
+ entry {
+ "printf(\"HelloETrice !\\n\");"
+ "HelloETriceSubSysClass_shutdown();//exit(0);"
+ "\t\t\t\t\t\t"
+ }
+ }
+ }
+ }
+ }
+}
+</code></literallayout>
+ <blockquote>
+ <para></para>
+ </blockquote>
+ </section>
+ <section id="CreatealaunchconfigurationtostarttheCcodegenerator">
+ <title>Create a launch configuration to start the C codegenerator</title>
+ </section>
+ <section id="Generatethecode">
+ <title>Generate the code</title>
+ </section>
+ <section id="Setuptheincludepath">
+ <title>Setup the include path</title>
+ </section>
+ <section id="Runthemodel">
+ <title>Run the model</title>
+ </section>
+ <section id="Summary4">
+ <title>Summary</title>
+ <para>We will implement the Hello World code on the initial transition of the
+ <emphasis>HelloWorldTop</emphasis> actor. Therefore open the state machine editor by right clicking the
+ <emphasis>HelloWorldTop</emphasis> actor in the outline view and select
+ <emphasis>Edit Behavior</emphasis>.
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/015-HelloWorld03.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>The state machine editor will be opened. Drag and drop an
+ <emphasis>Initial Point</emphasis> from the tool box to the diagram into the top level state. Drag and drop a
+ <emphasis>State</emphasis> from the tool box to the diagram. Confirm the dialogue with
+ <emphasis>ok</emphasis>. Select the
+ <emphasis>Transition</emphasis> in the tool box and draw the transition from the
+ <emphasis>Initial Point</emphasis> to the State. Open the transition dialogue by double clicking the transition arrow and fill in the action code.
+ </para>
+ <literallayout><code>System.out.println("Hello World !");
+</code></literallayout>
+ <para>The result should look like this:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/015-HelloWorld04.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>Save the diagram and inspect the model file. Note that the textual representation was created after saving the diagram.</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/015-HelloWorld05.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </section>
+ <section id="Buildandrunthemodel2">
+ <title>Build and run the model</title>
+ <para>Now the model is finished and source code can be generated. The project wizard has created a launch configuration that is responsible for generating the source code. From
+ <emphasis>HelloWorld/</emphasis> right click
+ <emphasis role="bold">gen_HelloWorld.launch</emphasis> and run it as gen_HelloWorld. All model files in the model directory will be generated.
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/015-HelloWorld06.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>The code will be generated to the src-gen directory. The main function will be contained in
+ <emphasis role="bold">SubSystem_HelloWorldRunner.java</emphasis>. Select this file and run it as Java application.
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/015-HelloWorld07.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>The Hello World application starts and the string will be printed on the console window. To stop the application the user must type
+ <emphasis>quit</emphasis> in the console window.
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/015-HelloWorld08.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </section>
+ <section id="OpentheMessageSequenceChart2">
+ <title>Open the Message Sequence Chart</title>
+ <para>During runtime the application produced a MSC and wrote it to a file. Open HelloWorld/tmp/log/SubSystem_HelloWorld_Async.seq using Trace2UML (it is open source and can be obtained from http://trace2uml.tigris.org/). You should see something like this:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/015-HelloWorld09.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </section>
+ <section id="Summary5">
+ <title>Summary</title>
+ <para>Now you have generated your first eTrice model from scratch. You can switch between diagram editor and model (.room file) and you can see what will be generated during editing and saving the diagram files.
+ You should take a look at the generated source files to understand how the state machine is generated and the life cycle of the application. The next tutorials will deal with more complex hierarchies in structure and behavior.</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.
diff --git a/plugins/org.eclipse.etrice.doc/help/FiniteStateMachines.html b/plugins/org.eclipse.etrice.doc/help/FiniteStateMachines.html
index ee426dd..73c824e 100644
--- a/plugins/org.eclipse.etrice.doc/help/FiniteStateMachines.html
+++ b/plugins/org.eclipse.etrice.doc/help/FiniteStateMachines.html
@@ -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="N10D7F">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10E94">
<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="N10E3E">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10F53">
<tr>
<td align="center">
diff --git a/plugins/org.eclipse.etrice.doc/help/Layering2.html b/plugins/org.eclipse.etrice.doc/help/Layering2.html
index 1879271..7013249 100644
--- a/plugins/org.eclipse.etrice.doc/help/Layering2.html
+++ b/plugins/org.eclipse.etrice.doc/help/Layering2.html
@@ -53,7 +53,7 @@
</div>
</div>
</div>
-<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10CCF">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10DE4">
<tr>
<td align="center">
diff --git a/plugins/org.eclipse.etrice.doc/help/Ports.html b/plugins/org.eclipse.etrice.doc/help/Ports.html
index f336019..4bea3c6 100644
--- a/plugins/org.eclipse.etrice.doc/help/Ports.html
+++ b/plugins/org.eclipse.etrice.doc/help/Ports.html
@@ -111,7 +111,7 @@
</li>
</ul>
</div>
-<table title="Class Port Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10AD4">
+<table title="Class Port Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10BE9">
<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="N10C0C">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10D21">
<tr>
<td align="center">
diff --git a/plugins/org.eclipse.etrice.doc/help/ROOMConcepts.html b/plugins/org.eclipse.etrice.doc/help/ROOMConcepts.html
index fde9deb..c5115ff 100644
--- a/plugins/org.eclipse.etrice.doc/help/ROOMConcepts.html
+++ b/plugins/org.eclipse.etrice.doc/help/ROOMConcepts.html
@@ -6,7 +6,7 @@
<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="SettinguptheWorkspaceC.html" title="Setting up the Workspace ( C )">
+<link rel="prev" href="Summary5.html" title="Summary">
<link rel="next" href="Protocols.html" title="Protocols">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -102,7 +102,7 @@
</div>
</div>
</div>
-<table title="Actor Class Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10948">
+<table title="Actor Class Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10A5D">
<tr>
<td align="center">
@@ -185,7 +185,7 @@
<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="N109CD">
+<table title="Actor Class Example" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10AE2">
<tr>
<td align="center">
diff --git a/plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceC.html b/plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceC.html
index 51f2a1a..ed1e8cf 100644
--- a/plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceC.html
+++ b/plugins/org.eclipse.etrice.doc/help/SettinguptheWorkspaceC.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="Whydoesitworkandwhyisitsafe.html" title="Why does it work and why is it safe?">
-<link rel="next" href="ROOMConcepts.html" title="ROOM Concepts">
+<link rel="next" href="TutorialHelloWorldC.html" title="Tutorial HelloWorld ( C )">
</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>
diff --git a/plugins/org.eclipse.etrice.doc/html/etrice.html b/plugins/org.eclipse.etrice.doc/html/etrice.html
index 6c20ae3..8651a3c 100644
--- a/plugins/org.eclipse.etrice.doc/html/etrice.html
+++ b/plugins/org.eclipse.etrice.doc/html/etrice.html
@@ -173,7 +173,47 @@
</dl>
</dd>
<dt>
-<span class="chapter"><a href="#ROOMConcepts">10. ROOM Concepts</a></span>
+<span class="chapter"><a href="#TutorialHelloWorldC">10. Tutorial HelloWorld ( C )</a></span>
+</dt>
+<dd>
+<dl>
+<dt>
+<span class="section"><a href="#Scope5">Scope</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Createanewmodelfromscratch4">Create a new model from scratch</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#CreatetheHelloWorldmodel">Create the HelloWorld model</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#CreatealaunchconfigurationtostarttheCcodegenerator">Create a launch configuration to start the C codegenerator</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Generatethecode">Generate the code</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Setuptheincludepath">Setup the include path</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Runthemodel">Run the model</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Summary4">Summary</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Buildandrunthemodel2">Build and run the model</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#OpentheMessageSequenceChart2">Open the Message Sequence Chart</a></span>
+</dt>
+<dt>
+<span class="section"><a href="#Summary5">Summary</a></span>
+</dt>
+</dl>
+</dd>
+<dt>
+<span class="chapter"><a href="#ROOMConcepts">11. ROOM Concepts</a></span>
</dt>
<dd>
<dl>
@@ -2665,12 +2705,354 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</p>
</div>
</div>
-<div class="chapter" title="Chapter&nbsp;10.&nbsp;ROOM Concepts">
+<div class="chapter" title="Chapter&nbsp;10.&nbsp;Tutorial HelloWorld ( C )">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title">
+<a name="TutorialHelloWorldC"></a>Chapter&nbsp;10.&nbsp;Tutorial HelloWorld ( C )</h2>
+</div>
+</div>
+</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>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 class="section" title="Create a new model from scratch">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Createanewmodelfromscratch4"></a>Create a new model from scratch</h2>
+</div>
+</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>.
+ Remember:
+ - 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>HelloWorldC</em></span>
+ - Project type is
+ <span class="emphasis"><em>Executable / Empty C Project</em></span>
+ - Toolchain is
+ <span class="emphasis"><em>MinGW</em></span>
+
+</p>
+<p>The workspace should look like this:</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/034-HelloWorldC01.png"></div>
+<p>
+
+</p>
+<p>The next step is to add the model folder:
+ Right click on the new project. Select
+ <span class="emphasis"><em>New-&gt;Folder</em></span> and name it
+ <span class="emphasis"><em>model</em></span>.
+ </p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/034-HelloWorldC02.png"></div>
+<p>
+
+</p>
+<p>Add the model file to the folder. Right click on the new folder. Select
+ <span class="emphasis"><em>New-&gt;file</em></span> and name it
+ <span class="emphasis"><em>HelloWorldC.room</em></span>.
+ </p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/034-HelloWorldC03.png"></div>
+<p>
+
+</p>
+<p>Due to the file ending
+ <span class="emphasis"><em>.room</em></span> the tool will ask you to add the Xtext nature. Answer with
+ <span class="emphasis"><em>Yes</em></span>.
+ </p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/034-HelloWorldC04.png"></div>
+<p>
+
+</p>
+<p>The workspace should look like this:</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/034-HelloWorldC05.png"></div>
+<p>
+
+</p>
+</div>
+<div class="section" title="Create the HelloWorld model">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="CreatetheHelloWorldmodel"></a>Create the HelloWorld model</h2>
+</div>
+</div>
+</div>
+<p>Once the model file is created and the Xtext nature is added, you can create the model as you did it for Java.
+ Creating the model is not the focus of this tutorial. Therefore copy and paste the following code into your model file. Optionally you can open and layout the diagrams.
+ 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.</p>
+<p>ToDo: shutdown must be not depend on the subsystem.</p>
+<div class="literallayout">
+<p>
+<code class="code">RoomModel&nbsp;HelloWorldCModel&nbsp;{<br>
+ import&nbsp;room.basic.types.c.*&nbsp;from&nbsp;"../../org.eclipse.etrice.modellib.c/model/CTypes.room"<br>
+ SubSystemClass&nbsp;HelloWorldCSubSysClass&nbsp;{<br>
+ ActorRef&nbsp;HelloETriceTopRef:AHelloWorldCTop&nbsp;<br>
+ }<br>
+ ActorClass&nbsp;AHelloWorldCTop&nbsp;{<br>
+ Structure&nbsp;{&nbsp;}<br>
+ Behavior&nbsp;{<br>
+ StateMachine&nbsp;{<br>
+ Transition&nbsp;init:&nbsp;initial&nbsp;-&gt;&nbsp;state0&nbsp;{&nbsp;}<br>
+ State&nbsp;state0&nbsp;{<br>
+ entry&nbsp;{<br>
+ "printf(\"HelloETrice&nbsp;!\\n\");"<br>
+ "HelloETriceSubSysClass_shutdown();//exit(0);"<br>
+ "\t\t\t\t\t\t"<br>
+ }<br>
+ }<br>
+ }<br>
+ }<br>
+ } <br>
+}<br>
+
+</code>
+</p>
+</div>
+<div class="blockquote">
+<blockquote class="blockquote">
+<p></p>
+</blockquote>
+</div>
+</div>
+<div class="section" title="Create a launch configuration to start the C codegenerator">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="CreatealaunchconfigurationtostarttheCcodegenerator"></a>Create a launch configuration to start the C codegenerator</h2>
+</div>
+</div>
+</div>
+</div>
+<div class="section" title="Generate the code">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Generatethecode"></a>Generate the code</h2>
+</div>
+</div>
+</div>
+</div>
+<div class="section" title="Setup the include path">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Setuptheincludepath"></a>Setup the include path</h2>
+</div>
+</div>
+</div>
+</div>
+<div class="section" title="Run the model">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Runthemodel"></a>Run the model</h2>
+</div>
+</div>
+</div>
+</div>
+<div class="section" title="Summary">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Summary4"></a>Summary</h2>
+</div>
+</div>
+</div>
+<p>We will implement the Hello World code on the initial transition of the
+ <span class="emphasis"><em>HelloWorldTop</em></span> actor. Therefore open the state machine editor by right clicking the
+ <span class="emphasis"><em>HelloWorldTop</em></span> actor in the outline view and select
+ <span class="emphasis"><em>Edit Behavior</em></span>.
+ </p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/015-HelloWorld03.png"></div>
+<p>
+
+</p>
+<p>The state machine editor will be opened. Drag and drop an
+ <span class="emphasis"><em>Initial Point</em></span> from the tool box to the diagram into the top level state. Drag and drop a
+ <span class="emphasis"><em>State</em></span> from the tool box to the diagram. Confirm the dialogue with
+ <span class="emphasis"><em>ok</em></span>. Select the
+ <span class="emphasis"><em>Transition</em></span> in the tool box and draw the transition from the
+ <span class="emphasis"><em>Initial Point</em></span> to the State. Open the transition dialogue by double clicking the transition arrow and fill in the action code.
+ </p>
+<div class="literallayout">
+<p>
+<code class="code">System.out.println("Hello&nbsp;World&nbsp;!");<br>
+
+</code>
+</p>
+</div>
+<p>The result should look like this:</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/015-HelloWorld04.png"></div>
+<p>
+
+</p>
+<p>Save the diagram and inspect the model file. Note that the textual representation was created after saving the diagram.</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/015-HelloWorld05.png"></div>
+<p>
+
+</p>
+</div>
+<div class="section" title="Build and run the model">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="Buildandrunthemodel2"></a>Build and run the model</h2>
+</div>
+</div>
+</div>
+<p>Now the model is finished and source code can be generated. The project wizard has created a launch configuration that is responsible for generating the source code. From
+ <span class="emphasis"><em>HelloWorld/</em></span> right click
+ <span class="bold"><strong>gen_HelloWorld.launch</strong></span> and run it as gen_HelloWorld. All model files in the model directory will be generated.
+ </p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/015-HelloWorld06.png"></div>
+<p>
+
+</p>
+<p>The code will be generated to the src-gen directory. The main function will be contained in
+ <span class="bold"><strong>SubSystem_HelloWorldRunner.java</strong></span>. Select this file and run it as Java application.
+ </p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/015-HelloWorld07.png"></div>
+<p>
+
+</p>
+<p>The Hello World application starts and the string will be printed on the console window. To stop the application the user must type
+ <span class="emphasis"><em>quit</em></span> in the console window.
+ </p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/015-HelloWorld08.png"></div>
+<p>
+
+</p>
+</div>
+<div class="section" title="Open the Message Sequence Chart">
+<div class="titlepage">
+<div>
+<div>
+<h2 class="title" style="clear: both">
+<a name="OpentheMessageSequenceChart2"></a>Open the Message Sequence Chart</h2>
+</div>
+</div>
+</div>
+<p>During runtime the application produced a MSC and wrote it to a file. Open HelloWorld/tmp/log/SubSystem_HelloWorld_Async.seq using Trace2UML (it is open source and can be obtained from http://trace2uml.tigris.org/). You should see something like this:</p>
+<p>
+
+</p>
+<div class="mediaobject">
+<img src="images/015-HelloWorld09.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>Now you have generated your first eTrice model from scratch. You can switch between diagram editor and model (.room file) and you can see what will be generated during editing and saving the diagram files.
+ You should take a look at the generated source files to understand how the state machine is generated and the life cycle of the application. The next tutorials will deal with more complex hierarchies in structure and behavior.</p>
+</div>
+</div>
+<div class="chapter" title="Chapter&nbsp;11.&nbsp;ROOM Concepts">
<div class="titlepage">
<div>
<div>
<h2 class="title">
-<a name="ROOMConcepts"></a>Chapter&nbsp;10.&nbsp;ROOM Concepts</h2>
+<a name="ROOMConcepts"></a>Chapter&nbsp;11.&nbsp;ROOM Concepts</h2>
</div>
</div>
</div>
@@ -2734,7 +3116,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
</div>
</div>
-<table title="Actor Class Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10948">
+<table title="Actor Class Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10A5D">
<tr>
<td align="center">
@@ -2817,7 +3199,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="N109CD">
+<table title="Actor Class Example" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10AE2">
<tr>
<td align="center">
@@ -3099,7 +3481,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</li>
</ul>
</div>
-<table title="Class Port Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10AD4">
+<table title="Class Port Notation" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10BE9">
<tr>
<td align="center">
@@ -3297,7 +3679,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="N10C0C">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10D21">
<tr>
<td align="center">
@@ -3454,7 +3836,7 @@ carLights.setState(TrafficLight3.OFF);&nbsp;<br>
</div>
</div>
</div>
-<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10CCF">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10DE4">
<tr>
<td align="center">
@@ -3585,7 +3967,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="N10D7F">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10E94">
<tr>
<td align="center">
@@ -3699,7 +4081,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="N10E3E">
+<table title="Title" frame="box" border="2" cellpadding="3" cellspacing="0" id="N10F53">
<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 c294229..dafdb71 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 9e3b806..09d2bbf 100644
--- a/plugins/org.eclipse.etrice.doc/toc.xml
+++ b/plugins/org.eclipse.etrice.doc/toc.xml
@@ -69,6 +69,19 @@
<topic href="help/SettinguptheWorkspaceC.html" label="Setting up the Workspace ( C )">
<topic href="help/SettinguptheWorkspaceC.html#Testingtheenvironment" label="Testing the environment"></topic>
</topic>
+<topic href="help/TutorialHelloWorldC.html" label="Tutorial HelloWorld ( C )">
+<topic href="help/TutorialHelloWorldC.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 codegenerator"></topic>
+<topic href="help/Generatethecode.html" label="Generate the code"></topic>
+<topic href="help/Setuptheincludepath.html" label="Setup the include path"></topic>
+<topic href="help/Runthemodel.html" label="Run the model"></topic>
+<topic href="help/Summary4.html" label="Summary"></topic>
+<topic href="help/Buildandrunthemodel2.html" label="Build and run the model"></topic>
+<topic href="help/OpentheMessageSequenceChart2.html" label="Open the Message Sequence Chart"></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>