From 8d87e7250e5046e771a8383098032290c9a2f9b1 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Thu, 14 Feb 2008 21:58:44 +0100 Subject: Support passing booleans to Objective-C methods. darcs-hash:ab45821977fdf6dec25f869ad5bda8760c805b4f --- Lisp/method-invocation.lisp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Lisp/method-invocation.lisp b/Lisp/method-invocation.lisp index dd36dd3..c0e44ac 100644 --- a/Lisp/method-invocation.lisp +++ b/Lisp/method-invocation.lisp @@ -406,7 +406,20 @@ easier to use with __apply__. ;; it's the best we can do. (setf (argref arg-c-type i) (pointer-to (coerce-object arg 'id)))) - (t (setf (argref arg-c-type i) arg))))) + (t (setf (argref arg-c-type i) + (case arg + ;; Do the right thing for booleans. + ;; + ;; Note that Objective-C method + ;; invocations do not understand + ;; generalised booleans. Among other + ;; things, this means that passing 0 + ;; for a boolean is the same as + ;; passing NIL, not the same as + ;; passing T. + ((nil) 0) + ((t) 1) + (otherwise arg))))))) (let* ((error-cell (%objcl-invoke-with-types (- argc 2) return-typestring -- cgit v1.2.3