Lines Matching defs:map
22 * C expression library value map support
51 initmap(Frame_t* frame, Cxmap_t* map, Cxdisc_t* disc)
64 if (map->header.flags & CX_INITIALIZED)
66 map->header.flags |= CX_INITIALIZED;
69 if (!map->mask)
70 map->mask = ~map->mask;
71 if (!map->map)
73 map = map->map;
75 if (!map->part)
77 if (map->str2num)
88 if (map->header.flags & CX_IGNORECASE)
92 map->str2num = dtopen(&stricase2numdisc, Dtoset);
95 map->str2num = dtopen(&str2numdisc, Dtoset);
96 if (!map->str2num)
103 top.str2num = map->str2num;
107 for (part = map->part; part; part = part->next)
124 if (item->map)
126 if (initmap(frame, item->map, disc))
137 if (!(map->num2str = dtopen(&num2strdisc, Dtoset)))
143 part = map->part;
144 map->shift += part->shift;
145 map->mask |= part->mask;
147 dtinsert(map->num2str, item);
153 * initialize map
157 cxinitmap(Cxmap_t* map, Cxdisc_t* disc)
159 return initmap(NiL, map, disc);
167 num2str(Cx_t* cx, Cxmap_t* map, Sfio_t* sp, Cxunsigned_t num, int del)
182 num >>= map->shift;
183 num &= map->mask;
184 if (!map->map)
186 map = map->map;
188 if (map->num2str && (item = (Cxitem_t*)dtmatch(map->num2str, &num)))
194 for (part = map->part; part; part = part->next)
209 if (item->map)
210 r += num2str(cx, item->map, sp, n, del);
241 * map number to string
250 if (format->map)
254 if (!num2str(cx, format->map, cx->tp, num, del))
271 str2num(Cx_t* cx, Cxmap_t* map, const char* str, Cxunsigned_t* num)
277 for (part = map->part; part; part = part->next)
293 * map string to number
307 if (!format->map)
310 dt = format->map->str2num;
322 else if (str2num(cx, format->map, b, &m))