Skip to content

Configure Workspace - Conditionals

The Studio's parser does not support intelligent analysis of conditionally compiled code. By default, the parser will analyze all code inside a #IFDEF - #ELSE - #ENDIF structure.

In most cases, this would not be a problem as the conditional code would not affect how the Studio would model your project. However, there are times when you would have code inside conditionally compiled blocks that could affect the Studio's description of your project. For example:

Define C_VERSION_10
Class cMyButton is a Button
    Procedure Construct_Object
        Forward Send Construct_Object
        #IFDEF C_VERSION_10
        #ELSE
            Property Boolean pbAutoSave True
        #ENDIF
    End_Procedure
End_Class

In this case, the compiler would not compile the property declaration inside cMyButton, but the Studio parser would process this declaration and add pbAutoSave to its metadata for the cMyButton class.

To prevent this from occurring, you can declare such symbols in this tab page and describe whether the parser should consider the symbol to be defined or not defined.

Library Defined #IFDEF Conditionals

If your current workspace is using libraries, then any conditional compile symbols that are defined in those library workspaces will be inherited by the current workspace. The inherited symbols will be listed in this grid.

Symbol

This column displays the name of the inherited symbol.

Condition

This column displays whether the symbol is to be considered defined (True) or not defined (False) by the parser.

Library

This column displays in which library workspace the displayed symbol is defined.

Workspace Defined #IFDEF Conditionals

Use this table to declare symbols that control conditionally compiled code in the current workspace (and any workspace that imports the current workspace as a library).

Note: You should only declare the symbols that would affect the Studio's ability to model your projects. If a symbol would have no effect on the Studio's modeling, then you do not need to declare it here.

Symbol

Enter the name of the symbol that you are declaring.

Condition

Enter whether the symbol is to be considered defined (True) or not defined (False) by the parser.

Add Symbol

Click this button to add a new row to the bottom of the grid.

Remove Symbol

Click this button to delete the currently selected row.

Predefined Conditionals

Other than Is$Windows and Is$WebApp all other symbols that control #IFDEF conditionally compiled code must be configured and managed here. See Predefined Conditionals

Is$Windows

The Is$Windows symbol does not need to be added to this list. The Studio's parser assumes that the Is$Windows special symbol is predefined. This means that you do not need to specify this symbol in this dialog for any workspace.

Is$WebApp

The Is$WebApp symbol is automatically added to this list when you create a new workspace. The Studio will automatically manage the True/False value of this symbol for you according to whether the current project you are working on is a Web Application project.

Other than Is$Windows and Is$WebApp, all other symbols that control #IFDEF conditionally compiled code must be configured and managed here.

Limitations and #IFNDEF

Conditionally compiled code that is controlled via the #IFNDEF compiler instruction is not recognized by the Studio’s parser, regardless of whether the symbol is configured within this dialog.

Compare the following two examples:

#IFDEF Is$WebApp
#ELSE
    Class cFoo is a cObject
End_Class
#ENDIF

In the above declaration, cFoo would be filtered from the Studio’s code model if the Is$WebApp symbol is configured to be false (i.e., the current project is not a Web Application). However, if you use #IFNDEF as follows:

#IFNDEF Is$WebApp
    Class cFoo is a cObject
End_Class
#ENDIF

In your compiled application, using #IFNDEF is equivalent to the first declaration; however, the Studio’s code model will not respect the conditional compile regardless of whether the Is$WebApp symbol is manually declared in this dialog.

Our recommendation is to avoid using #IFNDEF in your application; use #IFDEF - #ELSE instead.

See Also