Pascal Preprocessor
253
A
Syntax
%ifdef
expression
%then
.
.
%elseifdef
expression
%then
.
.
%endif
Comments
If the expression in
%ifdef
expression
%then
is
false
,
pc
skips over the
%then
part and executes the
%elseifdef
part instead. expression consists of a
conditional variable and the optional
boolean
operators,
and
,
or
, and
not
.
See the
%else
listing for examples of expression.
Example
The Pascal program,
ifdef.p
,
which first checks if
bird1
has
been defined. If not, it defines it
with a
%var
directive. If
bird1
has been defined, the program
checks whether or not it needs
to define
bird2
.
program ifdef_example(output);
%include 'bird.h';
begin
%ifdef not(bird1) %then
%var bird1
%elseifdef not(bird2) %then
%var bird2
%endif;
%if bird1 %then
writeln('Bird one is a ', a, '.');
%elseif bird2 %then
writeln('Bird two is a ', b, '.')
%endif
end. { ifdef_example }
Summary of Contents for SunSoft Pascal 4.0
Page 14: ...xiv Pascal 4 0 User s Guide ...
Page 16: ...xvi Pascal 4 0 User s Guide ...
Page 30: ...6 Pascal 4 0 User s Guide 1 ...
Page 160: ...136 Pascal 4 0 User s Guide 6 ...
Page 268: ...244 Pascal 4 0 User s Guide 11 ...
Page 320: ...296 Pascal 4 0 User s Guide B ...
Page 331: ...Index 307 ...
Page 333: ......