diff options
| author | Paul Buetow <paul@buetow.org> | 2008-10-26 12:51:57 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-10-26 12:51:57 +0000 |
| commit | a1c3f47491b98cd9026f8e853cc9e72630805c12 (patch) | |
| tree | ec2ea29640b43f2c1f820fd3fee317beec27d130 /src/core/scope.c | |
| parent | 380eacd0f4037ec00f37ad5b5e4baa18301cf3dd (diff) | |
added the "scope" function
Diffstat (limited to 'src/core/scope.c')
| -rw-r--r-- | src/core/scope.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/scope.c b/src/core/scope.c index 2a19390..8c3d4bf 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -150,8 +150,19 @@ scope_newset(Scope *p_scope, char *c_key, Symbol *p_symbol) { } void -scopes_print(Scope *p_scope) { +_scope_print_cb(void *p_void, int i_level) { + Hash *p_hash_syms = p_void; + if (i_level > 0) + printf("%d level(s) up:\n", i_level); + hash_iterate_key(p_hash_syms, symbol_print_cb); +} + +void +scope_print(Scope *p_scope) { printf("Scopes:\n"); - printf("Scope stack size: %d\n", p_scope->p_stack_scopes); - + printf("Scope stack size: %d\n", stack_size(p_scope->p_stack_scopes)); + printf("Global symbols:\n"); + hash_iterate_key(p_scope->p_hash_global, symbol_print_cb); + printf("Local symbols:\n"); + stack_iterate_level(p_scope->p_stack_scopes, _scope_print_cb); } |
