DEFINE,UNDEFINE,IFDEF,IFUNDEF
Description
As of version 4.50 B180:
Conditional compilation (DEFINE,UNDEFINE,IFDEF,IFUNDEF):
DEFINE:
Syntax:
DEFINE(Test);
DEFINE can be used to define a "term" as existing.
WARNING:
A "term" must not contain spaces (" ") or special characters (except underscore ("_")).
Such a "term" can be used with IFDEF or IFUNDEF for conditional compilation.
Example:
DEFINE(Test);
The "term" Test is defined as existing.
UNDEFINE:
Syntax:
UNDEFINE(Test);
UNDEFINE can be used to define a "term" as not existing.
WARNING:
A "term" must not contain spaces (" ") or special characters (except underscore ("_")).
Such a "term" can be used with IFDEF or IFUNDEF for conditional compilation.
Example:
UNDEFINE(Test);
The "term" Test is defined as not existing.
IFDEF:
Syntax:
IFDEF(Test)
{
}
ELSE
{
}
or
IFDEF(Test)
{
}
IFDEF can be used to compile the following block of instructions depending on the existence (DEFINE) of a "term"; if the "term" has not been defined, the following block of instructions is not compiled.
If IFDEF an ELSE is used, the block of instructions following ELSE is compiled.
Example 1:
DEFINE(Test);
IFDEF(Test)
{
@LogReport("This line is compiled");
}
ELSE
{
@LogReport("This line is not compiled");
}
The "term" Test is defined as existing; the block of instructions following IFDEF
{
@LogReport("This line is compiled");
}
is compiled.
The ELSE following block of instructions
{
@LogReport("This line is not compiled");
}
is not compiled.
Example 2:
UNDEFINE(Test);
IFDEF(Test)
{
@LogReport("This line is not compiled");
}
ELSE
{
@LogReport("This line is compiled");
}
The "term" Test is defined as not existing; the block of instructions following IFDEF
{
@LogReport("This line is not compiled");
}
is not compiled.
The ELSE following block of instructions
{
@LogReport("This line is compiled");
}
is compiled.
IFUNDEF:
Syntax:
IFUNDEF(Test)
{
}
ELSE
{
}
or
IFUNDEF(Test)
{
}
IFUNDEF can be used to compile the following block of instructions depending on the non-existence (UNDEFINE) of a "term"; if the "term" has been defined, the following block of instructions is not compiled.
If IFUNDEF an ELSE is used, the block of instructions following ELSE is compiled.
Example 1:
DEFINE(Test);
IFUNDEF(Test)
{
@LogReport("This line is not compiled");
}
ELSE
{
@LogReport("This line is compiled");
}
The "term" Test is defined as existing; the block of instructions following IFUNDEF
{
@LogReport("This line is not compiled");
}
is not compiled.
The ELSE following block of instructions
{
@LogReport("This line is compiled");
}
is compiled.
Example 2:
UNDEFINE(Test);
IFUNDEF(Test)
{
@LogReport("This line is compiled");
}
ELSE
{
@LogReport("This line is not compiled");
}
The "term" Test is defined as not existing; the block of instructions following IFDEF
{
@LogReport("This line is compiled");
}
is compiled.
The ELSE following block of instructions
{
@LogReport("This line is not compiled");
}
is not compiled.
NOTES:
IFDEF and IFUNDEF (with or without ELSE) can be nested.
With IFDEF and IFUNDEF, the "terms" used for conditional compilation cannot be combined with operators.
The following, for example, is therefore not possible:
IFUNDEF(Test & Test2)
{
@LogReport("Bal Bla Bla");
}
Note : This text was machine-translated and may contain inaccuracies.
