Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.190
 
1.191
 
MAIN:ragge:20080106150706
 
pftn.c
_>9595         r = argcast(r, t, d, s); *p = *r; nfree(r);
 9696 
 9797 /*
<>98 - * Info stored for delaying string printouts.
 99 - */
 100 -struct strsched {
 101 -        struct strsched *next;
 102 -        int locctr;
 103 -        struct symtab *sym;
 104 -} *strpole;
 105 -
 106 -/*
10798  * Linked list stack while reading in structs.
 10899  */
 109100 struct rstack {
     
 !
137128 void inforce(OFFSZ n);
 138129 void vfdalign(int n);
 139130 static void ssave(struct symtab *);
<>140 -static void strprint(void);
141131 static void alprint(union arglist *al, int in);
 142132 static void lcommadd(struct symtab *sp);
 143133 
     
 !
517507                 inline_end();
 518508         inline_prtout();
 519509 
<>520 -        strprint();
 521 -
522510         tmpfree(); /* Release memory resources */
 523511 }
 524512 
     
 !
11231111 }
 11241112 
 11251113 /*
<>1126 - * Write last part of wide string.
 1127 - * Do not bother to save wide strings.
  1114+ * Save string (and print it out)If wide == 'L' then wide string.
11281115  */
 11291116 NODE *
<>1130 -wstrend(char *str)
  1117+strend(int wide, char *str)
