Quick Search:

Mode

Context

Displaying the whole file. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.12
 
1.13
 
MAIN:ragge:20090308102151
 
token.c
_>11 /*      $Id$    */
 22 
 33 /*
<>4 - * Copyright (c) 2004 Anders Magnusson. All rights reserved.
  4+ * Copyright (c) 2004,2009 Anders Magnusson. All rights reserved.
55  *
 66  * Redistribution and use in source and binary forms, with or without
 77  * modification, are permitted provided that the following conditions
 88  * are met:
 99  * 1. Redistributions of source code must retain the above copyright
 1010  *    notice, this list of conditions and the following disclaimer.
 1111  * 2. Redistributions in binary form must reproduce the above copyright
 1212  *    notice, this list of conditions and the following disclaimer in the
 1313  *    documentation and/or other materials provided with the distribution.
<>14 - * 3. The name of the author may not be used to endorse or promote products
 15 - *    derived from this software without specific prior written permission
1614  *
 1715  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 1816  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 1917  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 2018  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 2119  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 2220  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 2321  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 2422  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 2523  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 2624  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 2725  */
 2826 
<> 27+#include "config.h"
  28+
2929 #include <stdlib.h>
 3030 #include <string.h>
 3131 #include <ctype.h>
<> 32+#ifdef HAVE_UNISTD_H
3233 #include <unistd.h>
<> 34+#endif
3335 #include <fcntl.h>
<> 36+#include <errno.h>
3437 
<> 38+#include "compat.h"
3539 #include "cpp.h"
<> 40+#include "y.tab.h"
3641 
<>37 -/* definition for include file info */
 38 -struct includ *ifiles;
  42+static void cvtdig(int rad);
  43+static int charcon(usch *);
  44+static void elsestmt(void);
  45+static void ifdefstmt(void);
  46+static void ifndefstmt(void);
  47+static void endifstmt(void);
  48+static void ifstmt(void);
  49+static void cpperror(void);
  50+static void pragmastmt(void);
  51+static void undefstmt(void);
  52+static void cpperror(void);
  53+static void elifstmt(void);
  54+static void storepb(void);
  55+static void badop(const char *);
  56+void  include(void);
  57+void  define(void);
3958 
<>40 -usch *yyp, *yystr, yybuf[CPPBUF];
  59+extern int yyget_lineno (void);
  60+extern void yyset_lineno (int);
4161 
<>42 -int yylex(void);
 43 -int yywrap(void);
  62+static int inch(void);
4463 
<>45 -static struct includ *
 46 -getbuf(usch *file)
 47 -{
 48 -        struct includ *ic;
 49 -        usch *ostr = stringbuf;
  64+static int scale, gotdef, contr;
  65+int inif;
5066 
<>51 -        stringbuf = (usch *)ROUND((int)stringbuf);
 52 -        ic = (struct includ *)stringbuf;
 53 -        stringbuf += sizeof(struct includ);
 54 -        ic->ostr = ostr;
  67+#undef input
  68+#undef unput
  69+#define input() inch()
  70+#define unput(ch) unch(ch)
  71+#define PRTOUT(x) if (YYSTATE || slow) return x; if (!flslvl) putstr((usch *)yytext);
  72+/* protection against recursion in #include */
  73+#define MAX_INCLEVEL    100
  74+static int inclevel;
5575 
<>56 -        return ic;
 57 -}
  76+#define IFR     1
  77+#define CONTR   2
  78+#define DEF     3
  79+#define COMMENT 4
  80+static int state;
  81+#define BEGIN state =
  82+#define YYSTATE state
5883 
<> 84+char yytext[CPPBUF];
  85+
5986 static void
<>60 -putbuf(struct includ *ic)
  87+unch(int c)
6188 {
<>62 -if (stringbuf < (usch *)&ic[1])
 63 -;
 64 -else
 65 -        stringbuf = ic->ostr;
  89+        *--ifiles->curptr = c;
6690 }
 6791 
