1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 01:00:20 +02:00

rewinding prompts works

* libguile/control.h (SCM_PROMPT_HANDLER): Remove, it was unused.
  (SCM_PROMPT_DYNWINDS): Rename from SCM_PROMPT_DYNENV.

* libguile/control.c: (scm_c_make_prompt): Take another arg, the winds
  that are to be in place for the prompt. Fix allocation to be 4 words
  instead of 5 (the handler was never used).

* libguile/eval.c (eval):
* libguile/throw.c (pre_init_catch): Adapt to scm_c_make_prompt change.

* libguile/vm-i-system.c (partial-cont-call): Grovel the new elements of
  the wind list in order to call setjmp() on the new prompts. Pass
  cookie to vm_reinstate_partial_continuation.
  (prompt): Adapt to scm_c_make_prompt change.

* libguile/vm.c (vm_reinstate_partial_continuation): Take a cookie arg,
  used when winding captured prompts onto the stack. Winding a prompt
  implies making a new prompt, actually -- with new registers, a new
  jump buffer, new winds, etc.

* test-suite/tests/control.test ("rewinding prompts"): Add a test for
  rewinding prompts.
This commit is contained in:
Andy Wingo 2010-02-26 13:05:25 +01:00
parent 416f26c753
commit adbdfd6d24
7 changed files with 58 additions and 23 deletions

View file

@ -33,16 +33,15 @@ SCM scm_sys_default_prompt_tag;
SCM
scm_c_make_prompt (SCM k, SCM *fp, SCM *sp, scm_t_uint8 *abort_ip,
scm_t_uint8 escape_only_p, scm_t_int64 vm_cookie)
scm_t_uint8 escape_only_p, scm_t_int64 vm_cookie,
SCM winds)
{
scm_t_bits tag;
SCM ret;
struct scm_prompt_registers *regs;
tag = scm_tc7_prompt;
if (escape_only_p)
tag |= (SCM_F_PROMPT_ESCAPE<<8);
ret = scm_words (tag, 5);
regs = scm_gc_malloc_pointerless (sizeof (*regs), "prompt registers");
regs->fp = fp;
@ -50,11 +49,8 @@ scm_c_make_prompt (SCM k, SCM *fp, SCM *sp, scm_t_uint8 *abort_ip,
regs->ip = abort_ip;
regs->cookie = vm_cookie;
SCM_SET_CELL_OBJECT (ret, 1, k);
SCM_SET_CELL_WORD (ret, 2, (scm_t_bits)regs);
SCM_SET_CELL_OBJECT (ret, 3, scm_i_dynwinds ());
return ret;
return scm_double_cell (tag, SCM_UNPACK (k), (scm_t_bits)regs,
SCM_UNPACK (winds));
}
/* Only to be called if the SCM_PROMPT_SETJMP returns 1 */