extern-exn.texi 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. @node Raising exceptions from C
  2. @section Raising exceptions from C
  3. The following macros raise certain errors, immediately returning to
  4. Scheme48. Raising an exception performs all necessary clean-up actions
  5. to properly return to Scheme48, including adjusting the stack of
  6. protected variables.
  7. @deftypefn {C function} {} s48_raise_scheme_exception (int @var{type}, int @var{nargs}, ...)
  8. The base procedure for raising exceptions. @var{Type} is the type of
  9. exception; it should be one of the @code{S48_EXCEPTION_@dots{}}
  10. constants defined in @file{scheme48.h}. @var{Nargs} is the number of
  11. additional values to be included in the exception; these follow the
  12. @var{nargs} argument and should all have the type @code{s48_value}.
  13. @var{Nargs} may not be greater than ten.
  14. @code{s48_raise_scheme_exception} never returns.
  15. @end deftypefn
  16. @deftypefn {C function} {} s48_raise_argument_type_error (s48_value @var{arg})
  17. @deftypefnx {C function} {} s48_raise_argument_number_error (s48_value @var{nargs}, s48_value @var{min}, s48_value @var{max})
  18. @deftypefnx {C function} {} s48_raise_range_error (s48_value @var{value}, s48_value @var{min}, s48_value @var{max})
  19. @deftypefnx {C function} {} s48_raise_closed_channel_error ()
  20. @deftypefnx {C function} {} s48_raise_os_error (int @var{errno})
  21. @deftypefnx {C function} {} s48_raise_out_of_memory_error ()
  22. Conveniences for raising certain kinds of exceptions. Argument type
  23. errors are due to procedures receiving arguments of the incorrect type.
  24. Argument number errors are due to the number of arguments being passed
  25. to a procedure, @var{nargs}, not being between @var{min} or @var{max},
  26. inclusive. Range errors are similar, but they are intended for larger
  27. ranges, not argument numbers. Closed channel errors occur when a
  28. @embedref{Channels, channel} was operated upon with the expectation
  29. that it would not be closed. OS errors originate from the OS, and they
  30. are denoted with Unix @code{errno} values.
  31. @end deftypefn
  32. @deftypefn {C macro} void S48_CHECK_BOOLEAN (s48_value @var{object})
  33. @deftypefnx {C macro} void S48_CHECK_SYMBOL (s48_value @var{object})
  34. @deftypefnx {C macro} void S48_CHECK_PAIR (s48_value @var{object})
  35. @deftypefnx {C macro} void S48_CHECK_STRING (s48_value @var{object})
  36. @deftypefnx {C macro} void S48_CHECK_INTEGER (s48_value @var{object})
  37. @deftypefnx {C macro} void S48_CHECK_CHANNEL (s48_value @var{object})
  38. @deftypefnx {C macro} void S48_CHECK_BYTE_VECTOR (s48_value @var{object})
  39. @deftypefnx {C macro} void S48_CHECK_RECORD (s48_value @var{object})
  40. @deftypefnx {C macro} void S48_CHECK_SHARED_BINDING (s48_value @var{object})
  41. Conveniences for checking argument types. These signal argument type
  42. errors with @code{s48_raise_argument_type_error} if their argument is
  43. not of the type being tested.
  44. @end deftypefn