Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.1
 
1.2
 
MAIN:ragge:20040821124805
 
cpp.c
_>197197 expand(char *infil, char *utfil)
 198198 {
 199199         struct symtab *nl, *thisnl;
<>200 -        register int c;
  200+        register int c, gotspc;
201201         usch *osp;
 202202 
 203203         exfail = 0;
     
 !
253253                                 nl = 0;
 254254                                 goto found;
 255255                         }
<> 256+                        gotspc = 0;
256257                         if ((c = yylex()) == WSPACE)
<>257 -                                c = yylex();
  258+                                gotspc = 1, c = yylex();
258259                         if (c != EXPAND) {
 259260                                 unpstr(yytext);
<>260 -                                cunput(' ');
  261+                                if (gotspc)
  262+                                        cunput(' ');
261263                                 unpstr(nl->namep);
 262264                                 (void)yylex(); /* get yytext correct */
 263265                                 nl = 0; /* ignore */
     
 !
376378 define()
 377379 {
 378380         struct symtab *np;
<>379 -        usch *args[MAXARG], *obuf;
  381+        usch *args[MAXARG], *ubuf;
380382         int c, i;
 381383         int mkstr = 0, narg = -1;
 382384 
     
 !
409411                 switch (c) {
 410412                 case WSPACE:
 411413                         /* remove spaces if it surrounds a ## directive */
<>412 -                        obuf = stringbuf;
  414+                        ubuf = stringbuf;
413415                         savstr(yytext);
 414416                         c = yylex();
 415417                         if (c == CONCAT) {
<>416 -                                stringbuf = obuf;
  418+                                stringbuf = ubuf;
417419                                 savch(CONC);
 418420                                 if ((c = yylex()) == WSPACE)
 419421                                         c = yylex();
     
 !
466468         }
 467469         savch(narg < 0 ? OBJCT : narg);
 468470         np->value = stringbuf-1;
<> 471+        putc('\n', obuf);
469472 
 470473 #ifdef CPP_DEBUG
 471474         if (dflag) {
     
 !
650653 expmac(struct recur *rp)
 651654 {
 652655         struct symtab *nl;
<>653 -        int c, noexp = 0;
  656+        int c, noexp = 0, gotspc;
654657 
 655658 if (dflag)printf("expmac\n");
 656659 if (dflag && rp)printf("do not expand %s\n", rp->sp->namep);
     
 !
671674                         }
 672675                         if (noexp != 1)
 673676                                 error("bad noexp %d", noexp);
<> 677+                        gotspc = 0;
674678                         if ((c = yylex()) == WSPACE)
<>675 -                                c = yylex();
  679+                                gotspc = 1, c = yylex();
676680                         if (c == EXPAND) {
 677681                                 noexp--;
 678682                                 if (subst(nl->namep, nl, rp))
 679683                                         break;
 680684                                 savstr(nl->namep);
<>681 -                                savch(' ');
  685+                                if (gotspc)
  686+                                        savch(' ');
682687                         } else {
 683688                                 unpstr(yytext);
<>684 -                                cunput(' ');
  689+                                if (gotspc)
  690+                                        cunput(' ');
685691                                 savstr(nl->namep);
 686692                         }
 687693                         break;
     
 !
723729         for (i = 0; i < narg && c != ')'; i++) {
 724730                 args[i] = stringbuf;
 725731                 plev = 0;
<>726 -                for (;;) {
  732+                if ((c = yylex()) == WSPACE)
727733                         c = yylex();
<> 734+                for (;;) {
728735                         if (plev == 0 && (c == ')' || c == ','))
 729736                                 break;
 730737                         if (c == '(')
 731738                                 plev++;
 732739                         if (c == ')')
 733740                                 plev--;
 734741                         savstr(yytext);
<> 742+                        c = yylex();
735743                 }
<> 744+                while (args[i] < stringbuf &&
  745+                    (stringbuf[-1] == ' ' || stringbuf[-1] == '\t'))
  746+                        stringbuf--;
<_736747                 savch('\0');
 737748         }
 738749         if (narg == 0)
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-22 18:46 +0100