On 7/31/08, Christian Jaeger christian@pflanze.mine.nu wrote:
Nguyen Thai Ngoc Duy wrote:
Hi,
Is there any way to get global symbol table from scheme? (Because I see that symbol completion is done in C).
You can get the ___GSTATE->symbol_table by calling (##symbol-table); this is not a normal Gambit hash table (it predated Gambit's hash table implementation, and maybe there are reasons to leave it at what it is); it's a vector with some number in the first position -- so, how you work with that depends on what you want to do with it. For one, you can use ##object->global-var to map a procedure value back to a symbol holding it. Maybe there are a few more Scheme wrappers, I haven't looked closely enough, check _kernel.scm, setup.c, and maybe a few other files.
I needed it to (try to) implement swank backend for gambit: give a prefix, return a more exact prefix (if any) and a list of possible completions.
Check cj-symbol*scm from http://scheme.mine.nu/gambit/preview/ for how I did it. (And I welcome suggestions and patches to that file.)
Might not have time for a look today. Thanks.