X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fobjects.lisp;h=9938a8eed4cca472bf58bfef7295975fd6e47bb8;hb=77fd04d570b9ae1fd40c1f7b0134af826576210b;hp=4930962437287a78af3c4233be16a14d83c7ea42;hpb=65e2a75247b894d1f562102ef1df77c7060b5048;p=uffi.git diff --git a/src/objects.lisp b/src/objects.lisp index 4930962..9938a8e 100644 --- a/src/objects.lisp +++ b/src/objects.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: objects.lisp,v 1.15 2003/07/08 12:37:21 kevin Exp $ +;;;; $Id: objects.lisp,v 1.16 2003/08/14 19:35:05 kevin Exp $ ;;;; ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -118,7 +118,11 @@ an array of TYPE with size SIZE. The TYPE parameter is evaluated." #+mcl (defsetf deref-pointer deref-pointer-set) -#+(or lispworks (and mcl (not openmcl))) ;; with LW, deref is a character +#+lispworks +(defmacro ensure-char-character (obj) + `(if (characterp ,obj) ,obj (code-char ,obj))) + +#+(and mcl (not openmcl)) (defmacro ensure-char-character (obj) obj) @@ -197,3 +201,30 @@ an array of TYPE with size SIZE. The TYPE parameter is evaluated." `(with-foreign-objects ((,var ,type)) ,@body)) +#+lispworks +(defmacro with-cast-pointer ((binding-name pointer type) &body body) + `(fli:with-coerced-pointer (,binding-name + :type ',(convert-from-uffi-type (eval type) :type)) + ,pointer + ,@body)) + +#+(or cmu scl sbcl) +(defmacro with-cast-pointer ((binding-name pointer type) &body body) + `(let ((,binding-name + (#+(or cmu scl) alien:cast + #+sbcl sb-alien:cast + ,pointer (* ,(convert-from-uffi-type (eval type) :type))))) + ,@body)) + +#+allegro +(defmacro with-cast-pointer ((binding-name pointer type) &body body) + (declare (ignore type)) + `(let ((,binding-name ,pointer)) + ,@body)) + +#-(or lispworks cmu scl sbcl allegro) +(defmacro with-cast-pointer ((binding-name pointer type) &body body) + (declare (ignore binding-name pointer type)) + '(error "WITH-CAST-POINTER not (yet) implemented for ~A" + (lisp-implementation-type))) +