<> 92+
  93+int
  94+yylex()
  95+{
  96+        static int owasnl, wasnl = 1;
  97+        int ch;
  98+        int yyp;
  99+        int os, mixed, haspmd;
  100+
  101+zagain:
  102+        yyp = 0;
  103+again:
  104+        yytext[yyp++] = ch = inch();
  105+        owasnl = wasnl;
  106+        wasnl = 0;
  107+        switch (ch) {
  108+        case '\n':
  109+                os = YYSTATE;
  110+
  111+                wasnl = 1;
  112+                if (os != IFR)
  113+                        BEGIN 0;
  114+                ifiles->lineno++;
  115+                if (flslvl == 0) {
  116+                        if (ifiles->lineno == 1)
  117+                                prtline();
  118+                        else
  119+                                putch('\n');
  120+                }
  121+                if ((os != 0 || slow) && !contr)
  122+                        goto yyret;
  123+                contr = 0;
  124+                break;
  125+
  126+        case '\r': /* Ignore CR's */
  127+                yyp = 0;
  128+                break;
  129+
  130+#define CHK(x,y) if (state != IFR) goto any; \
  131+        if ((ch = input()) != y) { unput(ch); ch = x; goto any; } \
  132+        yytext[yyp++] = ch
  133+
  134+        case '+': CHK('+','+'); badop("++"); break;
  135+        case '-': CHK('-','-'); badop("--"); break;
  136+        case '=': CHK('=','='); ch = EQ; goto yyret;
  137+        case '!': CHK('!','='); ch = NE; goto yyret;
  138+        case '|': CHK('|','|'); ch = OROR; goto yyret;
  139+        case '&': CHK('&','&'); ch = ANDAND; goto yyret;
  140+        case '<':
  141+                if (state != IFR) goto any;
  142+                if ((ch = inch()) == '=') {
  143+                        yytext[yyp++] = ch; ch = LE; goto yyret;
  144+                }
  145+                if (ch == '<') { yytext[yyp++] = ch; ch = LS; goto yyret; }
  146+                unch(ch);
  147+                ch = '<';
  148+                goto any;
  149+        case '>':
  150+                if (state != IFR) goto any;
  151+                if ((ch = inch()) == '=') {
  152+                        yytext[yyp++] = ch; ch = GE; goto yyret;
  153+                }
  154+                if (ch == '>') { yytext[yyp++] = ch; ch = RS; goto yyret; }
  155+                unch(ch);
  156+                ch = '>';
  157+                goto any;
  158+
  159+
  160+        case '0': case '1': case '2': case '3': case '4': case '5':
  161+        case '6': case '7': case '8': case '9':
  162+                /* readin a "pp-number" */
  163+                mixed = haspmd = 0;
  164+ppnum:          for (;;) {
  165+                        ch = input();
  166+                        if (ch == 'e' || ch == 'E' || ch == 'p' || ch == 'P') {
  167+                                yytext[yyp++] = ch;
  168+                                mixed = 1;
  169+                                ch = input();
  170+                                if (ch == '-' || ch == '+') {
  171+                                        yytext[yyp++] = ch;
  172+                                        haspmd = 1;
  173+                                } else
  174+                                        unput(ch);
  175+                                continue;
  176+                        }
  177+                        if (isdigit(ch) || isalpha(ch) ||
  178+                            ch == '_' || ch == '.') {
  179+                                yytext[yyp++] = ch;
  180+                                if (ch == '.')
  181+                                        haspmd = 1;
  182+                                if (!isdigit(ch))
  183+                                        mixed = 1;
  184+                                continue;
  185+                        }
  186+                        break;
  187+                }
  188+                yytext[yyp] = 0;
  189+
  190+                if (mixed == 0) {
  191+                        if (slow && !YYSTATE)
  192+                                return IDENT;
  193+                        scale = yytext[0] == '0' ? 8 : 10;
  194+                        goto num;
  195+                } else if (yytext[0] == '0' &&
  196+                    (yytext[1] == 'x' || yytext[1] == 'X')) {
  197+                        scale = 16;
  198+num:                    if (YYSTATE == IFR)
  199+                                cvtdig(scale);
  200+                        PRTOUT(NUMBER);
  201+                } else if (yytext[0] == '0' && isdigit(yytext[1])) {
  202+                        scale = 8; goto num;
  203+                } else if (haspmd) {
  204+                        PRTOUT(FPOINT);
  205+                } else {
  206+                        scale = 10; goto num;
  207+                }
  208+                goto zagain;
  209+
  210+
  211+        case '\'':
  212+chlit:          if (tflag && !(YYSTATE || slow))
  213+                        goto any;
  214+                for (;;) {
  215+                        if ((ch = input()) == '\\') {
  216+                                yytext[yyp++] = ch;
  217+                                yytext[yyp++] = input();
  218+                                continue;
  219+                        } else if (ch == '\n') {
  220+                                /* not a constant */
  221+                                while (yyp > 1)
  222+                                        unput(yytext[--yyp]);
  223+                                ch = '\'';
  224+                                goto any;
  225+                        } else
  226+                                yytext[yyp++] = ch;
  227+                        if (ch == '\'')
  228+                                break;
  229+                }
  230+                yytext[yyp] = 0;
  231+
  232+                if (YYSTATE || slow) {
  233+                        yylval.node.op = NUMBER;
  234+                        yylval.node.nd_val = charcon((usch *)yytext);
  235+                        return (NUMBER);
  236+                }
  237+                if (!flslvl)
  238+                        putstr((usch *)yytext);
  239+                goto zagain;
  240+
  241+        case ' ':
  242+        case '\t':
  243+                if (state == IFR)
  244+                        goto zagain;
  245+
  246+                while ((ch = input()) == ' ' || ch == '\t')
  247+                        yytext[yyp++] = ch;
  248+                if (owasnl == 0) {
  249+b1:                     unput(ch);
  250+                        yytext[yyp] = 0;
  251+                        PRTOUT(WSPACE);
  252+                } else if (ch != '#') {
  253+                        goto b1;
  254+                } else {
  255+                        extern int inmac;
  256+
  257+                        while ((ch = input()) == ' ' || ch == '\t')
  258+                                ;
  259+                        unch(ch);
  260+                        if (inmac)
  261+                                error("preprocessor directive found "
  262+                                    "while expanding macro");
  263+                        contr = 1;
  264+                        BEGIN CONTR;
  265+
  266+                }
  267+                goto zagain;
  268+
  269+        case '/':
  270+                if ((ch = input()) == '/') {
  271+                        do {
  272+                                yytext[yyp++] = ch;
  273+                                ch = input();
  274+                        } while (ch && ch != '\n');
  275+                        yytext[yyp] = 0;
  276+                        unch(ch);
  277+                        if (Cflag && !flslvl && !slow)
  278+                                putstr((usch *)yytext);
  279+                        else if (!flslvl)
  280+                                putch(' ');
  281+                        goto zagain;
  282+                } else if (ch == '*') {
  283+                        int c, wrn;
  284+                        int prtcm = Cflag && !flslvl && !slow;
  285+                        extern int readmac;
  286+
  287+                        if (Cflag && !flslvl && readmac)
  288+                                return CMNT;
  289+
  290+                        if (prtcm)
  291+                                putstr((usch *)yytext);
  292+                        wrn = 0;
  293+                more:   while ((c = input()) && c != '*') {
  294+                                if (c == '\n')
  295+                                        putch(c), ifiles->lineno++;
  296+                                else if (c == 1) /* WARN */
  297+                                        wrn = 1;
  298+                                else if (prtcm)
  299+                                        putch(c);
  300+                        }
  301+                        if (c == 0)
  302+                                return 0;
  303+                        if (prtcm)
  304+                                putch(c);
  305+                        if ((c = input()) && c != '/') {
  306+                                unput(c);
  307+                                goto more;
  308+                        }
  309+                        if (prtcm)
  310+                                putch(c);
  311+                        if (c == 0)
  312+                                return 0;
  313+                        if (!tflag && !Cflag && !flslvl)
  314+                                unput(' ');
  315+                        if (wrn)
  316+                                unput(1);
  317+                        goto zagain;
  318+                }
  319+                unch(ch);
  320+                ch = '/';
  321+                goto any;
  322+
  323+        case '#':
  324+                if (state != DEF)
  325+                        goto any;
  326+                if ((ch = input()) == '#') {
  327+                        yytext[yyp++] = ch;
  328+                        ch = CONCAT;
  329+                } else {
  330+                        unput(ch);
  331+                        ch = MKSTR;
  332+                }
  333+                goto yyret;
  334+                
  335+        case '.':
  336+                if (state != DEF) {
  337+                        ch = input();
  338+                        if (isdigit(ch)) {
  339+                                yytext[yyp++] = ch;
  340+                                mixed = haspmd = 1;
  341+                                goto ppnum;
  342+                        } else {
  343+                                unput(ch);
  344+                                ch = '.';
  345+                        }
  346+                        goto any;
  347+                }
  348+                if ((ch = input()) != '.') {
  349+                        unput(ch);
  350+                        ch = '.';
  351+                        goto any;
  352+                }
  353+                if ((ch = input()) != '.') {
  354+                        unput(ch);
  355+                        unput('.');
  356+                        ch = '.';
  357+                        goto any;
  358+                }
  359+                yytext[yyp++] = ch;
  360+                yytext[yyp++] = ch;
  361+                ch = ELLIPS;
  362+                goto yyret;
  363+
  364+
  365+        case '\"':
  366+        strng:
  367+                for (;;) {
  368+                        if ((ch = input()) == '\\') {
  369+                                yytext[yyp++] = ch;
  370+                                yytext[yyp++] = input();
  371+                                continue;
  372+                        } else
  373+                                yytext[yyp++] = ch;
  374+                        if (ch == '\"')
  375+                                break;
  376+                }
  377+                yytext[yyp] = 0;
  378+                { PRTOUT(STRING); }
  379+                break;
  380+
  381+        case 'L':
  382+                if ((ch = input()) == '\"') {
  383+                        yytext[yyp++] = ch;
  384+                        goto strng;
  385+                } else if (ch == '\'') {
  386+                        yytext[yyp++] = ch;
  387+                        goto chlit;
  388+                }
  389+                unput(ch);
  390+                /* FALLTHROUGH */
  391+
  392+        /* Yetch, all identifiers */
  393+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
  394+        case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
  395+        case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
  396+        case 's': case 't': case 'u': case 'v': case 'w': case 'x':
  397+        case 'y': case 'z':
  398+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
  399+        case 'G': case 'H': case 'I': case 'J': case 'K':
  400+        case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
  401+        case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
  402+        case 'Y': case 'Z':
  403+        case '_': { /* {L}({L}|{D})* */
  404+                struct symtab *nl;
  405+
  406+                /* Special hacks */
  407+                for (;;) { /* get chars */
  408+                        ch = input();
  409+                        if (isalpha(ch) || isdigit(ch) || ch == '_')
  410+                                yytext[yyp++] = ch;
  411+                        else
  412+                                break;
  413+                }
  414+                yytext[yyp] = 0; /* need already string */
  415+
  416+                switch (state) {
  417+                case DEF:
  418+                        if (strcmp(yytext, "__VA_ARGS__") == 0)
  419+                                return VA_ARGS;
  420+                        break;
  421+                case CONTR:
  422+#define CC(s)   if (strcmp(yytext, s) == 0)
  423+                        CC("ifndef") {
  424+                                contr = 0; ifndefstmt();
  425+                                goto zagain;
  426+                        } else CC("ifdef") {
  427+                                contr = 0; ifdefstmt();
  428+                                goto zagain;
  429+                        } else CC("if") {
  430+                                contr = 0; storepb(); BEGIN IFR;
  431+                                ifstmt(); BEGIN 0;
  432+                                goto zagain;
  433+                        } else CC("include") {
  434+                                contr = 0; BEGIN 0; include(); prtline();
  435+                                goto zagain;
  436+                        } else CC("else") {
  437+                                contr = 0; elsestmt();
  438+                                goto zagain;
  439+                        } else CC("endif") {
  440+                                contr = 0; endifstmt();
  441+                                goto zagain;
  442+                        } else CC("error") {
  443+                                contr = 0; if (slow) return IDENT;
  444+                                cpperror(); BEGIN 0;
  445+                                goto zagain;
  446+                        } else CC("define") {
  447+                                contr = 0; BEGIN DEF; define(); BEGIN 0;
  448+                                goto zagain;
  449+                        } else CC("undef") {
  450+                                contr = 0; if (slow) return IDENT; undefstmt();
  451+                                goto zagain;
  452+                        } else CC("line") {
  453+                                contr = 0; storepb(); BEGIN 0; line();
  454+                                goto zagain;
  455+                        } else CC("pragma") {
  456+                                contr = 0; pragmastmt(); BEGIN 0;
  457+                                goto zagain;
  458+                        } else CC("elif") {
  459+                                contr = 0; storepb(); BEGIN IFR;
  460+                                elifstmt(); BEGIN 0;
  461+                                goto zagain;
  462+                        }
  463+                        break;
  464+                case  IFR:
  465+                        CC("defined") {
  466+                                int p, c;
  467+                                gotdef = 1;
  468+                                if ((p = c = yylex()) == '(')
  469+                                        c = yylex();
  470+                                if (c != IDENT || (p != IDENT && p != '('))
  471+                                        error("syntax error");
  472+                                if (p == '(' && yylex() != ')')
  473+                                        error("syntax error");
  474+                                return NUMBER;
  475+                        } else {
  476+                                yylval.node.op = NUMBER;
  477+                                if (gotdef) {
  478+                                        yylval.node.nd_val
  479+                                            = lookup((usch *)yytext, FIND) != 0;
  480+                                        gotdef = 0;
  481+                                        return IDENT;
  482+                                }
  483+                                yylval.node.nd_val = 0;
  484+                                return NUMBER;
  485+                        }
  486+                }
  487+
  488+                /* end special hacks */
  489+
  490+                if (slow)
  491+                        return IDENT;
  492+                if (YYSTATE == CONTR) {
  493+                        if (flslvl == 0) {
  494+                                /*error("undefined control");*/
  495+                                while (input() != '\n')
  496+                                        ;
  497+                                unput('\n');
  498+                                BEGIN 0;
  499+                                goto xx;
  500+                        } else {
  501+                                BEGIN 0; /* do nothing */
  502+                        }
  503+                }
  504+                if (flslvl) {
  505+                        ; /* do nothing */
  506+                } else if (isdigit((int)yytext[0]) == 0 &&
  507+                    (nl = lookup((usch *)yytext, FIND)) != 0) {
  508+                        usch *op = stringbuf;
  509+                        putstr(gotident(nl));
  510+                        stringbuf = op;
  511+                } else
  512+                        putstr((usch *)yytext);
  513+                xx:
  514+                goto again;
  515+        }
  516+
  517+        default:
  518+        any:
  519+                if (state == IFR)
  520+                        goto yyret;
  521+                yytext[yyp] = 0;
  522+                if (contr) {
  523+                        while (input() != '\n')
  524+                                ;
  525+                        unput('\n');
  526+                        BEGIN 0;
  527+                        contr = 0;
  528+                        goto yy;
  529+                }
  530+                if (YYSTATE || slow)
  531+                        return yytext[0];
  532+                if (yytext[0] == 6) { /* PRAGS */
  533+                        usch *obp = stringbuf;
  534+                        extern usch *prtprag(usch *);
  535+                        *stringbuf++ = yytext[0];
  536+                        do {
  537+                                *stringbuf = input();
  538+                        } while (*stringbuf++ != 14);
  539+                        prtprag(obp);
  540+                        stringbuf = obp;
  541+                } else {
  542+                        PRTOUT(yytext[0]);
  543+                }
  544+                yy:
  545+                yyp = 0;
  546+                break;
  547+
  548+        } /* endcase */
  549+        goto again;
  550+
  551+yyret:
  552+        yytext[yyp] = 0;
  553+        return ch;
  554+}
  555+
  556+usch *yyp, yybuf[CPPBUF];
  557+
  558+int yylex(void);
  559+int yywrap(void);
  560+
