/* GNU Objective C Runtime class related functions
- Copyright (C) 1993, 1995, 1996, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1995, 1996, 2009, 2010 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
This file is part of GCC.
<http://www.gnu.org/licenses/>. */
#include "objc-private/common.h"
-#include "objc/objc.h"
-#include "objc/objc-api.h"
-#include "objc-private/runtime.h" /* the kitchen sink */
+#include "objc/runtime.h"
+#include "objc/thr.h" /* Required by objc-private/runtime.h. */
+#include "objc-private/module-abi-8.h" /* For CLS_ISCLASS and similar. */
+#include "objc-private/runtime.h" /* the kitchen sink */
-#include <string.h> /* For memcpy() */
+#include <string.h> /* For memcpy() */
#if OBJC_WITH_GC
# include <gc.h>
}
/* Traditional GNU Objective-C Runtime API. */
-id
-class_create_instance (Class class)
-{
- return class_createInstance (class, 0);
-}
-
-/* Temporary, while we are including objc-api.h instead of runtime.h. */
-#undef object_copy
-
id
object_copy (id object, size_t extraBytes)
{
return nil;
}
-/*
- Hook functions for memory allocation and disposal. Deprecated
- and currently unused.
-*/
+const char *
+object_getClassName (id object)
+{
+ if (object != nil)
+ return object->class_pointer->name;
+ else
+ return "Nil";
+}
+
+Class
+object_setClass (id object, Class class_)
+{
+ if (object == nil)
+ return Nil;
+ else
+ {
+ Class old_class = object->class_pointer;
-id (*_objc_object_alloc) (Class) = 0;
-id (*_objc_object_dispose) (id) = 0;
-id (*_objc_object_copy) (id) = 0;
+ object->class_pointer = class_;
+ return old_class;
+ }
+}