Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.101
 
1.102
 
MAIN:plunky:20121107095159
 
token.c
     
 !
_>64 -static void pragmastmt(void);
 65 -static void undefstmt(void);
     
 !
<> 65+static void undefstmt(void);
  66+static void pragmastmt(void);
     
 !
<>68 -static int chktg(void);
 69 -static int inpch(void);
 70 -static int inch(void);
     
 !
<>77 -/* get next character unaltered */
 78 -#define NXTCH() (ifiles->curptr < ifiles->maxread ? *ifiles->curptr++ : inpch())
 79 -
     
 !
<>101 -        C_DX,   C_DX,   0,      0,      C_2,    C_2,    C_2,    C_SPEC,
  95+        C_DX,   C_DX,   0,      0,      C_2,    C_2,    C_2,    0,
     
 !
<>106 -        C_I,    C_I,    C_I,    0,      C_SPEC0,      0,      C_I,
  100+        C_I,    C_I,    C_I,    0,      0,      0,      0,      C_I,
     
 !
<> 108+/*
  109+ * fill up the input buffer
  110+ */
  111+static int
  112+inpbuf(void)
  113+{
  114+        int len;
  115+
  116+        if (ifiles->infil == -1)
  117+                return 0;
  118+        len = read(ifiles->infil, ifiles->buffer, CPPBUF);
  119+        if (len == -1)
  120+                error("read error on file %s", ifiles->orgfn);
  121+        if (len > 0) {
  122+                ifiles->buffer[len] = 0;
  123+                ifiles->curptr = ifiles->buffer;
  124+                ifiles->maxread = ifiles->buffer + len;
  125+        }
  126+        return len;
  127+}
  128+
  129+/*
  130+ * return a raw character from the input stream
  131+ */
  132+static inline int
  133+inpch(void)
  134+{
  135+
  136+        do {
  137+                if (ifiles->curptr < ifiles->maxread)
  138+                        return *ifiles->curptr++;
  139+        } while (inpbuf() > 0);
  140+
  141+        return -1;
  142+}
  143+
  144+/*
  145+ * push a character back to the input stream
  146+ */
     
 !
<>120 -        --ifiles->curptr;
  153+        ifiles->curptr--;
     
 !
<> 159+/*
  160+ * Check for (and convert) trigraphs.
  161+ */
  162+static int
  163+chktg(void)
  164+{
  165+        int ch;
  166+
  167+        if ((ch = inpch()) != '?') {
  168+                unch(ch);
  169+                return 0;
  170+        }
  171+
  172+        switch (ch = inpch()) {
  173+        case '='return '#';
  174+        case '('return '[';
  175+        case ')'return ']';
  176+        case '<'return '{';
  177+        case '>'return '}';
  178+        case '/'return '\\';
  179+        case '\'': return '^';
  180+        case '!'return '|';
  181+        case '-'return '~';
  182+        }
  183+
  184+        unch(ch);
  185+        unch('?');
  186+        return 0;
  187+}
  188+
  189+/*
  190+ * check for (and eat) end-of-line
  191+ */
  192+static int
  193+chkeol(void)
  194+{
  195+        int ch;
  196+
  197+        ch = inpch();
  198+        if (ch == '\r') {
  199+                ch = inpch();
  200+                if (ch == '\n')
  201+                        return '\n';
  202+
  203+                unch(ch);
  204+                unch('\r');
  205+                return 0;
  206+        }
  207+        if (ch == '\n')
  208+                return '\n';
  209+
  210+        unch(ch);
  211+        return 0;
  212+}
  213+
  214+/*
  215+ * return next char, after converting trigraphs and
  216+ * skipping escaped line endings
  217+ */
  218+static inline int
  219+inch(void)
  220+{
  221+        int ch;
  222+
  223+        for (;;) {
  224+                ch = inpch();
  225+                if (ch == '?' && (ch = chktg()) == 0)
  226+                        return '?';
  227+                if (ch != '\\' || chkeol() == 0)
  228+                        return ch;
  229+                ifiles->escln++;
  230+        }
  231+}
  232+
     
 !
<>136 -                        if (!Cflag) PUTCH('\n');
  243+                        putch('\n');
  244+                        continue;
     
 !
<>171 -        int ch, i = 0;
 172 -        int nnl = 0;
  279+        int ch, i;
     
 !
<>177 -                ch = NXTCH();
  284+                ch = inch();
     
 !
<>205 -                                continue;
     
 !
<>212 -                case '?'/* trigraphs */
 213 -                        if ((ch = chktg()))
 214 -                                goto xloop;
 215 -                        PUTCH('?');
 216 -                        break;
 217 -
 218 -                case '\\':
 219 -                        if ((ch = NXTCH()) == '\n') {
 220 -                                ifiles->lineno++;
 221 -                                continue;
 222 -                        }
 223 -                        PUTCH('\\');
 224 -                        goto xloop;
 225 -
     
 !
