Precompiler Directives

Precompiler directives are instructions used in ProcScript that are replaced with actual ProcScript during compilation.

They can be embedded anywhere in your ProcScript modules, and enable you to determine the exact composition of the ProcScript that will be compiled. During precompilation, these directives are parsed and interpreted, and the resulting ProcScript is passed to the ProcScript compiler.

Formatting Precompiler Directives

  • Each precompiler directive must occur on a single, physical line. Continuation markers (%\) are not allowed.
  • A comment may follow the complete directive; use a semicolon (;) followed by the comment text. For example:
    #include MYLIB:START_TRIG ;at the start of every trigger

If an error occurs on a precompiler directive (for example, if the library or module named on the #include directive is not found), the directive is ignored. No error message is provided.

Listing Precompiler Directives

By default, when you compile Uniface objects (components, menus, and so on), only the completely generated ProcScript is shown, without the precompiler directives. However, if you compile from the command line (using /all, for example), you can use the subswitch /lis=2 to include the precompiler directives in the listing.

The following example adds a debug statement to the ProcScript being compiled if the constant <DEBUGGING> is defined as 1:

#ifdefined DEBUGGING
   #if (<DEBUGGING>=1)
      debug
   #endif
#endif
  • If the constant <DEBUGGING> is not defined, no further code is generated.
  • If the constant <DEBUGGING> is defined as 0, the #if directive is generated as follows:
    #if (1=0)
       debug
    #endif

    In this case, no ProcScript is generated.

  • If the constant <DEBUGGING> is defined as 1, the #if directive is generated as follows:
    #if (1=1)
       debug
    #endif

    In this case, the following ProcScript statement is compiled:

    debug

Related Topics