diff --git a/ChangeLog b/ChangeLog index d93ef671e..5058979cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-02-20 Richard Frith-Macdonald + + * Source/NSDistributedNotificationCenter.m: + * Source/GSFFCallInvocation.m: + * Source/GSFFIInvocation.m: + * Source/common.h: + * Source/NSConnection.m: + * Source/NSData.m: + Use GSObjCRuntime functions for selector types until/unless we can get + a standard runtime API that handles them. + 2011-02-19 Richard Frith-Macdonald * Source/NSBundle.m: diff --git a/Source/GSFFCallInvocation.m b/Source/GSFFCallInvocation.m index d5b1f3f21..31832fcc9 100644 --- a/Source/GSFFCallInvocation.m +++ b/Source/GSFFCallInvocation.m @@ -922,7 +922,7 @@ GSInvocationCallback (void *callback_data, va_alist args) selector = sel_getType_np(runtimeName, receiverTypes); if (selector == 0) { - selector = sel_registerTypedName_np(runtimeName, receiverTypes); + selector = GSSelectorFromNameAndTypes(runtimeName, receiverTypes); } if (runtimeTypes != 0) { diff --git a/Source/GSFFIInvocation.m b/Source/GSFFIInvocation.m index a260d9eeb..21d1b5a88 100644 --- a/Source/GSFFIInvocation.m +++ b/Source/GSFFIInvocation.m @@ -100,11 +100,7 @@ gs_method_for_receiver_and_selector (id receiver, SEL sel) static INLINE SEL gs_find_best_typed_sel (SEL sel) { -#ifdef __GNU_LIBOBJC__ - if (!sel_getTypeEncoding(sel)) -#else - if (!sel_getType_np(sel)) -#endif + if (!GSTypesFromSelector(sel)) { const char *name = sel_getName(sel); @@ -164,11 +160,7 @@ static IMP gs_objc_msg_forward2 (id receiver, SEL sel) in the callback, but only under limited circumstances. */ sel = gs_find_best_typed_sel(sel); -#ifdef __GNU_LIBOBJC__ - sel_type = sel_getTypeEncoding(sel); -#else - sel_type = sel_getType_np(sel); -#endif + sel_type = GSTypesFromSelector(sel); if (sel_type) { sig = [NSMethodSignature signatureWithObjCTypes: sel_type]; @@ -557,17 +549,11 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user) } sig = nil; -#ifdef __GNU_LIBOBJC__ - if (gs_protocol_selector(sel_getTypeEncoding(selector)) == YES) + if (gs_protocol_selector(GSTypesFromSelector(selector)) == YES) { - sig = [NSMethodSignature signatureWithObjCTypes: sel_getTypeEncoding(selector)]; + sig = [NSMethodSignature signatureWithObjCTypes: + GSTypesFromSelector(selector)]; } -#else - if (gs_protocol_selector(sel_getType_np(selector)) == YES) - { - sig = [NSMethodSignature signatureWithObjCTypes: sel_getType_np(selector)]; - } -#endif if (sig == nil) { sig = [obj methodSignatureForSelector: selector]; @@ -580,21 +566,13 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user) if (sig != nil) { const char *receiverTypes = [sig methodType]; -#ifdef __GNU_LIBOBJC__ - const char *runtimeTypes = sel_getTypeEncoding(selector); -#else - const char *runtimeTypes = sel_getType_np(selector); -#endif + const char *runtimeTypes = GSTypesFromSelector(selector); if (runtimeTypes == 0 || strcmp(receiverTypes, runtimeTypes) != 0) { const char *runtimeName = sel_getName(selector); -#ifdef __GNU_LIBOBJC__ - selector = sel_registerTypedName(runtimeName, receiverTypes); -#else - selector = sel_registerTypedName_np(runtimeName, receiverTypes); -#endif + selector = GSSelectorFromNameAndTypes(runtimeName, receiverTypes); if (runtimeTypes != 0) { /* @@ -616,19 +594,11 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user) { selector = gs_find_best_typed_sel (selector); -#ifdef __GNU_LIBOBJC__ - if (sel_getTypeEncoding(selector) != 0) + if (GSTypesFromSelector(selector) != 0) { sig = [NSMethodSignature signatureWithObjCTypes: - sel_getTypeEncoding(selector)]; + GSTypesFromSelector(selector)]; } -#else - if (sel_getType_np(selector) != 0) - { - sig = [NSMethodSignature signatureWithObjCTypes: - sel_getType_np(selector)]; - } -#endif } if (sig == nil) diff --git a/Source/NSConnection.m b/Source/NSConnection.m index f95289616..8b83689d5 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -1991,11 +1991,7 @@ static NSLock *cached_proxies_gate = nil; type = [[object methodSignatureForSelector: [inv selector]] methodType]; if (type) { -#ifdef __GNU_LIBOBJC__ - sel_registerTypedName(sel_getName([inv selector]), type); -#else - sel_registerTypedName_np(sel_getName([inv selector]), type); -#endif + GSSelectorFromNameAndTypes(sel_getName([inv selector]), type); } } NSParameterAssert(type); diff --git a/Source/NSData.m b/Source/NSData.m index 5022bb6bb..633136528 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -1160,11 +1160,7 @@ failure: if (lt) { -#ifdef __GNU_LIBOBJC__ - sel = sel_registerTypedName(name, types); -#else - sel = sel_registerTypedName_np(name, types); -#endif + sel = GSSelectorFromNameAndTypes(name, types); } else { @@ -2807,11 +2803,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) if (lt) { -#ifdef __GNU_LIBOBJC__ - sel = sel_registerTypedName(name, types); -#else - sel = sel_registerTypedName_np(name, types); -#endif + sel = GSSelectorFromNameAndTypes(name, types); } else { diff --git a/Source/NSDistributedNotificationCenter.m b/Source/NSDistributedNotificationCenter.m index 569ed4133..2ab116438 100644 --- a/Source/NSDistributedNotificationCenter.m +++ b/Source/NSDistributedNotificationCenter.m @@ -811,13 +811,8 @@ static NSDistributedNotificationCenter *netCenter = nil; notification = [NSNotification notificationWithName: name object: object userInfo: userInfo]; -#ifdef __GNU_LIBOBJC__ - [recipient performSelector: sel_registerTypedName([aSelector cString], 0) + [recipient performSelector: GSSelectorFromNameAndTypes([aSelector cString], 0) withObject: notification]; -#else - [recipient performSelector: sel_registerTypedName_np([aSelector cString], 0) - withObject: notification]; -#endif } @end diff --git a/Source/common.h b/Source/common.h index 095642548..435f66c12 100644 --- a/Source/common.h +++ b/Source/common.h @@ -44,18 +44,12 @@ #import "Foundation/NSString.h" #import "Foundation/NSDebug.h" +/* These headers needed for string localisation ... hopefully we will + * localise all the exceptions and debug/error messages in all the source + * some day, so localisation needs ot be in the common header for all code. + */ #import "Foundation/NSBundle.h" #import "GNUstepBase/NSBundle+GNUstepBase.h" - -#include -#include - -#if defined(__GNUSTEP_RUNTIME__) || defined(NeXT_RUNTIME) -#define objc_malloc(x) malloc(x) -#define objc_realloc(p, s) realloc(p, s) -#define objc_free(x) free(x) -#endif - // Semi-private GNU[step] runtime function. IMP get_imp(Class, SEL);