diff options
author | Andy Wingo <wingo@pobox.com> | 2010-03-14 14:39:47 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-03-14 14:39:47 +0100 |
commit | 0f7e6c56cd3d1a070ea4b469368d9c2f6f492538 (patch) | |
tree | 90832b08cea00b9ed8021f4d5efc3563cfd3f7ce /doc/ref/api-control.texi | |
parent | 06dcb9dfb663169ce612bca241e5438c73bfa5c6 (diff) | |
download | guile-0f7e6c56cd3d1a070ea4b469368d9c2f6f492538.tar.gz |
update "data representation" part of guile internals doc
* doc/ref/api-control.texi (Handling Errors): Move the "Signalling Type
Errors" section here.
* doc/ref/data-rep.texi (Data Representation): Refactor, lopping and
cropping and stitching.
* doc/ref/libguile-concepts.texi (Dynamic Types):
* doc/ref/libguile-smobs.texi (Describing a New Type, Double Smobs):
* doc/ref/guile.texi (Guile Implementation, Programming in C): Adapt to
refactorings.
* doc/ref/history.texi (A Scheme of Many Maintainers):
(A Timeline of Selected Guile Releases, Status): Update.
Diffstat (limited to 'doc/ref/api-control.texi')
-rw-r--r-- | doc/ref/api-control.texi | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/doc/ref/api-control.texi b/doc/ref/api-control.texi index 0e84d8948..7c73793ea 100644 --- a/doc/ref/api-control.texi +++ b/doc/ref/api-control.texi @@ -1393,6 +1393,42 @@ which is the name of the procedure incorrectly invoked. @end deftypefn +@subsubsection 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. + +@deftypefn Macro void SCM_ASSERT (int @var{test}, SCM @var{obj}, unsigned int @var{position}, const char *@var{subr}) +If @var{test} is zero, signal a ``wrong type argument'' error, +attributed to the subroutine named @var{subr}, operating on the value +@var{obj}, which is the @var{position}'th argument of @var{subr}. +@end deftypefn + +@deftypefn Macro int SCM_ARG1 +@deftypefnx Macro int SCM_ARG2 +@deftypefnx Macro int SCM_ARG3 +@deftypefnx Macro int SCM_ARG4 +@deftypefnx Macro int SCM_ARG5 +@deftypefnx Macro int SCM_ARG6 +@deftypefnx Macro int SCM_ARG7 +One of the above values can be used for @var{position} to indicate the +number of the argument of @var{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 @code{SCM_ARGN} instead of the +corresponding raw number, since it will make the code easier to +understand. +@end deftypefn + +@deftypefn Macro int SCM_ARGn +Passing a value of zero or @code{SCM_ARGn} for @var{position} allows to +leave it unspecified which argument's type is incorrect. Again, +@code{SCM_ARGn} should be preferred over a raw zero constant. +@end deftypefn + + @node Continuation Barriers @subsection Continuation Barriers |