X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Faggregates.lisp;h=4160864817e5701ad8a7bec4af0c57ccf64134c4;hb=db363beace9ab3ba90fe398d6b373c6d6a834490;hp=3fcb410c6702918ed727e6c1c56f208597b51a83;hpb=ebedde4e67b858b1f65c5eb4dc7bc45978ed1e40;p=uffi.git diff --git a/src/aggregates.lisp b/src/aggregates.lisp index 3fcb410..4160864 100644 --- a/src/aggregates.lisp +++ b/src/aggregates.lisp @@ -118,7 +118,8 @@ of the enum-name name, separator-string, and field-name" #+sbcl `(sb-alien:slot ,obj ,slot) #+mcl - `(ccl:pref ,obj ,(read-from-string (format nil ":~a.~a" (keyword type) (keyword slot)))) + `(ccl:pref ,obj ,(intern (concatenate 'string (symbol-name type) "." (symbol-name slot)) + :keyword)) ) #+mcl @@ -161,20 +162,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) + #+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 +195,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)