@@ -59,10 +59,11 @@ #define NO false typedef struct objc_class *Class; typedef struct objc_object *id; typedef const struct objc_selector *SEL; +typedef const struct objc_method *Method; typedef const struct objc_ivar *Ivar; #if !defined(__wii__) && !defined(__amigaos__) typedef bool BOOL; #endif typedef id _Nullable (*IMP)(id _Nonnull, SEL _Nonnull, ...); @@ -96,47 +97,19 @@ OBJC_CLASS_INFO_LOADED = 0x200, OBJC_CLASS_INFO_DTABLE = 0x400, OBJC_CLASS_INFO_INITIALIZED = 0x800 }; -struct objc_object { - Class _Nonnull isa; -}; - -struct objc_selector { - uintptr_t UID; - const char *_Nullable typeEncoding; -}; - struct objc_super { id __unsafe_unretained _Nullable self; #ifdef __cplusplus Class _Nonnull class_; #else Class _Nonnull class; #endif }; -struct objc_method { - struct objc_selector selector; - IMP _Nonnull implementation; -}; - -struct objc_method_list { - struct objc_method_list *_Nullable next; - unsigned int count; - struct objc_method methods[1]; -}; - -struct objc_category { - const char *_Nonnull categoryName; - const char *_Nonnull className; - struct objc_method_list *_Nullable instanceMethods; - struct objc_method_list *_Nullable classMethods; - struct objc_protocol_list *_Nullable protocols; -}; - enum objc_property_attributes { OBJC_PROPERTY_READONLY = 0x01, OBJC_PROPERTY_GETTER = 0x02, OBJC_PROPERTY_ASSIGN = 0x04, OBJC_PROPERTY_READWRITE = 0x08, @@ -248,10 +221,14 @@ extern const char *_Nonnull protocol_getName(Protocol *_Nonnull protocol); extern bool protocol_isEqual(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2); extern bool protocol_conformsToProtocol(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2); +extern Method _Nullable *_Nullable class_copyMethodList(Class _Nullable class_, + unsigned int *_Nullable outCount); +extern SEL _Nonnull method_getName(Method _Nonnull method); +extern const char *_Nullable method_getTypeEncoding(Method _Nonnull method); extern Ivar _Nullable *_Nullable class_copyIvarList(Class _Nullable class_, unsigned int *_Nullable outCount); extern const char *_Nonnull ivar_getName(Ivar _Nonnull ivar); extern const char *_Nonnull ivar_getTypeEncoding(Ivar _Nonnull ivar); extern ptrdiff_t ivar_getOffset(Ivar _Nonnull ivar);