Add gsize types for PPC32 and PPC64 archs
[cl-gtk2.git] / glib / gobject.foreign.lisp
blob65e08b833312dba5ecf24a22409ae21aac44ae10
1 (in-package :gobject)
3 (defgeneric release (object)
4 (:documentation "Manually frees the Lisp reference to the @code{object}. Probably should not be called.
6 @arg[object]{an instance of @class{g-object}}"))
8 (defmethod release ((object null)))
10 (defun release* (&rest objects)
11 "Calls @fun{release} on all objects in @code{objects}
13 @arg[objects]{a list of instances of @class{g-object}}"
14 (declare (dynamic-extent objects))
15 (loop
16 for object in objects
17 do (release object)))
19 (defmacro using ((var &optional (expr var)) &body body)
20 `(let ((,var ,expr))
21 (unwind-protect
22 (progn ,@body)
23 (release ,var))))
25 (defun using-expand (bindings body)
26 (if bindings
27 (destructuring-bind (var &optional (expr var)) (ensure-list (first bindings))
28 `(let ((,var ,expr))
29 (unwind-protect
30 ,(using-expand (rest bindings) body)
31 (release ,var))))
32 `(progn ,@body)))
34 (defmacro using* ((&rest bindings) &body body)
35 (using-expand bindings body))