File: cpp.rno

package info (click to toggle)
xview 3.2p1.4-4
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 20,068 kB
  • ctags: 24,304
  • sloc: ansic: 241,105; yacc: 1,392; sh: 1,140; makefile: 273; lex: 76; perl: 54; asm: 50; cpp: 15
file content (291 lines) | stat: -rw-r--r-- 8,099 bytes parent folder | download | duplicates (9)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
.lm 8.rm 72.nhy

.no autosubtitle .style headers 3,0,0
.pg.uc.ps 58,80.lm 8.rm 72
.hd
.hd mixed
.head mixed

.st ########cpp#####C Pre-Processor
.pg
.hl 1 ^&C Pre-Processor\&
.s 2
.c ;*******
.c ;* cpp *
.c ;*******
.s 2
.lm +8
.s.i -8;NAME:	cpp -- C Pre-Processor
.s.f
.i -8;SYNOPSIS:
.s.nf
cpp [-options] [infile [outfile]]
.s.f
.i -8;DESCRIPTION:
.s
CPP reads a C source file, expands macros and include
files, and writes an input file for the C compiler.
If no file arguments are given, CPP reads from stdin
and writes to stdout.  If one file argument is given,
it will define the input file, while two file arguments
define both input and output files.  The file name "-"
is a synonym for stdin or stdout as appropriate.
.s
The following options are supported.  Options may
be given in either case.
.lm +16
.p -16
-C		If set, source-file comments are written
to the output file.  This allows the output of CPP to be
used as the input to a program, such as lint, that expects
commands embedded in specially-formatted comments.
.p -16
-Dname=value	Define the name as if the programmer wrote
.s
.nf
    _#define name value
.s
.fill
at the start of the first file.  If "=value" is not
given, a value of "1" will be used.
.s
On non-unix systems, all alphabetic text will be forced
to upper-case.
.p -16
-E		Always return "success" to the operating
system, even if errors were detected.  Note that some fatal
errors, such as a missing _#include file, will terminate
CPP, returning "failure" even if the -E option is given.
.p -16
-Idirectory	Add this directory to the list of
directories searched for _#include "..." and _#include <...>
commands.  Note that there is no space between the
"-I" and the directory string.  More than one -I command
is permitted.  On non-Unix systems "directory" is forced
to upper-case.
.p -16
-N		CPP normally predefines some symbols defining
the target computer and operating system.  If -N is specified,
no symbols will be predefined.  If -N -N is specified, the
"always present" symbols, ____LINE____, ____FILE____, and ____DATE____
are not defined.
.p -16
-Stext		CPP normally assumes that the size of
the target computer's basic variable types is the same as the size
of these types of the host computer.  (This can be overridden
when CPP is compiled, however.)  The -S option allows dynamic
respecification of these values.  "text" is a string of
numbers, separated by commas, that specifies correct sizes.
The sizes must be specified in the exact order:
.s
.nf
    char short int long float double
.s
.fill
If you specify the option as "-S*text", pointers to these
types will be specified.  -S* takes one additional argument
for pointer to function (e.g. int (*)())
.s
For example, to specify sizes appropriate for a PDP-11,
you would write:
.s
.nf
       c s i l f d func
     -S1,2,2,2,4,8,
    -S*2,2,2,2,2,2,2
.s
.fill
Note that all values must be specified.
.p -16
-Uname		Undefine the name as if
.s
.nf
    _#undef name
.s
.fill
were given.  On non-Unix systems, "name" will be forced to
upper-case.
.p -16
-Xnumber	Enable debugging code.  If no value is
given, a value of 1 will be used.  (For maintenence of
CPP only.)
.s.lm -16
.s
.i -8;PRE-DEFINED VARIABLES:
.s
When CPP begins processing, the following variables will
have been defined (unless the -N option is specified):
.s
Target computer (as appropriate):
.s
.nf
    pdp11, vax, M68000 m68000 m68k
.fill
.s
Target operating system (as appropriate):
.s
.nf
    rsx, rt11, vms, unix
.fill
.s
Target compiler (as appropriate):
.s
.nf
    decus, vax11c
