From 80e4b9e501e4e702f1c32287c1ff57ca84054a7c Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Tue, 7 Jun 2011 19:37:35 +0000 Subject: In libobjc/: 2011-06-07 Nicola Pero In libobjc/: 2011-06-07 Nicola Pero Removed the Traditional Objective-C runtime public API. * Makefile.in (OBJC_DEPRECATED_H): Variable removed. (install-headers): Do not create the objc/deprecated directory and do not install the deprecated headers. (OBJC_H): Removed encoding.h and objc-api.h. * Object.m: Removed all methods with the exception of -class and -isEqual:. Updated includes. ([-class]): Use Modern API. * objc/Object.h: Do not include deprecated/Object.h. * objc/deprecated/Object.h: Removed. * linking.m (__objc_linking): Call [Object class] instead of [Object name]. * Protocol.m: Removed all methods with the exception of -isEqual:. Updated includes. * objc/Protocol.h: Do not include deprecated/Protocol.h. * objc/deprecated/Protocol.h: Removed. * objc/deprecated/struct_objc_symtab.h: Removed. * objc/deprecated/struct_objc_module.h: Removed. * objc/deprecated/struct_objc_ivar.h: Removed. * objc/deprecated/struct_objc_ivar_list.h: Removed. * objc/deprecated/struct_objc_method.h: Removed. * objc/deprecated/struct_objc_method_list.h: Removed. * objc/deprecated/struct_objc_protocol_list.h: Removed. * objc/deprecated/struct_objc_category.h: Removed. * objc/deprecated/MetaClass.h: Removed. * objc/deprecated/objc_msg_sendv.h: Removed. * objc/deprecated/README: Removed. * objc/deprecated/struct_objc_class.h: Removed. * objc/deprecated/struct_objc_protocol.h: Removed. * objc/deprecated/struct_objc_selector.h: Removed. * objc/encoding.h: Removed. * objc/message.h (struct objc_super): Removed the definition for the Traditional Objective-C runtime API. * objc/objc.h: Do not include objc/objc-decls.h. deprecated/struct_objc_selector.h, deprecated/MetaClass.h, deprecated/struct_objc_class.h, deprecated/struct_objc_protocol.h and deprecated/objc_msg_sendv.h. Uncommented new definition of Protocol *. * objc/objc-api.h: Removed. * objc/runtime.h: Updated comments. Removed check to detect concurrent usage of Traditional and Modern APIs. * objc-private/module-abi-8.h: Always define struct objc_class and struct objc_protocol. (struct objc_protocol_list): Changed type of 'list' argument from 'Protocol *' to 'struct objc_protocol *'. (class_get_instance_size): Added. * objc-private/protocols.h (__objc_protocols_add_protocol): Take a 'struct objc_protocol *' as argument, not a 'Protocol *'. * objc-private/runtime.h: Updated comments. * objc-private/selector.h (struct objc_selector, sel_eq): Added. * class.c: Include objc-private/selector.h. (objc_get_meta_class): Return a Class instead of a MetaClass. * encoding.c (method_get_next_argument): Removed. (method_get_first_argument): Removed. (method_get_nth_argument): Removed. * gc.c: Include objc/runtime.h instead of objc/encoding.h. Include objc-private/module-abi-8.h and ctype.h. * protocols.c (__objc_protocols_add_protocol): Take a 'struct objc_protocl *' as argument, not a 'Protocol *'. (class_addProtocol): Added casts to 'struct objc_protocol *' and 'Protocol *'. (class_copyProtocolList): Likewise. (protocol_conformsToProtocol): Likewise. (protocol_copyProtocolList): Likewise. * sarray.c: Include objc-private/module-abi-8.h. * sendmsg.c (method_get_next_argument): Removed. (method_get_first_argument): Removed. (method_get_nth_argument): Removed. (objc_msg_sendv): Removed. (arglist_t, retval_t): New. (class_get_class_method): Take a 'Class', not 'MetaClass', argument. * thr.c: Include module-abi-8.h. From-SVN: r174765 --- libobjc/objc-private/module-abi-8.h | 25 ++++++++++++------------- libobjc/objc-private/protocols.h | 2 +- libobjc/objc-private/runtime.h | 5 +---- libobjc/objc-private/selector.h | 19 +++++++++++++++++++ 4 files changed, 33 insertions(+), 18 deletions(-) (limited to 'libobjc/objc-private') diff --git a/libobjc/objc-private/module-abi-8.h b/libobjc/objc-private/module-abi-8.h index 0c9574b..4093452 100644 --- a/libobjc/objc-private/module-abi-8.h +++ b/libobjc/objc-private/module-abi-8.h @@ -149,34 +149,30 @@ struct objc_method_list structure. */ }; -/* Currently defined in Protocol.m (that definition should go away - once we include this file). Note that a 'struct - objc_method_description' as embedded inside a Protocol uses the - same trick as a 'struct objc_method': the method_name is a 'char *' - according to the compiler, who puts the method name as a string in - there. At runtime, the selectors need to be registered, and the - method_name then becomes a SEL. */ +/* Note that a 'struct objc_method_description' as embedded inside a + Protocol uses the same trick as a 'struct objc_method': the + method_name is a 'char *' according to the compiler, who puts the + method name as a string in there. At runtime, the selectors need + to be registered, and the method_name then becomes a SEL. */ struct objc_method_description_list { int count; struct objc_method_description list[1]; }; -/* Currently defined by objc/objc.h. */ -/* struct objc_protocol { struct objc_class* class_pointer; char *protocol_name; struct objc_protocol_list *protocol_list; struct objc_method_description_list *instance_methods, *class_methods; }; -*/ + struct objc_protocol_list { struct objc_protocol_list *next; size_t count; - Protocol *list[1]; + struct objc_protocol *list[1]; }; /* @@ -189,7 +185,6 @@ struct objc_protocol_list some members change type. The compiler generates "char* const" and places a string in the following member variables: super_class. */ -#ifndef __objc_STRUCT_OBJC_CLASS_defined struct objc_class { struct objc_class* class_pointer; /* Pointer to the class's meta class. */ @@ -232,7 +227,6 @@ struct objc_class { struct objc_protocol_list *protocols; /* Protocols conformed to */ void* gc_object_type; }; -#endif /* __objc_STRUCT_OBJC_CLASS_defined */ /* This is used to assure consistent access to the info field of classes. */ @@ -283,6 +277,11 @@ struct objc_class { (cls)->info >>= (HOST_BITS_PER_LONG/2); \ __CLS_SETINFO(cls, (((unsigned long)num) << (HOST_BITS_PER_LONG/2))); }) +static inline long +class_get_instance_size(Class _class) +{ + return CLS_ISCLASS(_class)?_class->instance_size:0; +} /* The compiler generates one of these structures for each category. A class may have many categories and contain both instance and diff --git a/libobjc/objc-private/protocols.h b/libobjc/objc-private/protocols.h index 87f8fc8..3219ff2 100644 --- a/libobjc/objc-private/protocols.h +++ b/libobjc/objc-private/protocols.h @@ -33,6 +33,6 @@ __objc_protocols_init (void); protocols by name, which allows objc_getProtocol(name) to be implemented efficiently. */ void -__objc_protocols_add_protocol (const char *name, Protocol *object); +__objc_protocols_add_protocol (const char *name, struct objc_protocol *object); #endif /* not __objc_private_protocols_INCLUDE_GNU */ diff --git a/libobjc/objc-private/runtime.h b/libobjc/objc-private/runtime.h index 5406294..bd11392 100644 --- a/libobjc/objc-private/runtime.h +++ b/libobjc/objc-private/runtime.h @@ -32,10 +32,7 @@ The original list was: #include "objc/hash.h" #include "objc/objc-list.h" -but can almost certainly be shrinked down. - -Note that you can use this file both with objc/objc-api.h and with -objc/runtime.h. */ +but can almost certainly be shrinked down. */ #ifndef __objc_private_runtime_INCLUDE_GNU #define __objc_private_runtime_INCLUDE_GNU diff --git a/libobjc/objc-private/selector.h b/libobjc/objc-private/selector.h index 490e171..1832a79 100644 --- a/libobjc/objc-private/selector.h +++ b/libobjc/objc-private/selector.h @@ -28,6 +28,25 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* Private runtime functions that may go away or be rewritten or replaced. */ +/* +** Definition of a selector. Selectors themselves are not unique, but +** the sel_id is a unique identifier. +*/ +struct objc_selector +{ + void *sel_id; + const char *sel_types; +}; + +inline static BOOL +sel_eq (SEL s1, SEL s2) +{ + if (s1 == 0 || s2 == 0) + return s1 == s2; + else + return s1->sel_id == s2->sel_id; +} + /* Number of selectors stored in each of the selector tables. */ extern unsigned int __objc_selector_max_index; -- cgit v1.1