From afc1b0855e777332ff9331c70dad9d22b9d4ebfc Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 3 Feb 2008 09:12:03 +0100 Subject: Make selectors funcallable. darcs-hash:cf005558542aa4148fe2e94a113c0eac682d3cac --- Lisp/data-types.lisp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'Lisp') diff --git a/Lisp/data-types.lisp b/Lisp/data-types.lisp index 0b5865d..ba98fc3 100644 --- a/Lisp/data-types.lisp +++ b/Lisp/data-types.lisp @@ -38,7 +38,8 @@ :initform (cffi:null-pointer)))) -(defclass selector (c-pointer-wrapper) () +(defclass selector (c2mop:funcallable-standard-object c-pointer-wrapper) () + (:metaclass c2mop:funcallable-standard-class) (:documentation "An Objective-C method selector. ## Description: @@ -55,6 +56,18 @@ Use __find-selector__ instead. __find-selector__")) +(defmethod shared-initialize :after ((selector selector) + slot-names + &rest initargs + &key + &allow-other-keys) + (declare (ignore slot-names initargs)) + (c2mop:set-funcallable-instance-function + selector + #'(lambda (receiver &rest args) + (apply #'invoke-by-name receiver selector args)))) + + (defclass id (c-pointer-wrapper) () (:documentation "An instance of an Objective-C class. -- cgit v1.2.3