Commit 0994488a by Richard Kenner

Changed Class * to Class in order to match NEXTSTEP and OpenStep

runtime.

From-SVN: r9497
parent bc1f3f77
/* Interface for the Object class for Objective-C. /* Interface for the Object class for Objective-C.
Copyright (C) 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -35,7 +35,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -35,7 +35,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
*/ */
@interface Object @interface Object
{ {
Class* isa; /* A pointer to the instance's class structure */ Class isa; /* A pointer to the instance's class structure */
} }
/* Initializing classes and instances */ /* Initializing classes and instances */
...@@ -52,9 +52,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -52,9 +52,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
- - deepCopy; - - deepCopy;
/* Identifying classes */ /* Identifying classes */
- (Class*)class; - (Class)class;
- (Class*)superClass; - (Class)superClass;
- (MetaClass*)metaClass; - (MetaClass)metaClass;
- (const char *)name; - (const char *)name;
/* Identifying and comparing objects */ /* Identifying and comparing objects */
...@@ -69,8 +69,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -69,8 +69,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
- (BOOL)isInstance; - (BOOL)isInstance;
/* Testing inheritance relationships */ /* Testing inheritance relationships */
- (BOOL)isKindOf:(Class*)aClassObject; - (BOOL)isKindOf:(Class)aClassObject;
- (BOOL)isMemberOf:(Class*)aClassObject; - (BOOL)isMemberOf:(Class)aClassObject;
- (BOOL)isKindOfClassNamed:(const char *)aClassName; - (BOOL)isKindOfClassNamed:(const char *)aClassName;
- (BOOL)isMemberOfClassNamed:(const char *)aClassName; - (BOOL)isMemberOfClassNamed:(const char *)aClassName;
...@@ -97,8 +97,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -97,8 +97,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame; - (retval_t)performv:(SEL)aSel :(arglist_t)argFrame;
/* Posing */ /* Posing */
+ + poseAs:(Class*)aClassObject; + + poseAs:(Class)aClassObject;
- (Class*)transmuteClassTo:(Class*)aClassObject; - (Class)transmuteClassTo:(Class)aClassObject;
/* Enforcing intentions */ /* Enforcing intentions */
- - subclassResponsibility:(SEL)aSel; - - subclassResponsibility:(SEL)aSel;
......
/* The implementation of class Object for Objective-C. /* The implementation of class Object for Objective-C.
Copyright (C) 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -81,17 +81,17 @@ extern int errno; ...@@ -81,17 +81,17 @@ extern int errno;
return [self copy]; return [self copy];
} }
- (Class*)class - (Class)class
{ {
return object_get_class(self); return object_get_class(self);
} }
- (Class*)superClass - (Class)superClass
{ {
return object_get_super_class(self); return object_get_super_class(self);
} }
- (MetaClass*)metaClass - (MetaClass)metaClass
{ {
return object_get_meta_class(self); return object_get_meta_class(self);
} }
...@@ -143,9 +143,9 @@ extern int errno; ...@@ -143,9 +143,9 @@ extern int errno;
return object_is_instance(self); return object_is_instance(self);
} }
- (BOOL)isKindOf:(Class*)aClassObject - (BOOL)isKindOf:(Class)aClassObject
{ {
Class* class; Class class;
for (class = self->isa; class!=Nil; class = class_get_super_class(class)) for (class = self->isa; class!=Nil; class = class_get_super_class(class))
if (class==aClassObject) if (class==aClassObject)
...@@ -153,14 +153,14 @@ extern int errno; ...@@ -153,14 +153,14 @@ extern int errno;
return NO; return NO;
} }
- (BOOL)isMemberOf:(Class*)aClassObject - (BOOL)isMemberOf:(Class)aClassObject
{ {
return self->isa==aClassObject; return self->isa==aClassObject;
} }
- (BOOL)isKindOfClassNamed:(const char *)aClassName - (BOOL)isKindOfClassNamed:(const char *)aClassName
{ {
Class* class; Class class;
if (aClassName!=NULL) if (aClassName!=NULL)
for (class = self->isa; class!=Nil; class = class_get_super_class(class)) for (class = self->isa; class!=Nil; class = class_get_super_class(class))
...@@ -204,7 +204,7 @@ extern int errno; ...@@ -204,7 +204,7 @@ extern int errno;
struct objc_protocol_list* proto_list; struct objc_protocol_list* proto_list;
id parent; id parent;
for (proto_list = ((Class*)self)->protocols; for (proto_list = ((Class)self)->protocols;
proto_list; proto_list = proto_list->next) proto_list; proto_list = proto_list->next)
{ {
for (i=0; i < proto_list->count; i++) for (i=0; i < proto_list->count; i++)
...@@ -280,19 +280,19 @@ extern int errno; ...@@ -280,19 +280,19 @@ extern int errno;
return objc_msg_sendv(self, aSel, argFrame); return objc_msg_sendv(self, aSel, argFrame);
} }
+ poseAs:(Class*)aClassObject + poseAs:(Class)aClassObject
{ {
return class_pose_as(self, aClassObject); return class_pose_as(self, aClassObject);
} }
- (Class*)transmuteClassTo:(Class*)aClassObject - (Class)transmuteClassTo:(Class)aClassObject
{ {
if (object_is_instance(self)) if (object_is_instance(self))
if (class_is_class(aClassObject)) if (class_is_class(aClassObject))
if (class_get_instance_size(aClassObject)==class_get_instance_size(isa)) if (class_get_instance_size(aClassObject)==class_get_instance_size(isa))
if ([self isKindOf:aClassObject]) if ([self isKindOf:aClassObject])
{ {
Class* old_isa = isa; Class old_isa = isa;
isa = aClassObject; isa = aClassObject;
return old_isa; return old_isa;
} }
......
/* GNU Objective C Runtime archiving /* GNU Objective C Runtime archiving
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 1995 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
Author: Kresten Krab Thorup
This file is part of GNU CC. This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify it under the GNU CC 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 terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version. Foundation; either version 2, or (at your option) any later version.
GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
GNU CC; see the file COPYING. If not, write to the Free Software GNU CC; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* As a special exception, if you link this library with files compiled with /* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable GCC to produce an executable, this does not cause the resulting executable
...@@ -45,7 +44,7 @@ extern int fflush(FILE*); ...@@ -45,7 +44,7 @@ extern int fflush(FILE*);
/* Declare some functions... */ /* Declare some functions... */
static int static int
objc_read_class (struct objc_typed_stream* stream, Class** class); objc_read_class (struct objc_typed_stream* stream, Class* class);
int objc_sizeof_type(const char* type); int objc_sizeof_type(const char* type);
...@@ -796,7 +795,7 @@ objc_read_object (struct objc_typed_stream* stream, id* object) ...@@ -796,7 +795,7 @@ objc_read_object (struct objc_typed_stream* stream, id* object)
if (buf[0] == (_B_EXT | _BX_OBJECT)) if (buf[0] == (_B_EXT | _BX_OBJECT))
{ {
Class* class; Class class;
/* get class */ /* get class */
len = objc_read_class (stream, &class); len = objc_read_class (stream, &class);
...@@ -849,7 +848,7 @@ objc_read_object (struct objc_typed_stream* stream, id* object) ...@@ -849,7 +848,7 @@ objc_read_object (struct objc_typed_stream* stream, id* object)
} }
static int static int
objc_read_class (struct objc_typed_stream* stream, Class** class) objc_read_class (struct objc_typed_stream* stream, Class* class)
{ {
unsigned char buf[sizeof (unsigned int)]; unsigned char buf[sizeof (unsigned int)];
int len; int len;
...@@ -958,7 +957,7 @@ objc_write_type(TypedStream* stream, const char* type, const void* data) ...@@ -958,7 +957,7 @@ objc_write_type(TypedStream* stream, const char* type, const void* data)
break; break;
case _C_CLASS: case _C_CLASS:
return objc_write_class (stream, *(Class**)data); return objc_write_class (stream, *(Class*)data);
break; break;
case _C_SEL: case _C_SEL:
...@@ -1052,7 +1051,7 @@ objc_read_type(TypedStream* stream, const char* type, void* data) ...@@ -1052,7 +1051,7 @@ objc_read_type(TypedStream* stream, const char* type, void* data)
break; break;
case _C_CLASS: case _C_CLASS:
return objc_read_class (stream, (Class**)data); return objc_read_class (stream, (Class*)data);
break; break;
case _C_SEL: case _C_SEL:
...@@ -1153,7 +1152,7 @@ objc_write_types (TypedStream* stream, const char* type, ...) ...@@ -1153,7 +1152,7 @@ objc_write_types (TypedStream* stream, const char* type, ...)
break; break;
case _C_CLASS: case _C_CLASS:
res = objc_write_class (stream, *va_arg(args, Class**)); res = objc_write_class (stream, *va_arg(args, Class*));
break; break;
case _C_SEL: case _C_SEL:
...@@ -1252,7 +1251,7 @@ objc_read_types(TypedStream* stream, const char* type, ...) ...@@ -1252,7 +1251,7 @@ objc_read_types(TypedStream* stream, const char* type, ...)
break; break;
case _C_CLASS: case _C_CLASS:
res = objc_read_class(stream, va_arg(args, Class**)); res = objc_read_class(stream, va_arg(args, Class*));
break; break;
case _C_SEL: case _C_SEL:
...@@ -1589,7 +1588,7 @@ objc_flush_typed_stream (TypedStream* stream) ...@@ -1589,7 +1588,7 @@ objc_flush_typed_stream (TypedStream* stream)
} }
long long
objc_get_stream_class_version (TypedStream* stream, Class* class) objc_get_stream_class_version (TypedStream* stream, Class class)
{ {
if (stream->class_table) if (stream->class_table)
return PTR2LONG(hash_value_for_key (stream->class_table, class->name)); return PTR2LONG(hash_value_for_key (stream->class_table, class->name));
......
/* GNU Objective C Runtime class related functions /* GNU Objective C Runtime class related functions
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 1995 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup and Dennis Glatting.
Author: Kresten Krab Thorup, Dennis Glatting
This file is part of GNU CC. This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify it under the GNU CC 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 terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version. Foundation; either version 2, or (at your option) any later version.
GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
GNU CC; see the file COPYING. If not, write to the Free Software GNU CC; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* As a special exception, if you link this library with files compiled with /* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable GCC to produce an executable, this does not cause the resulting executable
...@@ -33,7 +32,7 @@ static cache_ptr __objc_class_hash = 0; ...@@ -33,7 +32,7 @@ static cache_ptr __objc_class_hash = 0;
/* This is a hook which is called by objc_get_class and /* This is a hook which is called by objc_get_class and
objc_lookup_class if the runtime is not able to find the class. objc_lookup_class if the runtime is not able to find the class.
This may e.g. try to load in the class using dynamic loading */ This may e.g. try to load in the class using dynamic loading */
Class* (*_objc_lookup_class)(const char* name) = 0; Class (*_objc_lookup_class)(const char* name) = 0;
/* True when class links has been resolved */ /* True when class links has been resolved */
...@@ -59,9 +58,9 @@ void __objc_init_class_tables() ...@@ -59,9 +58,9 @@ void __objc_init_class_tables()
/* This function adds a class to the class hash table, and assigns the /* This function adds a class to the class hash table, and assigns the
class a number, unless it's already known */ class a number, unless it's already known */
void void
__objc_add_class_to_hash(Class* class) __objc_add_class_to_hash(Class class)
{ {
Class* h_class; Class h_class;
/* make sure the table is there */ /* make sure the table is there */
assert(__objc_class_hash); assert(__objc_class_hash);
...@@ -88,9 +87,9 @@ __objc_add_class_to_hash(Class* class) ...@@ -88,9 +87,9 @@ __objc_add_class_to_hash(Class* class)
/* Get the class object for the class named NAME. If NAME does not /* Get the class object for the class named NAME. If NAME does not
identify a known class, the hook _objc_lookup_class is called. If identify a known class, the hook _objc_lookup_class is called. If
this fails, nil is returned */ this fails, nil is returned */
Class* objc_lookup_class (const char* name) Class objc_lookup_class (const char* name)
{ {
Class* class; Class class;
/* Make sure the class hash table exists. */ /* Make sure the class hash table exists. */
assert (__objc_class_hash); assert (__objc_class_hash);
...@@ -109,10 +108,10 @@ Class* objc_lookup_class (const char* name) ...@@ -109,10 +108,10 @@ Class* objc_lookup_class (const char* name)
/* Get the class object for the class named NAME. If NAME does not /* Get the class object for the class named NAME. If NAME does not
identify a known class, the hook _objc_lookup_class is called. If identify a known class, the hook _objc_lookup_class is called. If
this fails, an error message is issued and the system aborts */ this fails, an error message is issued and the system aborts */
Class* Class
objc_get_class (const char *name) objc_get_class (const char *name)
{ {
Class* class; Class class;
/* Make sure the class hash table exists. */ /* Make sure the class hash table exists. */
assert (__objc_class_hash); assert (__objc_class_hash);
...@@ -132,7 +131,7 @@ objc_get_class (const char *name) ...@@ -132,7 +131,7 @@ objc_get_class (const char *name)
abort(); abort();
} }
MetaClass* MetaClass
objc_get_meta_class(const char *name) objc_get_meta_class(const char *name)
{ {
return objc_get_class(name)->class_pointer; return objc_get_class(name)->class_pointer;
...@@ -147,7 +146,7 @@ objc_get_meta_class(const char *name) ...@@ -147,7 +146,7 @@ objc_get_meta_class(const char *name)
while ((class = objc_next_class(&es))) while ((class = objc_next_class(&es)))
... do something with class; ... do something with class;
*/ */
Class* Class
objc_next_class(void **enum_state) objc_next_class(void **enum_state)
{ {
/* make sure the table is there */ /* make sure the table is there */
...@@ -157,7 +156,7 @@ objc_next_class(void **enum_state) ...@@ -157,7 +156,7 @@ objc_next_class(void **enum_state)
hash_next(__objc_class_hash, *(node_ptr*)enum_state); hash_next(__objc_class_hash, *(node_ptr*)enum_state);
if (*(node_ptr*)enum_state) if (*(node_ptr*)enum_state)
return (*(node_ptr*)enum_state)->value; return (*(node_ptr*)enum_state)->value;
return (Class*)0; return (Class)0;
} }
/* Resolve super/subclass links for all classes. The only thing we /* Resolve super/subclass links for all classes. The only thing we
...@@ -166,7 +165,7 @@ objc_next_class(void **enum_state) ...@@ -166,7 +165,7 @@ objc_next_class(void **enum_state)
void __objc_resolve_class_links() void __objc_resolve_class_links()
{ {
node_ptr node; node_ptr node;
Class* object_class = objc_get_class ("Object"); Class object_class = objc_get_class ("Object");
assert(object_class); assert(object_class);
...@@ -174,7 +173,7 @@ void __objc_resolve_class_links() ...@@ -174,7 +173,7 @@ void __objc_resolve_class_links()
for (node = hash_next (__objc_class_hash, NULL); node; for (node = hash_next (__objc_class_hash, NULL); node;
node = hash_next (__objc_class_hash, node)) node = hash_next (__objc_class_hash, node))
{ {
Class* class1 = node->value; Class class1 = node->value;
/* Make sure we have what we think we have. */ /* Make sure we have what we think we have. */
assert (CLS_ISCLASS(class1)); assert (CLS_ISCLASS(class1));
...@@ -190,7 +189,7 @@ void __objc_resolve_class_links() ...@@ -190,7 +189,7 @@ void __objc_resolve_class_links()
if(class1->super_class) if(class1->super_class)
{ {
Class* a_super_class Class a_super_class
= objc_get_class ((char *) class1->super_class); = objc_get_class ((char *) class1->super_class);
assert (a_super_class); assert (a_super_class);
...@@ -225,8 +224,8 @@ void __objc_resolve_class_links() ...@@ -225,8 +224,8 @@ void __objc_resolve_class_links()
for (node = hash_next (__objc_class_hash, NULL); node; for (node = hash_next (__objc_class_hash, NULL); node;
node = hash_next (__objc_class_hash, node)) node = hash_next (__objc_class_hash, node))
{ {
Class* class1 = node->value; Class class1 = node->value;
Class* sub_class; Class sub_class;
for (sub_class = class1->subclass_list; sub_class; for (sub_class = class1->subclass_list; sub_class;
sub_class = sub_class->sibling_class) sub_class = sub_class->sibling_class)
{ {
...@@ -241,11 +240,11 @@ void __objc_resolve_class_links() ...@@ -241,11 +240,11 @@ void __objc_resolve_class_links()
#define CLASSOF(c) ((c)->class_pointer) #define CLASSOF(c) ((c)->class_pointer)
Class* Class
class_pose_as (Class* impostor, Class* super_class) class_pose_as (Class impostor, Class super_class)
{ {
node_ptr node; node_ptr node;
Class* class1; Class class1;
if (!CLS_ISRESOLV (impostor)) if (!CLS_ISRESOLV (impostor))
__objc_resolve_class_links (); __objc_resolve_class_links ();
...@@ -259,16 +258,16 @@ class_pose_as (Class* impostor, Class* super_class) ...@@ -259,16 +258,16 @@ class_pose_as (Class* impostor, Class* super_class)
assert (impostor->instance_size == super_class->instance_size); assert (impostor->instance_size == super_class->instance_size);
{ {
Class **subclass = &(super_class->subclass_list); Class *subclass = &(super_class->subclass_list);
/* move subclasses of super_class to impostor */ /* move subclasses of super_class to impostor */
while (*subclass) while (*subclass)
{ {
Class *nextSub = (*subclass)->sibling_class; Class nextSub = (*subclass)->sibling_class;
if (*subclass != impostor) if (*subclass != impostor)
{ {
Class *sub = *subclass; Class sub = *subclass;
/* classes */ /* classes */
sub->sibling_class = impostor->subclass_list; sub->sibling_class = impostor->subclass_list;
...@@ -311,7 +310,7 @@ class_pose_as (Class* impostor, Class* super_class) ...@@ -311,7 +310,7 @@ class_pose_as (Class* impostor, Class* super_class)
for (node = hash_next (__objc_class_hash, NULL); node; for (node = hash_next (__objc_class_hash, NULL); node;
node = hash_next (__objc_class_hash, node)) node = hash_next (__objc_class_hash, node))
{ {
class1 = (Class*)node->value; class1 = (Class)node->value;
if (class1 == super_class) if (class1 == super_class)
{ {
node->value = impostor; /* change hash table value */ node->value = impostor; /* change hash table value */
......
/* Encoding of types for Objective C. /* Encoding of types for Objective C.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 1995 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
Author: Kresten Krab Thorup
This file is part of GNU CC. This file is part of GNU CC.
...@@ -64,7 +63,7 @@ objc_sizeof_type(const char* type) ...@@ -64,7 +63,7 @@ objc_sizeof_type(const char* type)
break; break;
case _C_CLASS: case _C_CLASS:
return sizeof(Class*); return sizeof(Class);
break; break;
case _C_SEL: case _C_SEL:
...@@ -171,7 +170,7 @@ objc_alignof_type(const char* type) ...@@ -171,7 +170,7 @@ objc_alignof_type(const char* type)
break; break;
case _C_CLASS: case _C_CLASS:
return __alignof__(Class*); return __alignof__(Class);
break; break;
case _C_SEL: case _C_SEL:
......
/* Basic data types for Objective C. /* Basic data types for Objective C.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 1995 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -76,7 +76,7 @@ typedef id (*IMP)(id, SEL, ...); ...@@ -76,7 +76,7 @@ typedef id (*IMP)(id, SEL, ...);
** More simple types... ** More simple types...
*/ */
#define nil (id)0 /* id of Nil instance */ #define nil (id)0 /* id of Nil instance */
#define Nil (Class*)0 /* id of Nil class */ #define Nil (Class)0 /* id of Nil class */
typedef char *STR; /* String alias */ typedef char *STR; /* String alias */
/* /*
...@@ -89,10 +89,10 @@ typedef char *STR; /* String alias */ ...@@ -89,10 +89,10 @@ typedef char *STR; /* String alias */
** change type. The compiler generates "char* const" and places a string in ** change type. The compiler generates "char* const" and places a string in
** the following member variables: super_class. ** the following member variables: super_class.
*/ */
typedef struct objc_class MetaClass; typedef struct objc_class *MetaClass;
typedef struct objc_class Class; typedef struct objc_class *Class;
struct objc_class { struct objc_class {
MetaClass* class_pointer; /* Pointer to the class's MetaClass class_pointer; /* Pointer to the class's
meta class. */ meta class. */
struct objc_class* super_class; /* Pointer to the super struct objc_class* super_class; /* Pointer to the super
class. NULL for class class. NULL for class
......
/* GNU Objective C Runtime class related functions /* GNU Objective C Runtime class related functions
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 1995 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
Author: Kresten Krab Thorup
This file is part of GNU CC. This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify it under the GNU CC 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 terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version. Foundation; either version 2, or (at your option) any later version.
GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
GNU CC; see the file COPYING. If not, write to the Free Software GNU CC; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* As a special exception, if you link this library with files compiled with /* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable GCC to produce an executable, this does not cause the resulting executable
...@@ -27,16 +26,16 @@ You should have received a copy of the GNU General Public License along with ...@@ -27,16 +26,16 @@ You should have received a copy of the GNU General Public License along with
#include "../tconfig.h" /* include defs of bzero for target */ #include "../tconfig.h" /* include defs of bzero for target */
#include "runtime.h" /* the kitchen sink */ #include "runtime.h" /* the kitchen sink */
id __objc_object_alloc(Class*); id __objc_object_alloc(Class);
id __objc_object_dispose(id); id __objc_object_dispose(id);
id __objc_object_copy(id); id __objc_object_copy(id);
id (*_objc_object_alloc)(Class*) = __objc_object_alloc; id (*_objc_object_alloc)(Class) = __objc_object_alloc;
id (*_objc_object_dispose)(id) = __objc_object_dispose; id (*_objc_object_dispose)(id) = __objc_object_dispose;
id (*_objc_object_copy)(id) = __objc_object_copy; id (*_objc_object_copy)(id) = __objc_object_copy;
id id
class_create_instance(Class* class) class_create_instance(Class class)
{ {
id new = nil; id new = nil;
if (CLS_ISCLASS(class)) if (CLS_ISCLASS(class))
...@@ -71,7 +70,7 @@ object_dispose(id object) ...@@ -71,7 +70,7 @@ object_dispose(id object)
return nil; return nil;
} }
id __objc_object_alloc(Class* class) id __objc_object_alloc(Class class)
{ {
return (id)__objc_xmalloc(class->instance_size); return (id)__objc_xmalloc(class->instance_size);
} }
......
/* GNU Objective C Runtime internal declarations /* GNU Objective C Runtime internal declarations
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 1995 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
Author: Kresten Krab Thorup
This file is part of GNU CC. This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify it under the GNU CC 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 terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version. Foundation; either version 2, or (at your option) any later version.
GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
GNU CC; see the file COPYING. If not, write to the Free Software GNU CC; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* As a special exception, if you link this library with files compiled with /* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable GCC to produce an executable, this does not cause the resulting executable
...@@ -41,15 +40,15 @@ You should have received a copy of the GNU General Public License along with ...@@ -41,15 +40,15 @@ You should have received a copy of the GNU General Public License along with
#include "objc/hash.h" /* hash structures */ #include "objc/hash.h" /* hash structures */
#include "objc/list.h" /* linear lists */ #include "objc/list.h" /* linear lists */
extern void __objc_add_class_to_hash(Class*); /* (objc-class.c) */ extern void __objc_add_class_to_hash(Class); /* (objc-class.c) */
extern void __objc_init_selector_tables(); /* (objc-sel.c) */ extern void __objc_init_selector_tables(); /* (objc-sel.c) */
extern void __objc_init_class_tables(); /* (objc-class.c) */ extern void __objc_init_class_tables(); /* (objc-class.c) */
extern void __objc_init_dispatch_tables(); /* (objc-dispatch.c) */ extern void __objc_init_dispatch_tables(); /* (objc-dispatch.c) */
extern void __objc_install_premature_dtable(Class*); /* (objc-dispatch.c) */ extern void __objc_install_premature_dtable(Class); /* (objc-dispatch.c) */
extern void __objc_resolve_class_links(); /* (objc-class.c) */ extern void __objc_resolve_class_links(); /* (objc-class.c) */
extern void __objc_register_selectors_from_class(Class*); /* (objc-sel.c) */ extern void __objc_register_selectors_from_class(Class); /* (objc-sel.c) */
extern void __objc_update_dispatch_table_for_class (Class*);/* (objc-msg.c) */ extern void __objc_update_dispatch_table_for_class (Class);/* (objc-msg.c) */
extern void class_add_method_list(Class*, MethodList_t); extern void class_add_method_list(Class, MethodList_t);
extern void objc_error(id object, const char* fmt, va_list); extern void objc_error(id object, const char* fmt, va_list);
extern void (*_objc_error)(id, const char*, va_list); extern void (*_objc_error)(id, const char*, va_list);
......
/* GNU Objective C Runtime selector related functions /* GNU Objective C Runtime selector related functions
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 1995 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
Author: Kresten Krab Thorup
This file is part of GNU CC. This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify it under the GNU CC 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 terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version. Foundation; either version 2, or (at your option) any later version.
GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
GNU CC; see the file COPYING. If not, write to the Free Software GNU CC; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* As a special exception, if you link this library with files compiled with /* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable GCC to produce an executable, this does not cause the resulting executable
...@@ -54,7 +53,7 @@ void __objc_init_selector_tables() ...@@ -54,7 +53,7 @@ void __objc_init_selector_tables()
/* This routine is given a class and records all of the methods in its class /* This routine is given a class and records all of the methods in its class
structure in the record table. */ structure in the record table. */
void void
__objc_register_selectors_from_class (Class* class) __objc_register_selectors_from_class (Class class)
{ {
MethodList_t method_list; MethodList_t method_list;
......
/* GNU Objective C Runtime message lookup /* GNU Objective C Runtime message lookup
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 1995 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
Author: Kresten Krab Thorup
This file is part of GNU CC. This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify it under the GNU CC 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 terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version. Foundation; either version 2, or (at your option) any later version.
GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
GNU CC; see the file COPYING. If not, write to the Free Software GNU CC; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* As a special exception, if you link this library with files compiled with /* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable GCC to produce an executable, this does not cause the resulting executable
...@@ -43,9 +42,9 @@ You should have received a copy of the GNU General Public License along with ...@@ -43,9 +42,9 @@ You should have received a copy of the GNU General Public License along with
struct sarray* __objc_uninstalled_dtable = 0; struct sarray* __objc_uninstalled_dtable = 0;
/* Send +initialize to class */ /* Send +initialize to class */
static void __objc_send_initialize(Class*); static void __objc_send_initialize(Class);
static void __objc_install_dispatch_table_for_class (Class*); static void __objc_install_dispatch_table_for_class (Class);
/* Forward declare some functions */ /* Forward declare some functions */
static void __objc_init_install_dtable(id, SEL); static void __objc_init_install_dtable(id, SEL);
...@@ -57,7 +56,7 @@ static __big ...@@ -57,7 +56,7 @@ static __big
static id static id
#endif #endif
__objc_block_forward(id, SEL, ...); __objc_block_forward(id, SEL, ...);
static Method_t search_for_method_in_hierarchy (Class* class, SEL sel); static Method_t search_for_method_in_hierarchy (Class class, SEL sel);
static Method_t search_for_method_in_list(MethodList_t list, SEL op); static Method_t search_for_method_in_list(MethodList_t list, SEL op);
id nil_method(id, SEL, ...); id nil_method(id, SEL, ...);
...@@ -70,7 +69,7 @@ nil_method(id receiver, SEL op, ...) ...@@ -70,7 +69,7 @@ nil_method(id receiver, SEL op, ...)
/* Given a class and selector, return the selector's implementation. */ /* Given a class and selector, return the selector's implementation. */
__inline__ __inline__
IMP IMP
get_imp (Class* class, SEL sel) get_imp (Class class, SEL sel)
{ {
IMP impl; IMP impl;
void* res = sarray_get (class->dtable, (size_t) sel->sel_id); void* res = sarray_get (class->dtable, (size_t) sel->sel_id);
...@@ -187,16 +186,16 @@ static void __objc_init_install_dtable(id receiver, SEL op) ...@@ -187,16 +186,16 @@ static void __objc_init_install_dtable(id receiver, SEL op)
else else
{ {
/* receiver is a class object */ /* receiver is a class object */
assert(CLS_ISCLASS((Class*)receiver)); assert(CLS_ISCLASS((Class)receiver));
assert(CLS_ISMETA(receiver->class_pointer)); assert(CLS_ISMETA(receiver->class_pointer));
/* Install real dtable for factory methods */ /* Install real dtable for factory methods */
__objc_install_dispatch_table_for_class (receiver->class_pointer); __objc_install_dispatch_table_for_class (receiver->class_pointer);
if (strcmp (sel_get_name (op), "initialize")) if (strcmp (sel_get_name (op), "initialize"))
__objc_send_initialize((Class*)receiver); __objc_send_initialize((Class)receiver);
else else
CLS_SETINITIALIZED((Class*)receiver); CLS_SETINITIALIZED((Class)receiver);
} }
allready_initialized: allready_initialized:
...@@ -215,14 +214,14 @@ allready_initialized: ...@@ -215,14 +214,14 @@ allready_initialized:
/* Install dummy table for class which causes the first message to /* Install dummy table for class which causes the first message to
that class (or instances hereof) to be initialized properly */ that class (or instances hereof) to be initialized properly */
void __objc_install_premature_dtable(Class* class) void __objc_install_premature_dtable(Class class)
{ {
assert(__objc_uninstalled_dtable); assert(__objc_uninstalled_dtable);
class->dtable = __objc_uninstalled_dtable; class->dtable = __objc_uninstalled_dtable;
} }
/* Send +initialize to class if not already done */ /* Send +initialize to class if not already done */
static void __objc_send_initialize(Class* class) static void __objc_send_initialize(Class class)
{ {
/* This *must* be a class object */ /* This *must* be a class object */
assert(CLS_ISCLASS(class)); assert(CLS_ISCLASS(class));
...@@ -264,9 +263,9 @@ static void __objc_send_initialize(Class* class) ...@@ -264,9 +263,9 @@ static void __objc_send_initialize(Class* class)
} }
static void static void
__objc_install_dispatch_table_for_class (Class* class) __objc_install_dispatch_table_for_class (Class class)
{ {
Class* super; Class super;
MethodList_t mlist; MethodList_t mlist;
int counter; int counter;
...@@ -302,9 +301,9 @@ __objc_install_dispatch_table_for_class (Class* class) ...@@ -302,9 +301,9 @@ __objc_install_dispatch_table_for_class (Class* class)
} }
} }
void __objc_update_dispatch_table_for_class (Class* class) void __objc_update_dispatch_table_for_class (Class class)
{ {
Class* next; Class next;
/* not yet installed -- skip it */ /* not yet installed -- skip it */
if (class->dtable == __objc_uninstalled_dtable) if (class->dtable == __objc_uninstalled_dtable)
...@@ -329,7 +328,7 @@ void __objc_update_dispatch_table_for_class (Class* class) ...@@ -329,7 +328,7 @@ void __objc_update_dispatch_table_for_class (Class* class)
methods installed rightaway, and their selectors are made into methods installed rightaway, and their selectors are made into
SEL's by the function __objc_register_selectors_from_class. */ SEL's by the function __objc_register_selectors_from_class. */
void void
class_add_method_list (Class* class, MethodList_t list) class_add_method_list (Class class, MethodList_t list)
{ {
int i; int i;
static SEL initialize_sel = 0; static SEL initialize_sel = 0;
...@@ -370,13 +369,13 @@ class_add_method_list (Class* class, MethodList_t list) ...@@ -370,13 +369,13 @@ class_add_method_list (Class* class, MethodList_t list)
Method_t Method_t
class_get_instance_method(Class* class, SEL op) class_get_instance_method(Class class, SEL op)
{ {
return search_for_method_in_hierarchy(class, op); return search_for_method_in_hierarchy(class, op);
} }
Method_t Method_t
class_get_class_method(MetaClass* class, SEL op) class_get_class_method(MetaClass class, SEL op)
{ {
return search_for_method_in_hierarchy(class, op); return search_for_method_in_hierarchy(class, op);
} }
...@@ -387,10 +386,10 @@ class_get_class_method(MetaClass* class, SEL op) ...@@ -387,10 +386,10 @@ class_get_class_method(MetaClass* class, SEL op)
otherwise. */ otherwise. */
static Method_t static Method_t
search_for_method_in_hierarchy (Class* cls, SEL sel) search_for_method_in_hierarchy (Class cls, SEL sel)
{ {
Method_t method = NULL; Method_t method = NULL;
Class* class; Class class;
if (! sel_is_mapped (sel)) if (! sel_is_mapped (sel))
return NULL; return NULL;
......
/* GNU Objective-C Typed Streams interface. /* GNU Objective-C Typed Streams interface.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 1995 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -98,7 +98,7 @@ int objc_read_types (TypedStream* stream, const char* type, ...); ...@@ -98,7 +98,7 @@ int objc_read_types (TypedStream* stream, const char* type, ...);
int objc_write_object_reference (TypedStream* stream, id object); int objc_write_object_reference (TypedStream* stream, id object);
int objc_write_root_object (TypedStream* stream, id object); int objc_write_root_object (TypedStream* stream, id object);
long objc_get_stream_class_version (TypedStream* stream, Class* class); long objc_get_stream_class_version (TypedStream* stream, Class class);
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment