Typo.
[cl-gtk2.git] / glib / gobject.foreign.lisp
1 (in-package :gobject)
2
3 (defgeneric release (object)
4   (:documentation "Manually frees the Lisp reference to the @code{object}. Probably should not be called.
5
6 @arg[object]{an instance of @class{g-object}}"))
7
8 (defmethod release ((object null)))
9
10 (defun release* (&rest objects)
11   "Calls @fun{release} on all objects in @code{objects}
12
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)))
18
19 (defmacro using ((var &optional (expr var)) &body body)
20   `(let ((,var ,expr))
21      (unwind-protect
22           (progn ,@body)
23        (release ,var))))
24
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)))
33
34 (defmacro using* ((&rest bindings) &body body)
35   (using-expand bindings body))