/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1986-2010 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 *
* (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 lexical analyzer
* standalone and tokenizing lexer combined in one source
* define CPP=1 for standalone
*/
#include "pplib.h"
#include "ppfsm.h"
#if CPP
/*
* standalone entry point
*/
#define PPCPP_T void
#if DEBUG & TRACE_debug
#endif
#define PPCHECKOUT() do{if(op>xp){{PPWRITE(PPBUFSIZ);if(pp.outbuf==pp.outb){pp.outbuf+=PPBUFSIZ;xp=pp.oute+=PPBUFSIZ;}else{pp.outbuf-=PPBUFSIZ;memcpy(pp.outbuf,xp,op-xp);xp=pp.oute-=PPBUFSIZ;op-=2*PPBUFSIZ;}}}}while(0)
#define PPCHECKOUTSP() do{if(op>xp){if(sp)op=sp;else{PPWRITE(PPBUFSIZ);if(pp.outbuf==pp.outb){pp.outbuf+=PPBUFSIZ;xp=pp.oute+=PPBUFSIZ;}else{pp.outbuf-=PPBUFSIZ;memcpy(pp.outbuf,xp,op-xp);xp=pp.oute-=PPBUFSIZ;op-=2*PPBUFSIZ;}}}}while(0)
#define PPCHECKOUTTP() do{if(op>xp){{PPWRITE(PPBUFSIZ);if(pp.outbuf==pp.outb){pp.outbuf+=PPBUFSIZ;xp=pp.oute+=PPBUFSIZ;}else{pp.outbuf-=PPBUFSIZ;memcpy(pp.outbuf,xp,op-xp);xp=pp.oute-=PPBUFSIZ;op-=2*PPBUFSIZ;}}tp=op;}}while(0)
#define PPSYNCLINE() do { \
{ \
if (spliced) \
{ \
spliced = 0; \
} \
else \
{ \
{ \
op += m; \
PPCHECKOUT(); \
} \
{ \
{ \
if (error_info.line) \
{ \
if (LASTOUT() != '\n') \
PUTCHR('\n'); \
SYNCOUT(); \
CACHEOUT(); \
} \
} \
else \
{ \
while (m-- > 0) \
PUTCHR('\n'); \
} \
} \
else \
{ \
PUTCHR('\n'); \
} \
} \
} \
} while (0)
#if POOL
/*
* <wait.h> is poison here so pool moved to the end
*/
static void poolstatus(void);
static void pool(void);
#endif
#else
/*
* return next pp token
*
* NOTE: pp.token points to at least MAXTOKEN*2 chars and is
* truncated back to MAXTOKEN on EOB
*/
#define PPCPP_T int
#endif
ppcpp(void)
{
register short* rp;
register char* ip;
register int state;
register int c;
register char* op;
char* bp;
int n;
int m;
int quot;
int quotquot;
int comdelim = 0;
int comstart = 0;
int comwarn = 0;
char* s;
#if CPP
register long st;
char* tp;
char* xp;
char* sp = 0;
int qual = 0;
int spliced = 0;
#else
int qual;
#endif
#if CPP
#if POOL
#endif
#else
#endif
error_info.indent++;
CACHE();
#if !CPP
qual = 0;
#endif
#if CPP
PPCHECKOUTSP();
#endif
do
{
;
} while (state > 0);
if (((state = ~state) != S_COMMENT || pp.comment || c == '/' && !INCOMMENT(rp)) && (n = ip - bp - 1) > 0)
{
#if CPP
{
case S_SHARP:
break;
case S_CHRB:
case S_NL:
if (*ip == '\n')
break;
/*FALLTHROUGH*/
default:
break;
PPSYNCLINE();
break;
}
#endif
ip++;
}
#endif
debug((-9, "TERM %s > %s%s%s |%-*.*s|%s|", pplexstr(INDEX(rp)), pplexstr(state), (st & NEWLINE) ? "|NEWLINE" : "", (st & SKIPCONTROL) ? "|SKIP" : "", op - tp, op - tp, tp, pptokchr(c)));
{
#if !CPP
case S_CHR:
PUTCHR(c);
break;
#endif
case S_CHRB:
BACKIN();
#if CPP
goto fsm_start;
#else
c = *tp;
break;
#endif
case S_COMMENT:
switch (c)
{
case '\n':
if (!INCOMMENTXX(rp))
{
qual = 0;
error_info.line++;
else BACKOUT();
#if CPP
goto fsm_get;
#else
goto fsm_begin;
#endif
}
break;
case '*':
{
{
{
comwarn = 1;
}
}
}
PUTCHR(c);
#if CPP
goto fsm_get;
#else
goto fsm_begin;
#endif
case '/':
{
BACKIN();
#if CPP
goto fsm_start;
#else
c = '*';
goto fsm_token;
#endif
}
else if (INCOMMENTXX(rp))
{
{
else if (!comwarn)
{
comwarn = 1;
}
}
goto fsm_comment;
}
break;
case EOF:
BACKIN();
{
}
break;
}
#if CPP
{
#if COMPATIBLE
#endif
{
BACKOUT();
PUTCHR(' ');
}
}
#else
if (pp.comment && !(st & (COLLECTING|DIRECTIVE|JOINING)) && !(*pp.control & SKIP) && (pp.in->type & IN_TOP))
#endif
{
*(op - (c != '\n')) = 0;
BACKOUT();
SYNC();
(*pp.comment)(c == '\n' ? "//" : "/*", tp + 2, c == '\n' ? "" : (st & HEADER) ? "*/\n" : "*/", comstart ? comstart : error_info.line);
CACHE();
comstart = m;
}
if (comstart)
{
comstart = 0;
}
BACKOUT();
if (c == '\n') goto fsm_newline;
{
if (*ip == '\n')
ip++;
goto fsm_newline;
}
#if COMPATIBLE
#endif
#if !CPP
{
#if COMPATIBLE
#else
c = ' ';
#endif
goto fsm_return;
}
#endif
goto fsm_start;
case S_EOB:
if (c)
{
goto fsm_terminal;
#if CPP
#if POOL
{
BACKIN();
SYNC();
pool();
CACHE();
goto fsm_pool;
}
#endif
SYNCOUT();
return;
#else
BACKIN();
c = 0;
goto fsm_return;
#endif
}
{
#if CPP
#endif
{
case IN_BUFFER:
case IN_INIT:
case IN_RESCAN:
#if CPP
if (prv)
#else
#endif
{
{
#if PROTOTYPE
else
#endif
}
#if CPP
spliced = 0;
#endif
{
}
else
{
}
#if !CPP && CATSTRINGS
else
#endif
{
{
case IN_BUFFER:
case IN_INIT:
/*FALLTHROUGH*/
case IN_FILE:
case IN_RESCAN:
if (prv->type == IN_FILE || cur->type == IN_FILE && (prv->type == IN_RESCAN || prv->type == IN_MULTILINE))
{
{
POP();
SYNCOUT();
CACHEOUT();
}
}
#if DEBUG
{
/*UNDENT*/
c = 0;
#if DEBUG & TRACE_count
{
c = 1;
}
#endif
{
c = 1;
if (hit[n])
}
#endif
{
c = 1;
}
/*INDENT*/
}
#endif
break;
}
}
#if CHECKPOINT
{
SYNCOUT();
CACHEOUT();
}
#endif
POP();
goto fsm_get;
}
c = EOF;
break;
case IN_COPY:
if (prv)
{
POP();
goto fsm_get;
}
c = EOF;
break;
case IN_EXPAND:
if (prv)
{
POP();
goto fsm_get;
}
c = EOF;
break;
case IN_FILE:
if (c == EOB)
{
#if CPP
PUTCHR('\n');
if (prv)
#else
{
}
#endif
{
{
}
else
{
{
SYNCOUT();
CACHEOUT();
}
goto fsm_pop;
}
}
else
c = EOF;
}
break;
case IN_MACRO:
case IN_MULTILINE:
#if !CPP
#endif
#if COMPATIBLE
if (prv && (!INMACRO(rp) || (st & (COMPATIBILITY|TRANSITION)) == COMPATIBILITY && ppismac(*prv->nextchr)))
#else
#endif
{
{
{
SYNCOUT();
CACHEOUT();
}
}
POP();
#if CPP
#endif
goto fsm_get;
}
c = EOF;
break;
case IN_QUOTE:
if (prv)
{
POP();
c = '"';
}
else c = EOF;
break;
case IN_SQUOTE:
if (prv)
{
POP();
c = '\'';
}
else c = EOF;
break;
case IN_STRING:
#if CPP
if (prv)
#else
#endif
{
POP();
goto fsm_get;
}
c = EOF;
break;
default:
c = EOF;
break;
}
}
goto fsm_get;
#if !CPP
case S_HUH:
{
if (c == '=')
{
#if PROTOTYPE
else
{
#endif
PUTCHR(c);
#if PROTOTYPE
}
#endif
switch (*tp)
{
case '/':
c = T_DIVEQ;
break;
case '%':
c = T_MODEQ;
break;
case '&':
c = T_ANDEQ;
break;
case '*':
c = T_MPYEQ;
break;
case '+':
c = T_ADDEQ;
break;
case '-':
c = T_SUBEQ;
break;
case '^':
c = T_XOREQ;
break;
case '|':
c = T_OREQ;
break;
case '<':
c = T_LSHIFTEQ;
break;
case '>':
c = T_RSHIFTEQ;
break;
}
}
else
{
BACKIN();
switch (c = *tp)
{
case '<':
c = T_LSHIFT;
break;
case '>':
c = T_RSHIFT;
break;
}
}
}
{
{
goto fsm_top;
}
PUTCHR(c);
}
else if (*tp == ':')
{
PUTCHR(c);
else c = '+';
}
else
{
BACKIN();
c = *tp;
}
break;
#endif
case S_QUAL:
{
#if CPP
qual = 1;
#if COMPATIBLE
#endif
PUTCHR(c);
#else
switch (c)
{
case 'f':
case 'F':
#if COMPATIBLE
if (!(st & COMPATIBILITY))
#endif
PUTCHR(c);
break;
case 'l':
case 'L':
PUTCHR(c);
break;
case 'u':
case 'U':
qual |= N_UNSIGNED;
#if COMPATIBLE
if (!(st & COMPATIBILITY))
#endif
PUTCHR(c);
break;
default:
PUTCHR(c);
break;
}
#endif
goto fsm_get;
}
#if !CPP
#endif
/*FALLTHROUGH*/
case S_LITBEG:
#if CPP
quot = c;
{
PPSYNCLINE();
}
#else
if ((quot = c) == '<')
{
if (!(st & HEADER) || (pp.option & (HEADEREXPAND|HEADEREXPANDALL)) && pp.in->type != IN_FILE && pp.in->type != IN_BUFFER && pp.in->type != IN_INIT && pp.in->type != IN_RESCAN)
{
PUTCHR(c);
goto fsm_get;
}
quot = '>';
}
if (!DOSTRIP())
#endif
PUTCHR(c);
goto fsm_get;
case S_LITEND:
n = 1;
if (c != quot)
{
if (c != '\n' && c != EOF)
{
{
{
quotquot = c;
}
}
PUTCHR(c);
goto fsm_get;
}
#if CPP
{
if (c == '\n') goto fsm_newline;
goto fsm_start;
}
#endif
else
#if COMPATIBLE && !CPP
#endif
{
switch (quot)
{
case '"':
if (c == '\n')
{
error_info.line++;
{
PUTCHR('\\');
c = 'n';
}
{
PUTCHR('\\');
PUTCHR('n');
PUTCHR('"');
PUTCHR('\n');
c = '"';
}
PUTCHR(c);
goto fsm_get;
}
c = '\n';
break;
case '\'':
break;
case '>':
break;
default:
break;
}
#if !CPP
if (!DOSTRIP())
#endif
}
if (c == '\n')
{
UNGETCHR(c);
c = quot;
}
}
{
{
quotquot = c;
}
PUTCHR('\\');
PUTCHR(c);
goto fsm_get;
}
#if CPP
else PUTCHR(c);
#else
#endif
#if CATSTRINGS
#if CPP
#else
if (c == '"' && pp.level == 1 && !(st & (COLLECTING|JOINING|NOTEXT|SKIPCONTROL)) && (pp.mode & CATLITERAL))
#endif
{
char* pptoken;
long ppstate;
if (DOSTRIP())
/*
* revert to the top level since string
* concatenation crosses file boundaries
* (allowing intervening directives)
*/
SYNCIN();
m = n = 0;
for (;;)
{
switch (c = pplex())
{
case '\n':
m++;
continue;
case ' ':
continue;
case T_WSTRING:
#if !CPP
#endif
op--;
else
{
n = m;
*op++ = '\n';
}
continue;
case T_STRING:
op--;
else
{
n = m;
*op++ = '\n';
}
continue;
case 0:
/*FALLTHROUGH*/
default:
if (m)
{
if (--m)
{
}
#if COMPATIBLE
{
}
error_info.line--;
#endif
}
*op++ = ' ';
{
*(s + 1) = MARK;
*(s + 2) = 0;
}
op--;
break;
}
break;
}
CACHEIN();
#if !CPP
break;
#endif
}
#endif
#if CPP
if (n && !(st & (PASSTHROUGH|SKIPCONTROL|NOTEXT)) && c == '\'' && (op - tp) <= 2 && !(pp.mode & (HOSTED|RELAX)))
else
goto fsm_start;
#else
switch (quot)
{
case '\'':
c = T_CHARCONST | qual;
break;
case '>':
c = T_HEADER;
break;
default:
if (c == quot)
break;
}
break;
#endif
case S_LITESC:
{
{
PUTCHR('\\');
}
PUTCHR(c);
}
#if CPP
#endif
else switch (c)
{
case 'b':
case 'f':
case 'n':
case 'r':
case 't':
case '\\':
case '\'':
case '"':
case '?':
PUTCHR(c);
break;
#if COMPATIBLE
case '8':
case '9':
/*FALLTHROUGH*/
#endif
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
n = c - '0';
for (m = 0; m < 2; m++)
{
switch (c)
{
#if COMPATIBLE
case '8':
case '9':
if (!(st & COMPATIBILITY))
{
UNGETCHR(c);
break;
}
/*FALLTHROUGH*/
#endif
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
n = (n << 3) + c - '0';
continue;
default:
UNGETCHR(c);
break;
}
break;
}
goto octal;
case 'a':
{
PUTCHR(c);
break;
}
#if COMPATIBLE
#endif
n = CC_bel;
goto octal;
case 'v':
{
PUTCHR(c);
break;
}
n = CC_vt;
goto octal;
case 'E':
n = CC_esc;
goto octal;
case 'x':
#if COMPATIBLE
#endif
n = 0;
for (m = 0; m < 3; m++)
{
switch (c)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
n = (n << 4) + c - '0';
continue;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
n = (n << 4) + c - 'a' + 10;
continue;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
n = (n << 4) + c - 'A' + 10;
continue;
default:
UNGETCHR(c);
break;
}
break;
}
break;
default:
PUTCHR(c);
break;
}
goto fsm_begin;
case S_MACRO:
BACKIN();
#if CPP
{
goto fsm_start;
}
SETCHR(0);
{
case HIT0:
break;
case HITN:
break;
default:
break;
}
{
SYNCIN();
CACHEIN();
if (n >= 0)
{
BACKOUT();
if (!n)
{
else
{
s = ip;
while (c > 0)
{
c -= n;
PPCHECKOUT();
}
ip = s;
}
}
{
SYNCOUT();
ppputchar('\n');
CACHEOUT();
}
}
}
goto fsm_start;
#else
{
c = T_ID;
{
{
BACKOUT();
goto fsm_top;
}
{
SETCHR(0);
{
if ((sym->flags & SYM_KEYWORD) && (!pp.truncate || (op - tp) <= pp.truncate || (tp[pp.truncate] = '_', tp[pp.truncate + 1] = 0, pp.symbol = sym = (pp.option & NOHASH) ? ppsymref(pp.symtab, tp) : ppsymset(pp.symtab, tp), 0)))
{
/*UNDENT*/
#define NOISE_BRACE 01
#define NOISE_NOSPACEOUT 02
#define NOISE_PAREN 04
{
if (c != T_NOISE)
{
int p;
int f;
char* pptoken;
SYNCIN();
f = 0;
{
f |= NOISE_NOSPACEOUT;
}
switch (c)
{
case T_X_GROUP:
m = p = 0;
quot = 1;
for (;;)
{
ADVANCE();
switch (c = pplex())
{
case '(':
case '{':
if (!p)
{
if (c == '(')
{
if (f & NOISE_PAREN)
{
ungetchr(c);
break;
}
f |= NOISE_PAREN;
p = ')';
}
else
{
f |= NOISE_BRACE|NOISE_PAREN;
p = '}';
}
n = 1;
m = c;
}
else if (c == m) n++;
quot = 0;
continue;
case ')':
case '}':
if (c == p && --n <= 0)
{
if (c == '}') break;
m = '\n';
p = 0;
}
quot = 0;
continue;
case ' ':
continue;
case '\n':
error_info.line++;
if (!m) m = '\n';
continue;
case 0:
break;
case T_ID:
if (quot) continue;
/*FALLTHROUGH*/
default:
if (m == '\n')
{
/*
* NOTE: token expanded again
*/
break;
}
continue;
}
break;
}
break;
case T_X_LINE:
for (;;)
{
ADVANCE();
switch (pplex())
{
case 0:
break;
case '\n':
error_info.line++;
break;
default:
continue;
}
break;
}
break;
case T_X_STATEMENT:
for (;;)
{
ADVANCE();
switch (pplex())
{
case 0:
break;
case ';':
ungetchr(';');
break;
default:
continue;
}
break;
}
break;
}
if (f & NOISE_NOSPACEOUT)
CACHEIN();
c = T_NOISES;
}
{
BACKOUT();
goto fsm_top;
}
}
/*INDENT*/
}
{
}
}
}
goto fsm_symbol;
}
goto fsm_check;
}
{
}
SETCHR(0);
{
SYNCIN();
CACHEIN();
if (c >= 0)
{
BACKOUT();
{
SYNCOUT();
CACHEOUT();
}
goto fsm_top;
}
}
c = T_ID;
{
{
BACKOUT();
goto fsm_top;
}
{
{
sym = 0;
}
if (!sym)
{
}
goto fsm_noise;
}
goto fsm_symbol;
}
goto fsm_check;
#endif
case S_SHARP:
if (c == '(')
{
{
{
PUTCHR(c);
#if CPP
goto fsm_start;
#else
break;
#endif
}
}
{
PUTCHR(c);
#if CPP
goto fsm_start;
#else
break;
#endif
}
op--;
SYNC();
ppbuiltin();
CACHE();
#if CPP
goto fsm_start;
#else
goto fsm_top;
#endif
}
BACKIN();
#if CPP
{
goto fsm_start;
}
if (*(s = tp) != '#')
{
#if COMPATIBLE
#endif
while (*s == ' ' || *s == '\t') s++;
if (*s != '#') goto fsm_nondirective;
}
BACKOUT();
#else
{
if (c == '#')
{
SKIPIN();
if (!(st & DEFINITION))
PUTCHR(c);
c = T_TOKCAT;
}
{
char* pptoken;
char* oop;
SYNCIN();
for (;;)
{
ADVANCE();
switch (pplex())
{
case 0:
break;
case '\n':
error_info.line++;
break;
default:
continue;
}
break;
}
CACHEIN();
*--op = 0;
{
*s = 0;
SYNC();
CACHE();
}
if (!c) BACKIN();
goto fsm_top;
}
else c = '#';
break;
}
#endif
{
/*
* pass line to pp.pragma VERBATIM
*/
SKIPIN();
while ((c = GETCHR()) && c != '\n')
{
*s = 0;
SYNC();
CACHE();
}
if (!c) BACKIN();
#if CPP
goto fsm_start;
#else
goto fsm_top;
#endif
}
SYNC();
ppcontrol();
CACHE();
#if CPP
{
if (!sp)
{
PPCHECKOUTTP();
}
}
else if (sp)
{
sp = 0;
}
goto fsm_start;
#else
goto fsm_top;
#endif
case S_NL:
#if CPP
{
error_info.line++;
goto fsm_start;
}
#endif
#if CPP
if (sp)
{
{
break;
}
c = '\n';
}
error_info.line++;
{
ip++;
PUTCHR('\n');
error_info.line++;
}
BACKOUT();
else
{
PUTCHR('\n');
PPSYNCLINE();
if (sp)
{
PPCHECKOUT();
}
}
goto fsm_start;
#else
{
error_info.line++;
{
BACKOUT();
goto fsm_top;
}
}
BACKOUT();
if (st & SKIPCONTROL)
{
error_info.line++;
goto fsm_start;
}
PUTCHR(c = '\n');
goto fsm_return;
#endif
#if !CPP
case S_TOK:
PUTCHR(c);
break;
case S_TOKB:
BACKIN();
break;
#endif
case S_VS:
PUTCHR(c);
#if !CPP
if (st & NOVERTICAL)
{
st &= ~NOVERTICAL;
}
#endif
#if COMPATIBLE
#endif
#if CPP
{
break;
}
goto fsm_start;
#else
goto fsm_get;
#endif
#if !CPP
case S_WS:
#if COMPATIBLE
#endif
{
{
{
#if CATSTRINGS
#else
#endif
{
BACKOUT();
goto fsm_get;
}
}
else
#if CATSTRINGS
#endif
{
goto fsm_get;
}
BACKIN();
c = ' ';
goto fsm_return;
}
BACKOUT();
goto fsm_get;
}
{
BACKOUT();
goto fsm_get;
}
if (c != '\n')
{
BACKIN();
c = ' ';
}
{
BACKOUT();
PUTCHR(c);
}
goto fsm_return;
#endif
default:
{
switch (c)
{
case MARK:
/*
* internal mark
*/
{
case IN_BUFFER:
case IN_FILE:
#if !CPP
case IN_INIT:
#if CATSTRINGS
if ((st & JOINING) && (!INQUOTE(rp) || quot != '"') || pp.level > 1 && (rp == fsm[START] || INQUOTE(rp)))
#else
#endif
PUTCHR(c);
#endif
break;
default:
switch (GETCHR())
{
case 'A':
{
c = GETCHR();
SYNCIN();
else
CACHEIN();
goto fsm_get;
}
/*FALLTHROUGH*/
case 'C':
if (!*(s = pp.macp->arg[c]) && (pp.in->symbol->flags & SYM_VARIADIC) && pp.in->symbol->macro->arity == (c + 1))
{
s = ip - 3;
}
else
{
SYNCIN();
CACHEIN();
}
goto fsm_get;
case 'F':
goto fsm_get;
case 'L':
goto fsm_get;
case 'Q':
c = GETCHR();
SYNCIN();
CACHEIN();
goto fsm_get;
case 'S':
c = GETCHR();
SYNCIN();
CACHEIN();
goto fsm_get;
case 'X':
{
goto fsm_get;
}
{
PUTCHR(c);
PUTCHR('X');
}
c = GETCHR();
break;
case 0:
goto fsm_begin;
default:
#if DEBUG
/*FALLTHROUGH*/
case MARK:
#endif
#if CATSTRINGS
{
PUTCHR(c);
}
else
#endif
#if CPP
UNGETCHR(c);
#else
UNGETCHR(c);
PUTCHR(c);
#endif
break;
}
break;
}
break;
case '?':
/*
* trigraph
*/
{
if (n == '?')
{
if (c = trigraph[n])
{
error(1, "trigraph conversion %c%c%c -> %c%s", '?', '?', n, c, (st & TRANSITION) ? "" : " inhibited");
#if COMPATIBLE
{
#endif
goto fsm_get;
#if COMPATIBLE
}
#endif
}
UNGETCHR(c = '?');
}
}
break;
case '%':
case '<':
case ':':
/*
* digraph = --trigraph
*/
{
m = 0;
switch (n)
{
case '%':
if (c == '<') m = '{';
break;
case '>':
if (c == '%') m = '}';
else if (c == ':') m = ']';
break;
case ':':
if (c == '%') m = '#';
else if (c == '<') m = '[';
break;
}
if (m)
{
#if COMPATIBLE
{
#endif
goto fsm_get;
#if COMPATIBLE
}
#endif
}
}
break;
case '\\':
/*
* line splice
*/
{
m = 0;
while (n == ' ')
{
m = 1;
}
if (n == '\r')
{
if (n != '\n' && n != EOB)
BACKIN();
}
if (n == '\n')
{
#if CPP
{
{
PUTCHR(n);
}
{
PUTCHR(c);
PUTCHR(n);
}
else
{
}
}
else
#else
#if COMPATIBLE
{
{
error_info.line++;
goto fsm_start;
PUTCHR(c);
goto fsm_check;
}
UNGETCHR(n);
goto fsm_terminal;
}
#endif
#endif
{
}
#if CPP
spliced++;
#else
error_info.line++;
#endif
goto fsm_get;
}
{
PUTCHR(c);
PUTCHR(n);
goto fsm_get;
}
#if COMPATIBLE
else if ((st & (COMPATIBILITY|TRANSITION)) == COMPATIBILITY && (n == '"' || n == '\'') && !INQUOTE(rp))
{
PUTCHR(c);
PUTCHR(n);
goto fsm_get;
}
#endif
else if (n != EOB)
BACKIN();
UNGETCHR(c);
}
#if COMPATIBLE
{
if (n == '"' || n == '\'')
{
PUTCHR(c);
PUTCHR(n);
goto fsm_get;
}
if (n != EOB)
BACKIN();
}
#endif
break;
case '\r':
/*
* barf
*/
{
if (n == '\n')
{
goto fsm_get;
}
}
break;
case CC_sub:
/*
* barf & puke
*/
{
c = 0;
goto fsm_terminal;
}
break;
}
goto fsm_terminal;
PUTCHR(c);
goto fsm_begin;
}
#if CPP
{
BACKIN();
goto fsm_start;
}
#endif
PUTCHR(c);
goto fsm_get;
}
#if !CPP
{
{
BACKOUT();
goto fsm_top;
}
}
if (st & SKIPCONTROL)
{
BACKOUT();
goto fsm_start;
}
#if CPP
#endif
SETCHR(0);
SYNC();
error_info.indent--;
return c;
#endif
}
#include <ls.h>
#include <wait.h>
/*
* output pool status on exit
*/
static void
poolstatus(void)
{
}
/*
* loop on < input output >
*/
static void
pool(void)
{
char* ifile;
char* ofile;
ppflushout();
/*
* kick the -I cache
*/
/*
* loop on < input output >
*/
{
*ofile++ = 0;
switch (fork())
{
case -1:
case 0:
error_info.errors = 0;
error_info.warnings = 0;
close(0);
close(1);
#if CHECKPOINT
{
if (!pp.pragma)
}
#endif
return;
}
}
}
#endif