Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.5
 
1.6
 
MAIN:ragge:20050511193259
 
token.c
     
 !
_>45 -        int curlen;
  45+        usch *maxread;
     
 !
<>47 -        usch buffer[CPPBUF];
  47+        usch *buffer;
  48+        usch bbuf[NAMEMAX+CPPBUF+1];
     
 !
<>51 -} *ifiles, *freebufs;
  52+} *ifiles;
     
 !
<> 64+        usch *ostr = stringbuf;
     
 !
<>64 -        if (freebufs) {
 65 -                /* Have buffer for use already */
 66 -                ic = freebufs;
 67 -                freebufs = freebufs->next;
 68 -                ic->ostr = NULL;
 69 -        } else {
 70 -                stringbuf = (usch *)ROUND((int)stringbuf);
 71 -                ic = (struct includ *)stringbuf;
 72 -                stringbuf += sizeof(struct includ);
 73 -                ic->ostr = stringbuf;
 74 -        }
 75 -        if (file) {
 76 -                ic->fname = savstr(file); /* XXX - will loose space */
 77 -                savch('\0');
 78 -        }
 79 -        if (ic->ostr)
 80 -                ic->ostr = stringbuf;
  66+//printf("getbuf1: stringbuf %p\n", stringbuf);
  67+        stringbuf = (usch *)ROUND((int)stringbuf);
  68+//printf("getbuf2: stringbuf %p\n", stringbuf);
  69+        ic = (struct includ *)stringbuf;
  70+        stringbuf += sizeof(struct includ);
  71+        ic->ostr = ostr;
  72+
  73+//printf("getbuf3: stringbuf %p\n", stringbuf);
     
 !
<>87 -        if (ic->ostr == stringbuf) {
 88 -                /* no new macros, free this buffer */
 89 -                stringbuf = (usch *)ic;
 90 -        } else {
 91 -                ic->next = freebufs;
 92 -                freebufs = ic;
 93 -        }
  80+//printf("putbuf: stringbuf %p\n", stringbuf);
  81+if (stringbuf < (usch *)&ic[1])
  82+;//     printf("ERROR!!!\n");
  83+else
  84+        stringbuf = ic->ostr;
  85+//printf("putbuf2: stringbuf %p\n", stringbuf);
     
 !
<> 92+        int len;
     
 !
<>101 -        if (ifiles->curptr < ifiles->buffer+ifiles->curlen)
  94+        if (ifiles->curptr < ifiles->maxread) {
  95+//printf("c %d\n", *ifiles->curptr);
     
 !
<> 97+}
     
 !
<>109 -        if ((ifiles->curlen = read(ifiles->infil, ifiles->buffer, CPPBUF)) < 0)
  104+        if ((len = read(ifiles->infil, ifiles->buffer, CPPBUF)) < 0)
     
 !
<>111 -        if (ifiles->curlen == 0)
  106+        if (len == 0)
     
 !
<> 109+        ifiles->maxread = ifiles->buffer + len;
     
 !
<>122 -        if (ifiles->curptr > ifiles->buffer) {
  118+if (c == 0) {
  119+printf("no;;\n");
  120+}
  121+
  122+        if (ifiles->curptr > ifiles->bbuf) {
     
 !
<>129 -                ic->curlen = CPPBUF;
 130 -                ic->curptr = ic->buffer+CPPBUF;
  129+                ic->curptr = &ic->bbuf[NAMEMAX+CPPBUF+1];
  130+                ic->maxread = ic->curptr;
     
 !
<> 135+//printf("unput %d\n", c);
     
 !
<> 195+#ifdef NEWBUF
  196+                rval = 0;
  197+#else
     
 !
<> 199+#endif
     
 !
<>395 -#ifdef NEW_READFILE
  400+#ifdef NEWBUF
     
 !
<>397 - * A new file included.  Read buffers are allocated on the stack and
 398 - * all subroutines are called from hereThis function will be called
 399 - * recursive when multiple files are included.
  402+ * A new file included.
  403+ * If ifiles == NULL, this is the first file and already opened (stdin).
  404+ * Return 0 on success, -1 on failure to open file.
     
 !
<>404 -        struct includ incl, *ic = &incl;
  409+        struct includ ibuf;
  410+        struct includ *old;
  411+        struct includ *ic;
     
 !
<>406 -        ic->lineno = 1;
 407 -        if (ifiles != NULL) { /* not if first file */
  413+        ic = &ibuf;
  414+        old = ifiles;
  415+
  416+        if (file != NULL) {
     
 !
<>410 -        } else
 411 -                ic->infil = 0; /* STDIN_FILENO */
 412 -
 413 -        ic->fname = savstr(file); /* XXX - will loose space */
 414 -        savch('\0');
  419+                ic->fname = file;
  420+        } else {
  421+                ic->infil = 0;
  422+                ic->fname = "<stdin>";
  423+        }
  424+        ic->buffer = ic->bbuf+NAMEMAX;
     
 !
<>416 -        ic->next = ifiles;
     
 !
<> 427+        ic->lineno = 0;
  428+        ic->maxread = ic->curptr;
  429+        unput('\n');
     
 !
<>419 -        while ((c = qscan()) != 0) {
 420 -                switch (c) {
 421 -                case CONTROL:
 422 -                        control();
 423 -                        break;
  431+        mainscan();
     
 !
<>425 -                
  433+        if (trulvl || flslvl)
  434+                error("unterminated conditional");
     
 !
<>427 -
 428 -
  436+        ifiles = old;
  437+        close(ic->infil);
  438+        return 0;
     
 !
<> 441+
     
 !
<>441 -#ifdef NEWBUF
 442 -        ic = getbuf(file);
 443 -#else
     
 !
<>446 -#endif
     
 !
<>448 -#ifdef NEWBUF
 449 -                if ((ic->infil = open(file, O_RDONLY)) < 0)
 450 -                        return -1;
 451 -#else
     
 !
<>454 -#endif
     
 !
<>456 -#ifdef NEWBUF
 457 -                ic->infil = 0;
 458 -#else
     
 !
<>460 -#endif
 461 -#ifdef NEWBUF
 462 -        ic->curptr = ic->buffer;
 463 -#endif
     
 !
<>471 -#endif
     
 !
<>483 -#ifdef NEWBUF
 484 -        close(ic->infil);
 485 -        putbuf(ic);
 486 -#else
     
 !
<>490 -#endif
     
 !
<> 482+#endif
     
 !
<> 501+#ifndef NEWBUF
     
 !
<> 510+#endif
     
 !
<_531 -                free(ifiles->fname), ifiles->fname = strdup(name);
  523+                ifiles->fname = strdup(name);
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-11-01 06:19 +0100