diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-08-06 17:39:18 +0200 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-08-06 17:39:18 +0200 |
commit | c191d8f49e58bbc5b769780a0a17b5cec82174f1 (patch) | |
tree | 72bb1fb5c57b577bf17f055c6a37f6396e2e6d61 /Lisp/type-conversion.lisp | |
parent | 6ac284ebf50cc18f42115db05feecbccd659f8eb (diff) |
Make class and selector name retrieval more portable.
darcs-hash:f7a369dba0dda3e067547210ce7c008ae60cdc05
Diffstat (limited to 'Lisp/type-conversion.lisp')
-rw-r--r-- | Lisp/type-conversion.lisp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Lisp/type-conversion.lisp b/Lisp/type-conversion.lisp index 8839b3b..3ac1ce6 100644 --- a/Lisp/type-conversion.lisp +++ b/Lisp/type-conversion.lisp @@ -32,4 +32,17 @@ ((id objc-class selector exception) (make-instance lisp-type :pointer value)) ((string) (foreign-string-to-lisp value)) - (otherwise value)))))
\ No newline at end of file + (otherwise value))))) + + +(defmacro with-foreign-objects (bindings &body body) + `(let ,(mapcar #'(lambda (name-value-pair) + (destructuring-bind (name value) + name-value-pair + `(,name (lisp->obj-data ,value)))) + bindings) + (unwind-protect + (progn ,@body) + ,@(mapcar #'(lambda (name-value-pair) + `(dealloc-obj-data ,(first name-value-pair))) + bindings)))) |