[gtk-cffi-cvs] CVS gtk-cffi/g-lib
CVS User rklochkov
rklochkov at common-lisp.net
Sun Aug 12 17:42:29 UTC 2012
Update of /project/gtk-cffi/cvsroot/gtk-cffi/g-lib
In directory tiger.common-lisp.net:/tmp/cvs-serv2591/g-lib
Modified Files:
array.lisp list.lisp quark.lisp
Log Message:
Synced with current version of CFFI
--- /project/gtk-cffi/cvsroot/gtk-cffi/g-lib/array.lisp 2012/07/31 17:57:11 1.8
+++ /project/gtk-cffi/cvsroot/gtk-cffi/g-lib/array.lisp 2012/08/12 17:42:29 1.9
@@ -11,19 +11,28 @@
()
(:actual-type :pointer))
-(define-parse-method garray (type &key free)
- (make-instance 'g-lib-array :type type :free free))
+(define-parse-method garray (type &rest rest)
+ (apply #'make-instance 'g-lib-array :type type rest))
(defcfun g-free :void (var :pointer))
+(defcfun g-malloc :pointer (n-bytes :int))
(defmethod free-ptr ((type g-lib-array) ptr)
(g-free ptr))
-(define-foreign-type g-lib-string (cffi-objects::cffi-string)
- ((free :initform t))
+(define-foreign-type g-lib-string (freeable)
+ ((free-from-foreign :initform t))
(:simple-parser g-lib-string)
(:actual-type :pointer))
+(defmethod translate-to-foreign (value (type g-lib-string))
+ (with-foreign-string ((str len) value)
+ (let ((ptr (g-malloc len)))
+ (lisp-string-to-foreign value ptr len)
+ ptr)))
-(defmethod free-ptr ((type cffi-string) ptr)
+(defmethod translate-from-foreign (value (type g-lib-string))
+ (foreign-string-to-lisp value))
+
+(defmethod free-ptr ((type g-lib-string) ptr)
(g-free ptr))
\ No newline at end of file
--- /project/gtk-cffi/cvsroot/gtk-cffi/g-lib/list.lisp 2012/02/20 16:51:37 1.7
+++ /project/gtk-cffi/cvsroot/gtk-cffi/g-lib/list.lisp 2012/08/12 17:42:29 1.8
@@ -37,7 +37,7 @@
(define-foreign-type g-list (freeable)
((list-type :initarg :elt :accessor list-type :initform nil
:documentation "If null, then list is of pointers or GObjects")
- (free :initform :container))
+ (free-from-foreign :initform t))
(:simple-parser g-list)
(:actual-type :pointer))
@@ -68,7 +68,8 @@
;; Copy-paste fom g-list. Bad, but what to do?
(define-foreign-type g-slist (freeable)
((list-type :initarg :elt :accessor list-type
- :documentation "If null, then list is of pointers or GObjects"))
+ :documentation "If null, then list is of pointers or GObjects")
+ (free-from-foreign :initform t))
(:simple-parser g-slist)
(:actual-type :pointer))
@@ -103,7 +104,7 @@
(g-slist-reverse p))))
(define-foreign-type string-list (freeable)
- ()
+ ((free-from-foreign :initform t))
(:actual-type :pointer)
(:simple-parser string-list))
--- /project/gtk-cffi/cvsroot/gtk-cffi/g-lib/quark.lisp 2012/02/12 17:29:41 1.3
+++ /project/gtk-cffi/cvsroot/gtk-cffi/g-lib/quark.lisp 2012/08/12 17:42:29 1.4
@@ -16,5 +16,6 @@
(defcfun g-intern-string :pointer (string :string))
-(defcfun g-intern-static-string :pointer (string (pstring :free :none)))
+(defcfun g-intern-static-string :pointer
+ (string (:string :free-to-foreign nil)))
More information about the gtk-cffi-cvs
mailing list