DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(guile.info.gz) Signalling Type Errors

Info Catalog (guile.info.gz) Non-immediate Datatypes (guile.info.gz) How Guile does it (guile.info.gz) Unpacking the SCM type
 
 18.2.6 Signalling Type Errors
 -----------------------------
 
 Every function visible at the Scheme level should aggressively check the
 types of its arguments, to avoid misinterpreting a value, and perhaps
 causing a segmentation fault.  Guile provides some macros to make this
 easier.
 
  -- Macro: void SCM_ASSERT (int TEST, SCM OBJ, unsigned int POSITION,
           const char *SUBR)
      If TEST is zero, signal a "wrong type argument" error, attributed
      to the subroutine named SUBR, operating on the value OBJ, which is
      the POSITION'th argument of SUBR.
 
  -- Macro: int SCM_ARG1
  -- Macro: int SCM_ARG2
  -- Macro: int SCM_ARG3
  -- Macro: int SCM_ARG4
  -- Macro: int SCM_ARG5
  -- Macro: int SCM_ARG6
  -- Macro: int SCM_ARG7
      One of the above values can be used for POSITION to indicate the
      number of the argument of SUBR which is being checked.
      Alternatively, a positive integer number can be used, which allows
      to check arguments after the seventh.  However, for parameter
      numbers up to seven it is preferable to use `SCM_ARGN' instead of
      the corresponding raw number, since it will make the code easier to
      understand.
 
  -- Macro: int SCM_ARGn
      Passing a value of zero or `SCM_ARGn' for POSITION allows to leave
      it unspecified which argument's type is incorrect.  Again,
      `SCM_ARGn' should be preferred over a raw zero constant.
 
Info Catalog (guile.info.gz) Non-immediate Datatypes (guile.info.gz) How Guile does it (guile.info.gz) Unpacking the SCM type
automatically generated byinfo2html