diff options
author | Neil Jerram <neil@ossau.uklinux.net> | 2006-02-04 14:36:24 +0000 |
---|---|---|
committer | Neil Jerram <neil@ossau.uklinux.net> | 2006-02-04 14:36:24 +0000 |
commit | 43e01b1ee350c823505d1397a306c8e1bfa31469 (patch) | |
tree | 79b5adf203e10c0895b8ba176476ef7e060fe080 /libguile/continuations.c | |
parent | 56658166b254d901670952bb183310063c148d3c (diff) | |
download | guile-43e01b1ee350c823505d1397a306c8e1bfa31469.tar.gz |
* throw.h (scm_c_catch, scm_c_with_throw_handler,
scm_catch_with_pre_unwind_handler, scm_with_throw_handler): New.
* throw.c (SCM_JBPREUNWIND, SCM_SETJBPREUNWIND): New.
(struct pre_unwind_data): New, replaces struct lazy_catch.
(scm_c_catch): New, replaces scm_internal_catch as the primary
catch API for C code; adds pre-unwind handler support.
(scm_internal_catch): Now just a wrapper for scm_c_catch, for back
compatibility.
(tc16_pre_unwind_data, pre_unwind_data_print,
make_pre_unwind_data, SCM_PRE_UNWIND_DATA_P): Renamed from
"lazy_catch" equivalents.
(scm_c_with_throw_handler): New, replaces scm_internal_lazy_catch
as the primary C API for a "lazy" catch.
(scm_internal_lazy_catch): Now just a wrapper for
scm_c_with_throw_handler, for back compatibility.
(scm_catch_with_pre_unwind_handler): Renamed from scm_catch; adds
pre-unwind handler support.
(scm_catch): Now just a wrapper for
scm_catch_with_pre_unwind_handler, for back compatibility.
(scm_with_throw_handler): New.
(scm_lazy_catch): Update comment to say that the handler can
return, and what happens if it does.
(toggle_pre_unwind_running): New.
(scm_ithrow): When identifying the throw target, take running
flags into account. In general, change naming of things from
"lazy_catch" to "pre_unwind". When throwing to a throw handler,
don't unwind the dynamic context first. Add dynwind framing to
manage the running flag of a throw handler. If a lazy catch or
throw handler returns, rethrow the same exception again. Add
pre-unwind support to the normal catch case (SCM_JMPBUFP).
* root.c (scm_internal_cwdr): Add NULL args to
scm_i_with_continuation_barrier call.
* dynwind.c: Change comment mentioning lazy-catch to mention
pre-unwind data and throw handler also.
* continuations.h (scm_i_with_continuation_barrier): Add
pre-unwind handler args.
* continuations.c (scm_i_with_continuation_barrier): Add
pre-unwind handler args, and pass on to scm_c_catch (changed from
scm_internal_catch).
(c_handler): Remove scm_handle_by_message_noexit call.
(scm_c_with_continuation_barrier): Call
scm_i_with_continuation_barrier with scm_handle_by_message_noexit
as the pre-unwind handler.
(scm_handler): Remove scm_handle_by_message_noexit call.
(s_scm_with_continuation_barrier): Call
scm_i_with_continuation_barrier with scm_handle_by_message_noexit
as the pre-unwind handler.
Diffstat (limited to 'libguile/continuations.c')
-rw-r--r-- | libguile/continuations.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libguile/continuations.c b/libguile/continuations.c index 20ddd27ff..06b0fb251 100644 --- a/libguile/continuations.c +++ b/libguile/continuations.c @@ -312,7 +312,9 @@ SCM scm_i_with_continuation_barrier (scm_t_catch_body body, void *body_data, scm_t_catch_handler handler, - void *handler_data) + void *handler_data, + scm_t_catch_handler pre_unwind_handler, + void *pre_unwind_handler_data) { SCM_STACKITEM stack_item; scm_i_thread *thread = SCM_I_CURRENT_THREAD; @@ -333,9 +335,10 @@ scm_i_with_continuation_barrier (scm_t_catch_body body, /* Call FUNC inside a catch all. This is now guaranteed to return directly and exactly once. */ - result = scm_internal_catch (SCM_BOOL_T, - body, body_data, - handler, handler_data); + result = scm_c_catch (SCM_BOOL_T, + body, body_data, + handler, handler_data, + pre_unwind_handler, pre_unwind_handler_data); /* Return to old continuation root. */ @@ -364,7 +367,6 @@ static SCM c_handler (void *d, SCM tag, SCM args) { struct c_data *data = (struct c_data *)d; - scm_handle_by_message_noexit (NULL, tag, args); data->result = NULL; return SCM_UNSPECIFIED; } @@ -376,7 +378,8 @@ scm_c_with_continuation_barrier (void *(*func) (void *), void *data) c_data.func = func; c_data.data = data; scm_i_with_continuation_barrier (c_body, &c_data, - c_handler, &c_data); + c_handler, &c_data, + scm_handle_by_message_noexit, NULL); return c_data.result; } @@ -394,7 +397,6 @@ scm_body (void *d) static SCM scm_handler (void *d, SCM tag, SCM args) { - scm_handle_by_message_noexit (NULL, tag, args); return SCM_BOOL_F; } @@ -415,7 +417,8 @@ SCM_DEFINE (scm_with_continuation_barrier, "with-continuation-barrier", 1,0,0, struct scm_data scm_data; scm_data.proc = proc; return scm_i_with_continuation_barrier (scm_body, &scm_data, - scm_handler, &scm_data); + scm_handler, &scm_data, + scm_handle_by_message_noexit, NULL); } #undef FUNC_NAME |