12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- @node Raising exceptions from C
- @section Raising exceptions from C
- The following macros raise certain errors, immediately returning to
- Scheme48. Raising an exception performs all necessary clean-up actions
- to properly return to Scheme48, including adjusting the stack of
- protected variables.
- @deftypefn {C function} {} s48_raise_scheme_exception (int @var{type}, int @var{nargs}, ...)
- The base procedure for raising exceptions. @var{Type} is the type of
- exception; it should be one of the @code{S48_EXCEPTION_@dots{}}
- constants defined in @file{scheme48.h}. @var{Nargs} is the number of
- additional values to be included in the exception; these follow the
- @var{nargs} argument and should all have the type @code{s48_value}.
- @var{Nargs} may not be greater than ten.
- @code{s48_raise_scheme_exception} never returns.
- @end deftypefn
- @deftypefn {C function} {} s48_raise_argument_type_error (s48_value @var{arg})
- @deftypefnx {C function} {} s48_raise_argument_number_error (s48_value @var{nargs}, s48_value @var{min}, s48_value @var{max})
- @deftypefnx {C function} {} s48_raise_range_error (s48_value @var{value}, s48_value @var{min}, s48_value @var{max})
- @deftypefnx {C function} {} s48_raise_closed_channel_error ()
- @deftypefnx {C function} {} s48_raise_os_error (int @var{errno})
- @deftypefnx {C function} {} s48_raise_out_of_memory_error ()
- Conveniences for raising certain kinds of exceptions. Argument type
- errors are due to procedures receiving arguments of the incorrect type.
- Argument number errors are due to the number of arguments being passed
- to a procedure, @var{nargs}, not being between @var{min} or @var{max},
- inclusive. Range errors are similar, but they are intended for larger
- ranges, not argument numbers. Closed channel errors occur when a
- @embedref{Channels, channel} was operated upon with the expectation
- that it would not be closed. OS errors originate from the OS, and they
- are denoted with Unix @code{errno} values.
- @end deftypefn
- @deftypefn {C macro} void S48_CHECK_BOOLEAN (s48_value @var{object})
- @deftypefnx {C macro} void S48_CHECK_SYMBOL (s48_value @var{object})
- @deftypefnx {C macro} void S48_CHECK_PAIR (s48_value @var{object})
- @deftypefnx {C macro} void S48_CHECK_STRING (s48_value @var{object})
- @deftypefnx {C macro} void S48_CHECK_INTEGER (s48_value @var{object})
- @deftypefnx {C macro} void S48_CHECK_CHANNEL (s48_value @var{object})
- @deftypefnx {C macro} void S48_CHECK_BYTE_VECTOR (s48_value @var{object})
- @deftypefnx {C macro} void S48_CHECK_RECORD (s48_value @var{object})
- @deftypefnx {C macro} void S48_CHECK_SHARED_BINDING (s48_value @var{object})
- Conveniences for checking argument types. These signal argument type
- errors with @code{s48_raise_argument_type_error} if their argument is
- not of the type being tested.
- @end deftypefn
|