diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ref/api-compound.texi | 11 | ||||
-rw-r--r-- | doc/ref/api-data.texi | 2 | ||||
-rw-r--r-- | doc/ref/api-foreign.texi | 4 | ||||
-rw-r--r-- | doc/ref/libguile-program.texi | 13 |
4 files changed, 16 insertions, 14 deletions
diff --git a/doc/ref/api-compound.texi b/doc/ref/api-compound.texi index c52fed42c..da8ca9199 100644 --- a/doc/ref/api-compound.texi +++ b/doc/ref/api-compound.texi @@ -3293,10 +3293,13 @@ Again the choice of @var{hash-proc} must be consistent with previous calls to @code{vhash-cons}. @end deffn -@deffn {Scheme Procedure} vhash-fold proc vhash -@deffnx {Scheme Procedure} vhash-fold-right proc vhash -Fold over the key/value elements of @var{vhash} in the given direction. -For each pair call @var{proc} as @code{(@var{proc} key value result)}. +@deffn {Scheme Procedure} vhash-fold proc init vhash +@deffnx {Scheme Procedure} vhash-fold-right proc init vhash +Fold over the key/value elements of @var{vhash} in the given direction, +with each call to @var{proc} having the form @code{(@var{proc} key value +result)}, where @var{result} is the result of the previous call to +@var{proc} and @var{init} the value of @var{result} for the first call +to @var{proc}. @end deffn @deffn {Scheme Procedure} vhash-fold* proc init key vhash [equal? [hash]] diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index 5017165c0..f2450cea2 100644 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -3366,7 +3366,7 @@ Change every character in @var{str} between @var{start} and @var{end} to @var{fill}. @lisp -(define y "abcdefg") +(define y (string-copy "abcdefg")) (substring-fill! y 1 3 #\r) y @result{} "arrdefg" diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi index 2dd691675..82925e68d 100644 --- a/doc/ref/api-foreign.texi +++ b/doc/ref/api-foreign.texi @@ -1,7 +1,7 @@ @c -*-texinfo-*- @c This is part of the GNU Guile Reference Manual. @c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2008, -@c 2009, 2010, 2011 Free Software Foundation, Inc. +@c 2009, 2010, 2011, 2012 Free Software Foundation, Inc. @c See the file guile.texi for copying conditions. @node Foreign Function Interface @@ -680,7 +680,7 @@ pointers to manipulate them. We could write: (lambda (b p) (format p "#<bottle of ~a ~x>" (bottle-contents b) - (pointer-address (unwrap-foo b))))) + (pointer-address (unwrap-bottle b))))) (define grab-bottle ;; Wrapper for `bottle_t *grab (void)'. diff --git a/doc/ref/libguile-program.texi b/doc/ref/libguile-program.texi index 2c30d246e..f565b916f 100644 --- a/doc/ref/libguile-program.texi +++ b/doc/ref/libguile-program.texi @@ -279,13 +279,12 @@ As an example, here is a possible implementation of the @code{square?} primitive: @lisp -#define FUNC_NAME "square?" static SCM square_p (SCM shape) @{ struct dia_guile_shape * guile_shape; /* Check that arg is really a shape SMOB. */ - SCM_VALIDATE_SHAPE (SCM_ARG1, shape); + scm_assert_smob_type (shape_tag, shape); /* Access Scheme-specific shape structure. */ guile_shape = SCM_SMOB_DATA (shape); @@ -295,7 +294,6 @@ static SCM square_p (SCM shape) return scm_from_bool (guile_shape->c_shape && (guile_shape->c_shape->type == DIA_SQUARE)); @} -#undef FUNC_NAME @end lisp Notice how easy it is to chain through from the @code{SCM shape} @@ -303,10 +301,11 @@ parameter that @code{square_p} receives --- which is a SMOB --- to the Scheme-specific structure inside the SMOB, and thence to the underlying C structure for the shape. -In this code, @code{SCM_SMOB_DATA} and @code{scm_from_bool} are from -the standard Guile API. @code{SCM_VALIDATE_SHAPE} is a macro that you -should define as part of your SMOB definition: it checks that the -passed parameter is of the expected type. This is needed to guard +In this code, @code{scm_assert_smob_type}, @code{SCM_SMOB_DATA}, and +@code{scm_from_bool} are from the standard Guile API. We assume that +@code{shape_tag} was given to us when we made the shape SMOB type, using +@code{scm_make_smob_type}. The call to @code{scm_assert_smob_type} +ensures that @var{shape} is indeed a shape. This is needed to guard against Scheme code using the @code{square?} procedure incorrectly, as in @code{(square? "hello")}; Scheme's latent typing means that usage errors like this must be caught at run time. |