Browse Source

Documentation for Generator features added to user doc

Andreas Mülder 13 years ago
parent
commit
aa1d60e972

+ 2 - 1
plugins/org.yakindu.sct.doc.user/.settings/org.eclipse.core.resources.prefs

@@ -1,3 +1,4 @@
-#Mon Mar 26 07:16:00 CEST 2012
+#Thu Apr 19 15:15:01 CEST 2012
 eclipse.preferences.version=1
+encoding//help/user/04_Tasks/tasks.html=utf-8
 encoding/<project>=UTF-8

+ 4 - 1
plugins/org.yakindu.sct.doc.user/contexts.xml

@@ -25,6 +25,9 @@
    <context id="sc_properties_transition_expression" title="YAKINDU Statechart Element Properties">
       <description>A transition is the transfer of one state to another. Transitions are diagrammed as arrows and can carry events and actions but must not.</description>
       <topic href="help/user/05_Reference/reference.html#Transitions" label="Transitions reference"/>
-      
+ 	     
+   </context>
+   <context id="sc_genmodel_features" title="Genmodel Features">
+      <topic href="help/user/04_Tasks/tasks.html" label="Outlet"/>
    </context>
 </contexts>

+ 13 - 3
plugins/org.yakindu.sct.doc.user/help/user/04_Tasks/tasks-toc.xml

@@ -6,8 +6,18 @@
 		</topic>
 		<topic href="help/user/04_Tasks/tasks.html#Validatingastatemachine" label="Validating a statemachine"></topic>
 		<topic href="help/user/04_Tasks/tasks.html#Simulatingastatemachine" label="Simulating a statemachine"></topic>
-		<topic href="help/user/04_Tasks/tasks.html#GeneratingJavacode" label="Generating Java code"></topic>
-		<topic href="help/user/04_Tasks/tasks.html#GeneratingCcode" label="Generating C code"></topic>
-		<topic href="help/user/04_Tasks/tasks.html#GeneratingCCode" label="Generating C++ Code"></topic>
+		<topic href="help/user/04_Tasks/tasks.html#GeneratingCode" label="Generating Code"></topic>
+		<topic href="help/user/04_Tasks/tasks.html#CoreFeatures" label="Core Features">
+			<topic href="help/user/04_Tasks/tasks.html#Outlet" label="Outlet"></topic>
+			<topic href="help/user/04_Tasks/tasks.html#LicenseHeader" label="LicenseHeader"></topic>
+			<topic href="help/user/04_Tasks/tasks.html#FunctionInlining" label="FunctionInlining"></topic>
+		</topic>
+		<topic href="help/user/04_Tasks/tasks.html#JavaGeneratorFeatures" label="Java Generator Features">
+			<topic href="help/user/04_Tasks/tasks.html#Naming" label="Naming"></topic>
+			<topic href="help/user/04_Tasks/tasks.html#GeneralFeatures" label="GeneralFeatures
+TBD"></topic>
+		</topic>
+		<topic href="help/user/04_Tasks/tasks.html#CGeneratorFetures" label="C Generator Fetures
+TBD"></topic>
 	</topic>
 </toc>

+ 121 - 127
plugins/org.yakindu.sct.doc.user/help/user/04_Tasks/tasks.html

@@ -98,8 +98,11 @@
 			<br/>
 			<a href="../03_Concepts/concepts.html#SimulationView">Simulation View</a>
 		</p>
-		<h2 id="GeneratingJavacode">Generating Java code</h2>
-		<p>To generate Java code you need a java genmodel.</p>
+		<h2 id="GeneratingCode">Generating Code</h2>
+		<p>For code generation, Yakindu Statechart Tools uses a textual generator model called 
+			<strong>SGen</strong>, that can be used to configure the code generation process. It can be created either by using the provided wizard or by creating a new text file with the file extension &#8218;.sgen&#8217;.
+			<br/>To create a generator model with the wizard,
+		</p>
 		<ol>
 			<li>Click 
 				<strong>File</strong> &gt; 
@@ -110,7 +113,7 @@
 			<li>Type a name and click 
 				<strong>Next</strong>
 			</li>
-			<li>Choose 
+			<li>Choose the desired generator, i.e. 
 				<strong>YAKINDU Java Code Generator</strong>
 			</li>
 			<li>Check the model(s) to generate code from and click 
@@ -120,149 +123,140 @@
 		<p>
 			<img border="0" src="images/genmodelwizardchooselanguage.jpg"/>
 		</p>