68561 static int
<>69 -input(void)
  562+inpch(void)
70563 {
<>71 -        struct includ *ic;
72564         int len;
 73565 
 74566         if (ifiles->curptr < ifiles->maxread)
 75567                 return *ifiles->curptr++;
 76568 
<>77 -        if (ifiles->infil < 0) {
 78 -                ic = ifiles;
 79 -                ifiles = ifiles->next;
 80 -                putbuf(ic);
 81 -                return input();
 82 -        }
83569         if ((len = read(ifiles->infil, ifiles->buffer, CPPBUF)) < 0)
<>84 -                error("read error on file %s", ifiles->fname);
  570+                error("read error on file %s", ifiles->orgfn);
85571         if (len == 0)
 86572                 return -1;
 87573         ifiles->curptr = ifiles->buffer;
 88574         ifiles->maxread = ifiles->buffer + len;
<>89 -        return input();
  575+        return inpch();
90576 }
 91577 
<>92 -static void
 93 -unput(int c)
 94 -{
 95 -        struct includ *ic;
 96 -
 97 -        if (ifiles->curptr > ifiles->bbuf) {
 98 -                *--ifiles->curptr = c;
 99 -        } else {
 100 -                ic = getbuf(NULL);
 101 -                ic->fname = ifiles->fname;
 102 -                ic->lineno = ifiles->lineno;
 103 -                ic->infil = -1;
 104 -                ic->curptr = &ic->bbuf[NAMEMAX+CPPBUF+1];
 105 -                ic->maxread = ic->curptr;
 106 -                ic->next = ifiles;
 107 -                ifiles = ic;
 108 -                *--ifiles->curptr = c;
 109 -        }
 110 -}
 111 -
 112 -#define UNPUT(c) *--ifiles->curptr = c
 113 -
