5 "$adt", "$aggr", "$append", "$complex", "$defn",
6 "$delete", "$do", "$else", "$eval", "$head", "$if",
7 "$local", "$loop", "$return", "$tail", "$then",
8 "$union", "$whatis", "$while",
10 static char picklestr[] = "\tbp = pickle(bp, ep, un, ";
18 top = bot + nelem(kwd) - 1;
20 new = bot + (top - bot)/2;
21 i = strcmp(kwd[new]+1, s);
40 for(h=0; h<nelem(hash); h++)
41 for(s = hash[h]; s != S; s = s->link)
42 if(s->suetag && s->suetag->link == t)
53 for(h=0; h<nelem(hash); h++)
54 for(s = hash[h]; s != S; s = s->link)
60 char picklechar[NTYPE];
83 for(p=picklecinit; p->code >= 0; p++)
84 picklechar[p->code] = p->value;
86 picklechar[TINT] = picklechar[TLONG];
87 picklechar[TUINT] = picklechar[TULONG];
88 if(types[TINT]->width != types[TLONG]->width) {
89 picklechar[TINT] = picklechar[TSHORT];
90 picklechar[TUINT] = picklechar[TUSHORT];
91 if(types[TINT]->width != types[TSHORT]->width)
92 warn(Z, "picklemember int not long or short");
98 picklemember(Type *t, long off)
101 static int picklecharinit = 0;
103 if(picklecharinit == 0) {
110 Bprint(&outbuf, " T%d\n", t->etype);
116 "%s\"p\", (char*)addr+%ld+_i*%ld);\n",
117 picklestr, t->offset+off, t->width);
120 "%s\"p\", &addr->%s);\n",
121 picklestr, pmap(s->name));
137 Bprint(&outbuf, "%s\"%c\", (char*)addr+%ld+_i*%ld);\n",
138 picklestr, picklechar[t->etype], t->offset+off, t->width);
140 Bprint(&outbuf, "%s\"%c\", &addr->%s);\n",
141 picklestr, picklechar[t->etype], pmap(s->name));
144 Bprint(&outbuf, "\tfor(_i = 0; _i < %ld; _i++) {\n\t",
145 t->width/t->link->width);
146 picklemember(t->link, t->offset+off);
147 Bprint(&outbuf, "\t}\n\t_i = 0;\n\tUSED(_i);\n");
152 s1 = picklesue(t->link);
156 Bprint(&outbuf, "\tbp = pickle_%s(bp, ep, un, (%s*)((char*)addr+%ld+_i*%ld));\n",
157 pmap(s1->name), pmap(s1->name), t->offset+off, t->width);
159 Bprint(&outbuf, "\tbp = pickle_%s(bp, ep, un, &addr->%s);\n",
160 pmap(s1->name), pmap(s->name));
179 for(i=iostack; i; i=i->link)
184 s = picklesue(t->link);
189 Bprint(&outbuf, "T%d\n", t->etype);
198 Bprint(&outbuf, "uchar*\npickle_%s(uchar *bp, uchar *ep, int un, %s *addr)\n{\n\tint _i = 0;\n\n\tUSED(_i);\n", an, an);
199 for(l = t->link; l != T; l = l->down)
201 Bprint(&outbuf, "\treturn bp;\n}\n\n");
206 for(l = t->link; l != T; l = l->down)
208 Bprint(&outbuf, "#define\t%s.%s\t%ld\n",
224 if(!debug['P'] || debug['s'])
228 for(i=iostack; i; i=i->link)
234 while(t && t->etype == TIND)
238 if(t->etype == TENUM) {
239 Bprint(&outbuf, "%s = ", pmap(s->name));
240 if(!typefd[t->etype])
241 Bprint(&outbuf, "%lld;\n", s->vconst);
243 Bprint(&outbuf, "%f\n;", s->fconst);
246 if(!typesu[t->etype])
248 s1 = picklesue(t->link);
254 s2 = picklefun(thisfn);
256 Bprint(&outbuf, "complex %s %s:%s;\n",
257 pmap(s1->name), pmap(s2->name), pmap(s->name));
264 Bprint(&outbuf, "complex %s %s;\n",
265 pmap(s1->name), pmap(s->name));