Author: tpapp Date: Mon Apr 21 09:01:57 2008 New Revision: 19
Modified: cl-cairo2-swig.lisp cl-cairo2.i tutorial/hearts.png Log: fixed my-double type coercion to work with new CFFI
Modified: cl-cairo2-swig.lisp ============================================================================== --- cl-cairo2-swig.lisp (original) +++ cl-cairo2-swig.lisp Mon Apr 21 09:01:57 2008 @@ -1,11 +1,15 @@
(in-package :cl-cairo2)
-(defctype my-double :double) -;; (defmethod cffi:expand-to-foreign (value (type (eql 'my-double))) -;; `(coerce ,value 'double-float)) -(defmethod translate-to-foreign (value (type (eql 'my-double))) - (coerce value 'double-float)) +;; define our own alias for double float, so we can automatically +;; convert other numerical types in the arguments +(define-foreign-type my-double-type () + () + (:actual-type :double) + (:simple-parser my-double)) + +(defmethod translate-to-foreign (value (type my-double-type)) + (coerce value 'double-float))
;; typedefs: we don't want to create all of them automatically, ;; because typedefs for structures confuse with-foreign-slots
Modified: cl-cairo2.i ============================================================================== --- cl-cairo2.i (original) +++ cl-cairo2.i Mon Apr 21 09:01:57 2008 @@ -9,11 +9,15 @@ %insert("lisphead") %{ (in-package :cl-cairo2)
-(defctype my-double :double) -;; (defmethod cffi:expand-to-foreign (value (type (eql 'my-double))) -;; `(coerce ,value 'double-float)) -(defmethod translate-to-foreign (value (type (eql 'my-double))) - (coerce value 'double-float)) +;; define our own alias for double float, so we can automatically +;; convert other numerical types in the arguments +(define-foreign-type my-double-type () + () + (:actual-type :double) + (:simple-parser my-double)) + +(defmethod translate-to-foreign (value (type my-double-type)) + (coerce value 'double-float))
;; typedefs: we don't want to create all of them automatically, ;; because typedefs for structures confuse with-foreign-slots
Modified: tutorial/hearts.png ============================================================================== Binary files. No diff available.