.IFNDEF-.ELSE-.ENDC
Perform conditional processing
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
.IFNDEF data_element [. . . source_1 . . .] [.ELSE . . . [source_2 . . .]] .ENDC
Arguments
data_element
One of the following:
- A defined macro
- A data declaration in the current routine
- A data declaration in a class (imported or otherwise)
- A data declaration in a structure, defined at any level and visible at that moment in processing
- An enumeration
source_1
(optional) One or more lines of source code.
source_2
(optional) One or more lines of source code.
Discussion
The .IFNDEF compilation control directive indicates that the statements that follow are to be compiled if the specified data element has not previously been defined.
The source_1 lines of code are compiled only if the specified variable or identifier is not defined prior to the .IFNDEF directive. If the .ELSE directive is present, the source_2 lines of code are compiled only if the specified variable or identifier is defined prior to the .IFDEF directive.
You can use one or more of the .ELSE, .IFT, .IFF, and .IFTF directives within an .IFNDEF conditional block. These conditional compilation control directives can be nested.
The .ENDC directive must always close an .IFNDEF conditional block.
Examples
The following example shows a simple conditional compilation control operation.
.define TTCHN ,1 proc open(TTCHN, o, "tt:") .ifndef NO_STATS writes(TTCHN, "some stats") ;This code will be compiled. .else . . ;Don't write stats . .endc
The next example shows nesting of the .IFNDEF conditional compilation control directive.
.define TTCHN ,1 .define SHOWTBLA . . . proc open(TTCHN, o, "tt:") . . . .ifndef NO_TABLES ;This code won't be compiled. .ifndef SHOWTBLA writes(TTCHN, "No information available for Table A") .else writes(TTCHN, "Table A") ;This code will be compiled. .endc .endc . . . end