From f4ca107f7fe0b6f1ca2c03b558f16077fc89db04 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Fri, 8 Nov 2019 15:31:00 +0100 Subject: Rebase throw/catch on top of raise-exception/with-exception-handler * libguile/exceptions.c: * libguile/exceptions.h: New files. * libguile.h: Add exceptions.h. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (DOT_X_FILES, DOT_DOC_FILES, modinclude_HEADERS): Add exceptions.c and exceptions.h. * libguile/init.c (scm_i_init_guile): Initialize exceptions. * libguile/threads.c (scm_spawn_thread): Use new names for scm_i_make_catch_handler and scm_c_make_thunk. * libguile/throw.c: Rewrite to be implemented in terms of with-exception-handler / raise-exception. * libguile/throw.h: Use data types from exceptions.h. Move scm_report_stack_overflow and scm_report_out_of_memory to exceptions.[ch]. * module/ice-9/boot-9.scm (&error, &programming-error) (&non-continuable, make-exception-from-throw, raise-exception) (with-exception-handler): New top-level definitions. (throw, catch, with-throw-handler): Rewrite in terms of with-exception-handler and raise-exception. : New top-level definitions. * module/ice-9/exceptions.scm: Adapt to re-export &error, &programming-error, &non-continuable, raise-exception, and with-exception-handler from boot-9. (make-quit-exception, guile-quit-exception-converter): New exception converters. (make-exception-from-throw): Override core binding. * test-suite/tests/eval.test ("inner trim with prompt tag"): Adapt to "with-exception-handler" being the procedure on the stack. ("outer trim with prompt tag"): Likewise. * test-suite/tests/exceptions.test (throw-test): Use pass-if-equal. * module/srfi/srfi-34.scm: Reimplement in terms of core exceptions, and make "guard" actually re-raise continuations with the original "raise" continuation. --- libguile/threads.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libguile/threads.c') diff --git a/libguile/threads.c b/libguile/threads.c index 86ac5e84b..280d306bf 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -821,9 +821,9 @@ scm_spawn_thread (scm_t_catch_body body, void *body_data, { SCM body_closure, handler_closure; - body_closure = scm_i_make_catch_body_closure (body, body_data); + body_closure = scm_c_make_thunk (body, body_data); handler_closure = handler == NULL ? SCM_UNDEFINED : - scm_i_make_catch_handler_closure (handler, handler_data); + scm_i_make_catch_handler (handler, handler_data); return scm_call_with_new_thread (body_closure, handler_closure); } -- cgit v1.2.3