PowerBuilder 11.2 includes a new property and method that allow you to programmatically compile standard PowerBuilder applications using or excluding script contained in conditional compilation blocks set with the DEBUG preprocessor symbol. The ORCA tool and OrcaScript commands do not use Project objects to compile applications of standard client-server PowerBuilder targets, even though the Project object is currently where you set inclusion or exclusion of the DEBUG condition while compiling from the IDE.
Windows Forms applications
ORCA and OrcaScript use Project objects to compile Windows
Forms applications. For these applications, the Enable DEBUG Condition
check box selection in a Project object determines whether or not
the script in DEBUG conditional compilation directives is compiled—even
when you compile code using ORCA or OrcaScript.
For information on the DEBUG conditional compilation directive, see “Using the DEBUG preprocessor symbol” in the PowerBuilder User’s Guide.
In ORCA 11.2, you can enable or disable the DEBUG condition for an entire ORCA session using the new boolean bDebug property of the PBORCA_CONFIG_SESSION structure. Otherwise, you can call the PBORCA_SetDebug method whenever you want to enable or disable the DEBUG condition during an ORCA session. This allows you to enable the DEBUG condition for some of the objects in a target and to disable it for other objects. The Pcode for an object stored in a target PBL reflects the DEBUG conditional setting in use when the object was last compiled or regenerated.
IDE regeneration
All objects compiled in the PowerBuilder IDE are compiled
with the DEBUG condition enabled. When a PowerBuilder developer
saves changes to an object or regenerates it in the IDE, the Pcode
stored for the object in the target PBL automatically includes code
from any DEBUG conditional directive scripted for the object.
For more information on the bDebug property and the PBORCA_SetDebug method, see the ORCA Guide PDF that the setup program installs in the PowerBuilder 11.0\SDK\ORCA directory.
The set debug OrcaScript command invokes the ORCA PBORCA_SetDebug method and can be called any time after the start session command. The value you set affects all objects used by subsequent regenerate and build application commands. It also affects all objects retrieved with scc refresh target and scc get latest version commands.
The build application full command in the following example recompiles all of the objects in the application PBL with the DEBUG condition disabled, and the buildapp_p.exe application created by the build executable command behaves exactly like a production application (without any debug code).
start session set debug false set liblist "testdebug\buildapp.pbl" set application "testdebug\buildapp.pbl" "testdebug" build application full build executable "destination_1\buildapp_p.exe" "icon\icon9.ico" "" "N" end session
Setting the debug value only affects objects that are compiled or regenerated after the set debug command is issued. The following example copies the PBL generated from the previous example after it was compiled with the debug condition disabled. In this example, even though set debug true is called before it builds the debug_copy.exe executable, the code in DEBUG conditional compilation blocks is not enabled because none of the commands that follow the set debug call invoke the PowerScript compiler.
start session set debug TRUE file copy "testdebug\buildapp.pbl" "testdebug\copy.pbl" clobber alwaysset liblist "testdebug\copy.pbl" set application "testdebug\copy.pbl" "testdebug" build executable "destination_1\debug_copy.exe" "icon\icon9.ico" "" "N" end session
However, if you add a build application command or a regenerate command after the set debug command in the previous example, the script inside DEBUG conditional compilation blocks will be enabled.