+2011-06-07 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ 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.
+
2011-06-03 Nicola Pero <nicola.pero@meta-innovation.com>
* Makefile.in (OBJC_DEPRECATED_H): Removed struct_objc_static_instances.h
NXConstStr.h \
Object.h \
Protocol.h \
- encoding.h \
message.h \
- objc-api.h \
objc-decls.h \
runtime.h \
thr.h
-# User-visible header files containing deprecated APIs, from the
-# objc/deprecated directory
-OBJC_DEPRECATED_H = \
- MetaClass.h \
- Object.h \
- Protocol.h \
- objc_msg_sendv.h \
- struct_objc_category.h \
- struct_objc_class.h \
- struct_objc_ivar.h \
- struct_objc_ivar_list.h \
- struct_objc_method.h \
- struct_objc_method_list.h \
- struct_objc_module.h \
- struct_objc_protocol.h \
- struct_objc_protocol_list.h \
- struct_objc_selector.h \
- struct_objc_symtab.h
-
# Objective-C source files to compile
OBJC_SOURCE_FILES = \
NXConstStr.m \
realfile=$(srcdir)/objc/$${file}; \
$(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \
done
- $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc/deprecated
- for file in $(OBJC_DEPRECATED_H); do \
- realfile=$(srcdir)/objc/deprecated/$${file}; \
- $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc/deprecated; \
- done
check uninstall install-strip dist installcheck installdirs:
<http://www.gnu.org/licenses/>. */
#include "objc-private/common.h"
-#include <stdarg.h>
-#include <string.h> /* For strcmp. */
-#include <errno.h>
#include "objc/Object.h"
-#include "objc/Protocol.h"
-#include "objc/objc-api.h"
+#include "objc/runtime.h"
@implementation Object
- (Class)class
{
- return object_get_class (self);
+ return object_getClass (self);
}
- (BOOL)isEqual: (id)anObject
}
@end
-
-/* The following methods were deprecated in GCC 4.6.0 and will be
- removed in the next GCC release. */
-@implementation Object (Deprecated)
-
-+ initialize
-{
- return self;
-}
-
-- init
-{
- return self;
-}
-
-+ new
-{
- return [[self alloc] init];
-}
-
-+ alloc
-{
- return class_create_instance(self);
-}
-
-- free
-{
- return object_dispose(self);
-}
-
-- copy
-{
- return [[self shallowCopy] deepen];
-}
-
-- shallowCopy
-{
- return object_copy(self);
-}
-
-- deepen
-{
- return self;
-}
-
-- deepCopy
-{
- return [self copy];
-}
-
-- (Class)superClass
-{
- return object_get_super_class(self);
-}
-
-- (MetaClass)metaClass
-{
- return object_get_meta_class(self);
-}
-
-- (const char *)name
-{
- return object_get_class_name(self);
-}
-
-- self
-{
- return self;
-}
-
-- (unsigned int)hash
-{
- return (size_t)self;
-}
-
-- (int)compare:(id)anotherObject;
-{
- if ([self isEqual:anotherObject])
- return 0;
- // Ordering objects by their address is pretty useless,
- // so subclasses should override this is some useful way.
- else if ((id)self > anotherObject)
- return 1;
- else
- return -1;
-}
-
-- (BOOL)isMetaClass
-{
- return NO;
-}
-
-- (BOOL)isClass
-{
- return object_is_class(self);
-}
-
-- (BOOL)isInstance
-{
- return object_is_instance(self);
-}
-
-- (BOOL)isKindOf:(Class)aClassObject
-{
- Class class;
-
- for (class = self->isa; class!=Nil; class = class_get_super_class(class))
- if (class==aClassObject)
- return YES;
- return NO;
-}
-
-- (BOOL)isMemberOf:(Class)aClassObject
-{
- return self->isa==aClassObject;
-}
-
-- (BOOL)isKindOfClassNamed:(const char *)aClassName
-{
- Class class;
-
- if (aClassName!=NULL)
- for (class = self->isa; class!=Nil; class = class_get_super_class(class))
- if (!strcmp(class_get_class_name(class), aClassName))
- return YES;
- return NO;
-}
-
-- (BOOL)isMemberOfClassNamed:(const char *)aClassName
-{
- return ((aClassName!=NULL)
- &&!strcmp(class_get_class_name(self->isa), aClassName));
-}
-
-+ (BOOL)instancesRespondTo:(SEL)aSel
-{
- return class_get_instance_method(self, aSel) != (Method_t)0;
-}
-
-- (BOOL)respondsTo:(SEL)aSel
-{
- return ((object_is_instance(self)
- ?class_get_instance_method(self->isa, aSel)
- :class_get_class_method(self->isa, aSel)) != (Method_t)0);
-}
-
-+ (IMP)instanceMethodFor:(SEL)aSel
-{
- return method_get_imp(class_get_instance_method(self, aSel));
-}
-
-// Indicates if the receiving class or instance conforms to the given protocol
-// not usually overridden by subclasses
-//
-// Modified 9/5/94 to always search the class object's protocol list, rather
-// than the meta class.
-
-+ (BOOL) conformsTo: (Protocol*)aProtocol
-{
- size_t i;
- struct objc_protocol_list* proto_list;
- id parent;
-
- for (proto_list = ((Class)self)->protocols;
- proto_list; proto_list = proto_list->next)
- {
- for (i=0; i < proto_list->count; i++)
- {
- if ([proto_list->list[i] conformsTo: aProtocol])
- return YES;
- }
- }
-
- if ((parent = [self superClass]))
- return [parent conformsTo: aProtocol];
- else
- return NO;
-}
-
-- (BOOL) conformsTo: (Protocol*)aProtocol
-{
- return [[self class] conformsTo:aProtocol];
-}
-
-- (IMP)methodFor:(SEL)aSel
-{
- return (method_get_imp(object_is_instance(self)
- ?class_get_instance_method(self->isa, aSel)
- :class_get_class_method(self->isa, aSel)));
-}
-
-+ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel
-{
- return ((struct objc_method_description *)
- class_get_instance_method(self, aSel));
-}
-
-- (struct objc_method_description *)descriptionForMethod:(SEL)aSel
-{
- return ((struct objc_method_description *)
- (object_is_instance(self)
- ?class_get_instance_method(self->isa, aSel)
- :class_get_class_method(self->isa, aSel)));
-}
-
-- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame
-{
- return objc_msg_sendv(self, aSel, argFrame);
-}
-
-+ poseAs:(Class)aClassObject
-{
- return class_pose_as(self, aClassObject);
-}
-
-- (Class)transmuteClassTo:(Class)aClassObject
-{
- if (object_is_instance(self))
- if (class_is_class(aClassObject))
- if (class_get_instance_size(aClassObject)==class_get_instance_size(isa))
- if ([self isKindOf:aClassObject])
- {
- Class old_isa = isa;
- isa = aClassObject;
- return old_isa;
- }
- return nil;
-}
-
-+ (int)version
-{
- return class_get_version(self);
-}
-
-+ setVersion:(int)aVersion
-{
- class_set_version(self, aVersion);
- return self;
-}
-
-@end
#include "objc-private/common.h"
#include "objc/runtime.h"
-#include "objc-private/module-abi-8.h"
#include "objc/Protocol.h"
@implementation Protocol
return protocol_isEqual (self, obj);
}
@end
-
-@implementation Protocol (Deprecated)
-
-- (const char *)name
-{
- return protocol_name;
-}
-
-- (BOOL) conformsTo: (Protocol *)aProtocolObject
-{
- return protocol_conformsToProtocol (self, aProtocolObject);
-}
-
-- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel
-{
- int i;
- struct objc_protocol_list* proto_list;
- struct objc_method_description *result;
-
- if (instance_methods)
- for (i = 0; i < instance_methods->count; i++)
- {
- if (sel_isEqual (instance_methods->list[i].name, aSel))
- return &(instance_methods->list[i]);
- }
-
- for (proto_list = protocol_list; proto_list; proto_list = proto_list->next)
- {
- size_t j;
- for (j=0; j < proto_list->count; j++)
- {
- if ((result = [proto_list->list[j]
- descriptionForInstanceMethod: aSel]))
- return result;
- }
- }
-
- return NULL;
-}
-
-- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
-{
- int i;
- struct objc_protocol_list* proto_list;
- struct objc_method_description *result;
-
- if (class_methods)
- for (i = 0; i < class_methods->count; i++)
- {
- if (sel_isEqual (class_methods->list[i].name, aSel))
- return &(class_methods->list[i]);
- }
-
- for (proto_list = protocol_list; proto_list; proto_list = proto_list->next)
- {
- size_t j;
- for (j=0; j < proto_list->count; j++)
- {
- if ((result = [proto_list->list[j]
- descriptionForClassMethod: aSel]))
- return result;
- }
- }
-
- return NULL;
-}
-
-- (unsigned) hash
-{
- /* Compute a hash of the protocol_name; use the same hash algorithm
- that we use for class names; protocol names and class names are
- somewhat similar types of string spaces. */
- int hash = 0, index;
-
- for (index = 0; protocol_name[index] != '\0'; index++)
- {
- hash = (hash << 4) ^ (hash >> 28) ^ protocol_name[index];
- }
-
- hash = (hash ^ (hash >> 10) ^ (hash >> 20));
-
- return hash;
-}
-
-@end
#include "objc-private/module-abi-8.h" /* For CLS_ISCLASS and similar. */
#include "objc-private/runtime.h" /* the kitchen sink */
#include "objc-private/sarray.h" /* For sarray_put_at_safe. */
+#include "objc-private/selector.h" /* For sarray_put_at_safe. */
#include <string.h> /* For memset */
/* We use a table which maps a class name to the corresponding class
return 0;
}
-MetaClass
+Class
objc_get_meta_class (const char *name)
{
return objc_get_class (name)->class_pointer;
return atoi (type);
}
-/*
- Return a pointer to the next argument of ARGFRAME. type points to
- the last argument. Typical use of this look like:
-
- {
- char *datum, *type;
- for (datum = method_get_first_argument (method, argframe, &type);
- datum; datum = method_get_next_argument (argframe, &type))
- {
- unsigned flags = objc_get_type_qualifiers (type);
- type = objc_skip_type_qualifiers (type);
- if (*type != _C_PTR)
- [portal encodeData: datum ofType: type];
- else
- {
- if ((flags & _F_IN) == _F_IN)
- [portal encodeData: *(char **) datum ofType: ++type];
- }
- }
- }
-*/
-char *
-method_get_next_argument (arglist_t argframe, const char **type)
-{
- const char *t = objc_skip_argspec (*type);
-
- if (*t == '\0')
- return 0;
-
- *type = t;
- t = objc_skip_typespec (t);
-
- if (*t == '+')
- return argframe->arg_regs + atoi (++t);
- else
- return argframe->arg_ptr + atoi (t);
-}
-
-/* Return a pointer to the value of the first argument of the method
- described in M with the given argumentframe ARGFRAME. The type
- is returned in TYPE. type must be passed to successive calls of
- method_get_next_argument. */
-char *
-method_get_first_argument (struct objc_method *m,
- arglist_t argframe,
- const char **type)
-{
- *type = m->method_types;
- return method_get_next_argument (argframe, type);
-}
-
-/* Return a pointer to the ARGth argument of the method
- M from the frame ARGFRAME. The type of the argument
- is returned in the value-result argument TYPE. */
-char *
-method_get_nth_argument (struct objc_method *m,
- arglist_t argframe, int arg,
- const char **type)
-{
- const char *t = objc_skip_argspec (m->method_types);
-
- if (arg > method_get_number_of_arguments (m))
- return 0;
-
- while (arg--)
- t = objc_skip_argspec (t);
-
- *type = t;
- t = objc_skip_typespec (t);
-
- if (*t == '+')
- return argframe->arg_regs + atoi (++t);
- else
- return argframe->arg_ptr + atoi (t);
-}
-
unsigned
objc_get_type_qualifiers (const char *type)
{
#include "tconfig.h"
#include <assert.h>
+#include <ctype.h> /* For isdigit. */
#include <string.h>
#include <stdlib.h>
-#include "objc/encoding.h"
+#include "objc/runtime.h"
+#include "objc-private/module-abi-8.h"
#include <gc.h>
#include <limits.h>
void __objc_linking (void)
{
- [Object name];
+ [Object class];
}
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];
};
/*
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. */
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. */
(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
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 */
#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
/* 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;
- (BOOL)isEqual: (id)anObject;
@end
-/* All of the following includes were deprecated in GCC 4.6 and will
- be removed in the next release. */
-#include "deprecated/Object.h"
-
#ifdef __cplusplus
}
#endif
protocol_getMethodDescription()
*/
-#include "deprecated/Protocol.h"
-
#ifdef __cplusplus
}
#endif
+++ /dev/null
-typedef struct objc_class *MetaClass;
+++ /dev/null
-/* The following methods were deprecated in GCC 4.6.0 and will be
- removed in the next GCC release. */
-@interface Object (Deprecated)
-/* Initializing classes and instances */
-+ initialize;
-- init;
-
-/* Creating, freeing, and copying instances */
-+ new;
-+ alloc;
-- free;
-- copy;
-- shallowCopy;
-- deepen;
-- deepCopy;
-
-/* Identifying classes */
-- (Class)superClass;
-- (MetaClass)metaClass;
-- (const char *)name;
-
-/* Identifying and comparing objects */
-- self;
-- (unsigned int)hash;
-- (int)compare:(id)anotherObject;
-
-/* Testing object type */
-- (BOOL)isMetaClass;
-- (BOOL)isClass;
-- (BOOL)isInstance;
-
-/* Testing inheritance relationships */
-- (BOOL)isKindOf:(Class)aClassObject;
-- (BOOL)isMemberOf:(Class)aClassObject;
-- (BOOL)isKindOfClassNamed:(const char *)aClassName;
-- (BOOL)isMemberOfClassNamed:(const char *)aClassName;
-
-/* Testing class functionality */
-+ (BOOL)instancesRespondTo:(SEL)aSel;
-- (BOOL)respondsTo:(SEL)aSel;
-
-/* Testing protocol conformance */
-- (BOOL)conformsTo:(Protocol*)aProtocol;
-
-/* Introspection */
-+ (IMP)instanceMethodFor:(SEL)aSel;
-- (IMP)methodFor:(SEL)aSel;
-+ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel;
-- (struct objc_method_description *)descriptionForMethod:(SEL)aSel;
-
-/* Forwarding */
-- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame;
-
-/* Posing */
-+ poseAs:(Class)aClassObject;
-- (Class)transmuteClassTo:(Class)aClassObject;
-
-/* Archiving */
-+ (int)version;
-+ setVersion:(int)aVersion;
-
-@end
-
+++ /dev/null
-/* The following methods were deprecated in GCC 4.6.0 and will be
- removed in the next GCC release. */
-@interface Protocol (Deprecated)
-/* Obtaining attributes intrinsic to the protocol */
-- (const char *)name;
-
-/* Testing protocol conformance */
-- (BOOL) conformsTo: (Protocol *)aProtocolObject;
-
-/* Looking up information specific to a protocol */
-- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
-- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
-@end
+++ /dev/null
-This directory contains declarations and features that are deprecated
-and that will be removed in future versions of the compiler.
-
-Note that files in this directory are not really usable headers on
-their own - they shouldn't be included directly by end users. They
-are header fragments containing deprecated APIs that are still
-included (until removed) from the real headers in objc/.
-
-Files in this directory should not #include any other objc header.
-Any include that they need should be done in the real objc/ headers
-before including these fragments.
+++ /dev/null
-/* The following types and functions are provided only for
- backwards-compatibility and should not be used in new code. They
- were deprecated in GCC 4.6 and will be removed in the next
- release. */
-typedef void* retval_t; /* return value */
-typedef void(*apply_t)(void); /* function pointer */
-typedef union arglist {
- char *arg_ptr;
- char arg_regs[sizeof (char*)];
-} *arglist_t; /* argument frame */
-
-objc_EXPORT retval_t objc_msg_sendv(id, SEL, arglist_t);
+++ /dev/null
-/*
-** The compiler generates one of these structures for each category. A class
-** may have many categories and contain both instance and factory methods.
-*/
-struct objc_category {
- const char* category_name; /* Name of the category. Name
- contained in the () of the
- category definition. */
- const char* class_name; /* Name of the class to which
- the category belongs. */
- MethodList_t instance_methods; /* Linked list of instance
- methods defined in the
- category. NULL indicates no
- instance methods defined. */
- MethodList_t class_methods; /* Linked list of factory
- methods defined in the
- category. NULL indicates no
- class methods defined. */
- struct objc_protocol_list *protocols; /* List of Protocols
- conformed to */
-};
+++ /dev/null
-/* This structure used to be public, but is now private to the runtime. */
-#define __objc_STRUCT_OBJC_CLASS_defined
-
-/*
-** The compiler generates one of these structures for each class.
-**
-** This structure is the definition for classes.
-**
-** This structure is generated by the compiler in the executable and used by
-** the run-time during normal messaging operations. Therefore some members
-** change type. The compiler generates "char* const" and places a string in
-** the following member variables: super_class.
-*/
-struct objc_class {
- MetaClass class_pointer; /* Pointer to the class's
- meta class. */
- struct objc_class* super_class; /* Pointer to the super
- class. NULL for class
- Object. */
- const char* name; /* Name of the class. */
- long version; /* Unknown. */
- unsigned long info; /* Bit mask. See class masks
- defined above. */
- long instance_size; /* Size in bytes of the class.
- The sum of the class
- definition and all super
- class definitions. */
-#ifdef _WIN64
- /* We pad the structure manually to prevent warning when -Wpadded
- is used. The compiler automatically pads the structures that it
- generates, so this manually padded structure still matches the one
- generated by the compiler, but if we don't pad manually, -Wpadded
- detects that padding is being added and generates annoying warnings.
- This hack is necessary as on LLP64 targets sizeof (long) isn't equal
- to sizeof (void *). */
- long pad;
-#endif
- struct objc_ivar_list* ivars; /* Pointer to a structure that
- describes the instance
- variables in the class
- definition. NULL indicates
- no instance variables. Does
- not include super class
- variables. */
- struct objc_method_list* methods; /* Linked list of instance
- methods defined for the
- class. */
- struct sarray * dtable; /* Pointer to instance
- method dispatch table. */
- struct objc_class* subclass_list; /* Subclasses */
- struct objc_class* sibling_class;
-
- struct objc_protocol_list *protocols; /* Protocols conformed to */
- void* gc_object_type;
-};
-
+++ /dev/null
-/*
-** The compiler generates one of these structures for a class that has
-** instance variables defined in its specification.
-*/
-typedef struct objc_ivar {
- const char* ivar_name; /* Name of the instance
- variable as entered in the
- class definition. */
- const char* ivar_type; /* Description of the Ivar's
- type. Useful for
- debuggers. */
- int ivar_offset; /* Byte offset from the base
- address of the instance
- structure to the variable. */
-} *Ivar_t;
+++ /dev/null
-typedef struct objc_ivar_list {
- int ivar_count; /* Number of structures (Ivar)
- contained in the list. One
- structure per instance
- variable defined in the
- class. */
- struct objc_ivar ivar_list[1]; /* Variable length
- structure. */
-} IvarList, *IvarList_t;
-
+++ /dev/null
-/*
-** The compiler generates one (or more) of these structures for a class that
-** has methods defined in its specification.
-**
-** The implementation of a class can be broken into separate pieces in a file
-** and categories can break them across modules. To handle this problem is a
-** singly linked list of methods.
-*/
-struct objc_method {
- SEL method_name; /* This variable is the method's
- name. It is a char*.
- The unique integer passed to
- objc_msg_send is a char* too.
- It is compared against
- method_name using strcmp. */
- const char* method_types; /* Description of the method's
- parameter list. Useful for
- debuggers. */
- IMP method_imp; /* Address of the method in the
- executable. */
-};
-
+++ /dev/null
-typedef struct objc_method_list {
- struct objc_method_list* method_next; /* This variable is used to link
- a method list to another. It
- is a singly linked list. */
- int method_count; /* Number of methods defined in
- this structure. */
- Method method_list[1]; /* Variable length
- structure. */
-} MethodList, *MethodList_t;
+++ /dev/null
-/*
-** The compiler generates one of these structures for each module that
-** composes the executable (eg main.m).
-**
-** This data structure is the root of the definition tree for the module.
-**
-** A collect program runs between ld stages and creates a ObjC ctor array.
-** That array holds a pointer to each module structure of the executable.
-*/
-typedef struct objc_module {
- unsigned long version; /* Version of the Module data structure. */
- unsigned long size; /* sizeof(Module) according to the compiler -
- only used to sanity check that it matches
- sizeof(Module) according to the
- runtime. */
- const char* name; /* Name of the file used to compile the
- module - not set by modern compilers for
- security reasons. */
- Symtab_t symtab; /* Pointer to the Symtab of the module. The
- Symtab holds an array of pointers to the
- classes and categories defined in the
- module. */
-} Module, *Module_t;
-
+++ /dev/null
-typedef 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;
-} Protocol;
+++ /dev/null
-struct objc_protocol_list {
- struct objc_protocol_list *next;
- size_t count;
- Protocol *list[1];
-};
+++ /dev/null
-/* This struct used to be public, but is now private to the runtime. */
-
-/*
-** 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;
-}
+++ /dev/null
-/* Whereas a Module (defined further down) is the root (typically) of a file,
- a Symtab is the root of the class and category definitions within the
- module.
-
- A Symtab contains a variable length array of pointers to classes and
- categories defined in the module. */
-typedef struct objc_symtab {
- unsigned long sel_ref_cnt; /* Unused (always set to 0). */
- SEL refs; /* The table of selectors referenced in
- this module. This is terminated by a
- selector with NULL sel_id and NULL
- sel_types. */
- unsigned short cls_def_cnt; /* Number of classes compiled
- (defined) in the module. */
- unsigned short cat_def_cnt; /* Number of categories
- compiled (defined) in the
- module. */
-
- void *defs[1]; /* Variable array of pointers.
- cls_def_cnt of type Class
- followed by cat_def_cnt of
- type Category_t, followed
- by a NULL terminated array
- of objc_static_instances. */
-} Symtab, *Symtab_t;
-
+++ /dev/null
-/* Encoding of types for Objective C.
- Copyright (C) 1993, 1997, 2002, 2004, 2009, 2010
- Free Software Foundation, Inc.
-
-Author: Kresten Krab Thorup
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-
-#ifndef __encoding_INCLUDE_GNU
-#define __encoding_INCLUDE_GNU
-
-/* This file is to be used with the "traditional" GNU Objective-C
- Runtime API (the one declared in objc/objc-api.h). If you are
- using the "modern" GNU Objective-C Runtime API, then the useful
- functions from this file are declared in objc/runtime.h. */
-
-#include "objc-api.h"
-#include <ctype.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* The following are used in encode strings to describe some
- qualifiers of method and ivar types. */
-#define _C_CONST 'r'
-#define _C_IN 'n'
-#define _C_INOUT 'N'
-#define _C_OUT 'o'
-#define _C_BYCOPY 'O'
-#define _C_BYREF 'R'
-#define _C_ONEWAY 'V'
-#define _C_GCINVISIBLE '|'
-
-/* The same when used as flags. */
-#define _F_CONST 0x01
-#define _F_IN 0x01
-#define _F_OUT 0x02
-#define _F_INOUT 0x03
-#define _F_BYCOPY 0x04
-#define _F_BYREF 0x08
-#define _F_ONEWAY 0x10
-#define _F_GCINVISIBLE 0x20
-
-int objc_sizeof_type (const char *type);
-int objc_alignof_type (const char *type);
-int objc_aligned_size (const char *type);
-int objc_promoted_size (const char *type);
-
-const char *objc_skip_type_qualifiers (const char *type);
-const char *objc_skip_typespec (const char *type);
-const char *objc_skip_offset (const char *type);
-const char *objc_skip_argspec (const char *type);
-unsigned objc_get_type_qualifiers (const char *type);
-
-/* The following functions are replaced, in the modern API, by
- method_getNumberOfArguments(), method_getArgumentType(). */
-int method_get_number_of_arguments (struct objc_method *);
-int method_get_sizeof_arguments (struct objc_method *);
-
-/* The following functions are deprecated and they use arglist_t which
- is deprecated. */
-char *method_get_first_argument (struct objc_method *,
- arglist_t argframe,
- const char **type);
-char *method_get_next_argument (arglist_t argframe,
- const char **type);
-char *method_get_nth_argument (struct objc_method *m,
- arglist_t argframe,
- int arg,
- const char **type);
-
-struct objc_struct_layout
-{
- const char *original_type;
- const char *type;
- const char *prev_type;
- unsigned int record_size;
- unsigned int record_align;
-};
-
-void objc_layout_structure (const char *type,
- struct objc_struct_layout *layout);
-BOOL objc_layout_structure_next_member (struct objc_struct_layout *layout);
-void objc_layout_finish_structure (struct objc_struct_layout *layout,
- unsigned int *size,
- unsigned int *align);
-void objc_layout_structure_get_info (struct objc_struct_layout *layout,
- unsigned int *offset,
- unsigned int *align,
- const char **type);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __encoding_INCLUDE_GNU */
The compiler generates one of these structures and passes it to
objc_msg_lookup_super() when a [super method] call is compiled. */
-/* In the traditional API, the super class field is called 'class' in
- Objective-C and 'super_class' in Objective-C++. In the new API
- (objc/runtime.h) it is always called 'super_class'. We detect the
- "traditional API" by the fact that the objc/objc-api.h header
- include guards are defined, which means objc/objc-api.h has been
- included. This works because objc/message.h does not exist in the
- Traditional API and is only read because objc-api.h itself includes
- it. */
-#ifdef __objc_api_INCLUDE_GNU
-/* Traditional API. */
-typedef struct objc_super
-{
- id self; /* Id of the object sending the message. */
-#ifdef __cplusplus
- Class super_class;
-#else
- Class class; /* Object's super class. */
-#endif
-} Super, *Super_t;
-#else
/* Modern API. */
struct objc_super
{
id self; /* The receiver of the message. */
Class super_class; /* The superclass of the receiver. */
};
-#endif
/* This is used by the compiler instead of objc_msg_lookup () when
compiling a call to 'super', such as [super method]. This requires
+++ /dev/null
-/* GNU Objective-C Runtime API - Traditional API
- Copyright (C) 1993, 1995, 1996, 1997, 2001, 2002, 2003, 2004, 2005,
- 2007, 2009, 2010 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-#ifndef __objc_api_INCLUDE_GNU
-#define __objc_api_INCLUDE_GNU
-
-/* This file declares the "traditional" GNU Objective-C Runtime API.
- It is the API supported by older versions of the GNU Objective-C
- Runtime. Include this file to use it.
-
- This API is being replaced by the "modern" GNU Objective-C Runtime
- API, which is declared in objc/runtime.h. The "modern" API is very
- similar to the API used by the modern Apple/NeXT runtime.
-
- The last version of GCC supporting the traditional API is GCC 4.6.
- This file will not exist in later versions of GCC.
-
- Because the two APIs have some conflicting definitions (in
- particular, Method and Category are defined differently) you should
- include either objc/objc-api.h (to use the traditional GNU
- Objective-C Runtime API) or objc/runtime.h (to use the modern GNU
- Objective-C Runtime API), but not both. */
-#ifdef __objc_runtime_INCLUDE_GNU
-# error You can not include both objc/objc-api.h and objc/runtime.h. Include objc/objc-api.h for the traditional GNU Objective-C Runtime API and objc/runtime.h for the modern one.
-#endif
-
-/* TODO: A deprecation warning any time the file is included ? */
-
-#include "objc.h"
-#include "thr.h"
-#include "objc-decls.h"
-#include <stdio.h>
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* Method descriptor returned by introspective Object methods.
- This is really just the first part of the more complete objc_method
- structure defined below and used internally by the runtime. */
-struct objc_method_description
-{
- SEL name; /* this is a selector, not a string */
- char *types; /* type encoding */
-};
-
-/* The following are used in encode strings to describe the type of
- Ivars and Methods. */
-#define _C_ID '@'
-#define _C_CLASS '#'
-#define _C_SEL ':'
-#define _C_CHR 'c'
-#define _C_UCHR 'C'
-#define _C_SHT 's'
-#define _C_USHT 'S'
-#define _C_INT 'i'
-#define _C_UINT 'I'
-#define _C_LNG 'l'
-#define _C_ULNG 'L'
-#define _C_LNG_LNG 'q'
-#define _C_ULNG_LNG 'Q'
-#define _C_FLT 'f'
-#define _C_DBL 'd'
-#define _C_LNG_DBL 'D'
-#define _C_BFLD 'b'
-#define _C_BOOL 'B'
-#define _C_VOID 'v'
-#define _C_UNDEF '?'
-#define _C_PTR '^'
-#define _C_CHARPTR '*'
-#define _C_ARY_B '['
-#define _C_ARY_E ']'
-#define _C_UNION_B '('
-#define _C_UNION_E ')'
-#define _C_STRUCT_B '{'
-#define _C_STRUCT_E '}'
-#define _C_VECTOR '!'
-#define _C_COMPLEX 'j'
-
-/* _C_ATOM is never generated by the compiler. You can treat it as
- equivalent to "*". */
-#define _C_ATOM '%'
-
-#include "deprecated/struct_objc_symtab.h"
-#include "deprecated/struct_objc_module.h"
-#include "deprecated/struct_objc_ivar.h"
-#include "deprecated/struct_objc_ivar_list.h"
-#include "deprecated/struct_objc_method.h"
-typedef struct objc_method Method, *Method_t;
-
-#include "deprecated/struct_objc_method_list.h"
-#include "deprecated/struct_objc_protocol_list.h"
-
-/*
-** This is used to assure consistent access to the info field of
-** classes
-*/
-#ifndef HOST_BITS_PER_LONG
-#define HOST_BITS_PER_LONG (sizeof(long)*8)
-#endif
-
-#define __CLS_INFO(cls) ((cls)->info)
-#define __CLS_ISINFO(cls, mask) ((__CLS_INFO(cls)&mask)==mask)
-#define __CLS_SETINFO(cls, mask) (__CLS_INFO(cls) |= mask)
-
-/* The structure is of type MetaClass */
-#define _CLS_META 0x2L
-#define CLS_ISMETA(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_META))
-
-
-/* The structure is of type Class */
-#define _CLS_CLASS 0x1L
-#define CLS_ISCLASS(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_CLASS))
-
-/*
-** The class is initialized within the runtime. This means that
-** it has had correct super and sublinks assigned
-*/
-#define _CLS_RESOLV 0x8L
-#define CLS_ISRESOLV(cls) __CLS_ISINFO(cls, _CLS_RESOLV)
-#define CLS_SETRESOLV(cls) __CLS_SETINFO(cls, _CLS_RESOLV)
-
-/*
-** The class has been send a +initialize message or a such is not
-** defined for this class
-*/
-#define _CLS_INITIALIZED 0x04L
-#define CLS_ISINITIALIZED(cls) __CLS_ISINFO(cls, _CLS_INITIALIZED)
-#define CLS_SETINITIALIZED(cls) __CLS_SETINFO(cls, _CLS_INITIALIZED)
-
-/*
-** The class number of this class. This must be the same for both the
-** class and its meta class object
-*/
-#define CLS_GETNUMBER(cls) (__CLS_INFO(cls) >> (HOST_BITS_PER_LONG/2))
-#define CLS_SETNUMBER(cls, num) \
- ({ (cls)->info <<= (HOST_BITS_PER_LONG/2); \
- (cls)->info >>= (HOST_BITS_PER_LONG/2); \
- __CLS_SETINFO(cls, (((unsigned long)num) << (HOST_BITS_PER_LONG/2))); })
-
-#include "deprecated/struct_objc_category.h"
-
-typedef struct objc_category Category, *Category_t;
-
-/* We include message.h for compatibility with the old objc-api.h
- which included the declarations currently in message.h. The
- Apple/NeXT runtime does not do this and only includes message.h in
- objc-runtime.h. It does not matter that much since most of the
- definitions in message.h are runtime-specific. */
-#include "message.h"
-
-/*
-** This is a hook which is called by objc_lookup_class and
-** objc_get_class if the runtime is not able to find the class.
-** This may e.g. try to load in the class using dynamic loading.
-** The function is guaranteed to be passed a non-NULL name string.
-** In the Modern API, this is replaced by
-** objc_setGetUnknownClassHandler ().
-*/
-objc_EXPORT Class (*_objc_lookup_class)(const char *name);
-
-/*
-** This is a hook which is called by __objc_exec_class every time a class
-** or a category is loaded into the runtime. This may e.g. help a
-** dynamic loader determine the classes that have been loaded when
-** an object file is dynamically linked in.
-*/
-objc_EXPORT void (*_objc_load_callback)(Class _class, Category* category);
-
-/*
- Standard functions for memory allocation and disposal. Users should
- use these functions in their ObjC programs so that they work so that
- they work properly with garbage collectors.
-*/
-objc_EXPORT void *
-objc_malloc(size_t size);
-
-/* FIXME: Shouldn't the following be called objc_malloc_atomic ? The
- GC function is GC_malloc_atomic() which makes sense.
- */
-objc_EXPORT void *
-objc_atomic_malloc(size_t size);
-
-objc_EXPORT void *
-objc_realloc(void *mem, size_t size);
-
-objc_EXPORT void *
-objc_calloc(size_t nelem, size_t size);
-
-objc_EXPORT void
-objc_free(void *mem);
-
-objc_EXPORT Method_t class_get_class_method(MetaClass _class, SEL aSel);
-
-objc_EXPORT Method_t class_get_instance_method(Class _class, SEL aSel);
-
-objc_EXPORT Class class_pose_as(Class impostor, Class superclass);
-
-objc_EXPORT Class objc_get_class(const char *name);
-
-objc_EXPORT Class objc_lookup_class(const char *name);
-
-objc_EXPORT Class objc_next_class(void **enum_state);
-
-objc_EXPORT const char *sel_get_name(SEL selector);
-
-objc_EXPORT const char *sel_get_type(SEL selector);
-
-objc_EXPORT SEL sel_get_uid(const char *name);
-
-objc_EXPORT SEL sel_get_any_uid(const char *name);
-
-objc_EXPORT SEL sel_get_any_typed_uid(const char *name);
-
-objc_EXPORT SEL sel_get_typed_uid(const char *name, const char*);
-
-objc_EXPORT SEL sel_register_name(const char *name);
-
-objc_EXPORT SEL sel_register_typed_name(const char *name, const char*type);
-
-
-objc_EXPORT BOOL sel_is_mapped (SEL aSel);
-
-extern id class_create_instance(Class _class);
-
-static inline const char *
-class_get_class_name(Class _class)
-{
- return CLS_ISCLASS(_class)?_class->name:((_class==Nil)?"Nil":0);
-}
-
-static inline long
-class_get_instance_size(Class _class)
-{
- return CLS_ISCLASS(_class)?_class->instance_size:0;
-}
-
-static inline MetaClass
-class_get_meta_class(Class _class)
-{
- return CLS_ISCLASS(_class)?_class->class_pointer:Nil;
-}
-
-static inline Class
-class_get_super_class(Class _class)
-{
- return CLS_ISCLASS(_class)?_class->super_class:Nil;
-}
-
-static inline int
-class_get_version(Class _class)
-{
- return CLS_ISCLASS(_class)?_class->version:-1;
-}
-
-static inline BOOL
-class_is_class(Class _class)
-{
- return CLS_ISCLASS(_class);
-}
-
-static inline BOOL
-class_is_meta_class(Class _class)
-{
- return CLS_ISMETA(_class);
-}
-
-
-static inline void
-class_set_version(Class _class, long version)
-{
- if (CLS_ISCLASS(_class))
- _class->version = version;
-}
-
-static inline void *
-class_get_gc_object_type (Class _class)
-{
- return CLS_ISCLASS(_class) ? _class->gc_object_type : NULL;
-}
-
-/* Mark the instance variable as innaccessible to the garbage collector */
-extern void class_ivar_set_gcinvisible (Class _class,
- const char* ivarname,
- BOOL gcInvisible);
-
-objc_EXPORT IMP method_get_imp(Method_t method);
-
-objc_EXPORT IMP get_imp (Class _class, SEL sel);
-
-/* object_copy used to take a single argument in the traditional GNU
- Objective-C Runtime API (the one declared here), but takes 2 in the
- modern API (implemented in the actual runtime). Define the old
- object_copy in terms of the new one. */
-objc_EXPORT id object_copy (id object, size_t size);
-#define object_copy(X) (object_copy ((X), 0))
-
-objc_EXPORT id object_dispose(id object);
-
-static inline Class
-object_get_class(id object)
-{
- return ((object!=nil)
- ? (CLS_ISCLASS(object->class_pointer)
- ? object->class_pointer
- : (CLS_ISMETA(object->class_pointer)
- ? (Class)object
- : Nil))
- : Nil);
-}
-
-static inline const char *
-object_get_class_name(id object)
-{
- return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
- ?object->class_pointer->name
- :((Class)object)->name)
- :"Nil");
-}
-
-static inline MetaClass
-object_get_meta_class(id object)
-{
- return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
- ?object->class_pointer->class_pointer
- :(CLS_ISMETA(object->class_pointer)
- ?object->class_pointer
- :Nil))
- :Nil);
-}
-
-static inline Class
-object_get_super_class
-(id object)
-{
- return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
- ?object->class_pointer->super_class
- :(CLS_ISMETA(object->class_pointer)
- ?((Class)object)->super_class
- :Nil))
- :Nil);
-}
-
-static inline BOOL
-object_is_class (id object)
-{
- return ((object != nil) && CLS_ISMETA (object->class_pointer));
-}
-
-static inline BOOL
-object_is_instance (id object)
-{
- return ((object != nil) && CLS_ISCLASS (object->class_pointer));
-}
-
-static inline BOOL
-object_is_meta_class (id object)
-{
- return ((object != nil)
- && !object_is_instance (object)
- && !object_is_class (object));
-}
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* not __objc_api_INCLUDE_GNU */
-
-
-
#include <stddef.h>
-/* objc-decls.h is included because deprecated/objc_msg_sendv.h needs
- it. When that goes away, the include of objc-decls.h should be
- removed. */
-#include "objc-decls.h"
-
/* The current version of the GNU Objective-C Runtime library in
compressed ISO date format. This should be updated any time a new
version is released with changes to the public API (there is no
selector and know that the class implements it, you can use it to
call the method for an object in the class. */
typedef const struct objc_selector *SEL;
-#include "deprecated/struct_objc_selector.h"
/* A Class is a class (in the object-oriented sense). In Objective-C
there is the complication that each Class is an object itself, and
so belongs to a class too. This class that a class belongs to is
called its 'meta class'. */
typedef struct objc_class *Class;
-#include "deprecated/MetaClass.h"
-#include "deprecated/struct_objc_class.h"
/* An 'id' is an object of an unknown class. The way the object data
is stored inside the object is private and what you see here is
there is no reason to even define a 'struct objc_protocol'. As
all the structure details will be hidden, a Protocol basically is
simply an object (as it should be). */
- /* typedef struct objc_object Protocol; */
- #include "deprecated/struct_objc_protocol.h"
+ typedef struct objc_object Protocol;
#else /* __OBJC__ */
@class Protocol;
#endif
-/* Deprecated include - here temporarily, for backwards-compatibility
- as reval_t, apply_t, arglist_t and objc_msg_lookup() used to be
- defined here. objc_msg_lookup() is now defined in message.h,
- included by objc-api.h or runtime.h. */
-#include "deprecated/objc_msg_sendv.h"
-
/* Compatibility note: the Apple/NeXT runtime defines sel_getName(),
sel_registerName(), object_getClassName(), object_getIndexedIvars()
in this file while the GNU runtime defines them in runtime.h.
/*
This file declares the "modern" GNU Objective-C Runtime API.
- Include this file to use it.
-
- This API is replacing the "traditional" GNU Objective-C Runtime API
- (declared in objc/objc-api.h) which is the one supported by older
- versions of the GNU Objective-C Runtime. The "modern" API is very
- similar to the API used by the modern Apple/NeXT runtime.
-
- Because the two APIs have some conflicting definitions (in
- particular, Method and Category are defined differently) you should
- include either objc/objc-api.h (to use the traditional GNU
- Objective-C Runtime API) or objc/runtime.h (to use the modern GNU
- Objective-C Runtime API), but not both.
-*/
-#ifdef __objc_api_INCLUDE_GNU
-# error You can not include both objc/objc-api.h and objc/runtime.h. Include objc/objc-api.h for the traditional GNU Objective-C Runtime API and objc/runtime.h for the modern one.
-#endif
+ This API replaced the "traditional" GNU Objective-C Runtime API
+ (which used to be declared in objc/objc-api.h) which is the one
+ supported by older versions of the GNU Objective-C Runtime. The
+ "modern" API is very similar to the API used by the modern
+ Apple/NeXT runtime.
+*/
#include "objc.h"
#include "objc-decls.h"
/* Add a protocol to the hashtable. */
void
-__objc_protocols_add_protocol (const char *name, Protocol *object)
+__objc_protocols_add_protocol (const char *name, struct objc_protocol *object)
{
objc_mutex_lock (__protocols_hashtable_lock);
/* Create the objc_protocol_list. */
protocols = malloc (sizeof (struct objc_protocol_list));
protocols->count = 1;
- protocols->list[0] = protocol;
+ protocols->list[0] = (struct objc_protocol *)protocol;
/* Attach it to the list of class protocols. */
protocols->next = class_->protocols;
size_t i;
for (i = 0; i < proto_list->count; i++)
{
- if (proto_list->list[i] == protocol
- || protocol_conformsToProtocol (proto_list->list[i],
+ if (proto_list->list[i] == (struct objc_protocol *)protocol
+ || protocol_conformsToProtocol ((Protocol *)proto_list->list[i],
protocol))
{
objc_mutex_unlock (__objc_runtime_mutex);
size_t j;
for (j = 0; j < proto_list->count; j++)
{
- returnValue[i] = proto_list->list[j];
+ returnValue[i] = (Protocol *)proto_list->list[j];
i++;
}
proto_list = proto_list->next;
for (i = 0; i < proto_list->count; i++)
{
- if (protocol_conformsToProtocol (proto_list->list[i], anotherProtocol))
+ if (protocol_conformsToProtocol ((Protocol *)proto_list->list[i], anotherProtocol))
return YES;
}
proto_list = proto_list->next;
size_t j;
for (j = 0; j < proto_list->count; j++)
{
- returnValue[i] = proto_list->list[j];
+ returnValue[i] = (Protocol *)proto_list->list[j];
i++;
}
proto_list = proto_list->next;
#include "objc-private/sarray.h"
#include "objc/runtime.h" /* For objc_malloc */
#include "objc/thr.h" /* For objc_mutex_lock */
+#include "objc-private/module-abi-8.h"
#include "objc-private/runtime.h"
#include <stdio.h>
#include <string.h> /* For memset */
return (IMP)nil_method;
}
-/* Temporarily defined here until objc_msg_sendv() goes away. */
-char *method_get_first_argument (struct objc_method *,
- arglist_t argframe,
- const char **type);
-char *method_get_next_argument (arglist_t argframe,
- const char **type);
-int method_get_sizeof_arguments (struct objc_method *);
-
struct objc_method *
class_get_instance_method (Class class, SEL op);
-retval_t
-objc_msg_sendv (id object, SEL op, arglist_t arg_frame)
-{
- struct objc_method *m = class_get_instance_method (object->class_pointer, op);
- const char *type;
- *((id *) method_get_first_argument (m, arg_frame, &type)) = object;
- *((SEL *) method_get_next_argument (arg_frame, &type)) = op;
- return __builtin_apply ((apply_t) m->method_imp,
- arg_frame,
- method_get_sizeof_arguments (m));
-}
-
void
__objc_init_dispatch_tables ()
{
}
struct objc_method *
-class_get_class_method (MetaClass class, SEL op)
+class_get_class_method (Class class, SEL op)
{
return search_for_method_in_hierarchy (class, op);
}
return NULL;
}
+typedef void * retval_t;
+typedef void * arglist_t;
+
static retval_t __objc_forward (id object, SEL sel, arglist_t args);
/* Forwarding pointers/integers through the normal registers. */
#include "objc/thr.h"
#include "objc/message.h" /* For objc_msg_lookup(). */
#include "objc/runtime.h"
+#include "objc-private/module-abi-8.h"
#include "objc-private/runtime.h"
#include <gthr.h>