X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Faggregates.lisp;h=70d3ad264c687abdd7374ffb22e0075f23094572;hb=6f7ce2ee216d141886f43ce07befd0c2668bcefb;hp=ae86bbe2b4d83db4156eacf551a804616fe05be1;hpb=65e2a75247b894d1f562102ef1df77c7060b5048;p=uffi.git diff --git a/src/aggregates.lisp b/src/aggregates.lisp index ae86bbe..70d3ad2 100644 --- a/src/aggregates.lisp +++ b/src/aggregates.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: aggregates.lisp,v 1.8 2003/08/13 18:53:42 kevin Exp $ +;;;; $Id$ ;;;; ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -161,20 +161,29 @@ of the enum-name name, separator-string, and field-name" "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) - #+lispworks `(fli:dereference ,obj :index ,i) + #+sbcl `(sb-alien:deref ,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) - #+mcl + #+openmcl (let* ((array-type (array-type type)) (local-type (convert-from-uffi-type array-type :allocation)) - (accessor (first (macroexpand `(ccl:pref obj ,local-type))))) - `(,accessor + (element-size-in-bits (ccl::%foreign-type-or-record-size local-type :bits))) + (ccl::%foreign-access-form + obj + (ccl::%foreign-type-or-record local-type) + `(* ,i ,element-size-in-bits) + nil)) + #+(and mcl (not openmcl)) + (let* ((array-type (array-type type)) + (local-type (convert-from-uffi-type array-type :allocation)) + (accessor (first (macroexpand `(ccl:pref obj ,local-type))))) + `(,accessor ,obj (* (the fixnum ,i) ,(size-of-foreign-type local-type)))) ) ; this expands to the %set-xx functions which has different params than %put-xx -#+mcl +#+(and mcl (not openmcl)) (defmacro deref-array-set (obj type i value) (let* ((array-type (array-type type)) (local-type (convert-from-uffi-type array-type :allocation)) @@ -185,7 +194,7 @@ of the enum-name name, separator-string, and field-name" (* (the fixnum ,i) ,(size-of-foreign-type local-type)) ,value))) -#+mcl +#+(and mcl (not openmcl)) (defsetf deref-array deref-array-set) (defmacro def-union (name &rest fields)