X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fobjects.lisp;h=358763e41fc829c815845886a3e898dcf31bd733;hb=24be2fb19ccbfb39ee2cfbc2ae3c49f4728c0dc5;hp=940c941cc42f6d09338c22f90b8bc0d9e45949e0;hpb=3e1ab6ebfcf56e76edffaff284aca937e8152408;p=uffi.git diff --git a/src/objects.lisp b/src/objects.lisp index 940c941..358763e 100644 --- a/src/objects.lisp +++ b/src/objects.lisp @@ -121,11 +121,11 @@ an array of TYPE with size SIZE. The TYPE parameter is evaluated." #+mcl `(ccl:pref ,ptr ,(convert-from-uffi-type type :deref)) ) -#+mcl +#+(and mcl (not openmcl)) (defmacro deref-pointer-set (ptr type value) `(setf (ccl:pref ,ptr ,(convert-from-uffi-type type :deref)) ,value)) -#+mcl +#+(and mcl (not openmcl)) (defsetf deref-pointer deref-pointer-set) (defmacro ensure-char-character (obj) @@ -166,15 +166,25 @@ an array of TYPE with size SIZE. The TYPE parameter is evaluated." (progn ,@body) (free-foreign-object ,var))) #+(or cmu scl) - (let ((obj (gensym))) - `(alien:with-alien ((,obj ,(convert-from-uffi-type (eval type) :allocate))) - (let ((,var (alien:addr ,obj))) - ,@body))) + (let ((obj (gensym)) + (ctype (convert-from-uffi-type (eval type) :allocate))) + (if (and (consp ctype) (eq 'array (car ctype))) + `(alien:with-alien ((,obj ,ctype)) + (let* ((,var ,obj)) + ,@body)) + `(alien:with-alien ((,obj ,ctype)) + (let* ((,var (alien:addr ,obj))) + ,@body)))) #+sbcl - (let ((obj (gensym))) - `(sb-alien:with-alien ((,obj ,(convert-from-uffi-type (eval type) :allocate))) - (let ((,var (sb-alien:addr ,obj))) - ,@body))) + (let ((obj (gensym)) + (ctype (convert-from-uffi-type (eval type) :allocate))) + (if (and (consp ctype) (eq 'array (car ctype))) + `(sb-alien:with-alien ((,obj ,ctype)) + (let* ((,var ,obj)) + ,@body)) + `(sb-alien:with-alien ((,obj ,ctype)) + (let* ((,var (sb-alien:addr ,obj))) + ,@body)))) #+lispworks `(fli:with-dynamic-foreign-objects ((,var ,(convert-from-uffi-type (eval type) :allocate)))