Next: Unsafe C macros, Previous: Using Scheme records in C, Up: C interface
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.
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 types48_value
. Nargs may not be greater than ten.s48_raise_scheme_exception
never returns.
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 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.
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.