Reserved Identifiers
99
NetLinx Programming Language Reference Guide
Reserved Identifiers
Compiler Directives
The compiler directives supported by NetLinx are described in the table below.
Compiler Directives
#DEFINE This directive defines a symbol to be used only by #IF_DEFINED and
#IF_NOT_DEFINED directives.
#DEFINE <symbol> [<constant expression>]
The name of the symbol must be unique among all other identifiers in the pro-
gram. The symbol can be defined anywhere in the program file but cannot be
used in any statement that appears before it is defined.
Example:
#DEFINE STRING_1 `Hello World`
#DEFINE STRING_2 "`Hello Letter `,65"
#DEFINE STRING_3 "65,66,67,68,69,70"
DEFINE_PROGRAM
PUSH[TP,1]
{
send_string 0,STRING_1 // This will send out `Hello
World`
send_string 0,STRING_2 // This will send out `Hello
Letter A`
send_string 0,STRING_3 // This will send out `ABCDEF`
}
#END_IF This directive marks the end of an #IF_DEFINED or #IF_NOT_DEFINED code
block.
#ELSE This directive specifies a counter condition; used optionally in conjunction with
#IF_DEFINED and #IF_NOT_DEFINED.
#IF_DEFINED This directive defines conditional compilation. The code following the
#IF_DEFINED and before #ELSE (or before #END_IF, if #ELSE is not present)
is compiled only if a symbol is defined (see #DEFINE above). If a symbol is not
defined and the #ELSE directive is present, the code following #ELSE and
before #END_IF is compiled instead.
#IF_DEFINED symbol
// code block
#ELSE
// code block
#END_IF
#IF_NOT_DEFINED This directive defines conditional compilation similar to #IF_DEFINED. The
code following the #IF_NOT_DEFINED and before #ELSE (or before #END_IF,
if #ELSE is not present) is compiled only if symbol is not defined (see #DEFINE
above). If a symbol is defined and the #ELSE directive is present, the code fol-
lowing #ELSE and before #END_IF is compiled instead.
#IF_NOT_DEFINED symbol
// code block
#ELSE
// code block
#END_IF