{ &preprocessor-name }&preprocessor-nameExpands the name, preprocessor-name, to its defined value. You can define preprocessor names using either the &GLOBAL-DEFINE preprocessor directive or the &SCOPED-DEFINE preprocessor directive. ABL also provides a set of built-in preprocessor names that you can reference for a variety of session information. Table 3 lists each built-in preprocessor name with its description.
Table 3: Equal to "yes" if the Batch (-b) startup parameter was used to start the client session. Otherwise, it expands to "no". That contains the name of the file being compiled.1 If you want only the name of the file as specified in the { } Include File Reference, the RUN statement, or the COMPILE statement, use the argument reference {0}. That contains the bit value of the AVM process on which the file is compiled. The possible values include "32" and "64".3 That contains the name of the windowing system in which the file is being compiled. The possible values include "MS-WINDOWS", "MS-WIN95", "MS-WINXP", and "TTY".4
ABL supports an override option for the &WINDOW-SYSTEM preprocessor name that provides backward compatibility. This option enables applications that need the WINDOW-SYSTEM preprocessor name to return the value of MS-WINDOWS for all Microsoft operating systems to do so. To establish this override value, define the WindowSystem key in the Startup section of the current environment, which can be in the registry or in an initialization file. If the WindowSystem key is located, the WINDOW-SYSTEM preprocessor name returns the value associated with the WindowSystem key on all platforms
Table 4 lists the additional built-in preprocessor names that apply to SpeedScript.
The r-prprc1.p procedure shows how you can reference a built-in preprocessor name and include it in a character string.
MESSAGE "The current operating system is" "{&OPSYS}."VIEW-AS ALERT-BOX.The procedure r-prprc2.p shows how to capture the value of a {&SEQUENCE} reference. In this example, {&SEQUENCE} is referenced three times, once each to assign its value to wvar (0) and xvar (1) at run time. The third reference defines the preprocessor name Last-Value with the value 3. As shown, Last-Value is assigned unchanged to both yvar and zvar, each of which takes the value 3 at run time.The procedure r-prprc3.p shows how preprocessor names override compile-time arguments. In this example, r-prprc3.p defines the preprocessor name My-Name as "Daniel". It then passes the compile-time argument My-Name, with the value "David", to the include file r-prprc3.i, which in turn defines a preprocessor name My-Name as "Donald".
&SCOPED-DEFINE My-Name "Daniel"{r-prprc3.i &My-Name = "David"}MESSAGE "My-Name preprocessed in r-prprc3.p is" {&My-Name} + "."VIEW-AS ALERT-BOX.
MESSAGE "My-Name argument in r-prprc3.i is" "{&My-Name}" + "."VIEW-AS ALERT-BOX.&SCOPED-DEFINE My-Name "Donald"MESSAGE "My-Name preprocessed in r-prprc3.i is" {&My-Name} + "."VIEW-AS ALERT-BOXDuring execution, the first message included by r-prprc3.i displays the value of the My-Name argument, "David". The second message included by r-prprc3.i displays the value of the following My-Name preprocessor name, defined as "Donald", permanently overriding "David" passed by the My-Name argument. Finally, the message in r-prprc3.p displays the value of the My-Name preprocessor name that was initially defined there, "Daniel", because the value from My-Name established in r-prprc3.i ("Donald") went out of scope during compilation.Note also that the reference to the My-Name compile-time argument in r-prprc3.i is inside double-quotes, because ABL passes string constant values for compile-time arguments without the surrounding double-quotes.You can encounter compilation problems mixing preprocessor names with compile-time argument names. The following example, a variation of r-prprc3.i, does not compile, even when passed a My-Name argument as an include file. This is because the preprocessor My-Name value overrides the argument My-Name value, as shown:
&SCOPED-DEFINE My-Name "Donald"MESSAGE "My-Name preprocessed in r-prprc3.i is" {&My-Name} + "."VIEW-AS ALERT-BOX.MESSAGE "My-Name argument in r-prprc3.i is" "{&My-Name}" + "."VIEW-AS ALERT-BOX.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |