Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.8
 
1.9
 
MAIN:ragge:20050515210634
 
token.c
_>5353 int yywrap(void);
 5454 
 5555 static struct includ *
 5656 getbuf(usch *file)
 5757 {
 5858         struct includ *ic;
<> 59+
  60+        ic = calloc(sizeof(struct includ), 1);
  61+#if 0
5962         usch *ostr = stringbuf;
 6063 
 6164 //printf("getbuf1: stringbuf %p\n", stringbuf);
 6265         stringbuf = (usch *)ROUND((int)stringbuf);
 6366 //printf("getbuf2: stringbuf %p\n", stringbuf);
 6467         ic = (struct includ *)stringbuf;
 6568         stringbuf += sizeof(struct includ);
 6669         ic->ostr = ostr;
 6770 
 6871 //printf("getbuf3: stringbuf %p\n", stringbuf);
<> 72+#endif
6973         return ic;
 7074 }
 7175 
 7276 static void
 7377 putbuf(struct includ *ic)
 7478 {
<> 79+        free(ic);
  80+#if 0
7581 //printf("putbuf: stringbuf %p\n", stringbuf);
 7682 if (stringbuf < (usch *)&ic[1])
 7783 ;//     printf("ERROR!!!\n");
 7884 else
 7985         stringbuf = ic->ostr;
 8086 //printf("putbuf2: stringbuf %p\n", stringbuf);
<> 87+#endif
8188 }
 8289 
 8390 static int
 8491 input(void)
 8592 {
 8693         struct includ *ic;
 8794         int len;
 8895 
 8996         if (ifiles->curptr < ifiles->maxread) {
<>90 -//printf("c %d\n", *ifiles->curptr);
  97+if (*ifiles->curptr == 0)
  98+printf("c %d\n", *ifiles->curptr);
9199                 return *ifiles->curptr++;
 92100 }
 93101         if (ifiles->infil < 0) {
 94102                 ic = ifiles;
 95103                 ifiles = ifiles->next;
 96104                 putbuf(ic);
     
 !
193201                 rval = 0;
 194202                 break;
 195203 
 196204         case '\'': /* charcon */
 197205         case '"': /* string */
 198206 chstr:          oc = c;
<>199 -                if (slow == 0) {
 200 -                        do {
 201 -                                putch(c);
 202 -                                if (c == '\\')
 203 -                                        putch(slofgetc());
 204 -                        } while ((c = slofgetc()) != EOF && c != oc);
 205 -                        if (c == oc)
 206 -                                putch(c);
 207 -                        goto fast;
 208 -                } else {
 209 -                        do {
 210 -                                *yyp++ = c;
 211 -                                if (c == '\\')
 212 -                                        *yyp++ = slofgetc();
 213 -                        } while ((c = slofgetc()) != EOF && c != oc);
 214 -                        *yyp++ = c; *yyp = 0;
 215 -                }
  207+                do {
  208+                        *yyp++ = c;
  209+                        if (c == '\\')
  210+                                *yyp++ = slofgetc();
  211+                } while ((c = slofgetc()) != EOF && c != oc);
  212+                *yyp++ = c; *yyp = 0;
216213                 rval = oc == '"' ? STRING : CHARCON;
 217214                 break;
 218215 
 219216         case '0': case '1': case '2': case '3': case '4':
 220217         case '5': case '6': case '7': case '8': case '9':
 221218                 *yyp++ = c;
     
 !
261258                         goto E;
 262259 
 263260         case '.':
 264261                 ONEMORE();
 265262                 if (isdigit(c))
 266263                         goto F;
<>267 -                if (!slow) {
 268 -                        UNPUT(c);
 269 -                        putch('.');
 270 -                        goto fast;
 271 -                }
272264                 if (c == '.') {
 273265                         ONEMORE();
 274266                         if (c == '.') {
 275267                                 *yyp++ = '.'; *yyp = 0;
 276268                                 rval = ELLIPS;
 277269                                 break;
     
 !
291283                 c = input();
 292284                 if (c == '\n') {
 293285                         ifiles->lineno++;
 294286                         putch('\n');
 295287                         goto fast;
 296288                 }
<>297 -                if (!slow) {
 298 -                        putch('\\');
 299 -                        goto again;
 300 -                }
301289                 UNPUT(c);
 302290                 *yyp++ = '\\'; *yyp = 0;
 303291                 rval = '\\';
 304292                 break;
 305293                 
 306294         case '\n':
 307295                 wasnl = 1;
 308296                 ifiles->lineno++;
<> 297+                *yyp++ = '\n'; *yyp = 0;
309298                 rval = NL;
<>310 -                if (slow)
 311 -                        break;
 312 -                if (flslvl == 0) {
 313 -                        if (curline() == 1)
 314 -                                prtline();
 315 -                        else
 316 -                                putch('\n');
 317 -                }
 318 -                goto fast;
  299+                break;
319300 
 320301         case '#':
 321302                 if (wasnl) {
 322303                         wasnl = 0;
 323304                         rval = CONTROL;
 324305                         break;
 325306                 }
<>326 -                if (!slow) {
 327 -                        putch('#');
 328 -                        goto fast;
 329 -                }
330307                 *yyp++ = c;
 331308                 c = input();
 332309                 if (c == '#') {
 333310                         *yyp++ = c;
 334311                         *yyp = 0;
 335312                         rval = CONCAT;
     
 !
410387                 rval = IDENT;
 411388                 break;
 412389 
 413390         default:
 414391                 if (isalpha(c) || c == '_')
 415392                         goto gotid;
<>416 -                if (!slow && c > 5) {
 417 -                        putch(c);
 418 -                        goto fast;
 419 -                }
420393                 yystr[0] = c; yystr[1] = 0;
 421394                 rval = c;
 422395                 break;
 423396         }
 424397         return rval;
 425398 }
     
 !
435408         struct includ ibuf;
 436409         struct includ *old;
 437410         struct includ *ic;
 438411         int otrulvl = trulvl, oflslvl = flslvl;
 439412 
 440413         ic = &ibuf;
<> 414+        memset(ic, 0, sizeof(struct includ));
441415         old = ifiles;
<> 416+//printf("ifiles %p ic %p\n", ifiles, ic);
442417 
<>443 -        slow = 0;
444418         if (file != NULL) {
 445419                 if ((ic->infil = open(file, O_RDONLY)) < 0)
 446420                         return -1;
 447421                 ic->fname = file;
 448422         } else {
 449423                 ic->infil = 0;
     
 !
459433         mainscan();
 460434 
 461435         if (trulvl != otrulvl || flslvl != oflslvl)
 462436                 error("unterminated conditional");
 463437 
 464438         ifiles = old;
<> 439+//printf("ifiles2 %p\n", ifiles);
<_465440         close(ic->infil);
 466441         return 0;
 467442 }
 468443 
 469444 /*
 470445  * Print current position to output file.
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-21 21:51 +0100