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.
srcprop.h, tags.h, throw.c, unif.c: Added new selectors
SCM_SETAND_CAR, SCM_SETAND_CDR, SCM_SETOR_CAR and SCM_SETOR_CDR.
Motivation: Safer use. Some other macros are defined in terms of
these operations. If these are defined using the SCM_SETCXR
(<e1>, SCM_CXR (<e1>) <op> <e2>) pattern a complex <e1> will lead
to inefficiency and an <e1> with side-effects could potentially
break. Also, these particular operations are heavily utilized in
the garbage collector. In unoptimized code there will be a
measurable speedup.
* alist.c, arbiters.c, continuations.c, debug.c, debug.h, eval.c,
eval.h, feature.c, filesys.c, fports.c, gc.c, gsubr.c, init.c,
ioext.c, kw.c, list.c, load.c, mallocs.c, numbers.c, numbers.h,
pairs.c, pairs.h, ports.c, ports.h, posix.c, procprop.c, procs.c,
procs.h, ramap.c, read.c, root.c, srcprop.c, srcprop.h,
strports.c, symbols.c, tags.h, throw.c, unif.c, variable.c,
vports.c: Cleaned up use of pairs: Don't make any special
assumptions about the internal structure of selectors and
mutators: SCM_CXR (<e1>) = <e2> --> SCM_SETCXR (<e1>, <e2>),
SCM_CXR (<e1>) &= <e2> --> SCM_SETAND_CXR (<e1>, <e2>) etc.
(Among other things, this change makes it easier to build Guile
with certain compilers which have problems with casted lvalues.)
throw.c: Renamed last_debug_info_frame -> scm_last_debug_frame.
* throw.c: Renamed scm_catch --> scm_catch_apply and added more
arguments. The motivation is that code in root.c needs catch
functionality, and we want to avoid code duplication.
New functions: scm_catch, scm_lazy_catch. These are wrappers for
scm_catch_apply. scm_lazy_catch is intended to introduce catch
handlers that run without popping the stack into the dynwind
chain.
see if a given element of scm_dynwinds is a valid catch.
* throw.c (scm_ithrow): If scm_dynwinds has invalid list
structure, abort; don't just silently ignore the garbage.
(scm_catch): Changed SCM_DEFER_INTS --> SCM_REDEFER_INTS and
SCM_ALLOW_INTS --> SCM_REALLOW_INTS. This is so that scm_catch
can be used in scm_call_with_new_root; Added reenabling of stack
checking when catching a throw.
Remove special support for uncaught throws; see throw.c for
rationale.
* throw.c (unhandled_throw): New function.
(scm_ithrow): Call unhandled_throw if we don't find a throw
target; don't mess with scm_bad_throw_vcell.
(scm_bad_throw_vcell): Variable deleted.
(scm_init_throw): Don't initialize it.
* throw.c (scm_ithrow): Don't let outer key matches shadow inner
#t catches.