114578 static int
<>115 -slofgetc(void)
  579+inch(void)
116580 {
 117581         int c;
 118582 
<>119 -again:  switch (c = input()) {
  583+again:  switch (c = inpch()) {
120584         case '\\': /* continued lines */
<>121 -                if ((c = input()) == '\n') {
  585+msdos:          if ((c = inpch()) == '\n') {
122586                         ifiles->lineno++;
<>123 -                        putc('\n', obuf);
  587+                        putch('\n');
124588                         goto again;
<>125 -                }
 126 -                cunput(c);
  589+                } else if (c == '\r')
  590+                        goto msdos;
  591+                unch(c);
127592                 return '\\';
 128593         case '?': /* trigraphs */
<>129 -                if ((c = input()) != '?') {
 130 -                        cunput(c);
  594+                if ((c = inpch()) != '?') {
  595+                        unch(c);
131596                         return '?';
 132597                 }
<>133 -                switch (c = input()) {
  598+                switch (c = inpch()) {
134599                 case '=': c = '#'; break;
 135600                 case '(': c = '['; break;
 136601                 case ')': c = ']'; break;
 137602                 case '<': c = '{'; break;
 138603                 case '>': c = '}'; break;
 139604                 case '/': c = '\\'; break;
 140605                 case '\'': c = '^'; break;
 141606                 case '!': c = '|'; break;
 142607                 case '-': c = '~'; break;
 143608                 default:
<>144 -                        cunput(c);
 145 -                        cunput('?');
  609+                        unch(c);
  610+                        unch('?');
146611                         return '?';
 147612                 }
<>148 -                cunput(c);
  613+                unch(c);
149614                 goto again;
 150615         default:
 151616                 return c;
 152617         }
 153618 }
 154619 
<>155 -int
 156 -yylex()
  620+/*
  621+ * Let the command-line args be faked defines at beginning of file.
  622+ */
  623+static void
  624+prinit(struct initar *it, struct includ *ic)
157625 {
<>158 -        static int wasnl = 1;
 159 -        int c, oc, rval;
  626+        char *a, *pre, *post;
160627 
<>161 -fast:   yystr = yybuf;
 162 -        yyp = yystr;
 163 -        c = input();
 164 -        if (c != ' ' && c != '\t' && c != '#')
 165 -                wasnl = 0;
 166 -#define ONEMORE()       { *yyp++ = c; c = slofgetc(); }
 167 -again:  switch (c) {
 168 -        case -1:
 169 -                rval = 0;
 170 -                break;
 171 -
 172 -        case '\'': /* charcon */
 173 -        case '"': /* string */
 174 -chstr:          oc = c;
 175 -                if (slow == 0) {
 176 -                        do {
 177 -                                putch(c);
 178 -                                if (c == '\\')
 179 -                                        putch(slofgetc());
 180 -                        } while ((c = slofgetc()) != EOF && c != oc);
 181 -                        if (c == oc)
 182 -                                putch(c);
 183 -                        goto fast;
 184 -                } else {
 185 -                        do {
 186 -                                *yyp++ = c;
 187 -                                if (c == '\\')
 188 -                                        *yyp++ = slofgetc();
 189 -                        } while ((c = slofgetc()) != EOF && c != oc);
 190 -                        *yyp++ = c; *yyp = 0;
 191 -                }
 192 -                rval = oc == '"' ? STRING : CHARCON;
 193 -                break;
 194 -
 195 -        case '0': case '1': case '2': case '3': case '4':
 196 -        case '5': case '6': case '7': case '8': case '9':
 197 -                *yyp++ = c;
 198 -                c = slofgetc();
 199 -                if (yyp[-1] == '0' && (c == 'x' || c == 'X')) {
 200 -                        do {
 201 -                                ONEMORE();
 202 -                        } while (isxdigit(c));
 203 -                } else {
 204 -                        while (isdigit(c))
 205 -                                ONEMORE();
 206 -                }
 207 -                if (c != '.' && c != 'e' && c != 'E') {
 208 -                        /* not floating point number */
 209 -                        while (c == 'l' || c == 'L' || c == 'u' || c == 'U') {
 210 -                                ONEMORE();
 211 -                        }
 212 -                        cunput(c);
 213 -                        *yyp = 0;
 214 -                        rval = NUMBER;
 215 -                        break;
 216 -                }
 217 -                /* it's a floating point number here */
 218 -                if (c == '.') { /* decimal point */
 219 -F:                      do { /* may be followed by digits */
 220 -                                ONEMORE();
 221 -                        } while (isdigit(c));
 222 -                        if (c == 'e' || c == 'E') {
 223 -E:                              ONEMORE();
 224 -                                if (c == '-' || c == '+') {
 225 -                                        ONEMORE();
 226 -                                }
 227 -                                while (isdigit(c))
 228 -                                        ONEMORE();
 229 -                        }
 230 -                        if (c == 'f' || c == 'F' || c == 'l' || c == 'L')
 231 -                                ONEMORE();
 232 -                        cunput(c);
 233 -                        *yyp = 0;
 234 -                        rval = FPOINT;
 235 -                        break;
  628+        if (it->next)
  629+                prinit(it->next, ic);
  630+        pre = post = NULL; /* XXX gcc */
  631+        switch (it->type) {
  632+        case 'D':
  633+                pre = "#define ";
  634+                if ((a = strchr(it->str, '=')) != NULL) {
  635+                        *a = ' ';
  636+                        post = "\n";
236637                 } else
<>237 -                        goto E;
 238 -
 239 -        case '.':
 240 -                ONEMORE();
 241 -                if (isdigit(c))
 242 -                        goto F;
 243 -                if (!slow) {
 244 -                        UNPUT(c);
 245 -                        putch('.');
 246 -                        goto fast;
 247 -                }
 248 -                if (c == '.') {
 249 -                        ONEMORE();
 250 -                        if (c == '.') {
 251 -                                *yyp++ = '.'; *yyp = 0;
 252 -                                rval = ELLIPS;
 253 -                                break;
 254 -                        }
 255 -                        cunput(c);
 256 -                        cunput('.');
 257 -                        *--yyp = 0;
 258 -                        rval = '.';
 259 -                        break;
 260 -                }
 261 -                cunput(c);
 262 -                *yyp = 0;
 263 -                rval = '.';
  638+                        post = " 1\n";
264639                 break;
<>265 -
 266 -        case '\\':
 267 -                c = input();
 268 -                if (c == '\n') {
 269 -                        ifiles->lineno++;
 270 -                        putch('\n');
 271 -                        goto fast;
 272 -                }
 273 -                if (!slow) {
 274 -                        putch('\\');
 275 -                        goto again;
 276 -                }
 277 -                UNPUT(c);
 278 -                *yyp++ = '\\'; *yyp = 0;
 279 -                rval = '\\';
  640+        case 'U':
  641+                pre = "#undef ";
  642+                post = "\n";
280643                 break;
<>281 -                
 282 -        case '\n':
 283 -                wasnl = 1;
 284 -                ifiles->lineno++;
 285 -                rval = NL;
 286 -                if (slow)
 287 -                        break;
 288 -                if (flslvl == 0) {
 289 -                        if (curline() == 1)
 290 -                                prtline();
 291 -                        else
 292 -                                putch('\n');
 293 -                }
 294 -                goto fast;
 295 -
 296 -        case '#':
 297 -                if (wasnl) {
 298 -                        wasnl = 0;
 299 -                        rval = CONTROL;
 300 -                        break;
 301 -                }
 302 -                if (!slow) {
 303 -                        putch('#');
 304 -                        goto fast;
 305 -                }
 306 -                *yyp++ = c;
 307 -                c = input();
 308 -                if (c == '#') {
 309 -                        *yyp++ = c;
 310 -                        *yyp = 0;
 311 -                        rval = CONCAT;
 312 -                } else {
 313 -                        unput(c);
 314 -                        *yyp = 0;
 315 -                        rval = MKSTR;
 316 -                }
  644+        case 'i':
  645+                pre = "#include \"";
  646+                post = "\"\n";
317647                 break;
<>318 -
 319 -        case ' ':
 320 -        case '\t': /* whitespace */
 321 -                do {
 322 -                        *yyp++ = c;
 323 -                        c = input();
 324 -                } while (c == ' ' || c == '\t');
 325 -                if (wasnl && c == '#') {
 326 -                        wasnl = 0;
 327 -                        rval = CONTROL;
 328 -                } else {
 329 -                        unput(c);
 330 -                        *yyp = 0;
 331 -                        rval = WSPACE;
 332 -                }
 333 -                break;
 334 -
 335 -        case '/':
 336 -                if ((c = slofgetc()) == '/') {
 337 -                        if (Cflag)
 338 -                                fprintf(obuf, "//");
 339 -                        while ((c = slofgetc()) && c != '\n')
 340 -                                if (Cflag)
 341 -                                        putc(c, obuf);
 342 -                        goto again;
 343 -                } else if (c == '*') {
 344 -                        if (Cflag)
 345 -                                fprintf(obuf, "/*");
 346 -                        oc = 0;
 347 -                        do {
 348 -                                while ((c = slofgetc()) && c != '*') {
 349 -                                        if (c == '\n') {
 350 -                                                putc(c, obuf);
 351 -                                                ifiles->lineno++;
 352 -                                        } else if (Cflag)
 353 -                                                putc(c, obuf);
 354 -                                }
 355 -                                if (Cflag)
 356 -                                        putc(c, obuf);
 357 -                                if ((c = slofgetc()) == '/')
 358 -                                        break;
 359 -                                unput(c);
 360 -                        } while (c);
 361 -                        if (Cflag)
 362 -                                putc(c, obuf);
 363 -                        if (tflag) {
 364 -                                rval = yylex();
 365 -                        } else {
 366 -                                *yyp++ = ' '; *yyp = 0;
 367 -                                rval = WSPACE;
 368 -                        }
 369 -                } else {
 370 -                        unput(c);
 371 -                        *yyp++ = '/'; *yyp = 0;
 372 -                        rval = '/';
 373 -                }
 374 -                break;
 375 -
 376 -        case 'L': /* may be STRING, CHARCON or identifier */
 377 -                *yyp++ = c;
 378 -                if ((c = slofgetc()) == '"' || c == '\'')
 379 -                        goto chstr;
 380 -gotid:          while (isalnum(c) || c == '_') {
 381 -                        *yyp++ = c;
 382 -                        c = slofgetc();
 383 -                }
 384 -                *yyp = 0;
 385 -                unput(c);
 386 -                rval = IDENT;
 387 -                break;
 388 -
389648         default:
<>390 -                if (isalpha(c) || c == '_')
 391 -                        goto gotid;
 392 -                if (!slow && c > 5) {
 393 -                        putch(c);
 394 -                        goto fast;
 395 -                }
 396 -                yystr[0] = c; yystr[1] = 0;
 397 -                rval = c;
 398 -                break;
  649+                error("prinit");
399650         }
<>400 -        return rval;
  651+        strlcat((char *)ic->buffer, pre, CPPBUF+1);
  652+        strlcat((char *)ic->buffer, it->str, CPPBUF+1);
  653+        if (strlcat((char *)ic->buffer, post, CPPBUF+1) >= CPPBUF+1)
  654+                error("line exceeds buffer size");
  655+
  656+        ic->lineno--;
  657+        while (*ic->maxread)
  658+                ic->maxread++;
401659 }
 402660 
 403661 /*
 404662  * A new file included.
 405663  * If ifiles == NULL, this is the first file and already opened (stdin).
<>406 - * Return 0 on success, -1 on failure to open file.
  664+ * Return 0 on success, -1 if file to be included is not found.
407665  */
 408666 int
<>409 -pushfile(char *file)
  667+pushfile(usch *file)
410668 {
<> 669+        extern struct initar *initar;
411670         struct includ ibuf;
<>412 -        struct includ *old;
413671         struct includ *ic;
<> 672+        int c, otrulvl;
414673 
 415674         ic = &ibuf;
<>416 -        old = ifiles;
  675+        ic->next = ifiles;
417676 
 418677         slow = 0;
 419678         if (file != NULL) {
<>420 -                if ((ic->infil = open(file, O_RDONLY)) < 0)
  679+                if ((ic->infil = open((char *)file, O_RDONLY)) < 0)
421680                         return -1;
<>422 -                ic->fname = file;
  681+                ic->orgfn = ic->fname = file;
  682+                if (++inclevel > MAX_INCLEVEL)
  683+                        error("Limit for nested includes exceeded");
423684         } else {
 424685                 ic->infil = 0;
<>425 -                ic->fname = "<stdin>";
  686+                ic->orgfn = ic->fname = (usch *)"<stdin>";
426687         }
 427688         ic->buffer = ic->bbuf+NAMEMAX;
 428689         ic->curptr = ic->buffer;
 429690         ifiles = ic;
<>430 -        ic->lineno = 0;
  691+        ic->lineno = 1;
431692         ic->maxread = ic->curptr;
<>432 -        unput('\n');
  693+        prtline();
  694+        if (initar) {
  695+                *ic->maxread = 0;
  696+                prinit(initar, ic);
  697+                if (dMflag)
  698+                        write(ofd, ic->buffer, strlen((char *)ic->buffer));
  699+                initar = NULL;
  700+        }
433701 
<>434 -        mainscan();
  702+        otrulvl = trulvl;
435703 
<>436 -        if (trulvl || flslvl)
  704+        if ((c = yylex()) != 0)
  705+                error("yylex returned %d", c);
  706+
  707+        if (otrulvl != trulvl || flslvl)
437708                 error("unterminated conditional");
 438709 
<>439 -        ifiles = old;
  710+        ifiles = ic->next;
440711         close(ic->infil);
<> 712+        inclevel--;
441713         return 0;
 442714 }
 443715 
 444716 /*
 445717  * Print current position to output file.
 446718  */
 447719 void
 448720 prtline()
 449721 {
<>450 -        fprintf(obuf, "# %d \"%s\"\n", ifiles->lineno, ifiles->fname);
  722+        usch *s, *os = stringbuf;
  723+
  724+        if (Mflag) {
  725+                if (dMflag)
  726+                        return; /* no output */
  727+                if (ifiles->lineno == 1) {
  728+                        s = sheap("%s: %s\n", Mfile, ifiles->fname);
  729+                        write(ofd, s, strlen((char *)s));
  730+                }
  731+        } else if (!Pflag)
  732+                putstr(sheap("# %d \"%s\"\n", ifiles->lineno, ifiles->fname));
  733+        stringbuf = os;
451734 }
 452735 
 453736 void
 454737 cunput(int c)
 455738 {
<>456 -extern int dflag;
 457 -if (dflag)printf(": '%c'(%d)", c, c);
  739+#ifdef CPP_DEBUG
  740+        extern int dflag;
  741+        if (dflag)printf(": '%c'(%d)", c > 31 ? c : ' ', c);
  742+#endif
458743         unput(c);
 459744 }
 460745 
<>461 -void
 462 -setline(int line)
  746+int yywrap(void) { return 1; }
  747+
  748+static int
  749+dig2num(int c)
463750 {
<>464 -        if (ifiles)
 465 -                ifiles->lineno = line-1;
  751+        if (c >= 'a')
  752+                c = c - 'a' + 10;
  753+        else if (c >= 'A')
  754+                c = c - 'A' + 10;
  755+        else
  756+                c = c - '0';
  757+        return c;
466758 }
 467759 
<>468 -void
 469 -setfile(char *name)
  760+/*
  761+ * Convert string numbers to unsigned long long and check overflow.
  762+ */
  763+static void
  764+cvtdig(int rad)
470765 {
<>471 -        if (ifiles)
 472 -                ifiles->fname = strdup(name);
  766+        unsigned long long rv = 0;
  767+        unsigned long long rv2 = 0;
  768+        char *y = yytext;
  769+        int c;
  770+
  771+        c = *y++;
  772+        if (rad == 16)
  773+                y++;
  774+        while (isxdigit(c)) {
  775+                rv = rv * rad + dig2num(c);
  776+                /* check overflow */
  777+                if (rv / rad < rv2)
  778+                        error("Constant \"%s\" is out of range", yytext);
  779+                rv2 = rv;
  780+                c = *y++;
  781+        }
  782+        y--;
  783+        while (*y == 'l' || *y == 'L')
  784+                y++;
  785+        yylval.node.op = *y == 'u' || *y == 'U' ? UNUMBER : NUMBER;
  786+        yylval.node.nd_uval = rv;
  787+        if ((rad == 8 || rad == 16) && yylval.node.nd_val < 0)
  788+                yylval.node.op = UNUMBER;
  789+        if (yylval.node.op == NUMBER && yylval.node.nd_val < 0)
  790+                /* too large for signed */
  791+                error("Constant \"%s\" is out of range", yytext);
473792 }
 474793 
<>475 -int
 476 -curline()
  794+static int
  795+charcon(usch *p)
477796 {
<>478 -        return ifiles ? ifiles->lineno : 0;
  797+        int val, c;
  798+
  799+        p++; /* skip first ' */
  800+        val = 0;
  801+        if (*p++ == '\\') {
  802+                switch (*p++) {
  803+                case 'a': val = '\a'; break;
  804+                case 'b': val = '\b'; break;
  805+                case 'f': val = '\f'; break;
  806+                case 'n': val = '\n'; break;
  807+                case 'r': val = '\r'; break;
  808+                case 't': val = '\t'; break;
  809+                case 'v': val = '\v'; break;
  810+                case '\"': val = '\"'; break;
  811+                case '\'': val = '\''; break;
  812+                case '\\': val = '\\'; break;
  813+                case 'x':
  814+                        while (isxdigit(c = *p)) {
  815+                                val = val * 16 + dig2num(c);
  816+                                p++;
  817+                        }
  818+                        break;
  819+                case '0': case '1': case '2': case '3': case '4':
  820+                case '5': case '6': case '7':
  821+                        p--;
  822+                        while (isdigit(c = *p)) {
  823+                                val = val * 8 + (c - '0');
  824+                                p++;
  825+                        }
  826+                        break;
  827+                default: val = p[-1];
  828+                }
  829+
  830+        } else
  831+                val = p[-1];
  832+        return val;
479833 }
 480834 
<>481 -char *
 482 -curfile()
  835+static void
  836+chknl(int ignore)
483837 {
<>484 -        return ifiles ? ifiles->fname : "";
  838+        int t;
  839+
  840+        slow = 1;
  841+        while ((t = yylex()) == WSPACE)
  842+                ;
  843+        if (t != '\n') {
  844+                if (ignore) {
  845+                        warning("newline expected, got \"%s\"", yytext);
  846+                        /* ignore rest of line */
  847+                        while ((t = yylex()) && t != '\n')
  848+                                ;
  849+                }
  850+                else
  851+                        error("newline expected, got \"%s\"", yytext);
  852+        }
  853+        slow = 0;
485854 }
<_ 855+
  856+static void
  857+elsestmt(void)
  858+{
  859+        if (flslvl) {
  860+                if (elflvl > trulvl)
  861+                        ;
  862+                else if (--flslvl!=0) {
  863+                        flslvl++;
  864+                } else {
  865+                        trulvl++;
  866+                        prtline();
  867+                }
  868+        } else if (trulvl) {
  869+                flslvl++;
  870+                trulvl--;
  871+        } else
  872+                error("If-less else");
  873+        if (elslvl==trulvl+flslvl)
  874+                error("Too many else");
  875+        elslvl=trulvl+flslvl;
  876+        chknl(1);
  877+}
  878+
  879+static void
  880+ifdefstmt(void)         
  881+{
  882+        int t;
  883+
  884+        if (flslvl) {
  885+                /* just ignore the rest of the line */
  886+                while (input() != '\n')
  887+                        ;
  888+                unput('\n');
  889+                yylex();
  890+                flslvl++;
  891+                return;
  892+        }
  893+        slow = 1;
  894+        do
  895+                t = yylex();
  896+        while (t == WSPACE);
  897+        if (t != IDENT)
  898+                error("bad ifdef");
  899+        slow = 0;
  900+        if (flslvl == 0 && lookup((usch *)yytext, FIND) != 0)
  901+                trulvl++;
  902+        else
  903+                flslvl++;
  904+        chknl(0);
  905+}
  906+
  907+static void
  908+ifndefstmt(void)         
  909+{
  910+        int t;
  911+
  912+        slow = 1;
  913+        do
  914+                t = yylex();
  915+        while (t == WSPACE);
  916+        if (t != IDENT)
  917+                error("bad ifndef");
  918+        slow = 0;
  919+        if (flslvl == 0 && lookup((usch *)yytext, FIND) == 0)
  920+                trulvl++;
  921+        else
  922+                flslvl++;
  923+        chknl(0);
  924+}
  925+
  926+static void
  927+endifstmt(void)         
  928+{
  929+        if (flslvl) {
  930+                flslvl--;
  931+                if (flslvl == 0)
  932+                        prtline();
  933+        } else if (trulvl)
  934+                trulvl--;
  935+        else
  936+                error("If-less endif");
  937+        if (flslvl == 0)
  938+                elflvl = 0;
  939+        elslvl = 0;
  940+        chknl(1);
  941+}
  942+
  943+/*
  944+ * Note! Ugly!
  945+ * Walk over the string s and search for defined, and replace it with
  946+ * spaces and a 1 or 0.
  947+ */
  948+static void
  949+fixdefined(usch *s)
  950+{
  951+        usch *bc, oc;
  952+
  953+        for (; *s; s++) {
  954+                if (*s != 'd')
  955+                        continue;
  956+                if (memcmp(s, "defined", 7))
  957+                        continue;
  958+                /* Ok, got defined, can scratch it now */
  959+                memset(s, ' ', 7);
  960+                s += 7;
  961+#define WSARG(x) (x == ' ' || x == '\t')
  962+                if (*s != '(' && !WSARG(*s))
  963+                        continue;
  964+                while (WSARG(*s))
  965+                        s++;
  966+                if (*s == '(')
  967+                        s++;
  968+                while (WSARG(*s))
  969+                        s++;
  970+#define IDARG(x) ((x>= 'A' && x <= 'Z') || (x >= 'a' && x <= 'z') || (x == '_'))
  971+#define NUMARG(x) (x >= '0' && x <= '9')
  972+                if (!IDARG(*s))
  973+                        error("bad defined arg");
  974+                bc = s;
  975+                while (IDARG(*s) || NUMARG(*s))
  976+                        s++;
  977+                oc = *s;
  978+                *s = 0;
  979+                *bc = (lookup(bc, FIND) != 0) + '0';
  980+                memset(bc+1, ' ', s-bc-1);
  981+                *s = oc;
  982+        }
  983+}
  984+
  985+/*
  986+ * get the full line of identifiers after an #if, pushback a WARN and
  987+ * the line and prepare for expmac() to expand.
  988+ * This is done before switching state.  When expmac is finished,
  989+ * pushback the expanded line, change state and call yyparse.
  990+ */
  991+static void
  992+storepb(void)
  993+{
  994+        usch *opb = stringbuf;
  995+        int c;
  996+
  997+        while ((c = input()) != '\n') {
  998+                if (c == '/') {
  999+                         if ((c = input()) == '*') {
  1000+                                /* ignore comments here whatsoever */
  1001+                                usch *g = stringbuf;
  1002+                                getcmnt();
  1003+                                stringbuf = g;
  1004+                                continue;
  1005+                        } else if (c == '/') {
  1006+                                while ((c = input()) && c != '\n')
  1007+                                        ;
  1008+                                break;
  1009+                        }
  1010+                        unput(c);
  1011+                        c = '/';
  1012+                }
  1013+                savch(c);
  1014+        }
  1015+        cunput('\n');
  1016+        savch(0);
  1017+        fixdefined(opb); /* XXX can fail if #line? */
  1018+        cunput(1); /* WARN XXX */
  1019+        unpstr(opb);
  1020+        stringbuf = opb;
  1021+        slow = 1;
  1022+        expmac(NULL);
  1023+        slow = 0;
  1024+        /* line now expanded */
  1025+        while (stringbuf > opb)
  1026+                cunput(*--stringbuf);
  1027+}
  1028+
  1029+static void
  1030+ifstmt(void)
  1031+{
  1032+        if (flslvl == 0) {
  1033+                slow = 1;
  1034+                if (yyparse())
  1035+                        ++trulvl;
  1036+                else
  1037+                        ++flslvl;
  1038+                slow = 0;
  1039+        } else
  1040+                ++flslvl;
  1041+}
  1042+
  1043+static void
  1044+elifstmt(void)
  1045+{
  1046+        if (flslvl == 0)
  1047+                elflvl = trulvl;
  1048+        if (flslvl) {
  1049+                if (elflvl > trulvl)
  1050+                        ;
  1051+                else if (--flslvl!=0)
  1052+                        ++flslvl;
  1053+                else {
  1054+                        slow = 1;
  1055+                        if (yyparse()) {
  1056+                                ++trulvl;
  1057+                                prtline();
  1058+                        } else
  1059+                                ++flslvl;
  1060+                        slow = 0;
  1061+                }
  1062+        } else if (trulvl) {
  1063+                ++flslvl;
  1064+                --trulvl;
  1065+        } else
  1066+                error("If-less elif");
  1067+}
  1068+
  1069+static usch *
  1070+svinp(void)
  1071+{
  1072+        int c;
  1073+        usch *cp = stringbuf;
  1074+
  1075+        while ((c = input()) && c != '\n')
  1076+                savch(c);
  1077+        savch('\n');
  1078+        savch(0);
  1079+        BEGIN 0;
  1080+        return cp;
  1081+}
  1082+
  1083+static void
  1084+cpperror(void)
  1085+{
  1086+        usch *cp;
  1087+        int c;
  1088+
  1089+        if (flslvl)
  1090+                return;
  1091+        c = yylex();
  1092+        if (c != WSPACE && c != '\n')
  1093+                error("bad error");
  1094+        cp = svinp();
  1095+        if (flslvl)
  1096+                stringbuf = cp;
  1097+        else
  1098+                error("%s", cp);
  1099+}
  1100+
  1101+static void
  1102+undefstmt(void)
  1103+{
  1104+        struct symtab *np;
  1105+
  1106+        slow = 1;
  1107+        if (yylex() != WSPACE || yylex() != IDENT)
  1108+                error("bad undef");
  1109+        if (flslvl == 0 && (np = lookup((usch *)yytext, FIND)))
  1110+                np->value = 0;
  1111+        slow = 0;
  1112+        chknl(0);
  1113+}
  1114+
  1115+static void
  1116+pragmastmt(void)
  1117+{
  1118+        int c;
  1119+
  1120+        slow = 1;
  1121+        if (yylex() != WSPACE)
  1122+                error("bad pragma");
  1123+        if (!flslvl)
  1124+                putstr((usch *)"#pragma ");
  1125+        do {
  1126+                c = input();
  1127+                if (!flslvl)
  1128+                        putch(c);       /* Do arg expansion instead? */
  1129+        } while (c && c != '\n');
  1130+        ifiles->lineno++;
  1131+        prtline();
  1132+        slow = 0;
  1133+}
  1134+
  1135+static void
  1136+badop(const char *op)
  1137+{
  1138+        error("invalid operator in preprocessor expression: %s", op);
  1139+}
  1140+
  1141+int
  1142+cinput()
  1143+{
  1144+        return input();
  1145+}
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-10-31 08:01 +0100