Fix documentation for vhash-fold and vhash-fold-right
[bpt/guile.git] / doc / ref / libguile-program.texi
index 819f97a..f565b91 100644 (file)
@@ -4,7 +4,6 @@
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
-@page
 @node Programming Overview
 @section An Overview of Guile Programming
 
@@ -280,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);
@@ -296,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}
@@ -304,17 +301,18 @@ 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.
 
 Having written the C code for your primitives, you need to make them
 available as Scheme procedures by calling the @code{scm_c_define_gsubr}
-function.  @code{scm_c_define_gsubr} (REFFIXME) takes arguments that
+function.  @code{scm_c_define_gsubr} (@pxref{Primitive Procedures}) takes arguments that
 specify the Scheme-level name for the primitive and how many required,
 optional and rest arguments it can accept.  The @code{square?} primitive
 always requires exactly one argument, so the call to make it available
@@ -685,7 +683,7 @@ If this approach is not enough, because the functionality that your
 application needs is not already available in this form, and it is
 impossible to write the new functionality in Scheme, you will need to
 write some C code.  If the required function is already available in C
-(e.g. in a library), all you need is a little glue to connect it to the
+(e.g.@: in a library), all you need is a little glue to connect it to the
 world of Guile.  If not, you need both to write the basic code and to
 plumb it into Guile.