3 (define-foreign-type gstrv-type ()
4 ((free-from-foreign :initarg :free-from-foreign :initform t :reader gstrv-type-fff)
5 (free-to-foreign :initarg :free-to-foreign :initform t :reader gstrv-type-ftf))
6 (:actual-type :pointer))
8 (define-parse-method gstrv (&key (free-from-foreign t) (free-to-foreign t))
9 (make-instance 'gstrv-type :free-from-foreign free-from-foreign :free-to-foreign free-to-foreign))
11 (defmethod translate-from-foreign (value (type gstrv-type))
12 (unless (null-pointer-p value)
15 (for str-ptr = (mem-aref value :pointer i))
16 (until (null-pointer-p str-ptr))
17 (collect (convert-from-foreign str-ptr '(:string :free-from-foreign nil)))
18 (when (gstrv-type-fff type)
20 (when (gstrv-type-fff type)
23 (defmethod translate-to-foreign (str-list (type gstrv-type))
24 (let* ((n (length str-list))
25 (result (g-malloc (* (1+ n) (foreign-type-size :pointer)))))
28 (setf (mem-aref result :pointer i) (g-strdup str)))
29 (setf (mem-aref result :pointer n) (null-pointer))