.IFDEF-.ELSE-.ENDC

Perform conditional processing

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
.IFDEF data_element
   [. . .
source_1
   . . .]
[.ELSE
   . . .
[source_2
   . . .]]
.ENDC

Arguments

data_ element

One of the following:

source_1

(optional) One or more lines of source code.

source_2

(optional) One or more lines of source code.

Discussion

The .IFDEF compilation control directive indicates that the statements that follow are to be compiled if the specified data element has already been defined.

The source_1 lines of code are compiled only if the specified variable or identifier is defined prior to the .IFDEF directive. If the .ELSE directive is present, the source_2 lines of code are compiled only if the specified variable or identifier is not defined prior to the .IFDEF directive.

You can use one or more of the .ELSE, .IFT, .IFF, and .IFTF directives within an .IFDEF conditional block. These conditional compilation control directives can be nested.

The .ENDC directive must always close an .IFDEF conditional block. If .ENDC is not present, a warning is generated.

Examples

The following example shows a simple conditional compilation control operation.

.define TTCHN           ,1
.define DEBUG
proc
    open(TTCHN, o, "tt:")
    .
    .
    .
.ifdef DEBUG
    writes(TTCHN, "Entering mod1")      ;This code will be compiled.
.endc

The following example shows nesting of the .IFDEF conditional compilation control directive.

.define SHOWTABLES
.define SHOWTBLB
.define TTCHN           ,1
proc
    open(TTCHN, o, "tt:")
    .
    .
    .
.ifdef SHOWTABLES
.ifdef SHOWTBLA
    writes(TTCHN, "Table A")            ;This code won't be compiled.
.endc
.ifdef SHOWTBLB
    writes(TTCHN, "Table B")            ;This code will be compiled.
.endc
.endc