1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-13 07:10:20 +02:00

(Handling Errors): Revise C support section to

get index entries, and clarify parameters.  Remove scm_regex_error, no
longer exists and wasn't available to applications.
This commit is contained in:
Kevin Ryde 2003-05-09 23:08:57 +00:00
parent 9c8721b55e
commit f8a6b8be67

View file

@ -934,41 +934,38 @@ of arguments.
@subsection C Support @subsection C Support
SCM scm_error (SCM key, char *subr, char *message, SCM args, SCM rest) In the following C functions, @var{SUBR} and @var{MESSAGE} parameters
can be @code{NULL} to give the @code{#f} described above.
Throws an error, after converting the char * arguments to Scheme strings. @deftypefn {C Function} SCM scm_error (SCM @var{key}, char *@var{subr}, char *@var{message}, SCM @var{args}, SCM @var{rest})
subr is the Scheme name of the procedure, NULL is converted to #f. Throw an error, as per @code{scm-error} above.
Likewise a NULL message is converted to #f. @end deftypefn
The following procedures invoke scm_error with various error keys and @deftypefn {C Function} void scm_syserror (char *@var{subr})
arguments. The first three call scm_error with the system-error key @deftypefnx {C Function} void scm_syserror_msg (char *@var{subr}, char *@var{message}, SCM @var{args})
and automatically supply errno in the "rest" argument: scm_syserror Throw an error with key @code{system-error} and supply @code{errno} in
generates messages using strerror. Care should be taken that the errno the @var{rest} argument. For @code{scm_syserror} the message is
value is not reset (e.g. due to an interrupt). generated using @code{strerror}.
@itemize @bullet Care should be taken that any code in between the failing operation
@item and the call to these routines doesn't change @code{errno}.
void scm_syserror (char *subr); @end deftypefn
@item
void scm_syserror_msg (char *subr, char *message, SCM args); @deftypefn {C Function} void scm_num_overflow (char *@var{subr})
@item @deftypefnx {C Function} void scm_out_of_range (char *@var{subr}, SCM @var{bad_value})
void scm_num_overflow (char *subr); @deftypefnx {C Function} void scm_wrong_num_args (SCM @var{proc})
@item @deftypefnx {C Function} void scm_wrong_type_arg (char *@var{subr}, int @var{argnum}, SCM @var{bad_value})
void scm_out_of_range (char *subr, SCM bad_value); @deftypefnx {C Function} void scm_memory_error (char *@var{subr})
@item Throw an error with the various keys described above.
void scm_wrong_num_args (SCM proc);
@item For @code{scm_wrong_num_args}, @var{proc} should be a Scheme symbol
void scm_wrong_type_arg (char *subr, int pos, SCM bad_value); which is the name of the procedure incorrectly invoked.
@item @end deftypefn
void scm_memory_error (char *subr);
@item
static void scm_regex_error (char *subr, int code); (only used in rgx.c).
@end itemize
Exception handlers can also be installed from C, using Exception handlers can also be installed from C, using
scm_internal_catch, scm_lazy_catch, or scm_stack_catch from @code{scm_internal_catch}, @code{scm_lazy_catch}, or
libguile/throw.c. These have not yet been documented, however the @code{scm_stack_catch} from @file{libguile/throw.c}. These have not
source contains some useful comments. yet been documented, but the source contains some useful comments.
@c Local Variables: @c Local Variables: