Difference between revisions of "IFDEF"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=#IFDEF…#ENDIF=
 
 
 
==Class==
 
Applications
 
 
 
 
==Purpose==
 
==Purpose==
 
Compiler directives to allow inclusion or exclusion of source code based on a compile-time constant
 
Compiler directives to allow inclusion or exclusion of source code based on a compile-time constant
Line 12: Line 5:
 
==Syntax==
 
==Syntax==
 
&#035;IFDEF <constant>
 
&#035;IFDEF <constant>
 +
 
[<statements1>]
 
[<statements1>]
 +
 
[#ELSE]
 
[#ELSE]
 +
 
[<statements2>]
 
[<statements2>]
 +
 
&#035;ENDIF
 
&#035;ENDIF
  
Line 33: Line 30:
 
#DEFINE RECITAL 1
 
#DEFINE RECITAL 1
 
#IFDEF RECITAL
 
#IFDEF RECITAL
  set compatible to recital
+
    set compatible to recital
  set filetype to recital
+
    set filetype to recital
 
#ELSE
 
#ELSE
  set compatible to vfp
+
    set compatible to vfp
  set filetype to vfp
+
    set filetype to vfp
 
#ENDIF
 
#ENDIF
 
</code>
 
</code>
Line 43: Line 40:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Applications]]
 +
[[Category:Applications Commands]]

Latest revision as of 16:55, 11 November 2009

Purpose

Compiler directives to allow inclusion or exclusion of source code based on a compile-time constant


Syntax

#IFDEF <constant>

[<statements1>]

[#ELSE]

[<statements2>]

#ENDIF


See Also

COMPILE, DEFINE, DO, DO CASE, IF, SET COMPILE, SET DEVELOPMENT


Description

The #IFDEF compiler directive can be used to allow inclusion or exclusion of source code based on the existence of a compile-time constant. The constant, <constant>, is defined using the #DEFINE directive. At compile time, the compiler checks if the <constant> is defined. If it is defined, the <statements1> that follow are included in the compiled program file. The <statements1> can be any valid Recital 4GL commands. If the <constant> is not defined, the <statements1> are excluded. If the <constant> is not defined and there is a #ELSE directive specified, the <statements2> following the #ELSE directive are included in the compiled program file.

This directive can only be used in compiled programs.


Example

#DEFINE RECITAL 1
#IFDEF RECITAL
    set compatible to recital
    set filetype to recital
#ELSE
    set compatible to vfp
    set filetype to vfp
#ENDIF


Products

Recital Server, Recital