Download Chora User Manual
Transcript
TARA Systems
Unit file (EWU)
In the unit file, the definition of a resource is only a directive to the Chora compiler to
read a certain external file (e.g. logo.png or a Verdana font) and to convert it into
the format of the target system. The attributes necessary for this are introduced using
the keyword attr. Depending on the type of resource, different attributes may be
needed. If attributes are missing, or if they contain the wrong values, the Chora
compiler reports an error message.
Each attribute consists of 3 elements: the meta-name, the name of the attribute and
the value of the attribute. The meta-name and the name of the attribute are fixed for
each resource class.
A resource can, as with constants, be language-dependent. This means that the
resource may contain several versions. Each of these versions must be assigned to
a particular language. One could, for example, extend the above-mentioned Logo
resource by a second bitmap for the German language:
resource Resources::Bitmap Logo
{
attr bitmapfile FileName =
(
German = GermanBanner.png;
Default = EnglishBanner.png;
);
}
Please note that each language-dependent attribute of a resource must always
contain a value for the Default language. Non-language-dependent resources are
automatically assigned the sole value of the attribute for the language Default.
Please also note that the names of languages must be defined in the project file. In
this case, the project file must define the two languages German and Default.
The choice of the suitable language-dependent resource occurs automatically at the
runtime of the Chora program and is completely transparent to the programmer. The
programmer needs only to switch between the languages in order to set all resources
to the language selected. More details in "Language selection" (chapter 9).
During translation a resource, the Chora compiler makes use of special resource
converters. Each resource class requires its own resource converter, and each
Platform Package must contain its own set of such converters. This technique
guarantees that the definitions of a resource may be ideally transferred to the format
of the target platform and that the Chora compiler may be improved in the future to
include new resources (e.g. sound, animated GIFs, etc.). The current version of the
Chora compiler contains only a bitmap and a font resource converter.
Optionally, the resource 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
resource Resources::Bitmap Logo
{
...
}
For more details about the $output directive see "Control directives" (chapter 8.3).
Embedded Wizard
Chora User Manual
Copyright TARA Systems GmbH
www.embedded-wizard.de
Page 58