Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.42
 
1.43
 
MAIN:ragge:20110109152539
 
token.c
_>8181 static int inch(void);
 8282 
 8383 int inif;
<> 84+extern int dflag;
8485 
 8586 #define PUTCH(ch) if (!flslvl) putch(ch)
 8687 /* protection against recursion in #include */
     
 !
9798 char yytext[CPPBUF];
 9899 #endif
 99100 
<>100 -#define C_SPEC  1
 101 -#define C_EP    2
 102 -#define C_ID    4
 103 -#define C_I     (C_SPEC|C_ID)
 104 -#define C_2     8               /* for yylex() tokenizing */
 105 -static char spechr[256] = {
  101+char spechr[256] = {
  102+        0,      0,      0,      0,      C_SPEC, C_SPEC, 0,      0,
  103+        0,      C_WSNL, C_SPEC|C_WSNL,  0,
  104+        0,      C_WSNL, 0,      0,
106105         0,      0,      0,      0,      0,      0,      0,      0,
<>107 -        0,      0,      C_SPEC0,      0,      0,      0,      0,
108106         0,      0,      0,      0,      0,      0,      0,      0,
<>109 -        0,      0,      0,      0,      0,      0,      0,      0,
110107 
<>111 -        0,      C_2,    C_SPEC0,      0,      0,      C_2,    C_SPEC,
  108+        C_WSNLC_2,    C_SPEC0,      0,      0,      C_2,    C_SPEC,
112109         0,      0,      0,      C_2,    0,      C_2,    0,      C_SPEC|C_2,
 113110         C_I,    C_I,    C_I,    C_I,    C_I,    C_I,    C_I,    C_I,
 114111         C_I,    C_I,    0,      0,      C_2,    C_2,    C_2,    C_SPEC,
     
 !
125122 
 126123 };
 127124 
<> 125+/*
  126+ * No-replacement array.  If a macro is found and exists in this array
  127+ * then no replacement shall occur.  This is a stack.
  128+ */
  129+struct symtab *norep[RECMAX];   /* Symbol table index table */
  130+int norepptr = 1;                       /* Top of index table */
  131+unsigned char bptr[RECMAX];     /* currently active noexpand macro stack */
  132+int bidx;                       /* Top of bptr stack */
  133+
128134 static void
 129135 unch(int c)
 130136 {
     
 !
149155 fastscan(void)
 150156 {
 151157         struct symtab *nl;
<>152 -        int ch, i;
  158+        int ch, i, ccnt, onemore;
153159 
 154160         goto run;
 155161         for (;;) {
 156162                 ch = NXTCH();
 157163 xloop:          if (ch == -1)
 158164                         return;
<> 165+                if (dflag>1)
  166+                        printf("fastscan ch %d (%c)\n", ch, ch > 31 ? ch : '@');
159167                 if ((spechr[ch] & C_SPEC) == 0) {
 160168                         PUTCH(ch);
 161169                         continue;
 162170                 }
 163171                 switch (ch) {
<> 172+                case EXP:
  173+                case NEX:
  174+                case WARN:
  175+                case CONC:
  176+                        error("bad char passed");
  177+                        break;
  178+
164179                 case '/': /* Comments */
 165180                         if ((ch = inch()) == '/') {
 166181                                 if (Cflag) { PUTCH(ch); } else { PUTCH(' '); }
     
 !
239254                 case '\"': /* strings */
 240255 str:                    PUTCH(ch);
 241256                         while ((ch = inch()) != '\"') {
<>242 -                                PUTCH(ch);
  257+                                if (ch == EXP)
  258+                                        doexp();
  259+                                else if (ch == NEX)
  260+                                        donex();
  261+                                else if (ch != CONC) /* XXX ??? */
  262+                                        PUTCH(ch);
243263                                 if (ch == '\\') {
 244264                                         ch = inch();
 245265                                         PUTCH(ch);
     
 !
308328                                         ch = NXTCH();
 309329                                 goto xloop;
 310330                         }
<>311 -                        i = 0;
  331+                        onemore = i = ccnt = 0;
312332                         do {
 313333                                 yytext[i++] = (usch)ch;
 314334                                 ch = NXTCH();
     
 !
325345                                 if (ch < 0)
 326346                                         return;
 327347                         } while (spechr[ch] & C_ID);
<> 348+
328349                         yytext[i] = 0;
 329350                         unch(ch);
<>330 -                        if ((nl = lookup((usch *)yytext, FIND)) != 0) {
 331 -                                usch *op = stringbuf;
 332 -                                putstr(gotident(nl));
 333 -                                stringbuf = op;
  351+
  352+                        if ((nl = lookup((usch *)yytext, FIND)) && kfind(nl)) {
  353+                                putstr(stringbuf);
334354                         } else
 335355                                 putstr((usch *)yytext);
<> 356+
336357                         break;
 337358                 }
 338359         }
     
 !
605626                         yylval.node.nd_val = nl != NULL;
 606627                         ifdef = 0;
 607628                 } else if (nl && noex == 0) {
<>608 -                        usch *c, *och = stringbuf;
  629+                        usch *och = stringbuf;
  630+                        int i;
609631 
<>610 -                        c = gotident(nl);
 611 -                        unch(1);
 612 -                        unpstr(c);
  632+                        i = kfind(nl);
  633+                        unch(WARN);
  634+                        if (i)
  635+                                unpstr(stringbuf);
  636+                        else
  637+                                unpstr(nl->namep);
613638                         stringbuf = och;
 614639                         noex = 1;
 615640                         return yylex();
     
 !
618643                 }
 619644                 yylval.node.op = NUMBER;
 620645                 return NUMBER;
<>621 -        case 1: /* WARN */
  646+        case WARN:
622647                 noex = 0;
 623648                 return yylex();
 624649         default:
     
 !
803828 cunput(int c)
 804829 {
 805830 #ifdef CPP_DEBUG
<>806 -        extern int dflag;
 807 -        if (dflag)printf(": '%c'(%d)", c > 31 ? c : ' ', c);
  831+//      extern int dflag;
  832+//      if (dflag)printf(": '%c'(%d)\n", c > 31 ? c : ' ', c);
<_808833 #endif
 809834 #if 0
 810835 if (c == 10) {
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-22 10:56 +0100