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");
93 if(types[TIND]->width == types[TUVLONG]->width)
99 acidmember(Type *t, long off, int flag)
103 static int acidcharinit = 0;
105 if(acidcharinit == 0) {
112 Bprint(&outbuf, " T%d\n", t->etype);
119 for(l=t; l->etype==TIND; l=l->link)
121 if(typesu[l->etype]) {
122 s1 = acidsue(l->link);
124 Bprint(&outbuf, " 'A' %s %ld %s;\n",
126 t->offset+off, amap(s->name));
132 "\tprint(\"\t%s\t\", addr.%s\\X, \"\\n\");\n",
133 amap(s->name), amap(s->name));
153 Bprint(&outbuf, " '%c' %ld %s;\n",
154 acidchar[t->etype], t->offset+off, amap(s->name));
156 Bprint(&outbuf, "\tprint(\"\t%s\t\", addr.%s, \"\\n\");\n",
157 amap(s->name), amap(s->name));
163 s1 = acidsue(t->link);
168 Bprint(&outbuf, " {\n");
169 for(l = t->link; l != T; l = l->down)
170 acidmember(l, t->offset+off, flag);
171 Bprint(&outbuf, " };\n");
173 Bprint(&outbuf, " %s %ld %s;\n",
175 t->offset+off, amap(s->name));
179 Bprint(&outbuf, "\tprint(\"%s %s {\\n\");\n",
180 amap(s1->name), amap(s->name));
181 Bprint(&outbuf, "\t%s(addr.%s);\n",
182 amap(s1->name), amap(s->name));
183 Bprint(&outbuf, "\tprint(\"}\\n\");\n");
185 Bprint(&outbuf, "\tprint(\"%s {\\n\");\n",
187 Bprint(&outbuf, "\t\t%s(addr+%ld);\n",
188 amap(s1->name), t->offset+off);
189 Bprint(&outbuf, "\tprint(\"}\\n\");\n");
209 for(i=iostack; i; i=i->link)
214 s = acidsue(t->link);
219 Bprint(&outbuf, "T%d\n", t->etype);
227 Bprint(&outbuf, "sizeof%s = %ld;\n", an, t->width);
228 Bprint(&outbuf, "aggr %s\n{\n", an);
229 for(l = t->link; l != T; l = l->down)
231 Bprint(&outbuf, "};\n\n");
233 Bprint(&outbuf, "defn\n%s(addr) {\n\tcomplex %s addr;\n", an, an);
234 for(l = t->link; l != T; l = l->down)
236 Bprint(&outbuf, "};\n\n");
241 for(l = t->link; l != T; l = l->down)
243 Bprint(&outbuf, "#define\t%s.%s\t%ld\n",
259 if(!debug['a'] || debug['s'])
263 for(i=iostack; i; i=i->link)
269 while(t && t->etype == TIND)
273 if(t->etype == TENUM) {
274 Bprint(&outbuf, "%s = ", amap(s->name));
275 if(!typefd[t->etype])
276 Bprint(&outbuf, "%lld;\n", s->vconst);
278 Bprint(&outbuf, "%f\n;", s->fconst);
281 if(!typesu[t->etype])
283 s1 = acidsue(t->link);
289 s2 = acidfun(thisfn);
291 Bprint(&outbuf, "complex %s %s:%s;\n",
292 amap(s1->name), amap(s2->name), amap(s->name));
299 Bprint(&outbuf, "complex %s %s;\n",
300 amap(s1->name), amap(s->name));