[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-88-ge0a822
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-88-ge0a8221 |
Date: |
Thu, 22 Dec 2011 14:32:30 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=e0a8221dcf0c6592a968a10e511a69bb05728753
The branch, stable-2.0 has been updated
via e0a8221dcf0c6592a968a10e511a69bb05728753 (commit)
from 61fe8eafc236e2f76259e987d66f43e97fc1eed4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e0a8221dcf0c6592a968a10e511a69bb05728753
Author: Andy Wingo <address@hidden>
Date: Thu Dec 22 09:32:09 2011 -0500
Make the "Dia Primitives" section of the manual more clear.
* doc/ref/libguile-program.texi (Dia Primitives): Use
scm_assert_smob_type, and update the text.
-----------------------------------------------------------------------
Summary of changes:
doc/ref/libguile-program.texi | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/doc/ref/libguile-program.texi b/doc/ref/libguile-program.texi
index 2c30d24..f565b91 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
address@hidden are from the standard Guile API. We assume that
address@hidden was given to us when we made the shape SMOB type, using
address@hidden 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.
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-88-ge0a8221,
Andy Wingo <=