<>227 -                        while (nnl > 0) { PUTCH('\n'); nnl--; ifiles->lineno++; }
 228 -run2:                   ifiles->lineno++;
 229 -                        do {
 230 -                                PUTCH(ch);
 231 -run:                            ch = NXTCH();
  319+                        i = ifiles->escln + 1;
  320+                        ifiles->lineno += i;
  321+                        ifiles->escln = 0;
  322+                        while (i-- > 0)
  323+                                putch('\n');
  324+run:                    for(;;) {
  325+                                ch = inch();
     
 !
<>233 -                                        ch = NXTCH();
  327+                                        ch = inch();
     
 !
<>238 -                                                goto run;
  332+                                                continue;
     
 !
<>243 -                        } while (ch == ' ' || ch == '\t');
 244 -                        if (ch == '\\') {
 245 -                                ch = NXTCH();
 246 -                                if (ch == '\n')
 247 -                                        goto run2;
 248 -                                unch(ch);
 249 -                                ch = '\\';
  337+                                if (ch != ' ' && ch != '\t')
  338+                                        break;
  339+                                PUTCH(ch);
     
 !
<>255 -                                ch = NXTCH();
  345+                                ch = inch();
     
 !
<>262 -                        } else if (ch == '?') {
 263 -                                if ((ch = chktg()) == '#') {
 264 -                                        ppdir();
 265 -                                        continue;
 266 -                                } else if (ch == 0)
 267 -                                        ch = '?';
     
 !
<>273 -                        while ((ch = NXTCH()) != '\"') {
  357+                        while ((ch = inch()) != '\"') {
  358+                                if (ch == '\\') {
  359+                                        PUTCH('\\');
  360+                                        ch = inch();
  361+                                }
     
 !
<>276 -                                if (ch == '\\') {
 277 -                                        if ((ch = NXTCH()) != '\n') {
 278 -                                                PUTCH('\\');
 279 -                                                PUTCH(ch);
 280 -                                        } else
 281 -                                                nnl++;
 282 -                                        continue;
 283 -                                }
     
 !
<>293 -                        ch = NXTCH();
  373+                        ch = inch();
     
 !
<> 376+
     
 !
<>301 -nxt:                            ch = NXTCH();
 302 -                                if (ch == '\\') {
 303 -                                        ch = NXTCH();
 304 -                                        if (ch == '\n') {
 305 -                                                nnl++;
 306 -                                                goto nxt;
 307 -                                        }
 308 -                                        unch(ch);
 309 -                                        ch = '\\';
 310 -                                }
  382+                                ch = inch();
     
 !
<>315 -                                        ch = NXTCH();
  387+                                        ch = inch();
     
 !
<>327 -                                continue; /* character constants ignored */
 328 -                        while ((ch = NXTCH()) != '\'') {
 329 -                                if (ch == '\n')
 330 -                                        goto xloop;
  399+                                break; /* character constants ignored */
  400+                        while ((ch = inch()) != '\'') {
     
 !
<>332 -                                        if ((ch = NXTCH()) != '\n') {
 333 -                                                PUTCH('\\');
 334 -                                                PUTCH(ch);
 335 -                                        } else
 336 -                                                nnl++;
 337 -                                        continue;
  402+                                        PUTCH('\\');
  403+                                        ch = inch();
     
 !
<> 405+                                if (ch == '\n')
  406+                                        goto xloop;
     
 !
<>347 -                        ch = NXTCH();
  415+                        ch = inch();
     
 !
<> 426+
     
 !
<> 429+#ifdef PCC_DEBUG
     
 !
<>362 -                        if (flslvl) {
 363 -                                while (ch != -1 && (spechr[ch] & C_ID))
 364 -                                        ch = NXTCH();
 365 -                                goto xloop;
 366 -                        }
  432+#endif
     
 !
<>370 -                                ch = NXTCH();
 371 -                                if (ch == '\\') {
 372 -                                        ch = NXTCH();
 373 -                                        if (ch != '\n') {
 374 -                                                unch(ch);
 375 -                                                ch = '\\';
 376 -                                        } else {
 377 -                                                putch('\n');
 378 -                                                ifiles->lineno++;
 379 -                                                ch = NXTCH();
 380 -                                        }
 381 -                                }
 382 -                                if (ch == -1)
 383 -                                        return;
 384 -                        } while (spechr[ch] & C_ID);
  436+                                ch = inch();
  437+                        } while (ch != -1 && (spechr[ch] & C_ID));
     
 !
<> 439+                        if (flslvl)
  440+                                goto xloop;
  441+
     
 !
<>617 -                c2 = inpch();
  673+                c2 = inch();
     
 !
<>653 -                        ch = inpch();
  709+                        ch = inch();
     
 !
<>656 -                        if ((ch = inpch()) == '/')
  712+                        if ((ch = inch()) == '/')
     
 !
<>710 -static int
 711 -inpch(void)
 712 -{
 713 -        int len;
 714 -
 715 -        if (ifiles->curptr < ifiles->maxread)
 716 -                return *ifiles->curptr++;
 717 -
 718 -        if (ifiles->infil == -1)
 719 -                return -1;
 720 -        if ((len = read(ifiles->infil, ifiles->buffer, CPPBUF)) < 0)
 721 -                error("read error on file %s", ifiles->orgfn);
 722 -        if (len == 0)
 723 -                return -1;
 724 -        ifiles->buffer[len] = 0;
 725 -        ifiles->curptr = ifiles->buffer;
 726 -        ifiles->maxread = ifiles->buffer + len;
 727 -        return inpch();
 728 -}
 729 -
 730 -static int
 731 -inch(void)
 732 -{
 733 -        int c;
 734 -
 735 -again:  switch (c = inpch()) {
 736 -        case '\\': /* continued lines */
 737 -msdos:          if ((c = inpch()) == '\n') {
 738 -                        ifiles->lineno++;
 739 -                        putch('\n');
 740 -                        goto again;
 741 -                } else if (c == '\r')
 742 -                        goto msdos;
 743 -                unch(c);
 744 -                return '\\';
 745 -        case '?': /* trigraphs */
 746 -                if ((c = chktg())) {
 747 -                        unch(c);
 748 -                        goto again;
 749 -                }
 750 -                return '?';
 751 -        default:
 752 -                return c;
 753 -        }
 754 -}
 755 -
     
 !
<>819 -                        error("Limit for nested includes exceeded");
  829+                        error("limit for nested includes exceeded");
     
 !
<> 841+        ic->escln = 0;
     
 !
<>932 -                        error("Constant \"%s\" is out of range", yytext);
  943+                        error("constant \"%s\" is out of range", yytext);
     
 !
<>945 -                error("Constant \"%s\" is out of range", yytext);
  956+                error("constant \"%s\" is out of range", yytext);
     
 !
<>1021 -                else if (--flslvl!=0) {
  1032+                else if (--flslvl!=0)
     
 !
<>1023 -                } else {
  1034+                else
     
 !
<>1025 -                        prtline();
 1026 -                }
     
 !
<>1031 -                error("If-less else");
  1040+                error("#else in non-conditional section");
     
 !
<>1033 -                error("Too many else");
  1042+                error("too many #else");
     
 !
<>1067 -        if (lookup(yytext, FIND) == NULL) {
 1068 -                putch('\n');
  1076+        if (lookup(yytext, FIND) == NULL)
     
 !
<>1070 -        } else
  1078+        else
     
 !
<>1090 -        if (lookup(yytext, FIND) != NULL) {
 1091 -                putch('\n');
  1098+        if (lookup(yytext, FIND) != NULL)
     
 !
<>1093 -        } else
  1100+        else
     
 !
<>1101 -        if (flslvl) {
  1108+        if (flslvl)
     
 !
<>1103 -                if (flslvl == 0) {
 1104 -                        putch('\n');
 1105 -                        prtline();
 1106 -                }
 1107 -        } else if (trulvl)
  1110+        else if (trulvl)
     
 !
<>1110 -                error("If-less endif");
  1113+                error("#endif in non-conditional section");
     
 !
<>1120 -        if (flslvl == 0) {
 1121 -                if (yyparse() == 0) {
 1122 -                        putch('\n');
 1123 -                        ++flslvl;
 1124 -                } else
 1125 -                        ++trulvl;
 1126 -        } else
 1127 -                ++flslvl;
  1123+        if (flslvl || yyparse() == 0)
  1124+                flslvl++;
  1125+        else
  1126+                trulvl++;
     
 !
<>1139 -                        ++flslvl;
 1140 -                else {
 1141 -                        if (yyparse()) {
 1142 -                                ++trulvl;
 1143 -                                prtline();
 1144 -                        } else {
 1145 -                                putch('\n');
 1146 -                                ++flslvl;
 1147 -                        }
  1138+                        flslvl++;
  1139+                else if (yyparse())
  1140+                        trulvl++;
  1141+                else
  1142+                        flslvl++;
     
 !
<>1150 -                ++flslvl;
 1151 -                --trulvl;
  1145+                flslvl++;
  1146+                trulvl--;
     
 !
<>1153 -                error("If-less elif");
  1148+                error("#elif in non-conditional section");
     
 !
<_1242 -/*
 1243 - * Check for (and convert) trigraphs.
 1244 - */
 1245 -int
 1246 -chktg(void)
 1247 -{
 1248 -        int c;
 1249 -
 1250 -        if ((c = inpch()) != '?') {
 1251 -                unch(c);
 1252 -                return 0;
 1253 -        }
 1254 -        switch (c = inpch()) {
 1255 -        case '=': c = '#'; break;
 1256 -        case '(': c = '['; break;
 1257 -        case ')': c = ']'; break;
 1258 -        case '<': c = '{'; break;
 1259 -        case '>': c = '}'; break;
 1260 -        case '/': c = '\\'; break;
 1261 -        case '\'': c = '^'; break;
 1262 -        case '!': c = '|'; break;
 1263 -        case '-': c = '~'; break;
 1264 -        default:
 1265 -                unch(c);
 1266 -                unch('?');
 1267 -                c = 0;
 1268 -        }
 1269 -        return c;
 1270 -}
 1271 -
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-08-21 12:10 +0200