guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-15-10-gde


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-15-10-gde6fb18
Date: Tue, 08 Feb 2011 21:48:34 +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=de6fb1875d1a7e8d2a39ec8eba753c07abcd4263

The branch, master has been updated
       via  de6fb1875d1a7e8d2a39ec8eba753c07abcd4263 (commit)
      from  36ad25332e1de74405cc2e8f6630cae0597f8576 (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 de6fb1875d1a7e8d2a39ec8eba753c07abcd4263
Author: Ludovic Courtès <address@hidden>
Date:   Tue Feb 8 22:40:55 2011 +0100

    Have `define-wrapped-pointer-type' take a type name.
    
    * module/system/foreign.scm (define-wrapped-pointer-type): Add a
      `type-name' argument instead of non-hygienically generating one.
    
    * test-suite/tests/foreign.test (foo): Update.
    
    * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update
      accordingly.

-----------------------------------------------------------------------

Summary of changes:
 doc/ref/api-foreign.texi      |    5 +++--
 module/system/foreign.scm     |   16 ++--------------
 test-suite/tests/foreign.test |    3 ++-
 3 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi
index f275242..fa65d68 100644
--- a/doc/ref/api-foreign.texi
+++ b/doc/ref/api-foreign.texi
@@ -627,7 +627,7 @@ structures to identify objects.  It is useful in such cases 
to reify the
 different pointer types as disjoint Scheme types.  The
 @code{define-wrapped-pointer-type} macro simplifies this.
 
address@hidden {Scheme Syntax} define-wrapped-pointer-type pred wrap unwrap 
print
address@hidden {Scheme Syntax} define-wrapped-pointer-type type-name pred wrap 
unwrap print
 Define helper procedures to wrap pointer objects into Scheme objects
 with a disjoint type.  Specifically, this macro defines:
 
@@ -651,7 +651,8 @@ For example, assume we are wrapping a C library that 
defines a type,
 pointers to manipulate them.  We could write:
 
 @example
-(define-wrapped-pointer-type bottle?
+(define-wrapped-pointer-type bottle
+  bottle?
   wrap-bottle unwrap-bottle
   (lambda (b p)
     (format p "#<bottle of ~a ~x>"
diff --git a/module/system/foreign.scm b/module/system/foreign.scm
index 16834ce..781e793 100644
--- a/module/system/foreign.scm
+++ b/module/system/foreign.scm
@@ -178,20 +178,8 @@ predicate for the new Scheme type, WRAP, a procedure that 
takes a
 pointer object and returns an object that satisfies PRED, and UNWRAP
 which does the reverse.  PRINT must name a user-defined object printer."
     (syntax-case stx ()
-      ((_ pred wrap unwrap print)
-       (and (symbol? (syntax->datum #'pred))
-            (symbol? (syntax->datum #'wrap))
-            (symbol? (syntax->datum #'unwrap)))
-
-       ;; Choose TYPE-NAME deterministically to help separate
-       ;; compilation.  It could be an arg of the macro, but that would
-       ;; expose an implementation detail.
-       (with-syntax ((type-name (datum->syntax
-                                 #'pred
-                                 (symbol-append '%%
-                                                (syntax->datum #'pred)
-                                                '-type-name)))
-                     (%wrap     (datum->syntax #'wrap (gensym "wrap"))))
+      ((_ type-name pred wrap unwrap print)
+       (with-syntax ((%wrap (datum->syntax #'wrap (gensym "wrap"))))
          #'(begin
              (define-record-type type-name
                (%wrap pointer)
diff --git a/test-suite/tests/foreign.test b/test-suite/tests/foreign.test
index a0ded0b..ba53a0d 100644
--- a/test-suite/tests/foreign.test
+++ b/test-suite/tests/foreign.test
@@ -67,7 +67,8 @@
     (not (equal? (make-pointer 123) (make-pointer 456)))))
 
 
-(define-wrapped-pointer-type foo?
+(define-wrapped-pointer-type foo
+  foo?
   wrap-foo unwrap-foo
   (lambda (x p)
     (format p "#<foo! ~a>" (pointer-address (unwrap-foo x)))))


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]