Ivar
struct old_ivar {
char *ivar_name;
char *ivar_type;
int ivar_offset;
#ifdef __LP64__
int space;
#endif
};
Property
struct old_property {
const char *name;
const char *attributes;
};
Method
struct old_method {
SEL method_name;
char *method_types;
IMP method_imp;
};
protocol
struct old_protocol {
Class isa;
const char *protocol_name;
struct old_protocol_list *protocol_list;
struct objc_method_description_list *instance_methods;
struct objc_method_description_list *class_methods;
};
struct objc_method_description *
lookup_protocol_method(old_protocol *proto, SEL aSel,
bool isRequiredMethod, bool isInstanceMethod,
bool recursive)
{
struct objc_method_description *m = nil;
old_protocol_ext *ext;
if (isRequiredMethod) {
if (isInstanceMethod) {
m = lookup_method(proto->instance_methods, aSel);
} else {
m = lookup_method(proto->class_methods, aSel);
}
} else if ((ext = ext_for_protocol(proto))) {
if (isInstanceMethod) {
m = lookup_method(ext->optional_instance_methods, aSel);
} else {
m = lookup_method(ext->optional_class_methods, aSel);
}
}
if (!m && recursive && proto->protocol_list) {
int i;
for (i = 0; !m && i < proto->protocol_list->count; i++) {
m = lookup_protocol_method(proto->protocol_list->list[i], aSel,
isRequiredMethod,isInstanceMethod,true);
}
}
return m;
}
category
struct old_category {
char *category_name;
char *class_name;
struct old_method_list *instance_methods;
struct old_method_list *class_methods;
struct old_protocol_list *protocols;
uint32_t size;
struct old_property_list *instance_properties;
};
参考