| 1 | /* The implementation of class Object for Objective-C.
|
|---|
| 2 | Copyright (C) 1993, 1994, 1995, 1997, 2002 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of GNU CC.
|
|---|
| 5 |
|
|---|
| 6 | GNU CC is free software; you can redistribute it and/or modify it
|
|---|
| 7 | under the terms of the GNU General Public License as published by the
|
|---|
| 8 | Free Software Foundation; either version 2, or (at your option) any
|
|---|
| 9 | later version.
|
|---|
| 10 |
|
|---|
| 11 | GNU CC is distributed in the hope that it will be useful, but WITHOUT
|
|---|
| 12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|---|
| 13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|---|
| 14 | License for more details.
|
|---|
| 15 |
|
|---|
| 16 | You should have received a copy of the GNU General Public License
|
|---|
| 17 | along with GNU CC; see the file COPYING. If not, write to
|
|---|
| 18 | the Free Software Foundation, 59 Temple Place - Suite 330,
|
|---|
| 19 | Boston, MA 02111-1307, USA. */
|
|---|
| 20 |
|
|---|
| 21 | /* As a special exception, if you link this library with files compiled
|
|---|
| 22 | with GCC to produce an executable, this does not cause the resulting
|
|---|
| 23 | executable to be covered by the GNU General Public License. This
|
|---|
| 24 | exception does not however invalidate any other reasons why the
|
|---|
| 25 | executable file might be covered by the GNU General Public License. */
|
|---|
| 26 |
|
|---|
| 27 | #include <stdarg.h>
|
|---|
| 28 | #include "objc/Object.h"
|
|---|
| 29 | #include "objc/Protocol.h"
|
|---|
| 30 | #include "objc/objc-api.h"
|
|---|
| 31 |
|
|---|
| 32 | extern int errno;
|
|---|
| 33 |
|
|---|
| 34 | #define MAX_CLASS_NAME_LEN 256
|
|---|
| 35 |
|
|---|
| 36 | @implementation Object
|
|---|
| 37 |
|
|---|
| 38 | + initialize
|
|---|
| 39 | {
|
|---|
| 40 | return self;
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | - init
|
|---|
| 44 | {
|
|---|
| 45 | return self;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | + new
|
|---|
| 49 | {
|
|---|
| 50 | return [[self alloc] init];
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | + alloc
|
|---|
| 54 | {
|
|---|
| 55 | return class_create_instance(self);
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | - free
|
|---|
| 59 | {
|
|---|
| 60 | return object_dispose(self);
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | - copy
|
|---|
| 64 | {
|
|---|
| 65 | return [[self shallowCopy] deepen];
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | - shallowCopy
|
|---|
| 69 | {
|
|---|
| 70 | return object_copy(self);
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | - deepen
|
|---|
| 74 | {
|
|---|
| 75 | return self;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | - deepCopy
|
|---|
| 79 | {
|
|---|
| 80 | return [self copy];
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | - (Class)class
|
|---|
| 84 | {
|
|---|
| 85 | return object_get_class(self);
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | - (Class)superClass
|
|---|
| 89 | {
|
|---|
| 90 | return object_get_super_class(self);
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | - (MetaClass)metaClass
|
|---|
| 94 | {
|
|---|
| 95 | return object_get_meta_class(self);
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | - (const char *)name
|
|---|
|
|---|