Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -369,11 +369,11 @@ } + (const char*)typeEncodingForInstanceSelector: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) - return objc_get_type_encoding(self, selector); + return class_getMethodTypeEncoding(self, selector); #else Method m; if ((m = class_getInstanceMethod(self, selector)) == NULL) return NULL; @@ -834,11 +834,11 @@ #endif - (const char*)typeEncodingForSelector: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) - return objc_get_type_encoding(object_getClass(self), selector); + return class_getMethodTypeEncoding(object_getClass(self), selector); #else Method m; if ((m = class_getInstanceMethod(object_getClass(self), selector)) == NULL) Index: src/runtime/class.m ================================================================== --- src/runtime/class.m +++ src/runtime/class.m @@ -616,11 +616,11 @@ { return objc_sparsearray_get(cls->dtable, (uint32_t)sel->uid); } const char* -objc_get_type_encoding(Class cls, SEL sel) +class_getMethodTypeEncoding(Class cls, SEL sel) { struct objc_method_list *ml; struct objc_category **cats; unsigned int i; @@ -653,12 +653,12 @@ } } objc_global_mutex_unlock(); - if (cls->superclass != NULL) - return objc_get_type_encoding(cls->superclass, sel); + if (cls->superclass != Nil) + return class_getMethodTypeEncoding(cls->superclass, sel); return NULL; } IMP Index: src/runtime/runtime.h ================================================================== --- src/runtime/runtime.h +++ src/runtime/runtime.h @@ -37,16 +37,22 @@ #if __has_attribute(objc_root_class) # define OBJC_ROOT_CLASS __attribute__((objc_root_class)) #else # define OBJC_ROOT_CLASS #endif + +#define Nil (Class)0 +#define nil (id)0 +#define YES (BOOL)1 +#define NO (BOOL)0 typedef struct objc_class* Class; typedef struct objc_object* id; typedef const struct objc_selector* SEL; typedef signed char BOOL; typedef id (*IMP)(id, SEL, ...); +typedef void (*objc_uncaught_exception_handler)(id); struct objc_class { Class isa; Class superclass; const char *name; @@ -109,26 +115,28 @@ }; struct objc_ivar { const char *name; const char *type; - unsigned offset; + unsigned int offset; }; struct objc_ivar_list { - unsigned count; + unsigned int count; struct objc_ivar ivars[1]; }; -#define OBJC_PROPERTY_READONLY 0x01 -#define OBJC_PROPERTY_GETTER 0x02 -#define OBJC_PROPERTY_ASSIGN 0x04 -#define OBJC_PROPERTY_READWRITE 0x08 -#define OBJC_PROPERTY_RETAIN 0x10 -#define OBJC_PROPERTY_COPY 0x20 -#define OBJC_PROPERTY_NONATOMIC 0x40 -#define OBJC_PROPERTY_SETTER 0x80 +enum objc_property_attributes { + OBJC_PROPERTY_READONLY = 0x01, + OBJC_PROPERTY_GETTER = 0x02, + OBJC_PROPERTY_ASSIGN = 0x04, + OBJC_PROPERTY_READWRITE = 0x08, + OBJC_PROPERTY_RETAIN = 0x10, + OBJC_PROPERTY_COPY = 0x20, + OBJC_PROPERTY_NONATOMIC = 0x40, + OBJC_PROPERTY_SETTER = 0x80 +}; struct objc_property { const char *name; unsigned char attributes; BOOL synthesized; @@ -137,11 +145,11 @@ const char *type; } getter, setter; }; struct objc_property_list { - unsigned count; + unsigned int count; struct objc_property_list *next; struct objc_property properties[1]; }; #ifdef __OBJC__ @@ -168,17 +176,10 @@ struct objc_protocol_list *next; long count; OBJC_UNSAFE_UNRETAINED Protocol *list[1]; }; -#define Nil (Class)0 -#define nil (id)0 -#define YES (BOOL)1 -#define NO (BOOL)0 - -typedef void (*objc_uncaught_exception_handler)(id); - #ifdef __cplusplus extern "C" { #endif extern SEL sel_registerName(const char*); extern const char* sel_getName(SEL); @@ -194,19 +195,15 @@ extern bool class_isKindOfClass(Class, Class); extern unsigned long class_getInstanceSize(Class); extern bool class_respondsToSelector(Class, SEL); extern bool class_conformsToProtocol(Class, Protocol*); extern IMP class_getMethodImplementation(Class, SEL); +extern const char* class_getMethodTypeEncoding(Class, SEL); extern IMP class_replaceMethod(Class, SEL, IMP, const char*); -extern const char* objc_get_type_encoding(Class, SEL); extern Class object_getClass(id); extern Class object_setClass(id, Class); extern const char* object_getClassName(id); -extern IMP objc_msg_lookup(id, SEL); -extern IMP objc_msg_lookup_stret(id, SEL); -extern IMP objc_msg_lookup_super(struct objc_super*, SEL); -extern IMP objc_msg_lookup_super_stret(struct objc_super*, SEL); extern const char* protocol_getName(Protocol*); extern bool protocol_isEqual(Protocol*, Protocol*); extern bool protocol_conformsToProtocol(Protocol*, Protocol*); extern void objc_exit(void); extern objc_uncaught_exception_handler objc_setUncaughtExceptionHandler( @@ -215,13 +212,18 @@ extern IMP (*objc_forward_handler_stret)(id, SEL); extern id objc_autorelease(id); extern void* objc_autoreleasePoolPush(void); extern void objc_autoreleasePoolPop(void*); extern id _objc_rootAutorelease(id); +/* Used by the compiler, but can be called manually. */ +extern IMP objc_msg_lookup(id, SEL); +extern IMP objc_msg_lookup_stret(id, SEL); +extern IMP objc_msg_lookup_super(struct objc_super*, SEL); +extern IMP objc_msg_lookup_super_stret(struct objc_super*, SEL); #ifdef __cplusplus } #endif #undef OBJC_UNSAFE_UNRETAINED #undef OBJC_ROOT_CLASS #endif