.fill
.s
The implementor may add definitions to this list.
The default definitions match the definition of the
host computer, operating system, and C compiler.
.s
The following are always available unless undefined (or
-N was specified twice):
.lm +16
.p -12
____FILE____	The input (or _#include) file being compiled
(as a quoted string).
.p -12
____LINE____	The line number being compiled.
.p -12
____DATE____	The date and time of compilation as
a Unix ctime quoted string (the trailing newline is removed).
Thus,
.s
.nf
    printf("Bug at line _%s,", ____LINE____);
    printf(" source file _%s", ____FILE____);
    printf(" compiled on _%s", ____DATE____);
.fill
.s.lm -16
.s
.i -8;DRAFT PROPOSED ANSI STANDARD CONSIDERATIONS:
.s
The current version of the Draft Proposed Standard
explicitly states that "readers are requested not to specify
or claim conformance to this draft."  Readers and users
of Decus CPP should not assume that Decus CPP conforms
to the standard, or that it will conform to the actual
C Language Standard.
.s
When CPP is itself compiled, many features of the Draft
Proposed Standard that are incompatible with existing
preprocessors may be disabled.  See the comments in CPP's
source for details.
.s
The latest version of the Draft Proposed Standard (as reflected
in Decus CPP) is dated November 12, 1984.
.s
Comments are removed from the input text.  The comment
is replaced by a single space character.  The -C option
preserves comments, writing them to the output file.
.s
The '$' character is considered to be a letter.  This is
a permitted extension.
.s
The following new features of C are processed by CPP:
.s.comment Note: significant spaces, not tabs, .br quotes #if, #elif
.br;####_#elif expression    (_#else _#if)
.br;####'_\xNNN'             (Hexadecimal constant)
.br;####'_\a'                (Ascii BELL)
.br;####'_\v'                (Ascii Vertical Tab)
.br;####_#if defined NAME    1 if defined, 0 if not
.br;####_#if defined (NAME)  1 if defined, 0 if not
.br;####_#if sizeof (basic type)
.br;####unary +
.br;####123U, 123LU          Unsigned ints and longs.
.br;####12.3L                Long double numbers
.br;####token_#token         Token concatenation
.br;####_#include token      Expands to filename
.s
The Draft Proposed Standard has extended C, adding a constant
string concatenation operator, where
.s
.nf
    "foo" "bar"
.s
.fill
is regarded as the single string "foobar".  (This does not
affect CPP's processing but does permit a limited form of
macro argument substitution into strings as will be discussed.)
.s
The Standard Committee plans to add token concatenation
to _#define command lines.  One suggested implementation
is as follows:  the sequence "Token1_#Token2" is treated
as if the programmer wrote "Token1Token2".  This could
be used as follows:
.s
.nf
    _#line 123
    _#define ATLINE foo_#____LINE____
.s
.fill
ATLINE would be defined as foo123.
.s
Note that "Token2" must either have the format of an
identifier or be a string of digits.  Thus, the string
.s
.nf
    _#define ATLINE foo_#1x3
.s
.fill
generates two tokens: "foo1" and "x3".
.s
If the tokens T1 and T2 are concatenated into T3,
this implementation operates as follows:
.s
.nf
  1. Expand T1 if it is a macro.
  2. Expand T2 if it is a macro.
  3. Join the tokens, forming T3.
  4. Expand T3 if it is a macro.
.s
.fill
A macro formal parameter will be substituted into a string
or character constant if it is the only component of that
constant:
.s
.nf
    _#define VECSIZE 123
    _#define vprint(name, size) _\
      printf("name" "[" "size" "] = {_\n")
      ... vprint(vector, VECSIZE);
.s
.fill
expands (effectively) to
.s
.nf
      vprint("vector[123] = {_\n");
.s
.fill
Note that this will be useful if your C compiler supports
the new string concatenation operation noted above.
As implemented here, if you write
.s
.nf
    _#define string(arg) "arg"
      ... string("foo") ...
.s
.fill
This implementation generates "foo", rather than the strictly
correct ""foo"" (which will probably generate an error message).
This is, strictly speaking, an error in CPP and may be removed
from future releases.
.s
.i -8;ERROR MESSAGES:
.s
Many.  CPP prints warning or error messages if you try to
use multiple-byte character constants (non-transportable)
if you _#undef a symbol that was not defined, or if your
program has potentially nested comments.
.s
.i -8;AUTHOR:
.s
Martin Minow
.s
.i -8;BUGS:
.s
The _#if expression processor uses signed integers only.
I.e, _#if 0xFFFFu < 0 may be TRUE.
.s
.lm 8.rm 72.nhy