klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit 2bebff836cbe048fa3a031aa718de7a39762f0db
parent 8d489b0de87801a64077b93da977b5b7967b4b65
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Wed, 20 Apr 2011 23:12:46 -0300

Added source code info table.

Diffstat:
Msrc/kgc.c | 1+
Msrc/klimits.h | 6+++++-
Msrc/kstate.c | 7+++++--
Msrc/kstate.h | 1+
4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/kgc.c b/src/kgc.c @@ -531,6 +531,7 @@ static void markroot (klisp_State *K) { /* TEMP: this is quite awfull, think of other way to do this */ /* MAYBE: some of these could be FIXED */ markvalue(K, K->name_table); + markvalue(K, K->si_table); markvalue(K, K->curr_cont); markvalue(K, K->next_obj); markvalue(K, K->next_value); diff --git a/src/klimits.h b/src/klimits.h @@ -54,11 +54,15 @@ #define MINSTRTABSIZE 32 #endif -/* minimum size for the name table (must be power of 2) */ +/* minimum size for the name & si table (must be power of 2) */ #ifndef MINNAMETABSIZE #define MINNAMETABSIZE 32 #endif +#ifndef MINSITABSIZE +#define MINSITABSIZE 32 +#endif + /* starting size for ground environment hashtable */ /* at last count, there were about 200 bindings in ground env */ #define ENVTABSIZE 512 diff --git a/src/kstate.c b/src/kstate.c @@ -132,12 +132,15 @@ klisp_State *klisp_newstate (klisp_Alloc f, void *ud) { K->strt.hash = NULL; klispS_resize(K, MINSTRTABSIZE); - /* initialize name table */ - /* has to have weak keys, otherwise every named object would + /* initialize name & source code info tables */ + /* needs weak keys, otherwise every named object would be fixed! */ K->name_table = klispH_new(K, 0, MINNAMETABSIZE, K_FLAG_WEAK_KEYS); + K->si_table = klispH_new(K, 0, MINSITABSIZE, + K_FLAG_WEAK_KEYS); + /* Empty string */ /* MAYBE: fix it so we can remove empty_string from roots */ K->empty_string = kstring_new_b_imm(K, ""); diff --git a/src/kstate.h b/src/kstate.h @@ -48,6 +48,7 @@ typedef struct stringtable { struct klisp_State { stringtable strt; /* hash table for immutable strings & symbols */ TValue name_table; /* hash tables for naming objects */ + TValue si_table; /* hash tables for source code info */ TValue curr_cont; /*