-		<p>The result is an .sgen file that opens in the editor. It will look similar to the following and you can use it to generate Java code. It will be build automatically if you checked 
-			<strong>Project</strong> &gt; 
-			<strong>Build Automatically</strong>. If not click 
-			<strong>Project</strong> &gt; 
-			<strong>Clean...</strong> &gt; 
-			<strong>Clean all</strong> to run the generator.
-		</p>
-		<pre><code>GeneratorModel for yakindu::java {
-
-	statechart coffeeMachine {
-
-		feature Outlet {
-			targetProject = "org.terra.coffee.machine"
-			targetFolder = "src-gen"			
-		}
-
-		feature Debug {
-			dumpSexec = false			
-		}
-
-		feature licenseHeader {
-			licenseText = "Copyright by itemis AG"			
+		<p>The result is an .sgen file of the following format: </p>
+		<pre><code>GeneratorModel for [GeneratorId] {
+	statechart [StatechartReference] {
+		feature [Feature] {
+			[ParameterName] = [ParameterValue]
 		}
 	}
 }
-
-
 </code></pre>
-		<h2 id="GeneratingCcode">Generating C code</h2>
-		<p>To generate C code you need a C genmodel.</p>
+		<p>The [GeneratorId] is the unique id of the Generator. Yakindu Statechart Tools currently supports the following Generators out of the box:</p>
 		<ol>
-			<li>Click 
-				<strong>File</strong> &gt; 
-				<strong>New</strong> &gt; 
-				<strong>Other...</strong> &gt; 
-				<strong>Yakindu Statechart Genmodel</strong>
-			</li>
-			<li>Type a name and click 
-				<strong>Next</strong>
-			</li>
-			<li>Choose 
-				<strong>YAKINDU C Code Generator</strong>
+			<li>yakindu::java &#8211; Generator ID for the Java Code Generator </li>
+			<li>yakindu::c &#8211; Generator ID for the C Code Generator</li>
+			<li>yakindu::cpp &#8211; Generator ID for the C++ Code Generator</li>
+		</ol>
+		<p>One GeneratorModel can contain several [StatechartReference]s. These are crossreference to statechart models for which the code should be generated. 
+			<br/>For each referenced Statechart, the generator process can be configured with [Feature]s. Each Feature consists of several parameters. These parameters can be configured with [ParameterName] = [ParameterValue].
+		</p>
+		<p>The Generator Model will be build automatically if you checked 
+			<strong>Project</strong> &gt; 
+			<strong>Build Automatically</strong>. If you want to execute only one Generator Model, you can select  
+			<br/>
+			<strong>Generate Statechart Artifacts</strong> from the 
+			<strong>Package Explorer&#8217;s</strong> context menu.
+		</p>
+		<h2 id="CoreFeatures">Core Features</h2>
+		<p>The following section describes the 
+			<strong>Core Features</strong> which are available for each Code Generator:
+		</p>
+		<h4 id="Outlet">Outlet</h4>
+		<p>The 
+			<strong>Outlet</strong> feature specifies the target project and folder for the generated artifacts. It is a 
+			<strong>required</strong> feature and consists of the following parameters:
+		</p>
+		<ol>
+			<li>
+				<i>targetProject</i>  (String): The project where the generated artifacts are stored  
 			</li>
-			<li>Check the model(s) to generate code from and click 
-				<strong>Finish</strong>
+			<li>
+				<i>targetFolder</i>  (String): The folder where the generated artifacts are stored
 			</li>
 		</ol>
-		<p>The result is an .sgen file that opens in the editor. It will look similar to the following and you can use it to generate Java code. It will be build automatically if you checked 
-			<strong>Project</strong> &gt; 
-			<strong>Build Automatically</strong>. If not click 
-			<strong>Project</strong> &gt; 
-			<strong>Clean...</strong> &gt; 
-			<strong>Clean all</strong> to run the generator.
+		<p>Example configuration:</p>
+		<pre><code>feature Outlet {
+	targetProject = "ExampleProject"
+	targetFolder = "src-gen"
+}
+</code></pre>
+		<p><!-- End Outlet --></p>
+		<h4 id="LicenseHeader">LicenseHeader</h4>
+		<p>The 
+			<strong>LicenseHeader</strong> feature specifies the license text that should be added as a header to the generated artifacts. It is an 
+			<strong>optinal</strong> feature and consists of the following parameters:
 		</p>
-		<pre><code>GeneratorModel for yakindu::c {
-
-	statechart coffeeMachine {
-
-		feature Outlet {
-			targetProject = "org.terra.coffee.machine"
-			targetFolder = "src-gen"
-		}
-
-		feature Debug {
-			dumpSexec = false
-		}
-
-		feature licenseHeader {
-			licenseText = "Enter license text here"
-		}
-		
-		feature FunctionInlining {
-			inlineChoices=true
-			inlineEnterRegion=true
-			inlineEnterSequences=true
-			inlineEntries=true
-			inlineEntryActions=true
-			inlineExitActions=true
-			inlineExitRegion=true
-			inlineExitSequences=true
-			inlineReactions=true
-		}
-	}
+		<ol>
+			<li>
+				<i>licenseText</i>  (String): The license text to add as a header  
+			</li>
+		</ol>
+		<p>Example configuration:</p>
+		<pre><code>feature LicenseHeader {
+	licenseText = "Copyright (c) 2012 committers of YAKINDU and others."
 }
-
-
 </code></pre>
-		<h2 id="GeneratingCCode">Generating C++ Code</h2>
-		<p>To generate C++ code you need a C++ genmodel.</p>
+		<p><!-- End LicenseHeader --></p>
+		<h4 id="FunctionInlining">FunctionInlining</h4>
+		<p>The 
+			<strong>FunctionInlining</strong> feature allows the inlining of expressions instead of generating separate functions or methods. This might reduce the readability of the generated code, but increases performance because less operation calls are neccessary. 
+			<br/>It is an 
+			<strong>optinal</strong> feature and consists of the following parameters:
+		</p>
 		<ol>
-			<li>Click 
-				<strong>File</strong> &gt; 
-				<strong>New</strong> &gt; 
-				<strong>Other...</strong> &gt; 
-				<strong>Yakindu Statechart Genmodel</strong>
+			<li>
+				<i>inlineReactions</i>  (Boolean): Inlines the expression for reactions
 			</li>
-			<li>Type a name and click 
-				<strong>Next</strong>
+			<li>
+				<i>inlineEntryActions</i>  (Boolean): Inlines the expression for entry actions
 			</li>
-			<li>Choose 
-				<strong>YAKINDU C++ Code Generator</strong>
+			<li>
+				<i>inlineExitActions</i>  (Boolean): Inlines the expression for exit actions
 			</li>
-			<li>Check the model(s) to generate code from and click 
-				<strong>Finish</strong>
+			<li>
+				<i>inlineEnterSequences</i>  (Boolean): Inlines the expression for enter sequences
+			</li>
+			<li>
+				<i>inlineExitSequences</i>  (Boolean): Inlines the expression for exit sequences
+			</li>
+			<li>
+				<i>inlineChoices</i>  (Boolean): Inlines the expression for choices
+			</li>
+			<li>
+				<i>inlineEnterRegion</i>  (Boolean): Inlines the expression for enter regions
+			</li>
+			<li>
+				<i>inlineExitRegion</i>  (Boolean): Inlines the expression for exit regions
+			</li>
+			<li>
+				<i>inlineEntries</i>  (Boolean): Inlines the expression for entries 
 			</li>
 		</ol>
-		<p>The result is an .sgen file that opens in the editor. It will look similar to the following and you can use it to generate Java code. It will be build automatically if you checked 
-			<strong>Project</strong> &gt; 
-			<strong>Build Automatically</strong>. If not click 
-			<strong>Project</strong> &gt; 
-			<strong>Clean...</strong> &gt; 
-			<strong>Clean all</strong> to run the generator.
+		<p>Example configuration:</p>
+		<pre><code>feature FunctionInlining {
+	inlineChoices = false
+	inlineEnterRegion = true
+	inlineEntries = true
+}
+</code></pre>
+		<p><!-- End FunctionInlining --></p>
+		<h2 id="JavaGeneratorFeatures">Java Generator Features</h2>
+		<h4 id="Naming">Naming</h4>
+		<p>The 
+			<strong>Naming</strong> feature allows the configuration of package names as well as class name prefix / suffix.
+			<br/>It is an 
+			<strong>optinal</strong> feature and consists of the following parameters:
 		</p>
-		<pre><code>GeneratorModel for yakindu::cpp {
-
-	statechart coffeeMachine {
-
-		feature Outlet {
-			targetProject = "org.terra.coffee.machine"
-			targetFolder = "src-gen"
-		}
-
-		feature Debug {
-			dumpSexec = false
-		}
-
-		feature licenseHeader {
-			licenseText = "Enter license text here"
-		}
-		
-		feature FunctionInlining {
-			inlineChoices=true
-			inlineEnterRegion=true
-			inlineEnterSequences=true
-			inlineEntries=true
-			inlineEntryActions=true
-			inlineExitActions=true
-			inlineExitRegion=true
-			inlineExitSequences=true
-			inlineReactions=true
-		}
-	}
+		<ol>
+			<li>
+				<i>basePackage</i>  (Boolean): Inlines the expression for reactions
+			</li>
+			<li>
+				<i>implementationSuffix</i>  (Boolean): Inlines the expression for entry actions
+			</li>
+		</ol>
+		<p>Example configuration:</p>
+		<pre><code>feature Naming {
+	basePackage = "org.yakindu.sct"
+	implementationSuffix = "Impl"
 }
 </code></pre>
+		<p><!-- End Naming -->	</p>
+		<h4 id="GeneralFeatures">GeneralFeatures
+			TBD</h4>
+		<h2 id="CGeneratorFetures">C Generator Fetures
+			TBD</h2>
+		<p>}</p>
 	</body>
 </html>

+ 81 - 84
plugins/org.yakindu.sct.doc.user/help/user/04_Tasks/tasks.textile

@@ -59,124 +59,121 @@ Start a simulation with the different modes as follows
 "Simulation perspective":../03_Concepts/concepts.html#YakinduSCSimulationperspective
 "Simulation View":../03_Concepts/concepts.html#SimulationView
 
-h2. Generating Java code
+h2. Generating Code
 
-To generate Java code you need a java genmodel.
+For code generation, Yakindu Statechart Tools uses a textual generator model called *SGen*, that can be used to configure the code generation process. It can be created either by using the provided wizard or by creating a new text file with the file extension '.sgen'.
+To create a generator model with the wizard,
 
 # Click *File* > *New* > *Other...* > *Yakindu Statechart Genmodel*
 # Type a name and click *Next*
-# Choose *YAKINDU Java Code Generator*
+# Choose the desired generator, i.e. *YAKINDU Java Code Generator*
 # Check the model(s) to generate code from and click *Finish*
 
-
 !images/genmodelwizardchooselanguage.jpg!
 
-The result is an .sgen file that opens in the editor. It will look similar to the following and you can use it to generate Java code. It will be build automatically if you checked *Project* > *Build Automatically*. If not click *Project* > *Clean...* > *Clean all* to run the generator.
+The result is an .sgen file of the following format: 
 
 bc.. 
-GeneratorModel for yakindu::java {
+GeneratorModel for [GeneratorId] {
+	statechart [StatechartReference] {
+		feature [Feature] {
+			[ParameterName] = [ParameterValue]
+		}
+	}
+}
+p. The [GeneratorId] is the unique id of the Generator. Yakindu Statechart Tools currently supports the following Generators out of the box:
+# yakindu::java - Generator ID for the Java Code Generator 
+# yakindu::c - Generator ID for the C Code Generator
+# yakindu::cpp - Generator ID for the C++ Code Generator
 
-	statechart coffeeMachine {
+p. One GeneratorModel can contain several [StatechartReference]s. These are crossreference to statechart models for which the code should be generated. 
+For each referenced Statechart, the generator process can be configured with [Feature]s. Each Feature consists of several parameters. These parameters can be configured with [ParameterName] = [ParameterValue].
+ 
+The Generator Model will be build automatically if you checked *Project* > *Build Automatically*. If you want to execute only one Generator Model, you can select  
+*Generate Statechart Artifacts* from the *Package Explorer's* context menu.
 
-		feature Outlet {
-			targetProject = "org.terra.coffee.machine"
-			targetFolder = "src-gen"			
-		}
+h2. Core Features
 
-		feature Debug {
-			dumpSexec = false			
-		}
+The following section describes the *Core Features* which are available for each Code Generator:
 
-		feature licenseHeader {
-			licenseText = "Copyright by itemis AG"			
-		}
-	}
-}
 
+h4. Outlet
 
-h2. Generating C code
+The *Outlet* feature specifies the target project and folder for the generated artifacts. It is a *required* feature and consists of the following parameters:
+# __targetProject__  (String): The project where the generated artifacts are stored  
+# __targetFolder__  (String): The folder where the generated artifacts are stored
 
-To generate C code you need a C genmodel.
+Example configuration:
 
-# Click *File* > *New* > *Other...* > *Yakindu Statechart Genmodel*
-# Type a name and click *Next*
-# Choose *YAKINDU C Code Generator*
-# Check the model(s) to generate code from and click *Finish*
+bc.. 
+feature Outlet {
+	targetProject = "ExampleProject"
+	targetFolder = "src-gen"
+}
+p. ==<!-- End Outlet -->==
 
-The result is an .sgen file that opens in the editor. It will look similar to the following and you can use it to generate Java code. It will be build automatically if you checked *Project* > *Build Automatically*. If not click *Project* > *Clean...* > *Clean all* to run the generator.
+h4. LicenseHeader
+
+The *LicenseHeader* feature specifies the license text that should be added as a header to the generated artifacts. It is an *optinal* feature and consists of the following parameters:
+
+# __licenseText__  (String): The license text to add as a header  
+
+Example configuration:
 
 bc.. 
-GeneratorModel for yakindu::c {
+feature LicenseHeader {
+	licenseText = "Copyright (c) 2012 committers of YAKINDU and others."
+}
+p. ==<!-- End LicenseHeader -->==
 
-	statechart coffeeMachine {
+h4. FunctionInlining
 
-		feature Outlet {
-			targetProject = "org.terra.coffee.machine"
-			targetFolder = "src-gen"
-		}
+The *FunctionInlining* feature allows the inlining of expressions instead of generating separate functions or methods. This might reduce the readability of the generated code, but increases performance because less operation calls are neccessary. 
+It is an *optinal* feature and consists of the following parameters:
 
-		feature Debug {
-			dumpSexec = false
-		}
+# __inlineReactions__  (Boolean): Inlines the expression for reactions
+# __inlineEntryActions__  (Boolean): Inlines the expression for entry actions
+# __inlineExitActions__  (Boolean): Inlines the expression for exit actions
+# __inlineEnterSequences__  (Boolean): Inlines the expression for enter sequences
+# __inlineExitSequences__  (Boolean): Inlines the expression for exit sequences
+# __inlineChoices__  (Boolean): Inlines the expression for choices
+# __inlineEnterRegion__  (Boolean): Inlines the expression for enter regions
+# __inlineExitRegion__  (Boolean): Inlines the expression for exit regions
+# __inlineEntries__  (Boolean): Inlines the expression for entries 
 
-		feature licenseHeader {
-			licenseText = "Enter license text here"
-		}
-		
-		feature FunctionInlining {
-			inlineChoices=true
-			inlineEnterRegion=true
-			inlineEnterSequences=true
-			inlineEntries=true
-			inlineEntryActions=true
-			inlineExitActions=true
-			inlineExitRegion=true
-			inlineExitSequences=true
-			inlineReactions=true
-		}
-	}
+Example configuration:
+
+bc.. 
+feature FunctionInlining {
+	inlineChoices = false
+	inlineEnterRegion = true
+	inlineEntries = true
 }
+p. ==<!-- End FunctionInlining -->==
 
+h2. Java Generator Features
 
-h2. Generating C++ Code
+h4. Naming
 
-To generate C++ code you need a C++ genmodel.
+The *Naming* feature allows the configuration of package names as well as class name prefix / suffix.
+It is an *optinal* feature and consists of the following parameters:
 
-# Click *File* > *New* > *Other...* > *Yakindu Statechart Genmodel*
-# Type a name and click *Next*
-# Choose *YAKINDU C++ Code Generator*
-# Check the model(s) to generate code from and click *Finish*
+# __basePackage__  (Boolean): Inlines the expression for reactions
+# __implementationSuffix__  (Boolean): Inlines the expression for entry actions
 
-The result is an .sgen file that opens in the editor. It will look similar to the following and you can use it to generate Java code. It will be build automatically if you checked *Project* > *Build Automatically*. If not click *Project* > *Clean...* > *Clean all* to run the generator.
+Example configuration:
 
 bc.. 
-GeneratorModel for yakindu::cpp {
-
-	statechart coffeeMachine {
+feature Naming {
+	basePackage = "org.yakindu.sct"
+	implementationSuffix = "Impl"
+}
+p. ==<!-- End Naming -->==	
 
-		feature Outlet {
-			targetProject = "org.terra.coffee.machine"
-			targetFolder = "src-gen"
-		}
+h4. GeneralFeatures
+TBD
 
-		feature Debug {
-			dumpSexec = false
-		}
+h2. C Generator Fetures
+TBD
 
-		feature licenseHeader {
-			licenseText = "Enter license text here"
-		}
-		
-		feature FunctionInlining {
-			inlineChoices=true
-			inlineEnterRegion=true
-			inlineEnterSequences=true
-			inlineEntries=true
-			inlineEntryActions=true
-			inlineExitActions=true
-			inlineExitRegion=true
-			inlineExitSequences=true
-			inlineReactions=true
-		}
-	}
 }