/
_if.html
98 lines (62 loc) · 2.64 KB
/
_if.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<html>
<head>
<meta charset='utf-8'>
<title>#if</title>
</head>
<body>
<h1>#if</h1>
<h2>Syntax</h2>
A conditional compilation <b>#if</b> has the form:<p>
</p>
<table>
<tr valign="top">
<td width="40"> </td>
<td colspan="8"><font size="+1"><b>#if</b> <i>expn</i> <b>then</b></font></td>
</tr>
<tr valign="top">
<td width="40"> </td>
<td width="40"> </td>
<td colspan="7"><font size="+1"><i>… any source text …</i></font></td>
</tr>
<tr valign="top">
<td width="40"> </td>
<td colspan="8"><font size="+1">{ <b>#elsif</b> <i>expn</i> <b>then</b></font></td>
</tr>
<tr valign="top">
<td width="40"> </td>
<td width="40"> </td>
<td colspan="7"><font size="+1"><i>… any source text …</i> }</font></td>
</tr>
<tr valign="top">
<td width="40"> </td>
<td colspan="8"><font size="+1">[ <b>#else</b></font></td>
</tr>
<tr valign="top">
<td width="40"> </td>
<td width="40"> </td>
<td colspan="7"><font size="+1"><i>… any source text …</i> ]</font></td>
</tr>
<tr valign="top">
<td width="40"> </td>
<td colspan="8"><font size="+1"><b>#end</b> <b>if</b></font></td>
</tr>
</table>
<p></p>
<h2>Description</h2>
An #<b>if</b> construct supports compile time selection of sections of source text to make up a program (or unit of a program), in other words <i>conditional compilation</i>. Any arbitrary source text (characters) can be selected.<p>
Each of the selecting expressions (<i>expns</i>) have the form of a boolean expression, with the use of the operators <b>and</b>, <b>or</b> and <b>not</b> (but not =>) and parentheses. The short forms & and ~ are supported. The operands of the expressions must be <i>preprocessor flags</i>, which are set by a system- dependent mechanism not described here. A flag is considered to be <b>true</b> if it is explicitly set. If it is not explicitly set, it is considered false.</p>
<p>
Unlike other parts of the language, the <b>#if</b>, <b>#elsif</b>, <b>#else</b> and <b>#end</b> <b>if</b> constructs are not free format. Specifically, they must be placed by themselves on a single line.</p>
<p>
</p>
<h2>Example</h2>
A pair of declarations is chosen if both <i>stats</i> and <i>debug</i> are set, otherwise the <b>put</b> statement is selected. The selected part becomes part of the program and the other parts are ignored.<p>
</p>
<pre><code> #if stats and debug then
var count : array 1 .. 5 of real
var message : string
#else
put "Debugging message"
#end if</code></pre>
</body>
</html>