From a9e8e67fbfce2a60318e9b946200833ef242c24c Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Wed, 5 Mar 2008 16:43:17 +0100 Subject: Add function OBJECTIVE-C-CLASS-REGISTERED-P. darcs-hash:3e89853d61732a8fc928a1c3318dfaa648191e8c --- Lisp/data-types.lisp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'Lisp/data-types.lisp') diff --git a/Lisp/data-types.lisp b/Lisp/data-types.lisp index 8cff29a..c305d99 100644 --- a/Lisp/data-types.lisp +++ b/Lisp/data-types.lisp @@ -183,6 +183,53 @@ a suitable class method instead as you would in Objective-C. __invoke__, __invoke-by-name__, __exception__")) +(defgeneric objective-c-class-registered-p (class) + (:documentation "Determine whether a class has been registered with the Objective-C runtime. + +## Arguments and Values: + +*class* --- an **object** of **type** __objective-c-class__. + +Returns: a **boolean**. + + +## Description: + +_objective-c-class-registered-p_ determines whether **class** has been +registered with the Objective-C runtime. It is the only public API +provided by the class __objective-c-class__. + +A class is registered automatically when an instance is first seen by +Objective-CL or when an attempt is made to send a message to it or its +metaclass. + +The effect of attempting to add methods to registered classes is +undefined. Portable programs should therefore avoid it, even though it +may work reliably on some systems (where it can be useful for debugging +and development for portable programs as well). + + +## Examples: + + (define-objective-c-class mlk-my-class () + ((foos :initargs :foos) + (foo-count :foreign-type :int))) ;\"fooCount\" on the foreign side + => # + + (objective-c-class-registered-p (find-objc-class 'mlk-my-class)) + => NIL + + (invoke (find-objc-class 'mlk-my-class) 'new) + => #' {81DE1F8}> + + (objective-c-class-registered-p (find-objc-class 'mlk-my-class)) + => T")) + + +(defmethod objective-c-class-registered-p ((class objective-c-class)) + (foreign-class-registered-p class)) + + (defclass objective-c-class (standard-class c-pointer-wrapper) ((registered-p :type boolean :accessor foreign-class-registered-p -- cgit v1.2.3