Rename legacy types.

For consistency, each now has a `_gcc` or `_gsv1` suffix indicating
whether they were inherited from the GCC or GNUstep v1 ABI.
main
David Chisnall 8 years ago
parent 48967e58f3
commit 64ab2d51f5

@ -37,7 +37,7 @@ struct objc_category
struct objc_property_list *class_properties; struct objc_property_list *class_properties;
}; };
struct objc_category_legacy struct objc_category_gcc
{ {
/** /**
* The name of this category. * The name of this category.
@ -50,11 +50,11 @@ struct objc_category_legacy
/** /**
* The list of instance methods to add to the class. * The list of instance methods to add to the class.
*/ */
struct objc_method_list_legacy *instance_methods; struct objc_method_list_gcc *instance_methods;
/** /**
* The list of class methods to add to the class. * The list of class methods to add to the class.
*/ */
struct objc_method_list_legacy *class_methods; struct objc_method_list_gcc *class_methods;
/** /**
* The list of protocols adopted by this category. * The list of protocols adopted by this category.
*/ */

@ -144,7 +144,7 @@ struct objc_class
}; };
// end: objc_class // end: objc_class
struct legacy_gnustep_objc_class struct objc_class_gsv1
{ {
/** /**
* Pointer to the metaclass for this class. The metaclass defines the * Pointer to the metaclass for this class. The metaclass defines the
@ -187,12 +187,12 @@ struct legacy_gnustep_objc_class
/** /**
* Metadata describing the instance variables in this class. * Metadata describing the instance variables in this class.
*/ */
struct objc_ivar_list_legacy *ivars; struct objc_ivar_list_gcc *ivars;
/** /**
* Metadata for for defining the mappings from selectors to IMPs. Linked * Metadata for for defining the mappings from selectors to IMPs. Linked
* list of method list structures, one per class and one per category. * list of method list structures, one per class and one per category.
*/ */
struct objc_method_list_legacy *methods; struct objc_method_list_gcc *methods;
/** /**
* The dispatch table for this class. Intialized and maintained by the * The dispatch table for this class. Intialized and maintained by the
* runtime. * runtime.
@ -283,7 +283,7 @@ struct legacy_gnustep_objc_class
* same fields, and you can test the new abi flag to tell whether it is safe to * same fields, and you can test the new abi flag to tell whether it is safe to
* access the subsequent fields. * access the subsequent fields.
*/ */
struct legacy_gcc_objc_class struct objc_class_gcc
{ {
struct objc_class *isa; struct objc_class *isa;
struct objc_class *super_class; struct objc_class *super_class;
@ -291,7 +291,7 @@ struct legacy_gcc_objc_class
long version; long version;
unsigned long info; unsigned long info;
long instance_size; long instance_size;
struct objc_ivar_list_legacy *ivars; struct objc_ivar_list_gcc *ivars;
struct objc_method_list *methods; struct objc_method_list *methods;
void *dtable; void *dtable;
struct objc_class *subclass_list; struct objc_class *subclass_list;
@ -375,7 +375,7 @@ static inline BOOL objc_test_class_flag(struct objc_class *aClass,
return (aClass->info & (unsigned long)flag) == (unsigned long)flag; return (aClass->info & (unsigned long)flag) == (unsigned long)flag;
} }
static inline BOOL objc_test_class_flag_legacy(struct legacy_gnustep_objc_class *aClass, static inline BOOL objc_test_class_flag_legacy(struct objc_class_gsv1 *aClass,
enum objc_class_flags flag) enum objc_class_flags flag)
{ {
return (aClass->info & (unsigned long)flag) == (unsigned long)flag; return (aClass->info & (unsigned long)flag) == (unsigned long)flag;
@ -396,7 +396,7 @@ static inline int objc_get_class_version(struct objc_class *aClass)
return aClass->abi_version + 1; return aClass->abi_version + 1;
} }
static inline int objc_get_class_version_legacy(struct legacy_gnustep_objc_class *aClass) static inline int objc_get_class_version_legacy(struct objc_class_gsv1 *aClass)
{ {
if (!objc_test_class_flag_legacy(aClass, objc_class_flag_new_abi)) if (!objc_test_class_flag_legacy(aClass, objc_class_flag_new_abi))
{ {

@ -167,7 +167,7 @@ PRIVATE BOOL objc_resolve_class(Class cls)
} }
else else
{ {
struct legacy_gnustep_objc_class *ocls = objc_legacy_class_for_class(cls); struct objc_class_gsv1 *ocls = objc_legacy_class_for_class(cls);
if (ocls != NULL) if (ocls != NULL)
{ {
const char *super_name = (const char*)ocls->super_class; const char *super_name = (const char*)ocls->super_class;
@ -258,7 +258,7 @@ PRIVATE BOOL objc_resolve_class(Class cls)
// Fix up the ivar offsets // Fix up the ivar offsets
objc_compute_ivar_offsets(cls); objc_compute_ivar_offsets(cls);
struct legacy_gnustep_objc_class *oldCls = objc_legacy_class_for_class(cls); struct objc_class_gsv1 *oldCls = objc_legacy_class_for_class(cls);
if (oldCls) if (oldCls)
{ {
oldCls->super_class = cls->super_class; oldCls->super_class = cls->super_class;

@ -91,7 +91,7 @@ PRIVATE void objc_compute_ivar_offsets(Class class)
} }
// If we have a legacy ivar list, update the offset in it too - // If we have a legacy ivar list, update the offset in it too -
// code from older compilers may access this directly! // code from older compilers may access this directly!
struct legacy_gnustep_objc_class* legacy = objc_legacy_class_for_class(class); struct objc_class_gsv1* legacy = objc_legacy_class_for_class(class);
if (legacy) if (legacy)
{ {
for (i = 0 ; i < class->ivars->count ; i++) for (i = 0 ; i < class->ivars->count ; i++)

@ -75,7 +75,7 @@ static inline ivar_ownership ivarGetOwnership(Ivar ivar)
/** /**
* Legacy ivar structure, inherited from the GCC ABI. * Legacy ivar structure, inherited from the GCC ABI.
*/ */
struct objc_ivar_legacy struct objc_ivar_gcc
{ {
/** /**
* Name of this instance variable. * Name of this instance variable.
@ -123,7 +123,7 @@ struct objc_ivar_list
/** /**
* Legacy version of the ivar list * Legacy version of the ivar list
*/ */
struct objc_ivar_list_legacy struct objc_ivar_list_gcc
{ {
/** /**
* The number of instance variables in this list. * The number of instance variables in this list.
@ -133,6 +133,6 @@ struct objc_ivar_list_legacy
* An array of instance variable metadata structures. Note that this array * An array of instance variable metadata structures. Note that this array
* has count elements. * has count elements.
*/ */
struct objc_ivar_legacy ivar_list[]; struct objc_ivar_gcc ivar_list[];
}; };

@ -12,7 +12,7 @@
PRIVATE size_t lengthOfTypeEncoding(const char *types); PRIVATE size_t lengthOfTypeEncoding(const char *types);
static ivar_ownership ownershipForIvar(struct legacy_gnustep_objc_class *cls, int idx) static ivar_ownership ownershipForIvar(struct objc_class_gsv1 *cls, int idx)
{ {
if (objc_get_class_version_legacy(cls) < 2) if (objc_get_class_version_legacy(cls) < 2)
{ {
@ -29,9 +29,9 @@ static ivar_ownership ownershipForIvar(struct legacy_gnustep_objc_class *cls, in
return ownership_unsafe; return ownership_unsafe;
} }
static struct objc_ivar_list *upgradeIvarList(struct legacy_gnustep_objc_class *cls) static struct objc_ivar_list *upgradeIvarList(struct objc_class_gsv1 *cls)
{ {
struct objc_ivar_list_legacy *l = cls->ivars; struct objc_ivar_list_gcc *l = cls->ivars;
if (l == NULL) if (l == NULL)
{ {
return NULL; return NULL;
@ -69,7 +69,7 @@ static struct objc_ivar_list *upgradeIvarList(struct legacy_gnustep_objc_class *
return n; return n;
} }
static struct objc_method_list *upgradeMethodList(struct objc_method_list_legacy *old) static struct objc_method_list *upgradeMethodList(struct objc_method_list_gcc *old)
{ {
if (old == NULL) if (old == NULL)
{ {
@ -246,12 +246,12 @@ static struct objc_property_list *upgradePropertyList(struct objc_property_list_
static int legacy_key; static int legacy_key;
PRIVATE struct legacy_gnustep_objc_class* objc_legacy_class_for_class(Class cls) PRIVATE struct objc_class_gsv1* objc_legacy_class_for_class(Class cls)
{ {
return (struct legacy_gnustep_objc_class*)objc_getAssociatedObject((id)cls, &legacy_key); return (struct objc_class_gsv1*)objc_getAssociatedObject((id)cls, &legacy_key);
} }
PRIVATE Class objc_upgrade_class(struct legacy_gnustep_objc_class *oldClass) PRIVATE Class objc_upgrade_class(struct objc_class_gsv1 *oldClass)
{ {
Class cls = calloc(sizeof(struct objc_class), 1); Class cls = calloc(sizeof(struct objc_class), 1);
cls->isa = oldClass->isa; cls->isa = oldClass->isa;
@ -268,16 +268,16 @@ PRIVATE Class objc_upgrade_class(struct legacy_gnustep_objc_class *oldClass)
objc_register_selectors_from_class(cls); objc_register_selectors_from_class(cls);
if (!objc_test_class_flag(cls, objc_class_flag_meta)) if (!objc_test_class_flag(cls, objc_class_flag_meta))
{ {
cls->isa = objc_upgrade_class((struct legacy_gnustep_objc_class*)cls->isa); cls->isa = objc_upgrade_class((struct objc_class_gsv1*)cls->isa);
objc_setAssociatedObject((id)cls, &legacy_key, (id)oldClass, OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject((id)cls, &legacy_key, (id)oldClass, OBJC_ASSOCIATION_ASSIGN);
} }
return cls; return cls;
} }
PRIVATE struct objc_category *objc_upgrade_category(struct objc_category_legacy *old) PRIVATE struct objc_category *objc_upgrade_category(struct objc_category_gcc *old)
{ {
struct objc_category *cat = calloc(1, sizeof(struct objc_category)); struct objc_category *cat = calloc(1, sizeof(struct objc_category));
memcpy(cat, old, sizeof(struct objc_category_legacy)); memcpy(cat, old, sizeof(struct objc_category_gcc));
cat->instance_methods = upgradeMethodList(old->instance_methods); cat->instance_methods = upgradeMethodList(old->instance_methods);
cat->class_methods = upgradeMethodList(old->class_methods); cat->class_methods = upgradeMethodList(old->class_methods);
return cat; return cat;

@ -5,10 +5,10 @@
#include "category.h" #include "category.h"
#include "protocol.h" #include "protocol.h"
PRIVATE Class objc_upgrade_class(struct legacy_gnustep_objc_class *oldClass); PRIVATE Class objc_upgrade_class(struct objc_class_gsv1 *oldClass);
PRIVATE struct objc_category *objc_upgrade_category(struct objc_category_legacy *); PRIVATE struct objc_category *objc_upgrade_category(struct objc_category_gcc *);
PRIVATE struct legacy_gnustep_objc_class* objc_legacy_class_for_class(Class); PRIVATE struct objc_class_gsv1* objc_legacy_class_for_class(Class);
PRIVATE struct objc_protocol *objc_upgrade_protocol_gcc(struct objc_protocol_gcc*); PRIVATE struct objc_protocol *objc_upgrade_protocol_gcc(struct objc_protocol_gcc*);
PRIVATE struct objc_protocol *objc_upgrade_protocol_gsv1(struct objc_protocol_gsv1*); PRIVATE struct objc_protocol *objc_upgrade_protocol_gsv1(struct objc_protocol_gsv1*);

@ -17,7 +17,7 @@ struct objc_method
const char *types; const char *types;
}; };
struct objc_method_legacy struct objc_method_gcc
{ {
/** /**
* Selector used to send messages to this method. The type encoding of * Selector used to send messages to this method. The type encoding of
@ -66,12 +66,12 @@ struct objc_method_list
/** /**
* Legacy version of the method list. * Legacy version of the method list.
*/ */
struct objc_method_list_legacy struct objc_method_list_gcc
{ {
/** /**
* The next group of methods in the list. * The next group of methods in the list.
*/ */
struct objc_method_list_legacy *next; struct objc_method_list_gcc *next;
/** /**
* The number of methods in this list. * The number of methods in this list.
*/ */
@ -79,5 +79,5 @@ struct objc_method_list_legacy
/** /**
* An array of methods. Note that the actual size of this is count. * An array of methods. Note that the actual size of this is count.
*/ */
struct objc_method_legacy methods[]; struct objc_method_gcc methods[];
}; };

Loading…
Cancel
Save