Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.43
 
1.44
 
MAIN:ragge:20070102194737
 
cpp.c
_>853853 
 854854 /*
 855855  * do macro-expansion until WARN character read.
<> 856+ * read from lex buffer and store result on heap.
856857  * will recurse into lookup() for recursive expansion.
 857858  * when returning all expansions on the token list is done.
 858859  */
     
 !
880881                 case EXPAND: noexp--; break;
 881882 
 882883                 case IDENT:
<>883 -#if 1
884884                         /*
 885885                          * Handle argument concatenation here.
 886886                          * If an identifier is found and directly
<>887 -                         * thereafter EXPAND or NOEXP then push the
  887+                         * after EXPAND or NOEXP then push the
888888                          * identifier back on the input stream and
 889889                          * call yylex() again.
 890890                          * Be careful to keep the noexp balance.
<>891 -Om:
 892 -- vi fått en till IDENT: peta tillbaks EXPAND först som vi fått.
 893 -- annars: Gör ingenting.
894891                          */
 895892                         och = stringbuf;
 896893                         savstr((usch *)yytext);
<>897 -                        savch('\0');
898894                         DDPRINT(("id: str %s\n", och));
<>899 -                        while ((c = yylex()) == EXPAND || c == NOEXP) {
  895+
  896+                        orgexp = 0;
  897+                        while ((c = yylex()) == EXPAND || c == NOEXP)
900898                                 if (c == EXPAND)
<>901 -                                        noexp--;
  899+                                        orgexp--;
902900                                 else
<>903 -                                        noexp++;
  901+                                        orgexp++;
  902+
  903+                        DDPRINT(("id1: noexp %d orgexp %d\n", noexp, orgexp));
  904+                        if (c == IDENT) { /* XXX numbers? */
  905+                                DDPRINT(("id2: str %s\n", yytext));
  906+                                /* OK to always expand here? */
  907+                                savstr((usch *)yytext);
  908+                                switch (orgexp) {
  909+                                case 0: /* been EXP+NOEXP */
  910+                                        if (noexp != 1)
  911+                                                error("case 0");
  912+                                        cunput(NOEXP);
  913+                                        noexp = 0;
  914+                                        break;
  915+                                case -1: /* been EXP */
  916+                                        if (noexp != 1)
  917+                                                error("case -1");
  918+                                        noexp = 0;
  919+                                        break;
  920+                                case 1:
  921+                                        if (noexp != 0)
  922+                                                error("case 1");
  923+                                        cunput(NOEXP);
  924+                                        break;
  925+                                default:
  926+                                        error("orgexp = %d", orgexp);
  927+                                }
  928+                                unpstr(och);
  929+                                stringbuf = och;
  930+                                continue; /* New longer identifier */
904931                         }
<>905 -                        orgexp = noexp;
 906 -                        if (c == IDENT) {
 907 -                                while (0 < orgexp)
 908 -                                        cunput(NOEXP), orgexp--;
 909 -                        }
910932                         unpstr(yytext);
<> 933+                        if (orgexp == -1)
  934+                                cunput(EXPAND);
  935+                        else if (orgexp == 1)
  936+                                cunput(NOEXP);
911937                         unpstr(och);
 912938                         stringbuf = och;
<>913 -                        if (c == IDENT) {
 914 -                                orgexp = noexp;
 915 -                                while (0 < orgexp)
 916 -                                        cunput(EXPAND), orgexp--;
 917 -                                continue; /* New longer identifier */
 918 -                        }
  939+
  940+
919941                         yylex(); /* XXX reget last identifier */
<>920 -#else
 921 -                        /* workaround if an arg will be concatenated */
 922 -                        och = stringbuf;
 923 -                        savstr((usch *)yytext);
 924 -                        savch('\0');
 925 -                        DDPRINT(("id: str %s\n", och));
 926 -                        if ((c = yylex()) == EXPAND) {
 927 -                                DDPRINT(("funnet expand\n"));
 928 -                                if ((c = yylex()) == NOEXP) {
 929 -                                        DDPRINT(("funnet noexp\n"));
 930 -                                        if ((c = yylex()) == IDENT) {
 931 -yid:
 932 -                                                DDPRINT(("funnet ident %s%s\n",
 933 -                                                    och, yytext));
 934 -                                                stringbuf--;
 935 -                                                savstr((usch *)yytext);
 936 -                                                savch('\0');
 937 -                                                cunput(NOEXP);
 938 -                                                unpstr(och);
 939 -                                                noexp--;
 940 -                                                stringbuf = och;
 941 -                                                continue;
 942 -                                        } else {
 943 -                                                DDPRINT(("ofunnet ident\n"));
 944 -                                                unpstr((usch *)yytext);
 945 -                                                unpstr(och);
 946 -                                                stringbuf = och;
 947 -                                                continue;
 948 -                                        }
 949 -                                } else {
 950 -                                        if (c == IDENT)
 951 -                                                goto yid;
 952 -                                        DDPRINT(("ofunnet inoexp\n"));
 953 -                                        unpstr((usch *)yytext);
 954 -                                        cunput(EXPAND);
 955 -                                        unpstr(och);
 956 -                                        yylex();
 957 -printf("CURID: '%s'\n", yytext);
 958 -                                }
 959 -                        } else {
 960 -                                DDPRINT(("ofunnet expand got (%d)\n", c));
 961 -                                if (c == NOEXP) {
 962 -                                        if ((c = yylex()) == IDENT) {
 963 -                                                noexp++;
 964 -                                                goto yid;
 965 -                                        }
 966 -                                        unpstr((usch *)yytext);
 967 -                                        cunput(NOEXP);
 968 -                                } else
 969 -                                        unpstr((usch *)yytext);
 970 -                                DDPRINT(("ofunnet expand yys (%d)\n", *yytext));
 971 -                                unpstr(och);
 972 -                                yylex();
 973 -                                DDPRINT(("ofunnet expand: yytext %s\n",
 974 -                                    yytext));
 975 -                        }
 976 -                        stringbuf = och;
 977 -#endif
978942 
 979943                         if ((nl = lookup((usch *)yytext, FIND)) == NULL)
 980944                                 goto def;
     
 !
992956                                         goto def;
 993957                                 break;
 994958                         }
<>995 -printf("noexp1 %d nl->namep %s\n", noexp, nl->namep);
 996 -if (noexp > 1) goto def;
 997 -//                      if (noexp != 1)
 998 -//                              error("bad noexp %d", noexp);
  959+//printf("noexp1 %d nl->namep %s\n", noexp, nl->namep);
  960+//if (noexp > 1) goto def;
  961+                        if (noexp != 1)
  962+                                error("bad noexp %d", noexp);
999963                         stksv = NULL;
 1000964                         if ((c = yylex()) == WSPACE) {
 1001965                                 stksv = alloca(yyleng+1);
     
 !
1035999                         break;
 10361000                 }
 10371001         }
<>1038 -printf("noexp2 %d\n", noexp);
  1002+        if (noexp)
  1003+                error("expmac noexp=%d", noexp);
<_10391004         DPRINT(("return from expmac\n"));
 10401005 }
 10411006 
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-09-23 18:26 +0200