Download Chora User Manual
Transcript
TARA Systems Unit file (EWU) Unlike the ordinary class inheritance, each variant is signed with a variant condition. This condition determines when the variant will be used in order to substitute its origin definition. Only if the condition is fulfilled, the affected variant is applied. In this manner, multiple variants can be implemented and the user can switch between them. The condition accepts a list of profile and style names. The condition is fulfilled, if one of the specified profiles or styles is selected. The variant condition is evaluated as well as during the code generation and at the runtime. If the condition is fulfilled already during the code generation, the affected variant does substitute its origin definition permanently – it can’t be switched at the runtime anymore. Such kind of a variant is called 'static' variant. Usually its condition depends on a profile, which is then selected for the code generation. The second kind is called 'dynamic' variants. Dynamic variants can be switched at the runtime, if the appropriate variant condition depends on one of the active styles. The activation and deactivation of styles is performed by assigning a set of style names to the global built-in Chora variable styles. For example, the both styles AquaLook and WideScreen are activated in the following manner: styles = [AquaLook, WideScreen]; Alternatively the variant condition can be set to the literal true. In this case the variant substitutes its origin definition permanently, independent from any profiles or styles. For more details about profiles and styles see "Profiles and macros" (chapter 3.2) and "Styles" (chapter 3.4) If the variant condition is set to the literal default, the variant substitutes its origin definition only when no other variant is available. Alternatively the variant condition can be set to the literal true. In this case the variant substitutes its origin defintion permanently, independent If the condition of a variant is never fulfilled, no code is generated for the affected variant. This automatic elimination reduces the memory footprint of Chora programs. If two variants of the same origin definition depend on the same variant condition, a Chora compiler error is reported, because the Embedded Wizard is not able to distinguish between those both variants. It is also possible to derived variants from other variants. So complex variant hierarchy is possible. For more details see "Usage of Variants" (chapter 10). 4.8.1 Class Variants Class variants are always introduced by the keyword vclass, followed by the name of the variant and the name of the origin class (the ancestor): Embedded Wizard Chora User Manual Copyright TARA Systems GmbH www.embedded-wizard.de Page 72