summaryrefslogtreecommitdiff
path: root/libguile/throw.h
Commit message (Expand)AuthorAgeFilesLines
* scm_spawn_thread uses call-with-new-thread...* libguile/throw.h (scm_i_make_catch_body_closure) (scm_i_make_catch_handler_closure): Add scm_i_ prefix and make available for internal use. * libguile/throw.c: Adapt. * libguile/threads.c (scm_spawn_thread): Rewrite in terms of scm_call_with_new_thread. Andy Wingo2016-11-141-0/+5
* Out-of-memory situations raise exceptions instead of aborting...* libguile/gc.c (scm_oom_fn, scm_init_gc): Install an out-of-memory handler that raises an unwind-only out-of-memory exception. (scm_gc_warn_proc, scm_init_gc): Install a warning proc that tries to print to the current warning port, if the current warning port is a file port. (scm_gc_after_nonlocal_exit): New interface. Should be called after a nonlocal return to potentially collect memory; otherwise allocations could try to expand again when they should collect. * libguile/continuations.c (scm_i_make_continuation): * libguile/eval.c (eval): * libguile/throw.c (catch): * libguile/vm.c (scm_call_n): Call scm_gc_after_nonlocal_exit after nonlocal returns. * libguile/throw.c (abort_to_prompt, throw_without_pre_unwind): Rework to avoid allocating memory. (scm_report_out_of_memory): New interface. (scm_init_throw): Pre-allocate the arguments for stack-overflow and out-of-memory errors. * module/ice-9/boot-9.scm: Add an out-of-memory exception printer. * module/system/repl/error-handling.scm (call-with-error-handling): Add out-of-memory to the report-keys set. * libguile/gc-malloc.c (scm_realloc): Call scm_report_out_of_memory if realloc fails. * libguile/error.h: * libguile/error.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_memory_error): Deprecate. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-out-of-memory: New test case. Andy Wingo2014-03-221-0/+4
* Unwind-only stack overflow exceptions...* module/ice-9/boot-9.scm (catch): Signal an early error if the handler or pre-unwind handler types aren't right. This is more important than it was, given that we dispatch on type now when finding matching catch clauses. * libguile/vm.c (vm_expand_stack): Use the standard scm_report_stack_overflow to signal stack overflow. This will avoid running pre-unwind handlers. * libguile/throw.h: Move scm_report_stack_overflow here. * libguile/throw.c (catch): Define a version of catch in C. (throw_without_pre_unwind): New helper. Besides serving as the pre-boot "throw" binding, it allows stack overflow to throw without running pre-unwind handlers. (scm_catch, scm_catch_with_pre_unwind_handler) (scm_with_throw_handler): Use the new catch in C. (scm_report_stack_overflow): Moved from stackchk.c; throws an unwind-only exception. * libguile/stackchk.h: * libguile/stackchk.c: Remove the scm_report_stack_overflow bits. Andy Wingo2014-02-201-1/+5
* Don't use the identifier 'noreturn'....Fixes <http://bugs.gnu.org/15798>. Reported by Matt Sicker <boards@gmail.com>. * libguile/__scm.h (SCM_NORETURN): Use ((__noreturn__)) instead of ((noreturn)). * libguile/throw.h (scm_ithrow): Rename formal parameter from 'noreturn' to 'no_return'. * libguile/throw.c (scm_ithrow): Rename formal parameter from 'noreturn' to 'no_return'. Mark H Weaver2013-11-041-1/+1
* deprecate the-last-stack...* libguile/backtrace.h (scm_the_last_stack_fluid_var) * libguile/backtrace.c (scm_init_backtrace): No more scm_the_last_stack_fluid_var. The replacement is to resolve `the-last-stack' in (ice-9 stack-catch). (scm_backtrace_with_highlights): Accordingly, instead of backtracing the last stack, backtrace the current stack. * libguile/throw.h: * libguile/throw.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_internal_stack_catch): Deprecate this function. * module/ice-9/save-stack.scm (the-last-stack): Move here from boot-9. * module/ice-9/debug.scm: * module/ice-9/debugger.scm: Use (ice-9 save-stack) for the-last-stack. * module/ice-9/deprecated.scm (the-last-stack): Add deprecated shim. Andy Wingo2010-06-191-7/+1
* deprecate lazy-catch...* libguile/deprecated.h: * libguile/deprecated.c (scm_internal_lazy_catch, scm_lazy_catch): Deprecate, and print out a nasty warning that people should change to with-throw-handler. * libguile/throw.h: * libguile/throw.c (scm_c_with_throw_handler): Deprecate the use of the lazy_catch_p argument, printing out a nasty warning if someone actually passes 1 as that argument. The combination of the pre-unwind and post-unwind handlers should be sufficient. * test-suite/tests/exceptions.test: Remove lazy-catch tests, as they are deprecated. Two of them fail: * throw/catch: effect of lazy-catch unwinding on throw to another key * throw/catch: repeat of previous test but with lazy-catch Hopefully people are not depending on this behavior, and the warning is sufficiently nasty for people to switch. We will see. * test-suite/tests/eval.test ("promises"): Use with-throw-handler instead of lazy-catch. * doc/ref/api-debug.texi: * doc/ref/api-control.texi: Update to remove references to lazy-catch, folding in the useful bits to with-throw-handler. Andy Wingo2010-02-261-7/+0
* Change Guile license to LGPLv3+...(Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* ) Neil Jerram2009-06-171-6/+7
* Add `SCM_INTERNAL' macro, use it.Ludovic Courtès2008-05-311-2/+2
* merge from 1.8 branchKevin Ryde2006-04-171-1/+1
* * 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. Neil Jerram2006-02-041-0/+17
* The FSF has a new address.Marius Vollmer2005-05-231-1/+1
* Changed license terms to the plain LGPL thru-out.Marius Vollmer2003-04-051-35/+11
* Prefixed each each exported symbol with SCM_API.Marius Vollmer2001-11-021-29/+29
* * Renamed header macros to the SCM_<filename>_H format.Dirk Herrmann2001-08-311-7/+10
* replace "scm_*_t" with "scm_t_*".Marius Vollmer2001-06-141-8/+8
* Updated copyrightsMikael Djurfeldt2000-06-121-1/+1
* * *.[hc]: add Emacs magic at the end of file, to ensure GNU... indentation style. Michael Livshin2000-03-191-0/+6
* * list.c: Moved append docs to append! Thanks Dirk Hermann. Also,...added append docs from R4RS. * strings.c: Docstring typo fix, + eliminate unneeded IMP tests. Thanks Dirk Hermann! * chars.h: Provide SCM_CHARP, SCM_CHAR, SCM_MAKE_CHAR and deprecate SCM_ICHRP, SCM_ICHR, SCM_MAKICHR. Thanks Dirk Hermann! * *.h, *.c: Use SCM_CHARP, SCM_CHAR, SCM_MAKE_CHAR throughout. Drop use of SCM_P for function prototypes... assume an ANSI C compiler. Thanks Dirk Hermann! Greg J. Badros2000-03-021-30/+30
* * __scm.h, alist.c, async.c, async.h, backtrace.h, chars.c,...continuations.c, debug.c, debug.h, dynl-dl.c, dynl.c, dynl.h, dynwind.c, dynwind.h, eq.c, error.c, error.h, eval.c, eval.h, feature.c, filesys.c, filesys.h, fports.c, fports.h, gc.c, gc.h, genio.c, genio.h, gh.h, gh_data.c, gsubr.c, gsubr.h, hash.c, hashtab.c, init.c, init.h, ioext.c, ioext.h, kw.c, libguile.h, list.c, list.h, load.c, load.h, mallocs.c, markers.c, mit-pthreads.c, net_db.c, numbers.c, numbers.h, options.c, ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c, procprop.h, procs.c, procs.h, ramap.c, ramap.h, regex-posix.c, regex-posix.h, root.c, root.h, scmsigs.c, scmsigs.h, script.c, script.h, simpos.c, simpos.h, smob.c, smob.h, snarf.h, socket.c, srcprop.c, stackchk.c, stackchk.h, stacks.c, stime.c, stime.h, strings.c, strings.h, strports.c, struct.c, struct.h, symbols.c, symbols.h, tags.h, threads.c, throw.h, unif.c, variable.c, vectors.c, vectors.h, version.h, vports.c, weaks.c: Update copyright years. Jim Blandy1998-10-191-1/+1
* * throw.c, throw.h (scm_handle_by_throw): New function: This...handler throws errors to next handler on the dynwind chain. Mikael Djurfeldt1998-05-111-0/+1
* * throw.h: Removed jmpbuf arg in scm_catch_body_t....* backtrace.c (display_error_body, display_backtrace_body), coop-threads.c (scheme_body_bootstrip, c_body_bootstrip), gh_eval.c (eval_str_wrapper, eval_file_wrapper), init.c (invoke_main_func), root.c (cwdr_body), throw.c (cwss_body, scm_body_thunk, hbpca_body): Removed the second jmpbuf arg on body functions. * throw.c (scm_internal_catch, scm_internal_lazy_catch): Bodies don't receive the jmpbuf arg anylonger. (scm_catch): Don't accept a #f tag. (scm_throw): Check that key is a symbol. (scm_ithrow): Don't take a jmpbuf as key. Don't check key arg. Mikael Djurfeldt1998-02-021-2/+2
* * throw.h (scm_handle_by_proc_catching_all): New prototype...throw.c (scm_handle_by_proc_catching_all): New function Marius Vollmer1997-10-021-0/+1
* * * gh_eval.c (catch_with_saved_stack): Removed. Replaced by:... throw.c (scm_internal_stack_catch): New sibling to the other catch functions. Code moved from gh_eval.c. throw.h: Added header. gh_eval.c (gh_eval_str_with_stack_saving_handler): Renamed call to scm_internal_stack_catch. Mikael Djurfeldt1997-08-131-0/+6
* * root.c: Establish a reliable catch-all handler for the new root....After all the Scheme handler function might signal an error too, and we don't want to lose that. (cwdr_inner_body): Renamed from cwdr_body. (cwdr_outer_body): New function, to establish the user's handler, and pass control to cwdr_inner_body. (cwdr): Establish the reliable catch-all handler here, and pass control to cwdr_outer_body. (struct cwdr_body_data): New field, handler, to allow cwdr to pass the user's handler through to cwdr_outer_body. * throw.c (scm_handle_by_message): Move guts into.... (handler_message): New static function. (scm_handle_by_message_noexit): New function. * throw.h (scm_handle_by_message_noexit): New prototype. Jim Blandy1997-06-231-0/+1
* * Lots of files: New address for FSF.Jim Blandy1997-05-261-3/+3
* * throw.h: prototype for scm_exit_status....* throw.c (scm_handle_by_message): if a 'quit is caught, use its args to derive an exit status. Allows (quit) to work from a script. (scm_exit_status): new function. #include "eq.h". Gary Houston1997-03-021-0/+2
* * throw.c (scm_internal_lazy_catch): New function....(scm_lazy_catch): Rewritten to use it. (scm_ithrow): Handle the new lazy catch representation. Use SCM_LAZY_CATCH_P, instead of assuming that any wind list entry that doesn't have a jmpbuf is a lazy catch clause. (tc16_lazy_catch, struct lazy_catch, mark_lazy_catch, free_lazy_catch, print_lazy_catch, lazy_catch_funs, make_lazy_catch, SCM_LAZY_CATCH_P): Support funs, including a new smob. (scm_init_throw): Register the new lazy-catch smob type. * throw.h (scm_internal_lazy_catch): decl for new function. Jim Blandy1997-02-071-0/+6
* * throw.c (scm_internal_catch): Make body funcs and handler funcs...use separate data pointers, to allow them to be designed independently and reused. (scm_body_thunk, scm_handle_by_proc, scm_handle_by_message): Renamed from catch_body, catch_handler, and uncaught_throw; made generically useful. (struct scm_catch_body_data): Renamed from catch_body_data; moved to throw.h. (scm_catch): Use the above. (scm_throw): Don't bother printing a message for an uncaught throw; we establish a default handler in init. * throw.h (scm_internal_catch): Prototype updated. (scm_body_thunk, scm_handle_by_proc, scm_handle_by_message): New decls. (struct scm_body_thunk_data): New structure, used as data argument to scm_body_thunk. * init.c (struct main_func_closure): New structure, packaging up the data to pass to the user's main function. (scm_boot_guile): Create one. Pass it to scm_boot_guile_1. (scm_boot_guile_1): Pass it through to invoke_main_func. Use scm_internal_catch to establish a catch-all handler, using scm_handle_by_message. This replaces the special-case code in scm_throw. (invoke_main_func): Body function for scm_internal_catch; invoke the user's main function, using the main_func_closure pointer to decide what to pass it. * root.c (struct cwdr_body_data): Remove handler_proc member. (cwdr): Use scm_handle_by_proc instead of cwdr_handler. (cwdr_handler): Removed. Jim Blandy1996-12-211-1/+22
* Add new interface to catch/throw, usable from C as well as...Scheme. * throw.h (scm_catch_body_t, scm_catch_handler_t): New types. (scm_internal_catch): New function, replaces... (scm_catch_apply): Deleted. * throw.c (scm_catch_apply): Deleted; replaced with a more general mechanism which is a bit more code, but can be used nicely from C and implement the Scheme semantics as well. (scm_internal_catch): This is the replacement; it's named after the analogous function in Emacs. (scm_catch): Reimplemented in terms of the above. (struct catch_body_data, catch_body, catch_handler): New functions, used by scm_catch. * root.c (cwdr): Reimplemented in terms of scm_internal_catch. (struct cwdr_body_data, cwdr_body, cwdr_handler): New functions; support for new cwdr. Jim Blandy1996-12-091-1/+9
* * throw.h (scm_catch_apply): Removed the `lazyp' argument.Mikael Djurfeldt1996-10-061-1/+1
* * throw.h: Added prototypes for scm_catch_apply and...scm_lazy_catch. Mikael Djurfeldt1996-10-051-0/+2
* * root.c: Added #include "genio.h", #include "smob.h", #include..."pairs.h", #include "throw.h", #include "dynwind.h", #include "eval.h" (scm_init_root): Added #include "root.x". Mikael Djurfeldt1996-10-011-0/+1
* * throw.h, throw.c: Use SCM_P instead of #if hair.Jim Blandy1996-09-281-17/+4
* * alist.h, append.h, arbiters.h, async.h, boolean.h, chars.h,...continuations.h, debug.h, dynwind.h, error.h, eval.h, fdsocket.h, feature.h, filesys.h, fports.h, gc.h, gdbint.h, genio.h, gsubr.h, hash.h, init.h, ioext.h, kw.h, list.h, markers.h, marksweep.h, mbstrings.h, numbers.h, objprop.h, options.h, pairs.h, ports.h, posix.h, print.h, procprop.h, procs.h, ramap.h, read.h, root.h, sequences.h, smob.h, socket.h, srcprop.h, stackchk.h, stime.h, strings.h, strop.h, strorder.h, strports.h, struct.h, symbols.h, tag.h, throw.h, unif.h, variable.h, vectors.h, version.h, vports.h, weaks.h: #include "libguile/__scm.h", not <libguile/__scm.h>. This allows 'gcc -MM' to determine which dependencies are within libguile properly. Jim Blandy1996-09-051-1/+1
* Don't install the unwashed masses of Guile header files in the...main #include path; put most of them in a subdirectory called 'libguile'. This avoids naming conflicts between Guile header files and system header files (of which there were a few). * Makefile.in (pkgincludedir): Deleted. (innerincludedir): New variable; this and $(includedir) are enough. (INCLUDE_CFLAGS): Search for headers in "-I$(srcdir)/..". (installed_h_files): Divide this up. Now this variable lists those header files which should go into $(includedir) (i.e. appear directly in the #include path), and ... (inner_h_files): ... this new variable says which files appear in a subdirectory, and are referred to as <libguile/mumble.h>. (h_files): List them both. (install): Create innerincludedir, not pkgincludedir. Put the installed_h_files and inner_h_files in their proper places. (uninstall): Corresponding changes. * alist.h, append.h, arbiters.h, async.h, boolean.h, chars.h, continuations.h, debug.h, dynwind.h, error.h, eval.h, fdsocket.h, feature.h, fports.h, gc.h, genio.h, gsubr.h, hash.h, init.h, ioext.h, kw.h, libguile.h, list.h, markers.h, marksweep.h, mbstrings.h, numbers.h, options.h, pairs.h, ports.h, posix.h, print.h, procprop.h, procs.h, ramap.h, read.h, root.h, sequences.h, smob.h, socket.h, srcprop.h, stackchk.h, stime.h, strings.h, strop.h, strorder.h, strports.h, struct.h, symbols.h, tag.h, throw.h, unif.h, variable.h, vectors.h, version.h, vports.h, weaks.h: Find __scm.h in its new location. * __scm.h: Find scmconfig.h and tags.h in their new locations (they're both "inner" files). Jim Blandy1996-09-041-1/+1
* maintainer changed: was lord, now jimb; first importJim Blandy1996-07-251-0/+67