1 /* $Id: preprocess.c,v 1.21 1994/06/24 10:18:50 ceriel Exp $ */
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 /* PREPROCESSOR DRIVER */
16 #include "line_prefix.h"
23 extern int do_preprocess;
27 if (do_preprocess) sys_write(STDOUT, _obuf, OBUFSIZE);
34 register char *op = _obuf;
35 register char *ob = &_obuf[OBUFSIZE];
38 extern char options[];
40 #define flush(X) (! do_preprocess || sys_write(STDOUT,_obuf,X))
41 #define echo(ch) if (op == ob) { Xflush(); op = _obuf; } *op++ = (ch);
42 #define newline() echo('\n')
45 /* Generate a line directive communicating the
48 register char *p = Xbuf;
50 sprint(p, "%s 1 \"%s\"\n",
67 if (lineno != LineNumber || fn != FileName) {
71 register char *p = Xbuf;
73 sprint(p, "%s %d \"%s\"\n",
89 fatal("non-ascii character read");
126 else if (options['C']) {
143 register int stopc = c;
168 } while (escaped || c != stopc);
171 break; /* Don't eat # */
176 #define getdec(c) do { echo(c); LoadChar(c);} while (is_dig(c))
177 #define gethex(c) do { echo(c); LoadChar(c);} while (is_hex(c))
181 if (c == '.') getdec(c);
185 if (c == '+' || c == '-') {
189 if (is_dig(c)) getdec(c);
195 if (c == 'x' || c == 'X') gethex(c);
196 else if (is_dig(c)) getdec(c);
200 extern int idfsize; /* ??? */
201 char buf[IDFSIZE + 1];
202 register char *tg = &buf[0];
203 register char *maxpos = &buf[idfsize];
204 register struct idf *idef;
206 #define tstmac(bx) if (!(bits[c] & bx)) goto nomac
207 #define cpy if (Unstacked) EnableMacros(); *tg++ = c
208 #define load LoadChar(c); if (!in_idf(c)) goto endidf
211 cpy; tstmac(bit0); load;
212 cpy; tstmac(bit1); load;
213 cpy; tstmac(bit2); load;
214 cpy; tstmac(bit3); load;
215 cpy; tstmac(bit4); load;
216 cpy; tstmac(bit5); load;
217 cpy; tstmac(bit6); load;
218 cpy; tstmac(bit7); load;
230 *tg = '\0'; /* mark the end of the identifier */
232 if (idef && idef->id_macro) {