Lines Matching refs:sym
44 static void examine_symbol(struct symbol *sym, xmlNodePtr node);
65 static xmlNodePtr new_sym_node(struct symbol *sym, const char *name, xmlNodePtr parent)
68 const char *ident = show_ident(sym->ident);
71 assert(sym != NULL);
80 if (sym->ident && ident)
82 newProp(node, "file", stream_name(sym->pos.stream));
84 newNumProp(node, "start-line", sym->pos.line);
85 newNumProp(node, "start-col", sym->pos.pos);
87 if (sym->endpos.type) {
88 newNumProp(node, "end-line", sym->endpos.line);
89 newNumProp(node, "end-col", sym->endpos.pos);
90 if (sym->pos.stream != sym->endpos.stream)
91 newProp(node, "end-file", stream_name(sym->endpos.stream));
93 sym->aux = node;
102 struct symbol *sym;
104 FOR_EACH_PTR(list, sym) {
105 examine_symbol(sym, node);
106 } END_FOR_EACH_PTR(sym);
109 static void examine_modifiers(struct symbol *sym, xmlNodePtr node)
147 if (sym->namespace != NS_SYMBOL)
152 if ((sym->ctype.modifiers & 1<<i) && modifiers[i])
158 examine_layout(struct symbol *sym, xmlNodePtr node)
160 examine_symbol_type(sym);
162 newNumProp(node, "bit-size", sym->bit_size);
163 newNumProp(node, "alignment", sym->ctype.alignment);
164 newNumProp(node, "offset", sym->offset);
165 if (is_bitfield_type(sym)) {
166 newNumProp(node, "bit-offset", sym->bit_offset);
170 static void examine_symbol(struct symbol *sym, xmlNodePtr node)
176 if (!sym)
178 if (sym->aux) /*already visited */
181 if (sym->ident && sym->ident->reserved)
184 child = new_sym_node(sym, get_type_name(sym->type), node);
185 examine_modifiers(sym, child);
186 examine_layout(sym, child);
188 if (sym->ctype.base_type) {
189 if ((base = builtin_typename(sym->ctype.base_type)) == NULL) {
190 if (!sym->ctype.base_type->aux) {
191 examine_symbol(sym->ctype.base_type, root_node);
194 xmlGetProp((xmlNodePtr)sym->ctype.base_type->aux, BAD_CAST "id"));
199 if (sym->array_size) {
201 array_size = get_expression_value(sym->array_size);
206 switch (sym->type) {
209 examine_members(sym->symbol_list, child);
212 examine_members(sym->arguments, child);
215 newProp(child, "base-type-builtin", builtin_typename(sym));
237 static void examine_macro(struct symbol *sym, xmlNodePtr node)
242 pos = get_expansion_end(sym->expansion);
244 sym->endpos = *pos;
246 sym->endpos = sym->pos;
248 new_sym_node(sym, "macro", node);
251 static void examine_namespace(struct symbol *sym)
253 if (sym->ident && sym->ident->reserved)
256 switch(sym->namespace) {
258 examine_macro(sym, root_node);
263 examine_symbol(sym, root_node);
273 die("Unrecognised namespace type %d",sym->namespace);
290 struct symbol *sym;
295 FOR_EACH_PTR(list, sym) {
296 if (sym->pos.stream == stream_id)
297 examine_namespace(sym);
298 } END_FOR_EACH_PTR(sym);