summaryrefslogtreecommitdiff
path: root/Lisp/method-invocation.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'Lisp/method-invocation.lisp')
-rw-r--r--Lisp/method-invocation.lisp143
1 files changed, 1 insertions, 142 deletions
diff --git a/Lisp/method-invocation.lisp b/Lisp/method-invocation.lisp
index ab520df..66f7368 100644
--- a/Lisp/method-invocation.lisp
+++ b/Lisp/method-invocation.lisp
@@ -425,7 +425,7 @@ easier to use with __apply__.
;; detailed method signature type information,
;; it's the best we can do.
(setf (argref arg-c-type i)
- (pointer-to (coerce-object arg 'id))))
+ (pointer-to (coerce-object arg :id))))
(t (setf (argref arg-c-type i)
(case arg
;; Do the right thing for booleans.
@@ -481,144 +481,3 @@ easier to use with __apply__.
(>= mismatch (length prefix))))))
(or (method-name-starts-with "alloc")
(method-name-starts-with "new"))))
-
-
-;;; (@* "High-level Data Conversion")
-(defgeneric coerce-object (object type))
-
-
-(defcoercion id ((x id))
- x)
-
-(defcoercion id ((x objective-c-class))
- x)
-
-(defcoercion id ((x exception))
- x)
-
-(defcoercion id ((x integer))
- (primitive-invoke (find-objc-class 'ns-number)
- "numberWithInt:"
- 'id
- x))
-
-(defcoercion id ((x float))
- (primitive-invoke (find-objc-class 'ns-number)
- (etypecase x
- (long-float "numberWithDouble:")
- (double-float "numberWithDouble:")
- (short-float "numberWithFloat:")
- (single-float "numberWithFloat:"))
- 'id
- x))
-
-(defcoercion id ((x null))
- +nil+)
-
-;; (defcoercion id ((x {list, string, t})) ...): See lisp-value-wrapping.lisp.
-
-
-(defcoercion class ((x id))
- (object-get-class x))
-
-(defcoercion class ((x exception))
- (object-get-class x))
-
-(defcoercion class ((x objective-c-class))
- x)
-
-(defcoercion class ((x string))
- (find-objc-class x t))
-
-(defcoercion class ((x symbol))
- (find-objc-class x t))
-
-
-(defcoercion integer ((x integer))
- x)
-
-(defcoercion integer ((x id))
- (assert (objc-typep x 'ns-number))
- (invoke x 'int-value))
-
-(defcoercion integer ((x number))
- (truncate x))
-
-(defcoercion integer ((x null))
- (declare (ignore x))
- +no+)
-
-(defcoercion integer (x)
- (declare (ignore x))
- +yes+)
-
-
-(defcoercion selector ((x selector))
- x)
-
-(defcoercion selector ((x symbol))
- (selector x))
-
-(defcoercion selector ((x string))
- (selector x))
-
-(defcoercion selector ((x cons))
- (selector x))
-
-
-(defcoercion exception ((x exception))
- x)
-
-
-(defcoercion character ((x character))
- x)
-
-(defcoercion character ((x integer))
- x)
-
-
-(defcoercion float ((x number))
- (float x))
-
-
-(defcoercion double ((x number))
- (float x))
-
-
-;; Note that this refers to the Objective-C BOOL type, not the Lisp
-;; BOOLEAN type.
-(defcoercion bool ((x null))
- (declare (ignore x))
- +no+)
-
-(defcoercion bool (x)
- (declare (ignore x))
- +yes+)
-
-
-;; Note that this refers to the Lisp BOOLEAN type, not the Objective-C
-;; BOOL type.
-(defcoercion boolean ((x number))
- (not (zerop x)))
-
-
-(defcoercion string ((x string))
- x)
-
-(defcoercion string ((x foreign-pointer))
- (check-type x foreign-pointer)
- x)
-
-
-(defcoercion pointer ((x foreign-pointer))
- (check-type x foreign-pointer)
- x)
-
-(defcoercion pointer ((x exception))
- (pointer-to x))
-
-(defcoercion pointer ((x c-pointer-wrapper))
- (pointer-to x))
-
-(defcoercion pointer ((x number))
- (pointer-to (coerce-object x 'id)))