void scheme_signal_error(char *msg, ...)
Raises a generic primitive exception. The parameters are as for printf.
void scheme_raise_exn(int exnid, ...)
Raises a specific primitive exception. The exnid argument specifies the exception to be raised. If an instance of that exception has n fields, then the next n-2 arguments are values for those fields (skipping the message and debug-info fields). The remaining arguments start with an error string and proceed as for printf.
Exception ids are #defined using the same names as in Scheme, but prefixed with ``MZ'', all letters are capitalized, and all ``:'s', ``-''s, and ``/''s are replaced with underscores. For example, MZEXN_I_O_FILESYSTEM_DIRECTORY is the exception id for the bad directory pathname exception.
void scheme_warning(char *msg, ...)
Signals a warning. The parameters are as for printf.
void scheme_wrong_count(char *name, int minc, int maxc, int argc, Scheme_Object **argv)
This function is automatically invoked when the wrong number of arguments are given to a primitive procedure. It signals that the wrong number of parameters was received and escapes (like scheme_signal_error). The name argument is the name of the procedure that was given the wrong number of arguments; minc is the minimum number of expected arguments; maxc is the maximum number of expected arguments, or -1 if there is no maximum; argc and argv contain all of the received arguments.
void scheme_wrong_type(char *name, char *expected, int which, int argc, Scheme_Object **argv)
Signals that an argument of the wrong type was received, and escapes (like scheme_signal_error). name is the name of the procedure that was given the wrong type of argument; expected is the name of the expected type; which is the offending argument in the argv array; argc and argv contain all of the received arguments. If the original argc and argv are not available, provide -1 for which and a pointer to the bad value in argv; argc is ignored in this case.
void scheme_wrong_return_arity(char *name, int expected, int got, Scheme_Object **argv, const char *detail, )
Signals that the wrong number of values were returned to a multiple-values context. The expected argument indicates how many values were expected, got indicates the number received, and argv are the received values. The detail string can be NULL or it can contain a printf-style string (with additional arguments) to describe the context of the error.
void scheme_unbound_global(char *name)
Signals an unbound-variable error, where name is the name of the variable.
char *scheme_make_provided_string( Scheme_Object *o, int count, int *len)
Converts a Scheme value into a string for the purposes of reporting an error message. The count argument specifies how many Scheme values total will appear in the error message (so the string for this value can be scaled appropriately). If len is not NULL, it is filled with the length of the returned string.
char *scheme_make_args_string(char *s, int which, int argc, Scheme_Object **argv)
Converts an array of Scheme values into a string, skipping the array element indicated by which. This function is used to specify the ``other'' arguments to a function when one argument is bad (thus giving the user more information about the state of the program when the error occurred).
void scheme_check_proc_arity(char *where, int a, int which, int argc, Scheme_Object **argv)
Checks the whichth argument in argv to make sure it is a procedure that can take a arguments. If there is an error, the where, which, argc, and argv arguments are passed on to scheme_wrong_type. As in scheme_wrong_type, which can be -1, in which case *argv is checked.
Scheme_Object *scheme_dynamic_wind( void (*pre)(void *data), Scheme_Object *(*action)(void *data), void (*post)(void *data), Scheme_Object *(*jmp_handler)(void *data), void *data)
Evaluates calls the function action to get a value for the scheme_dynamic_wind call. The functions pre and post are invoked when jumping into and out of action, repsectively.
The function jmp_handler is called when an error is signaled (or an escaping continuation is invoked) duirng the call to action; if jmp_handler returns NULL, then the error is passed on to the next error handler, otherwise the return value is used as the return value for the scheme_dynamic_wind call.
The pointer data can be anything; it is passed along in calls to action, pre, post, and jmp_handler.