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
|
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1986-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* preprocessor data
*
* intended to be a conforming implementation of the translation phases
* (2.1.1.2) 1,2,3,4 and 6 of the "American National Standard for
* Information Systems -- Programming Language -- C", ANSI X3.159-1989.
*
* STANDARD INTERPRETATION:
*
* include files are forced to preserve #if nesting levels
* support for this is found in the recursive description for
* include file processing in the translation phases
*
* ID"..." produces two tokens: {ID}{"..."}
* ID'...' produces two tokens: {ID}{'...'}
*
* COMPATIBILITY:
*
* only sane Reiser compatibility is implemented
*
* strange handling of `\newline', especially in directives,
* is not implemented
*
* dissappearing comments used as concatenation operators work
* only within macro bodies
*/
static const char id[] = "\n@(#)$Id: libpp (AT&T Research) 2009-02-02 $\0\n";
#include "pplib.h"
#ifndef IDNAME
#define IDNAME "pp"
#endif
static char addbuf[MAXTOKEN+1]; /* ADD buffer */
static char argsbuf[MAXTOKEN+1]; /* predicate args */
static char catbuf[MAXTOKEN+1]; /* catenation buffer */
static char hidebuf[MAXTOKEN+1]; /* pp:hide buffer */
static char outbuf[2*(PPBUFSIZ+MAXTOKEN)];/* output buffer */
static char pathbuf[MAXTOKEN+1]; /* full path of last #include */
static char tmpbuf[MAXTOKEN+1]; /* very temporary buffer */
static char tokbuf[2*MAXTOKEN+1]; /* token buffer */
static char valbuf[MAXTOKEN+1]; /* builtin macro value buffer */
static char optflags[X_last_option+1];/* OPT_* flags indexed by X_* */
static char null[1];
static struct ppinstk instack = /* input stream stack */
{
&null[0] /* nextchr */
};
static struct ppdirs stddir = /* standard include directory */
{
PPSTANDARD, 0, 1, INC_STANDARD, TYPE_INCLUDE|TYPE_DIRECTORY|TYPE_HOSTED
};
static struct ppdirs firstdir = /* first include directory */
{
"", &stddir, 0, INC_PREFIX, TYPE_INCLUDE|TYPE_DIRECTORY
};
struct ppglobals pp =
{
/* public globals */
&id[10], /* version */
"", /* lineid */
"/dev/stdout", /* outfile */
IDNAME, /* pass */
&tokbuf[0], /* token */
0, /* symbol */
/* exposed for the output macros */
&outbuf[0], /* outb */
&outbuf[0], /* outbuf */
&outbuf[0], /* outp */
&outbuf[PPBUFSIZ], /* oute */
0, /* offset */
/* public context */
&firstdir, /* lcldirs */
&firstdir, /* stddirs */
0, /* flags */
0, /* symtab */
/* private context */
0, /* context */
0, /* state */
ALLMULTIPLE|CATLITERAL, /* mode */
PREFIX, /* option */
0, /* test */
0, /* filedeps.sp */
0, /* filedeps.flags */
&firstdir, /* firstdir */
&firstdir, /* lastdir */
0, /* hide */
0, /* column */
-1, /* pending */
0, /* firstfile */
0, /* lastfile */
0, /* ignore */
0, /* probe */
0, /* filtab */
0, /* prdtab */
0, /* date */
0, /* time */
0, /* maps */
0, /* ro_state */
0, /* ro_mode */
0, /* ro_option */
{0}, /* cdir */
{0}, /* hostdir */
0, /* ppdefault */
0, /* firstindex */
0, /* lastindex */
0, /* firstop */
0, /* lastop */
0, /* firsttx */
0, /* lasttx */
0, /* arg_file */
0, /* arg_mode */
0, /* arg_style */
0, /* c */
0, /* hosted */
0, /* ignoresrc */
0, /* initialized */
0, /* standalone */
0, /* spare_1 */
/* library private globals */
"\"08/11/94\"", /* checkpoint (with quotes!) */
128, /* constack */
&instack, /* in */
&addbuf[0], /* addp */
&argsbuf[0], /* args */
&addbuf[0], /* addbuf */
&catbuf[0], /* catbuf */
0, /* hdrbuf */
&hidebuf[0], /* hidebuf */
&pathbuf[0], /* path */
&tmpbuf[0], /* tmpbuf */
&valbuf[0], /* valbuf */
&optflags[0], /* optflags */
'\n', /* lastout */
/* the rest are implicitly initialized */
};
char ppctype[UCHAR_MAX+1];
|