Changes for page Project Creation, Initialization and Launch (Prom)
Last modified by Richard Kreissig on 2023/09/14 10:56
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -72,9 +72,9 @@ 72 72 73 73 == Prom Environments == 74 74 75 -Environments are used to provide default settings for project creation and launch. They are configured in the **preferences** (Window > Preferences > KIELER > Environments). 75 +Environments are used to provide default settings for project creation and launch. They are configured in the **preferences** (//Window //>// Preferences > KIELER > Environments//). 76 76 77 -An Environment consists of77 +An environment consists of 78 78 79 79 1. a unique **name**, that does not contain a comma 80 80 1. a **related project wizard** ... ... @@ -121,10 +121,16 @@ 121 121 122 122 Therefore one can write **wrapper code snippets** for a target device. These can then be injected to a **template file** as part of a KiCo launch. What snippets are injected is defined using **annotations on inputs and outputs** directly in the model file. 123 123 124 +In SCT files, annotations are added as in java, with an at-sign e.g. //@LightSensor S3//. You can write implicit and explicit wrapper code annotations. 125 + 126 +Explicit annotations have the form **{{code language="none"}}@Wrapper SnippetName arg1 arg2 ... argN{{/code}}**. An explicit wrapper annotation raises an error if the snippet does not exist, thus it is **recommened** to use the explicit **@Wrapper** annotation. Every other annotation is tried as wrapper code annotation as well, but will be ignored, if no such snippet could be found. Thus you can write the above explicit annotation as **@SnippetName arg1 arg2 ... argN**{{code language="none"}}{{/code}}, but there will be no error if the snippet with this name does not exist or could not be found e.g. because of a typo. 127 + 124 124 [[image:attach:wrapper_code_generation_scheme.png]] 125 125 126 126 In the **template file** one can use special **placeholders**. 127 127 132 +**${model_name}** will be replaced with the name of the model. 133 + 128 128 **${inits}** will be replaced with initialization code for components (<@init>...</@init> of a snippet definition). Initialization should occur before the tick loop of the model file. 129 129 130 130 **${inputs}** will be replaced with code to set inputs for the model (<@input>...</@input> of a snippet definition). Setting model inputs should occur in the tick loop, before the tick function call. ... ... @@ -133,6 +133,8 @@ 133 133 134 134 [[image:attach:template_file_structure.png]] 135 135 142 +To ease the modification of the template file, one can open it with the text editor the final code will be for. This will enable syntax highlighting and code completion for the langauge, but it will not show any errors. You can open the file for example with the Java Editor of Eclipse using //Right Click > Open With > Other > Java Editor// 143 + 136 136 === FreeMarker === 137 137 138 138 The wrapper code injection is done using the open source **template engine [[FreeMarker>>url:http://freemarker.org/||shape="rect"]]**. A wrapper code snippet is basically a [[Macro>>url:http://freemarker.org/docs/ref_directive_macro.html||shape="rect"]] definition of FreeMarker. The Macro is called when the corresponding annotation is found in the model file. The file extension of FreeMarker templates is **.ftl**.
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -13762 7211 +13762832 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/13762 721/Project Creation, Initialization and Launch (Prom)1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/13762832/Project Creation, Initialization and Launch (Prom)