Elatec GmbH
Page 26 of 50
7. Scripting
7.1 Language Description
The scripting language for TWN3 readers is a simplified version of the language C. The main
differences are:
•
There is one data type available, which is a
byte
. A
byte
is an unsigned integer with a size of
8 bits.
•
There are no pointers available. Instead, there is a reference operator, which is showing some
similarity to the language C++.
7.1.1 Source Code
The source for a TWN3 script is given as a text file. Due to closeness to the language C, the extension
should be “.c”. Doing so will give the advantage of a working syntax highlighting in many programming
editors. In order to distinguish normal C-code from TWN3 scripting code it is furthermore
recommended to expand the
extension
to
“.twn.c”
. This is also the default extension which is used
by the configuration tool TWNConfig. The preferred extension for include files is
“.twn.h”
.
A TWN3 script is one file of source. It is possible to include additional source files via a directive to the
preprocessor.
7.1.2 Comments
In order to place a comment within the source code, two slashes are used. The remaining content of
the line will be ignored by the compiler.
7.1.3 Case Sensitivity
The TWN3 script language is sensitive to upper and lower case. Examples:
byte a; // Valid
Byte a; // Invalid
byte Byte; // Valid(!)
7.1.4 Preprocessor Directives
The preprocessor is removing comments from the source code and processing the preprocessor
directives. Currently, there is one directive available.