;; License along with this library; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-;; $Id: gforeign.lisp,v 1.2 2000-08-16 18:25:30 espen Exp $
+;; $Id: gforeign.lisp,v 1.3 2000-08-23 14:27:41 espen Exp $
(in-package "GLIB")
`(lambda (sap offset)
(declare (ignorable sap offset))
,(translate-from-alien
- type-spec `(,(sap-ref-fname type-spec) sap offset) :copy))))))
+ type-spec `(,(sap-ref-fname type-spec) sap offset) :reference))))))
(defun get-destroy-function (type-spec)
`(make-pointer (1+ (kernel:get-lisp-obj-address ,string)))))
(deftype-method
- translate-from-alien string (type-spec sap &optional (alloc :dynamic))
+ translate-from-alien string (type-spec sap &optional (alloc :copy))
(declare (ignore type-spec))
`(let ((sap ,sap))
(unless (null-pointer-p sap)
(prog1
(c-call::%naturalize-c-string sap)
- ,(when (eq alloc :dynamic) `(deallocate-memory ,sap))))))
+ ,(when (eq alloc :copy) `(deallocate-memory ,sap))))))
(deftype-method cleanup-alien string (type-spec sap &optional copied)
(declare (ignore type-spec))
;; License along with this library; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-;; $Id: glib.lisp,v 1.3 2000-08-22 23:13:39 espen Exp $
+;; $Id: glib.lisp,v 1.4 2000-08-23 14:27:41 espen Exp $
(in-package "GLIB")
(deftype-method
translate-from-alien
- double-list (type-spec glist &optional (alloc :dynamic))
+ double-list (type-spec glist &optional (alloc :reference))
(let ((element-type-spec (second (type-expand-to 'double-list type-spec))))
`(let ((glist ,glist)
(list nil))
,(translate-from-alien
element-type-spec `(glist-data tmp ,element-type-spec) alloc)
list))
- ,(when (eq alloc :dynamic)
+ ,(when (eq alloc :reference)
'(glist-free glist))
(nreverse list))))
;; License along with this library; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-;; $Id: gtype.lisp,v 1.2 2000-08-15 14:42:34 espen Exp $
+;; $Id: gtype.lisp,v 1.3 2000-08-23 14:27:41 espen Exp $
(in-package "GLIB")
(deftype-method translate-from-alien
alien-object (type-spec location &optional alloc)
- (declare (ignore alloc))
+ ;; Reference counted objects are always treated as if alloc were :reference
+ (declare (ignore alloc))
`(let ((location ,location))
(unless (null-pointer-p location)
(ensure-alien-instance ',type-spec location))))
(alien-instance-location object))))
(deftype-method translate-from-alien
- alien-structure (type-spec location &optional (alloc :dynamic))
+ alien-structure (type-spec location &optional (alloc :reference))
`(let ((location ,location))
(unless (null-pointer-p location)
,(ecase alloc
- (:dynamic `(ensure-alien-instance ',type-spec location))
+ (:copy `(ensure-alien-instance ',type-spec location))
(:static `(ensure-alien-instance ',type-spec location :static t))
- (:copy `(ensure-alien-instance
- ',type-spec
- `(,(alien-copier type-spec)
- location ,(alien-class-size (find-class type-spec)))))))))
+ (:reference
+ `(ensure-alien-instance
+ ',type-spec
+ `(,(alien-copier type-spec)
+ location ,(alien-class-size (find-class type-spec)))))))))
(deftype-method cleanup-alien alien-structure (type-spec sap &optional copied)
(when copied