Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

About conditional compilation – PB Docs 115 – PowerBuilder Library

About conditional compilation – PB Docs 115

About conditional compilation

You
can use the number sign (#) at the start of a line or block
of code in PowerBuilder to mark the code for specialized processing
prior to PowerScript compilation. Each line of code or block of
conditional code set off by a leading number sign is automatically
parsed by a PowerBuilder preprocessor before it is passed to the
design-time PowerScript compiler or the PowerBuilder-to-C# (pb2cs)
compiler.

Preprocessing symbols

There are
six default code-processing symbols that affect the code passed to
the PowerScript compiler at design time. Four of these symbols correspond
to different PowerBuilder target types, one applies to all .NET target
types, and one applies to both standard PowerBuilder and .NET target
types.

The preprocessor enables PowerBuilder to compile project code
specific to a particular deployment target without hindering the
compiler’s ability to handle the same code when a different
deployment target is selected.

The preprocessor substitutes blank lines for all declarative
statements and conditional block delimiters having leading number
sign characters before passing the code to the PowerScript compiler
or the pb2cs compiler. The contents of the conditional
blocks are converted to blank lines or passed to the compiler depending
on which preprocessor symbol is used.

Table 14-1 displays the default
preprocessing symbols, the project types to which they correspond,
and their effects on the code passed to the PowerScript compiler
engine or the pb2cs compiler.

Table 14-1: Default preprocessing symbols
for conditional compilation
Preprocessing symbols Project type Code in this processing block
PBNATIVE PowerBuilder client-server or distributed
applications
Fully parsed by the PowerScript compiler.
It is converted to blank lines for the pb2cs compiler.
PBWEBFORM .NET Web Forms application Fully parsed by the pb2cs compiler for
.NET Web Forms targets only. It is converted to blank lines for
the PowerScript compiler and all other types of .NET targets.
PBWINFORM .NET Windows Forms applications Fully parsed by the pb2cs compiler for
.NET Windows Forms targets only. It is converted to blank lines for
the PowerScript compiler and all other types of .NET targets.
PBWEBSERVICE .NET Web Service component targets Fully parsed by the pb2cs compiler for
.NET Web Service targets only. It is converted to blank lines for
the PowerScript compiler and all other types of .NET targets.
PBDOTNET .NET Web Forms and Windows Forms applications,
and .NET Assembly and .NET Web Service components
Fully parsed by the pb2cs compiler for
all .NET target types. It is converted to blank lines for the PowerScript
compiler.
DEBUG Standard PowerBuilder targets and all
.NET application and component targets
When a project’s Enable DEBUG Symbol
check box is selected, code is fully parsed in deployed applications
by the PowerScript compiler, or for .NET targets, by the pb2cs compiler.
Code is converted to blank lines when the check box is cleared.

Conditional syntax

You indicate a conditional block of code with a statement
of the following type, where symbolType is
any of the symbols defined by PowerBuilder:

You can use the NOT operator to include code for all target
types that are not of the symbol type that you designate. For example,
the following code is parsed for all targets that are not of the
type PBNative:

You can also use #ELSE statements
inside the code block to include code for all target types other
than the one defined at the start of the code block. You can use #ELSEIF
defined symbolType then
statements
to include code for a specific target type that is different from
the one defined at the start of the code block.

The closing statement for a conditional block is always:

Comments can be added to conditional code if they are preceded
by double slash marks ( // )
in the same line of code. Although you cannot use the PowerScript
line continuation character ( & )
in a conditional code statement, you must use it in code that you
embed in the conditional block when you use more than one line for
a single line of code.

Limitations and error messages

Conditional compilation is not supported in DataWindow syntax,
in structures, or in menu objects. You cannot edit the source code
for an object to include conditional compilation blocks that span
function, event, or variable definition boundaries.

You must rebuild your application after you add a DEBUG conditional
block.

Table 14-2 shows
the types of error messages displayed for incorrect conditional
compilation code.

Table 14-2: Types of error messages returned
by the preprocessor
Error message Description
Invalid if statement #if statement
without a defined symbol, with an incorrectly defined symbol, or
without a then clause
#end if directive expected #if statement
without an #end if statement
Unexpected preprocessor directive Caused by an #else, #elseif,
or #end if statement
when not preceded by an #if statement
Preprocessor syntax error Caused by including text after an #else or #end if statement
when the text is not preceded by comment characters (//)

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x