The preprocessor


Introduction

A preprocessor is used to handle different versions of a program in one source. It allows you to exclude parts of the source from compilation or include another source file.

The preprocessor of FPKPascal is integrated in the compiler and supports all preprocessor instructions of TP except the compiler switches.

Furthermore, the preprocessor support macro expanding like and C allows to print user defined messages while compiling.

Predefined symbols

The symbol FPK is predefined for all versions of FPKPascal.

Furthermore, there are symbols to distinguish different versions of FPKPascal, for version 0.6.2 these are VER0, VER0_6 and VER0_6_2.

There are also predefined symbols to detect the target operating system: DOS for DOS,OS2 for OS/2, LINUX for LINUX and WIN32 for Windows 95/NT.

Messages

The preprocessor of FPKPascal allows to print messages while compiling to the error output stream (stdout or file).

$MESSAGE prints the message until the end of the comment

$WARNING prints the message until the end of the comment as compiler warning

$ERROR prints the message until the end of the comment as compiler error

Macros

The preprocessor supports macros like C. Macros are identifiers which are sustituted by another text while compiling. The compiler expects the compiler switch -Sm if macros should be supported.

Macros are defined by $DEFINE follow by an identifier and =. If this identifier occurs in the input, this identifier is replace by the compiler with the text which follows the =. Example: {...} {$DEFINE expr= a:=a+b; } {...} begin expr { becomes a:=a+b; } {$DEFINE b=100} expr { becomes a:=a+100; } end; {...}


back to Programmer's Manual

fnklaemp@cip.ft.uni-erlangen.de

Copyright (c) 1996 by Florian Klaempfl