Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.11
 
1.12
 
MAIN:ragge:20040828150847
 
cpp.c
_>114114 
 115115 static struct symtab *filloc;
 116116 static struct symtab *linloc;
<>117 -static struct symtab *datloc;
 118 -static struct symtab *timloc;
119117 int     trulvl;
 120118 int     flslvl;
 121119 int     elflvl;
     
 !
127125  * - For object-type macros, replacement strings are stored as-is.
 128126  * - For function-type macros, macro args are substituted for the
 129127  *   character WARN followed by the argument number.
<> 128+ * - The value element points to the end of the string, to simplify
  129+ *   pushback onto the input queue.
130130  *
<>131 - * The first character in the replacement list is the number of arguments:
  131+ * The first character (from the end) in the replacement list is
  132+ * the number of arguments:
132133  *   OBJCT - object-type macro
 133134  *   0     - empty parenthesis, foo()
 134135  *   1->   - number of args.
     
 !
148149 
 149150 static void expdef(usch *proto, struct recur *, int gotwarn);
 150151 static void savch(int c);
<>151 -static void insym(struct symtab **sp, char *namep);
152152 static void control(void);
 153153 static usch *savstr(usch *str);
 154154 static void define(void);
     
 !
240240 
 241241         prtline();
 242242 
<>243 -        insym(&filloc, "__FILE__");
 244 -        insym(&linloc, "__LINE__");
 245 -        insym(&datloc, "__DATE__");
 246 -        insym(&timloc, "__TIME__");
  243+        filloc = lookup("__FILE__", ENTER);
  244+        linloc = lookup("__LINE__", ENTER);
  245+        if (tflag == 0) {
  246+                time_t t = time(NULL);
  247+                char *n = ctime(&t);
247248 
<> 249+                /*
  250+                 * Manually move in the predefined macros.
  251+                 */
  252+                nl = lookup("__TIME__", ENTER);
  253+                savch('"');  n[19] = 0; savstr(&n[11]); savch('"');
  254+                savch(OBJCT);
  255+                nl->value = stringbuf-1;
  256+
  257+                nl = lookup("__DATE__", ENTER);
  258+                savch('"'); n[24] = n[11] = 0; savstr(&n[4]); savstr(&n[20]);
  259+                savch('"'); savch(OBJCT);
  260+                nl->value = stringbuf-1;
  261+
  262+                nl = lookup("__STDC__", ENTER);
  263+                savch('1'); savch(OBJCT);
  264+                nl->value = stringbuf-1;
  265+        }
  266+
248267         thisnl = NULL;
 249268         while ((c = yylex()) != 0) {
 250269                 switch (c) {
     
 !
657676 }
 658677 
 659678 void
<>660 -insym(sp, namep)
 661 -struct symtab **sp;
 662 -char *namep;
 663 -{
 664 -        register struct symtab *np;
 665 -
 666 -        *sp = np = lookup(namep, ENTER);
 667 -        np->value = NULL;
 668 -}
 669 -
 670 -void
671679 error(char *s, ...)
 672680 {
 673681         va_list ap;
     
 !
725733                 }
 726734         }
 727735         if (enterf == ENTER) {
<>728 -                sp->namep = savstr(namep), savch('\0');
  736+                sp->namep = savstr(namep), savch('\0'), sp->value = NULL;
729737         }
 730738         return(sp->namep ? sp : 0);
 731739 }
     
 !
757765                         char buf[12];
 758766                         sprintf(buf, "%d", curline());
 759767                         savstr(buf);
<>760 -                } else if (sp == datloc) {
 761 -                        time_t t = time(NULL);
 762 -                        char *n = ctime(&t);
 763 -                        savch('"');
 764 -                        n[24] = n[11] = 0;
 765 -                        savstr(&n[4]);
 766 -                        savstr(&n[20]);
 767 -                        savch('"');
 768 -                } else if (sp == timloc) {
 769 -                        time_t t = time(NULL);
 770 -                        char *n = ctime(&t);
 771 -                        savch('"'); 
 772 -                        n[19] = 0;
 773 -                        savstr(&n[11]);
 774 -                        savch('"');
<_775768                 } else
 776769                         return 0;
 777770                 return 1;
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 00:51 +0100