RADE |
Multi-Workspace Application Builder |
The Declarative File PreprocessorHow to distinguish specific operating system sections |
Technical Article |
AbstractSome declarative files are `preprocessed' (i.e. Imakefile.mk, IdentityCard.h) in order to distinguish specific sections (such as operating systems under which the workspace is being built). |
The preprocessor is an internal step which parse any lines that begin with a
`#' character in first column and is followed by an interpreted keyword,
any others are translated to declarative file parser.
Such lines cannot be continued on next line with the `\' continuing
character.
The comments are encapsulated with `/*' and `*/' sequence characters.
The following keywords are available:
#define FlagName | |
#undef FlagName | |
are used for special purpose and may not be used outside Dassault Systèmes | |
#if Expression | |
#elif Expression | |
#else | |
#endif | |
are used to check flag(s) by analysing Expression. |
Expression consist of test flag clauses that can be mixed with booleans
operators and grouped with parenthesis `(...)'.
Only following operators are supported (comparison's are not) :
&& | (AND) | |
|| | (OR) | |
! | (NOT) |
A clause consist of a flag existence test (not a value test), by using the
following keywords :
defined FlagName | |
used for special purpose and may not be used outside Dassault Systèmes | |
os OSName | |
test predefined flags set by mkmk, depending on the operating system it is executed. Such flags names correspond to value of environment variables MkmkOS_NAME (platform notion) and MkmkOS_Buildtime (targeted operating system notion, the one for which the code is being built) |
List of actually supported OS names is described in the following table:
Operating system | Value of OSName flag |
---|---|
AIX (IBM) | AIX aix_a |
HP-UX (Hewlett Packard) | HP-UX hpux_a |
SunOS (Sun MicroSystems) | SunOS solaris_a |
Windows (Microsoft) | Windows_NT intel_a (Windows 2000) win_a (Windows 98) |
This example is not optimized in term of logic but it just shows the syntax that can be used to distinguish operating systems specifics in a declarative file:
... common section (available for all operating systems) ... #if os AIX ... section available for IBM platform ... #elif os SunOS ... section available for SUN platform ... #elif os HP-UX ... section available for HP platform ... #elif os Windows_NT ... section available for Windows platform (intel_a, win_a ) ...
#if os intel_a ... section available for Windows NT operating systems ... #elif os win_a ... section available for Windows 98 operating system ... #endif /* "#if os intel_a" block closing instruction */ #else /*"#if os AIX" else instruction */ ... section available all other operating system ... #endif /* "#if os AIX" block closing instruction */ ... common section (available for all operating systems) ...
[Top]
Version: 1 [Mar 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.