diff options
Diffstat (limited to 'Objective-C')
-rw-r--r-- | Objective-C/libobjcl.h | 3 | ||||
-rw-r--r-- | Objective-C/libobjcl.m | 25 |
2 files changed, 25 insertions, 3 deletions
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 } |