diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-10-10 13:48:50 +0200 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-10-10 13:48:50 +0200 |
commit | f71611e1995b2645a183a52e221fccfcca64d2e0 (patch) | |
tree | bb077189374c81a3ece36d37a221a5d75530bb99 /Objective-C | |
parent | 8c5db651a2d55a8692b0dd78e37d4c01c4794585 (diff) |
Make compile-time selector warnings work on the NeXT runtime, clean the Objective-C layer up a bit.
darcs-hash:bff1454e2749c658ed0d0ad4eb51c4b1802e6f40
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 } |