4 * This is pretty trivial.
6 * Copyright (C) 2003 Linus Torvalds, all rights reserved.
16 base_scope
= { .next
= &base_scope
},
17 *current_scope
= &base_scope
;
19 void bind_scope(struct symbol
*sym
)
21 add_symbol(¤t_scope
->symbols
, sym
);
24 void start_symbol_scope(void)
26 struct scope
*scope
= __alloc_bytes(sizeof(*scope
));
27 memset(scope
, 0, sizeof(*scope
));
28 scope
->next
= current_scope
;
29 current_scope
= scope
;
32 static void remove_symbol_scope(struct symbol
*sym
, void *data
, int flags
)
34 struct symbol
**ptr
= sym
->id_list
;
37 ptr
= &(*ptr
)->next_id
;
41 void end_symbol_scope(void)
43 struct scope
*scope
= current_scope
;
44 struct symbol_list
*symbols
= scope
->symbols
;
46 current_scope
= scope
->next
;
47 scope
->symbols
= NULL
;
48 symbol_iterate(symbols
, remove_symbol_scope
, NULL
);