next up previous contents
Next: Machine Dependencies Up: The STUTTGART TB-LMTO-ASA program. Previous: License Agreement

The preprocessor

 

A preprocessor ccomp provides a simplified, FORTRAN compatible version of C conditional compilation. FORTRAN statements beginning with C# are preprocessor directives; the ones implemented now are C#ifdef, C#ifndef, C#else, C#elseif, C#endif (also C#define defines a name). Directives C#ifdef, C#ifndef, C#elseif, and C#endif are followed by a name, e.g. C#ifdef CRAY. when C#ifdef is false (either name is not defined or it lies within an #if/#endif block that is false), ccomp comments out until a change of state (new C#ifdef, C#ifndef, C#else, C#elseif, C#endif encountered); C#ifdef is true, ccomp uncomments lines following until another conditional compilation directive is encountered.

Conditional compilation blocks may be nested. As with C, ccomp distinguishes case. Output is to standard out.

There is a primitive facility to make logical expressions using the AND (&) and OR (|) operators, such C#ifdef john & bill, or C#ifdef john | bill, is provided. Precedence of operators is strictly left to right, so that john | bill & mike is equivalent to (john | bill) & mike, whereas john & bill | mike is equivalent to (john & bill) | mike

How ccomp determines whether to modify code:

Whether the lines following a C#ifdef, C#ifndef, C#else, C#elseif, C#endif need to be commented out or uncommented depends on whether they have been commented out in a previous pass. This information is contained in a `C' following the directive, e.g. C#ifdefC, C#ifndefC, C#elseC, C#elseifC, C#endifC. The preprocessor will set this, it is best advised to create any new blocks uncommented and let the preprocessor do the commenting.

The main programs in directory MAIN: lm.f, lmstr.f, lmbnd.f, lmdos.f, lmovl.f, and lmhart.f are all obtained from and lmall.f in the main directory, by running the latter ccomp with different keywords defined. To modify a main program change lmall.f and execute make all. This will create all the main programs in MAIN and compile and link them. Similarly for the atomic program a non-relativistic version may be generated using the keyword NONREL.

The following line illustrates the use of the preprocessor (after it has been compiled by the C-compiler) IBM (CMS) machine: ccomp -uLM -dLMSTR LM LMSTR. `-uLM' means undefine LM i.e. remove LM specific lines. `-dLMSTR' means define LMSTR i.e. uncommend LMSTR specific lines. `LM' is the filename of the input file with file type FOR and file mode A. `LMSTR' is the output file. Multiple defines and undefines are possible.


next up previous contents
Next: Machine Dependencies Up: The STUTTGART TB-LMTO-ASA program. Previous: License Agreement

O. Jepsen
Thu Oct 12 14:48:45 MESZ 2000