diff options
author | Andy Wingo <wingo@pobox.com> | 2010-02-25 13:17:34 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-02-25 20:59:55 +0100 |
commit | b8af64db76bc602517be300128be0dfb67fac89f (patch) | |
tree | 71175912af3a40c5f44a781fe8983e23a6081c61 /libguile/control.c | |
parent | da7fa082e80b2c3989c90031ee5356e5b65bd00b (diff) | |
download | guile-b8af64db76bc602517be300128be0dfb67fac89f.tar.gz |
simplify handling of nonlocal prompt returns from c
* libguile/control.h:
* libguile/control.c (scm_i_prompt_pop_abort_args_x): New helper.
* libguile/eval.c (eval): Use the new helper.
Diffstat (limited to 'libguile/control.c')
-rw-r--r-- | libguile/control.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libguile/control.c b/libguile/control.c index 9f23f3098..5ca625254 100644 --- a/libguile/control.c +++ b/libguile/control.c @@ -57,6 +57,26 @@ scm_c_make_prompt (SCM vm, SCM k, scm_t_uint8 escape_only_p, return ret; } +/* Only to be called if the SCM_PROMPT_SETJMP returns 1 */ +SCM +scm_i_prompt_pop_abort_args_x (SCM prompt) +{ + size_t i, n; + SCM vals = SCM_EOL; + + n = scm_to_size_t (SCM_PROMPT_REGISTERS (prompt)->sp[0]); + for (i = 0; i < n; i++) + vals = scm_cons (SCM_PROMPT_REGISTERS (prompt)->sp[-(i + 1)], vals); + + /* The abort did reset the VM's registers, but then these values + were pushed on; so we need to pop them ourselves. */ + SCM_VM_DATA (scm_the_vm ())->sp -= n + 1; + /* FIXME NULLSTACK */ + + return vals; +} + + #ifdef WORDS_BIGENDIAN #define OBJCODE_HEADER(main,meta) 0, 0, 0, main, 0, 0, 0, meta+8 #define META_HEADER(meta) 0, 0, 0, meta, 0, 0, 0, 0 |