Open System Testing Architecture

TOC PREV NEXT INDEX



Conditional Compilation of Source Code

SCL provides commands that enable you to define the circumstances for the compilation of a section of code. Conditional sections of code are marked with `variants', which are specified on the `-V' option on the SCL compiler command line when you compile the source file.

Conditional compilation commands may appear at any point within the Environment, Definitions and Code sections, including before the ENTRY command and between subroutines. They cannot appear part way through a command or statement. They may be nested to a depth of 10.

Format:

condition variant

Parameters:
condition

A conditional compilation command which starts or ends a section of code. This may be one of the following:

#IFDEF
Compile next section if "variant" requested
#IFNDEF
Compile next section if "variant" not requested
#ELIF
Otherwise compile next section if "variant" requested
#ELSE
Otherwise compile the next section
#ENDIF
End of variant section
 

The #IFDEF, #IFNDEF and #ELIF commands require the "variant" parameter, to specify the condition under which the following section of code will be compiled. The #ELSE and #ENDIF commands relate to the most recently specified variant.

variant

An OpenSTA Dataname which identifies a section of code that is only compiled under certain conditions. The compiler processes this variant in conjunction with the `-V' option on the SCL command line.

Examples:
 #IFDEF variant1
 	 log "Only compiled if /VARIANT=variant1 is specified"
 #ELIF variant2
 	 log "Only compiled if /VARIANT=variant2 is specified"
 #ELSE
 	 log "Only compiled if neither variant is specified"
 #ENDIF

See also:

Overview of Script Control Language Syntax


OpenSTA.org
Mailing Lists
Further enquiries
Documentation feedback
CYRANO.com
TOC PREV NEXT INDEX