Download Chora User Manual
Transcript
TARA Systems
Unit file (EWU)
states = Sample::States[];
A set data type is very practical if a variable may be given a combination of particular
values from a limited list. No other values not contained in the list may be stored in
the variable. Special operators allow the programmer to perform operations on sets.
He can determine the intersection or combination of two sets, for example. Further
details about operators may be found in "Operators" (chapter 7).
During the code generation, Embedded Wizard converts automatically all affected
set definitions into code artifacts appropriate for the respective target system. While
this task, the Code Generator assigns numeric values to the individual items of the
generated set definitions. Usually this process starts with the value 1 for the first
item, 2 for the second, 4 for the third, 8 for the fourth and so far – up to 32 items. If
desired, the developer can control this automatic enumeration. In this case it is
possible to map Chora set definitions to some corresponding definitions already
existing in the target system.
In order to change the automatic enumeration, it is necessary to assign a designated
numeric value to the appropriate item. In such case the Code Generator takes over
the given number and uses it for the enumeration of all following items:
set States
{
item Visible;
item Selected = 0x100;
item Highlighted;
}
The above example demonstrates the explicitly designation of a numeric value to an
item within an set definition. In this case the second item Selected has become a
value 0x100 (256). This will force the Code Generator to use the specified value
for all occurrences of the item within the generated code. As mentioned above the
Code Generator also uses the specified value for the enumeration of all following
items. Therefore the third item Highlighted will receive the value 0x200 (512).
Optionally, the set definition may be prefixed with the $output directive. This
directive controls the code generation for the affected definition; it is generated if the
condition of the directive is fulfilled:
$output true
set States
{
...
}
For more details about the $output directive see "Control directives" (chapter 8.3).
Within the Embedded Wizard IDE the set definitions and their item enumerator
members appear as bricks in the Composer window:
The attributes of these definitions can be set directly in the Inspector window, when
the appropriate brick has been previously selected:
Embedded Wizard
Chora User Manual
Copyright TARA Systems GmbH
www.embedded-wizard.de
Page 70