From ac9eafca18c6a684c2a7ed3c353c5eeac3456849 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Wed, 12 May 2004 18:43:31 +0000 Subject: [PATCH] r9320: add THE declaration to DEREF array, fix convert-to-uffi-type to make unsized array declarations be pointers for SBCL/CMUCL --- src/aggregates.lisp | 6 +++--- src/primitives.lisp | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/aggregates.lisp b/src/aggregates.lisp index 523bd4f..255e226 100644 --- a/src/aggregates.lisp +++ b/src/aggregates.lisp @@ -159,9 +159,9 @@ of the enum-name name, separator-string, and field-name" (defmacro deref-array (obj type i) "Returns a field from a row" - #+(or lispworks cmu sbcl scl) (declare (ignore type)) - #+(or cmu scl) `(alien:deref ,obj ,i) - #+sbcl `(sb-alien:deref ,obj ,i) + #+(or lispworks scl) (declare (ignore type)) + #+(or cmu scl) `(alien:deref (the (alien:alien ,(convert-from-uffi-type type :declare)) ,obj) ,i) + #+sbcl `(sb-alien:deref (the (sb-alien:alien ,(convert-from-uffi-type type :declare)) ,obj) ,i) #+lispworks `(fli:dereference ,obj :index ,i :copy-foreign-object nil) #+allegro `(ff:fslot-value-typed (quote ,(convert-from-uffi-type type :type)) :c ,obj ,i) #+openmcl diff --git a/src/primitives.lisp b/src/primitives.lisp index c430894..26737bd 100644 --- a/src/primitives.lisp +++ b/src/primitives.lisp @@ -277,6 +277,15 @@ supports takes advantage of this optimization." (let ((result (%convert-from-uffi-type type context))) (cond ((atom result) result) + ;; Arrays without size are really pointers to type on SBCL/CMUCL + #+sbcl + ((and (consp type) (= 2 (length type)) (eq :array (car type))) + (setf (car result) 'sb-alien:*) + result) + #+cmu + ((and (consp type) (= 2 (length type)) (eq :array (car type))) + (setf (car result) 'alien:*) + result) #+openmcl ((eq (car result) :address) (if (eq context :struct) -- 2.34.1