Progress
Portability Guide
Using Preprocessor Directives
Progress provides a language preprocessor that allows you to write applications that are easy to read, modify, and transport to other operating systems. The preprocessor is a component of the Progress Compiler. Before the Compiler analyzes your source code and creates r-code, the preprocessor examines your source code and performs text substitutions.
You control the preprocessor by placing preprocessor directives throughout your source code. A preprocessor directive is a statement that begins with an ampersand (&) and is meaningful only to the preprocessor.
The preprocessor recognizes a built-in preprocessor constant that identifies the window system where a file is being compiled, called &WINDOW-SYSTEM. The possible values include “MS-WINnn” and “TTY.” You can use this constant to direct the preprocessor to determine which code to run on each window system, as follows:
The SESSION system handle also has a WINDOW-SYSTEM attribute. Your application can use this to test the current window system while it is running:
Both the &WINDOW-SYSTEM preprocessor constant and the SESSION handle WINDOW-SYSTEM attribute perform the same basic function. The &WINDOW-SYSTEM preprocessor constant allows you to write code that is conditionally compiled, while the WINDOW-SYSTEM attribute is a run-time function.
The WINDOW-SYSTEM attribute evaluates as follows:
- If Windows nn or Windows NT is running, and the Windows nn user interface is running, this attribute evaluates to MS-WINnn. Otherwise, if the Windows nn user interface is not running, it evaluates to MS-WINDOWS.
- If the application is not running in a Windows environment, this attribute evaluates to TTY.
Progress supports an override option that enables applications that require a WINDOW-SYSTEM attribute to return the value of MS-WINDOWS for all Microsoft operating systems. To establish this override capability, define the Window System key in the Startup Section of the current environment, which might be in the registry or an initialization file. If the Window System key is located, the WINDOW-SYSTEM attribute returns the value associated with the Window System key on all platforms.
You can also specify offsets and ROW and COLUMN specifications using preprocessor constants, then define the constants separately for different environments. Progress allows you to specify fractional character units so that you can specify precise locations for objects in a graphical environment. In a character environment, the ROW and COLUMN values are truncated to integer values, as follows:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |