diff options
author | Andy Wingo <wingo@pobox.com> | 2010-02-24 18:55:34 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-02-24 18:55:34 +0100 |
commit | 3ccee39194a2ae967eb12dd9c0adceeddb305646 (patch) | |
tree | 88b5c2f2b507ec5110d10e3d92449176b45b22ad /libguile/control.c | |
parent | 29366989cf19c844c8d46e456da03466db534ddf (diff) | |
download | guile-3ccee39194a2ae967eb12dd9c0adceeddb305646.tar.gz |
add %default-prompt-tag, and error (not abort()) on an abort to bad tag
* libguile/init.c (scm_i_init_guile): Call scm_init_control after
initing fluids.
* libguile/control.h (scm_sys_default_prompt_tag): New internal var.
* libguile/control.c (scm_c_abort): If abort is called for an unknown
tag, raise an exception, except if the tag was the default prompt tag,
in which case really abort -- to prevent recursion when some other
patches land.
(scm_init_control): Define %default-prompt-tag in the default
environment.
Diffstat (limited to 'libguile/control.c')
-rw-r--r-- | libguile/control.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libguile/control.c b/libguile/control.c index 49a19cf44..05a8dab1e 100644 --- a/libguile/control.c +++ b/libguile/control.c @@ -28,6 +28,9 @@ +SCM scm_sys_default_prompt_tag; + + SCM scm_c_make_prompt (SCM vm, SCM k, scm_t_uint8 escape_only_p, scm_t_int64 vm_cookie) @@ -193,9 +196,13 @@ scm_c_abort (SCM vm, SCM tag, size_t n, SCM *argv, scm_t_int64 cookie) any code that might throw up. */ if (scm_is_false (prompt)) { - /* FIXME: jump to default */ - /* scm_handle_by_message (NULL, key, args); */ - abort (); + if (scm_is_eq (tag, scm_fluid_ref (scm_sys_default_prompt_tag))) + { + fprintf (stderr, "No prompt found for abort to default prompt tag!\n"); + abort (); + } + else + scm_misc_error ("abort", "abort to unknown tag", scm_list_1 (tag)); } cont = reify_partial_continuation (vm, prompt, winds, cookie); @@ -250,9 +257,13 @@ SCM_DEFINE (scm_at_abort, "@abort", 2, 0, 0, (SCM tag, SCM args), } #undef FUNC_NAME -void scm_init_control (void) +void +scm_init_control (void) { #include "control.x" + scm_sys_default_prompt_tag = scm_make_fluid (); + scm_fluid_set_x (scm_sys_default_prompt_tag, scm_gensym (SCM_UNDEFINED)); + scm_c_define ("%default-prompt-tag", scm_sys_default_prompt_tag); } /* |