[gtk-cffi-cvs] CVS gtk-cffi/g-lib

CVS User rklochkov rklochkov at common-lisp.net
Mon Feb 20 18:50:27 UTC 2012


Update of /project/gtk-cffi/cvsroot/gtk-cffi/g-lib
In directory tiger.common-lisp.net:/tmp/cvs-serv18060/g-lib

Modified Files:
	array.lisp 
Log Message:
Added GtkAboutDialog


--- /project/gtk-cffi/cvsroot/gtk-cffi/g-lib/array.lisp	2012/01/25 19:15:08	1.6
+++ /project/gtk-cffi/cvsroot/gtk-cffi/g-lib/array.lisp	2012/02/20 18:50:27	1.7
@@ -7,42 +7,15 @@
 
 (in-package :g-lib-cffi)
 
-(defvar *array-length* (foreign-alloc :uint))
-
-;; TODO: add with-pointer-to-vector-data optimization
-(define-foreign-type cffi-array (freeable)
-  ((element-type :initarg :type :accessor element-type))
+(define-foreign-type g-lib-array (cffi-array)
+  ()
   (:actual-type :pointer))
 
 (define-parse-method garray (type &key free)
-  (make-instance 'cffi-array :type type :free free))
+  (make-instance 'g-lib-array :type type :free free))
 
 (defcfun g-free :void (var :pointer))
 
-(defmethod free-ptr ((type cffi-array) ptr)
+(defmethod free-ptr ((type g-lib-array) ptr)
   (g-free ptr))
 
-(defmethod translate-to-foreign (value (cffi-array cffi-array))
-  (if (pointerp value)
-      value
-      (let* ((length (length value))
-             (type (element-type cffi-array))
-             (res (foreign-alloc type :count length)))
-        (dotimes (i length (values res t))
-          (setf (mem-aref res type i) (elt value i)))
-        res)))
-
-;(defmethod free-translated-object (ptr (cffi-array cffi-array) param)
-;  (declare (ignore param))
-;  (free-if-needed cffi-array ptr :free-func #'foreign-free))
-
-
-(defmethod translate-from-foreign (ptr (cffi-array cffi-array))
-  (let ((array-length (mem-ref *array-length* :uint)))
-    (let* ((res (make-array array-length))
-           (el-type (element-type cffi-array)))
-      (iter
-        (for i from 0 below array-length)
-        (setf (aref res i)
-              (mem-aref ptr el-type i)))
-      res)))





More information about the gtk-cffi-cvs mailing list