| 263 |
dpurdie |
1 |
CPP Version 5.3: August 4, 1989.
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
INTRODUCTION
|
|
|
5 |
|
|
|
6 |
This file briefly describes CPP, a Preprocessor Program for the C language.
|
|
|
7 |
|
|
|
8 |
For an introduction to C and the C preprocessor, see K&R, i.e., the book,
|
|
|
9 |
The C Programming Language, second edition, by Kernighan and Ritchie, published
|
|
|
10 |
by Prentice Hall.
|
|
|
11 |
|
|
|
12 |
As far as is known, CPP meets all specifications in the Draft C
|
|
|
13 |
Standard of January, 1988. Please report all bugs to:
|
|
|
14 |
|
|
|
15 |
Edward K. Ream
|
|
|
16 |
1617 Monroe Street
|
|
|
17 |
Madison, WI 53711
|
|
|
18 |
(608) 257-0802.
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
OVERVIEW
|
|
|
22 |
|
|
|
23 |
CPP copies an input file to an output file, doing the following as it does so:
|
|
|
24 |
|
|
|
25 |
o It includes files into the output file. Included files may include other
|
|
|
26 |
include files to any depth.
|
|
|
27 |
o It expands macros. Macros may have arguments and may call other macros.
|
|
|
28 |
The details of macro processing are EXTREMELY complicated. See the Draft C
|
|
|
29 |
Standard of January, 1988 for full details.
|
|
|
30 |
o It conditionally includes lines from the input files. These directives may
|
|
|
31 |
be nested to any depth.
|
|
|
32 |
o It eliminates all comments by default, though comments may be included in
|
|
|
33 |
the output file if desired.
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
PREPROCESSOR DIRECTIVES
|
|
|
37 |
|
|
|
38 |
CPP supports the following preprocessing directives. See K&R or the Draft C
|
|
|
39 |
standard for a description of what these directives do.
|
|
|
40 |
|
|
|
41 |
#define identifier replacement_text
|
|
|
42 |
#define identifier(argument_list) replacement_text
|
|
|
43 |
#elif
|
|
|
44 |
#else
|
|
|
45 |
#endif
|
|
|
46 |
#error
|
|
|
47 |
#if constant_expression
|
|
|
48 |
#ifdef identifier
|
|
|
49 |
#ifndef identifier
|
|
|
50 |
#include "filename"
|
|
|
51 |
#include <filename>
|
|
|
52 |
#include tokens
|
|
|
53 |
#line line_number [optional_file_name]
|
|
|
54 |
#pragma
|
|
|
55 |
#undef identifier
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
USAGE
|
|
|
59 |
|
|
|
60 |
Invoke CPP as follows:
|
|
|
61 |
|
|
|
62 |
CPP input_file output_file [optional_arguments]
|
|
|
63 |
|
|
|
64 |
The following arguments are optional:
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
-c
|
|
|
69 |
|
|
|
70 |
Include comments and extra white space in the output file. By default,
|
|
|
71 |
comments and extra white space are excluded from the output file.
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
-d identifier
|
|
|
76 |
-d identifier=definition
|
|
|
77 |
|
|
|
78 |
Define an identifier on the command line, just as if
|
|
|
79 |
|
|
|
80 |
#define identifier definition
|
|
|
81 |
|
|
|
82 |
appeared at the start of the input file. The equal sign is not part of the
|
|
|
83 |
definition of the identifier. If the equal sign and definition are omitted, an
|
|
|
84 |
empty definition is created.
|
|
|
85 |
|
|
|
86 |
Whitespace is required between the -d and the identifier.
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
-n
|
|
|
91 |
|
|
|
92 |
Allow nested comments. By default, CPP follows the C standard and disallows
|
|
|
93 |
constructions such as
|
|
|
94 |
|
|
|
95 |
/* comment out -----
|
|
|
96 |
a = 5;
|
|
|
97 |
/* This is a nested comment. */
|
|
|
98 |
----- end comment out */
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
-s path
|
|
|
103 |
|
|
|
104 |
Specify one or more "standard places" to search when looking for included
|
|
|
105 |
files. For example:
|
|
|
106 |
|
|
|
107 |
CPP in out -s \src -s d:\src\headers
|
|
|
108 |
|
|
|
109 |
If no -s option is specifed, CPP uses \usr\include.
|
|
|
110 |
|
|
|
111 |
Whitespace is required between the -s and the path.
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
-u identifier
|
|
|
116 |
|
|
|
117 |
Cancel the first definition of identifier, as if #undef identifier were
|
|
|
118 |
inserted immediately following the that definition.
|