@@ -59,10 +59,11 @@ #define NO false typedef struct objc_class *Class; typedef struct objc_object *id; typedef const struct objc_selector *SEL; +typedef struct objc_ivar *Ivar; #if !defined(__wii__) && !defined(__amigaos__) typedef bool BOOL; #endif typedef id _Nullable (*IMP)(id _Nonnull, SEL _Nonnull, ...); typedef void (*objc_uncaught_exception_handler_t)(id _Nullable); @@ -73,19 +74,19 @@ Class _Nullable superclass; const char *_Nonnull name; unsigned long version; unsigned long info; long instanceSize; - struct objc_ivar_list *_Nullable iVars; + struct objc_ivar_list *_Nullable ivars; struct objc_method_list *_Nullable methodList; struct objc_dtable *_Nonnull DTable; Class _Nullable *_Nullable subclassList; void *_Nullable siblingClass; struct objc_protocol_list *_Nullable protocols; void *_Nullable GCObjectType; unsigned long ABIVersion; - int32_t *_Nonnull *_Nullable iVarOffsets; + int32_t *_Nonnull *_Nullable ivarOffsets; struct objc_property_list *_Nullable properties; }; enum objc_class_info { OBJC_CLASS_INFO_CLASS = 0x001, @@ -132,21 +133,10 @@ struct objc_method_list *_Nullable instanceMethods; struct objc_method_list *_Nullable classMethods; struct objc_protocol_list *_Nullable protocols; }; -struct objc_ivar { - const char *_Nonnull name; - const char *_Nonnull typeEncoding; - unsigned int offset; -}; - -struct objc_ivar_list { - unsigned int count; - struct objc_ivar iVars[1]; -}; - enum objc_property_attributes { OBJC_PROPERTY_READONLY = 0x01, OBJC_PROPERTY_GETTER = 0x02, OBJC_PROPERTY_ASSIGN = 0x04, OBJC_PROPERTY_READWRITE = 0x08, @@ -258,10 +248,15 @@ 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 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); extern void objc_exit(void); extern _Nullable objc_uncaught_exception_handler_t objc_setUncaughtExceptionHandler( objc_uncaught_exception_handler_t _Nullable handler); extern void objc_setForwardHandler(IMP _Nullable forward,