From 09ef86d2df68776a773bcf35a32ee45e204f2200 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Wed, 2 Mar 2005 19:25:59 +0000 Subject: [PATCH] r10350: 2005-03-03 Kevin Rosenberg (kevin@rosenberg.net) * src/primitives.lisp: Add support for :union types [patch from Cyrus Harmon] * tests/union.lisp, tests/structs.lisp: Tests for union and structure types [from Cyrus Harmon] --- ChangeLog | 6 ++++++ debian/changelog | 6 ++++++ src/primitives.lisp | 10 +++++++--- tests/structs.lisp | 5 +++++ tests/union.lisp | 19 +++++++++++++++++++ 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46eba70..0755118 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-03-03 Kevin Rosenberg (kevin@rosenberg.net) + * src/primitives.lisp: Add support for :union types + [patch from Cyrus Harmon] + * tests/union.lisp, tests/structs.lisp: Tests for + union and structure types [from Cyrus Harmon] + 2005-02-22 Kevin Rosenberg (kevin@rosenberg.net) * src/primitives.lisp, src/strings.lisp: Better support for sb-unicode [from Yoshinori Tahara and R. Mattes] diff --git a/debian/changelog b/debian/changelog index e6750de..d20f5b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-uffi (1.4.33-1) unstable; urgency=low + + * New upstream + + -- Kevin M. Rosenberg Wed, 2 Mar 2005 12:25:43 -0700 + cl-uffi (1.4.32-1) unstable; urgency=low * New upstream diff --git a/src/primitives.lisp b/src/primitives.lisp index 5522f5a..0f47eb7 100644 --- a/src/primitives.lisp +++ b/src/primitives.lisp @@ -272,9 +272,13 @@ supports takes advantage of this optimization." #+mcl `(:struct ,(%convert-from-uffi-type (cadr type) :struct)) #-mcl (%convert-from-uffi-type (cadr type) :struct) ) - (t - (cons (%convert-from-uffi-type (first type) context) - (%convert-from-uffi-type (rest type) context))))))) + (:union + #+mcl `(:union ,(%convert-from-uffi-type (cadr type) :union)) + #-mcl (%convert-from-uffi-type (cadr type) :union) + ) + (t + (cons (%convert-from-uffi-type (first type) context) + (%convert-from-uffi-type (rest type) context))))))) (defun convert-from-uffi-type (type context) (let ((result (%convert-from-uffi-type type context))) diff --git a/tests/structs.lisp b/tests/structs.lisp index 6eb7577..20338d4 100644 --- a/tests/structs.lisp +++ b/tests/structs.lisp @@ -29,3 +29,8 @@ t) t) +(deftest structs.2 + (progn + (uffi:def-foreign-type foo-struct (:struct foo)) + t) + t) diff --git a/tests/union.lisp b/tests/union.lisp index 86e8627..584d563 100644 --- a/tests/union.lisp +++ b/tests/union.lisp @@ -49,4 +49,23 @@ (deftest union.3 (plusp (uffi:get-slot-value *u* 'tunion1 'uint)) t) +(uffi:def-union foo-u + (bar :pointer-self)) + +(uffi:def-foreign-type foo-u-ptr (* foo-u)) + +;; tests that compilation worked +(deftest unions.4 + (with-foreign-object (p 'foo-u) + t) + t) + +(deftest unions.5 + (progn + (uffi:def-foreign-type foo-union (:union foo-u)) + t) + t) + + + -- 2.34.1