8 fmtinstall('A', Aconv);
9 fmtinstall('B', Bconv);
10 fmtinstall('P', Pconv);
11 fmtinstall('S', Sconv);
12 fmtinstall('D', Dconv);
13 fmtinstall('R', Rconv);
19 char str[STRINGSZ], ss[STRINGSZ], *s;
24 bits = va_arg(fp->args, Bits);
30 snprint(ss, sizeof(ss), "$%ld", var[i].offset);
34 if(strlen(str) + strlen(s) + 1 >= STRINGSZ)
37 bits.b[i/32] &= ~(1L << (i%32));
39 return fmtstrcpy(fp, str);
48 p = va_arg(fp->args, Prog*);
50 snprint(str, sizeof(str), " %A %D/%d,%D",
51 p->as, &p->from, p->from.scale, &p->to);
52 else if(p->as == ATEXT)
53 snprint(str, sizeof(str), " %A %D,%d,%D",
54 p->as, &p->from, p->from.scale, &p->to);
56 snprint(str, sizeof(str), " %A %D,%D",
57 p->as, &p->from, &p->to);
58 return fmtstrcpy(fp, str);
66 i = va_arg(fp->args, int);
67 return fmtstrcpy(fp, anames[i]);
77 a = va_arg(fp->args, Adr*);
81 snprint(str, sizeof(str), "%ld(%R)", a->offset, i-D_INDIR);
83 snprint(str, sizeof(str), "(%R)", i-D_INDIR);
90 snprint(str, sizeof(str), "$%ld,%R", a->offset, i);
92 snprint(str, sizeof(str), "%R", i);
100 snprint(str, sizeof(str), "%ld(PC)", a->offset-pc);
104 snprint(str, sizeof(str), "%s+%ld(SB)", a->sym->name, a->offset);
108 snprint(str, sizeof(str), "%s<>+%ld(SB)", a->sym->name,
113 snprint(str, sizeof(str), "%s+%ld(SP)", a->sym->name, a->offset);
118 snprint(str, sizeof(str), "%s+%ld(FP)", a->sym->name, a->offset);
120 snprint(str, sizeof(str), "%ld(FP)", a->offset);
124 snprint(str, sizeof(str), "$%ld", a->offset);
128 snprint(str, sizeof(str), "$(%.17e)", a->dval);
132 snprint(str, sizeof(str), "$\"%S\"", a->sval);
138 snprint(str, sizeof(str), "$%D", a);
144 if(a->index != D_NONE) {
146 snprint(s, sizeof(s), "(%R*%d)", (int)a->index, (int)a->scale);
147 return fmtstrcpy(fp, s);
150 return fmtstrcpy(fp, str);
231 r = va_arg(fp->args, int);
232 if(r >= D_AL && r <= D_NONE)
233 snprint(str, sizeof(str), "%s", regstr[r-D_AL]);
235 snprint(str, sizeof(str), "gok(%d)", r);
237 return fmtstrcpy(fp, str);
244 char str[30], *p, *a;
246 a = va_arg(fp->args, char*);
248 for(i=0; i<sizeof(double); i++) {
250 if(c >= 'a' && c <= 'z' ||
251 c >= 'A' && c <= 'Z' ||
252 c >= '0' && c <= '9') {
259 if(c < 040 || c >= 0177)
260 break; /* not portable */
278 *p++ = ((c>>3) & 7) + '0';
279 *p++ = (c & 7) + '0';
282 return fmtstrcpy(fp, str);