5 "$adt", "$aggr", "$append", "$builtin", "$complex", "$defn",
6 "$delete", "$do", "$else", "$eval", "$head", "$if",
7 "$local", "$loop", "$return", "$tail", "$then",
8 "$union", "$whatis", "$while",
17 top = bot + nelem(kwd) - 1;
19 new = bot + (top - bot)/2;
20 i = strcmp(kwd[new]+1, s);
39 for(h=0; h<nelem(hash); h++)
40 for(s = hash[h]; s != S; s = s->link)
41 if(s->suetag && s->suetag->link == t)
52 for(h=0; h<nelem(hash); h++)
53 for(s = hash[h]; s != S; s = s->link)
82 for(p=acidcinit; p->code >= 0; p++)
83 acidchar[p->code] = p->value;
85 acidchar[TINT] = acidchar[TLONG];
86 acidchar[TUINT] = acidchar[TULONG];
87 if(types[TINT]->width != types[TLONG]->width) {
88 acidchar[TINT] = acidchar[TSHORT];
89 acidchar[TUINT] = acidchar[TUSHORT];
90 if(types[TINT]->width != types[TSHORT]->width)
91 warn(Z, "acidmember int not long or short");
97 acidmember(Type *t, long off, int flag)
101 static int acidcharinit = 0;
103 if(acidcharinit == 0) {
110 Bprint(&outbuf, " T%d\n", t->etype);
117 for(l=t; l->etype==TIND; l=l->link)
119 if(typesu[l->etype]) {
120 s1 = acidsue(l->link);
122 Bprint(&outbuf, " 'A' %s %ld %s;\n",
124 t->offset+off, amap(s->name));
130 "\tprint(\"\t%s\t\", addr.%s\\X, \"\\n\");\n",
131 amap(s->name), amap(s->name));
151 Bprint(&outbuf, " '%c' %ld %s;\n",
152 acidchar[t->etype], t->offset+off, amap(s->name));
154 Bprint(&outbuf, "\tprint(\"\t%s\t\", addr.%s, \"\\n\");\n",
155 amap(s->name), amap(s->name));
161 s1 = acidsue(t->link);
166 Bprint(&outbuf, " {\n");
167 for(l = t->link; l != T; l = l->down)
168 acidmember(l, t->offset+off, flag);
169 Bprint(&outbuf, " };\n");
171 Bprint(&outbuf, " %s %ld %s;\n",
173 t->offset+off, amap(s->name));
177 Bprint(&outbuf, "\tprint(\"%s %s {\\n\");\n",
178 amap(s1->name), amap(s->name));
179 Bprint(&outbuf, "\t%s(addr.%s);\n",
180 amap(s1->name), amap(s->name));
181 Bprint(&outbuf, "\tprint(\"}\\n\");\n");
183 Bprint(&outbuf, "\tprint(\"%s {\\n\");\n",
185 Bprint(&outbuf, "\t\t%s(addr+%ld);\n",
186 amap(s1->name), t->offset+off);
187 Bprint(&outbuf, "\tprint(\"}\\n\");\n");
207 for(i=iostack; i; i=i->link)
212 s = acidsue(t->link);
217 Bprint(&outbuf, "T%d\n", t->etype);
225 Bprint(&outbuf, "sizeof%s = %ld;\n", an, t->width);
226 Bprint(&outbuf, "aggr %s\n{\n", an);
227 for(l = t->link; l != T; l = l->down)
229 Bprint(&outbuf, "};\n\n");
231 Bprint(&outbuf, "defn\n%s(addr) {\n\tcomplex %s addr;\n", an, an);
232 for(l = t->link; l != T; l = l->down)
234 Bprint(&outbuf, "};\n\n");
239 for(l = t->link; l != T; l = l->down)
241 Bprint(&outbuf, "#define\t%s.%s\t%ld\n",
257 if(!debug['a'] || debug['s'])
261 for(i=iostack; i; i=i->link)
267 while(t && t->etype == TIND)
271 if(t->etype == TENUM) {
272 Bprint(&outbuf, "%s = ", amap(s->name));
273 if(!typefd[t->etype])
274 Bprint(&outbuf, "%lld;\n", s->vconst);
276 Bprint(&outbuf, "%f\n;", s->fconst);
279 if(!typesu[t->etype])
281 s1 = acidsue(t->link);
287 s2 = acidfun(thisfn);
289 Bprint(&outbuf, "complex %s %s:%s;\n",
290 amap(s1->name), amap(s2->name), amap(s->name));
297 Bprint(&outbuf, "complex %s %s;\n",
298 amap(s1->name), amap(s->name));