klisp

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

commit c9968f34c70786bfd968fdbc31b7353e7ed6f0fb
parent 3236c00af124e4d040f87f8264bb46adb30faa20
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Fri, 29 Apr 2011 17:25:20 -0300

Hack to add (root-continuation's) source info to repl continuations.

Diffstat:
Msrc/krepl.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/krepl.c b/src/krepl.c @@ -211,6 +211,7 @@ void kinit_repl(klisp_State *K) /* GC: symbol should already be in root */ kadd_binding(K, K->ground_env, symbol, root_cont); + #if KTRACK_SI /* TODO: find a cleaner way of doing this..., maybe disable gc */ /* Add source info to the cont */ TValue str = kstring_new_b_imm(K, __FILE__); @@ -223,11 +224,13 @@ void kinit_repl(klisp_State *K) krooted_tvs_pop(K); krooted_tvs_pop(K); krooted_tvs_pop(K); + #endif symbol = ksymbol_new(K, "error-continuation"); /* GC: symbol should already be in root */ kadd_binding(K, K->ground_env, symbol, error_cont); + #if KTRACK_SI str = kstring_new_b_imm(K, __FILE__); krooted_tvs_push(K, str); tail = kcons(K, i2tv(__LINE__), i2tv(0)); @@ -238,6 +241,7 @@ void kinit_repl(klisp_State *K) krooted_tvs_pop(K); krooted_tvs_pop(K); krooted_tvs_pop(K); + #endif /* and save them in the structure */ K->root_cont = root_cont; @@ -247,6 +251,13 @@ void kinit_repl(klisp_State *K) krooted_tvs_pop(K); krooted_tvs_pop(K); + #if KTRACK_SI + /* save the root cont in next_si to let the loop continuations have + source info, this is hackish but works */ + + K->next_si = ktry_get_si(K, K->root_cont); + #endif + /* GC: create_loop will root std_env */ create_loop(K, std_env); }