OSDN Git Service

2002-07-02 Rodney Brown <rbrown64@csc.com.au>
authorshebs <shebs@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Jul 2002 19:43:03 +0000 (19:43 +0000)
committershebs <shebs@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Jul 2002 19:43:03 +0000 (19:43 +0000)
* objc/encoding.h: Fix formatting.
* objc/hash.h: Likewise.
* objc/objc-api.h: Likewise.
* objc/runtime.h: Likewise.
* objc/thr.h: Likewise.
* archive.c: Likewise.
* class.c: Likewise.
* encoding.c: Likewise.
* gc.c: Likewise.
* hash.c: Likewise.
* init.c: Likewise.
* misc.c: Likewise.
* nil_method.c: Likewise.
* objects.c: Likewise.
* sarray.c: Likewise.
* selector.c: Likewise.
* sendmsg.c: Likewise.
* thr-mach.c: Likewise.
* thr.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55190 138bc75d-0d04-0410-961f-82ee72b054a4

18 files changed:
libobjc/ChangeLog
libobjc/archive.c
libobjc/class.c
libobjc/encoding.c
libobjc/gc.c
libobjc/hash.c
libobjc/init.c
libobjc/misc.c
libobjc/nil_method.c
libobjc/objc/encoding.h
libobjc/objc/hash.h
libobjc/objc/thr.h
libobjc/objects.c
libobjc/sarray.c
libobjc/selector.c
libobjc/sendmsg.c
libobjc/thr-mach.c
libobjc/thr.c

index 6cbfdeb..db5a938 100644 (file)
@@ -1,3 +1,25 @@
+2002-07-02  Rodney Brown  <rbrown64@csc.com.au>
+
+       * objc/encoding.h: Fix formatting.
+       * objc/hash.h: Likewise.
+       * objc/objc-api.h: Likewise.
+       * objc/runtime.h: Likewise.
+       * objc/thr.h: Likewise.
+       * archive.c: Likewise.
+       * class.c: Likewise.
+       * encoding.c: Likewise.
+       * gc.c: Likewise.
+       * hash.c: Likewise.
+       * init.c: Likewise.
+       * misc.c: Likewise.
+       * nil_method.c: Likewise.
+       * objects.c: Likewise.
+       * sarray.c: Likewise.
+       * selector.c: Likewise.
+       * sendmsg.c: Likewise.
+       * thr-mach.c: Likewise.
+       * thr.c: Likewise.
+
 2002-06-25  DJ Delorie  <dj@redhat.com>
 
        * aclocal.m4 (GLIBCPP_CONFIGURE): Split out
 2002-06-25  DJ Delorie  <dj@redhat.com>
 
        * aclocal.m4 (GLIBCPP_CONFIGURE): Split out
index e6b6d2f..f98379b 100644 (file)
@@ -1,5 +1,5 @@
-/* GNU Objective C Runtime archiving
-   Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ /* GNU Objective C Runtime archiving
+   Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
    Contributed by Kresten Krab Thorup
 
 This file is part of GNU CC.
    Contributed by Kresten Krab Thorup
 
 This file is part of GNU CC.
@@ -30,40 +30,40 @@ Boston, MA 02111-1307, USA.  */
 #include "encoding.h"
 #include <stdlib.h>
 
 #include "encoding.h"
 #include <stdlib.h>
 
-extern int fflush(FILE*);
+extern int fflush (FILE *);
 
 #define ROUND(V, A) \
 
 #define ROUND(V, A) \
-  ({ typeof(V) __v=(V); typeof(A) __a=(A);  \
-     __a*((__v+__a-1)/__a); })
+  ({ typeof (V) __v = (V); typeof (A) __a = (A);  \
+     __a * ((__v + __a - 1)/__a); })
 
 
-#define PTR2LONG(P) (((char*)(P))-(char*)0)
-#define LONG2PTR(L) (((char*)0)+(L))
+#define PTR2LONG(P) (((char *) (P))-(char *) 0)
+#define LONG2PTR(L) (((char *) 0) + (L))
 
 /* Declare some functions... */
 
 static int
 
 /* Declare some functions... */
 
 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);
 
 static int
 
 static int
-objc_write_use_common (struct objc_typed_streamstream, unsigned long key);
+objc_write_use_common (struct objc_typed_stream *stream, unsigned long key);
 
 static int
 
 static int
-objc_write_register_common (struct objc_typed_streamstream,
+objc_write_register_common (struct objc_typed_stream *stream,
                            unsigned long key);
 
 static int 
                            unsigned long key);
 
 static int 
-objc_write_class (struct objc_typed_streamstream,
-                        struct objc_classclass);
+objc_write_class (struct objc_typed_stream *stream,
+                        struct objc_class *class);
 
 
-const char* objc_skip_type (const char* type);
+const char *objc_skip_type (const char *type);
 
 
-static void __objc_finish_write_root_object(struct objc_typed_stream*);
-static void __objc_finish_read_root_object(struct objc_typed_stream*);
+static void __objc_finish_write_root_object (struct objc_typed_stream *);
+static void __objc_finish_read_root_object (struct objc_typed_stream *);
 
 static __inline__ int
 
 static __inline__ int
-__objc_code_unsigned_char (unsigned charbuf, unsigned char val)
+__objc_code_unsigned_char (unsigned char *buf, unsigned char val)
 {
   if ((val&_B_VALUE) == val)
     {
 {
   if ((val&_B_VALUE) == val)
     {
@@ -79,16 +79,16 @@ __objc_code_unsigned_char (unsigned char* buf, unsigned char val)
 }
 
 int
 }
 
 int
-objc_write_unsigned_char (struct objc_typed_streamstream,
+objc_write_unsigned_char (struct objc_typed_stream *stream,
                          unsigned char value)
 {
                          unsigned char value)
 {
-  unsigned char buf[sizeof (unsigned char)+1];
+  unsigned char buf[sizeof (unsigned char) + 1];
   int len = __objc_code_unsigned_char (buf, value);
   int len = __objc_code_unsigned_char (buf, value);
-  return (*stream->write)(stream->physical, buf, len);
+  return (*stream->write) (stream->physical, buf, len);
 }
 
 static __inline__ int
 }
 
 static __inline__ int
-__objc_code_char (unsigned charbuf, signed char val)
+__objc_code_char (unsigned char *buf, signed char val)
 {
   if (val >= 0)
     return __objc_code_unsigned_char (buf, val);
 {
   if (val >= 0)
     return __objc_code_unsigned_char (buf, val);
@@ -101,15 +101,15 @@ __objc_code_char (unsigned char* buf, signed char val)
 }
 
 int
 }
 
 int
-objc_write_char (struct objc_typed_streamstream, signed char value)
+objc_write_char (struct objc_typed_stream *stream, signed char value)
 {
 {
-  unsigned char buf[sizeof (char)+1];
+  unsigned char buf[sizeof (char) + 1];
   int len = __objc_code_char (buf, value);
   int len = __objc_code_char (buf, value);
-  return (*stream->write)(stream->physical, buf, len);
+  return (*stream->write) (stream->physical, buf, len);
 }
 
 static __inline__ int
 }
 
 static __inline__ int
-__objc_code_unsigned_short (unsigned charbuf, unsigned short val)
+__objc_code_unsigned_short (unsigned char *buf, unsigned short val)
 {
   if ((val&_B_VALUE) == val)
     {
 {
   if ((val&_B_VALUE) == val)
     {
@@ -122,15 +122,15 @@ __objc_code_unsigned_short (unsigned char* buf, unsigned short val)
 
       buf[0] = _B_NINT;
 
 
       buf[0] = _B_NINT;
 
-      for (c= sizeof(short); c != 0; c -= 1)
-       if (((val>>(8*(c-1)))%0x100) != 0)
+      for (c = sizeof (short); c != 0; c -= 1)
+       if (((val >> (8*(c - 1)))%0x100) != 0)
          break;
 
       buf[0] |= c;
 
       for (b = 1; c != 0; c--, b++)
        {
          break;
 
       buf[0] |= c;
 
       for (b = 1; c != 0; c--, b++)
        {
-         buf[b] = (val >> (8*(c-1)))%0x100;
+         buf[b] = (val >> (8*(c - 1)))%0x100;
        }
 
       return b;
        }
 
       return b;
@@ -138,16 +138,16 @@ __objc_code_unsigned_short (unsigned char* buf, unsigned short val)
 }
 
 int
 }
 
 int
-objc_write_unsigned_short (struct objc_typed_streamstream, 
+objc_write_unsigned_short (struct objc_typed_stream *stream, 
                           unsigned short value)
 {
                           unsigned short value)
 {
-  unsigned char buf[sizeof (unsigned short)+1];
+  unsigned char buf[sizeof (unsigned short) + 1];
   int len = __objc_code_unsigned_short (buf, value);
   int len = __objc_code_unsigned_short (buf, value);
-  return (*stream->write)(stream->physical, buf, len);
+  return (*stream->write) (stream->physical, buf, len);
 }
       
 static __inline__ int
 }
       
 static __inline__ int
-__objc_code_short (unsigned charbuf, short val)
+__objc_code_short (unsigned char *buf, short val)
 {
   int sign = (val < 0);
   int size = __objc_code_unsigned_short (buf, sign ? -val : val);
 {
   int sign = (val < 0);
   int size = __objc_code_unsigned_short (buf, sign ? -val : val);
@@ -157,16 +157,16 @@ __objc_code_short (unsigned char* buf, short val)
 }
 
 int
 }
 
 int
-objc_write_short (struct objc_typed_streamstream, short value)
+objc_write_short (struct objc_typed_stream *stream, short value)
 {
 {
-  unsigned char buf[sizeof (short)+1];
+  unsigned char buf[sizeof (short) + 1];
   int len = __objc_code_short (buf, value);
   int len = __objc_code_short (buf, value);
-  return (*stream->write)(stream->physical, buf, len);
+  return (*stream->write) (stream->physical, buf, len);
 }
       
 
 static __inline__ int
 }
       
 
 static __inline__ int
-__objc_code_unsigned_int (unsigned charbuf, unsigned int val)
+__objc_code_unsigned_int (unsigned char *buf, unsigned int val)
 {
   if ((val&_B_VALUE) == val)
     {
 {
   if ((val&_B_VALUE) == val)
     {
@@ -179,8 +179,8 @@ __objc_code_unsigned_int (unsigned char* buf, unsigned int val)
 
       buf[0] = _B_NINT;
 
 
       buf[0] = _B_NINT;
 
-      for (c= sizeof(int); c != 0; c -= 1)
-       if (((val>>(8*(c-1)))%0x100) != 0)
+      for (c = sizeof (int); c != 0; c -= 1)
+       if (((val >> (8*(c - 1)))%0x100) != 0)
          break;
 
       buf[0] |= c;
          break;
 
       buf[0] |= c;
@@ -195,15 +195,15 @@ __objc_code_unsigned_int (unsigned char* buf, unsigned int val)
 }
 
 int
 }
 
 int
-objc_write_unsigned_int (struct objc_typed_streamstream, unsigned int value)
+objc_write_unsigned_int (struct objc_typed_stream *stream, unsigned int value)
 {
 {
-  unsigned char buf[sizeof(unsigned int)+1];
+  unsigned char buf[sizeof (unsigned int) + 1];
   int len = __objc_code_unsigned_int (buf, value);
   int len = __objc_code_unsigned_int (buf, value);
-  return (*stream->write)(stream->physical, buf, len);
+  return (*stream->write) (stream->physical, buf, len);
 }
 
 static __inline__ int
 }
 
 static __inline__ int
-__objc_code_int (unsigned charbuf, int val)
+__objc_code_int (unsigned char *buf, int val)
 {
   int sign = (val < 0);
   int size = __objc_code_unsigned_int (buf, sign ? -val : val);
 {
   int sign = (val < 0);
   int size = __objc_code_unsigned_int (buf, sign ? -val : val);
@@ -213,15 +213,15 @@ __objc_code_int (unsigned char* buf, int val)
 }
 
 int
 }
 
 int
-objc_write_int (struct objc_typed_streamstream, int value)
+objc_write_int (struct objc_typed_stream *stream, int value)
 {
 {
-  unsigned char buf[sizeof(int)+1];
+  unsigned char buf[sizeof (int) + 1];
   int len = __objc_code_int (buf, value);
   int len = __objc_code_int (buf, value);
-  return (*stream->write)(stream->physical, buf, len);
+  return (*stream->write) (stream->physical, buf, len);
 }
 
 static __inline__ int
 }
 
 static __inline__ int
-__objc_code_unsigned_long (unsigned charbuf, unsigned long val)
+__objc_code_unsigned_long (unsigned char *buf, unsigned long val)
 {
   if ((val&_B_VALUE) == val)
     {
 {
   if ((val&_B_VALUE) == val)
     {
@@ -234,15 +234,15 @@ __objc_code_unsigned_long (unsigned char* buf, unsigned long val)
 
       buf[0] = _B_NINT;
 
 
       buf[0] = _B_NINT;
 
-      for (c= sizeof(long); c != 0; c -= 1)
-       if (((val>>(8*(c-1)))%0x100) != 0)
+      for (c = sizeof (long); c != 0; c -= 1)
+       if (((val >> (8*(c - 1)))%0x100) != 0)
          break;
 
       buf[0] |= c;
 
       for (b = 1; c != 0; c--, b++)
        {
          break;
 
       buf[0] |= c;
 
       for (b = 1; c != 0; c--, b++)
        {
-         buf[b] = (val >> (8*(c-1)))%0x100;
+         buf[b] = (val >> (8*(c - 1)))%0x100;
        }
 
       return b;
        }
 
       return b;
@@ -250,16 +250,16 @@ __objc_code_unsigned_long (unsigned char* buf, unsigned long val)
 }
 
 int
 }
 
 int
-objc_write_unsigned_long (struct objc_typed_streamstream, 
+objc_write_unsigned_long (struct objc_typed_stream *stream, 
                          unsigned long value)
 {
                          unsigned long value)
 {
-  unsigned char buf[sizeof(unsigned long)+1];
+  unsigned char buf[sizeof (unsigned long) + 1];
   int len = __objc_code_unsigned_long (buf, value);
   int len = __objc_code_unsigned_long (buf, value);
-  return (*stream->write)(stream->physical, buf, len);
+  return (*stream->write) (stream->physical, buf, len);
 }
 
 static __inline__ int
 }
 
 static __inline__ int
-__objc_code_long (unsigned charbuf, long val)
+__objc_code_long (unsigned char *buf, long val)
 {
   int sign = (val < 0);
   int size = __objc_code_unsigned_long (buf, sign ? -val : val);
 {
   int sign = (val < 0);
   int size = __objc_code_unsigned_long (buf, sign ? -val : val);
@@ -269,19 +269,19 @@ __objc_code_long (unsigned char* buf, long val)
 }
 
 int
 }
 
 int
-objc_write_long (struct objc_typed_streamstream, long value)
+objc_write_long (struct objc_typed_stream *stream, long value)
 {
 {
-  unsigned char buf[sizeof(long)+1];
+  unsigned char buf[sizeof (long) + 1];
   int len = __objc_code_long (buf, value);
   int len = __objc_code_long (buf, value);
-  return (*stream->write)(stream->physical, buf, len);
+  return (*stream->write) (stream->physical, buf, len);
 }
 
 
 int
 }
 
 
 int
-objc_write_string (struct objc_typed_streamstream,
-                  const unsigned charstring, unsigned int nbytes)
+objc_write_string (struct objc_typed_stream *stream,
+                  const unsigned char *string, unsigned int nbytes)
 {
 {
-  unsigned char buf[sizeof(unsigned int)+1];
+  unsigned char buf[sizeof (unsigned int) + 1];
   int len = __objc_code_unsigned_int (buf, nbytes);
   
   if ((buf[0]&_B_CODE) == _B_SINT)
   int len = __objc_code_unsigned_int (buf, nbytes);
   
   if ((buf[0]&_B_CODE) == _B_SINT)
@@ -290,15 +290,15 @@ objc_write_string (struct objc_typed_stream* stream,
   else /* _B_NINT */
     buf[0] = (buf[0]&_B_VALUE)|_B_NSTR;
 
   else /* _B_NINT */
     buf[0] = (buf[0]&_B_VALUE)|_B_NSTR;
 
-  if ((*stream->write)(stream->physical, buf, len) != 0)
-    return (*stream->write)(stream->physical, string, nbytes);
+  if ((*stream->write) (stream->physical, buf, len) != 0)
+    return (*stream->write) (stream->physical, string, nbytes);
   else
     return 0;
 }
 
 int
   else
     return 0;
 }
 
 int
-objc_write_string_atomic (struct objc_typed_streamstream,
-                         unsigned charstring, unsigned int nbytes)
+objc_write_string_atomic (struct objc_typed_stream *stream,
+                         unsigned char *string, unsigned int nbytes)
 {
   unsigned long key;
   if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, string))))
 {
   unsigned long key;
   if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, string))))
@@ -314,60 +314,60 @@ objc_write_string_atomic (struct objc_typed_stream* stream,
 }
 
 static int
 }
 
 static int
-objc_write_register_common (struct objc_typed_streamstream, 
+objc_write_register_common (struct objc_typed_stream *stream, 
                            unsigned long key)
 {
   unsigned char buf[sizeof (unsigned long)+2];
                            unsigned long key)
 {
   unsigned char buf[sizeof (unsigned long)+2];
-  int len = __objc_code_unsigned_long (buf+1, key);
+  int len = __objc_code_unsigned_long (buf + 1, key);
   if (len == 1)
     {
       buf[0] = _B_RCOMM|0x01;
       buf[1] &= _B_VALUE;
   if (len == 1)
     {
       buf[0] = _B_RCOMM|0x01;
       buf[1] &= _B_VALUE;
-      return (*stream->write)(stream->physical, buf, len+1);
+      return (*stream->write) (stream->physical, buf, len + 1);
     }
   else
     {
       buf[1] = (buf[1]&_B_VALUE)|_B_RCOMM;
     }
   else
     {
       buf[1] = (buf[1]&_B_VALUE)|_B_RCOMM;
-      return (*stream->write)(stream->physical, buf+1, len);
+      return (*stream->write) (stream->physical, buf + 1, len);
     }
 }
 
 static int
     }
 }
 
 static int
-objc_write_use_common (struct objc_typed_streamstream, unsigned long key)
+objc_write_use_common (struct objc_typed_stream *stream, unsigned long key)
 {
   unsigned char buf[sizeof (unsigned long)+2];
 {
   unsigned char buf[sizeof (unsigned long)+2];
-  int len = __objc_code_unsigned_long (buf+1, key);
+  int len = __objc_code_unsigned_long (buf + 1, key);
   if (len == 1)
     {
       buf[0] = _B_UCOMM|0x01;
       buf[1] &= _B_VALUE;
   if (len == 1)
     {
       buf[0] = _B_UCOMM|0x01;
       buf[1] &= _B_VALUE;
-      return (*stream->write)(stream->physical, buf, 2);
+      return (*stream->write) (stream->physical, buf, 2);
     }
   else
     {
       buf[1] = (buf[1]&_B_VALUE)|_B_UCOMM;
     }
   else
     {
       buf[1] = (buf[1]&_B_VALUE)|_B_UCOMM;
-      return (*stream->write)(stream->physical, buf+1, len);
+      return (*stream->write) (stream->physical, buf + 1, len);
     }
 }
 
 static __inline__ int
     }
 }
 
 static __inline__ int
-__objc_write_extension (struct objc_typed_streamstream, unsigned char code)
+__objc_write_extension (struct objc_typed_stream *stream, unsigned char code)
 {
   if (code <= _B_VALUE)
     {
       unsigned char buf = code|_B_EXT;
 {
   if (code <= _B_VALUE)
     {
       unsigned char buf = code|_B_EXT;
-      return (*stream->write)(stream->physical, &buf, 1);
+      return (*stream->write) (stream->physical, &buf, 1);
     }
   else 
     {
     }
   else 
     {
-      objc_error(nil, OBJC_ERR_BAD_OPCODE,
-                "__objc_write_extension: bad opcode %c\n", code);
+      objc_error (nil, OBJC_ERR_BAD_OPCODE,
+                 "__objc_write_extension: bad opcode %c\n", code);
       return -1;
     }
 }
 
 __inline__ int
       return -1;
     }
 }
 
 __inline__ int
-__objc_write_object (struct objc_typed_streamstream, id object)
+__objc_write_object (struct objc_typed_stream *stream, id object)
 {
   unsigned char buf = '\0';
   SEL write_sel = sel_get_any_uid ("write:");
 {
   unsigned char buf = '\0';
   SEL write_sel = sel_get_any_uid ("write:");
@@ -375,15 +375,15 @@ __objc_write_object (struct objc_typed_stream* stream, id object)
     {
       __objc_write_extension (stream, _BX_OBJECT);
       objc_write_class (stream, object->class_pointer);
     {
       __objc_write_extension (stream, _BX_OBJECT);
       objc_write_class (stream, object->class_pointer);
-      (*objc_msg_lookup(object, write_sel))(object, write_sel, stream);
-      return (*stream->write)(stream->physical, &buf, 1);
+      (*objc_msg_lookup (object, write_sel)) (object, write_sel, stream);
+      return (*stream->write) (stream->physical, &buf, 1);
     }
   else
     }
   else
-    return objc_write_use_common(stream, 0);
+    return objc_write_use_common (stream, 0);
 }
 
 int 
 }
 
 int 
-objc_write_object_reference (struct objc_typed_streamstream, id object)
+objc_write_object_reference (struct objc_typed_stream *stream, id object)
 {
   unsigned long key;
   if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object))))
 {
   unsigned long key;
   if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object))))
@@ -394,7 +394,7 @@ objc_write_object_reference (struct objc_typed_stream* stream, id object)
 }
 
 int 
 }
 
 int 
-objc_write_root_object (struct objc_typed_streamstream, id object)
+objc_write_root_object (struct objc_typed_stream *stream, id object)
 {
   int len = 0;
   if (stream->writing_root_p)
 {
   int len = 0;
   if (stream->writing_root_p)
@@ -404,22 +404,22 @@ objc_write_root_object (struct objc_typed_stream* stream, id object)
     {
       stream->writing_root_p = 1;
       __objc_write_extension (stream, _BX_OBJROOT);
     {
       stream->writing_root_p = 1;
       __objc_write_extension (stream, _BX_OBJROOT);
-      if((len = objc_write_object (stream, object)))
-       __objc_finish_write_root_object(stream);
+      if ((len = objc_write_object (stream, object)))
+       __objc_finish_write_root_object (stream);
       stream->writing_root_p = 0;
     }
   return len;
 }
 
 int 
       stream->writing_root_p = 0;
     }
   return len;
 }
 
 int 
-objc_write_object (struct objc_typed_streamstream, id object)
+objc_write_object (struct objc_typed_stream *stream, id object)
 {
   unsigned long key;
   if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object))))
     return objc_write_use_common (stream, key);
 
   else if (object == nil)
 {
   unsigned long key;
   if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object))))
     return objc_write_use_common (stream, key);
 
   else if (object == nil)
-    return objc_write_use_common(stream, 0);
+    return objc_write_use_common (stream, 0);
 
   else
     {
 
   else
     {
@@ -432,18 +432,18 @@ objc_write_object (struct objc_typed_stream* stream, id object)
 }
 
 __inline__ int
 }
 
 __inline__ int
-__objc_write_class (struct objc_typed_stream* stream, struct objc_class* class)
+__objc_write_class (struct objc_typed_stream *stream, struct objc_class *class)
 {
   __objc_write_extension (stream, _BX_CLASS);
 {
   __objc_write_extension (stream, _BX_CLASS);
-  objc_write_string_atomic(stream, (char*)class->name,
-                          strlen((char*)class->name));
+  objc_write_string_atomic (stream, (char *) class->name,
+                          strlen ((char *) class->name));
   return objc_write_unsigned_long (stream, class->version);
 }
 
 
 static int 
   return objc_write_unsigned_long (stream, class->version);
 }
 
 
 static int 
-objc_write_class (struct objc_typed_streamstream,
-                        struct objc_classclass)
+objc_write_class (struct objc_typed_stream *stream,
+                        struct objc_class *class)
 {
   unsigned long key;
   if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, class))))
 {
   unsigned long key;
   if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, class))))
