Elatec GmbH TWN3A1 User Manual

Page of 44
Elatec GmbH 
Page 24 of 44 
7.1.5.2  Arguments 
If a function has no arguments, the list of arguments has to be left empty (do not write void). 
In order to declare arguments, write the list of arguments separated by commas. Arguments are 
passed by value or by reference. In order to pass an argument by reference instead of value, insert the 
‘&’ before the identifier of argument. Here are some examples of valid function prototypes: 
void Func1();                   // No arguments 
 
void Func2(byte i);             // A single argument, 
                                // which is passed by value 
 
void Func3(byte in, byte &out); // Two arguments, where in is passed by 
                                // value and out is passed by reference 
 
7.1.5.3  System Functions 
A system function can only be declared as prototype. Following form: 
(byte | void) identifier([list of arguments]) system number
The list of available system functions is contained in the file sys.twn.h. For the script programmer there 
is normally no need to declare system functions on his own. 
 
7.1.5.4  Function main 
A TWN3 script always needs the function main to be implemented. The prototype for the function main 
is: 
void main(); 
After internal initialization, the TWN3 reader will start execution of the script by calling this function 
main
 
7.1.6  Statements 
A single statement has the form 
[expression]; 
This means, a statement is a (optional) expression followed by a semicolon. If only a semicolon without 
an expression is specified, it is called an empty statement. Statements can be enclosed by braces to 
build a block of statements. A block statement can be used wherever a single statement can be used. 
 
7.1.6.1  if Statement 
An if statement has the form: 
if (expression) statement 
Statement is executed only if the result of expression is not equal to zero.