Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.101
 
1.102
 
MAIN:ragge:20091231114613
 
cpp.c
_>171171 void define(void);
 172172 static int canexpand(struct recur *, struct symtab *np);
 173173 void include(void);
<> 174+void include_next(void);
174175 void line(void);
 175176 void flbuf(void);
 176177 void usage(void);
     
 !
185186         struct incs *w, *w2;
 186187         struct symtab *nl;
 187188         register int ch;
<> 189+        usch *fn1, *fn2;
188190 
 189191 #ifdef TIMING
 190192         struct timeval t1, t2;
     
 !
316318                 ofd = 1; /* stdout */
 317319         istty = isatty(ofd);
 318320 
<>319 -        if (pushfile((usch *)(argc && strcmp(argv[0], "-") ? argv[0] : NULL)))
  321+        if (argc && strcmp(argv[0], "-")) {
  322+                fn1 = fn2 = (usch *)argv[0];
  323+        } else {
  324+                fn1 = NULL;
  325+                fn2 = (usch *)"";
  326+        }
  327+        if (pushfile(fn1, fn2, 0, NULL))
320328                 error("cannot open %s", argv[0]);
 321329 
 322330         flbuf();
     
 !
485493 }
 486494 
 487495 /*
<> 496+ * Search for and include next file.
  497+ * Return 1 on success.
  498+ */
  499+static int
  500+fsrch(usch *fn, int idx, struct incs *w)
  501+{
  502+        int i;
  503+
  504+        for (i = idx; i < 2; i++) {
  505+                if (i > idx)
  506+                        w = incdir[i];
  507+                for (; w; w = w->next) {
  508+                        usch *nm = stringbuf;
  509+
  510+                        savstr(w->dir); savch('/');
  511+                        savstr(fn); savch(0);
  512+                        if (pushfile(nm, fn, i, w->next) == 0)
  513+                                return 1;
  514+                        stringbuf = nm;
  515+                }
  516+        }
  517+        return 0;
  518+}
  519+
  520+/*
488521  * Include a file. Include order:
 489522  * - For <...> files, first search -I directories, then system directories.
 490523  * - For "..." files, first search "current" dir, then as <...> files.
     
 !
493526 include()
 494527 {
 495528         struct symtab *nl;
<>496 -        struct incs *w;
497529         usch *osp;
 498530         usch *fn, *safefn;
<>499 -        int i, c, it;
  531+        int c, it;
500532 
 501533         if (flslvl)
 502534                 return;
     
 !
549581                 c = yylex();
 550582                 if (c != '\n')
 551583                         goto bad;
<>552 -                if (pushfile(nm) == 0)
  584+                if (pushfile(nm, safefn, 0, NULL) == 0)
553585                         goto okret;
 554586                 /* XXX may loose stringbuf space */
 555587         }
 556588 
<>557 -        /* create search path and try to open file */
 558 -        for (i = 0; i < 2; i++) {
 559 -                for (w = incdir[i]; w; w = w->next) {
 560 -                        usch *nm = stringbuf;
  589+        if (fsrch(safefn, 0, incdir[0]))
  590+                goto okret;
561591 
<>562 -                        savstr(w->dir); savch('/');
 563 -                        savstr(safefn); savch(0);
 564 -                        if (pushfile(nm) == 0)
 565 -                                goto okret;
 566 -                        stringbuf = nm;
 567 -                }
 568 -        }
569592         error("cannot find '%s'", safefn);
 570593         /* error() do not return */
 571594 
     
 !
575598         prtline();
 576599 }
 577600 
<> 601+void
  602+include_next()
  603+{
  604+        if (fsrch(ifiles->fn, ifiles->idx, ifiles->incs) == 0)
  605+                error("cannot find '%s'", ifiles->fn);
  606+}
  607+
<_578608 static int
 579609 definp(void)
 580610 {
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-30 10:12 +0200