The following macros explicitly raise certain errors, immediately returning to Scheme 48. Raising an exception performs all necessary clean-up actions to properly return to Scheme 48, including adjusting the stack of protected variables.
s48_raise_scheme_exception(int type, int nargs, ...)
s48_raise_scheme_exception
is the base procedure for
raising exceptions.
type
is the type of exception, and should be one of the
S48_EXCEPTION_
...constants defined in scheme48arch.h
.
nargs
is the number of additional values to be included in the
exception; these follow the nargs
argument and should all have
type s48_value
.
s48_raise_scheme_exception
never returns.
The following procedures are available for raising particular
types of exceptions.
Like s48_raise_scheme_exception
these never return.
s48_raise_argument_type_error(scheme_value)
s48_raise_argument_number_error(int nargs, int min, int max)
s48_raise_range_error(long value, long min, long max)
s48_raise_closed_channel_error()
s48_raise_os_error(int errno)
s48_raise_out_of_memory_error()
An argument type error indicates that the given value is of the wrong
type.
An argument number error is raised when the number of arguments, nargs
,
should be, but isn't, between min
and max
, inclusive.
Similarly, a range error indicates that value
is not between
between min
and max
, inclusive.
The following macros raise argument type errors if their argument does not
have the required type.
S48_CHECK_BOOLEAN
raises an error if its argument is neither
#t
or #f
.
void S48_CHECK_BOOLEAN(s48_value)
void S48_CHECK_SYMBOL(s48_value)
void S48_CHECK_PAIR(s48_value)
void S48_CHECK_STRING(s48_value)
void S48_CHECK_INTEGER(s48_value)
void S48_CHECK_CHANNEL(s48_value)
void S48_CHECK_BYTE_VECTOR(s48_value)
void S48_CHECK_RECORD(s48_value)
void S48_CHECK_SHARED_BINDING(s48_value)
Previous: Using Scheme records in C code | Next: Unsafe functions and macros