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.

 -- C function: s48_raise_scheme_exception (int TYPE, int NARGS, ...)
     The base procedure for raising exceptions.  TYPE is the type of exception; it should be one of the S48_EXCEPTION_... constants defined in scheme48.h.  NARGS is the number of additional values to be included in the exception; these follow the NARGS argument and should all have the type s48_value. NARGS may not be greater than ten. s48_raise_scheme_exception never returns.

 -- C function: s48_raise_argument_type_error (s48_value ARG)
 -- C function: s48_raise_argument_number_error (s48_value NARGS, s48_value MIN, s48_value MAX)
 -- C function: s48_raise_range_error (s48_value VALUE, s48_value MIN, s48_value MAX)
 -- C function: s48_raise_closed_channel_error ()
 -- C function: s48_raise_os_error (int ERRNO)
 -- 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, NARGS, not being between MIN or MAX, inclusive.  Range errors are similar, but they are intended for larger ranges, not argument numbers.  Closed channel errors occur when a 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 errno values.

 -- C macro: void S48_CHECK_BOOLEAN (s48_value OBJECT)
 -- C macro: void S48_CHECK_SYMBOL (s48_value OBJECT)
 -- C macro: void S48_CHECK_PAIR (s48_value OBJECT)
 -- C macro: void S48_CHECK_STRING (s48_value OBJECT)
 -- C macro: void S48_CHECK_INTEGER (s48_value OBJECT)
 -- C macro: void S48_CHECK_CHANNEL (s48_value OBJECT)
 -- C macro: void S48_CHECK_BYTE_VECTOR (s48_value OBJECT)
 -- C macro: void S48_CHECK_RECORD (s48_value OBJECT)
 -- C macro: void S48_CHECK_SHARED_BINDING (s48_value OBJECT)
     Conveniences for checking argument types.  These signal argument type errors with s48_raise_argument_type_error if their argument is not of the type being tested.