IF CONDITION()


General Form:

Where:


This is a resolve time test, based on the value of the constant expression, that determines if the symbols inside the IF block should be included in the symbol table of the program or library. A TRUE or non-zero value will include the IF CONDITION block and exclude any ELSE CONDITION block but if the expression is FALSE or zero then the IF block will be ignored and any optional ELSE block will be included in the program.

The scope of the IF CONDITION block and any ELSE CONDITION block may span one or more DEFSUBs. The code inside the block is parsed and must be legal. Subroutines and variables defined inside a block will not be visible to the program unless the block is included. The IF CONDITION block must be properly nested inside or around other IF blocks or other structured constructs. The KCML workbench will indent the blocks to correspond to such nesting.

When a library is built with kmake or kc it is resolved and the IF CONDITION is evaluated to determine which code to include. The controlling constant will come from an earlier library that this one depends on.

IF CONDITION is different from #IF in that the code inside the IF CONDITION block is parsed whereas code inside a #IF block is effectively a comment. A #IF block may contain code that is not legal in that version of KCML. #IF is controlled by environment variables or KCML versions.

IF CONDITION differs from a regular IF it that it has the ability to hide symbols when the program is being resolved prior to execution. It is not executed at run time.

From KCML 7.02, IF CONDITION supports the FEATURE EXISTS syntax.

Example

IF CONDITION(_cf_moduleinstalled)
	'cf_libdbctl_constructor()
END CONDITION

Compatibility

IF CONDITION was introduced with KCML 6.60.

See also:

#IF and #IFDEF IF ... ENDIF