Lines Matching defs:sym
105 /* Expand symbol 'sym' at '*list' */
129 struct symbol *sym = lookup_symbol(ident, NS_MACRO | NS_UNDEF);
130 if (sym && sym->namespace != NS_MACRO)
131 sym = NULL;
132 return sym;
138 struct symbol *sym = lookup_macro(token->ident);
139 if (sym) {
140 sym->used_in = file_scope;
212 struct symbol *sym;
217 sym = lookup_macro(token->ident);
218 if (!sym)
220 if (sym->expand_simple) {
221 sym->expand_simple(token);
226 sym->used_in = file_scope;
228 rc = expand(list, sym);
745 static int expand(struct token **list, struct symbol *sym)
751 struct token *expansion = sym->expansion;
752 int nargs = sym->arglist ? sym->arglist->count.normal : 0;
760 if (sym->arglist) {
763 if (!collect_arguments(token->next, sym->arglist, args, token))
768 if (sym->expand)
769 return sym->expand(token, args) ? 0 : 1;
1348 struct symbol *sym;
1355 sym = lookup_symbol(name, NS_MACRO | NS_UNDEF);
1356 if (sym) {
1359 if (attr < sym->attr)
1362 clean = (attr == sym->attr && sym->namespace == NS_MACRO);
1364 if (token_list_different(sym->expansion, expansion) ||
1365 token_list_different(sym->arglist, arglist)) {
1368 || sym->used_in == file_scope) {
1371 info(sym->pos, "this was the original definition");
1377 if (!sym || sym->scope != file_scope) {
1378 sym = alloc_symbol(pos, SYM_NODE);
1379 bind_symbol(sym, name, NS_MACRO);
1385 sym->expansion = expansion;
1386 sym->arglist = arglist;
1391 sym->namespace = NS_MACRO;
1392 sym->used_in = NULL;
1393 sym->attr = attr;
1518 struct symbol *sym;
1525 sym = lookup_symbol(left->ident, NS_MACRO | NS_UNDEF);
1526 if (sym) {
1527 if (attr < sym->attr)
1529 if (attr == sym->attr && sym->namespace == NS_UNDEF)
1534 if (!sym || sym->scope != file_scope) {
1535 sym = alloc_symbol(left->pos, SYM_NODE);
1536 bind_symbol(sym, left->ident, NS_MACRO);
1539 sym->namespace = NS_UNDEF;
1540 sym->used_in = NULL;
1541 sym->attr = attr;
1985 struct symbol *sym;
1992 sym = lookup_symbol(arg->ident, NS_KEYWORD);
1993 replace_with_bool(token, sym && sym->op && sym->op->attribute);
2000 struct symbol *sym;
2007 sym = lookup_symbol(arg->ident, NS_SYMBOL);
2008 replace_with_bool(token, sym && sym->builtin);
2064 static void create_arglist(struct symbol *sym, int count)
2075 sym->arglist = token;
2149 struct symbol *sym;
2150 sym = create_symbol(stream, normal[i].name, SYM_PREPROCESSOR, NS_PREPROCESSOR);
2151 sym->handler = normal[i].handler;
2152 sym->normal = 1;
2155 struct symbol *sym;
2156 sym = create_symbol(stream, special[i].name, SYM_PREPROCESSOR, NS_PREPROCESSOR);
2157 sym->handler = special[i].handler;
2158 sym->normal = 0;
2161 struct symbol *sym;
2162 sym = create_symbol(stream, dynamic[i].name, SYM_NODE, NS_MACRO);
2163 sym->expand_simple = dynamic[i].expand_simple;
2164 if ((sym->expand = dynamic[i].expand) != NULL)
2165 create_arglist(sym, 1);
2182 struct symbol *sym = lookup_symbol(token->ident, NS_PREPROCESSOR);
2183 if (sym) {
2184 handler = sym->handler;
2185 is_normal = sym->normal;
2186 is_cond = !sym->normal;
2297 static void dump_macro(struct symbol *sym)
2299 int nargs = sym->arglist ? sym->arglist->count.normal : 0;
2303 printf("#define %s", show_ident(sym->ident));
2304 token = sym->arglist;
2322 token = sym->expansion;
2351 struct symbol *sym = lookup_macro(name);
2352 if (sym)
2353 dump_macro(sym);