From tpapp at common-lisp.net Sun Apr 20 23:37:41 2008 From: tpapp at common-lisp.net (tpapp at common-lisp.net) Date: Sun, 20 Apr 2008 19:37:41 -0400 (EDT) Subject: [cl-cairo2-cvs] r18 - Message-ID: <20080420233741.D2C02240D8@common-lisp.net> Author: tpapp Date: Sun Apr 20 19:37:41 2008 New Revision: 18 Modified: cl-cairo2-swig.lisp Log: Regenerated SWIG file. Modified: cl-cairo2-swig.lisp ============================================================================== --- cl-cairo2-swig.lisp (original) +++ cl-cairo2-swig.lisp Sun Apr 20 19:37:41 2008 @@ -81,7 +81,7 @@ (cl:defconstant CAIRO_VERSION_MINOR 4) -(cl:defconstant CAIRO_VERSION_MICRO 10) +(cl:defconstant CAIRO_VERSION_MICRO 14) (cl:defconstant CAIRO_HAS_SVG_SURFACE 1) From tpapp at common-lisp.net Mon Apr 21 13:01:58 2008 From: tpapp at common-lisp.net (tpapp at common-lisp.net) Date: Mon, 21 Apr 2008 09:01:58 -0400 (EDT) Subject: [cl-cairo2-cvs] r19 - tutorial Message-ID: <20080421130158.2CAB77A012@common-lisp.net> 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.