11311118 {
<>1132 -        struct symtab *sp = getsymtab(str, SSTRING|STEMP);
 1133 -        struct strsched *sc = tmpalloc(sizeof(struct strsched));
 1134 -        NODE *p = block(NAME, NIL, NIL, WCHAR_TYPE+ARY,
 1135 -            tmpalloc(sizeof(union dimfun)), MKSUE(WCHAR_TYPE));
 1136 -        int i;
 1137 -        char *c;
 1138 -
 1139 -        sp->sclass = ILABEL;
 1140 -        sp->soffset = getlab();
 1141 -        sp->stype = WCHAR_TYPE+ARY;
 1142 -
 1143 -        sc = tmpalloc(sizeof(struct strsched));
 1144 -        sc->locctr = STRNG;
 1145 -        sc->sym = sp;
 1146 -        sc->next = strpole;
 1147 -        strpole = sc;
 1148 -
 1149 -        /* length calculation, used only for sizeof */
 1150 -        for (i = 0, c = str; *c; ) {
 1151 -                if (*c++ == '\\')
 1152 -                        (void)esccon(&c);
 1153 -                i++;
 1154 -        }
 1155 -        p->n_df->ddim = (i+1) * ((MKSUE(WCHAR_TYPE))->suesize/SZCHAR);
 1156 -        p->n_sp = sp;
 1157 -        return(clocal(p));
 1158 -}
 1159 -
 1160 -/*
 1161 - * Write last part of string.
 1162 - */
 1163 -NODE *
 1164 -strend(char *str)
 1165 -{
 1166 -//      extern int maystr;
 1167 -        struct symtab *s;
  1119+        struct symtab *sp;
11681120         NODE *p;
<>1169 -        int i;
 1170 -        char *c;
11711121 
 11721122         /* If an identical string is already emitted, just forget this one */
<>1173 -        str = addstring(str);   /* enter string in string table */
 1174 -        s = lookup(str, SSTRING);       /* check for existance */
 1175 -
 1176 -        if (s->soffset == 0 /* && maystr == 0 */) { /* No string */
 1177 -                struct strsched *sc;
 1178 -                s->sclass = ILABEL;
 1179 -
 1180 -                /*
 1181 -                 * Delay printout of this string until after the current
 1182 -                 * function, or the end of the statement.
 1183 -                 */
 1184 -                sc = tmpalloc(sizeof(struct strsched));
 1185 -                sc->locctr = STRNG;
 1186 -                sc->sym = s;
 1187 -                sc->next = strpole;
 1188 -                strpole = sc;
 1189 -                s->soffset = getlab();
  1123+        if (wide == 'L') {
  1124+                /* Do not save wide strings, at least not now */
  1125+                sp = getsymtab(str, SSTRING|STEMP);
  1126+        } else {
  1127+                str = addstring(str);   /* enter string in string table */
  1128+                sp = lookup(str, SSTRING);      /* check for existance */
11901129         }
 11911130 
<>1192 -        p = block(NAME, NIL, NIL, CHAR+ARY,
 1193 -            tmpalloc(sizeof(union dimfun)), MKSUE(CHAR));
  1131+        if (sp->soffset == 0) { /* No string */
  1132+                char *wr;
  1133+                int i;
  1134+
  1135+                sp->sclass = STATIC;
  1136+                sp->slevel = 1;
  1137+                sp->soffset = getlab();
  1138+                sp->squal = (CON >> TSHIFT);
  1139+                sp->sdf = permalloc(sizeof(union dimfun));
  1140+                if (wide == 'L') {
  1141+                        sp->stype = WCHAR_TYPE+ARY;
  1142+                        sp->ssue = MKSUE(WCHAR_TYPE);
  1143+                } else {
11941144 #ifdef CHAR_UNSIGNED
<>1195 -        p->n_type = UCHAR+ARY;
 1196 -        p->n_sue = MKSUE(UCHAR);
  1145+                        sp->stype = UCHAR+ARY;
  1146+                        sp->ssue = MKSUE(UCHAR);
  1147+#else
  1148+                        sp->stype = CHAR+ARY;
  1149+                        sp->ssue = MKSUE(CHAR);
11971150 #endif
<>1198 -        /* length calculation, used only for sizeof */
 1199 -        for (i = 0, c = str; *c; ) {
 1200 -                if (*c++ == '\\')
 1201 -                        (void)esccon(&c);
 1202 -                i++;
 1203 -        }
 1204 -        p->n_df->ddim = i+1;
 1205 -        p->n_sp = s;
 1206 -        return(clocal(p));
 1207 -}
 1208 -
 1209 -/*
 1210 - * Print out new strings, before temp memory is cleared.
 1211 - */
 1212 -void
 1213 -strprint()
 1214 -{
 1215 -        char *wr;
 1216 -        int i, val, isw;
 1217 -        NODE *p = bcon(0);
 1218 -
 1219 -        while (strpole != NULL) {
 1220 -                setloc1(STRNG);
 1221 -                deflab1(strpole->sym->soffset);
 1222 -                isw = strpole->sym->stype == WCHAR_TYPE+ARY;
 1223 -
 1224 -                i = 0;
 1225 -                wr = strpole->sym->sname;
 1226 -                while (*wr != 0) {
 1227 -                        if (*wr++ == '\\')
 1228 -                                val = esccon(&wr);
 1229 -                        else
 1230 -                                val = (unsigned char)wr[-1];
 1231 -                        if (isw) {
 1232 -                                p->n_lval = val;
 1233 -                                p->n_type = WCHAR_TYPE;
 1234 -                                ninval(i*(WCHAR_TYPE/SZCHAR),
 1235 -                                    (MKSUE(WCHAR_TYPE))->suesize, p);
 1236 -                        } else
 1237 -                                bycode(val, i);
 1238 -                        i++;
12391151                 }
<>1240 -                if (isw) {
 1241 -                        p->n_lval = 0;
 1242 -                        ninval(i*(WCHAR_TYPE/SZCHAR),
 1243 -                            (MKSUE(WCHAR_TYPE))->suesize, p);
 1244 -                } else {
 1245 -                        bycode(0, i++);
 1246 -                        bycode(-1, i);
 1247 -                }
 1248 -                strpole = strpole->next;
  1152+                for (wr = sp->sname, i = 1; *wr; i++)
  1153+                        if (*wr++ == '\\')
  1154+                                (void)esccon(&wr);
  1155+
  1156+                sp->sdf->ddim = i;
  1157+                if (wide == 'L')
  1158+                        inwstring(sp);
  1159+                else
  1160+                        instring(sp);
12491161         }
<>1250 -        nfree(p);
 1251 -}
12521162 
<>1253 -#if 0
 1254 -/*
 1255 - * simulate byte v appearing in a list of integer values
 1256 - */
 1257 -void
 1258 -putbyte(int v)
 1259 -{
 1260 -        NODE *p;
 1261 -        p = bcon(v);
 1262 -        incode( p, SZCHAR );
 1263 -        tfree( p );
 1264 -//      gotscal();
  1163+        p = block(NAME, NIL, NIL, sp->stype, sp->sdf, sp->ssue);
  1164+        p->n_sp = sp;
  1165+        return(clocal(p));
12651166 }
<>1266 -#endif
12671167 
 12681168 /*
 12691169  * update the offset pointed to by poff; return the
     
 !
15131413                 if (blevel == 0)
 15141414                         lcommadd(p->n_sp);
 15151415                 else
<>1516 -                        lcommdec(p->n_sp);
  1416+                        defzero(p->n_sp);
15171417                 break;
 15181418         }
 15191419 }
     
 !
15731473         struct lcd *lc;
 15741474 
 15751475         SLIST_FOREACH(lc, &lhead, next) {
<>1576 -                if (lc->sp != NULL) {
 1577 -                        if (lc->sp->sclass == STATIC)
 1578 -                                lcommdec(lc->sp);
 1579 -                        else
 1580 -                                commdec(lc->sp);
 1581 -                }
  1476+                if (lc->sp != NULL)
  1477+                        defzero(lc->sp);
<_15821478         }
 15831479 }
 15841480 
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-02 21:06 +0200