From f71611e1995b2645a183a52e221fccfcca64d2e0 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Wed, 10 Oct 2007 13:48:50 +0200 Subject: Make compile-time selector warnings work on the NeXT runtime, clean the Objective-C layer up a bit. darcs-hash:bff1454e2749c658ed0d0ad4eb51c4b1802e6f40 --- Objective-C/libobjcl.h | 3 +++ Objective-C/libobjcl.m | 25 ++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'Objective-C') diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h index 56ba2d7..9a48a1e 100644 --- a/Objective-C/libobjcl.h +++ b/Objective-C/libobjcl.h @@ -49,6 +49,9 @@ objcl_find_meta_class (const char *class_name); SEL objcl_find_selector (const char *selector_name); +SEL +objcl_intern_selector (const char *selector_name); + /* Return a null-terminated list of type information strings. The first entry describes the type of the method's return value. */ char ** diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m index 6f09cfe..de899e3 100644 --- a/Objective-C/libobjcl.m +++ b/Objective-C/libobjcl.m @@ -131,7 +131,7 @@ objcl_find_class (const char *class_name) #ifdef __NEXT_RUNTIME__ return objc_lookUpClass (class_name); #else - return NSClassFromString ([NSString stringWithUTF8String: class_name]); + return objc_lookup_class (class_name); #endif } @@ -153,9 +153,28 @@ objcl_find_meta_class (const char *class_name) SEL -objcl_find_selector (const char *class_name) +objcl_find_selector (const char *selector_name) { - return NSSelectorFromString ([NSString stringWithUTF8String: class_name]); +#ifdef __NEXT_RUNTIME__ + if (!(sel_isMapped ((SEL) selector_name))) /* XXX Does this work? */ + return NULL; + else + return sel_getUid (selector_name); +#else + return sel_get_any_uid (selector_name); +#endif +} + + +SEL +objcl_intern_selector (const char *selector_name) +{ + /* sel_registerName and sel_register_name seem not to be necessary here. */ +#ifdef __NEXT_RUNTIME__ + return sel_getUid (selector_name); +#else + return sel_get_uid (selector_name); +#endif } -- cgit v1.2.3