@@ -451,7 +451,7 @@ objc_write_class (struct objc_typed_stream* stream,
   else
     {
       int length;
   else
     {
       int length;
-      hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(class)), class);
+      hash_add (&stream->stream_table, LONG2PTR(key = PTR2LONG(class)), class);
       if ((length = objc_write_register_common (stream, key)))
        return __objc_write_class (stream, class);
       return length;
       if ((length = objc_write_register_common (stream, key)))
        return __objc_write_class (stream, class);
       return length;
@@ -460,9 +460,9 @@ objc_write_class (struct objc_typed_stream* stream,
 
 
 __inline__ int 
 
 
 __inline__ int 
-__objc_write_selector (struct objc_typed_streamstream, SEL selector)
+__objc_write_selector (struct objc_typed_stream *stream, SEL selector)
 {
 {
-  const charsel_name;
+  const char *sel_name;
   __objc_write_extension (stream, _BX_SEL);
   /* to handle NULL selectors */
   if ((SEL)0 == selector)
   __objc_write_extension (stream, _BX_SEL);
   /* to handle NULL selectors */
   if ((SEL)0 == selector)
@@ -472,9 +472,9 @@ __objc_write_selector (struct objc_typed_stream* stream, SEL selector)
 }
 
 int 
 }
 
 int 
-objc_write_selector (struct objc_typed_streamstream, SEL selector)
+objc_write_selector (struct objc_typed_stream *stream, SEL selector)
 {
 {
-  const charsel_name;
+  const char *sel_name;
   unsigned long key;
 
   /* to handle NULL selectors */
   unsigned long key;
 
   /* to handle NULL selectors */
@@ -488,7 +488,7 @@ objc_write_selector (struct objc_typed_stream* stream, SEL selector)
     {
       int length;
       hash_add (&stream->stream_table, 
     {
       int length;
       hash_add (&stream->stream_table, 
-               LONG2PTR(key=PTR2LONG(sel_name)), (char*)sel_name);
+               LONG2PTR(key = PTR2LONG(sel_name)), (char *) sel_name);
       if ((length = objc_write_register_common (stream, key)))
        return __objc_write_selector (stream, selector);
       return length;
       if ((length = objc_write_register_common (stream, key)))
        return __objc_write_selector (stream, selector);
       return length;
@@ -502,11 +502,11 @@ objc_write_selector (struct objc_typed_stream* stream, SEL selector)
 */
 
 __inline__ int
 */
 
 __inline__ int
-objc_read_char (struct objc_typed_stream* stream, char* val)
+objc_read_char (struct objc_typed_stream *stream, char *val)
 {
   unsigned char buf;
   int len;
 {
   unsigned char buf;
   int len;
-  len = (*stream->read)(stream->physical, &buf, 1);
+  len = (*stream->read) (stream->physical, &buf, 1);
   if (len != 0)
     {
       if ((buf & _B_CODE) == _B_SINT)
   if (len != 0)
     {
       if ((buf & _B_CODE) == _B_SINT)
@@ -514,47 +514,47 @@ objc_read_char (struct objc_typed_stream* stream, char* val)
 
       else if ((buf & _B_NUMBER) == 1)
        {
 
       else if ((buf & _B_NUMBER) == 1)
        {
-         len = (*stream->read)(stream->physical, val, 1);
+         len = (*stream->read) (stream->physical, val, 1);
          if (buf&_B_SIGN)
          if (buf&_B_SIGN)
-           (*val) = -1*(*val);
+           (*val) = -1 * (*val);
        }
 
       else
        }
 
       else
-       objc_error(nil, OBJC_ERR_BAD_DATA,
-                  "expected 8bit signed int, got %dbit int",
-                  (int)(buf&_B_NUMBER)*8);
+       objc_error (nil, OBJC_ERR_BAD_DATA,
+                   "expected 8bit signed int, got %dbit int",
+                   (int) (buf&_B_NUMBER)*8);
     }
   return len;
 }
 
 
 __inline__ int
     }
   return len;
 }
 
 
 __inline__ int
-objc_read_unsigned_char (struct objc_typed_stream* stream, unsigned char* val)
+objc_read_unsigned_char (struct objc_typed_stream *stream, unsigned char *val)
 {
   unsigned char buf;
   int len;
 {
   unsigned char buf;
   int len;
-  if ((len = (*stream->read)(stream->physical, &buf, 1)))
+  if ((len = (*stream->read) (stream->physical, &buf, 1)))
     {
       if ((buf & _B_CODE) == _B_SINT)
        (*val) = (buf & _B_VALUE);
 
       else if ((buf & _B_NUMBER) == 1)
     {
       if ((buf & _B_CODE) == _B_SINT)
        (*val) = (buf & _B_VALUE);
 
       else if ((buf & _B_NUMBER) == 1)
-       len = (*stream->read)(stream->physical, val, 1);
+       len = (*stream->read) (stream->physical, val, 1);
 
       else
 
       else
-       objc_error(nil, OBJC_ERR_BAD_DATA,
-                  "expected 8bit unsigned int, got %dbit int",
-                  (int)(buf&_B_NUMBER)*8);
+       objc_error (nil, OBJC_ERR_BAD_DATA,
+                   "expected 8bit unsigned int, got %dbit int",
+                   (int) (buf&_B_NUMBER)*8);
     }
   return len;
 }
 
 __inline__ int
     }
   return len;
 }
 
 __inline__ int
-objc_read_short (struct objc_typed_stream* stream, short* value)
+objc_read_short (struct objc_typed_stream *stream, short *value)
 {
 {
-  unsigned char buf[sizeof(short)+1];
+  unsigned char buf[sizeof (short) + 1];
   int len;
   int len;
-  if ((len = (*stream->read)(stream->physical, buf, 1)))
+  if ((len = (*stream->read) (stream->physical, buf, 1)))
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
@@ -564,9 +564,9 @@ objc_read_short (struct objc_typed_stream* stream, short* value)
          int pos = 1;
          int nbytes = buf[0] & _B_NUMBER;
          if (nbytes > (int) sizeof (short))
          int pos = 1;
          int nbytes = buf[0] & _B_NUMBER;
          if (nbytes > (int) sizeof (short))
-           objc_error(nil, OBJC_ERR_BAD_DATA,
-                      "expected short, got bigger (%dbits)", nbytes*8);
-         len = (*stream->read)(stream->physical, buf+1, nbytes);
+           objc_error (nil, OBJC_ERR_BAD_DATA,
+                       "expected short, got bigger (%dbits)", nbytes*8);
+         len = (*stream->read) (stream->physical, buf + 1, nbytes);
          (*value) = 0;
          while (pos <= nbytes)
            (*value) = ((*value)*0x100) + buf[pos++];
          (*value) = 0;
          while (pos <= nbytes)
            (*value) = ((*value)*0x100) + buf[pos++];
@@ -578,12 +578,12 @@ objc_read_short (struct objc_typed_stream* stream, short* value)
 }
 
 __inline__ int
 }
 
 __inline__ int
-objc_read_unsigned_short (struct objc_typed_streamstream,
-                         unsigned shortvalue)
+objc_read_unsigned_short (struct objc_typed_stream *stream,
+                         unsigned short *value)
 {
 {
-  unsigned char buf[sizeof(unsigned short)+1];
+  unsigned char buf[sizeof (unsigned short) + 1];
   int len;
   int len;
-  if ((len = (*stream->read)(stream->physical, buf, 1)))
+  if ((len = (*stream->read) (stream->physical, buf, 1)))
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
@@ -593,9 +593,9 @@ objc_read_unsigned_short (struct objc_typed_stream* stream,
          int pos = 1;
          int nbytes = buf[0] & _B_NUMBER;
          if (nbytes > (int) sizeof (short))
          int pos = 1;
          int nbytes = buf[0] & _B_NUMBER;
          if (nbytes > (int) sizeof (short))
-           objc_error(nil, OBJC_ERR_BAD_DATA,
-                      "expected short, got int or bigger");
-         len = (*stream->read)(stream->physical, buf+1, nbytes);
+           objc_error (nil, OBJC_ERR_BAD_DATA,
+                       "expected short, got int or bigger");
+         len = (*stream->read) (stream->physical, buf + 1, nbytes);
          (*value) = 0;
          while (pos <= nbytes)
            (*value) = ((*value)*0x100) + buf[pos++];
          (*value) = 0;
          while (pos <= nbytes)
            (*value) = ((*value)*0x100) + buf[pos++];
@@ -606,11 +606,11 @@ objc_read_unsigned_short (struct objc_typed_stream* stream,
 
 
 __inline__ int
 
 
 __inline__ int
-objc_read_int (struct objc_typed_stream* stream, int* value)
+objc_read_int (struct objc_typed_stream *stream, int *value)
 {
 {
-  unsigned char buf[sizeof(int)+1];
+  unsigned char buf[sizeof (int) + 1];
   int len;
   int len;
-  if ((len = (*stream->read)(stream->physical, buf, 1)))
+  if ((len = (*stream->read) (stream->physical, buf, 1)))
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
@@ -620,8 +620,8 @@ objc_read_int (struct objc_typed_stream* stream, int* value)
          int pos = 1;
          int nbytes = buf[0] & _B_NUMBER;
          if (nbytes > (int) sizeof (int))
          int pos = 1;
          int nbytes = buf[0] & _B_NUMBER;
          if (nbytes > (int) sizeof (int))
-           objc_error(nil, OBJC_ERR_BAD_DATA, "expected int, got bigger");
-         len = (*stream->read)(stream->physical, buf+1, nbytes);
+           objc_error (nil, OBJC_ERR_BAD_DATA, "expected int, got bigger");
+         len = (*stream->read) (stream->physical, buf + 1, nbytes);
          (*value) = 0;
          while (pos <= nbytes)
            (*value) = ((*value)*0x100) + buf[pos++];
          (*value) = 0;
          while (pos <= nbytes)
            (*value) = ((*value)*0x100) + buf[pos++];
@@ -633,11 +633,11 @@ objc_read_int (struct objc_typed_stream* stream, int* value)
 }
 
 __inline__ int
 }
 
 __inline__ int
-objc_read_long (struct objc_typed_stream* stream, long* value)
+objc_read_long (struct objc_typed_stream *stream, long *value)
 {
 {
-  unsigned char buf[sizeof(long)+1];
+  unsigned char buf[sizeof (long) + 1];
   int len;
   int len;
-  if ((len = (*stream->read)(stream->physical, buf, 1)))
+  if ((len = (*stream->read) (stream->physical, buf, 1)))
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
@@ -647,8 +647,8 @@ objc_read_long (struct objc_typed_stream* stream, long* value)
          int pos = 1;
          int nbytes = buf[0] & _B_NUMBER;
          if (nbytes > (int) sizeof (long))
          int pos = 1;
          int nbytes = buf[0] & _B_NUMBER;
          if (nbytes > (int) sizeof (long))
-           objc_error(nil, OBJC_ERR_BAD_DATA, "expected long, got bigger");
-         len = (*stream->read)(stream->physical, buf+1, nbytes);
+           objc_error (nil, OBJC_ERR_BAD_DATA, "expected long, got bigger");
+         len = (*stream->read) (stream->physical, buf + 1, nbytes);
          (*value) = 0;
          while (pos <= nbytes)
            (*value) = ((*value)*0x100) + buf[pos++];
          (*value) = 0;
          while (pos <= nbytes)
            (*value) = ((*value)*0x100) + buf[pos++];
@@ -660,17 +660,17 @@ objc_read_long (struct objc_typed_stream* stream, long* value)
 }
 
 __inline__ int
 }
 
 __inline__ int
-__objc_read_nbyte_uint (struct objc_typed_streamstream,
-                      unsigned int nbytes, unsigned int* val)
+__objc_read_nbyte_uint (struct objc_typed_stream *stream,
+                       unsigned int nbytes, unsigned int *val)
 {
   int len;
   unsigned int pos = 0;
 {
   int len;
   unsigned int pos = 0;
-  unsigned char buf[sizeof(unsigned int)+1];
+  unsigned char buf[sizeof (unsigned int) + 1];
 
   if (nbytes > sizeof (int))
 
   if (nbytes > sizeof (int))
-    objc_error(nil, OBJC_ERR_BAD_DATA, "expected int, got bigger");
+    objc_error (nil, OBJC_ERR_BAD_DATA, "expected int, got bigger");
 
 
-  len = (*stream->read)(stream->physical, buf, nbytes);
+  len = (*stream->read) (stream->physical, buf, nbytes);
   (*val) = 0;
   while (pos < nbytes)
     (*val) = ((*val)*0x100) + buf[pos++];
   (*val) = 0;
   while (pos < nbytes)
     (*val) = ((*val)*0x100) + buf[pos++];
@@ -679,12 +679,12 @@ __objc_read_nbyte_uint (struct objc_typed_stream* stream,
   
 
 __inline__ int
   
 
 __inline__ int
-objc_read_unsigned_int (struct objc_typed_streamstream,
-                       unsigned intvalue)
+objc_read_unsigned_int (struct objc_typed_stream *stream,
+                       unsigned int *value)
 {
 {
-  unsigned char buf[sizeof(unsigned int)+1];
+  unsigned char buf[sizeof (unsigned int) + 1];
   int len;
   int len;
-  if ((len = (*stream->read)(stream->physical, buf, 1)))
+  if ((len = (*stream->read) (stream->physical, buf, 1)))
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
@@ -697,17 +697,17 @@ objc_read_unsigned_int (struct objc_typed_stream* stream,
 }
 
 int
 }
 
 int
-__objc_read_nbyte_ulong (struct objc_typed_streamstream,
-                      unsigned int nbytes, unsigned longval)
+__objc_read_nbyte_ulong (struct objc_typed_stream *stream,
+                      unsigned int nbytes, unsigned long *val)
 {
   int len;
   unsigned int pos = 0;
 {
   int len;
   unsigned int pos = 0;
-  unsigned char buf[sizeof(unsigned long)+1];
+  unsigned char buf[sizeof (unsigned long) + 1];
 
   if (nbytes > sizeof (long))
 
   if (nbytes > sizeof (long))
-    objc_error(nil, OBJC_ERR_BAD_DATA, "expected long, got bigger");
+    objc_error (nil, OBJC_ERR_BAD_DATA, "expected long, got bigger");
 
 
-  len = (*stream->read)(stream->physical, buf, nbytes);
+  len = (*stream->read) (stream->physical, buf, nbytes);
   (*val) = 0;
   while (pos < nbytes)
     (*val) = ((*val)*0x100) + buf[pos++];
   (*val) = 0;
   while (pos < nbytes)
     (*val) = ((*val)*0x100) + buf[pos++];
@@ -716,12 +716,12 @@ __objc_read_nbyte_ulong (struct objc_typed_stream* stream,
   
 
 __inline__ int
   
 
 __inline__ int
-objc_read_unsigned_long (struct objc_typed_streamstream,
-                       unsigned long* value)
+objc_read_unsigned_long (struct objc_typed_stream *stream,
+                        unsigned long *value)
 {
 {
-  unsigned char buf[sizeof(unsigned long)+1];
+  unsigned char buf[sizeof (unsigned long) + 1];
   int len;
   int len;
-  if ((len = (*stream->read)(stream->physical, buf, 1)))
+  if ((len = (*stream->read) (stream->physical, buf, 1)))
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
     {
       if ((buf[0] & _B_CODE) == _B_SINT)
        (*value) = (buf[0] & _B_VALUE);
@@ -734,29 +734,29 @@ objc_read_unsigned_long (struct objc_typed_stream* stream,
 }
 
 __inline__ int
 }
 
 __inline__ int
-objc_read_string (struct objc_typed_streamstream,
-                 char** string)
+objc_read_string (struct objc_typed_stream *stream,
+                 char **string)
 {
 {
-  unsigned char buf[sizeof(unsigned int)+1];
+  unsigned char buf[sizeof (unsigned int) + 1];
   int len;
   int len;
-  if ((len = (*stream->read)(stream->physical, buf, 1)))
+  if ((len = (*stream->read) (stream->physical, buf, 1)))
     {
       unsigned long key = 0;
 
       if ((buf[0]&_B_CODE) == _B_RCOMM)        /* register following */
        {
     {
       unsigned long key = 0;
 
       if ((buf[0]&_B_CODE) == _B_RCOMM)        /* register following */
        {
-         len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
-         len = (*stream->read)(stream->physical, buf, 1);
+         len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+         len = (*stream->read) (stream->physical, buf, 1);
        }
 
       switch (buf[0]&_B_CODE) {
       case _B_SSTR:
        {
          int length = buf[0]&_B_VALUE;
        }
 
       switch (buf[0]&_B_CODE) {
       case _B_SSTR:
        {
          int length = buf[0]&_B_VALUE;
-         (*string) = (char*)objc_malloc(length+1);
+         (*string) = (char*)objc_malloc (length + 1);
          if (key)
            hash_add (&stream->stream_table, LONG2PTR(key), *string);
          if (key)
            hash_add (&stream->stream_table, LONG2PTR(key), *string);
-         len = (*stream->read)(stream->physical, *string, length);
+         len = (*stream->read) (stream->physical, *string, length);
          (*string)[length] = '\0';
        }
        break;
          (*string)[length] = '\0';
        }
        break;
@@ -764,9 +764,9 @@ objc_read_string (struct objc_typed_stream* stream,
       case _B_UCOMM:
        {
          char *tmp;
       case _B_UCOMM:
        {
          char *tmp;
-         len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
+         len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
          tmp = hash_value_for_key (stream->stream_table, LONG2PTR (key));
          tmp = hash_value_for_key (stream->stream_table, LONG2PTR (key));
-         *string = objc_malloc (strlen(tmp) + 1);
+         *string = objc_malloc (strlen (tmp) + 1);
          strcpy (*string, tmp);
        }
        break;
          strcpy (*string, tmp);
        }
        break;
@@ -774,20 +774,20 @@ objc_read_string (struct objc_typed_stream* stream,
       case _B_NSTR:
        {
          unsigned int nbytes = buf[0]&_B_VALUE;
       case _B_NSTR:
        {
          unsigned int nbytes = buf[0]&_B_VALUE;
-         len = __objc_read_nbyte_uint(stream, nbytes, &nbytes);
+         len = __objc_read_nbyte_uint (stream, nbytes, &nbytes);
          if (len) {
          if (len) {
-           (*string) = (char*)objc_malloc(nbytes+1);
+           (*string) = (char*)objc_malloc (nbytes + 1);
            if (key)
              hash_add (&stream->stream_table, LONG2PTR(key), *string);
            if (key)
              hash_add (&stream->stream_table, LONG2PTR(key), *string);
-           len = (*stream->read)(stream->physical, *string, nbytes);
+           len = (*stream->read) (stream->physical, *string, nbytes);
            (*string)[nbytes] = '\0';
          }
        }
        break;
        
       default:
            (*string)[nbytes] = '\0';
          }
        }
        break;
        
       default:
-       objc_error(nil, OBJC_ERR_BAD_DATA,
-                  "expected string, got opcode %c\n", (buf[0]&_B_CODE));
+       objc_error (nil, OBJC_ERR_BAD_DATA,
+                   "expected string, got opcode %c\n", (buf[0]&_B_CODE));
       }
     }
 
       }
     }
 
@@ -796,19 +796,19 @@ objc_read_string (struct objc_typed_stream* stream,
 
 
 int
 
 
 int
-objc_read_object (struct objc_typed_stream* stream, id* object)
+objc_read_object (struct objc_typed_stream *stream, id *object)
 {
   unsigned char buf[sizeof (unsigned int)];
   int len;
 {
   unsigned char buf[sizeof (unsigned int)];
   int len;
-  if ((len = (*stream->read)(stream->physical, buf, 1)))
+  if ((len = (*stream->read) (stream->physical, buf, 1)))
     {
       SEL read_sel = sel_get_any_uid ("read:");
       unsigned long key = 0;
 
       if ((buf[0]&_B_CODE) == _B_RCOMM)        /* register common */
        {
     {
       SEL read_sel = sel_get_any_uid ("read:");
       unsigned long key = 0;
 
       if ((buf[0]&_B_CODE) == _B_RCOMM)        /* register common */
        {
-         len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
-         len = (*stream->read)(stream->physical, buf, 1);
+         len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+         len = (*stream->read) (stream->physical, buf, 1);
        }
 
       if (buf[0] == (_B_EXT | _BX_OBJECT))
        }
 
       if (buf[0] == (_B_EXT | _BX_OBJECT))
@@ -819,7 +819,7 @@ objc_read_object (struct objc_typed_stream* stream, id* object)
          len = objc_read_class (stream, &class);
 
          /* create instance */
          len = objc_read_class (stream, &class);
 
          /* create instance */
-         (*object) = class_create_instance(class);
+         (*object) = class_create_instance (class);
 
          /* register? */
          if (key)
 
          /* register? */
          if (key)
@@ -827,148 +827,148 @@ objc_read_object (struct objc_typed_stream* stream, id* object)
 
          /* send -read: */
          if (__objc_responds_to (*object, read_sel))
 
          /* send -read: */
          if (__objc_responds_to (*object, read_sel))
-           (*get_imp(class, read_sel))(*object, read_sel, stream);
+           (*get_imp (class, read_sel)) (*object, read_sel, stream);
 
          /* check null-byte */
 
          /* check null-byte */
-         len = (*stream->read)(stream->physical, buf, 1);
+         len = (*stream->read) (stream->physical, buf, 1);
          if (buf[0] != '\0')
          if (buf[0] != '\0')
-           objc_error(nil, OBJC_ERR_BAD_DATA,
-                      "expected null-byte, got opcode %c", buf[0]);
+           objc_error (nil, OBJC_ERR_BAD_DATA,
+                       "expected null-byte, got opcode %c", buf[0]);
        }
 
       else if ((buf[0]&_B_CODE) == _B_UCOMM)
        {
          if (key)
        }
 
       else if ((buf[0]&_B_CODE) == _B_UCOMM)
        {
          if (key)
-           objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
-         len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
+           objc_error (nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
+         len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
          (*object) = hash_value_for_key (stream->object_table, LONG2PTR(key));
        }
 
       else if (buf[0] == (_B_EXT | _BX_OBJREF))        /* a forward reference */
        {
          (*object) = hash_value_for_key (stream->object_table, LONG2PTR(key));
        }
 
       else if (buf[0] == (_B_EXT | _BX_OBJREF))        /* a forward reference */
        {
-         struct objc_listother;
+         struct objc_list *other;
          len = objc_read_unsigned_long (stream, &key);
          len = objc_read_unsigned_long (stream, &key);
-         other = (struct objc_list*)hash_value_for_key (stream->object_refs, 
-                                                        LONG2PTR(key));
+         other = (struct objc_list *) hash_value_for_key (stream->object_refs, 
+                                                          LONG2PTR(key));
          hash_add (&stream->object_refs, LONG2PTR(key), 
          hash_add (&stream->object_refs, LONG2PTR(key), 
-                   (void*)list_cons(object, other));
+                   (void *)list_cons (object, other));
        }
 
       else if (buf[0] == (_B_EXT | _BX_OBJROOT)) /* a root object */
        {
          if (key)
        }
 
       else if (buf[0] == (_B_EXT | _BX_OBJROOT)) /* a root object */
        {
          if (key)
-           objc_error(nil, OBJC_ERR_BAD_KEY,
-                      "cannot register root object...");
+           objc_error (nil, OBJC_ERR_BAD_KEY,
+                       "cannot register root object...");
          len = objc_read_object (stream, object);
          __objc_finish_read_root_object (stream);
        }
 
       else
          len = objc_read_object (stream, object);
          __objc_finish_read_root_object (stream);
        }
 
       else
-       objc_error(nil, OBJC_ERR_BAD_DATA,
-                  "expected object, got opcode %c", buf[0]);
+       objc_error (nil, OBJC_ERR_BAD_DATA,
+                   "expected object, got opcode %c", buf[0]);
     }
   return len;
 }
 
 static int
     }
   return len;
 }
 
 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)];
   int len;
 {
   unsigned char buf[sizeof (unsigned int)];
   int len;
-  if ((len = (*stream->read)(stream->physical, buf, 1)))
+  if ((len = (*stream->read) (stream->physical, buf, 1)))
     {
       unsigned long key = 0;
 
       if ((buf[0]&_B_CODE) == _B_RCOMM)        /* register following */
        {
     {
       unsigned long key = 0;
 
       if ((buf[0]&_B_CODE) == _B_RCOMM)        /* register following */
        {
-         len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
-         len = (*stream->read)(stream->physical, buf, 1);
+         len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+         len = (*stream->read) (stream->physical, buf, 1);
        }
 
       if (buf[0] == (_B_EXT | _BX_CLASS))
        {
        }
 
       if (buf[0] == (_B_EXT | _BX_CLASS))
        {
-         charclass_name;
+         char *class_name;
          unsigned long version;
 
          /* get class */
          len = objc_read_string (stream, &class_name);
          unsigned long version;
 
          /* get class */
          len = objc_read_string (stream, &class_name);
-         (*class) = objc_get_class(class_name);
-         objc_free(class_name);
+         (*class) = objc_get_class (class_name);
+         objc_free (class_name);
 
          /* register */
          if (key)
            hash_add (&stream->stream_table, LONG2PTR(key), *class);
 
 
          /* register */
          if (key)
            hash_add (&stream->stream_table, LONG2PTR(key), *class);
 
-         objc_read_unsigned_long(stream, &version);
-         hash_add (&stream->class_table, (*class)->name, (void*)version);
+         objc_read_unsigned_long (stream, &version);
+         hash_add (&stream->class_table, (*class)->name, (void *)version);
        }
 
       else if ((buf[0]&_B_CODE) == _B_UCOMM)
        {
          if (key)
        }
 
       else if ((buf[0]&_B_CODE) == _B_UCOMM)
        {
          if (key)
-           objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
-         len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
-         (*class) = hash_value_for_key (stream->stream_table, LONG2PTR(key));
-         if (!*class)
-           objc_error(nil, OBJC_ERR_BAD_CLASS,
-                      "cannot find class for key %lu", key);
+           objc_error (nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
+         len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+         *class = hash_value_for_key (stream->stream_table, LONG2PTR(key));
+         if (! *class)
+           objc_error (nil, OBJC_ERR_BAD_CLASS,
+                       "cannot find class for key %lu", key);
        }
 
       else
        }
 
       else
-       objc_error(nil, OBJC_ERR_BAD_DATA,
-                  "expected class, got opcode %c", buf[0]);
+       objc_error (nil, OBJC_ERR_BAD_DATA,
+                   "expected class, got opcode %c", buf[0]);
     }
   return len;
 }
 
 int
     }
   return len;
 }
 
 int
-objc_read_selector (struct objc_typed_streamstream, SEL* selector)
+objc_read_selector (struct objc_typed_stream *stream, SEL* selector)
 {
   unsigned char buf[sizeof (unsigned int)];
   int len;
 {
   unsigned char buf[sizeof (unsigned int)];
   int len;
-  if ((len = (*stream->read)(stream->physical, buf, 1)))
+  if ((len = (*stream->read) (stream->physical, buf, 1)))
     {
       unsigned long key = 0;
 
       if ((buf[0]&_B_CODE) == _B_RCOMM)        /* register following */
        {
     {
       unsigned long key = 0;
 
       if ((buf[0]&_B_CODE) == _B_RCOMM)        /* register following */
        {
-         len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
-         len = (*stream->read)(stream->physical, buf, 1);
+         len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+         len = (*stream->read) (stream->physical, buf, 1);
        }
 
       if (buf[0] == (_B_EXT|_BX_SEL)) /* selector! */
        {
        }
 
       if (buf[0] == (_B_EXT|_BX_SEL)) /* selector! */
        {
-         charselector_name;
+         char *selector_name;
 
          /* get selector */
          len = objc_read_string (stream, &selector_name);
          /* To handle NULL selectors */
 
          /* get selector */
          len = objc_read_string (stream, &selector_name);
          /* To handle NULL selectors */
-         if (0 == strlen(selector_name))
+         if (0 == strlen (selector_name))
            {
              (*selector) = (SEL)0;
              return 0;
            }
          else 
            {
              (*selector) = (SEL)0;
              return 0;
            }
          else 
-           (*selector) = sel_get_any_uid(selector_name);
-         objc_free(selector_name);
+           (*selector) = sel_get_any_uid (selector_name);
+         objc_free (selector_name);
 
          /* register */
          if (key)
 
          /* register */
          if (key)
-           hash_add (&stream->stream_table, LONG2PTR(key), (void*)*selector);
+           hash_add (&stream->stream_table, LONG2PTR(key), (void *) *selector);
        }
 
       else if ((buf[0]&_B_CODE) == _B_UCOMM)
        {
          if (key)
        }
 
       else if ((buf[0]&_B_CODE) == _B_UCOMM)
        {
          if (key)
-           objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
-         len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
+           objc_error (nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
+         len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
          (*selector) = hash_value_for_key (stream->stream_table, 
                                            LONG2PTR(key));
        }
 
       else
          (*selector) = hash_value_for_key (stream->stream_table, 
                                            LONG2PTR(key));
        }
 
       else
-       objc_error(nil, OBJC_ERR_BAD_DATA,
-                  "expected selector, got opcode %c", buf[0]);
+       objc_error (nil, OBJC_ERR_BAD_DATA,
+                   "expected selector, got opcode %c", buf[0]);
     }
   return len;
 }
     }
   return len;
 }
@@ -983,66 +983,67 @@ objc_read_selector (struct objc_typed_stream* stream, SEL* selector)
 */
 
 int
 */
 
 int
-objc_write_type(TypedStream* stream, const char* type, const void* data)
+objc_write_type (TypedStream *stream, const char *type, const void *data)
 {
 {
-  switch(*type) {
+  switch (*type) {
   case _C_ID:
   case _C_ID:
-    return objc_write_object (stream, *(id*)data);
+    return objc_write_object (stream, *(id *) data);
     break;
 
   case _C_CLASS:
     break;
 
   case _C_CLASS:
-    return objc_write_class (stream, *(Class*)data);
+    return objc_write_class (stream, *(Class *) data);
     break;
 
   case _C_SEL:
     break;
 
   case _C_SEL:
-    return objc_write_selector (stream, *(SEL*)data);
+    return objc_write_selector (stream, *(SEL *) data);
     break;
 
   case _C_CHR:
     break;
 
   case _C_CHR:
-    return objc_write_char(stream, *(signed char*)data);
+    return objc_write_char (stream, *(signed char *) data);
     break;
     
   case _C_UCHR:
     break;
     
   case _C_UCHR:
-    return objc_write_unsigned_char(stream, *(unsigned char*)data);
+    return objc_write_unsigned_char (stream, *(unsigned char *) data);
     break;
 
   case _C_SHT:
     break;
 
   case _C_SHT:
-    return objc_write_short(stream, *(short*)data);
+    return objc_write_short (stream, *(short *) data);
     break;
 
   case _C_USHT:
     break;
 
   case _C_USHT:
-    return objc_write_unsigned_short(stream, *(unsigned short*)data);
+    return objc_write_unsigned_short (stream, *(unsigned short *) data);
     break;
 
   case _C_INT:
     break;
 
   case _C_INT:
-    return objc_write_int(stream, *(int*)data);
+    return objc_write_int (stream, *(int *) data);
     break;
 
   case _C_UINT:
     break;
 
   case _C_UINT:
-    return objc_write_unsigned_int(stream, *(unsigned int*)data);
+    return objc_write_unsigned_int (stream, *(unsigned int *) data);
     break;
 
   case _C_LNG:
     break;
 
   case _C_LNG:
-    return objc_write_long(stream, *(long*)data);
+    return objc_write_long (stream, *(long *) data);
     break;
 
   case _C_ULNG:
     break;
 
   case _C_ULNG:
-    return objc_write_unsigned_long(stream, *(unsigned long*)data);
+    return objc_write_unsigned_long (stream, *(unsigned long *) data);
     break;
 
   case _C_CHARPTR:
     break;
 
   case _C_CHARPTR:
-    return objc_write_string (stream, *(char**)data, strlen(*(char**)data));
+    return objc_write_string (stream,
+                             *(char **) data, strlen (*(char **) data));
     break;
 
   case _C_ATOM:
     break;
 
   case _C_ATOM:
-    return objc_write_string_atomic (stream, *(char**)data, 
-                                    strlen(*(char**)data));
+    return objc_write_string_atomic (stream, *(char **) data, 
+                                    strlen (*(char **) data));
     break;
 
   case _C_ARY_B:
     {
     break;
 
   case _C_ARY_B:
     {
-      int len = atoi(type+1);
-      while (isdigit((unsigned char)*++type))
+      int len = atoi (type + 1);
+      while (isdigit ((unsigned char) *++type))
        ;
       return objc_write_array (stream, type, len, data);
     }
        ;
       return objc_write_array (stream, type, len, data);
     }
@@ -1058,7 +1059,7 @@ objc_write_type(TypedStream* stream, const char* type, const void* data)
        {
          align = objc_alignof_type (type);       /* padd to alignment */
          acc_size += ROUND (acc_size, align);
        {
          align = objc_alignof_type (type);       /* padd to alignment */
          acc_size += ROUND (acc_size, align);
-         objc_write_type (stream, type, ((char*)data)+acc_size);
+         objc_write_type (stream, type, ((char *) data) + acc_size);
          acc_size += objc_sizeof_type (type);   /* add component size */
          type = objc_skip_typespec (type);      /* skip component */
        }
          acc_size += objc_sizeof_type (type);   /* add component size */
          type = objc_skip_typespec (type);      /* skip component */
        }
@@ -1067,8 +1068,8 @@ objc_write_type(TypedStream* stream, const char* type, const void* data)
 
   default:
     {
 
   default:
     {
-      objc_error(nil, OBJC_ERR_BAD_TYPE,
-                "objc_write_type: cannot parse typespec: %s\n", type);
+      objc_error (nil, OBJC_ERR_BAD_TYPE,
+                 "objc_write_type: cannot parse typespec: %s\n", type);
       return 0;
     }
   }
       return 0;
     }
   }
@@ -1082,10 +1083,10 @@ objc_write_type(TypedStream* stream, const char* type, const void* data)
 */
 
 int
 */
 
 int
-objc_read_type(TypedStream* stream, const char* type, void* data)
+objc_read_type(TypedStream *stream, const char *type, void *data)
 {
   char c;
 {
   char c;
-  switch(c = *type) {
+  switch (c = *type) {
   case _C_ID:
     return objc_read_object (stream, (id*)data);
     break;
   case _C_ID:
     return objc_read_object (stream, (id*)data);
     break;
@@ -1137,8 +1138,8 @@ objc_read_type(TypedStream* stream, const char* type, void* data)
 
   case _C_ARY_B:
     {
 
   case _C_ARY_B:
     {
-      int len = atoi(type+1);
-      while (isdigit((unsigned char)*++type))
+      int len = atoi (type + 1);
+      while (isdigit ((unsigned char) *++type))
        ;
       return objc_read_array (stream, type, len, data);
     }
        ;
       return objc_read_array (stream, type, len, data);
     }
@@ -1163,8 +1164,8 @@ objc_read_type(TypedStream* stream, const char* type, void* data)
 
   default:
     {
 
   default:
     {
-      objc_error(nil, OBJC_ERR_BAD_TYPE,
-                "objc_read_type: cannot parse typespec: %s\n", type);
+      objc_error (nil, OBJC_ERR_BAD_TYPE,
+                 "objc_read_type: cannot parse typespec: %s\n", type);
       return 0;
     }
   }
       return 0;
     }
   }
@@ -1181,7 +1182,7 @@ objc_read_type(TypedStream* stream, const char* type, void* data)
 */
 
 int 
 */
 
 int 
-objc_write_types (TypedStream* stream, const char* type, ...)
+objc_write_types (TypedStream *stream, const char *type, ...)
 {
   va_list args;
   const char *c;
 {
   va_list args;
   const char *c;
@@ -1191,17 +1192,17 @@ objc_write_types (TypedStream* stream, const char* type, ...)
 
   for (c = type; *c; c = objc_skip_typespec (c))
     {
 
   for (c = type; *c; c = objc_skip_typespec (c))
     {
-      switch(*c) {
+      switch (*c) {
       case _C_ID:
        res = objc_write_object (stream, *va_arg (args, id*));
        break;
 
       case _C_CLASS:
       case _C_ID:
        res = objc_write_object (stream, *va_arg (args, id*));
        break;
 
       case _C_CLASS:
-       res = objc_write_class (stream, *va_arg(args, Class*));
+       res = objc_write_class (stream, *va_arg (args, Class*));
        break;
 
       case _C_SEL:
        break;
 
       case _C_SEL:
-       res = objc_write_selector (stream, *va_arg(args, SEL*));
+       res = objc_write_selector (stream, *va_arg (args, SEL*));
        break;
        
       case _C_CHR:
        break;
        
       case _C_CHR:
@@ -1214,60 +1215,60 @@ objc_write_types (TypedStream* stream, const char* type, ...)
        break;
        
       case _C_SHT:
        break;
        
       case _C_SHT:
-       res = objc_write_short (stream, *va_arg(args, short*));
+       res = objc_write_short (stream, *va_arg (args, short*));
        break;
 
       case _C_USHT:
        res = objc_write_unsigned_short (stream,
        break;
 
       case _C_USHT:
        res = objc_write_unsigned_short (stream,
-                                        *va_arg(args, unsigned short*));
+                                        *va_arg (args, unsigned short*));
        break;
 
       case _C_INT:
        break;
 
       case _C_INT:
-       res = objc_write_int(stream, *va_arg(args, int*));
+       res = objc_write_int(stream, *va_arg (args, int*));
        break;
        
       case _C_UINT:
        break;
        
       case _C_UINT:
-       res = objc_write_unsigned_int(stream, *va_arg(args, unsigned int*));
+       res = objc_write_unsigned_int(stream, *va_arg (args, unsigned int*));
        break;
 
       case _C_LNG:
        break;
 
       case _C_LNG:
-       res = objc_write_long(stream, *va_arg(args, long*));
+       res = objc_write_long(stream, *va_arg (args, long*));
        break;
        
       case _C_ULNG:
        break;
        
       case _C_ULNG:
-       res = objc_write_unsigned_long(stream, *va_arg(args, unsigned long*));
+       res = objc_write_unsigned_long(stream, *va_arg (args, unsigned long*));
        break;
 
       case _C_CHARPTR:
        {
        break;
 
       case _C_CHARPTR:
        {
-         char** str = va_arg(args, char**);
-         res = objc_write_string (stream, *str, strlen(*str));
+         char **str = va_arg (args, char **);
+         res = objc_write_string (stream, *str, strlen (*str));
        }
        break;
 
       case _C_ATOM:
        {
        }
        break;
 
       case _C_ATOM:
        {
-         char** str = va_arg(args, char**);
-         res = objc_write_string_atomic (stream, *str, strlen(*str));
+         char **str = va_arg (args, char **);
+         res = objc_write_string_atomic (stream, *str, strlen (*str));
        }
        break;
 
       case _C_ARY_B:
        {
        }
        break;
 
       case _C_ARY_B:
        {
-         int len = atoi(c+1);
-         const chart = c;
-         while (isdigit((unsigned char)*++t))
+         int len = atoi (c + 1);
+         const char *t = c;
+         while (isdigit ((unsigned char) *++t))
            ;
            ;
-         res = objc_write_array (stream, t, len, va_arg(args, void*));
+         res = objc_write_array (stream, t, len, va_arg (args, void *));
          t = objc_skip_typespec (t);
          if (*t != _C_ARY_E)
          t = objc_skip_typespec (t);
          if (*t != _C_ARY_E)
-           objc_error(nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t);
+           objc_error (nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t);
        }
        break; 
        
       default:
        }
        break; 
        
       default:
-       objc_error(nil, OBJC_ERR_BAD_TYPE, 
-                  "objc_write_types: cannot parse typespec: %s\n", type);
+       objc_error (nil, OBJC_ERR_BAD_TYPE, 
+                   "objc_write_types: cannot parse typespec: %s\n", type);
       }
     }
   va_end(args);
       }
     }
   va_end(args);
@@ -1281,88 +1282,88 @@ objc_write_types (TypedStream* stream, const char* type, ...)
 */
 
 int 
 */
 
 int 
-objc_read_types(TypedStream* stream, const char* type, ...)
+objc_read_types(TypedStream *stream, const char *type, ...)
 {
   va_list args;
   const char *c;
   int res = 0;
 
 {
   va_list args;
   const char *c;
   int res = 0;
 
-  va_start(args, type);
+  va_start (args, type);
 
   for (c = type; *c; c = objc_skip_typespec(c))
     {
 
   for (c = type; *c; c = objc_skip_typespec(c))
     {
-      switch(*c) {
+      switch (*c) {
       case _C_ID:
       case _C_ID:
-       res = objc_read_object(stream, va_arg(args, id*));
+       res = objc_read_object(stream, va_arg (args, id*));
        break;
 
       case _C_CLASS:
        break;
 
       case _C_CLASS:
-       res = objc_read_class(stream, va_arg(args, Class*));
+       res = objc_read_class(stream, va_arg (args, Class*));
        break;
 
       case _C_SEL:
        break;
 
       case _C_SEL:
-       res = objc_read_selector(stream, va_arg(args, SEL*));
+       res = objc_read_selector(stream, va_arg (args, SEL*));
        break;
        
       case _C_CHR:
        break;
        
       case _C_CHR:
-       res = objc_read_char(stream, va_arg(args, char*));
+       res = objc_read_char(stream, va_arg (args, char*));
        break;
        
       case _C_UCHR:
        break;
        
       case _C_UCHR:
-       res = objc_read_unsigned_char(stream, va_arg(args, unsigned char*));
+       res = objc_read_unsigned_char(stream, va_arg (args, unsigned char*));
        break;
        
       case _C_SHT:
        break;
        
       case _C_SHT:
-       res = objc_read_short(stream, va_arg(args, short*));
+       res = objc_read_short(stream, va_arg (args, short*));
        break;
 
       case _C_USHT:
        break;
 
       case _C_USHT:
-       res = objc_read_unsigned_short(stream, va_arg(args, unsigned short*));
+       res = objc_read_unsigned_short(stream, va_arg (args, unsigned short*));
        break;
 
       case _C_INT:
        break;
 
       case _C_INT:
-       res = objc_read_int(stream, va_arg(args, int*));
+       res = objc_read_int(stream, va_arg (args, int*));
        break;
        
       case _C_UINT:
        break;
        
       case _C_UINT:
-       res = objc_read_unsigned_int(stream, va_arg(args, unsigned int*));
+       res = objc_read_unsigned_int(stream, va_arg (args, unsigned int*));
        break;
 
       case _C_LNG:
        break;
 
       case _C_LNG:
-       res = objc_read_long(stream, va_arg(args, long*));
+       res = objc_read_long(stream, va_arg (args, long*));
        break;
        
       case _C_ULNG:
        break;
        
       case _C_ULNG:
-       res = objc_read_unsigned_long(stream, va_arg(args, unsigned long*));
+       res = objc_read_unsigned_long(stream, va_arg (args, unsigned long*));
        break;
 
       case _C_CHARPTR:
       case _C_ATOM:
        {
        break;
 
       case _C_CHARPTR:
       case _C_ATOM:
        {
-         char** str = va_arg(args, char**);
+         char **str = va_arg (args, char **);
          res = objc_read_string (stream, str);
        }
        break;
 
       case _C_ARY_B:
        {
          res = objc_read_string (stream, str);
        }
        break;
 
       case _C_ARY_B:
        {
-         int len = atoi(c+1);
-         const chart = c;
-         while (isdigit((unsigned char)*++t))
+         int len = atoi (c + 1);
+         const char *t = c;
+         while (isdigit ((unsigned char) *++t))
            ;
            ;
-         res = objc_read_array (stream, t, len, va_arg(args, void*));
+         res = objc_read_array (stream, t, len, va_arg (args, void *));
          t = objc_skip_typespec (t);
          if (*t != _C_ARY_E)
          t = objc_skip_typespec (t);
          if (*t != _C_ARY_E)
-           objc_error(nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t);
+           objc_error (nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t);
        }
        break; 
        
       default:
        }
        break; 
        
       default:
-       objc_error(nil, OBJC_ERR_BAD_TYPE, 
-                  "objc_read_types: cannot parse typespec: %s\n", type);
+       objc_error (nil, OBJC_ERR_BAD_TYPE, 
+                   "objc_read_types: cannot parse typespec: %s\n", type);
       }
     }
       }
     }
-  va_end(args);
+  va_end (args);
   return res;
 }
 
   return res;
 }
 
@@ -1372,11 +1373,11 @@ objc_read_types(TypedStream* stream, const char* type, ...)
 */
 
 int
 */
 
 int
-objc_write_array (TypedStream* stream, const char* type,
-                 int count, const voiddata)
+objc_write_array (TypedStream *stream, const char *type,
+                 int count, const void *data)
 {
   int off = objc_sizeof_type(type);
 {
   int off = objc_sizeof_type(type);
-  const charwhere = data;
+  const char *where = data;
 
   while (count-- > 0)
     {
 
   while (count-- > 0)
     {
@@ -1394,11 +1395,11 @@ objc_write_array (TypedStream* stream, const char* type,
 */
 
 int
 */
 
 int
-objc_read_array (TypedStream* stream, const char* type,
-                int count, voiddata)
+objc_read_array (TypedStream *stream, const char *type,
+                int count, void *data)
 {
   int off = objc_sizeof_type(type);
 {
   int off = objc_sizeof_type(type);
-  charwhere = (char*)data;
+  char *where = (char*)data;
 
   while (count-- > 0)
     {
 
   while (count-- > 0)
     {
@@ -1409,48 +1410,48 @@ objc_read_array (TypedStream* stream, const char* type,
 }
 
 static int 
 }
 
 static int 
-__objc_fread(FILE* file, char* data, int len)
+__objc_fread (FILE *file, char *data, int len)
 {
   return fread(data, len, 1, file);
 }
 
 static int 
 {
   return fread(data, len, 1, file);
 }
 
 static int 
-__objc_fwrite(FILE* file, char* data, int len)
+__objc_fwrite (FILE *file, char *data, int len)
 {
   return fwrite(data, len, 1, file);
 }
 
 static int
 {
   return fwrite(data, len, 1, file);
 }
 
 static int
-__objc_feof(FILE* file)
+__objc_feof (FILE *file)
 {
   return feof(file);
 }
 
 static int 
 {
   return feof(file);
 }
 
 static int 
-__objc_no_write(FILE* file __attribute__ ((__unused__)),
-               const char *data __attribute__ ((__unused__)),
-               int len __attribute__ ((__unused__)))
+__objc_no_write (FILE *file __attribute__ ((__unused__)),
+                const char *data __attribute__ ((__unused__)),
+                int len __attribute__ ((__unused__)))
 {
   objc_error (nil, OBJC_ERR_NO_WRITE, "TypedStream not open for writing");
   return 0;
 }
 
 static int 
 {
   objc_error (nil, OBJC_ERR_NO_WRITE, "TypedStream not open for writing");
   return 0;
 }
 
 static int 
-__objc_no_read(FILE* file __attribute__ ((__unused__)),
-              const char *data __attribute__ ((__unused__)),
-              int len __attribute__ ((__unused__)))
+__objc_no_read (FILE *file __attribute__ ((__unused__)),
+               const char *data __attribute__ ((__unused__)),
+               int len __attribute__ ((__unused__)))
 {
   objc_error (nil, OBJC_ERR_NO_READ, "TypedStream not open for reading");
   return 0;
 }
 
 static int
 {
   objc_error (nil, OBJC_ERR_NO_READ, "TypedStream not open for reading");
   return 0;
 }
 
 static int
-__objc_read_typed_stream_signature (TypedStreamstream)
+__objc_read_typed_stream_signature (TypedStream *stream)
 {
   char buffer[80];
   int pos = 0;
   do
 {
   char buffer[80];
   int pos = 0;
   do
-    (*stream->read)(stream->physical, buffer+pos, 1);
+    (*stream->read) (stream->physical, buffer+pos, 1);
   while (buffer[pos++] != '\0')
     ;
   sscanf (buffer, "GNU TypedStream %d", &stream->version);
   while (buffer[pos++] != '\0')
     ;
   sscanf (buffer, "GNU TypedStream %d", &stream->version);
@@ -1461,16 +1462,16 @@ __objc_read_typed_stream_signature (TypedStream* stream)
 }
 
 static int
 }
 
 static int
-__objc_write_typed_stream_signature (TypedStreamstream)
+__objc_write_typed_stream_signature (TypedStream *stream)
 {
   char buffer[80];
   sprintf(buffer, "GNU TypedStream %d", OBJC_TYPED_STREAM_VERSION);
   stream->version = OBJC_TYPED_STREAM_VERSION;
 {
   char buffer[80];
   sprintf(buffer, "GNU TypedStream %d", OBJC_TYPED_STREAM_VERSION);
   stream->version = OBJC_TYPED_STREAM_VERSION;
-  (*stream->write)(stream->physical, buffer, strlen(buffer)+1);
+  (*stream->write) (stream->physical, buffer, strlen (buffer) + 1);
   return 1;
 }
 
   return 1;
 }
 
-static void __objc_finish_write_root_object(struct objc_typed_streamstream)
+static void __objc_finish_write_root_object(struct objc_typed_stream *stream)
 {
   hash_delete (stream->object_table);
   stream->object_table = hash_new(64,
 {
   hash_delete (stream->object_table);
   stream->object_table = hash_new(64,
@@ -1478,7 +1479,7 @@ static void __objc_finish_write_root_object(struct objc_typed_stream* stream)
                                  (compare_func_type)compare_ptrs);
 }
 
                                  (compare_func_type)compare_ptrs);
 }
 
-static void __objc_finish_read_root_object(struct objc_typed_streamstream)
+static void __objc_finish_read_root_object(struct objc_typed_stream *stream)
 {
   node_ptr node;
   SEL awake_sel = sel_get_any_uid ("awake");
 {
   node_ptr node;
   SEL awake_sel = sel_get_any_uid ("awake");
@@ -1490,12 +1491,12 @@ static void __objc_finish_read_root_object(struct objc_typed_stream* stream)
   for (node = hash_next (stream->object_refs, NULL); node;
        node = hash_next (stream->object_refs, node))
     {
   for (node = hash_next (stream->object_refs, NULL); node;
        node = hash_next (stream->object_refs, node))
     {
-      struct objc_listreflist = node->value;
-      const voidkey = node->key;
+      struct objc_list *reflist = node->value;
+      const void *key = node->key;
       id object = hash_value_for_key (stream->object_table, key);
       id object = hash_value_for_key (stream->object_table, key);
-      while(reflist)
+      while (reflist)
        {
        {
-         *((id*)reflist->head) = object;
+         *((id*) reflist->head) = object;
          if (hash_value_for_key (free_list,reflist) == NULL)
            hash_add (&free_list,reflist,reflist);
 
          if (hash_value_for_key (free_list,reflist) == NULL)
            hash_add (&free_list,reflist,reflist);
 
@@ -1523,7 +1524,7 @@ static void __objc_finish_read_root_object(struct objc_typed_stream* stream)
        {
          id object = node->value;
          if (__objc_responds_to (object, awake_sel))
        {
          id object = node->value;
          if (__objc_responds_to (object, awake_sel))
-           (*objc_msg_lookup(object, awake_sel))(object, awake_sel);
+           (*objc_msg_lookup (object, awake_sel)) (object, awake_sel);
        }
     }
 
        }
     }
 
@@ -1538,38 +1539,38 @@ static void __objc_finish_read_root_object(struct objc_typed_stream* stream)
 ** Open the stream PHYSICAL in MODE
 */
 
 ** Open the stream PHYSICAL in MODE
 */
 
-TypedStream
-objc_open_typed_stream (FILEphysical, int mode)
+TypedStream *
+objc_open_typed_stream (FILE *physical, int mode)
 {
 {
-  TypedStream* s = (TypedStream*)objc_malloc(sizeof(TypedStream));
+  TypedStream *s = (TypedStream *) objc_malloc (sizeof (TypedStream));
 
   s->mode = mode;
   s->physical = physical;
 
   s->mode = mode;
   s->physical = physical;
-  s->stream_table = hash_new(64,
-                            (hash_func_type)hash_ptr,
-                            (compare_func_type)compare_ptrs);
-  s->object_table = hash_new(64,
-                            (hash_func_type)hash_ptr,
-                            (compare_func_type)compare_ptrs);
-  s->eof = (objc_typed_eof_func)__objc_feof;
-  s->flush = (objc_typed_flush_func)fflush;
+  s->stream_table = hash_new (64,
+                             (hash_func_type) hash_ptr,
+                             (compare_func_type) compare_ptrs);
+  s->object_table = hash_new (64,
+                             (hash_func_type) hash_ptr,
+                             (compare_func_type) compare_ptrs);
+  s->eof = (objc_typed_eof_func) __objc_feof;
+  s->flush = (objc_typed_flush_func) fflush;
   s->writing_root_p = 0;
   if (mode == OBJC_READONLY)
     {
   s->writing_root_p = 0;
   if (mode == OBJC_READONLY)
     {
-      s->class_table = hash_new(8, (hash_func_type)hash_string,
-                               (compare_func_type)compare_strings);
-      s->object_refs = hash_new(8, (hash_func_type)hash_ptr,
-                               (compare_func_type)compare_ptrs);
-      s->read = (objc_typed_read_func)__objc_fread;
-      s->write = (objc_typed_write_func)__objc_no_write;
+      s->class_table = hash_new (8, (hash_func_type) hash_string,
+                                (compare_func_type) compare_strings);
+      s->object_refs = hash_new (8, (hash_func_type) hash_ptr,
+                                (compare_func_type) compare_ptrs);
+      s->read = (objc_typed_read_func) __objc_fread;
+      s->write = (objc_typed_write_func) __objc_no_write;
       __objc_read_typed_stream_signature (s);
     }
   else if (mode == OBJC_WRITEONLY)
     {
       s->class_table = 0;
       s->object_refs = 0;
       __objc_read_typed_stream_signature (s);
     }
   else if (mode == OBJC_WRITEONLY)
     {
       s->class_table = 0;
       s->object_refs = 0;
-      s->read = (objc_typed_read_func)__objc_no_read;
-      s->write = (objc_typed_write_func)__objc_fwrite;
+      s->read = (objc_typed_read_func) __objc_no_read;
+      s->write = (objc_typed_write_func) __objc_fwrite;
       __objc_write_typed_stream_signature (s);
     }      
   else
       __objc_write_typed_stream_signature (s);
     }      
   else
@@ -1586,10 +1587,10 @@ objc_open_typed_stream (FILE* physical, int mode)
 */
 
 TypedStream*
 */
 
 TypedStream*
-objc_open_typed_stream_for_file (const charfile_name, int mode)
+objc_open_typed_stream_for_file (const char *file_name, int mode)
 {
 {
-  FILEfile = NULL;
-  TypedStreams;
+  FILE *file = NULL;
+  TypedStream *s;
 
   if (mode == OBJC_READONLY)
     file = fopen (file_name, "r");
 
   if (mode == OBJC_READONLY)
     file = fopen (file_name, "r");
@@ -1613,7 +1614,7 @@ objc_open_typed_stream_for_file (const char* file_name, int mode)
 */
 
 void
 */
 
 void
-objc_close_typed_stream (TypedStreamstream)
+objc_close_typed_stream (TypedStream *stream)
 {
   if (stream->mode == OBJC_READONLY)
     {
 {
   if (stream->mode == OBJC_READONLY)
     {
@@ -1626,25 +1627,25 @@ objc_close_typed_stream (TypedStream* stream)
   hash_delete (stream->object_table);
 
   if (stream->type == (OBJC_MANAGED_STREAM | OBJC_FILE_STREAM))
   hash_delete (stream->object_table);
 
   if (stream->type == (OBJC_MANAGED_STREAM | OBJC_FILE_STREAM))
-    fclose ((FILE*)stream->physical);
+    fclose ((FILE *)stream->physical);
 
   objc_free(stream);
 }
 
 BOOL
 
   objc_free(stream);
 }
 
 BOOL
-objc_end_of_typed_stream (TypedStreamstream)
+objc_end_of_typed_stream (TypedStream *stream)
 {
 {
-  return (*stream->eof)(stream->physical);
+  return (*stream->eof) (stream->physical);
 }
 
 void
 }
 
 void
-objc_flush_typed_stream (TypedStreamstream)
+objc_flush_typed_stream (TypedStream *stream)
 {
 {
-  (*stream->flush)(stream->physical);
+  (*stream->flush) (stream->physical);
 }
 
 long
 }
 
 long
-objc_get_stream_class_version (TypedStreamstream, Class class)
+objc_get_stream_class_version (TypedStream *stream, Class class)
 {
   if (stream->class_table)
     return PTR2LONG(hash_value_for_key (stream->class_table, class->name));
 {
   if (stream->class_table)
     return PTR2LONG(hash_value_for_key (stream->class_table, class->name));
index 89ef641..1740f38 100644 (file)
@@ -1,5 +1,6 @@
 /* GNU Objective C Runtime class related functions
 /* GNU Objective C Runtime class related functions
-   Copyright (C) 1993, 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 1996, 1997, 2001, 2002
+     Free Software Foundation, Inc.
    Contributed by Kresten Krab Thorup and Dennis Glatting.
 
    Lock-free class table code designed and written from scratch by
    Contributed by Kresten Krab Thorup and Dennis Glatting.
 
    Lock-free class table code designed and written from scratch by
@@ -166,7 +167,7 @@ static void
 class_table_setup (void)
 {
   /* Start - nothing in the table.  */
 class_table_setup (void)
 {
   /* Start - nothing in the table.  */
-  memset (class_table_array, 0, sizeof(class_node_ptr) * CLASS_TABLE_SIZE);
+  memset (class_table_array, 0, sizeof (class_node_ptr) * CLASS_TABLE_SIZE);
 
   /* The table writing mutex.  */
   __class_table_lock = objc_mutex_allocate ();
 
   /* The table writing mutex.  */
   __class_table_lock = objc_mutex_allocate ();
@@ -339,7 +340,7 @@ class_table_next (struct class_table_enumerator **e)
 #if 0 /* DEBUGGING FUNCTIONS */
 /* Debugging function - print the class table.  */
 void
 #if 0 /* DEBUGGING FUNCTIONS */
 /* Debugging function - print the class table.  */
 void
-class_table_print ()
+class_table_print (void)
 {
   int i;
   
 {
   int i;
   
@@ -362,7 +363,7 @@ class_table_print ()
    function of hash key values.  Useful to evaluate the hash function
    in real cases.  */
 void
    function of hash key values.  Useful to evaluate the hash function
    in real cases.  */
 void
-class_table_print_histogram ()
+class_table_print_histogram (void)
 {
   int i, j;
   int counter = 0;
 {
   int i, j;
   int counter = 0;
@@ -408,64 +409,66 @@ class_table_print_histogram ()
 /* 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.  
    This may e.g. try to load in the class using dynamic loading.  */
 /* 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.  
    This may e.g. try to load in the class using dynamic loading.  */
-Class (*_objc_lookup_class)(const char* name) = 0;      /* !T:SAFE */
+Class (*_objc_lookup_class) (const char *name) = 0;      /* !T:SAFE */
 
 
 /* True when class links has been resolved.  */     
 BOOL __objc_class_links_resolved = NO;                  /* !T:UNUSED */
 
 
 
 
 /* True when class links has been resolved.  */     
 BOOL __objc_class_links_resolved = NO;                  /* !T:UNUSED */
 
 
-void __objc_init_class_tables()
+void
+__objc_init_class_tables (void)
 {
   /* Allocate the class hash table.  */
   
 {
   /* Allocate the class hash table.  */
   
-  if(__class_table_lock)
+  if (__class_table_lock)
     return;
   
     return;
   
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
   
   class_table_setup ();
 
   
   class_table_setup ();
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 }  
 
 /* This function adds a class to the class hash table, and assigns the
    class a number, unless it's already known.  */
 void
 }  
 
 /* This function adds a class to the class hash table, and assigns the
    class a number, unless it's already known.  */
 void
-__objc_add_class_to_hash(Class class)
+__objc_add_class_to_hash (Class class)
 {
   Class h_class;
 
 {
   Class h_class;
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
   /* Make sure the table is there.  */
 
   /* Make sure the table is there.  */
-  assert(__class_table_lock);
+  assert (__class_table_lock);
 
   /* Make sure it's not a meta class.  */
 
   /* Make sure it's not a meta class.  */
-  assert(CLS_ISCLASS(class));
+  assert (CLS_ISCLASS (class));
 
   /* Check to see if the class is already in the hash table.  */
   h_class = class_table_get_safe (class->name);
 
   /* Check to see if the class is already in the hash table.  */
   h_class = class_table_get_safe (class->name);
-  if (!h_class)
+  if (! h_class)
     {
       /* The class isn't in the hash table.  Add the class and assign a class
          number.  */
       static unsigned int class_number = 1;
 
     {
       /* The class isn't in the hash table.  Add the class and assign a class
          number.  */
       static unsigned int class_number = 1;
 
-      CLS_SETNUMBER(class, class_number);
-      CLS_SETNUMBER(class->class_pointer, class_number);
+      CLS_SETNUMBER (class, class_number);
+      CLS_SETNUMBER (class->class_pointer, class_number);
 
       ++class_number;
       class_table_insert (class->name, class);
     }
 
 
       ++class_number;
       class_table_insert (class->name, class);
     }
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 }
 
 /* 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
    this fails, nil is returned.  */
 }
 
 /* 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
    this fails, nil is returned.  */
-Class objc_lookup_class (const char* name)
+Class
+objc_lookup_class (const char *name)
 {
   Class class;
 
 {
   Class class;
 
@@ -475,7 +478,7 @@ Class objc_lookup_class (const char* name)
     return class;
 
   if (_objc_lookup_class)
     return class;
 
   if (_objc_lookup_class)
-    return (*_objc_lookup_class)(name);
+    return (*_objc_lookup_class) (name);
   else
     return 0;
 }
   else
     return 0;
 }
@@ -494,20 +497,20 @@ objc_get_class (const char *name)
     return class;
 
   if (_objc_lookup_class)
     return class;
 
   if (_objc_lookup_class)
-    class = (*_objc_lookup_class)(name);
+    class = (*_objc_lookup_class) (name);
 
 
-  if(class)
+  if (class)
     return class;
   
     return class;
   
-  objc_error(nil, OBJC_ERR_BAD_CLASS, 
-             "objc runtime: cannot find class %s\n", name);
+  objc_error (nil, OBJC_ERR_BAD_CLASS, 
+              "objc runtime: cannot find class %s\n", name);
   return 0;
 }
 
 MetaClass
   return 0;
 }
 
 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;
 }
 
 /* This function provides a way to enumerate all the classes in the
 }
 
 /* This function provides a way to enumerate all the classes in the
@@ -516,22 +519,22 @@ objc_get_meta_class(const char *name)
    For example: 
        id class; 
        void *es = NULL;
    For example: 
        id class; 
        void *es = NULL;
-       while ((class = objc_next_class(&es)))
+       while ((class = objc_next_class (&es)))
          ... do something with class; 
 */
 Class
          ... do something with class; 
 */
 Class
-objc_next_class(void **enum_state)
+objc_next_class (void **enum_state)
 {
   Class class;
 
 {
   Class class;
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
   
   /* Make sure the table is there.  */
   
   /* Make sure the table is there.  */
-  assert(__class_table_lock);
+  assert (__class_table_lock);
 
 
-  class = class_table_next ((struct class_table_enumerator **)enum_state);
+  class = class_table_next ((struct class_table_enumerator **) enum_state);
 
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
   
   return class;
 }
   
   return class;
 }
@@ -539,33 +542,34 @@ objc_next_class(void **enum_state)
 /* Resolve super/subclass links for all classes.  The only thing we
    can be sure of is that the class_pointer for class objects point to
    the right meta class objects.  */
 /* Resolve super/subclass links for all classes.  The only thing we
    can be sure of is that the class_pointer for class objects point to
    the right meta class objects.  */
-void __objc_resolve_class_links()
+void
+__objc_resolve_class_links (void)
 {
   struct class_table_enumerator *es = NULL;
   Class object_class = objc_get_class ("Object");
   Class class1;
 
 {
   struct class_table_enumerator *es = NULL;
   Class object_class = objc_get_class ("Object");
   Class class1;
 
-  assert(object_class);
+  assert (object_class);
 
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
   /* Assign subclass links.  */
   while ((class1 = class_table_next (&es)))
     {
       /* Make sure we have what we think we have.  */
 
   /* Assign subclass links.  */
   while ((class1 = class_table_next (&es)))
     {
       /* Make sure we have what we think we have.  */
-      assert (CLS_ISCLASS(class1));
-      assert (CLS_ISMETA(class1->class_pointer));
+      assert (CLS_ISCLASS (class1));
+      assert (CLS_ISMETA (class1->class_pointer));
 
       /* The class_pointer of all meta classes point to Object's meta
          class.  */
       class1->class_pointer->class_pointer = object_class->class_pointer;
 
 
       /* The class_pointer of all meta classes point to Object's meta
          class.  */
       class1->class_pointer->class_pointer = object_class->class_pointer;
 
-      if (!(CLS_ISRESOLV(class1)))
+      if (! CLS_ISRESOLV (class1))
         {
         {
-          CLS_SETRESOLV(class1);
-          CLS_SETRESOLV(class1->class_pointer);
+          CLS_SETRESOLV (class1);
+          CLS_SETRESOLV (class1->class_pointer);
               
               
-          if(class1->super_class)
+          if (class1->super_class)
             {   
               Class a_super_class 
                 = objc_get_class ((char *) class1->super_class);
             {   
               Class a_super_class 
                 = objc_get_class ((char *) class1->super_class);
@@ -607,12 +611,12 @@ void __objc_resolve_class_links()
            sub_class = sub_class->sibling_class)
         {
           sub_class->super_class = class1;
            sub_class = sub_class->sibling_class)
         {
           sub_class->super_class = class1;
-          if(CLS_ISCLASS(sub_class))
+          if (CLS_ISCLASS (sub_class))
             sub_class->class_pointer->super_class = class1->class_pointer;
         }
     }
 
             sub_class->class_pointer->super_class = class1->class_pointer;
         }
     }
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 }
 
 
 }
 
 
@@ -622,7 +626,7 @@ void __objc_resolve_class_links()
 Class
 class_pose_as (Class impostor, Class super_class)
 {
 Class
 class_pose_as (Class impostor, Class super_class)
 {
-  if (!CLS_ISRESOLV (impostor))
+  if (! CLS_ISRESOLV (impostor))
     __objc_resolve_class_links ();
 
   /* Preconditions */
     __objc_resolve_class_links ();
 
   /* Preconditions */
@@ -685,11 +689,11 @@ class_pose_as (Class impostor, Class super_class)
      keys of the hashtable is, change all values that are superclass
      into impostor.  */
 
      keys of the hashtable is, change all values that are superclass
      into impostor.  */
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
   class_table_replace (super_class, impostor);
 
 
   class_table_replace (super_class, impostor);
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 
   /* Next, we update the dispatch tables...  */
   __objc_update_dispatch_table_for_class (CLASSOF (impostor));
 
   /* Next, we update the dispatch tables...  */
   __objc_update_dispatch_table_for_class (CLASSOF (impostor));
index 8fd6e5b..be4c08b 100644 (file)
@@ -34,18 +34,18 @@ Boston, MA 02111-1307, USA.  */
 
 #undef  MAX
 #define MAX(X, Y)                    \
 
 #undef  MAX
 #define MAX(X, Y)                    \
-  ({ typeof(X) __x = (X), __y = (Y); \
+  ({ typeof (X) __x = (X), __y = (Y); \
      (__x > __y ? __x : __y); })
 
 #undef  MIN
 #define MIN(X, Y)                    \
      (__x > __y ? __x : __y); })
 
 #undef  MIN
 #define MIN(X, Y)                    \
-  ({ typeof(X) __x = (X), __y = (Y); \
+  ({ typeof (X) __x = (X), __y = (Y); \
      (__x < __y ? __x : __y); })
 
 #undef  ROUND
 #define ROUND(V, A) \
      (__x < __y ? __x : __y); })
 
 #undef  ROUND
 #define ROUND(V, A) \
-  ({ typeof(V) __v=(V); typeof(A) __a=(A); \
-     __a*((__v+__a-1)/__a); })
+  ({ typeof (V) __v = (V); typeof (A) __a = (A); \
+     __a * ((__v+__a - 1)/__a); })
 
 
 /* Various hacks for objc_layout_record. These are used by the target
 
 
 /* Various hacks for objc_layout_record. These are used by the target
@@ -89,7 +89,7 @@ static int __attribute__ ((__unused__)) target_flags = 0;
 */
 
 int
 */
 
 int
-objc_sizeof_type (const chartype)
+objc_sizeof_type (const char *type)
 {
   /* Skip the variable name if any */
   if (*type == '"')
 {
   /* Skip the variable name if any */
   if (*type == '"')
@@ -98,81 +98,83 @@ objc_sizeof_type (const char* type)
        /* do nothing */;
     }
 
        /* do nothing */;
     }
 
-  switch(*type) {
+  switch (*type) {
   case _C_ID:
   case _C_ID:
-    return sizeof(id);
+    return sizeof (id);
     break;
 
   case _C_CLASS:
     break;
 
   case _C_CLASS:
-    return sizeof(Class);
+    return sizeof (Class);
     break;
 
   case _C_SEL:
     break;
 
   case _C_SEL:
-    return sizeof(SEL);
+    return sizeof (SEL);
     break;
 
   case _C_CHR:
     break;
 
   case _C_CHR:
-    return sizeof(char);
+    return sizeof (char);
     break;
 
   case _C_UCHR:
     break;
 
   case _C_UCHR:
-    return sizeof(unsigned char);
+    return sizeof (unsigned char);
     break;
 
   case _C_SHT:
     break;
 
   case _C_SHT:
-    return sizeof(short);
+    return sizeof (short);
     break;
 
   case _C_USHT:
     break;
 
   case _C_USHT:
-    return sizeof(unsigned short);
+    return sizeof (unsigned short);
     break;
 
   case _C_INT:
     break;
 
   case _C_INT:
-    return sizeof(int);
+    return sizeof (int);
     break;
 
   case _C_UINT:
     break;
 
   case _C_UINT:
-    return sizeof(unsigned int);
+    return sizeof (unsigned int);
     break;
 
   case _C_LNG:
     break;
 
   case _C_LNG:
-    return sizeof(long);
+    return sizeof (long);
     break;
 
   case _C_ULNG:
     break;
 
   case _C_ULNG:
-    return sizeof(unsigned long);
+    return sizeof (unsigned long);
     break;
 
   case _C_LNG_LNG:
     break;
 
   case _C_LNG_LNG:
-    return sizeof(long long);
+    return sizeof (long long);
     break;
 
   case _C_ULNG_LNG:
     break;
 
   case _C_ULNG_LNG:
-    return sizeof(unsigned long long);
+    return sizeof (unsigned long long);
     break;
 
   case _C_FLT:
     break;
 
   case _C_FLT:
-    return sizeof(float);
+    return sizeof (float);
     break;
 
   case _C_DBL:
     break;
 
   case _C_DBL:
-    return sizeof(double);
+    return sizeof (double);
     break;
 
   case _C_VOID:
     break;
 
   case _C_VOID:
-    return sizeof(void);
+    return sizeof (void);
     break;
     break;
+
   case _C_PTR:
   case _C_ATOM:
   case _C_CHARPTR:
   case _C_PTR:
   case _C_ATOM:
   case _C_CHARPTR:
-    return sizeof(char*);
+    return sizeof (char *);
     break;
 
   case _C_ARY_B:
     {
     break;
 
   case _C_ARY_B:
     {
-      int len = atoi(type+1);
-      while (isdigit((unsigned char)*++type));
-      return len*objc_aligned_size (type);
+      int len = atoi (type + 1);
+      while (isdigit ((unsigned char)*++type))
+       ;
+      return len * objc_aligned_size (type);
     }
     break;
 
     }
     break;
 
@@ -183,7 +185,8 @@ objc_sizeof_type (const char* type)
       int startByte, endByte;
 
       position = atoi (type + 1);
       int startByte, endByte;
 
       position = atoi (type + 1);
-      while (isdigit ((unsigned char)*++type));
+      while (isdigit ((unsigned char)*++type))
+       ;
       size = atoi (type + 1);
 
       startByte = position / BITS_PER_UNIT;
       size = atoi (type + 1);
 
       startByte = position / BITS_PER_UNIT;
@@ -207,7 +210,8 @@ objc_sizeof_type (const char* type)
   case _C_UNION_B:
     {
       int max_size = 0;
   case _C_UNION_B:
     {
       int max_size = 0;
-      while (*type != _C_UNION_E && *type++ != '=') /* do nothing */;
+      while (*type != _C_UNION_E && *type++ != '=')
+       /* do nothing */;
       while (*type != _C_UNION_E)
        {
          /* Skip the variable name if any */
       while (*type != _C_UNION_E)
        {
          /* Skip the variable name if any */
@@ -224,7 +228,7 @@ objc_sizeof_type (const char* type)
 
   default:
     {
 
   default:
     {
-      objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type);
+      objc_error (nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type);
       return 0;
     }
   }
       return 0;
     }
   }
@@ -236,7 +240,7 @@ objc_sizeof_type (const char* type)
 */
 
 int
 */
 
 int
-objc_alignof_type(const char* type)
+objc_alignof_type (const char *type)
 {
   /* Skip the variable name if any */
   if (*type == '"')
 {
   /* Skip the variable name if any */
   if (*type == '"')
@@ -244,75 +248,76 @@ objc_alignof_type(const char* type)
       for (type++; *type++ != '"';)
        /* do nothing */;
     }
       for (type++; *type++ != '"';)
        /* do nothing */;
     }
-  switch(*type) {
+  switch (*type) {
   case _C_ID:
   case _C_ID:
-    return __alignof__(id);
+    return __alignof__ (id);
     break;
 
   case _C_CLASS:
     break;
 
   case _C_CLASS:
-    return __alignof__(Class);
+    return __alignof__ (Class);
     break;
 
   case _C_SEL:
     break;
 
   case _C_SEL:
-    return __alignof__(SEL);
+    return __alignof__ (SEL);
     break;
 
   case _C_CHR:
     break;
 
   case _C_CHR:
-    return __alignof__(char);
+    return __alignof__ (char);
     break;
 
   case _C_UCHR:
     break;
 
   case _C_UCHR:
-    return __alignof__(unsigned char);
+    return __alignof__ (unsigned char);
     break;
 
   case _C_SHT:
     break;
 
   case _C_SHT:
-    return __alignof__(short);
+    return __alignof__ (short);
     break;
 
   case _C_USHT:
     break;
 
   case _C_USHT:
-    return __alignof__(unsigned short);
+    return __alignof__ (unsigned short);
     break;
 
   case _C_INT:
     break;
 
   case _C_INT:
-    return __alignof__(int);
+    return __alignof__ (int);
     break;
 
   case _C_UINT:
     break;
 
   case _C_UINT:
-    return __alignof__(unsigned int);
+    return __alignof__ (unsigned int);
     break;
 
   case _C_LNG:
     break;
 
   case _C_LNG:
-    return __alignof__(long);
+    return __alignof__ (long);
     break;
 
   case _C_ULNG:
     break;
 
   case _C_ULNG:
-    return __alignof__(unsigned long);
+    return __alignof__ (unsigned long);
     break;
 
   case _C_LNG_LNG:
     break;
 
   case _C_LNG_LNG:
-    return __alignof__(long long);
+    return __alignof__ (long long);
     break;
 
   case _C_ULNG_LNG:
     break;
 
   case _C_ULNG_LNG:
-    return __alignof__(unsigned long long);
+    return __alignof__ (unsigned long long);
     break;
 
   case _C_FLT:
     break;
 
   case _C_FLT:
-    return __alignof__(float);
+    return __alignof__ (float);
     break;
 
   case _C_DBL:
     break;
 
   case _C_DBL:
-    return __alignof__(double);
+    return __alignof__ (double);
     break;
 
   case _C_PTR:
   case _C_ATOM:
   case _C_CHARPTR:
     break;
 
   case _C_PTR:
   case _C_ATOM:
   case _C_CHARPTR:
-    return __alignof__(char*);
+    return __alignof__ (char *);
     break;
 
   case _C_ARY_B:
     break;
 
   case _C_ARY_B:
-    while (isdigit((unsigned char)*++type)) /* do nothing */;
+    while (isdigit ((unsigned char)*++type))
+      /* do nothing */;
     return objc_alignof_type (type);
 
   case _C_STRUCT_B:
     return objc_alignof_type (type);
 
   case _C_STRUCT_B:
@@ -331,7 +336,8 @@ objc_alignof_type(const char* type)
   case _C_UNION_B:
     {
       int maxalign = 0;
   case _C_UNION_B:
     {
       int maxalign = 0;
-      while (*type != _C_UNION_E && *type++ != '=') /* do nothing */;
+      while (*type != _C_UNION_E && *type++ != '=')
+       /* do nothing */;
       while (*type != _C_UNION_E)
        {
          /* Skip the variable name if any */
       while (*type != _C_UNION_E)
        {
          /* Skip the variable name if any */
@@ -348,7 +354,7 @@ objc_alignof_type(const char* type)
 
   default:
     {
 
   default:
     {
-      objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type);
+      objc_error (nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type);
       return 0;
     }
   }
       return 0;
     }
   }
@@ -359,7 +365,7 @@ objc_alignof_type(const char* type)
 */
 
 int
 */
 
 int
-objc_aligned_size (const chartype)
+objc_aligned_size (const char *type)
 {
   int size, align;
 
 {
   int size, align;
 
@@ -378,11 +384,11 @@ objc_aligned_size (const char* type)
 
 /*
   The size rounded up to the nearest integral of the wordsize, taken
 
 /*
   The size rounded up to the nearest integral of the wordsize, taken
-  to be the size of a void*.
+  to be the size of a void *.
 */
 
 int
 */
 
 int
-objc_promoted_size (const chartype)
+objc_promoted_size (const char *type)
 {
   int size, wordsize;
 
 {
   int size, wordsize;
 
@@ -394,7 +400,7 @@ objc_promoted_size (const char* type)
     }
 
   size = objc_sizeof_type (type);
     }
 
   size = objc_sizeof_type (type);
-  wordsize = sizeof (void*);
+  wordsize = sizeof (void *);
 
   return ROUND (size, wordsize);
 }
 
   return ROUND (size, wordsize);
 }
@@ -404,8 +410,8 @@ objc_promoted_size (const char* type)
   occurring in method prototype encodings.
 */
 
   occurring in method prototype encodings.
 */
 
-inline const char*
-objc_skip_type_qualifiers (const chartype)
+inline const char *
+objc_skip_type_qualifiers (const char *type)
 {
   while (*type == _C_CONST
         || *type == _C_IN
 {
   while (*type == _C_CONST
         || *type == _C_IN
@@ -427,8 +433,8 @@ objc_skip_type_qualifiers (const char* type)
   qualifiers, these are skipped as well.
 */
 
   qualifiers, these are skipped as well.
 */
 
-const char*
-objc_skip_typespec (const chartype)
+const char *
+objc_skip_typespec (const char *type)
 {
   /* Skip the variable name if any */
   if (*type == '"')
 {
   /* Skip the variable name if any */
   if (*type == '"')
@@ -449,7 +455,8 @@ objc_skip_typespec (const char* type)
       return type;
     else
       {
       return type;
     else
       {
-       while (*++type != '"') /* do nothing */;
+       while (*++type != '"')
+         /* do nothing */;
        return type + 1;
       }
 
        return type + 1;
       }
 
@@ -478,34 +485,45 @@ objc_skip_typespec (const char* type)
   case _C_ARY_B:
     /* skip digits, typespec and closing ']' */
 
   case _C_ARY_B:
     /* skip digits, typespec and closing ']' */
 
-    while(isdigit((unsigned char)*++type));
-    type = objc_skip_typespec(type);
+    while (isdigit ((unsigned char)*++type))
+      ;
+    type = objc_skip_typespec (type);
     if (*type == _C_ARY_E)
       return ++type;
     else
       {
     if (*type == _C_ARY_E)
       return ++type;
     else
       {
-       objc_error(nil, OBJC_ERR_BAD_TYPE, "bad array type %s\n", type);
+       objc_error (nil, OBJC_ERR_BAD_TYPE, "bad array type %s\n", type);
        return 0;
       }
 
   case _C_BFLD:
     /* The new encoding of bitfields is: b 'position' 'type' 'size' */
        return 0;
       }
 
   case _C_BFLD:
     /* The new encoding of bitfields is: b 'position' 'type' 'size' */
-    while (isdigit ((unsigned char)*++type));  /* skip position */
-    while (isdigit ((unsigned char)*++type));  /* skip type and size */
+    while (isdigit ((unsigned char)*++type))
+      ;        /* skip position */
+    while (isdigit ((unsigned char)*++type))
+      ;        /* skip type and size */
     return type;
 
   case _C_STRUCT_B:
     /* skip name, and elements until closing '}'  */
 
     return type;
 
   case _C_STRUCT_B:
     /* skip name, and elements until closing '}'  */
 
-    while (*type != _C_STRUCT_E && *type++ != '=');
-    while (*type != _C_STRUCT_E) { type = objc_skip_typespec (type); }
+    while (*type != _C_STRUCT_E && *type++ != '=')
+      ;
+    while (*type != _C_STRUCT_E)
+      {
+       type = objc_skip_typespec (type);
+      }
     return ++type;
 
   case _C_UNION_B:
     /* skip name, and elements until closing ')'  */
 
     return ++type;
 
   case _C_UNION_B:
     /* skip name, and elements until closing ')'  */
 
-    while (*type != _C_UNION_E && *type++ != '=');
-    while (*type != _C_UNION_E) { type = objc_skip_typespec (type); }
+    while (*type != _C_UNION_E && *type++ != '=')
+      ;
+    while (*type != _C_UNION_E)
+      {
+       type = objc_skip_typespec (type);
+      }
     return ++type;
 
   case _C_PTR:
     return ++type;
 
   case _C_PTR:
@@ -515,7 +533,7 @@ objc_skip_typespec (const char* type)
 
   default:
     {
 
   default:
     {
-      objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type);
+      objc_error (nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type);
       return 0;
     }
   }
       return 0;
     }
   }
@@ -525,19 +543,21 @@ objc_skip_typespec (const char* type)
   Skip an offset as part of a method encoding.  This is prepended by a
   '+' if the argument is passed in registers.
 */
   Skip an offset as part of a method encoding.  This is prepended by a
   '+' if the argument is passed in registers.
 */
-inline const char*
-objc_skip_offset (const chartype)
+inline const char *
+objc_skip_offset (const char *type)
 {
 {
-  if (*type == '+') type++;
-  while(isdigit((unsigned char)*++type));
+  if (*type == '+')
+    type++;
+  while (isdigit ((unsigned char) *++type))
+    ;
   return type;
 }
 
 /*
   Skip an argument specification of a method encoding.
 */
   return type;
 }
 
 /*
   Skip an argument specification of a method encoding.
 */
-const char*
-objc_skip_argspec (const chartype)
+const char *
+objc_skip_argspec (const char *type)
 {
   type = objc_skip_typespec (type);
   type = objc_skip_offset (type);
 {
   type = objc_skip_typespec (type);
   type = objc_skip_offset (type);
@@ -550,10 +570,10 @@ objc_skip_argspec (const char* type)
   `_cmd'.
 */
 int
   `_cmd'.
 */
 int
-method_get_number_of_arguments (struct objc_methodmth)
+method_get_number_of_arguments (struct objc_method *mth)
 {
   int i = 0;
 {
   int i = 0;
-  const chartype = mth->method_types;
+  const char *type = mth->method_types;
   while (*type)
     {
       type = objc_skip_argspec (type);
   while (*type)
     {
       type = objc_skip_argspec (type);
@@ -569,9 +589,9 @@ method_get_number_of_arguments (struct objc_method* mth)
 */
 
 int
 */
 
 int
-method_get_sizeof_arguments (struct objc_methodmth)
+method_get_sizeof_arguments (struct objc_method *mth)
 {
 {
-  const chartype = objc_skip_typespec (mth->method_types);
+  const char *type = objc_skip_typespec (mth->method_types);
   return atoi (type);
 }
 
   return atoi (type);
 }
 
@@ -591,15 +611,14 @@ method_get_sizeof_arguments (struct objc_method* mth)
        else
          {
            if ((flags & _F_IN) == _F_IN)
        else
          {
            if ((flags & _F_IN) == _F_IN)
-              [portal encodeData: *(char**)datum ofType: ++type];
+              [portal encodeData: *(char **) datum ofType: ++type];
          }
       }
   }
 */
 
          }
       }
   }
 */
 
-char*
-method_get_next_argument (arglist_t argframe,
-                         const char **type)
+char *
+method_get_next_argument (arglist_t argframe, const char **type)
 {
   const char *t = objc_skip_argspec (*type);
 
 {
   const char *t = objc_skip_argspec (*type);
 
@@ -621,10 +640,10 @@ method_get_next_argument (arglist_t argframe,
   is returned in TYPE.  type must be passed to successive calls of
   method_get_next_argument.
 */
   is returned in TYPE.  type must be passed to successive calls of
   method_get_next_argument.
 */
-char*
-method_get_first_argument (struct objc_methodm,
+char *
+method_get_first_argument (struct objc_method *m,
                           arglist_t argframe,
                           arglist_t argframe,
-                          const char** type)
+                          const char **type)
 {
   *type = m->method_types;
   return method_get_next_argument (argframe, type);
 {
   *type = m->method_types;
   return method_get_next_argument (argframe, type);
@@ -636,12 +655,12 @@ method_get_first_argument (struct objc_method* m,
    is returned in the value-result argument TYPE
 */
 
    is returned in the value-result argument TYPE
 */
 
-char*
-method_get_nth_argument (struct objc_methodm,
+char *
+method_get_nth_argument (struct objc_method *m,
                         arglist_t argframe, int arg,
                         const char **type)
 {
                         arglist_t argframe, int arg,
                         const char **type)
 {
-  const chart = objc_skip_argspec (m->method_types);
+  const char *t = objc_skip_argspec (m->method_types);
 
   if (arg > method_get_number_of_arguments (m))
     return 0;
 
   if (arg > method_get_number_of_arguments (m))
     return 0;
@@ -659,7 +678,7 @@ method_get_nth_argument (struct objc_method* m,
 }
 
 unsigned
 }
 
 unsigned
-objc_get_type_qualifiers (const chartype)
+objc_get_type_qualifiers (const char *type)
 {
   unsigned res = 0;
   BOOL flag = YES;
 {
   unsigned res = 0;
   BOOL flag = YES;
@@ -712,7 +731,7 @@ objc_layout_structure (const char *type,
 
   if (*type++ != _C_STRUCT_B)
     {
 
   if (*type++ != _C_STRUCT_B)
     {
-      objc_error(nil, OBJC_ERR_BAD_TYPE,
+      objc_error (nil, OBJC_ERR_BAD_TYPE,
                  "record type expected in objc_layout_structure, got %s\n",
                  type);
     }
                  "record type expected in objc_layout_structure, got %s\n",
                  type);
     }
@@ -760,7 +779,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
       else {
         /* Get the bitfield's type */
         for (bfld_type = type + 1;
       else {
         /* Get the bitfield's type */
         for (bfld_type = type + 1;
-             isdigit((unsigned char)*bfld_type);
+             isdigit ((unsigned char)*bfld_type);
              bfld_type++)
           /* do nothing */;
 
              bfld_type++)
           /* do nothing */;
 
@@ -784,12 +803,14 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
   type = objc_skip_type_qualifiers (layout->type);
 
   if (*type != _C_BFLD)
   type = objc_skip_type_qualifiers (layout->type);
 
   if (*type != _C_BFLD)
-    desired_align = objc_alignof_type(type) * BITS_PER_UNIT;
+    desired_align = objc_alignof_type (type) * BITS_PER_UNIT;
   else
     {
       desired_align = 1;
       /* Skip the bitfield's offset */
   else
     {
       desired_align = 1;
       /* Skip the bitfield's offset */
-      for (bfld_type = type + 1; isdigit((unsigned char)*bfld_type); bfld_type++)
+      for (bfld_type = type + 1;
+           isdigit ((unsigned char) *bfld_type);
+           bfld_type++)
         /* do nothing */;
 
       bfld_type_size = objc_sizeof_type (bfld_type) * BITS_PER_UNIT;
         /* do nothing */;
 
       bfld_type_size = objc_sizeof_type (bfld_type) * BITS_PER_UNIT;
@@ -809,7 +830,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
      is meaningless.  */
 #ifndef PCC_BITFIELD_TYPE_MATTERS
   layout->record_align = MAX (layout->record_align, desired_align);
      is meaningless.  */
 #ifndef PCC_BITFIELD_TYPE_MATTERS
   layout->record_align = MAX (layout->record_align, desired_align);
-#else
+#else  /* PCC_BITFIELD_TYPE_MATTERS */
   if (*type == _C_BFLD)
     {
       /* For these machines, a zero-length field does not
   if (*type == _C_BFLD)
     {
       /* For these machines, a zero-length field does not
@@ -841,7 +862,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
     }
   else
     layout->record_align = MAX (layout->record_align, desired_align);
     }
   else
     layout->record_align = MAX (layout->record_align, desired_align);
-#endif
+#endif /* PCC_BITFIELD_TYPE_MATTERS */
 
   /* Does this field automatically have alignment it needs
      by virtue of the fields that precede it and the record's
 
   /* Does this field automatically have alignment it needs
      by virtue of the fields that precede it and the record's
@@ -875,7 +896,7 @@ void objc_layout_finish_structure (struct objc_struct_layout *layout,
          in the record type.  Round it up to a multiple of the record's
          alignment. */
 
          in the record type.  Round it up to a multiple of the record's
          alignment. */
 
-#if defined(ROUND_TYPE_ALIGN) && !defined(__sparc__)
+#if defined (ROUND_TYPE_ALIGN) && ! defined (__sparc__)
       layout->record_align = ROUND_TYPE_ALIGN (layout->original_type,
                                                1,
                                                layout->record_align);
       layout->record_align = ROUND_TYPE_ALIGN (layout->original_type,
                                                1,
                                                layout->record_align);
index 761905c..1010508 100644 (file)
@@ -1,5 +1,5 @@
 /* Basic data types for Objective C.
 /* Basic data types for Objective C.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
    Contributed by Ovidiu Predescu.
 
 This file is part of GNU CC.
    Contributed by Ovidiu Predescu.
 
 This file is part of GNU CC.
@@ -58,11 +58,11 @@ typedef GC_signed_word signed_word;
    The offset is incremented with the size of the type.  */
 
 #define ROUND(V, A) \
    The offset is incremented with the size of the type.  */
 
 #define ROUND(V, A) \
-  ({ typeof(V) __v=(V); typeof(A) __a=(A); \
-     __a*((__v+__a-1)/__a); })
+  ({ typeof (V) __v = (V); typeof (A) __a = (A); \
+     __a * ((__v+__a - 1)/__a); })
 
 #define SET_BIT_FOR_OFFSET(mask, offset) \
 
 #define SET_BIT_FOR_OFFSET(mask, offset) \
-  GC_set_bit(mask, offset / sizeof (void*))
+  GC_set_bit (mask, offset / sizeof (void *))
 
 /* Some prototypes */
 static void
 
 /* Some prototypes */
 static void
@@ -74,9 +74,9 @@ __objc_gc_setup_union (GC_bitmap mask, const char *type, int offset);
 static void
 __objc_gc_setup_array (GC_bitmap mask, const char *type, int offset)
 {
 static void
 __objc_gc_setup_array (GC_bitmap mask, const char *type, int offset)
 {
-  int i, len = atoi(type + 1);
+  int i, len = atoi (type + 1);
 
 
-  while (isdigit(*++type))
+  while (isdigit (*++type))
     /* do nothing */;          /* skip the size of the array */
 
   switch (*type) {
     /* do nothing */;          /* skip the size of the array */
 
   switch (*type) {
@@ -138,8 +138,8 @@ __objc_gc_setup_struct (GC_bitmap mask, const char *type, int offset)
       case _C_PTR:
       case _C_CHARPTR:
       case _C_ATOM:
       case _C_PTR:
       case _C_CHARPTR:
       case _C_ATOM:
-       if (!gc_invisible)
-         SET_BIT_FOR_OFFSET(mask, position);
+       if (! gc_invisible)
+         SET_BIT_FOR_OFFSET (mask, position);
        break;
 
       case _C_ARY_B:
        break;
 
       case _C_ARY_B:
@@ -178,11 +178,11 @@ __objc_gc_setup_union (GC_bitmap mask, const char *type, int offset)
   size = objc_sizeof_type (type);
   align = objc_alignof_type (type);
 
   size = objc_sizeof_type (type);
   align = objc_alignof_type (type);
 
-  offset = ROUND(offset, align);
-  for (i = 0; i < size; i += sizeof (void*))
+  offset = ROUND (offset, align);
+  for (i = 0; i < size; i += sizeof (void *))
     {
     {
-      SET_BIT_FOR_OFFSET(mask, offset);
-      offset += sizeof (void*);
+      SET_BIT_FOR_OFFSET (mask, offset);
+      offset += sizeof (void *);
     }
 }
 
     }
 }
 
@@ -223,8 +223,8 @@ __objc_gc_type_description_from_type (GC_bitmap mask, const char *type)
       case _C_SEL:
       case _C_PTR:
       case _C_CHARPTR:
       case _C_SEL:
       case _C_PTR:
       case _C_CHARPTR:
-        if (!gc_invisible)
-          SET_BIT_FOR_OFFSET(mask, offset);
+        if (! gc_invisible)
+          SET_BIT_FOR_OFFSET (mask, offset);
        break;
 
       case _C_ARY_B:
        break;
 
       case _C_ARY_B:
@@ -254,9 +254,9 @@ __objc_class_structure_encoding (Class class, char **type, int *size,
                                  int *current)
 {
   int i, ivar_count;
                                  int *current)
 {
   int i, ivar_count;
-  struct objc_ivar_listivars;
+  struct objc_ivar_list *ivars;
 
 
-  if (!class)
+  if (! class)
     {
       strcat (*type, "{");
       *current++;
     {
       strcat (*type, "{");
       *current++;
@@ -267,7 +267,7 @@ __objc_class_structure_encoding (Class class, char **type, int *size,
   __objc_class_structure_encoding (class->super_class, type, size, current);
 
   ivars = class->ivars;
   __objc_class_structure_encoding (class->super_class, type, size, current);
 
   ivars = class->ivars;
-  if (!ivars)
+  if (! ivars)
     return;
 
   ivar_count = ivars->ivar_count;
     return;
 
   ivar_count = ivars->ivar_count;
@@ -282,7 +282,7 @@ __objc_class_structure_encoding (Class class, char **type, int *size,
         {
           /* Increase the size of the encoding string so that it
              contains this ivar's type. */
         {
           /* Increase the size of the encoding string so that it
              contains this ivar's type. */
-          *size = ROUND(*current + len + 1, 10);
+          *size = ROUND (*current + len + 1, 10);
           *type = objc_realloc (*type, *size);
         }
       strcat (*type + *current, ivar_type);
           *type = objc_realloc (*type, *size);
         }
       strcat (*type + *current, ivar_type);
@@ -302,7 +302,7 @@ __objc_generate_gc_type_description (Class class)
   int type_size = 10, current;
   char *class_structure_type;
 
   int type_size = 10, current;
   char *class_structure_type;
 
-  if (!CLS_ISCLASS(class))
+  if (! CLS_ISCLASS (class))
     return;
 
   /* We have to create a mask in which each bit counts for a pointer member.
     return;
 
   /* We have to create a mask in which each bit counts for a pointer member.
@@ -311,9 +311,9 @@ __objc_generate_gc_type_description (Class class)
 
   /* The number of bits in the mask is the size of an instance in bytes divided
      by the size of a pointer. */
 
   /* The number of bits in the mask is the size of an instance in bytes divided
      by the size of a pointer. */
-  bits_no = (ROUND(class_get_instance_size (class), sizeof(void*))
-             / sizeof (void*));
-  size = ROUND(bits_no, BITS_PER_WORD) / BITS_PER_WORD;
+  bits_no = (ROUND (class_get_instance_size (class), sizeof (void *))
+             / sizeof (void *));
+  size = ROUND (bits_no, BITS_PER_WORD) / BITS_PER_WORD;
   mask = objc_atomic_malloc (size * sizeof (int));
   memset (mask, 0, size * sizeof (int));
 
   mask = objc_atomic_malloc (size * sizeof (int));
   memset (mask, 0, size * sizeof (int));
 
@@ -342,7 +342,7 @@ __objc_generate_gc_type_description (Class class)
   puts ("");
 #endif
 
   puts ("");
 #endif
 
-  class->gc_object_type = (void*)GC_make_descriptor (mask, bits_no);
+  class->gc_object_type = (void *) GC_make_descriptor (mask, bits_no);
 }
 
 
 }
 
 
@@ -370,17 +370,17 @@ __objc_ivar_pointer (const char *type)
    This operation only makes sense on instance variables that are
    pointers.  */
 void
    This operation only makes sense on instance variables that are
    pointers.  */
 void
-class_ivar_set_gcinvisible (Class class, const charivarname,
+class_ivar_set_gcinvisible (Class class, const char *ivarname,
                             BOOL gc_invisible)
 {
   int i, ivar_count;
                             BOOL gc_invisible)
 {
   int i, ivar_count;
-  struct objc_ivar_listivars;
+  struct objc_ivar_list *ivars;
 
 
-  if (!class || !ivarname)
+  if (! class || ! ivarname)
     return;
 
   ivars = class->ivars;
     return;
 
   ivars = class->ivars;
-  if (!ivars)
+  if (! ivars)
     return;
 
   ivar_count = ivars->ivar_count;
     return;
 
   ivar_count = ivars->ivar_count;
@@ -390,7 +390,7 @@ class_ivar_set_gcinvisible (Class class, const char* ivarname,
       struct objc_ivar *ivar = &(ivars->ivar_list[i]);
       const char *type;
 
       struct objc_ivar *ivar = &(ivars->ivar_list[i]);
       const char *type;
 
-      if (!ivar->ivar_name || strcmp (ivar->ivar_name, ivarname))
+      if (! ivar->ivar_name || strcmp (ivar->ivar_name, ivarname))
        continue;
 
       assert (ivar->ivar_type);
        continue;
 
       assert (ivar->ivar_type);
@@ -407,7 +407,7 @@ class_ivar_set_gcinvisible (Class class, const char* ivarname,
        {
          char *new_type;
 
        {
          char *new_type;
 
-         if (gc_invisible || !__objc_ivar_pointer (type))
+         if (gc_invisible || ! __objc_ivar_pointer (type))
            return;     /* The type of the variable already matches the
                           requested gc_invisible type */
 
            return;     /* The type of the variable already matches the
                           requested gc_invisible type */
 
@@ -422,7 +422,7 @@ class_ivar_set_gcinvisible (Class class, const char* ivarname,
        {
          char *new_type;
 
        {
          char *new_type;
 
-         if (!gc_invisible || !__objc_ivar_pointer (type))
+         if (! gc_invisible || ! __objc_ivar_pointer (type))
            return;     /* The type of the variable already matches the
                           requested gc_invisible type */
 
            return;     /* The type of the variable already matches the
                           requested gc_invisible type */
 
@@ -451,7 +451,7 @@ __objc_generate_gc_type_description (Class class __attribute__ ((__unused__)))
 }
 
 void class_ivar_set_gcinvisible (Class class __attribute__ ((__unused__)),
 }
 
 void class_ivar_set_gcinvisible (Class class __attribute__ ((__unused__)),
-                                const charivarname __attribute__ ((__unused__)),
+                                const char *ivarname __attribute__ ((__unused__)),
                                 BOOL gc_invisible __attribute__ ((__unused__)))
 {
 }
                                 BOOL gc_invisible __attribute__ ((__unused__)))
 {
 }
index 223991f..2f58b2c 100644 (file)
@@ -47,7 +47,7 @@ hash_new (unsigned int size, hash_func_type hash_func,
 
   /* Pass me a value greater than 0 and a power of 2.  */
   assert (size);
 
   /* Pass me a value greater than 0 and a power of 2.  */
   assert (size);
-  assert (!(size & (size - 1)));
+  assert (! (size & (size - 1)));
 
   /* Allocate the cache structure.  calloc insures
      its initialization for default values.  */
 
   /* Allocate the cache structure.  calloc insures
      its initialization for default values.  */
@@ -196,7 +196,7 @@ hash_remove (cache_ptr cache, const void *key)
         objc_free(node);
       } else
         prev = node, node = node->next;
         objc_free(node);
       } else
         prev = node, node = node->next;
-    } while (!removed && node);
+    } while (! removed && node);
     assert (removed);
   }
 
     assert (removed);
   }
 
@@ -210,7 +210,7 @@ hash_next (cache_ptr cache, node_ptr node)
 {
   /* If the scan is being started then reset the last node
      visitied pointer and bucket index.  */
 {
   /* If the scan is being started then reset the last node
      visitied pointer and bucket index.  */
-  if (!node)
+  if (! node)
     cache->last_bucket  = 0;
 
   /* If there is a node visited last then check for another
     cache->last_bucket  = 0;
 
   /* If there is a node visited last then check for another
@@ -258,7 +258,7 @@ hash_value_for_key (cache_ptr cache, const void *key)
               break;
       } else
         node = node->next;
               break;
       } else
         node = node->next;
-    } while (!retval && node);
+    } while (! retval && node);
 
   return retval;
 }
 
   return retval;
 }
index e257aee..098e253 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU Objective C Runtime initialization 
 /* GNU Objective C Runtime initialization 
-   Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
    Contributed by Kresten Krab Thorup
    +load support contributed by Ovidiu Predescu <ovidiu@net-community.com>
 
    Contributed by Kresten Krab Thorup
    +load support contributed by Ovidiu Predescu <ovidiu@net-community.com>
 
@@ -27,62 +27,62 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "runtime.h"
 
 /* The version number of this runtime.  This must match the number 
 #include "runtime.h"
 
 /* The version number of this runtime.  This must match the number 
-   defined in gcc (objc-act.c) */
+   defined in gcc (objc-act.c) */
 #define OBJC_VERSION 8
 #define PROTOCOL_VERSION 2
 
 #define OBJC_VERSION 8
 #define PROTOCOL_VERSION 2
 
-/* This list contains all modules currently loaded into the runtime */
-static struct objc_list__objc_module_list = 0;       /* !T:MUTEX */
+/* This list contains all modules currently loaded into the runtime */
+static struct objc_list *__objc_module_list = 0;       /* !T:MUTEX */
 
 
-/* This list contains all proto_list's not yet assigned class links */
-static struct objc_listunclaimed_proto_list = 0;     /* !T:MUTEX */
+/* This list contains all proto_list's not yet assigned class links */
+static struct objc_list *unclaimed_proto_list = 0;     /* !T:MUTEX */
 
 /* List of unresolved static instances.  */
 static struct objc_list *uninitialized_statics = 0;    /* !T:MUTEX */
 
 
 /* List of unresolved static instances.  */
 static struct objc_list *uninitialized_statics = 0;    /* !T:MUTEX */
 
-/* Global runtime "write" mutex. */
+/* Global runtime "write" mutex.  */
 objc_mutex_t __objc_runtime_mutex = 0;
 
 objc_mutex_t __objc_runtime_mutex = 0;
 
-/* Number of threads that are alive. */
+/* Number of threads that are alive.  */
 int __objc_runtime_threads_alive = 1;                  /* !T:MUTEX */
 
 int __objc_runtime_threads_alive = 1;                  /* !T:MUTEX */
 
-/* Check compiler vs runtime version */
+/* Check compiler vs runtime version */
 static void init_check_module_version (Module_t);
 
 static void init_check_module_version (Module_t);
 
-/* Assign isa links to protos */
-static void __objc_init_protocols (struct objc_protocol_listprotos);
+/* Assign isa links to protos */
+static void __objc_init_protocols (struct objc_protocol_list *protos);
 
 
-/* Add protocol to class */
-static void __objc_class_add_protocols (Class, struct objc_protocol_list*);
+/* Add protocol to class */
+static void __objc_class_add_protocols (Class, struct objc_protocol_list *);
 
 
-/* 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 */
-void (*_objc_load_callback)(Class class, Category* category); /* !T:SAFE */
+/* 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
+   dynamic loader determine the classes that have been loaded when
+   an object file is dynamically linked in */
+void (*_objc_load_callback) (Class class, Category *category); /* !T:SAFE */
 
 
-/* Is all categories/classes resolved? */
+/* Is all categories/classes resolved?  */
 BOOL __objc_dangling_categories = NO;           /* !T:UNUSED */
 
 extern SEL
 __sel_register_typed_name (const char *name, const char *types, 
                           struct objc_selector *orig, BOOL is_const);
 
 BOOL __objc_dangling_categories = NO;           /* !T:UNUSED */
 
 extern SEL
 __sel_register_typed_name (const char *name, const char *types, 
                           struct objc_selector *orig, BOOL is_const);
 
-/* Sends +load to all classes and categories in certain situations. */
+/* Sends +load to all classes and categories in certain situations.  */
 static void objc_send_load (void);
 
 /* Inserts all the classes defined in module in a tree of classes that
 static void objc_send_load (void);
 
 /* Inserts all the classes defined in module in a tree of classes that
-   resembles the class hierarchy. This tree is traversed in preorder and the
-   classes in its nodes receive the +load message if these methods were not
-   executed before. The algorithm ensures that when the +load method of a class
-   is executed all the superclasses have been already received the +load
-   message. */
+   resembles the class hierarchy. This tree is traversed in preorder
+   and the classes in its nodes receive the +load message if these
+   methods were not executed before. The algorithm ensures that when
+   the +load method of a class is executed all the superclasses have
+   been already received the +load message.  */
 static void __objc_create_classes_tree (Module_t module);
 
 static void __objc_call_callback (Module_t module);
 
 /* A special version that works only before the classes are completely
 static void __objc_create_classes_tree (Module_t module);
 
 static void __objc_call_callback (Module_t module);
 
 /* A special version that works only before the classes are completely
-   installed in the runtime. */
+   installed in the runtime.  */
 static BOOL class_is_subclass_of_class (Class class, Class superclass);
 
 typedef struct objc_class_tree {
 static BOOL class_is_subclass_of_class (Class class, Class superclass);
 
 typedef struct objc_class_tree {
@@ -90,24 +90,26 @@ typedef struct objc_class_tree {
   struct objc_list *subclasses; /* `head' is pointer to an objc_class_tree */
 } objc_class_tree;
 
   struct objc_list *subclasses; /* `head' is pointer to an objc_class_tree */
 } objc_class_tree;
 
-/* This is a linked list of objc_class_tree trees. The head of these trees
-   are root classes (their super class is Nil). These different trees
-   represent different class hierarchies. */
+/* This is a linked list of objc_class_tree trees. The head of these
+   trees are root classes (their super class is Nil). These different
+   trees represent different class hierarchies.  */
 static struct objc_list *__objc_class_tree_list = NULL;
 
 static struct objc_list *__objc_class_tree_list = NULL;
 
-/* Keeps the +load methods who have been already executed. This hash should
-   not be destroyed during the execution of the program. */
+/* Keeps the +load methods who have been already executed. This hash
+   should not be destroyed during the execution of the program.  */
 static cache_ptr __objc_load_methods = NULL;
 
 static cache_ptr __objc_load_methods = NULL;
 
-/* Creates a tree of classes whose topmost class is directly inherited from
-   `upper' and the bottom class in this tree is `bottom_class'. The classes
-   in this tree are super classes of `bottom_class'. `subclasses' member
-   of each tree node point to the next subclass tree node. */
+/* Creates a tree of classes whose topmost class is directly inherited
+   from `upper' and the bottom class in this tree is
+   `bottom_class'. The classes in this tree are super classes of
+   `bottom_class'. `subclasses' member of each tree node point to the
+   next subclass tree node.  */
+
 static objc_class_tree *
 create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
 {
   Class superclass = bottom_class->super_class ?
 static objc_class_tree *
 create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
 {
   Class superclass = bottom_class->super_class ?
-                       objc_lookup_class ((char*)bottom_class->super_class)
+                       objc_lookup_class ((char *) bottom_class->super_class)
                      : Nil;
                                        
   objc_class_tree *tree, *prev;
                      : Nil;
                                        
   objc_class_tree *tree, *prev;
@@ -126,7 +128,7 @@ create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
       tree->class = superclass;
       tree->subclasses = list_cons (prev, tree->subclasses);
       superclass = (superclass->super_class ?
       tree->class = superclass;
       tree->subclasses = list_cons (prev, tree->subclasses);
       superclass = (superclass->super_class ?
-                       objc_lookup_class ((char*)superclass->super_class)
+                       objc_lookup_class ((char *) superclass->super_class)
                      : Nil);
       prev = tree;
     }
                      : Nil);
       prev = tree;
     }
@@ -134,11 +136,13 @@ create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
   return tree;
 }
 
   return tree;
 }
 
-/* Insert the `class' into the proper place in the `tree' class hierarchy. This
-   function returns a new tree if the class has been successfully inserted into
-   the tree or NULL if the class is not part of the classes hierarchy described
-   by `tree'. This function is private to objc_tree_insert_class(), you should
-   not call it directly. */
+/* Insert the `class' into the proper place in the `tree' class
+   hierarchy. This function returns a new tree if the class has been
+   successfully inserted into the tree or NULL if the class is not
+   part of the classes hierarchy described by `tree'. This function is
+   private to objc_tree_insert_class (), you should not call it
+   directly.  */
+
 static objc_class_tree *
 __objc_tree_insert_class (objc_class_tree *tree, Class class)
 {
 static objc_class_tree *
 __objc_tree_insert_class (objc_class_tree *tree, Class class)
 {
@@ -154,21 +158,21 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
       return tree;
     }
   else if ((class->super_class ?
       return tree;
     }
   else if ((class->super_class ?
-                   objc_lookup_class ((char*)class->super_class)
+                   objc_lookup_class ((char *) class->super_class)
                  : Nil)
            == tree->class)
     {
       /* If class is a direct subclass of tree->class then add class to the
         list of subclasses. First check to see if it wasn't already
                  : Nil)
            == tree->class)
     {
       /* If class is a direct subclass of tree->class then add class to the
         list of subclasses. First check to see if it wasn't already
-        inserted. */
+        inserted.  */
       struct objc_list *list = tree->subclasses;
       objc_class_tree *node;
 
       while (list)
        {
          /* Class has been already inserted; do nothing just return
       struct objc_list *list = tree->subclasses;
       objc_class_tree *node;
 
       while (list)
        {
          /* Class has been already inserted; do nothing just return
-            the tree. */
-         if (((objc_class_tree*)list->head)->class == class)
+            the tree.  */
+         if (((objc_class_tree *) list->head)->class == class)
            {
              DEBUG_PRINTF ("2. class %s was previously inserted\n",
                            class->name);
            {
              DEBUG_PRINTF ("2. class %s was previously inserted\n",
                            class->name);
@@ -186,24 +190,25 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
     }
   else
     {
     }
   else
     {
-      /* The class is not a direct subclass of tree->class. Search for class's
-         superclasses in the list of subclasses. */
+      /* The class is not a direct subclass of tree->class. Search for
+         class's superclasses in the list of subclasses.  */
       struct objc_list *subclasses = tree->subclasses;
 
       struct objc_list *subclasses = tree->subclasses;
 
-      /* Precondition: the class must be a subclass of tree->class; otherwise
-         return NULL to indicate our caller that it must take the next tree. */
-      if (!class_is_subclass_of_class (class, tree->class))
+      /* Precondition: the class must be a subclass of tree->class;
+         otherwise return NULL to indicate our caller that it must
+         take the next tree.  */
+      if (! class_is_subclass_of_class (class, tree->class))
        return NULL;
 
       for (; subclasses != NULL; subclasses = subclasses->tail)
        {
        return NULL;
 
       for (; subclasses != NULL; subclasses = subclasses->tail)
        {
-         Class aClass = ((objc_class_tree*)(subclasses->head))->class;
+         Class aClass = ((objc_class_tree *) (subclasses->head))->class;
 
          if (class_is_subclass_of_class (class, aClass))
            {
 
          if (class_is_subclass_of_class (class, aClass))
            {
-             /* If we found one of class's superclasses we insert the class
-                into its subtree and return the original tree since nothing
-                has been changed. */
+             /* If we found one of class's superclasses we insert the
+                class into its subtree and return the original tree
+                since nothing has been changed.  */
              subclasses->head
                  = __objc_tree_insert_class (subclasses->head, class);
              DEBUG_PRINTF ("4. class %s inserted\n", class->name);
              subclasses->head
                  = __objc_tree_insert_class (subclasses->head, class);
              DEBUG_PRINTF ("4. class %s inserted\n", class->name);
@@ -211,12 +216,12 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
            }
        }
 
            }
        }
 
-      /* We haven't found a subclass of `class' in the `subclasses' list.
-         Create a new tree of classes whose topmost class is a direct subclass
-        of tree->class. */
+      /* We haven't found a subclass of `class' in the `subclasses'
+         list.  Create a new tree of classes whose topmost class is a
+         direct subclass of tree->class.  */
       {
        objc_class_tree *new_tree
       {
        objc_class_tree *new_tree
-           = create_tree_of_subclasses_inherited_from (class, tree->class);
+         = create_tree_of_subclasses_inherited_from (class, tree->class);
        tree->subclasses = list_cons (new_tree, tree->subclasses);
        DEBUG_PRINTF ("5. class %s inserted\n", class->name);
        return tree;
        tree->subclasses = list_cons (new_tree, tree->subclasses);
        DEBUG_PRINTF ("5. class %s inserted\n", class->name);
        return tree;
@@ -224,7 +229,8 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
     }
 }
 
     }
 }
 
-/* This function inserts `class' in the right tree hierarchy classes. */
+/* This function inserts `class' in the right tree hierarchy classes.  */
+
 static void
 objc_tree_insert_class (Class class)
 {
 static void
 objc_tree_insert_class (Class class)
 {
@@ -244,20 +250,21 @@ objc_tree_insert_class (Class class)
        list_node = list_node->tail;
     }
 
        list_node = list_node->tail;
     }
 
-  /* If the list was finished but the class hasn't been inserted, insert it
-     here. */
-  if (!list_node)
+  /* If the list was finished but the class hasn't been inserted,
+     insert it here.  */
+  if (! list_node)
     {
       __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
       __objc_class_tree_list->head = __objc_tree_insert_class (NULL, class);
     }
 }
 
     {
       __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
       __objc_class_tree_list->head = __objc_tree_insert_class (NULL, class);
     }
 }
 
-/* Traverse tree in preorder. Used to send +load. */
+/* Traverse tree in preorder. Used to send +load.  */
+
 static void
 objc_preorder_traverse (objc_class_tree *tree,
                        int level,
 static void
 objc_preorder_traverse (objc_class_tree *tree,
                        int level,
-                       void (*function)(objc_class_tree*, int))
+                       void (*function) (objc_class_tree *, int))
 {
   struct objc_list *node;
 
 {
   struct objc_list *node;
 
@@ -266,11 +273,12 @@ objc_preorder_traverse (objc_class_tree *tree,
     objc_preorder_traverse (node->head, level + 1, function);
 }
 
     objc_preorder_traverse (node->head, level + 1, function);
 }
 
-/* Traverse tree in postorder. Used to destroy a tree. */
+/* Traverse tree in postorder. Used to destroy a tree.  */
+
 static void
 objc_postorder_traverse (objc_class_tree *tree,
 static void
 objc_postorder_traverse (objc_class_tree *tree,
-                       int level,
-                       void (*function)(objc_class_tree*, int))
+                        int level,
+                        void (*function) (objc_class_tree *, int))
 {
   struct objc_list *node;
 
 {
   struct objc_list *node;
 
@@ -279,7 +287,8 @@ objc_postorder_traverse (objc_class_tree *tree,
   (*function) (tree, level);
 }
 
   (*function) (tree, level);
 }
 
-/* Used to print a tree class hierarchy. */
+/* Used to print a tree class hierarchy.  */
+
 #ifdef DEBUG
 static void
 __objc_tree_print (objc_class_tree *tree, int level)
 #ifdef DEBUG
 static void
 __objc_tree_print (objc_class_tree *tree, int level)
@@ -292,35 +301,37 @@ __objc_tree_print (objc_class_tree *tree, int level)
 }
 #endif
 
 }
 #endif
 
-/* Walks on a linked list of methods in the reverse order and executes all
-   the methods corresponding to `op' selector. Walking in the reverse order
-   assures the +load of class is executed first and then +load of categories
-   because of the way in which categories are added to the class methods. */
+/* Walks on a linked list of methods in the reverse order and executes
+   all the methods corresponding to `op' selector. Walking in the
+   reverse order assures the +load of class is executed first and then
+   +load of categories because of the way in which categories are
+   added to the class methods.  */
+
 static void
 __objc_send_message_in_list (MethodList_t method_list, Class class, SEL op)
 {
   int i;
 
 static void
 __objc_send_message_in_list (MethodList_t method_list, Class class, SEL op)
 {
   int i;
 
-  if (!method_list)
+  if (! method_list)
     return;
 
   /* First execute the `op' message in the following method lists */
   __objc_send_message_in_list (method_list->method_next, class, op);
 
     return;
 
   /* First execute the `op' message in the following method lists */
   __objc_send_message_in_list (method_list->method_next, class, op);
 
-  /* Search the method list. */
+  /* Search the method list.  */
   for (i = 0; i < method_list->method_count; i++)
     {
       Method_t mth = &method_list->method_list[i];
 
       if (mth->method_name && sel_eq (mth->method_name, op)
   for (i = 0; i < method_list->method_count; i++)
     {
       Method_t mth = &method_list->method_list[i];
 
       if (mth->method_name && sel_eq (mth->method_name, op)
-         && !hash_is_key_in_hash (__objc_load_methods, mth->method_imp))
+         && ! hash_is_key_in_hash (__objc_load_methods, mth->method_imp))
        {
          /* Add this method into the +load hash table */
          hash_add (&__objc_load_methods, mth->method_imp, mth->method_imp);
 
          DEBUG_PRINTF ("sending +load in class: %s\n", class->name);
 
        {
          /* Add this method into the +load hash table */
          hash_add (&__objc_load_methods, mth->method_imp, mth->method_imp);
 
          DEBUG_PRINTF ("sending +load in class: %s\n", class->name);
 
-         /* The method was found and wasn't previously executed. */
+         /* The method was found and wasn't previously executed.  */
          (*mth->method_imp) ((id)class, mth->method_name);
 
          break;
          (*mth->method_imp) ((id)class, mth->method_name);
 
          break;
@@ -336,7 +347,7 @@ __objc_send_load (objc_class_tree *tree,
   Class class = tree->class;
   MethodList_t method_list = class->class_pointer->methods;
 
   Class class = tree->class;
   MethodList_t method_list = class->class_pointer->methods;
 
-  if (!load_sel)
+  if (! load_sel)
     load_sel = sel_register_name ("load");
 
   __objc_send_message_in_list (method_list, class, load_sel);
     load_sel = sel_register_name ("load");
 
   __objc_send_message_in_list (method_list, class, load_sel);
@@ -349,8 +360,9 @@ __objc_destroy_class_tree_node (objc_class_tree *tree,
   objc_free (tree);
 }
 
   objc_free (tree);
 }
 
-/* This is used to check if the relationship between two classes before the
-   runtime completely installs the classes. */
+/* This is used to check if the relationship between two classes
+   before the runtime completely installs the classes.  */
+
 static BOOL
 class_is_subclass_of_class (Class class, Class superclass)
 {
 static BOOL
 class_is_subclass_of_class (Class class, Class superclass)
 {
@@ -359,19 +371,19 @@ class_is_subclass_of_class (Class class, Class superclass)
       if (class == superclass)
        return YES;
       class = (class->super_class ?
       if (class == superclass)
        return YES;
       class = (class->super_class ?
-                 objc_lookup_class ((char*)class->super_class)
+                 objc_lookup_class ((char *) class->super_class)
                : Nil);
     }
 
   return NO;
 }
 
                : Nil);
     }
 
   return NO;
 }
 
-/* This list contains all the classes in the runtime system for whom their
-   superclasses are not yet know to the runtime. */
-static struct objc_listunresolved_classes = 0;
+/* This list contains all the classes in the runtime system for whom
+   their superclasses are not yet known to the runtime.  */
+static struct objc_list *unresolved_classes = 0;
 
 
-/* Extern function used to reference the Object and NXConstantString classes.
- */
+/* Extern function used to reference the Object and NXConstantString
  classes.  */
 
 extern void __objc_force_linking (void);
 
 
 extern void __objc_force_linking (void);
 
@@ -382,15 +394,16 @@ __objc_force_linking (void)
   __objc_linking ();
 }
 
   __objc_linking ();
 }
 
-/* Run through the statics list, removing modules as soon as all its statics
-   have been initialized.  */
+/* Run through the statics list, removing modules as soon as all its
+   statics have been initialized.  */
+
 static void
 objc_init_statics (void)
 {
   struct objc_list **cell = &uninitialized_statics;
   struct objc_static_instances **statics_in_module;
 
 static void
 objc_init_statics (void)
 {
   struct objc_list **cell = &uninitialized_statics;
   struct objc_static_instances **statics_in_module;
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
   while (*cell)
     {
 
   while (*cell)
     {
@@ -402,7 +415,7 @@ objc_init_statics (void)
          struct objc_static_instances *statics = *statics_in_module;
          Class class = objc_lookup_class (statics->class_name);
 
          struct objc_static_instances *statics = *statics_in_module;
          Class class = objc_lookup_class (statics->class_name);
 
-         if (!class)
+         if (! class)
            module_initialized = 0;
          /* Actually, the static's class_pointer will be NULL when we
              haven't been here before.  However, the comparison is to be
            module_initialized = 0;
          /* Actually, the static's class_pointer will be NULL when we
              haven't been here before.  However, the comparison is to be
@@ -432,19 +445,19 @@ objc_init_statics (void)
          /* Remove this module from the uninitialized list.  */
          struct objc_list *this = *cell;
          *cell = this->tail;
          /* Remove this module from the uninitialized list.  */
          struct objc_list *this = *cell;
          *cell = this->tail;
-         objc_free(this);
+         objc_free (this);
        }
       else
        cell = &(*cell)->tail;
     }
 
        }
       else
        cell = &(*cell)->tail;
     }
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 } /* objc_init_statics */
 
 /* This function is called by constructor functions generated for each
 } /* objc_init_statics */
 
 /* This function is called by constructor functions generated for each
-   module compiled.  (_GLOBAL_$I$...) The purpose of this function is to
-   gather the module pointers so that they may be processed by the
-   initialization routines as soon as possible */
+   module compiled.  (_GLOBAL_$I$...) The purpose of this function is
+   to gather the module pointers so that they may be processed by the
+   initialization routines as soon as possible */
 
 void
 __objc_exec_class (Module_t module)
 
 void
 __objc_exec_class (Module_t module)
@@ -453,7 +466,7 @@ __objc_exec_class (Module_t module)
      indicate that some global data structures need to be built.  */
   static BOOL previous_constructors = 0;
 
      indicate that some global data structures need to be built.  */
   static BOOL previous_constructors = 0;
 
-  static struct objc_listunclaimed_categories = 0;
+  static struct objc_list *unclaimed_categories = 0;
 
   /* The symbol table (defined in objc-api.h) generated by gcc */
   Symtab_t symtab = module->symtab;
 
   /* The symbol table (defined in objc-api.h) generated by gcc */
   Symtab_t symtab = module->symtab;
@@ -463,7 +476,7 @@ __objc_exec_class (Module_t module)
     = symtab->defs[symtab->cls_def_cnt + symtab->cat_def_cnt];
 
   /* Entry used to traverse hash lists */
     = symtab->defs[symtab->cls_def_cnt + symtab->cat_def_cnt];
 
   /* Entry used to traverse hash lists */
-  struct objc_list** cell;
+  struct objc_list **cell;
 
   /* The table of selector references for this module */
   SEL selectors = symtab->refs; 
 
   /* The table of selector references for this module */
   SEL selectors = symtab->refs; 
@@ -474,19 +487,19 @@ __objc_exec_class (Module_t module)
   DEBUG_PRINTF ("received module: %s\n", module->name);
 
   /* check gcc version */
   DEBUG_PRINTF ("received module: %s\n", module->name);
 
   /* check gcc version */
-  init_check_module_version(module);
+  init_check_module_version (module);
 
   /* On the first call of this routine, initialize some data structures.  */
 
   /* On the first call of this routine, initialize some data structures.  */
-  if (!previous_constructors)
+  if (! previous_constructors)
     {
        /* Initialize thread-safe system */
     {
        /* Initialize thread-safe system */
-      __objc_init_thread_system();
+      __objc_init_thread_system ();
       __objc_runtime_threads_alive = 1;
       __objc_runtime_threads_alive = 1;
-      __objc_runtime_mutex = objc_mutex_allocate();
+      __objc_runtime_mutex = objc_mutex_allocate ();
 
 
-      __objc_init_selector_tables();
-      __objc_init_class_tables();
-      __objc_init_dispatch_tables();
+      __objc_init_selector_tables ();
+      __objc_init_class_tables ();
+      __objc_init_dispatch_tables ();
       __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
       __objc_load_methods
          = hash_new (128, (hash_func_type)hash_ptr, compare_ptrs);
       __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
       __objc_load_methods
          = hash_new (128, (hash_func_type)hash_ptr, compare_ptrs);
@@ -494,8 +507,8 @@ __objc_exec_class (Module_t module)
     }
 
   /* Save the module pointer for later processing. (not currently used) */
     }
 
   /* Save the module pointer for later processing. (not currently used) */
-  objc_mutex_lock(__objc_runtime_mutex);
-  __objc_module_list = list_cons(module, __objc_module_list);
+  objc_mutex_lock (__objc_runtime_mutex);
+  __objc_module_list = list_cons (module, __objc_module_list);
 
   /* Replace referenced selectors from names to SEL's.  */
   if (selectors)
 
   /* Replace referenced selectors from names to SEL's.  */
   if (selectors)
@@ -503,12 +516,12 @@ __objc_exec_class (Module_t module)
       for (i = 0; selectors[i].sel_id; ++i)
        {
          const char *name, *type;
       for (i = 0; selectors[i].sel_id; ++i)
        {
          const char *name, *type;
-         name = (char*)selectors[i].sel_id;
-         type = (char*)selectors[i].sel_types;
+         name = (char *) selectors[i].sel_id;
+         type = (char *) selectors[i].sel_types;
          /* Constructors are constant static data so we can safely store
             pointers to them in the runtime structures. is_const == YES */
          __sel_register_typed_name (name, type, 
          /* Constructors are constant static data so we can safely store
             pointers to them in the runtime structures. is_const == YES */
          __sel_register_typed_name (name, type, 
-                                    (struct objc_selector*)&(selectors[i]),
+                                    (struct objc_selector *) &(selectors[i]),
                                     YES);
        }
     }
                                     YES);
        }
     }
@@ -518,15 +531,15 @@ __objc_exec_class (Module_t module)
   for (i = 0; i < symtab->cls_def_cnt; ++i)
     {
       Class class = (Class) symtab->defs[i];
   for (i = 0; i < symtab->cls_def_cnt; ++i)
     {
       Class class = (Class) symtab->defs[i];
-      const char* superclass = (char*)class->super_class;
+      const char *superclass = (char *) class->super_class;
 
       /* Make sure we have what we think.  */
 
       /* Make sure we have what we think.  */
-      assert (CLS_ISCLASS(class));
-      assert (CLS_ISMETA(class->class_pointer));
+      assert (CLS_ISCLASS (class));
+      assert (CLS_ISMETA (class->class_pointer));
       DEBUG_PRINTF ("phase 1, processing class: %s\n", class->name);
 
       /* Initialize the subclass list to be NULL.
       DEBUG_PRINTF ("phase 1, processing class: %s\n", class->name);
 
       /* Initialize the subclass list to be NULL.
-        In some cases it isn't and this crashes the program. */
+        In some cases it isn't and this crashes the program.  */
       class->subclass_list = NULL;
 
       /* Store the class in the class table and assign class numbers.  */
       class->subclass_list = NULL;
 
       /* Store the class in the class table and assign class numbers.  */
@@ -537,19 +550,19 @@ __objc_exec_class (Module_t module)
       __objc_register_selectors_from_class ((Class) class->class_pointer);
 
       /* Install the fake dispatch tables */
       __objc_register_selectors_from_class ((Class) class->class_pointer);
 
       /* Install the fake dispatch tables */
-      __objc_install_premature_dtable(class);
-      __objc_install_premature_dtable(class->class_pointer);
+      __objc_install_premature_dtable (class);
+      __objc_install_premature_dtable (class->class_pointer);
 
       /* Register the instance methods as class methods, this is
 
       /* Register the instance methods as class methods, this is
-        only done for root classes. */
-      __objc_register_instance_methods_to_class(class);
+        only done for root classes.  */
+      __objc_register_instance_methods_to_class (class);
 
       if (class->protocols)
        __objc_init_protocols (class->protocols);
 
       /* Check to see if the superclass is known in this point. If it's not
 
       if (class->protocols)
        __objc_init_protocols (class->protocols);
 
       /* Check to see if the superclass is known in this point. If it's not
-        add the class to the unresolved_classes list. */
-      if (superclass && !objc_lookup_class (superclass))
+        add the class to the unresolved_classes list.  */
+      if (superclass && ! objc_lookup_class (superclass))
        unresolved_classes = list_cons (class, unresolved_classes);
    }
 
        unresolved_classes = list_cons (class, unresolved_classes);
    }
 
@@ -583,14 +596,14 @@ __objc_exec_class (Module_t module)
            }
 
           /* Register the instance methods as class methods, this is
            }
 
           /* Register the instance methods as class methods, this is
-             only done for root classes. */
-          __objc_register_instance_methods_to_class(class);
+             only done for root classes.  */
+          __objc_register_instance_methods_to_class (class);
        }
       else
        {
          /* The object to which the category methods belong can't be found.
             Save the information.  */
        }
       else
        {
          /* The object to which the category methods belong can't be found.
             Save the information.  */
-         unclaimed_categories = list_cons(category, unclaimed_categories);
+         unclaimed_categories = list_cons (category, unclaimed_categories);
        }
     }
 
        }
     }
 
@@ -627,8 +640,8 @@ __objc_exec_class (Module_t module)
            }
 
           /* Register the instance methods as class methods, this is
            }
 
           /* Register the instance methods as class methods, this is
-             only done for root classes. */
-          __objc_register_instance_methods_to_class(class);
+             only done for root classes.  */
+          __objc_register_instance_methods_to_class (class);
        }
       else
        cell = &(*cell)->tail;
        }
       else
        cell = &(*cell)->tail;
@@ -636,30 +649,32 @@ __objc_exec_class (Module_t module)
   
   if (unclaimed_proto_list && objc_lookup_class ("Protocol"))
     {
   
   if (unclaimed_proto_list && objc_lookup_class ("Protocol"))
     {
-      list_mapcar (unclaimed_proto_list,(void(*)(void*))__objc_init_protocols);
+      list_mapcar (unclaimed_proto_list,
+                  (void (*) (void *))__objc_init_protocols);
       list_free (unclaimed_proto_list);
       unclaimed_proto_list = 0;
     }
 
   objc_send_load ();
 
       list_free (unclaimed_proto_list);
       unclaimed_proto_list = 0;
     }
 
   objc_send_load ();
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 }
 
 }
 
-static void objc_send_load (void)
+static void
+objc_send_load (void)
 {
 {
-  if (!__objc_module_list)
+  if (! __objc_module_list)
     return;
  
   /* Try to find out if all the classes loaded so far also have their
     return;
  
   /* Try to find out if all the classes loaded so far also have their
-     superclasses known to the runtime. We suppose that the objects that are
-     allocated in the +load method are in general of a class declared in the
-     same module. */
+     superclasses known to the runtime. We suppose that the objects
+     that are allocated in the +load method are in general of a class
+     declared in the same module.  */
   if (unresolved_classes)
     {
       Class class = unresolved_classes->head;
 
   if (unresolved_classes)
     {
       Class class = unresolved_classes->head;
 
-      while (objc_lookup_class ((char*)class->super_class))
+      while (objc_lookup_class ((char *) class->super_class))
        {
          list_remove_head (&unresolved_classes);
          if (unresolved_classes)
        {
          list_remove_head (&unresolved_classes);
          if (unresolved_classes)
@@ -668,25 +683,25 @@ static void objc_send_load (void)
            break;
        }
 
            break;
        }
 
-      /*
-       * If we still have classes for whom we don't have yet their super
-       * classes known to the runtime we don't send the +load messages.
-       */
+      /* If we still have classes for whom we don't have yet their
+         super classes known to the runtime we don't send the +load
+         messages.  */
       if (unresolved_classes)
        return;
     }
 
       if (unresolved_classes)
        return;
     }
 
-  /* Special check to allow creating and sending messages to constant strings
-     in +load methods. If these classes are not yet known, even if all the
-     other classes are known, delay sending of +load. */
-  if (!objc_lookup_class ("NXConstantString") ||
-      !objc_lookup_class ("Object"))
+  /* Special check to allow creating and sending messages to constant
+     strings in +load methods. If these classes are not yet known,
+     even if all the other classes are known, delay sending of +load.  */
+  if (! objc_lookup_class ("NXConstantString") ||
+      ! objc_lookup_class ("Object"))
     return;
 
     return;
 
-  /* Iterate over all modules in the __objc_module_list and call on them the
-     __objc_create_classes_tree function. This function creates a tree of
-     classes that resembles the class hierarchy. */
-  list_mapcar (__objc_module_list, (void(*)(void*))__objc_create_classes_tree);
+  /* Iterate over all modules in the __objc_module_list and call on
+     them the __objc_create_classes_tree function. This function
+     creates a tree of classes that resembles the class hierarchy.  */
+  list_mapcar (__objc_module_list,
+              (void (*) (void *)) __objc_create_classes_tree);
 
   while (__objc_class_tree_list)
     {
 
   while (__objc_class_tree_list)
     {
@@ -701,7 +716,7 @@ static void objc_send_load (void)
       list_remove_head (&__objc_class_tree_list);
     }
 
       list_remove_head (&__objc_class_tree_list);
     }
 
-  list_mapcar (__objc_module_list, (void(*)(void*))__objc_call_callback);
+  list_mapcar (__objc_module_list, (void (*) (void *)) __objc_call_callback);
   list_free (__objc_module_list);
   __objc_module_list = NULL;
 }
   list_free (__objc_module_list);
   __objc_module_list = NULL;
 }
@@ -714,8 +729,8 @@ __objc_create_classes_tree (Module_t module)
   Symtab_t symtab = module->symtab;
   int i;
 
   Symtab_t symtab = module->symtab;
   int i;
 
-  /* Iterate thru classes defined in this module and insert them in the classes
-     tree hierarchy. */
+  /* Iterate thru classes defined in this module and insert them in
+     the classes tree hierarchy.  */
   for (i = 0; i < symtab->cls_def_cnt; i++)
     {
       Class class = (Class) symtab->defs[i];
   for (i = 0; i < symtab->cls_def_cnt; i++)
     {
       Class class = (Class) symtab->defs[i];
@@ -727,56 +742,58 @@ __objc_create_classes_tree (Module_t module)
 static void
 __objc_call_callback (Module_t module)
 {
 static void
 __objc_call_callback (Module_t module)
 {
-  /* The runtime mutex is locked in this point */
+  /* The runtime mutex is locked in this point */
 
   Symtab_t symtab = module->symtab;
   int i;
 
 
   Symtab_t symtab = module->symtab;
   int i;
 
-  /* Iterate thru classes defined in this module and call the callback for
-     each one. */
+  /* Iterate thru classes defined in this module and call the callback
+     for each one.  */
   for (i = 0; i < symtab->cls_def_cnt; i++)
     {
       Class class = (Class) symtab->defs[i];
 
   for (i = 0; i < symtab->cls_def_cnt; i++)
     {
       Class class = (Class) symtab->defs[i];
 
-      /* Call the _objc_load_callback for this class. */
+      /* Call the _objc_load_callback for this class.  */
       if (_objc_load_callback)
       if (_objc_load_callback)
-       _objc_load_callback(class, 0);
+       _objc_load_callback (class, 0);
     }
 
     }
 
-  /* Call the _objc_load_callback for categories. Don't register the instance
-     methods as class methods for categories to root classes since they were
-     already added in the class. */
+  /* Call the _objc_load_callback for categories. Don't register the
+     instance methods as class methods for categories to root classes
+     since they were already added in the class.  */
   for (i = 0; i < symtab->cat_def_cnt; i++)
     {
       Category_t category = symtab->defs[i + symtab->cls_def_cnt];
       Class class = objc_lookup_class (category->class_name);
       
       if (_objc_load_callback)
   for (i = 0; i < symtab->cat_def_cnt; i++)
     {
       Category_t category = symtab->defs[i + symtab->cls_def_cnt];
       Class class = objc_lookup_class (category->class_name);
       
       if (_objc_load_callback)
-       _objc_load_callback(class, category);
+       _objc_load_callback (class, category);
     }
 }
 
     }
 }
 
-/* Sanity check the version of gcc used to compile `module'*/
-static void init_check_module_version(Module_t module)
+/* Sanity check the version of gcc used to compile `module'.  */
+
+static void
+init_check_module_version (Module_t module)
 {
   if ((module->version != OBJC_VERSION) || (module->size != sizeof (Module)))
     {
       int code;
 
 {
   if ((module->version != OBJC_VERSION) || (module->size != sizeof (Module)))
     {
       int code;
 
-      if(module->version > OBJC_VERSION)
+      if (module->version > OBJC_VERSION)
        code = OBJC_ERR_OBJC_VERSION;
       else if (module->version < OBJC_VERSION)
        code = OBJC_ERR_GCC_VERSION;
       else
        code = OBJC_ERR_MODULE_SIZE;
 
        code = OBJC_ERR_OBJC_VERSION;
       else if (module->version < OBJC_VERSION)
        code = OBJC_ERR_GCC_VERSION;
       else
        code = OBJC_ERR_MODULE_SIZE;
 
-      objc_error(nil, code, "Module %s version %d doesn't match runtime %d\n",
-              module->name, (int)module->version, OBJC_VERSION);
+      objc_error (nil, code, "Module %s version %d doesn't match runtime %d\n",
+                 module->name, (int)module->version, OBJC_VERSION);
     }
 }
 
 static void
     }
 }
 
 static void
-__objc_init_protocols (struct objc_protocol_listprotos)
+__objc_init_protocols (struct objc_protocol_list *protos)
 {
   size_t i;
   static Class proto_class = 0;
 {
   size_t i;
   static Class proto_class = 0;
@@ -784,15 +801,15 @@ __objc_init_protocols (struct objc_protocol_list* protos)
   if (! protos)
     return;
 
   if (! protos)
     return;
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
 
-  if (!proto_class)
-    proto_class = objc_lookup_class("Protocol");
+  if (! proto_class)
+    proto_class = objc_lookup_class ("Protocol");
 
 
-  if (!proto_class)
+  if (! proto_class)
     {
       unclaimed_proto_list = list_cons (protos, unclaimed_proto_list);
     {
       unclaimed_proto_list = list_cons (protos, unclaimed_proto_list);
-      objc_mutex_unlock(__objc_runtime_mutex);
+      objc_mutex_unlock (__objc_runtime_mutex);
       return;
     }
 
       return;
     }
 
@@ -800,9 +817,9 @@ __objc_init_protocols (struct objc_protocol_list* protos)
   assert (protos->next == 0);  /* only single ones allowed */
 #endif
 
   assert (protos->next == 0);  /* only single ones allowed */
 #endif
 
-  for(i = 0; i < protos->count; i++)
+  for (i = 0; i < protos->count; i++)
     {
     {
-      struct objc_protocolaProto = protos->list[i];
+      struct objc_protocol *aProto = protos->list[i];
       if (((size_t)aProto->class_pointer) == PROTOCOL_VERSION)
        {
          /* assign class pointer */
       if (((size_t)aProto->class_pointer) == PROTOCOL_VERSION)
        {
          /* assign class pointer */
@@ -813,24 +830,25 @@ __objc_init_protocols (struct objc_protocol_list* protos)
        }
       else if (protos->list[i]->class_pointer != proto_class)
        {
        }
       else if (protos->list[i]->class_pointer != proto_class)
        {
-         objc_error(nil, OBJC_ERR_PROTOCOL_VERSION,
+         objc_error (nil, OBJC_ERR_PROTOCOL_VERSION,
                     "Version %d doesn't match runtime protocol version %d\n",
                     "Version %d doesn't match runtime protocol version %d\n",
-                    (int)((char*)protos->list[i]->class_pointer-(char*)0),
+                    (int) ((char *) protos->list[i]->class_pointer
+                           - (char *) 0),
                     PROTOCOL_VERSION);
        }
     }
 
                     PROTOCOL_VERSION);
        }
     }
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 }
 
 }
 
-static void __objc_class_add_protocols (Class class,
-                                       struct objc_protocol_list* protos)
+static void
+__objc_class_add_protocols (Class class, struct objc_protocol_list *protos)
 {
 {
-  /* Well... */
+  /* Well...  */
   if (! protos)
     return;
 
   if (! protos)
     return;
 
-  /* Add it... */
+  /* Add it...  */
   protos->next = class->protocols;
   class->protocols = protos;
 }
   protos->next = class->protocols;
   class->protocols = protos;
 }
index 7339888..9572d3f 100644 (file)
@@ -1,5 +1,6 @@
 /* GNU Objective C Runtime Miscellaneous 
 /* GNU Objective C Runtime Miscellaneous 
-   Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 1997, 2002
+   Free Software Foundation, Inc.
    Contributed by Kresten Krab Thorup
 
 This file is part of GNU CC.
    Contributed by Kresten Krab Thorup
 
 This file is part of GNU CC.
@@ -37,25 +38,25 @@ static objc_error_handler _objc_error_handler = NULL;
 
 /* Trigger an objc error */
 void
 
 /* Trigger an objc error */
 void
-objc_error(id object, int code, const char* fmt, ...)
+objc_error (id object, int code, const char *fmt, ...)
 {
   va_list ap;
 
 {
   va_list ap;
 
-  va_start(ap, fmt);
-  objc_verror(object, code, fmt, ap);
-  va_end(ap);
+  va_start (ap, fmt);
+  objc_verror (object, code, fmt, ap);
+  va_end (ap);
 }
 
 /* Trigger an objc error */
 void
 }
 
 /* Trigger an objc error */
 void
-objc_verror(id object, int code, const char* fmt, va_list ap)
+objc_verror (id object, int code, const char *fmt, va_list ap)
 {
   BOOL result = NO;
 
   /* Call the error handler if its there
      Otherwise print to stderr */
   if (_objc_error_handler)
 {
   BOOL result = NO;
 
   /* Call the error handler if its there
      Otherwise print to stderr */
   if (_objc_error_handler)
-    result = (*_objc_error_handler)(object, code, fmt, ap);
+    result = (*_objc_error_handler) (object, code, fmt, ap);
   else
     vfprintf (stderr, fmt, ap);
 
   else
     vfprintf (stderr, fmt, ap);
 
@@ -64,12 +65,12 @@ objc_verror(id object, int code, const char* fmt, va_list ap)
   if (result)
     return;
   else
   if (result)
     return;
   else
-    abort();
+    abort ();
 }
 
 /* Set the error handler */
 objc_error_handler
 }
 
 /* Set the error handler */
 objc_error_handler
-objc_set_error_handler(objc_error_handler func)
+objc_set_error_handler (objc_error_handler func)
 {
   objc_error_handler temp = _objc_error_handler;
   _objc_error_handler = func;
 {
   objc_error_handler temp = _objc_error_handler;
   _objc_error_handler = func;
@@ -84,54 +85,54 @@ objc_set_error_handler(objc_error_handler func)
 */
 
 void *
 */
 
 void *
-objc_malloc(size_t size)
+objc_malloc (size_t size)
 {
 {
-  void* res = (void*) (*_objc_malloc)(size);
-  if(!res)
-    objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
+  void *res = (void *) (*_objc_malloc) (size);
+  if (! res)
+    objc_error (nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
   return res;
 }
 
 void *
   return res;
 }
 
 void *
-objc_atomic_malloc(size_t size)
+objc_atomic_malloc (size_t size)
 {
 {
-  void* res = (void*) (*_objc_atomic_malloc)(size);
-  if(!res)
-    objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
+  void *res = (void *) (*_objc_atomic_malloc) (size);
+  if (! res)
+    objc_error (nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
   return res;
 }
 
 void *
   return res;
 }
 
 void *
-objc_valloc(size_t size)
+objc_valloc (size_t size)
 {
 {
-  void* res = (void*) (*_objc_valloc)(size);
-  if(!res)
-    objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
+  void *res = (void *) (*_objc_valloc) (size);
+  if (! res)
+    objc_error (nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
   return res;
 }
 
 void *
   return res;
 }
 
 void *
-objc_realloc(void *mem, size_t size)
+objc_realloc (void *mem, size_t size)
 {
 {
-  void* res = (void*) (*_objc_realloc)(mem, size);
-  if(!res)
-    objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
+  void *res = (void *) (*_objc_realloc) (mem, size);
+  if (! res)
+    objc_error (nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
   return res;
 }
 
 void *
   return res;
 }
 
 void *
-objc_calloc(size_t nelem, size_t size)
+objc_calloc (size_t nelem, size_t size)
 {
 {
-  void* res = (void*) (*_objc_calloc)(nelem, size);
-  if(!res)
-    objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
+  void *res = (void *) (*_objc_calloc) (nelem, size);
+  if (! res)
+    objc_error (nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
   return res;
 }
 
 void
   return res;
 }
 
 void
-objc_free(void *mem)
+objc_free (void *mem)
 {
 {
-  (*_objc_free)(mem);
+  (*_objc_free) (mem);
 }
 
 /*
 }
 
 /*
@@ -148,33 +149,37 @@ objc_free(void *mem)
 #if OBJC_WITH_GC
 #include <gc.h>
 
 #if OBJC_WITH_GC
 #include <gc.h>
 
-static void *GC_calloc (size_t nelem, size_t size)
+static void *
+GC_calloc (size_t nelem, size_t size)
 {
 {
-  voidp = GC_malloc (nelem * size);
-  if (!p)
+  void *p = GC_malloc (nelem * size);
+  if (! p)
     objc_error (nil, OBJC_ERR_MEMORY, "Virtual memory exhausted!\n");
 
   memset (p, 0, nelem * size);
   return p;
 }
 
     objc_error (nil, OBJC_ERR_MEMORY, "Virtual memory exhausted!\n");
 
   memset (p, 0, nelem * size);
   return p;
 }
 
-static void noFree (void* p) {}
+static void
+noFree (void *p)
+{
+}
 
 
-void *(*_objc_malloc)(size_t) = GC_malloc;
-void *(*_objc_atomic_malloc)(size_t) = GC_malloc_atomic;
-void *(*_objc_valloc)(size_t) = GC_malloc;
-void *(*_objc_realloc)(void *, size_t) = GC_realloc;
-void *(*_objc_calloc)(size_t, size_t) = GC_calloc;
-void (*_objc_free)(void *) = noFree;
+void *(*_objc_malloc) (size_t) = GC_malloc;
+void *(*_objc_atomic_malloc) (size_t) = GC_malloc_atomic;
+void *(*_objc_valloc) (size_t) = GC_malloc;
+void *(*_objc_realloc) (void *, size_t) = GC_realloc;
+void *(*_objc_calloc) (size_t, size_t) = GC_calloc;
+void (*_objc_free) (void *) = noFree;
 
 
-#else
+#else  /* !OBJC_WITH_GC */
 
 
-void *(*_objc_malloc)(size_t) = malloc;
-void *(*_objc_atomic_malloc)(size_t) = malloc;
-void *(*_objc_valloc)(size_t) = malloc;
-void *(*_objc_realloc)(void *, size_t) = realloc;
-void *(*_objc_calloc)(size_t, size_t) = calloc;
-void (*_objc_free)(void *) = free;
+void *(*_objc_malloc) (size_t) = malloc;
+void *(*_objc_atomic_malloc) (size_t) = malloc;
+void *(*_objc_valloc) (size_t) = malloc;
+void *(*_objc_realloc) (void *, size_t) = realloc;
+void *(*_objc_calloc) (size_t, size_t) = calloc;
+void (*_objc_free) (void *) = free;
 
 
 
 
-#endif
+#endif /* !OBJC_WITH_GC */
index 214235b..800b0e3 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU Objective C Runtime nil receiver function
 /* GNU Objective C Runtime nil receiver function
-   Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 1996, 2002 Free Software Foundation, Inc.
    Contributed by Kresten Krab Thorup
 
 This file is part of GNU CC.
    Contributed by Kresten Krab Thorup
 
 This file is part of GNU CC.
@@ -30,11 +30,7 @@ Boston, MA 02111-1307, USA.  */
 #include "runtime.h"
 
 id
 #include "runtime.h"
 
 id
-nil_method(id receiver, SEL op __attribute__ ((__unused__)), ...)
+nil_method (id receiver, SEL op __attribute__ ((__unused__)), ...)
 {
   return receiver;
 }
 {
   return receiver;
 }
-
-
-
-
index b4def43..36a3d89 100644 (file)
@@ -1,5 +1,5 @@
 /* Encoding of types for Objective C.
 /* Encoding of types for Objective C.
-   Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1997, 2002 Free Software Foundation, Inc.
 
 Author: Kresten Krab Thorup
 
 
 Author: Kresten Krab Thorup
 
@@ -50,30 +50,30 @@ Boston, MA 02111-1307, USA.  */
 #define _F_ONEWAY      0x10
 #define _F_GCINVISIBLE 0x20
 
 #define _F_ONEWAY      0x10
 #define _F_GCINVISIBLE 0x20
 
-int objc_aligned_size (const chartype);
-int objc_sizeof_type (const chartype);
-int objc_alignof_type (const chartype);
-int objc_aligned_size (const chartype);
-int objc_promoted_size (const chartype);
+int objc_aligned_size (const char *type);
+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);
-int method_get_number_of_arguments (struct objc_method*);
-int method_get_sizeof_arguments (struct objc_method*);
+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);
+int method_get_number_of_arguments (struct objc_method *);
+int method_get_sizeof_arguments (struct objc_method *);
 
 
-char* method_get_first_argument (struct objc_method*,
+char *method_get_first_argument (struct objc_method *,
                                 arglist_t argframe, 
                                 arglist_t argframe, 
-                                const char** type);
-charmethod_get_next_argument (arglist_t argframe, 
+                                const char **type);
+char *method_get_next_argument (arglist_t argframe, 
                                const char **type);
                                const char **type);
-char* method_get_nth_argument (struct objc_method* m, 
+char *method_get_nth_argument (struct objc_method *m, 
                               arglist_t argframe,
                               int arg, 
                               const char **type);
 
                               arglist_t argframe,
                               int arg, 
                               const char **type);
 
-unsigned objc_get_type_qualifiers (const chartype);
+unsigned objc_get_type_qualifiers (const char *type);
 
 
 struct objc_struct_layout 
 
 
 struct objc_struct_layout 
index fc3cc9e..e695012 100644 (file)
@@ -60,7 +60,7 @@ typedef struct cache_node
  * typedef.  Therefore, to remove compiler warnings the functions passed to
  * hash_new will have to be casted to this type. 
  */
  * typedef.  Therefore, to remove compiler warnings the functions passed to
  * hash_new will have to be casted to this type. 
  */
-typedef unsigned int (*hash_func_type)(void *, const void *);
+typedef unsigned int (*hash_func_type) (void *, const void *);
 
 /*
  * This data type is the function that compares two hash keys and returns an
 
 /*
  * This data type is the function that compares two hash keys and returns an
@@ -69,7 +69,7 @@ typedef unsigned int (*hash_func_type)(void *, const void *);
  * second. 
  */
 
  * second. 
  */
 
-typedef int (*compare_func_type)(const void *, const void *);
+typedef int (*compare_func_type) (const void *, const void *);
 
 
 /*
 
 
 /*
@@ -174,8 +174,8 @@ hash_string (cache_ptr cache, const void *key)
   unsigned int ctr = 0;
         
         
   unsigned int ctr = 0;
         
         
-  while (*(char*)key) {
-    ret ^= *(char*)key++ << ctr;
+  while (*(char *) key) {
+    ret ^= *(char *) key++ << ctr;
     ctr = (ctr + 1) % sizeof (void *);
   }
 
     ctr = (ctr + 1) % sizeof (void *);
   }
 
@@ -187,7 +187,7 @@ hash_string (cache_ptr cache, const void *key)
 static inline int 
 compare_ptrs (const void *k1, const void *k2)
 {
 static inline int 
 compare_ptrs (const void *k1, const void *k2)
 {
-  return !(k1 - k2);
+  return ! (k1 - k2);
 }
 
 
 }
 
 
@@ -200,7 +200,7 @@ compare_strings (const void *k1, const void *k2)
   else if (k1 == 0 || k2 == 0)
     return 0;
   else
   else if (k1 == 0 || k2 == 0)
     return 0;
   else
-    return !strcmp (k1, k2);
+    return ! strcmp (k1, k2);
 }
 
 
 }
 
 
index 42403f6..48ad0be 100644 (file)
@@ -1,5 +1,5 @@
 /* Thread and mutex controls for Objective C.
 /* Thread and mutex controls for Objective C.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
    Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
 
 This file is part of GNU CC.
    Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
 
 This file is part of GNU CC.
@@ -74,30 +74,30 @@ struct objc_condition
 typedef struct objc_condition *objc_condition_t;
 
 /* Frontend mutex functions */
 typedef struct objc_condition *objc_condition_t;
 
 /* Frontend mutex functions */
-objc_mutex_t objc_mutex_allocate(void);
-int objc_mutex_deallocate(objc_mutex_t mutex);
-int objc_mutex_lock(objc_mutex_t mutex);
-int objc_mutex_unlock(objc_mutex_t mutex);
-int objc_mutex_trylock(objc_mutex_t mutex);
+objc_mutex_t objc_mutex_allocate (void);
+int objc_mutex_deallocate (objc_mutex_t mutex);
+int objc_mutex_lock (objc_mutex_t mutex);
+int objc_mutex_unlock (objc_mutex_t mutex);
+int objc_mutex_trylock (objc_mutex_t mutex);
 
 /* Frontend condition mutex functions */
 
 /* Frontend condition mutex functions */
-objc_condition_t objc_condition_allocate(void);
-int objc_condition_deallocate(objc_condition_t condition);
-int objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex);
-int objc_condition_signal(objc_condition_t condition);
-int objc_condition_broadcast(objc_condition_t condition);
+objc_condition_t objc_condition_allocate (void);
+int objc_condition_deallocate (objc_condition_t condition);
+int objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex);
+int objc_condition_signal (objc_condition_t condition);
+int objc_condition_broadcast (objc_condition_t condition);
 
 /* Frontend thread functions */
 
 /* Frontend thread functions */
-objc_thread_t objc_thread_detach(SEL selector, id object, id argument);
-void objc_thread_yield(void);
-int objc_thread_exit(void);
-int objc_thread_set_priority(int priority);
-int objc_thread_get_priority(void);
-void * objc_thread_get_data(void);
-int objc_thread_set_data(void *value);
-objc_thread_t objc_thread_id(void);
-void objc_thread_add(void);
-void objc_thread_remove(void);
+objc_thread_t objc_thread_detach (SEL selector, id object, id argument);
+void objc_thread_yield (void);
+int objc_thread_exit (void);
+int objc_thread_set_priority (int priority);
+int objc_thread_get_priority (void);
+void * objc_thread_get_data (void);
+int objc_thread_set_data (void *value);
+objc_thread_t objc_thread_id (void);
+void objc_thread_add (void);
+void objc_thread_remove (void);
 
 /*
   Use this to set the hook function that will be called when the 
 
 /*
   Use this to set the hook function that will be called when the 
@@ -111,35 +111,35 @@ void objc_thread_remove(void);
   it can be informed; for example, the GNUstep Base Library sets it 
   so it can implement the NSBecomingMultiThreaded notification.
   */
   it can be informed; for example, the GNUstep Base Library sets it 
   so it can implement the NSBecomingMultiThreaded notification.
   */
-typedef void (*objc_thread_callback)(void);
-objc_thread_callback objc_set_thread_callback(objc_thread_callback func);
+typedef void (*objc_thread_callback) (void);
+objc_thread_callback objc_set_thread_callback (objc_thread_callback func);
 
 /* Backend initialization functions */
 
 /* Backend initialization functions */
-int __objc_init_thread_system(void);
-int __objc_fini_thread_system(void);
+int __objc_init_thread_system (void);
+int __objc_fini_thread_system (void);
 
 /* Backend mutex functions */
 
 /* Backend mutex functions */
-int __objc_mutex_allocate(objc_mutex_t mutex);
-int __objc_mutex_deallocate(objc_mutex_t mutex);
-int __objc_mutex_lock(objc_mutex_t mutex);
-int __objc_mutex_trylock(objc_mutex_t mutex);
-int __objc_mutex_unlock(objc_mutex_t mutex);
+int __objc_mutex_allocate (objc_mutex_t mutex);
+int __objc_mutex_deallocate (objc_mutex_t mutex);
+int __objc_mutex_lock (objc_mutex_t mutex);
+int __objc_mutex_trylock (objc_mutex_t mutex);
+int __objc_mutex_unlock (objc_mutex_t mutex);
 
 /* Backend condition mutex functions */
 
 /* Backend condition mutex functions */
-int __objc_condition_allocate(objc_condition_t condition);
-int __objc_condition_deallocate(objc_condition_t condition);
-int __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex);
-int __objc_condition_broadcast(objc_condition_t condition);
-int __objc_condition_signal(objc_condition_t condition);
+int __objc_condition_allocate (objc_condition_t condition);
+int __objc_condition_deallocate (objc_condition_t condition);
+int __objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex);
+int __objc_condition_broadcast (objc_condition_t condition);
+int __objc_condition_signal (objc_condition_t condition);
 
 /* Backend thread functions */
 
 /* Backend thread functions */
-objc_thread_t __objc_thread_detach(void (*func)(void *arg), void *arg);
-int __objc_thread_set_priority(int priority);
-int __objc_thread_get_priority(void);
-void __objc_thread_yield(void);
-int __objc_thread_exit(void);
-objc_thread_t __objc_thread_id(void);
-int __objc_thread_set_data(void *value);
-void * __objc_thread_get_data(void);
+objc_thread_t __objc_thread_detach (void (*func) (void *arg), void *arg);
+int __objc_thread_set_priority (int priority);
+int __objc_thread_get_priority (void);
+void __objc_thread_yield (void);
+int __objc_thread_exit (void);
+objc_thread_t __objc_thread_id (void);
+int __objc_thread_set_data (void *value);
+void * __objc_thread_get_data (void);
 
 #endif /* not __thread_INCLUDE_GNU */
 
 #endif /* not __thread_INCLUDE_GNU */
index df74b85..6858fed 100644 (file)
@@ -32,29 +32,29 @@ Boston, MA 02111-1307, USA.  */
 # include <gc.h>
 #endif
 
 # include <gc.h>
 #endif
 
-id __objc_object_alloc(Class);
-id __objc_object_dispose(id);
-id __objc_object_copy(id);
+id __objc_object_alloc (Class);
+id __objc_object_dispose (id);
+id __objc_object_copy (id);
 
 
-id (*_objc_object_alloc)(Class)   = __objc_object_alloc;   /* !T:SINGLE */ 
-id (*_objc_object_dispose)(id)    = __objc_object_dispose; /* !T:SINGLE */
-id (*_objc_object_copy)(id)       = __objc_object_copy;    /* !T:SINGLE */
+id (*_objc_object_alloc) (Class)   = __objc_object_alloc;   /* !T:SINGLE */ 
+id (*_objc_object_dispose) (id)    = __objc_object_dispose; /* !T:SINGLE */
+id (*_objc_object_copy) (id)       = __objc_object_copy;    /* !T:SINGLE */
 
 id
 
 id
-class_create_instance(Class class)
+class_create_instance (Class class)
 {
   id new = nil;
 
 #if OBJC_WITH_GC
 {
   id new = nil;
 
 #if OBJC_WITH_GC
-  if (CLS_ISCLASS(class))
-    new = (id)GC_malloc_explicitly_typed (class->instance_size,
-                                         class->gc_object_type);
+  if (CLS_ISCLASS (class))
+    new = (id) GC_malloc_explicitly_typed (class->instance_size,
+                                          class->gc_object_type);
 #else
 #else
-  if (CLS_ISCLASS(class))
-    new = (*_objc_object_alloc)(class);
+  if (CLS_ISCLASS (class))
+    new = (*_objc_object_alloc) (class);
 #endif
 
 #endif
 
-  if (new!=nil)
+  if (new != nil)
     {
       memset (new, 0, class->instance_size);
       new->class_pointer = class;
     {
       memset (new, 0, class->instance_size);
       new->class_pointer = class;
@@ -63,43 +63,41 @@ class_create_instance(Class class)
 }
 
 id
 }
 
 id
-object_copy(id object)
+object_copy (id object)
 {
 {
-  if ((object!=nil)&&CLS_ISCLASS(object->class_pointer))
-    return (*_objc_object_copy)(object);
+  if ((object != nil) && CLS_ISCLASS (object->class_pointer))
+    return (*_objc_object_copy) (object);
   else
     return nil;
 }
 
 id
   else
     return nil;
 }
 
 id
-object_dispose(id object)
+object_dispose (id object)
 {
 {
-  if ((object!=nil)&&CLS_ISCLASS(object->class_pointer))
+  if ((object != nil) && CLS_ISCLASS (object->class_pointer))
     {
       if (_objc_object_dispose)
     {
       if (_objc_object_dispose)
-        (*_objc_object_dispose)(object);
+        (*_objc_object_dispose) (object);
       else
       else
-        objc_free(object);
+        objc_free (object);
     }
   return nil;
 }
 
     }
   return nil;
 }
 
-id __objc_object_alloc(Class class)
+id __objc_object_alloc (Class class)
 {
 {
-  return (id)objc_malloc(class->instance_size);
+  return (id) objc_malloc (class->instance_size);
 }
 
 }
 
-id __objc_object_dispose(id object) 
+id __objc_object_dispose (id object) 
 {
 {
-  objc_free(object);
+  objc_free (object);
   return 0;
 }
 
   return 0;
 }
 
-id __objc_object_copy(id object)
+id __objc_object_copy (id object)
 {
 {
-  id copy = class_create_instance(object->class_pointer);
-  memcpy(copy, object, object->class_pointer->instance_size);
+  id copy = class_create_instance (object->class_pointer);
+  memcpy (copy, object, object->class_pointer->instance_size);
   return copy;
 }
   return copy;
 }
-
-
index 14135af..e78e36d 100644 (file)
@@ -1,5 +1,5 @@
 /* Sparse Arrays for Objective C dispatch tables
 /* Sparse Arrays for Objective C dispatch tables
-   Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 1996, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
 
 This file is part of GNU CC.
 
@@ -34,36 +34,36 @@ int nindices = 0;                                   /* !T:MUTEX */
 int narrays = 0;                                       /* !T:MUTEX */
 int idxsize = 0;                                       /* !T:MUTEX */
 
 int narrays = 0;                                       /* !T:MUTEX */
 int idxsize = 0;                                       /* !T:MUTEX */
 
-static void *  first_free_data = NULL;                 /* !T:MUTEX */
+static void *first_free_data = NULL;                   /* !T:MUTEX */
 
 #ifdef OBJC_SPARSE2
 
 #ifdef OBJC_SPARSE2
-const char__objc_sparse2_id = "2 level sparse indices";
+const char *__objc_sparse2_id = "2 level sparse indices";
 #endif
 
 #ifdef OBJC_SPARSE3
 #endif
 
 #ifdef OBJC_SPARSE3
-const char__objc_sparse3_id = "3 level sparse indices";
+const char *__objc_sparse3_id = "3 level sparse indices";
 #endif
 
 /* This function removes any structures left over from free operations
    that were not safe in a multi-threaded environment. */
 void
 #endif
 
 /* This function removes any structures left over from free operations
    that were not safe in a multi-threaded environment. */
 void
-sarray_remove_garbage(void)
+sarray_remove_garbage (void)
 {
   void **vp;
   void *np;
   
 {
   void **vp;
   void *np;
   
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
   vp = first_free_data;
   first_free_data = NULL;
 
   while (vp) {
     np = *vp;
 
   vp = first_free_data;
   first_free_data = NULL;
 
   while (vp) {
     np = *vp;
-    objc_free(vp);
+    objc_free (vp);
     vp = np;
   }
   
     vp = np;
   }
   
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 }
 
 /* Free a block of dynamically allocated memory.  If we are in multi-threaded
 }
 
 /* Free a block of dynamically allocated memory.  If we are in multi-threaded
@@ -71,33 +71,33 @@ sarray_remove_garbage(void)
    freed later. */
 
 static void
    freed later. */
 
 static void
-sarray_free_garbage(void *vp)
+sarray_free_garbage (void *vp)
 {
 {
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
   
   if (__objc_runtime_threads_alive == 1) {
   
   if (__objc_runtime_threads_alive == 1) {
-    objc_free(vp);
+    objc_free (vp);
     if (first_free_data)
     if (first_free_data)
-      sarray_remove_garbage();
+      sarray_remove_garbage ();
   }
   else {
     *(void **)vp = first_free_data;
     first_free_data = vp;
   }
       
   }
   else {
     *(void **)vp = first_free_data;
     first_free_data = vp;
   }
       
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 }
 
 /* sarray_at_put : copies data in such a way as to be thread reader safe. */
 void
 }
 
 /* sarray_at_put : copies data in such a way as to be thread reader safe. */
 void
-sarray_at_put(struct sarray* array, sidx index, void* element)
+sarray_at_put (struct sarray *array, sidx index, void *element)
 {
 #ifdef OBJC_SPARSE3
 {
 #ifdef OBJC_SPARSE3
-  struct sindex** the_index;
-  struct sindex*  new_index;
+  struct sindex **the_index;
+  struct sindex *new_index;
 #endif
 #endif
-  struct sbucket** the_bucket;
-  struct sbucket*  new_bucket;
+  struct sbucket **the_bucket;
+  struct sbucket *new_bucket;
 #ifdef OBJC_SPARSE3
   size_t ioffset;
 #endif
 #ifdef OBJC_SPARSE3
   size_t ioffset;
 #endif
@@ -122,7 +122,7 @@ sarray_at_put(struct sarray* array, sidx index, void* element)
 #endif
 #endif /* not PRECOMPUTE_SELECTORS */
 
 #endif
 #endif /* not PRECOMPUTE_SELECTORS */
 
-  assert(soffset_decode(index) < array->capacity); /* Range check */
+  assert (soffset_decode (index) < array->capacity); /* Range check */
 
 #ifdef OBJC_SPARSE3
   the_index = &(array->indices[ioffset]);
 
 #ifdef OBJC_SPARSE3
   the_index = &(array->indices[ioffset]);
@@ -141,8 +141,8 @@ sarray_at_put(struct sarray* array, sidx index, void* element)
   if ((*the_index) == array->empty_index) {
 
     /* The index was previously empty, allocate a new */
   if ((*the_index) == array->empty_index) {
 
     /* The index was previously empty, allocate a new */
-    new_index = (struct sindex*)objc_malloc(sizeof(struct sindex));
-    memcpy(new_index, array->empty_index, sizeof(struct sindex));
+    new_index = (struct sindex *) objc_malloc (sizeof (struct sindex));
+    memcpy (new_index, array->empty_index, sizeof (struct sindex));
     new_index->version.version = array->version.version;
     *the_index = new_index;                     /* Prepared for install. */
     the_bucket = &((*the_index)->buckets[boffset]);
     new_index->version.version = array->version.version;
     *the_index = new_index;                     /* Prepared for install. */
     the_bucket = &((*the_index)->buckets[boffset]);
@@ -151,9 +151,9 @@ sarray_at_put(struct sarray* array, sidx index, void* element)
   } else if ((*the_index)->version.version != array->version.version) {
 
     /* This index must be lazy copied */
   } else if ((*the_index)->version.version != array->version.version) {
 
     /* This index must be lazy copied */
-    struct sindexold_index = *the_index;
-    new_index = (struct sindex*)objc_malloc(sizeof(struct sindex));
-    memcpy( new_index, old_index, sizeof(struct sindex));
+    struct sindex *old_index = *the_index;
+    new_index = (struct sindex *) objc_malloc (sizeof (struct sindex));
+    memcpy (new_index, old_index, sizeof (struct sindex));
     new_index->version.version = array->version.version;
     *the_index = new_index;                     /* Prepared for install. */
     the_bucket = &((*the_index)->buckets[boffset]);
     new_index->version.version = array->version.version;
     *the_index = new_index;                     /* Prepared for install. */
     the_bucket = &((*the_index)->buckets[boffset]);
@@ -169,9 +169,9 @@ sarray_at_put(struct sarray* array, sidx index, void* element)
 
     /* The bucket was previously empty (or something like that), */
     /* allocate a new.  This is the effect of `lazy' allocation */  
 
     /* The bucket was previously empty (or something like that), */
     /* allocate a new.  This is the effect of `lazy' allocation */  
-    new_bucket = (struct sbucket*)objc_malloc(sizeof(struct sbucket));
-    memcpy((void *) new_bucket, (const void*)array->empty_bucket, 
-          sizeof(struct sbucket));
+    new_bucket = (struct sbucket *) objc_malloc (sizeof (struct sbucket));
+    memcpy ((void *) new_bucket, (const void *) array->empty_bucket, 
+           sizeof (struct sbucket));
     new_bucket->version.version = array->version.version;
     *the_bucket = new_bucket;                   /* Prepared for install. */
     
     new_bucket->version.version = array->version.version;
     *the_bucket = new_bucket;                   /* Prepared for install. */
     
@@ -180,9 +180,9 @@ sarray_at_put(struct sarray* array, sidx index, void* element)
   } else if ((*the_bucket)->version.version != array->version.version) {
 
     /* Perform lazy copy. */
   } else if ((*the_bucket)->version.version != array->version.version) {
 
     /* Perform lazy copy. */
-    struct sbucketold_bucket = *the_bucket;
-    new_bucket = (struct sbucket*)objc_malloc(sizeof(struct sbucket));
-    memcpy( new_bucket, old_bucket, sizeof(struct sbucket));
+    struct sbucket *old_bucket = *the_bucket;
+    new_bucket = (struct sbucket *) objc_malloc (sizeof (struct sbucket));
+    memcpy (new_bucket, old_bucket, sizeof (struct sbucket));
     new_bucket->version.version = array->version.version;
     *the_bucket = new_bucket;                   /* Prepared for install. */
     
     new_bucket->version.version = array->version.version;
     *the_bucket = new_bucket;                   /* Prepared for install. */
     
@@ -193,39 +193,39 @@ sarray_at_put(struct sarray* array, sidx index, void* element)
 }
 
 void
 }
 
 void
-sarray_at_put_safe(struct sarray* array, sidx index, void* element)
+sarray_at_put_safe (struct sarray *array, sidx index, void *element)
 {
 {
-  if(soffset_decode(index) >= array->capacity)
-    sarray_realloc(array, soffset_decode(index)+1);
-  sarray_at_put(array, index, element);
+  if (soffset_decode (index) >= array->capacity)
+    sarray_realloc (array, soffset_decode (index) + 1);
+  sarray_at_put (array, index, element);
 }
 
 }
 
-struct sarray
-sarray_new (int size, voiddefault_element)
+struct sarray *
+sarray_new (int size, void *default_element)
 {
 {
-  struct sarrayarr;
+  struct sarray *arr;
 #ifdef OBJC_SPARSE3
 #ifdef OBJC_SPARSE3
-  size_t num_indices = ((size-1)/(INDEX_CAPACITY))+1;
-  struct sindex ** new_indices;
+  size_t num_indices = ((size - 1)/(INDEX_CAPACITY)) + 1;
+  struct sindex **new_indices;
 #else /* OBJC_SPARSE2 */
 #else /* OBJC_SPARSE2 */
-  size_t num_indices = ((size-1)/BUCKET_SIZE)+1;
-  struct sbucket ** new_buckets;
+  size_t num_indices = ((size - 1)/BUCKET_SIZE) + 1;
+  struct sbucket **new_buckets;
 #endif
   size_t counter;
 
 #endif
   size_t counter;
 
-  assert(size > 0);
+  assert (size > 0);
 
   /* Allocate core array */
 
   /* Allocate core array */
-  arr = (struct sarray*) objc_malloc(sizeof(struct sarray));
+  arr = (struct sarray *) objc_malloc (sizeof (struct sarray));
   arr->version.version = 0;
   
   /* Initialize members */
 #ifdef OBJC_SPARSE3
   arr->capacity = num_indices*INDEX_CAPACITY;
   arr->version.version = 0;
   
   /* Initialize members */
 #ifdef OBJC_SPARSE3
   arr->capacity = num_indices*INDEX_CAPACITY;
-  new_indices = (struct sindex**) 
-    objc_malloc(sizeof(struct sindex*)*num_indices);
+  new_indices = (struct sindex **) 
+    objc_malloc (sizeof (struct sindex *) * num_indices);
 
 
-  arr->empty_index = (struct sindex*) objc_malloc(sizeof(struct sindex));
+  arr->empty_index = (struct sindex *) objc_malloc (sizeof (struct sindex));
   arr->empty_index->version.version = 0;
   
   narrays  += 1;
   arr->empty_index->version.version = 0;
   
   narrays  += 1;
@@ -234,35 +234,35 @@ sarray_new (int size, void* default_element)
 
 #else /* OBJC_SPARSE2 */
   arr->capacity = num_indices*BUCKET_SIZE;
 
 #else /* OBJC_SPARSE2 */
   arr->capacity = num_indices*BUCKET_SIZE;
-  new_buckets = (struct sbucket**) 
-    objc_malloc(sizeof(struct sbucket*)*num_indices);
+  new_buckets = (struct sbucket **) 
+    objc_malloc (sizeof (struct sbucket *) * num_indices);
   
   narrays  += 1;
   idxsize  += num_indices;
 
 #endif
 
   
   narrays  += 1;
   idxsize  += num_indices;
 
 #endif
 
-  arr->empty_bucket = (struct sbucket*) objc_malloc(sizeof(struct sbucket));
+  arr->empty_bucket = (struct sbucket *) objc_malloc (sizeof (struct sbucket));
   arr->empty_bucket->version.version = 0;
   
   nbuckets += 1;
 
   arr->ref_count = 1;
   arr->empty_bucket->version.version = 0;
   
   nbuckets += 1;
 
   arr->ref_count = 1;
-  arr->is_copy_of = (struct sarray*)0;
+  arr->is_copy_of = (struct sarray *) 0;
   
   
-  for (counter=0; counter<BUCKET_SIZE; counter++)
+  for (counter = 0; counter < BUCKET_SIZE; counter++)
     arr->empty_bucket->elems[counter] = default_element;
 
 #ifdef OBJC_SPARSE3
     arr->empty_bucket->elems[counter] = default_element;
 
 #ifdef OBJC_SPARSE3
-  for (counter=0; counter<INDEX_SIZE; counter++)
+  for (counter = 0; counter < INDEX_SIZE; counter++)
     arr->empty_index->buckets[counter] = arr->empty_bucket;
 
     arr->empty_index->buckets[counter] = arr->empty_bucket;
 
-  for (counter=0; counter<num_indices; counter++)
+  for (counter = 0; counter < num_indices; counter++)
     new_indices[counter] = arr->empty_index;
 
 #else /* OBJC_SPARSE2 */
 
     new_indices[counter] = arr->empty_index;
 
 #else /* OBJC_SPARSE2 */
 
-  for (counter=0; counter<num_indices; counter++)
+  for (counter = 0; counter < num_indices; counter++)
     new_buckets[counter] = arr->empty_bucket;
 
 #endif
     new_buckets[counter] = arr->empty_bucket;
 
 #endif
@@ -282,48 +282,48 @@ sarray_new (int size, void* default_element)
    any concurrent readers notice the update. */
 
 void 
    any concurrent readers notice the update. */
 
 void 
-sarray_realloc(struct sarray* array, int newsize)
+sarray_realloc (struct sarray *array, int newsize)
 {
 #ifdef OBJC_SPARSE3
 {
 #ifdef OBJC_SPARSE3
-  size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY;
-  size_t new_max_index = ((newsize-1)/INDEX_CAPACITY);
-  size_t rounded_size = (new_max_index+1)*INDEX_CAPACITY;
+  size_t old_max_index = (array->capacity - 1)/INDEX_CAPACITY;
+  size_t new_max_index = ((newsize - 1)/INDEX_CAPACITY);
+  size_t rounded_size = (new_max_index + 1) * INDEX_CAPACITY;
 
 
-  struct sindex ** new_indices;
-  struct sindex ** old_indices;
+  struct sindex **new_indices;
+  struct sindex **old_indices;
   
 #else /* OBJC_SPARSE2 */
   
 #else /* OBJC_SPARSE2 */
-  size_t old_max_index = (array->capacity-1)/BUCKET_SIZE;
-  size_t new_max_index = ((newsize-1)/BUCKET_SIZE);
-  size_t rounded_size = (new_max_index+1)*BUCKET_SIZE;
+  size_t old_max_index = (array->capacity - 1)/BUCKET_SIZE;
+  size_t new_max_index = ((newsize - 1)/BUCKET_SIZE);
+  size_t rounded_size = (new_max_index + 1) * BUCKET_SIZE;
 
 
-  struct sbucket ** new_buckets;
-  struct sbucket ** old_buckets;
+  struct sbucket **new_buckets;
+  struct sbucket **old_buckets;
   
 #endif
 
   size_t counter;
 
   
 #endif
 
   size_t counter;
 
-  assert(newsize > 0);
+  assert (newsize > 0);
 
   /* The size is the same, just ignore the request */
 
   /* The size is the same, just ignore the request */
-  if(rounded_size <= array->capacity)
+  if (rounded_size <= array->capacity)
     return;
 
     return;
 
-  assert(array->ref_count == 1);       /* stop if lazy copied... */
+  assert (array->ref_count == 1);      /* stop if lazy copied... */
 
   /* We are asked to extend the array -- allocate new bucket table, */
   /* and insert empty_bucket in newly allocated places. */
 
   /* We are asked to extend the array -- allocate new bucket table, */
   /* and insert empty_bucket in newly allocated places. */
-  if(rounded_size > array->capacity) 
+  if (rounded_size > array->capacity) 
     {
 
 #ifdef OBJC_SPARSE3
       new_max_index += 4;
     {
 
 #ifdef OBJC_SPARSE3
       new_max_index += 4;
-      rounded_size = (new_max_index+1)*INDEX_CAPACITY;
+      rounded_size = (new_max_index + 1) * INDEX_CAPACITY;
       
 #else /* OBJC_SPARSE2 */
       new_max_index += 4;
       
 #else /* OBJC_SPARSE2 */
       new_max_index += 4;
-      rounded_size = (new_max_index+1)*BUCKET_SIZE;
+      rounded_size = (new_max_index + 1) * BUCKET_SIZE;
 #endif
       
       /* update capacity */
 #endif
       
       /* update capacity */
@@ -332,16 +332,16 @@ sarray_realloc(struct sarray* array, int newsize)
 #ifdef OBJC_SPARSE3
       /* alloc to force re-read by any concurrent readers. */
       old_indices = array->indices;
 #ifdef OBJC_SPARSE3
       /* alloc to force re-read by any concurrent readers. */
       old_indices = array->indices;
-      new_indices = (struct sindex**)
-       objc_malloc((new_max_index+1)*sizeof(struct sindex*));
+      new_indices = (struct sindex **)
+       objc_malloc ((new_max_index + 1) * sizeof (struct sindex *));
 #else /* OBJC_SPARSE2 */
       old_buckets = array->buckets;
 #else /* OBJC_SPARSE2 */
       old_buckets = array->buckets;
-      new_buckets = (struct sbucket**)
-       objc_malloc((new_max_index+1)*sizeof(struct sbucket*));
+      new_buckets = (struct sbucket **)
+       objc_malloc ((new_max_index + 1) * sizeof (struct sbucket *));
 #endif
 
       /* copy buckets below old_max_index (they are still valid) */
 #endif
 
       /* copy buckets below old_max_index (they are still valid) */
-      for(counter = 0; counter <= old_max_index; counter++ ) {
+      for (counter = 0; counter <= old_max_index; counter++ ) {
 #ifdef OBJC_SPARSE3
        new_indices[counter] = old_indices[counter];
 #else /* OBJC_SPARSE2 */
 #ifdef OBJC_SPARSE3
        new_indices[counter] = old_indices[counter];
 #else /* OBJC_SPARSE2 */
@@ -351,11 +351,11 @@ sarray_realloc(struct sarray* array, int newsize)
 
 #ifdef OBJC_SPARSE3
       /* reset entries above old_max_index to empty_bucket */
 
 #ifdef OBJC_SPARSE3
       /* reset entries above old_max_index to empty_bucket */
-      for(counter = old_max_index+1; counter <= new_max_index; counter++)
+      for (counter = old_max_index + 1; counter <= new_max_index; counter++)
        new_indices[counter] = array->empty_index;
 #else /* OBJC_SPARSE2 */
       /* reset entries above old_max_index to empty_bucket */
        new_indices[counter] = array->empty_index;
 #else /* OBJC_SPARSE2 */
       /* reset entries above old_max_index to empty_bucket */
-      for(counter = old_max_index+1; counter <= new_max_index; counter++)
+      for (counter = old_max_index + 1; counter <= new_max_index; counter++)
        new_buckets[counter] = array->empty_bucket;
 #endif
       
        new_buckets[counter] = array->empty_bucket;
 #endif
       
@@ -368,9 +368,9 @@ sarray_realloc(struct sarray* array, int newsize)
 
 #ifdef OBJC_SPARSE3
       /* free the old indices */
 
 #ifdef OBJC_SPARSE3
       /* free the old indices */
-      sarray_free_garbage(old_indices);
+      sarray_free_garbage (old_indices);
 #else /* OBJC_SPARSE2 */
 #else /* OBJC_SPARSE2 */
-      sarray_free_garbage(old_buckets);
+      sarray_free_garbage (old_buckets);
 #endif
       
       idxsize += (new_max_index-old_max_index);
 #endif
       
       idxsize += (new_max_index-old_max_index);
@@ -382,20 +382,19 @@ sarray_realloc(struct sarray* array, int newsize)
 /* Free a sparse array allocated with sarray_new */
 
 void 
 /* Free a sparse array allocated with sarray_new */
 
 void 
-sarray_free(struct sarray* array)
-{
+sarray_free (struct sarray *array) {
 #ifdef OBJC_SPARSE3
 #ifdef OBJC_SPARSE3
-  size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY;
-  struct sindex ** old_indices;
+  size_t old_max_index = (array->capacity - 1)/INDEX_CAPACITY;
+  struct sindex **old_indices;
 #else
 #else
-  size_t old_max_index = (array->capacity-1)/BUCKET_SIZE;
-  struct sbucket ** old_buckets;
+  size_t old_max_index = (array->capacity - 1)/BUCKET_SIZE;
+  struct sbucket **old_buckets;
 #endif
   size_t counter = 0;
 
 #endif
   size_t counter = 0;
 
-  assert(array->ref_count != 0);       /* Freed multiple times!!! */
+  assert (array->ref_count != 0);      /* Freed multiple times!!! */
 
 
-  if(--(array->ref_count) != 0)        /* There exists copies of me */
+  if (--(array->ref_count) != 0)       /* There exists copies of me */
     return;
 
 #ifdef OBJC_SPARSE3
     return;
 
 #ifdef OBJC_SPARSE3
@@ -404,34 +403,34 @@ sarray_free(struct sarray* array)
   old_buckets = array->buckets;
 #endif
   
   old_buckets = array->buckets;
 #endif
   
-  if((array->is_copy_of) && ((array->is_copy_of->ref_count - 1) == 0))
-    sarray_free(array->is_copy_of);
+  if ((array->is_copy_of) && ((array->is_copy_of->ref_count - 1) == 0))
+    sarray_free (array->is_copy_of);
 
   /* Free all entries that do not point to empty_bucket */
 
   /* Free all entries that do not point to empty_bucket */
-  for(counter = 0; counter <= old_max_index; counter++ ) {
+  for (counter = 0; counter <= old_max_index; counter++ ) {
 #ifdef OBJC_SPARSE3
 #ifdef OBJC_SPARSE3
-    struct sindexidx = old_indices[counter];
-    if((idx != array->empty_index) &&
+    struct sindex *idx = old_indices[counter];
+    if ((idx != array->empty_index) &&
        (idx->version.version == array->version.version)) {
       int c2; 
        (idx->version.version == array->version.version)) {
       int c2; 
-      for(c2=0; c2<INDEX_SIZE; c2++) {
-       struct sbucketbkt = idx->buckets[c2];
-       if((bkt != array->empty_bucket) &&
+      for (c2 = 0; c2 < INDEX_SIZE; c2++) {
+       struct sbucket *bkt = idx->buckets[c2];
+       if ((bkt != array->empty_bucket) &&
           (bkt->version.version == array->version.version))
          {
           (bkt->version.version == array->version.version))
          {
-           sarray_free_garbage(bkt);
+           sarray_free_garbage (bkt);
            nbuckets -= 1;
          }
       }
            nbuckets -= 1;
          }
       }
-      sarray_free_garbage(idx);
+      sarray_free_garbage (idx);
       nindices -= 1;
     }
 #else /* OBJC_SPARSE2 */
       nindices -= 1;
     }
 #else /* OBJC_SPARSE2 */
-    struct sbucketbkt = array->buckets[counter];
+    struct sbucket *bkt = array->buckets[counter];
     if ((bkt != array->empty_bucket) &&
        (bkt->version.version == array->version.version))
       {
     if ((bkt != array->empty_bucket) &&
        (bkt->version.version == array->version.version))
       {
-       sarray_free_garbage(bkt);
+       sarray_free_garbage (bkt);
        nbuckets -= 1;
       }
 #endif
        nbuckets -= 1;
       }
 #endif
@@ -439,52 +438,52 @@ sarray_free(struct sarray* array)
        
 #ifdef OBJC_SPARSE3  
   /* free empty_index */
        
 #ifdef OBJC_SPARSE3  
   /* free empty_index */
-  if(array->empty_index->version.version == array->version.version) {
-    sarray_free_garbage(array->empty_index);
+  if (array->empty_index->version.version == array->version.version) {
+    sarray_free_garbage (array->empty_index);
     nindices -= 1;
   }
 #endif
 
   /* free empty_bucket */
     nindices -= 1;
   }
 #endif
 
   /* free empty_bucket */
-  if(array->empty_bucket->version.version == array->version.version) {
-    sarray_free_garbage(array->empty_bucket);
+  if (array->empty_bucket->version.version == array->version.version) {
+    sarray_free_garbage (array->empty_bucket);
     nbuckets -= 1;
   }
     nbuckets -= 1;
   }
-  idxsize -= (old_max_index+1);
+  idxsize -= (old_max_index + 1);
   narrays -= 1;
 
 #ifdef OBJC_SPARSE3
   /* free bucket table */
   narrays -= 1;
 
 #ifdef OBJC_SPARSE3
   /* free bucket table */
-  sarray_free_garbage(array->indices);
+  sarray_free_garbage (array->indices);
 
 #else
   /* free bucket table */
 
 #else
   /* free bucket table */
-  sarray_free_garbage(array->buckets);
+  sarray_free_garbage (array->buckets);
 
 #endif
   
   /* free array */
 
 #endif
   
   /* free array */
-  sarray_free_garbage(array);
+  sarray_free_garbage (array);
 }
 
 /* This is a lazy copy.  Only the core of the structure is actually */
 /* copied.   */
 
 }
 
 /* This is a lazy copy.  Only the core of the structure is actually */
 /* copied.   */
 
-struct sarray
-sarray_lazy_copy(struct sarray* oarr)
+struct sarray *
+sarray_lazy_copy (struct sarray *oarr)
 {
 {
-  struct sarrayarr;
+  struct sarray *arr;
 
 #ifdef OBJC_SPARSE3
 
 #ifdef OBJC_SPARSE3
-  size_t num_indices = ((oarr->capacity-1)/INDEX_CAPACITY)+1;
-  struct sindex ** new_indices;
+  size_t num_indices = ((oarr->capacity - 1)/INDEX_CAPACITY) + 1;
+  struct sindex **new_indices;
 #else /* OBJC_SPARSE2 */
 #else /* OBJC_SPARSE2 */
-  size_t num_indices = ((oarr->capacity-1)/BUCKET_SIZE)+1;
-  struct sbucket ** new_buckets;
+  size_t num_indices = ((oarr->capacity - 1)/BUCKET_SIZE) + 1;
+  struct sbucket **new_buckets;
 #endif
 
   /* Allocate core array */
 #endif
 
   /* Allocate core array */
-  arr = (struct sarray*) objc_malloc(sizeof(struct sarray)); /* !!! */
+  arr = (struct sarray *) objc_malloc (sizeof (struct sarray)); /* !!! */
   arr->version.version = oarr->version.version + 1;
 #ifdef OBJC_SPARSE3
   arr->empty_index = oarr->empty_index;
   arr->version.version = oarr->version.version + 1;
 #ifdef OBJC_SPARSE3
   arr->empty_index = oarr->empty_index;
@@ -497,17 +496,15 @@ sarray_lazy_copy(struct sarray* oarr)
   
 #ifdef OBJC_SPARSE3
   /* Copy bucket table */
   
 #ifdef OBJC_SPARSE3
   /* Copy bucket table */
-  new_indices = (struct sindex**) 
-    objc_malloc(sizeof(struct sindex*)*num_indices);
-  memcpy( new_indices,oarr->indices, 
-       sizeof(struct sindex*)*num_indices);
+  new_indices = (struct sindex **) 
+    objc_malloc (sizeof (struct sindex *) * num_indices);
+  memcpy (new_indices, oarr->indices, sizeof (struct sindex *) * num_indices);
   arr->indices = new_indices;
 #else 
   /* Copy bucket table */
   arr->indices = new_indices;
 #else 
   /* Copy bucket table */
-  new_buckets = (struct sbucket**) 
-    objc_malloc(sizeof(struct sbucket*)*num_indices);
-  memcpy( new_buckets,oarr->buckets, 
-       sizeof(struct sbucket*)*num_indices);
+  new_buckets = (struct sbucket **) 
+    objc_malloc (sizeof (struct sbucket *) * num_indices);
+  memcpy (new_buckets, oarr->buckets, sizeof (struct sbucket *) * num_indices);
   arr->buckets = new_buckets;
 #endif
 
   arr->buckets = new_buckets;
 #endif
 
index 13a2afd..5f5a26b 100644 (file)
@@ -31,16 +31,16 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define SELECTOR_HASH_SIZE 128
 
 /* Tables mapping selector names to uid and opposite */
 #define SELECTOR_HASH_SIZE 128
 
 /* Tables mapping selector names to uid and opposite */
-static struct sarray__objc_selector_array = 0; /* uid -> sel  !T:MUTEX */
-static struct sarray__objc_selector_names = 0; /* uid -> name !T:MUTEX */
+static struct sarray *__objc_selector_array = 0; /* uid -> sel  !T:MUTEX */
+static struct sarray *__objc_selector_names = 0; /* uid -> name !T:MUTEX */
 static cache_ptr      __objc_selector_hash  = 0; /* name -> uid !T:MUTEX */
 
 static cache_ptr      __objc_selector_hash  = 0; /* name -> uid !T:MUTEX */
 
-static void register_selectors_from_list(MethodList_t);
+static void register_selectors_from_list (MethodList_t);
 
 /* Number of selectors stored in each of the above tables */
 unsigned int __objc_selector_max_index = 0;     /* !T:MUTEX */
 
 
 /* Number of selectors stored in each of the above tables */
 unsigned int __objc_selector_max_index = 0;     /* !T:MUTEX */
 
-void __objc_init_selector_tables()
+void __objc_init_selector_tables ()
 {
   __objc_selector_array = sarray_new (SELECTOR_HASH_SIZE, 0);
   __objc_selector_names = sarray_new (SELECTOR_HASH_SIZE, 0);
 {
   __objc_selector_array = sarray_new (SELECTOR_HASH_SIZE, 0);
   __objc_selector_names = sarray_new (SELECTOR_HASH_SIZE, 0);
@@ -81,15 +81,15 @@ register_selectors_from_list (MethodList_t method_list)
     {
       Method_t method = &method_list->method_list[i];
       method->method_name 
     {
       Method_t method = &method_list->method_list[i];
       method->method_name 
-       = sel_register_typed_name ((const char*)method->method_name, 
-                                    method->method_types);
+       = sel_register_typed_name ((const char *) method->method_name, 
+                                  method->method_types);
       i += 1;
     }
 }
 
 
 /* Register instance methods as class methods for root classes */
       i += 1;
     }
 }
 
 
 /* Register instance methods as class methods for root classes */
-void __objc_register_instance_methods_to_class(Class class)
+void __objc_register_instance_methods_to_class (Class class)
 {
   MethodList_t method_list;
   MethodList_t class_method_list;
 {
   MethodList_t method_list;
   MethodList_t class_method_list;
@@ -98,12 +98,12 @@ void __objc_register_instance_methods_to_class(Class class)
   Method_t curr_method;
 
   /* Only if a root class. */
   Method_t curr_method;
 
   /* Only if a root class. */
-  if(class->super_class)
+  if (class->super_class)
     return;
 
   /* Allocate a method list to hold the new class methods */
     return;
 
   /* Allocate a method list to hold the new class methods */
-  new_list = objc_calloc(sizeof(struct objc_method_list)
-                           + sizeof(struct objc_method[max_methods_no]), 1);
+  new_list = objc_calloc (sizeof (struct objc_method_list)
+                           + sizeof (struct objc_method[max_methods_no]), 1);
   method_list = class->methods;
   class_method_list = class->class_pointer->methods;
   curr_method = &new_list->method_list[0];
   method_list = class->methods;
   class_method_list = class->class_pointer->methods;
   curr_method = &new_list->method_list[0];
@@ -118,7 +118,7 @@ void __objc_register_instance_methods_to_class(Class class)
        {
          Method_t mth = &method_list->method_list[i];
          if (mth->method_name
        {
          Method_t mth = &method_list->method_list[i];
          if (mth->method_name
-             && !search_for_method_in_list (class_method_list,
+             && ! search_for_method_in_list (class_method_list,
                                              mth->method_name))
            {
              /* This instance method isn't a class method. 
                                              mth->method_name))
            {
              /* This instance method isn't a class method. 
@@ -126,10 +126,10 @@ void __objc_register_instance_methods_to_class(Class class)
              *curr_method = *mth;
   
              /* Reallocate the method list if necessary */
              *curr_method = *mth;
   
              /* Reallocate the method list if necessary */
-             if(++new_list->method_count == max_methods_no)
+             if (++new_list->method_count == max_methods_no)
                new_list =
                new_list =
-                 objc_realloc(new_list, sizeof(struct objc_method_list)
-                               + sizeof(struct 
+                 objc_realloc (new_list, sizeof (struct objc_method_list)
+                               + sizeof (struct 
                                        objc_method[max_methods_no += 16]));
              curr_method = &new_list->method_list[new_list->method_count];
            }
                                        objc_method[max_methods_no += 16]));
              curr_method = &new_list->method_list[new_list->method_count];
            }
@@ -143,8 +143,8 @@ void __objc_register_instance_methods_to_class(Class class)
   if (new_list->method_count)
     {
       new_list =
   if (new_list->method_count)
     {
       new_list =
-       objc_realloc(new_list, sizeof(struct objc_method_list)
-                    + sizeof(struct objc_method[new_list->method_count]));
+       objc_realloc (new_list, sizeof (struct objc_method_list)
+                    + sizeof (struct objc_method[new_list->method_count]));
       new_list->method_next = class->class_pointer->methods;
       class->class_pointer->methods = new_list;
     }
       new_list->method_next = class->class_pointer->methods;
       class->class_pointer->methods = new_list;
     }
@@ -156,21 +156,21 @@ void __objc_register_instance_methods_to_class(Class class)
 /* Returns YES iff t1 and t2 have same method types, but we ignore
    the argframe layout */
 BOOL
 /* Returns YES iff t1 and t2 have same method types, but we ignore
    the argframe layout */
 BOOL
-sel_types_match (const char* t1, const char* t2)
+sel_types_match (const char *t1, const char *t2)
 {
 {
-  if (!t1 || !t2)
+  if (! t1 || ! t2)
     return NO;
   while (*t1 && *t2)
     {
       if (*t1 == '+') t1++;
       if (*t2 == '+') t2++;
     return NO;
   while (*t1 && *t2)
     {
       if (*t1 == '+') t1++;
       if (*t2 == '+') t2++;
-      while (isdigit((unsigned char)*t1)) t1++;
-      while (isdigit((unsigned char)*t2)) t2++;
+      while (isdigit ((unsigned char) *t1)) t1++;
+      while (isdigit ((unsigned char) *t2)) t2++;
       /* xxx Remove these next two lines when qualifiers are put in
         all selectors, not just Protocol selectors. */
       /* xxx Remove these next two lines when qualifiers are put in
         all selectors, not just Protocol selectors. */
-      t1 = objc_skip_type_qualifiers(t1);
-      t2 = objc_skip_type_qualifiers(t2);
-      if (!*t1 && !*t2)
+      t1 = objc_skip_type_qualifiers (t1);
+      t2 = objc_skip_type_qualifiers (t2);
+      if (! *t1 && ! *t2)
        return YES;
       if (*t1 != *t2)
        return NO;
        return YES;
       if (*t1 != *t2)
        return NO;
@@ -187,35 +187,35 @@ sel_get_typed_uid (const char *name, const char *types)
   struct objc_list *l;
   sidx i;
 
   struct objc_list *l;
   sidx i;
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
   i = (sidx) hash_value_for_key (__objc_selector_hash, name);
   if (i == 0)
     {
 
   i = (sidx) hash_value_for_key (__objc_selector_hash, name);
   if (i == 0)
     {
-      objc_mutex_unlock(__objc_runtime_mutex);
+      objc_mutex_unlock (__objc_runtime_mutex);
       return 0;
     }
 
       return 0;
     }
 
-  for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i);
+  for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
        l; l = l->tail)
     {
        l; l = l->tail)
     {
-      SEL s = (SEL)l->head;
+      SEL s = (SEL) l->head;
       if (types == 0 || s->sel_types == 0)
        {
          if (s->sel_types == types)
            {
       if (types == 0 || s->sel_types == 0)
        {
          if (s->sel_types == types)
            {
-             objc_mutex_unlock(__objc_runtime_mutex);
+             objc_mutex_unlock (__objc_runtime_mutex);
              return s;
            }
        }
       else if (sel_types_match (s->sel_types, types))
        {
              return s;
            }
        }
       else if (sel_types_match (s->sel_types, types))
        {
-         objc_mutex_unlock(__objc_runtime_mutex);
+         objc_mutex_unlock (__objc_runtime_mutex);
          return s;
        }
     }
 
          return s;
        }
     }
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
   return 0;
 }
 
   return 0;
 }
 
@@ -227,27 +227,27 @@ sel_get_any_typed_uid (const char *name)
   sidx i;
   SEL s = NULL;
 
   sidx i;
   SEL s = NULL;
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
   i = (sidx) hash_value_for_key (__objc_selector_hash, name);
   if (i == 0)
     {
 
   i = (sidx) hash_value_for_key (__objc_selector_hash, name);
   if (i == 0)
     {
-      objc_mutex_unlock(__objc_runtime_mutex);
+      objc_mutex_unlock (__objc_runtime_mutex);
       return 0;
     }
 
       return 0;
     }
 
-  for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i);
+  for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
        l; l = l->tail)
     {
       s = (SEL) l->head;
       if (s->sel_types)
        {
        l; l = l->tail)
     {
       s = (SEL) l->head;
       if (s->sel_types)
        {
-           objc_mutex_unlock(__objc_runtime_mutex);
+           objc_mutex_unlock (__objc_runtime_mutex);
            return s;
        }
     }
 
            return s;
        }
     }
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
   return s;
 }
 
   return s;
 }
 
@@ -258,22 +258,22 @@ sel_get_any_uid (const char *name)
   struct objc_list *l;
   sidx i;
 
   struct objc_list *l;
   sidx i;
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
   i = (sidx) hash_value_for_key (__objc_selector_hash, name);
   if (soffset_decode (i) == 0)
     {
 
   i = (sidx) hash_value_for_key (__objc_selector_hash, name);
   if (soffset_decode (i) == 0)
     {
-      objc_mutex_unlock(__objc_runtime_mutex);
+      objc_mutex_unlock (__objc_runtime_mutex);
       return 0;
     }
 
       return 0;
     }
 
-  l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i);
-  objc_mutex_unlock(__objc_runtime_mutex);
+  l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
+  objc_mutex_unlock (__objc_runtime_mutex);
 
   if (l == 0)
     return 0;
 
 
   if (l == 0)
     return 0;
 
-  return (SEL)l->head;
+  return (SEL) l->head;
 }
 
 /* return selector representing name */
 }
 
 /* return selector representing name */
@@ -285,18 +285,17 @@ sel_get_uid (const char *name)
 
 /* Get name of selector.  If selector is unknown, the empty string "" 
    is returned */ 
 
 /* Get name of selector.  If selector is unknown, the empty string "" 
    is returned */ 
-const char*
-sel_get_name (SEL selector)
+const char *sel_get_name (SEL selector)
 {
   const char *ret;
 
 {
   const char *ret;
 
-  objc_mutex_lock(__objc_runtime_mutex);
-  if ((soffset_decode((sidx)selector->sel_id) > 0)
-      && (soffset_decode((sidx)selector->sel_id) <= __objc_selector_max_index))
+  objc_mutex_lock (__objc_runtime_mutex);
+  if ((soffset_decode ((sidx)selector->sel_id) > 0)
+      && (soffset_decode ((sidx)selector->sel_id) <= __objc_selector_max_index))
     ret = sarray_get_safe (__objc_selector_names, (sidx) selector->sel_id);
   else
     ret = 0;
     ret = sarray_get_safe (__objc_selector_names, (sidx) selector->sel_id);
   else
     ret = 0;
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
   return ret;
 }
 
   return ret;
 }
 
@@ -308,8 +307,7 @@ sel_is_mapped (SEL selector)
 }
 
 
 }
 
 
-const char*
-sel_get_type (SEL selector)
+const char *sel_get_type (SEL selector)
 {
   if (selector)
     return selector->sel_types;
 {
   if (selector)
     return selector->sel_types;
@@ -318,7 +316,7 @@ sel_get_type (SEL selector)
 }
 
 /* The uninstalled dispatch table */
 }
 
 /* The uninstalled dispatch table */
-extern struct sarray__objc_uninstalled_dtable;
+extern struct sarray *__objc_uninstalled_dtable;
 
 /* Store the passed selector name in the selector record and return its
    selector value (value returned by sel_get_uid).
 
 /* Store the passed selector name in the selector record and return its
    selector value (value returned by sel_get_uid).
@@ -331,35 +329,35 @@ SEL
 __sel_register_typed_name (const char *name, const char *types, 
                           struct objc_selector *orig, BOOL is_const)
 {
 __sel_register_typed_name (const char *name, const char *types, 
                           struct objc_selector *orig, BOOL is_const)
 {
-  struct objc_selectorj;
+  struct objc_selector *j;
   sidx i;
   struct objc_list *l;
 
   i = (sidx) hash_value_for_key (__objc_selector_hash, name);
   if (soffset_decode (i) != 0)
     {
   sidx i;
   struct objc_list *l;
 
   i = (sidx) hash_value_for_key (__objc_selector_hash, name);
   if (soffset_decode (i) != 0)
     {
-      for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i);
+      for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
           l; l = l->tail)
        {
           l; l = l->tail)
        {
-         SEL s = (SEL)l->head;
+         SEL s = (SEL) l->head;
          if (types == 0 || s->sel_types == 0)
            {
              if (s->sel_types == types)
                {
                  if (orig)
                    {
          if (types == 0 || s->sel_types == 0)
            {
              if (s->sel_types == types)
                {
                  if (orig)
                    {
-                     orig->sel_id = (void*)i;
+                     orig->sel_id = (void *) i;
                      return orig;
                    }
                  else
                    return s;
                }
            }
                      return orig;
                    }
                  else
                    return s;
                }
            }
-         else if (!strcmp (s->sel_types, types))
+         else if (! strcmp (s->sel_types, types))
            {
              if (orig)
                {
            {
              if (orig)
                {
-                 orig->sel_id = (void*)i;
+                 orig->sel_id = (void *) i;
                  return orig;
                }
              else
                  return orig;
                }
              else
@@ -371,32 +369,32 @@ __sel_register_typed_name (const char *name, const char *types,
       else
        j = objc_malloc (sizeof (struct objc_selector));
 
       else
        j = objc_malloc (sizeof (struct objc_selector));
 
-      j->sel_id = (void*)i;
+      j->sel_id = (void *) i;
       /* Can we use the pointer or must copy types?  Don't copy if NULL */
       if ((is_const) || (types == 0))
       /* Can we use the pointer or must copy types?  Don't copy if NULL */
       if ((is_const) || (types == 0))
-       j->sel_types = (const char*)types;
+       j->sel_types = (const char *) types;
       else {
       else {
-       j->sel_types = (char *) objc_malloc(strlen(types)+1);
-       strcpy((char *)j->sel_types, types);
+       j->sel_types = (char *) objc_malloc (strlen (types) + 1);
+       strcpy ((char *) j->sel_types, types);
       }
       }
-      l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i);
+      l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
     }
   else
     {
       __objc_selector_max_index += 1;
     }
   else
     {
       __objc_selector_max_index += 1;
-      i = soffset_encode(__objc_selector_max_index);
+      i = soffset_encode (__objc_selector_max_index);
       if (orig)
        j = orig;
       else
        j = objc_malloc (sizeof (struct objc_selector));
        
       if (orig)
        j = orig;
       else
        j = objc_malloc (sizeof (struct objc_selector));
        
-      j->sel_id = (void*)i;
+      j->sel_id = (void *) i;
       /* Can we use the pointer or must copy types?  Don't copy if NULL */
       if ((is_const) || (types == 0))
       /* Can we use the pointer or must copy types?  Don't copy if NULL */
       if ((is_const) || (types == 0))
-       j->sel_types = (const char*)types;
+       j->sel_types = (const char *) types;
       else {
       else {
-       j->sel_types = (char *) objc_malloc(strlen(types)+1);
-       strcpy((char *)j->sel_types, types);
+       j->sel_types = (char *) objc_malloc (strlen (types) + 1);
+       strcpy ((char *) j->sel_types, types);
       }
       l = 0;
     }
       }
       l = 0;
     }
@@ -412,18 +410,18 @@ __sel_register_typed_name (const char *name, const char *types,
     if ((is_const) || (name == 0))
       new_name = name;
     else {
     if ((is_const) || (name == 0))
       new_name = name;
     else {
-      new_name = (char *) objc_malloc(strlen(name)+1);
-      strcpy((char *)new_name, name);
+      new_name = (char *) objc_malloc (strlen (name) + 1);
+      strcpy ((char *) new_name, name);
     }
 
     }
 
-    l = list_cons ((void*)j, l);
+    l = list_cons ((void *) j, l);
     sarray_at_put_safe (__objc_selector_names, i, (void *) new_name);
     sarray_at_put_safe (__objc_selector_array, i, (void *) l);
     if (is_new)
       hash_add (&__objc_selector_hash, (void *) new_name, (void *) i);
   }
 
     sarray_at_put_safe (__objc_selector_names, i, (void *) new_name);
     sarray_at_put_safe (__objc_selector_array, i, (void *) l);
     if (is_new)
       hash_add (&__objc_selector_hash, (void *) new_name, (void *) i);
   }
 
-  sarray_realloc(__objc_uninstalled_dtable, __objc_selector_max_index+1);
+  sarray_realloc (__objc_uninstalled_dtable, __objc_selector_max_index + 1);
 
   return (SEL) j;
 }
 
   return (SEL) j;
 }
@@ -433,11 +431,11 @@ sel_register_name (const char *name)
 {
   SEL ret;
     
 {
   SEL ret;
     
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
   /* Assume that name is not constant static memory and needs to be
      copied before put into a runtime structure.  is_const == NO */
   ret = __sel_register_typed_name (name, 0, 0, NO);
   /* Assume that name is not constant static memory and needs to be
      copied before put into a runtime structure.  is_const == NO */
   ret = __sel_register_typed_name (name, 0, 0, NO);
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
   
   return ret;
 }
   
   return ret;
 }
@@ -447,12 +445,11 @@ sel_register_typed_name (const char *name, const char *type)
 {
   SEL ret;
     
 {
   SEL ret;
     
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
   /* Assume that name and type are not constant static memory and need to
      be copied before put into a runtime structure.  is_const == NO */
   ret = __sel_register_typed_name (name, type, 0, NO);
   /* Assume that name and type are not constant static memory and need to
      be copied before put into a runtime structure.  is_const == NO */
   ret = __sel_register_typed_name (name, type, 0, NO);
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
   
   return ret;
 }
   
   return ret;
 }
-
index eafecd7..06fc9ba 100644 (file)
@@ -1,6 +1,6 @@
 /* GNU Objective C Runtime message lookup 
    Copyright (C) 1993, 1995, 1996, 1997, 1998,
 /* GNU Objective C Runtime message lookup 
    Copyright (C) 1993, 1995, 1996, 1997, 1998,
-   2001 Free Software Foundation, Inc.
+   2001, 2002 Free Software Foundation, Inc.
    Contributed by Kresten Krab Thorup
 
 This file is part of GNU CC.
    Contributed by Kresten Krab Thorup
 
 This file is part of GNU CC.
@@ -37,27 +37,27 @@ Boston, MA 02111-1307, USA.  */
 #define gen_rtx_REG(args...) 1
 #define rtx int
 
 #define gen_rtx_REG(args...) 1
 #define rtx int
 
-#if !defined(STRUCT_VALUE) || STRUCT_VALUE == 0
+#if ! defined (STRUCT_VALUE) || STRUCT_VALUE == 0
 #define INVISIBLE_STRUCT_RETURN 1
 #else
 #define INVISIBLE_STRUCT_RETURN 0
 #endif
 
 /* The uninstalled dispatch table */
 #define INVISIBLE_STRUCT_RETURN 1
 #else
 #define INVISIBLE_STRUCT_RETURN 0
 #endif
 
 /* The uninstalled dispatch table */
-struct sarray__objc_uninstalled_dtable = 0;   /* !T:MUTEX */
+struct sarray *__objc_uninstalled_dtable = 0;   /* !T:MUTEX */
 
 /* Hook for method forwarding. If it is set, is invoked to return a
    function that performs the real forwarding. Otherwise the libgcc
    based functions (__builtin_apply and friends) are used. */
 
 /* Hook for method forwarding. If it is set, is invoked to return a
    function that performs the real forwarding. Otherwise the libgcc
    based functions (__builtin_apply and friends) are used. */
-IMP (*__objc_msg_forward)(SEL) = NULL;
+IMP (*__objc_msg_forward) (SEL) = NULL;
 
 /* 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);
 
 /* Forward declare some functions */
 
 static void __objc_install_dispatch_table_for_class (Class);
 
 /* Forward declare some functions */
-static void __objc_init_install_dtable(id, SEL);
+static void __objc_init_install_dtable (id, SEL);
 
 /* Various forwarding functions that are used based upon the
    return type for the selector.
 
 /* Various forwarding functions that are used based upon the
    return type for the selector.
@@ -65,76 +65,76 @@ static void __objc_init_install_dtable(id, SEL);
    __objc_double_forward for floats/doubles.
    __objc_word_forward for pointers or types that fit in registers.
    */
    __objc_double_forward for floats/doubles.
    __objc_word_forward for pointers or types that fit in registers.
    */
-static double __objc_double_forward(id, SEL, ...);
-static id __objc_word_forward(id, SEL, ...);
+static double __objc_double_forward (id, SEL, ...);
+static id __objc_word_forward (id, SEL, ...);
 typedef struct { id many[8]; } __big;
 #if INVISIBLE_STRUCT_RETURN 
 static __big 
 #else
 static id
 #endif
 typedef struct { id many[8]; } __big;
 #if INVISIBLE_STRUCT_RETURN 
 static __big 
 #else
 static id
 #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);
-Method_t search_for_method_in_list(MethodList_t list, SEL op);
-id nil_method(id, SEL, ...);
-
-/* Given a selector, return the proper forwarding implementation.  */
-__inline__ 
-IMP 
-__objc_get_forward_imp (SEL sel) 
-{ 
+Method_t search_for_method_in_list (MethodList_t list, SEL op);
+id nil_method (id, SEL, ...);
+
+/* Given a selector, return the proper forwarding implementation. */
+__inline__
+IMP
+__objc_get_forward_imp (SEL sel)
+{
   /* If a custom forwarding hook was registered, try getting a forwarding
    * function from it.  */
   /* If a custom forwarding hook was registered, try getting a forwarding
    * function from it.  */
-  if (__objc_msg_forward) 
-    { 
-      IMP result; 
+  if (__objc_msg_forward)
+    {
+      IMP result;
       if ((result = __objc_msg_forward (sel)) != NULL) 
       if ((result = __objc_msg_forward (sel)) != NULL) 
-        return result; 
-    } 
+        return result;
+    }
 
   /* In all other cases, use the default forwarding functions built using
    * __builtin_apply and friends.  */
 
   /* In all other cases, use the default forwarding functions built using
    * __builtin_apply and friends.  */
-  { 
-    const char *t = sel->sel_types; 
-    if (t && (*t == '[' || *t == '(' || *t == '{') 
-#ifdef OBJC_MAX_STRUCT_BY_VALUE 
-        && objc_sizeof_type(t) > OBJC_MAX_STRUCT_BY_VALUE 
-#endif 
-        ) 
-      return (IMP)__objc_block_forward; 
-    else if (t && (*t == 'f' || *t == 'd')) 
-      return (IMP)__objc_double_forward; 
-    else 
-      return (IMP)__objc_word_forward; 
-  } 
-} 
+    {
+      const char *t = sel->sel_types;
+
+      if (t && (*t == '[' || *t == '(' || *t == '{')
+#ifdef OBJC_MAX_STRUCT_BY_VALUE
+          && objc_sizeof_type (t) > OBJC_MAX_STRUCT_BY_VALUE
+#endif
+          )
+        return (IMP)__objc_block_forward;
+      else if (t && (*t == 'f' || *t == 'd'))
+        return (IMP)__objc_double_forward;
+      else
+        return (IMP)__objc_word_forward;
+    }
+}
 
 /* Given a class and selector, return the selector's implementation.  */
 __inline__
 IMP
 get_imp (Class class, SEL sel)
 {
 
 /* Given a class and selector, return the selector's implementation.  */
 __inline__
 IMP
 get_imp (Class class, SEL sel)
 {
-  voidres = sarray_get_safe (class->dtable, (size_t) sel->sel_id);
+  void *res = sarray_get_safe (class->dtable, (size_t) sel->sel_id);
   if (res == 0)
     {
       /* Not a valid method */
   if (res == 0)
     {
       /* Not a valid method */
-      if(class->dtable == __objc_uninstalled_dtable)
+      if (class->dtable == __objc_uninstalled_dtable)
        {
          /* The dispatch table needs to be installed. */
        {
          /* The dispatch table needs to be installed. */
-         objc_mutex_lock(__objc_runtime_mutex);
+         objc_mutex_lock (__objc_runtime_mutex);
          __objc_install_dispatch_table_for_class (class);
          __objc_install_dispatch_table_for_class (class);
-         objc_mutex_unlock(__objc_runtime_mutex);
+         objc_mutex_unlock (__objc_runtime_mutex);
          /* Call ourselves with the installed dispatch table
             and get the real method */
          /* Call ourselves with the installed dispatch table
             and get the real method */
-         res = get_imp(class, sel);
+         res = get_imp (class, sel);
        }
       else
        {
          /* The dispatch table has been installed so the
             method just doesn't exist for the class.
             Return the forwarding implementation. */
        }
       else
        {
          /* The dispatch table has been installed so the
             method just doesn't exist for the class.
             Return the forwarding implementation. */
-         res = __objc_get_forward_imp(sel);
+         res = __objc_get_forward_imp (sel);
        }
     }
   return res;
        }
     }
   return res;
@@ -147,14 +147,14 @@ __inline__
 BOOL
 __objc_responds_to (id object, SEL sel)
 {
 BOOL
 __objc_responds_to (id object, SEL sel)
 {
-  voidres;
+  void *res;
 
   /* Install dispatch table if need be */
   if (object->class_pointer->dtable == __objc_uninstalled_dtable)
     {
 
   /* Install dispatch table if need be */
   if (object->class_pointer->dtable == __objc_uninstalled_dtable)
     {
-      objc_mutex_lock(__objc_runtime_mutex);
+      objc_mutex_lock (__objc_runtime_mutex);
       __objc_install_dispatch_table_for_class (object->class_pointer);
       __objc_install_dispatch_table_for_class (object->class_pointer);
-      objc_mutex_unlock(__objc_runtime_mutex);
+      objc_mutex_unlock (__objc_runtime_mutex);
     }
 
   /* Get the method from the dispatch table */
     }
 
   /* Get the method from the dispatch table */
@@ -167,31 +167,31 @@ __objc_responds_to (id object, SEL sel)
    needs to be installed or it doesn't exist and forwarding is attempted. */
 __inline__
 IMP
    needs to be installed or it doesn't exist and forwarding is attempted. */
 __inline__
 IMP
-objc_msg_lookup(id receiver, SEL op)
+objc_msg_lookup (id receiver, SEL op)
 {
   IMP result;
 {
   IMP result;
-  if(receiver)
+  if (receiver)
     {
       result = sarray_get_safe (receiver->class_pointer->dtable, 
                                (sidx)op->sel_id);
       if (result == 0)
        {
          /* Not a valid method */
     {
       result = sarray_get_safe (receiver->class_pointer->dtable, 
                                (sidx)op->sel_id);
       if (result == 0)
        {
          /* Not a valid method */
-         if(receiver->class_pointer->dtable == __objc_uninstalled_dtable)
+         if (receiver->class_pointer->dtable == __objc_uninstalled_dtable)
            {
              /* The dispatch table needs to be installed.
                 This happens on the very first method call to the class. */
            {
              /* The dispatch table needs to be installed.
                 This happens on the very first method call to the class. */
-             __objc_init_install_dtable(receiver, op);
+             __objc_init_install_dtable (receiver, op);
 
              /* Get real method for this in newly installed dtable */
 
              /* Get real method for this in newly installed dtable */
-             result = get_imp(receiver->class_pointer, op);
+             result = get_imp (receiver->class_pointer, op);
            }
          else
            {
              /* The dispatch table has been installed so the
                 method just doesn't exist for the class.
                 Attempt to forward the method. */
            }
          else
            {
              /* The dispatch table has been installed so the
                 method just doesn't exist for the class.
                 Attempt to forward the method. */
-             result = __objc_get_forward_imp(op);
+             result = __objc_get_forward_imp (op);
            }
        }
       return result;
            }
        }
       return result;
@@ -209,93 +209,92 @@ objc_msg_lookup_super (Super_t super, SEL sel)
     return nil_method;
 }
 
     return nil_method;
 }
 
-int method_get_sizeof_arguments (Method*);
+int method_get_sizeof_arguments (Method *);
 
 retval_t
 
 retval_t
-objc_msg_sendv(id object, SEL op, arglist_t arg_frame)
+objc_msg_sendv (id object, SEL op, arglist_t arg_frame)
 {
 {
-  Method* m = class_get_instance_method(object->class_pointer, op);
+  Method *m = class_get_instance_method (object->class_pointer, op);
   const char *type;
   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));
+  *((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
 }
 
 void
-__objc_init_dispatch_tables()
+__objc_init_dispatch_tables ()
 {
 {
-  __objc_uninstalled_dtable
-    = sarray_new(200, 0);
+  __objc_uninstalled_dtable = sarray_new (200, 0);
 }
 
 /* This function is called by objc_msg_lookup when the
    dispatch table needs to be installed; thus it is called once
    for each class, namely when the very first message is sent to it. */
 static void
 }
 
 /* This function is called by objc_msg_lookup when the
    dispatch table needs to be installed; thus it is called once
    for each class, namely when the very first message is sent to it. */
 static void
-__objc_init_install_dtable(id receiver, SEL op __attribute__ ((__unused__)))
+__objc_init_install_dtable (id receiver, SEL op __attribute__ ((__unused__)))
 {
   /* This may happen, if the programmer has taken the address of a 
      method before the dtable was initialized... too bad for him! */
 {
   /* This may happen, if the programmer has taken the address of a 
      method before the dtable was initialized... too bad for him! */
-  if(receiver->class_pointer->dtable != __objc_uninstalled_dtable)
+  if (receiver->class_pointer->dtable != __objc_uninstalled_dtable)
     return;
 
     return;
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
 
-  if(CLS_ISCLASS(receiver->class_pointer))
+  if (CLS_ISCLASS (receiver->class_pointer))
     {
       /* receiver is an ordinary object */
     {
       /* receiver is an ordinary object */
-      assert(CLS_ISCLASS(receiver->class_pointer));
+      assert (CLS_ISCLASS (receiver->class_pointer));
 
       /* install instance methods table */
       __objc_install_dispatch_table_for_class (receiver->class_pointer);
 
       /* call +initialize -- this will in turn install the factory 
         dispatch table if not already done :-) */
 
       /* install instance methods table */
       __objc_install_dispatch_table_for_class (receiver->class_pointer);
 
       /* call +initialize -- this will in turn install the factory 
         dispatch table if not already done :-) */
-      __objc_send_initialize(receiver->class_pointer);
+      __objc_send_initialize (receiver->class_pointer);
     }
   else
     {
       /* receiver is a class object */
     }
   else
     {
       /* receiver is a class object */
-      assert(CLS_ISCLASS((Class)receiver));
-      assert(CLS_ISMETA(receiver->class_pointer));
+      assert (CLS_ISCLASS ((Class)receiver));
+      assert (CLS_ISMETA (receiver->class_pointer));
 
       /* Install real dtable for factory methods */
       __objc_install_dispatch_table_for_class (receiver->class_pointer);
 
 
       /* Install real dtable for factory methods */
       __objc_install_dispatch_table_for_class (receiver->class_pointer);
 
-      __objc_send_initialize((Class)receiver);
+      __objc_send_initialize ((Class)receiver);
     }
     }
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 }
 
 /* Install dummy table for class which causes the first message to
    that class (or instances hereof) to be initialized properly */
 void
 }
 
 /* Install dummy table for class which causes the first message to
    that class (or instances hereof) to be initialized properly */
 void
-__objc_install_premature_dtable(Class class)
+__objc_install_premature_dtable (Class class)
 {
 {
-  assert(__objc_uninstalled_dtable);
+  assert (__objc_uninstalled_dtable);
   class->dtable = __objc_uninstalled_dtable;
 }   
 
 /* Send +initialize to class if not already done */
 static void
   class->dtable = __objc_uninstalled_dtable;
 }   
 
 /* Send +initialize to class if not already done */
 static void
-__objc_send_initialize(Class class)
+__objc_send_initialize (Class class)
 {
   /* This *must* be a class object */
 {
   /* This *must* be a class object */
-  assert(CLS_ISCLASS(class));
-  assert(!CLS_ISMETA(class));
+  assert (CLS_ISCLASS (class));
+  assert (! CLS_ISMETA (class));
 
 
-  if (!CLS_ISINITIALIZED(class))
+  if (! CLS_ISINITIALIZED (class))
     {
     {
-      CLS_SETINITIALIZED(class);
-      CLS_SETINITIALIZED(class->class_pointer);
+      CLS_SETINITIALIZED (class);
+      CLS_SETINITIALIZED (class->class_pointer);
 
       /* Create the garbage collector type memory description */
       __objc_generate_gc_type_description (class);
 
 
       /* Create the garbage collector type memory description */
       __objc_generate_gc_type_description (class);
 
-      if(class->super_class)
-       __objc_send_initialize(class->super_class);
+      if (class->super_class)
+       __objc_send_initialize (class->super_class);
 
       {
        SEL          op = sel_register_name ("initialize");
 
       {
        SEL          op = sel_register_name ("initialize");
@@ -306,7 +305,7 @@ __objc_send_initialize(Class class)
          int i;
           Method_t method;
 
          int i;
           Method_t method;
 
-          for (i = 0; i< method_list->method_count; i++) {
+          for (i = 0; i < method_list->method_count; i++) {
            method = &(method_list->method_list[i]);
             if (method->method_name
                 && method->method_name->sel_id == op->sel_id) {
            method = &(method_list->method_list[i]);
             if (method->method_name
                 && method->method_name->sel_id == op->sel_id) {
@@ -322,7 +321,7 @@ __objc_send_initialize(Class class)
 
        }
        if (imp)
 
        }
        if (imp)
-           (*imp)((id)class, op);
+           (*imp) ((id) class, op);
                
       }
     }
                
       }
     }
@@ -339,7 +338,7 @@ __objc_install_methods_in_dtable (Class class, MethodList_t method_list)
 {
   int i;
 
 {
   int i;
 
-  if (!method_list)
+  if (! method_list)
     return;
 
   if (method_list->method_next)
     return;
 
   if (method_list->method_next)
@@ -362,8 +361,8 @@ __objc_install_dispatch_table_for_class (Class class)
 
   /* If the class has not yet had its class links resolved, we must 
      re-compute all class links */
 
   /* If the class has not yet had its class links resolved, we must 
      re-compute all class links */
-  if(!CLS_ISRESOLV(class))
-    __objc_resolve_class_links();
+  if (! CLS_ISRESOLV (class))
+    __objc_resolve_class_links ();
 
   super = class->super_class;
 
 
   super = class->super_class;
 
@@ -373,9 +372,9 @@ __objc_install_dispatch_table_for_class (Class class)
   /* Allocate dtable if necessary */
   if (super == 0)
     {
   /* Allocate dtable if necessary */
   if (super == 0)
     {
-      objc_mutex_lock(__objc_runtime_mutex);
+      objc_mutex_lock (__objc_runtime_mutex);
       class->dtable = sarray_new (__objc_selector_max_index, 0);
       class->dtable = sarray_new (__objc_selector_max_index, 0);
-      objc_mutex_unlock(__objc_runtime_mutex);
+      objc_mutex_unlock (__objc_runtime_mutex);
     }
   else
     class->dtable = sarray_lazy_copy (super->dtable);
     }
   else
     class->dtable = sarray_lazy_copy (super->dtable);
@@ -393,7 +392,7 @@ __objc_update_dispatch_table_for_class (Class class)
   if (class->dtable == __objc_uninstalled_dtable) 
     return;
 
   if (class->dtable == __objc_uninstalled_dtable) 
     return;
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
   arr = class->dtable;
   __objc_install_premature_dtable (class); /* someone might require it... */
 
   arr = class->dtable;
   __objc_install_premature_dtable (class); /* someone might require it... */
@@ -406,7 +405,7 @@ __objc_update_dispatch_table_for_class (Class class)
     for (next = class->subclass_list; next; next = next->sibling_class)
       __objc_update_dispatch_table_for_class (next);
 
     for (next = class->subclass_list; next; next = next->sibling_class)
       __objc_update_dispatch_table_for_class (next);
 
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 }
 
 
 }
 
 
@@ -423,7 +422,7 @@ class_add_method_list (Class class, MethodList_t list)
   int i;
 
   /* Passing of a linked list is not allowed.  Do multiple calls.  */
   int i;
 
   /* Passing of a linked list is not allowed.  Do multiple calls.  */
-  assert (!list->method_next);
+  assert (! list->method_next);
 
   /* Check for duplicates.  */
   for (i = 0; i < list->method_count; ++i)
 
   /* Check for duplicates.  */
   for (i = 0; i < list->method_count; ++i)
@@ -434,7 +433,7 @@ class_add_method_list (Class class, MethodList_t list)
        {
          /* This is where selector names are transmogrified to SEL's */
          method->method_name = 
        {
          /* This is where selector names are transmogrified to SEL's */
          method->method_name = 
-           sel_register_typed_name ((const char*)method->method_name,
+           sel_register_typed_name ((const char *) method->method_name,
                                     method->method_types);
        }
     }
                                     method->method_types);
        }
     }
@@ -448,15 +447,15 @@ 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);
 }
 
 
 }
 
 
@@ -580,13 +579,13 @@ __objc_forward (id object, SEL sel, arglist_t args)
   SEL err_sel;
 
   /* first try if the object understands forward:: */
   SEL err_sel;
 
   /* first try if the object understands forward:: */
-  if (!frwd_sel)
-    frwd_sel = sel_get_any_uid("forward::");
+  if (! frwd_sel)
+    frwd_sel = sel_get_any_uid ("forward::");
 
   if (__objc_responds_to (object, frwd_sel))
     {
 
   if (__objc_responds_to (object, frwd_sel))
     {
-      imp = get_imp(object->class_pointer, frwd_sel);
-      return (*imp)(object, frwd_sel, sel, args);
+      imp = get_imp (object->class_pointer, frwd_sel);
+      return (*imp) (object, frwd_sel, sel, args);
     }
 
   /* If the object recognizes the doesNotRecognize: method then we're going
     }
 
   /* If the object recognizes the doesNotRecognize: method then we're going
@@ -601,11 +600,11 @@ __objc_forward (id object, SEL sel, arglist_t args)
   /* The object doesn't recognize the method.  Check for responding to
      error:.  If it does then sent it. */
   {
   /* The object doesn't recognize the method.  Check for responding to
      error:.  If it does then sent it. */
   {
-    char msg[256 + strlen ((const char*)sel_get_name (sel))
-             + strlen ((const char*)object->class_pointer->name)];
+    char msg[256 + strlen ((const char *) sel_get_name (sel))
+             + strlen ((const char *) object->class_pointer->name)];
 
     sprintf (msg, "(%s) %s does not recognize %s",
 
     sprintf (msg, "(%s) %s does not recognize %s",
-            (CLS_ISMETA(object->class_pointer)
+            (CLS_ISMETA (object->class_pointer)
              ? "class"
              : "instance" ),
              object->class_pointer->name, sel_get_name (sel));
              ? "class"
              : "instance" ),
              object->class_pointer->name, sel_get_name (sel));
@@ -626,40 +625,41 @@ __objc_forward (id object, SEL sel, arglist_t args)
 }
 
 void
 }
 
 void
-__objc_print_dtable_stats()
+__objc_print_dtable_stats ()
 {
   int total = 0;
 
 {
   int total = 0;
 
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
 #ifdef OBJC_SPARSE2
 
 #ifdef OBJC_SPARSE2
-  printf("memory usage: (%s)\n", "2-level sparse arrays");
+  printf ("memory usage: (%s)\n", "2-level sparse arrays");
 #else
 #else
-  printf("memory usage: (%s)\n", "3-level sparse arrays");
+  printf ("memory usage: (%s)\n", "3-level sparse arrays");
 #endif
 
 #endif
 
-  printf("arrays: %d = %ld bytes\n", narrays, 
-        (long)narrays*sizeof(struct sarray));
-  total += narrays*sizeof(struct sarray);
-  printf("buckets: %d = %ld bytes\n", nbuckets, 
-        (long)nbuckets*sizeof(struct sbucket));
-  total += nbuckets*sizeof(struct sbucket);
-
-  printf("idxtables: %d = %ld bytes\n", idxsize, (long)idxsize*sizeof(void*));
-  total += idxsize*sizeof(void*);
-  printf("-----------------------------------\n");
-  printf("total: %d bytes\n", total);
-  printf("===================================\n");
-
-  objc_mutex_unlock(__objc_runtime_mutex);
+  printf ("arrays: %d = %ld bytes\n", narrays, 
+         (long) narrays * sizeof (struct sarray));
+  total += narrays * sizeof (struct sarray);
+  printf ("buckets: %d = %ld bytes\n", nbuckets, 
+         (long) nbuckets * sizeof (struct sbucket));
+  total += nbuckets * sizeof (struct sbucket);
+
+  printf ("idxtables: %d = %ld bytes\n",
+         idxsize, (long) idxsize * sizeof (void *));
+  total += idxsize * sizeof (void *);
+  printf ("-----------------------------------\n");
+  printf ("total: %d bytes\n", total);
+  printf ("===================================\n");
+
+  objc_mutex_unlock (__objc_runtime_mutex);
 }
 
 /* Returns the uninstalled dispatch table indicator.
  If a class' dispatch table points to __objc_uninstalled_dtable
  then that means it needs its dispatch table to be installed. */
 __inline__
 }
 
 /* Returns the uninstalled dispatch table indicator.
  If a class' dispatch table points to __objc_uninstalled_dtable
  then that means it needs its dispatch table to be installed. */
 __inline__
-struct sarray
-objc_get_uninstalled_dtable()
+struct sarray *
+objc_get_uninstalled_dtable ()
 {
   return __objc_uninstalled_dtable;
 }
 {
   return __objc_uninstalled_dtable;
 }
index 44af0c1..e954607 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU Objective C Runtime Thread Implementation
 /* GNU Objective C Runtime Thread Implementation
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
    Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
    Modified for Mach threads by Bill Bumgarner <bbum@friday.com>
    Condition functions added by Mircea Oancea <mircea@first.elcom.pub.ro>
    Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
    Modified for Mach threads by Bill Bumgarner <bbum@friday.com>
    Condition functions added by Mircea Oancea <mircea@first.elcom.pub.ro>
@@ -37,7 +37,8 @@ Boston, MA 02111-1307, USA.  */
   maximum priority downward only-- cannot be raised without superuser
   privileges.  Once lowered, it cannot be raised.
   */
   maximum priority downward only-- cannot be raised without superuser
   privileges.  Once lowered, it cannot be raised.
   */
-static int __mach_get_max_thread_priority(cthread_t t, int *base)
+static int
+__mach_get_max_thread_priority (cthread_t t, int *base)
 {
   thread_t threadP;
   kern_return_t error;
 {
   thread_t threadP;
   kern_return_t error;
@@ -47,10 +48,10 @@ static int __mach_get_max_thread_priority(cthread_t t, int *base)
   if (t == NULL)
     return -1;
 
   if (t == NULL)
     return -1;
 
-  threadP  = cthread_thread(t);        /* get thread underlying */
+  threadP  = cthread_thread (t);       /* get thread underlying */
 
 
-  error=thread_info(threadP, THREAD_SCHED_INFO, 
-                   (thread_info_t)&info, &info_count);
+  error = thread_info (threadP, THREAD_SCHED_INFO, 
+                      (thread_info_t) &info, &info_count);
 
   if (error != KERN_SUCCESS)
     return -1;
 
   if (error != KERN_SUCCESS)
     return -1;
@@ -65,14 +66,14 @@ static int __mach_get_max_thread_priority(cthread_t t, int *base)
 
 /* Initialize the threads subsystem. */
 int
 
 /* Initialize the threads subsystem. */
 int
-__objc_init_thread_system(void)
+__objc_init_thread_system (void)
 {
   return 0;
 }
 
 /* Close the threads subsystem. */
 int
 {
   return 0;
 }
 
 /* Close the threads subsystem. */
 int
-__objc_close_thread_system(void)
+__objc_close_thread_system (void)
 {
   return 0;
 }
 {
   return 0;
 }
@@ -81,19 +82,19 @@ __objc_close_thread_system(void)
 
 /* Create a new thread of execution. */
 objc_thread_t
 
 /* Create a new thread of execution. */
 objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
+__objc_thread_detach (void (*func) (void *arg), void *arg)
 {
   objc_thread_t thread_id;
   cthread_t new_thread_handle;
 
   /* create thread */
 {
   objc_thread_t thread_id;
   cthread_t new_thread_handle;
 
   /* create thread */
-  new_thread_handle = cthread_fork((cthread_fn_t)func, arg);
+  new_thread_handle = cthread_fork ((cthread_fn_t) func, arg);
 
 
-  if(new_thread_handle)
+  if (new_thread_handle)
     {
       /* this is not terribly portable */
     {
       /* this is not terribly portable */
-      thread_id = *(objc_thread_t *)&new_thread_handle; 
-      cthread_detach(new_thread_handle);
+      thread_id = *(objc_thread_t *) &new_thread_handle; 
+      cthread_detach (new_thread_handle);
     }
   else
     thread_id = NULL;
     }
   else
     thread_id = NULL;
@@ -103,11 +104,11 @@ __objc_thread_detach(void (*func)(void *arg), void *arg)
 
 /* Set the current thread's priority. */
 int
 
 /* Set the current thread's priority. */
 int
-__objc_thread_set_priority(int priority)
+__objc_thread_set_priority (int priority)
 {
 {
-  objc_thread_t *t = objc_thread_id();
+  objc_thread_t *t = objc_thread_id ();
   cthread_t cT = (cthread_t) t; 
   cthread_t cT = (cthread_t) t; 
-  int maxPriority = __mach_get_max_thread_priority(cT, NULL);
+  int maxPriority = __mach_get_max_thread_priority (cT, NULL);
   int sys_priority = 0;
 
   if (maxPriority == -1)
   int sys_priority = 0;
 
   if (maxPriority == -1)
@@ -132,7 +133,7 @@ __objc_thread_set_priority(int priority)
     return -1;
 
   /* Change the priority */
     return -1;
 
   /* Change the priority */
-  if (cthread_priority(cT, sys_priority, 0) == KERN_SUCCESS)
+  if (cthread_priority (cT, sys_priority, 0) == KERN_SUCCESS)
     return 0;
   else
     return -1;
     return 0;
   else
     return -1;
@@ -140,19 +141,19 @@ __objc_thread_set_priority(int priority)
 
 /* Return the current thread's priority. */
 int
 
 /* Return the current thread's priority. */
 int
-__objc_thread_get_priority(void)
+__objc_thread_get_priority (void)
 {
 {
-  objc_thread_t *t = objc_thread_id();
-  cthread_t cT = (cthread_t) t; /* see objc_thread_id() */
+  objc_thread_t *t = objc_thread_id ();
+  cthread_t cT = (cthread_t) t; /* see objc_thread_id () */
   int basePriority;
   int maxPriority;
   int sys_priority = 0;
 
   int interactiveT, backgroundT, lowT; /* thresholds */
 
   int basePriority;
   int maxPriority;
   int sys_priority = 0;
 
   int interactiveT, backgroundT, lowT; /* thresholds */
 
-  maxPriority = __mach_get_max_thread_priority(cT, &basePriority);
+  maxPriority = __mach_get_max_thread_priority (cT, &basePriority);
 
 
-  if(maxPriority == -1)
+  if (maxPriority == -1)
     return -1;
 
   if (basePriority > ( (maxPriority * 2) / 3))
     return -1;
 
   if (basePriority > ( (maxPriority * 2) / 3))
@@ -166,17 +167,17 @@ __objc_thread_get_priority(void)
 
 /* Yield our process time to another thread. */
 void
 
 /* Yield our process time to another thread. */
 void
-__objc_thread_yield(void)
+__objc_thread_yield (void)
 {
 {
-  cthread_yield();
+  cthread_yield ();
 }
 
 /* Terminate the current thread. */
 int
 }
 
 /* Terminate the current thread. */
 int
-__objc_thread_exit(void)
+__objc_thread_exit (void)
 {
   /* exit the thread */
 {
   /* exit the thread */
-  cthread_exit(&__objc_thread_exit_status);
+  cthread_exit (&__objc_thread_exit_status);
 
   /* Failed if we reached here */
   return -1;
 
   /* Failed if we reached here */
   return -1;
@@ -184,42 +185,42 @@ __objc_thread_exit(void)
 
 /* Returns an integer value which uniquely describes a thread. */
 objc_thread_t
 
 /* Returns an integer value which uniquely describes a thread. */
 objc_thread_t
-__objc_thread_id(void)
+__objc_thread_id (void)
 {
 {
-  cthread_t self = cthread_self();
+  cthread_t self = cthread_self ();
 
 
-  return *(objc_thread_t *)&self;
+  return *(objc_thread_t *) &self;
 }
 
 /* Sets the thread's local storage pointer. */
 int
 }
 
 /* Sets the thread's local storage pointer. */
 int
-__objc_thread_set_data(void *value)
+__objc_thread_set_data (void *value)
 {
 {
-  cthread_set_data(cthread_self(), (any_t) value);
+  cthread_set_data (cthread_self (), (any_t) value);
   return 0;
 }
 
 /* Returns the thread's local storage pointer. */
 void *
   return 0;
 }
 
 /* Returns the thread's local storage pointer. */
 void *
-__objc_thread_get_data(void)
+__objc_thread_get_data (void)
 {
 {
-  return (void *) cthread_data(cthread_self());
+  return (void *) cthread_data (cthread_self ());
 }
 
 /* Backend mutex functions */
 
 /* Allocate a mutex. */
 int
 }
 
 /* Backend mutex functions */
 
 /* Allocate a mutex. */
 int
-__objc_mutex_allocate(objc_mutex_t mutex)
+__objc_mutex_allocate (objc_mutex_t mutex)
 {
   int err = 0;
 {
   int err = 0;
-  mutex->backend = objc_malloc(sizeof(struct mutex));
+  mutex->backend = objc_malloc (sizeof (struct mutex));
 
 
-  err = mutex_init((mutex_t)(mutex->backend));
+  err = mutex_init ((mutex_t) (mutex->backend));
 
   if (err != 0)
     {
 
   if (err != 0)
     {
-      objc_free(mutex->backend);
+      objc_free (mutex->backend);
       return -1;
     }
   else
       return -1;
     }
   else
@@ -228,28 +229,28 @@ __objc_mutex_allocate(objc_mutex_t mutex)
 
 /* Deallocate a mutex. */
 int
 
 /* Deallocate a mutex. */
 int
-__objc_mutex_deallocate(objc_mutex_t mutex)
+__objc_mutex_deallocate (objc_mutex_t mutex)
 {
 {
-  mutex_clear((mutex_t)(mutex->backend));
+  mutex_clear ((mutex_t) (mutex->backend));
 
 
-  objc_free(mutex->backend);
+  objc_free (mutex->backend);
   mutex->backend = NULL;
   return 0;
 }
 
 /* Grab a lock on a mutex. */
 int
   mutex->backend = NULL;
   return 0;
 }
 
 /* Grab a lock on a mutex. */
 int
-__objc_mutex_lock(objc_mutex_t mutex)
+__objc_mutex_lock (objc_mutex_t mutex)
 {
 {
-  mutex_lock((mutex_t)(mutex->backend));
+  mutex_lock ((mutex_t) (mutex->backend));
   return 0;
 }
 
 /* Try to grab a lock on a mutex. */
 int
   return 0;
 }
 
 /* Try to grab a lock on a mutex. */
 int
-__objc_mutex_trylock(objc_mutex_t mutex)
+__objc_mutex_trylock (objc_mutex_t mutex)
 {
 {
-  if (mutex_try_lock((mutex_t)(mutex->backend)) == 0)
+  if (mutex_try_lock ((mutex_t) (mutex->backend)) == 0)
     return -1;
   else
     return 0;
     return -1;
   else
     return 0;
@@ -257,9 +258,9 @@ __objc_mutex_trylock(objc_mutex_t mutex)
 
 /* Unlock the mutex */
 int
 
 /* Unlock the mutex */
 int
-__objc_mutex_unlock(objc_mutex_t mutex)
+__objc_mutex_unlock (objc_mutex_t mutex)
 {
 {
-  mutex_unlock((mutex_t)(mutex->backend));
+  mutex_unlock ((mutex_t) (mutex->backend));
   return 0;
 }
 
   return 0;
 }
 
@@ -267,45 +268,45 @@ __objc_mutex_unlock(objc_mutex_t mutex)
 
 /* Allocate a condition. */
 int
 
 /* Allocate a condition. */
 int
-__objc_condition_allocate(objc_condition_t condition)
+__objc_condition_allocate (objc_condition_t condition)
 {
 {
-  condition->backend = objc_malloc(sizeof(struct condition));
-  condition_init((condition_t)(condition->backend));
+  condition->backend = objc_malloc (sizeof (struct condition));
+  condition_init ((condition_t) (condition->backend));
   return 0;
 }
 
 /* Deallocate a condition. */
 int
   return 0;
 }
 
 /* Deallocate a condition. */
 int
-__objc_condition_deallocate(objc_condition_t condition)
+__objc_condition_deallocate (objc_condition_t condition)
 {
 {
-  condition_clear((condition_t)(condition->backend));
-  objc_free(condition->backend);
+  condition_clear ((condition_t) (condition->backend));
+  objc_free (condition->backend);
   condition->backend = NULL;
   return 0;
 }
 
 /* Wait on the condition */
 int
   condition->backend = NULL;
   return 0;
 }
 
 /* Wait on the condition */
 int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
+__objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
 {
 {
-  condition_wait((condition_t)(condition->backend),
-                (mutex_t)(mutex->backend));
+  condition_wait ((condition_t) (condition->backend),
+                 (mutex_t) (mutex->backend));
   return 0;
 }
 
 /* Wake up all threads waiting on this condition. */
 int
   return 0;
 }
 
 /* Wake up all threads waiting on this condition. */
 int
-__objc_condition_broadcast(objc_condition_t condition)
+__objc_condition_broadcast (objc_condition_t condition)
 {
 {
-  condition_broadcast((condition_t)(condition->backend));
+  condition_broadcast ((condition_t) (condition->backend));
   return 0;
 }
 
 /* Wake up one thread waiting on this condition. */
 int
   return 0;
 }
 
 /* Wake up one thread waiting on this condition. */
 int
-__objc_condition_signal(objc_condition_t condition)
+__objc_condition_signal (objc_condition_t condition)
 {
 {
-  condition_signal((condition_t)(condition->backend));
+  condition_signal ((condition_t) (condition->backend));
   return 0;
 }
 
   return 0;
 }
 
index 13a22a5..bc94473 100644 (file)
@@ -48,7 +48,7 @@ objc_thread_callback _objc_became_multi_threaded = NULL;
   it can be informed; for example, the GNUstep Base Library sets it 
   so it can implement the NSBecomingMultiThreaded notification.
   */
   it can be informed; for example, the GNUstep Base Library sets it 
   so it can implement the NSBecomingMultiThreaded notification.
   */
-objc_thread_callback objc_set_thread_callback(objc_thread_callback func)
+objc_thread_callback objc_set_thread_callback (objc_thread_callback func)
 {
   objc_thread_callback temp = _objc_became_multi_threaded;
   _objc_became_multi_threaded = func;
 {
   objc_thread_callback temp = _objc_became_multi_threaded;
   _objc_became_multi_threaded = func;
@@ -76,44 +76,44 @@ struct __objc_thread_start_state
 };
 
 static volatile void
 };
 
 static volatile void
-__objc_thread_detach_function(struct __objc_thread_start_state *istate)
+__objc_thread_detach_function (struct __objc_thread_start_state *istate)
 {
   /* Valid state? */
   if (istate) {
 {
   /* Valid state? */
   if (istate) {
-    id (*imp)(id,SEL,id);
+    id (*imp) (id, SEL, id);
     SEL selector = istate->selector;
     id object   = istate->object;
     id argument = istate->argument;
 
     /* Don't need anymore so free it */
     SEL selector = istate->selector;
     id object   = istate->object;
     id argument = istate->argument;
 
     /* Don't need anymore so free it */
-    objc_free(istate);
+    objc_free (istate);
 
     /* Clear out the thread local storage */
 
     /* Clear out the thread local storage */
-    objc_thread_set_data(NULL);
+    objc_thread_set_data (NULL);
 
     /* Check to see if we just became multi threaded */
 
     /* Check to see if we just became multi threaded */
-    if (!__objc_is_multi_threaded)
+    if (! __objc_is_multi_threaded)
       {
        __objc_is_multi_threaded = 1;
 
        /* Call the hook function */
        if (_objc_became_multi_threaded != NULL)
       {
        __objc_is_multi_threaded = 1;
 
        /* Call the hook function */
        if (_objc_became_multi_threaded != NULL)
-         (*_objc_became_multi_threaded)();
+         (*_objc_became_multi_threaded) ();
       }
 
     /* Call the method */
       }
 
     /* Call the method */
-    if ((imp = (id(*)(id, SEL, id))objc_msg_lookup(object, selector)))
-       (*imp)(object, selector, argument);
+    if ((imp = (id (*) (id, SEL, id))objc_msg_lookup (object, selector)))
+       (*imp) (object, selector, argument);
     else
     else
-      objc_error(object, OBJC_ERR_UNIMPLEMENTED,
-                "objc_thread_detach called with bad selector.\n");
+      objc_error (object, OBJC_ERR_UNIMPLEMENTED,
+                 "objc_thread_detach called with bad selector.\n");
   }
   else
   }
   else
-    objc_error(nil, OBJC_ERR_BAD_STATE,
-              "objc_thread_detach called with NULL state.\n");
+    objc_error (nil, OBJC_ERR_BAD_STATE,
+               "objc_thread_detach called with NULL state.\n");
 
   /* Exit the thread */
 
   /* Exit the thread */
-  objc_thread_exit();
+  objc_thread_exit ();
 }
 
 /*
 }
 
 /*
@@ -131,14 +131,14 @@ __objc_thread_detach_function(struct __objc_thread_start_state *istate)
   takes a single argument.
   */
 objc_thread_t
   takes a single argument.
   */
 objc_thread_t
-objc_thread_detach(SEL selector, id object, id argument)
+objc_thread_detach (SEL selector, id object, id argument)
 {
   struct __objc_thread_start_state *istate;
   objc_thread_t        thread_id = NULL;
 
   /* Allocate the state structure */
 {
   struct __objc_thread_start_state *istate;
   objc_thread_t        thread_id = NULL;
 
   /* Allocate the state structure */
-  if (!(istate = (struct __objc_thread_start_state *)
-       objc_malloc(sizeof(*istate))))
+  if (! (istate = (struct __objc_thread_start_state *)
+        objc_malloc (sizeof (*istate))))
     return NULL;
 
   /* Initialize the state structure */
     return NULL;
 
   /* Initialize the state structure */
@@ -147,39 +147,39 @@ objc_thread_detach(SEL selector, id object, id argument)
   istate->argument = argument;
 
   /* lock access */
   istate->argument = argument;
 
   /* lock access */
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
 
   /* Call the backend to spawn the thread */
 
   /* Call the backend to spawn the thread */
-  if ((thread_id = __objc_thread_detach((void *)__objc_thread_detach_function,
-                                       istate)) == NULL)
+  if ((thread_id = __objc_thread_detach ((void *)__objc_thread_detach_function,
+                                        istate)) == NULL)
     {
       /* failed! */
     {
       /* failed! */
-      objc_mutex_unlock(__objc_runtime_mutex);
-      objc_free(istate);
+      objc_mutex_unlock (__objc_runtime_mutex);
+      objc_free (istate);
       return NULL;
     }
 
   /* Increment our thread counter */
   __objc_runtime_threads_alive++;
       return NULL;
     }
 
   /* Increment our thread counter */
   __objc_runtime_threads_alive++;
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 
   return thread_id;
 }
 
 /* Set the current thread's priority. */
 int
 
   return thread_id;
 }
 
 /* Set the current thread's priority. */
 int
-objc_thread_set_priority(int priority)
+objc_thread_set_priority (int priority)
 {
   /* Call the backend */
 {
   /* Call the backend */
-  return __objc_thread_set_priority(priority);
+  return __objc_thread_set_priority (priority);
 }
 
 /* Return the current thread's priority. */
 int
 }
 
 /* Return the current thread's priority. */
 int
-objc_thread_get_priority(void)
+objc_thread_get_priority (void)
 {
   /* Call the backend */
 {
   /* Call the backend */
-  return __objc_thread_get_priority();
+  return __objc_thread_get_priority ();
 }
 
 /*
 }
 
 /*
@@ -188,10 +188,10 @@ objc_thread_get_priority(void)
   make progress even on a lazy uniprocessor system.
   */
 void
   make progress even on a lazy uniprocessor system.
   */
 void
-objc_thread_yield(void)
+objc_thread_yield (void)
 {
   /* Call the backend */
 {
   /* Call the backend */
-  __objc_thread_yield();
+  __objc_thread_yield ();
 }
 
 /*
 }
 
 /*
@@ -199,15 +199,15 @@ objc_thread_yield(void)
   Actually, if it failed returns -1.
   */
 int
   Actually, if it failed returns -1.
   */
 int
-objc_thread_exit(void)
+objc_thread_exit (void)
 {
   /* Decrement our counter of the number of threads alive */
 {
   /* Decrement our counter of the number of threads alive */
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
   __objc_runtime_threads_alive--;
   __objc_runtime_threads_alive--;
-  objc_mutex_unlock(__objc_runtime_mutex);
+  objc_mutex_unlock (__objc_runtime_mutex);
 
   /* Call the backend to terminate the thread */
 
   /* Call the backend to terminate the thread */
-  return __objc_thread_exit();
+  return __objc_thread_exit ();
 }
 
 /*
 }
 
 /*
@@ -215,10 +215,10 @@ objc_thread_exit(void)
   NULL which is reserved as a marker for "no thread".
   */
 objc_thread_t
   NULL which is reserved as a marker for "no thread".
   */
 objc_thread_t
-objc_thread_id(void)
+objc_thread_id (void)
 {
   /* Call the backend */
 {
   /* Call the backend */
-  return __objc_thread_id();
+  return __objc_thread_id ();
 }
 
 /*
 }
 
 /*
@@ -226,20 +226,20 @@ objc_thread_id(void)
   Returns 0 if successful or -1 if failed.
   */
 int
   Returns 0 if successful or -1 if failed.
   */
 int
-objc_thread_set_data(void *value)
+objc_thread_set_data (void *value)
 {
   /* Call the backend */
 {
   /* Call the backend */
-  return __objc_thread_set_data(value);
+  return __objc_thread_set_data (value);
 }
 
 /*
   Returns the thread's local storage pointer.  Returns NULL on failure.
   */
 void *
 }
 
 /*
   Returns the thread's local storage pointer.  Returns NULL on failure.
   */
 void *
-objc_thread_get_data(void)
+objc_thread_get_data (void)
 {
   /* Call the backend */
 {
   /* Call the backend */
-  return __objc_thread_get_data();
+  return __objc_thread_get_data ();
 }
 
 /* Frontend mutex functions */
 }
 
 /* Frontend mutex functions */
@@ -249,19 +249,19 @@ objc_thread_get_data(void)
   allocation failed for any reason.
   */
 objc_mutex_t
   allocation failed for any reason.
   */
 objc_mutex_t
-objc_mutex_allocate(void)
+objc_mutex_allocate (void)
 {
   objc_mutex_t mutex;
 
   /* Allocate the mutex structure */
 {
   objc_mutex_t mutex;
 
   /* Allocate the mutex structure */
-  if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex))))
+  if (! (mutex = (objc_mutex_t)objc_malloc (sizeof (struct objc_mutex))))
     return NULL;
 
   /* Call backend to create the mutex */
     return NULL;
 
   /* Call backend to create the mutex */
-  if (__objc_mutex_allocate(mutex))
+  if (__objc_mutex_allocate (mutex))
     {
       /* failed! */
     {
       /* failed! */
-      objc_free(mutex);
+      objc_free (mutex);
       return NULL;
     }
 
       return NULL;
     }
 
@@ -279,23 +279,23 @@ objc_mutex_allocate(void)
   Returns the number of locks on the thread.  (1 for deallocate).
   */
 int
   Returns the number of locks on the thread.  (1 for deallocate).
   */
 int
-objc_mutex_deallocate(objc_mutex_t mutex)
+objc_mutex_deallocate (objc_mutex_t mutex)
 {
   int depth;
 
   /* Valid mutex? */
 {
   int depth;
 
   /* Valid mutex? */
-  if (!mutex)
+  if (! mutex)
     return -1;
 
   /* Acquire lock on mutex */
     return -1;
 
   /* Acquire lock on mutex */
-  depth = objc_mutex_lock(mutex);
+  depth = objc_mutex_lock (mutex);
 
   /* Call backend to destroy mutex */
 
   /* Call backend to destroy mutex */
-  if (__objc_mutex_deallocate(mutex))
+  if (__objc_mutex_deallocate (mutex))
     return -1;
 
   /* Free the mutex structure */
     return -1;
 
   /* Free the mutex structure */
-  objc_free(mutex);
+  objc_free (mutex);
 
   /* Return last depth */
   return depth;
 
   /* Return last depth */
   return depth;
@@ -308,22 +308,22 @@ objc_mutex_deallocate(objc_mutex_t mutex)
   Returns the lock count on the mutex held by this thread.
   */
 int
   Returns the lock count on the mutex held by this thread.
   */
 int
-objc_mutex_lock(objc_mutex_t mutex)
+objc_mutex_lock (objc_mutex_t mutex)
 {
   objc_thread_t thread_id;
   int status;
 
   /* Valid mutex? */
 {
   objc_thread_t thread_id;
   int status;
 
   /* Valid mutex? */
-  if (!mutex)
+  if (! mutex)
     return -1;
 
   /* If we already own the lock then increment depth */
     return -1;
 
   /* If we already own the lock then increment depth */
-  thread_id = __objc_thread_id();
+  thread_id = __objc_thread_id ();
   if (mutex->owner == thread_id)
     return ++mutex->depth;
 
   /* Call the backend to lock the mutex */
   if (mutex->owner == thread_id)
     return ++mutex->depth;
 
   /* Call the backend to lock the mutex */
-  status = __objc_mutex_lock(mutex);
+  status = __objc_mutex_lock (mutex);
 
   /* Failed? */
   if (status)
 
   /* Failed? */
   if (status)
@@ -340,22 +340,22 @@ objc_mutex_lock(objc_mutex_t mutex)
   thread has a lock on the mutex returns -1.
   */
 int
   thread has a lock on the mutex returns -1.
   */
 int
-objc_mutex_trylock(objc_mutex_t mutex)
+objc_mutex_trylock (objc_mutex_t mutex)
 {
   objc_thread_t thread_id;
   int status;
 
   /* Valid mutex? */
 {
   objc_thread_t thread_id;
   int status;
 
   /* Valid mutex? */
-  if (!mutex)
+  if (! mutex)
     return -1;
 
   /* If we already own the lock then increment depth */ 
     return -1;
 
   /* If we already own the lock then increment depth */ 
-  thread_id = __objc_thread_id();
+  thread_id = __objc_thread_id ();
   if (mutex->owner == thread_id)
     return ++mutex->depth;
     
   /* Call the backend to try to lock the mutex */
   if (mutex->owner == thread_id)
     return ++mutex->depth;
     
   /* Call the backend to try to lock the mutex */
-  status = __objc_mutex_trylock(mutex);
+  status = __objc_mutex_trylock (mutex);
 
   /* Failed? */
   if (status)
 
   /* Failed? */
   if (status)
@@ -375,17 +375,17 @@ objc_mutex_trylock(objc_mutex_t mutex)
   doesn't hold in which case return -1 and the mutex is unaffected.
   */
 int
   doesn't hold in which case return -1 and the mutex is unaffected.
   */
 int
-objc_mutex_unlock(objc_mutex_t mutex)
+objc_mutex_unlock (objc_mutex_t mutex)
 {
   objc_thread_t thread_id;
   int status;
 
   /* Valid mutex? */
 {
   objc_thread_t thread_id;
   int status;
 
   /* Valid mutex? */
-  if (!mutex)
+  if (! mutex)
     return -1;
 
   /* If another thread owns the lock then abort */
     return -1;
 
   /* If another thread owns the lock then abort */
-  thread_id = __objc_thread_id();
+  thread_id = __objc_thread_id ();
   if (mutex->owner != thread_id)
     return -1;
 
   if (mutex->owner != thread_id)
     return -1;
 
@@ -398,7 +398,7 @@ objc_mutex_unlock(objc_mutex_t mutex)
   mutex->owner = NULL;
 
   /* Have the backend unlock the mutex */
   mutex->owner = NULL;
 
   /* Have the backend unlock the mutex */
-  status = __objc_mutex_unlock(mutex);
+  status = __objc_mutex_unlock (mutex);
 
   /* Failed? */
   if (status)
 
   /* Failed? */
   if (status)
@@ -414,20 +414,20 @@ objc_mutex_unlock(objc_mutex_t mutex)
   if the allocation failed for any reason.
   */
 objc_condition_t 
   if the allocation failed for any reason.
   */
 objc_condition_t 
-objc_condition_allocate(void)
+objc_condition_allocate (void)
 {
   objc_condition_t condition;
     
   /* Allocate the condition mutex structure */
 {
   objc_condition_t condition;
     
   /* Allocate the condition mutex structure */
-  if (!(condition = 
-       (objc_condition_t)objc_malloc(sizeof(struct objc_condition))))
+  if (! (condition = 
+        (objc_condition_t) objc_malloc (sizeof (struct objc_condition))))
     return NULL;
 
   /* Call the backend to create the condition mutex */
     return NULL;
 
   /* Call the backend to create the condition mutex */
-  if (__objc_condition_allocate(condition))
+  if (__objc_condition_allocate (condition))
     {
       /* failed! */
     {
       /* failed! */
-      objc_free(condition);
+      objc_free (condition);
       return NULL;
     }
 
       return NULL;
     }
 
@@ -443,41 +443,41 @@ objc_condition_allocate(void)
   waiting but just wake them up.
   */
 int
   waiting but just wake them up.
   */
 int
-objc_condition_deallocate(objc_condition_t condition)
+objc_condition_deallocate (objc_condition_t condition)
 {
   /* Broadcast the condition */
 {
   /* Broadcast the condition */
-  if (objc_condition_broadcast(condition))
+  if (objc_condition_broadcast (condition))
     return -1;
 
   /* Call the backend to destroy */
     return -1;
 
   /* Call the backend to destroy */
-  if (__objc_condition_deallocate(condition))
+  if (__objc_condition_deallocate (condition))
     return -1;
 
   /* Free the condition mutex structure */
     return -1;
 
   /* Free the condition mutex structure */
-  objc_free(condition);
+  objc_free (condition);
 
   return 0;
 }
 
 /*
 
   return 0;
 }
 
 /*
-  Wait on the condition unlocking the mutex until objc_condition_signal()
-  or objc_condition_broadcast() are called for the same condition. The
+  Wait on the condition unlocking the mutex until objc_condition_signal ()
+  or objc_condition_broadcast () are called for the same condition. The
   given mutex *must* have the depth set to 1 so that it can be unlocked
   here, so that someone else can lock it and signal/broadcast the condition.
   The mutex is used to lock access to the shared data that make up the
   "condition" predicate.
   */
 int
   given mutex *must* have the depth set to 1 so that it can be unlocked
   here, so that someone else can lock it and signal/broadcast the condition.
   The mutex is used to lock access to the shared data that make up the
   "condition" predicate.
   */
 int
-objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
+objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
 {
   objc_thread_t thread_id;
 
   /* Valid arguments? */
 {
   objc_thread_t thread_id;
 
   /* Valid arguments? */
-  if (!mutex || !condition)
+  if (! mutex || ! condition)
     return -1;
 
   /* Make sure we are owner of mutex */
     return -1;
 
   /* Make sure we are owner of mutex */
-  thread_id = __objc_thread_id();
+  thread_id = __objc_thread_id ();
   if (mutex->owner != thread_id)
     return -1;
 
   if (mutex->owner != thread_id)
     return -1;
 
@@ -490,7 +490,7 @@ objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
   mutex->owner = (objc_thread_t)NULL;
 
   /* Call the backend to wait */
   mutex->owner = (objc_thread_t)NULL;
 
   /* Call the backend to wait */
-  __objc_condition_wait(condition, mutex);
+  __objc_condition_wait (condition, mutex);
 
   /* Make ourselves owner of the mutex */
   mutex->owner = thread_id;
 
   /* Make ourselves owner of the mutex */
   mutex->owner = thread_id;
@@ -506,13 +506,13 @@ objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
   right away after this call.
   */
 int
   right away after this call.
   */
 int
-objc_condition_broadcast(objc_condition_t condition)
+objc_condition_broadcast (objc_condition_t condition)
 {
   /* Valid condition mutex? */
 {
   /* Valid condition mutex? */
-  if (!condition)
+  if (! condition)
     return -1;
 
     return -1;
 
-  return __objc_condition_broadcast(condition);
+  return __objc_condition_broadcast (condition);
 }
 
 /*
 }
 
 /*
@@ -522,42 +522,42 @@ objc_condition_broadcast(objc_condition_t condition)
   right away after this call.
   */
 int
   right away after this call.
   */
 int
-objc_condition_signal(objc_condition_t condition)
+objc_condition_signal (objc_condition_t condition)
 {
   /* Valid condition mutex? */
 {
   /* Valid condition mutex? */
-  if (!condition)
+  if (! condition)
     return -1;
 
     return -1;
 
-  return __objc_condition_signal(condition);
+  return __objc_condition_signal (condition);
 }
 
 /* Make the objc thread system aware that a thread which is managed
    (started, stopped) by external code could access objc facilities
    from now on.  This is used when you are interfacing with some
    external non-objc-based environment/system - you must call
 }
 
 /* Make the objc thread system aware that a thread which is managed
    (started, stopped) by external code could access objc facilities
    from now on.  This is used when you are interfacing with some
    external non-objc-based environment/system - you must call
-   objc_thread_add() before an alien thread makes any calls to
+   objc_thread_add () before an alien thread makes any calls to
    Objective-C.  Do not cause the _objc_became_multi_threaded hook to
    be executed. */
 void 
    Objective-C.  Do not cause the _objc_became_multi_threaded hook to
    be executed. */
 void 
-objc_thread_add(void)
+objc_thread_add (void)
 {
 {
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
   __objc_is_multi_threaded = 1;
   __objc_runtime_threads_alive++;
   __objc_is_multi_threaded = 1;
   __objc_runtime_threads_alive++;
-  objc_mutex_unlock(__objc_runtime_mutex);  
+  objc_mutex_unlock (__objc_runtime_mutex);  
 }
 
 /* Make the objc thread system aware that a thread managed (started,
    stopped) by some external code will no longer access objc and thus
    can be forgotten by the objc thread system.  Call
 }
 
 /* Make the objc thread system aware that a thread managed (started,
    stopped) by some external code will no longer access objc and thus
    can be forgotten by the objc thread system.  Call
-   objc_thread_remove() when your alien thread is done with making
+   objc_thread_remove () when your alien thread is done with making
    calls to Objective-C. */
 void
    calls to Objective-C. */
 void
-objc_thread_remove(void)
+objc_thread_remove (void)
 {
 {
-  objc_mutex_lock(__objc_runtime_mutex);
+  objc_mutex_lock (__objc_runtime_mutex);
   __objc_runtime_threads_alive--;
   __objc_runtime_threads_alive--;
-  objc_mutex_unlock(__objc_runtime_mutex);  
+  objc_mutex_unlock (__objc_runtime_mutex);  
 }
 
 /* End of File */
 }
 
 /* End of File */