From d6b10c99aa432bfb5bff90a350bf1605a1da0b84 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 7 Feb 2011 22:16:16 +0900 Subject: [PATCH] Most, if not all, of the fixes needed to get qwaq building. This is pretty much just changing [] to * and moving [N] to the other side of the variable name. --- ruamoko/include/Array.h | 20 ++++++++++---------- ruamoko/include/AutoreleasePool.h | 2 +- ruamoko/include/Object.h | 2 +- ruamoko/include/Protocol.h | 10 +++++----- ruamoko/include/plist.h | 2 +- ruamoko/include/qfile.h | 8 ++++---- ruamoko/include/runtime.h | 24 ++++++++++++------------ ruamoko/include/script.h | 2 +- ruamoko/lib/Array+Private.r | 2 +- ruamoko/lib/Array.r | 24 ++++++++++++------------ ruamoko/lib/AutoreleasePool.r | 2 +- ruamoko/lib/Object.r | 30 +++++++++++++++--------------- ruamoko/lib/Protocol.r | 22 +++++++++++----------- ruamoko/lib/plist.r | 2 +- ruamoko/lib/qfile.r | 6 +++--- tools/qwaq/defs.qc | 2 +- 16 files changed, 80 insertions(+), 80 deletions(-) diff --git a/ruamoko/include/Array.h b/ruamoko/include/Array.h index d3b6d5e14..62fb1f69c 100644 --- a/ruamoko/include/Array.h +++ b/ruamoko/include/Array.h @@ -23,7 +23,7 @@ unsigned count; ///< The number of objects currently contained unsigned capacity; ///< The number of objects that can be held right now unsigned granularity; ///< The number of pointers allocated at a time (based on initial capacity) - id [] _objs; ///< A primitive array of pointers to objects + id *_objs; ///< A primitive array of pointers to objects } ///\name Creating arrays @@ -43,7 +43,7 @@ /** Returns a copy of \a array, retaining its contents. */ -+ (id) arrayWithArray: (Array [])array; ++ (id) arrayWithArray: (Array *)array; /** Create an array containing only \a anObject . @@ -65,7 +65,7 @@ \warning Do not supply a primitive array containing fewer than \a count objects. */ -+ (id) arrayWithObjects: (id [])objs ++ (id) arrayWithObjects: (id *)objs count: (unsigned)cnt; //\} @@ -79,7 +79,7 @@ /** Initialize the receiver with objects from \a array. */ -- (id) initWithArray: (Array [])array; +- (id) initWithArray: (Array *)array; /** Initialize the receiver with objects from \a array. @@ -87,7 +87,7 @@ \param array The array to duplicate \param flag if #YES, copies the contents instead of retaining them. */ -- (id) initWithArray: (Array [])array +- (id) initWithArray: (Array *)array copyItems: (BOOL)flag; /** @@ -101,7 +101,7 @@ /** Initialize the receiver with a primitive array of objects. */ -- (id) initWithObjects: (id [])objs +- (id) initWithObjects: (id *)objs count: (unsigned)count; //\} @@ -138,7 +138,7 @@ \warning The destination buffer must be large enough to hold all contents. */ -- (BOOL) getObjects: (id [])aBuffer +- (BOOL) getObjects: (id *)aBuffer range: (Range)aRange; #endif //\} @@ -193,7 +193,7 @@ /** Adds each object in \a array to the receiver, retaining it. */ -- (void) addObjectsFromArray: (Array [])array; +- (void) addObjectsFromArray: (Array *)array; /** Adds a single object to an array @@ -218,7 +218,7 @@ \note If \a array and self are the same object, this method has no effect. */ -- (void) setArray: (Array [])array; +- (void) setArray: (Array *)array; //\} ///\name Removing Objects @@ -245,7 +245,7 @@ Finds and removes all objects from the receiver that are equal to any objects in array \a anArray. */ -- (void) removeObjectsInArray: (Array [])anArray; +- (void) removeObjectsInArray: (Array *)anArray; /** Finds and removes all objects from the receiver that are \b exactly equal diff --git a/ruamoko/include/AutoreleasePool.h b/ruamoko/include/AutoreleasePool.h index 7adcd5c78..d01629a69 100644 --- a/ruamoko/include/AutoreleasePool.h +++ b/ruamoko/include/AutoreleasePool.h @@ -22,7 +22,7 @@ */ @interface AutoreleasePool: Object { - Array[] array; ///< a list of objects awaiting release + Array *array; ///< a list of objects awaiting release } /** diff --git a/ruamoko/include/Object.h b/ruamoko/include/Object.h index 91414fc5d..a88f9163f 100644 --- a/ruamoko/include/Object.h +++ b/ruamoko/include/Object.h @@ -25,7 +25,7 @@ withObject: (id)anObject withObject: (id)anotherObject; - (BOOL) respondsToSelector: (SEL)aSelector; -- (BOOL) conformsToProtocol: (Protocol [])aProtocol; +- (BOOL) conformsToProtocol: (Protocol *)aProtocol; - (id) retain; - (id) autorelease; diff --git a/ruamoko/include/Protocol.h b/ruamoko/include/Protocol.h index 2b2eacfba..2894ee4fa 100644 --- a/ruamoko/include/Protocol.h +++ b/ruamoko/include/Protocol.h @@ -12,14 +12,14 @@ struct obj_method_description { { @private string protocol_name; - struct obj_protocol_list [] protocol_list; - struct obj_method_description_list [] instance_methods, class_methods; + struct obj_protocol_list *protocol_list; + struct obj_method_description_list *instance_methods, *class_methods; } - (string) name; -- (BOOL) conformsTo: (Protocol [])aProtocolObject; -- (struct obj_method_description []) descriptionForInstanceMethod: (SEL)aSel; -- (struct obj_method_description []) descriptionForClassMethod: (SEL)aSel; +- (BOOL) conformsTo: (Protocol *)aProtocolObject; +- (struct obj_method_description *) descriptionForInstanceMethod: (SEL)aSel; +- (struct obj_method_description *) descriptionForClassMethod: (SEL)aSel; @end #endif//__ruamoko_Protocol_h diff --git a/ruamoko/include/plist.h b/ruamoko/include/plist.h index f81a12d8e..82f0608ee 100644 --- a/ruamoko/include/plist.h +++ b/ruamoko/include/plist.h @@ -25,7 +25,7 @@ typedef enum {QFDictionary, QFArray, QFBinary, QFString} pltype_t; // possible t @extern plitem_t PL_RemoveObjectAtIndex (plitem_t array_item, integer index); @extern plitem_t PL_NewDictionary (); @extern plitem_t PL_NewArray (); -@extern plitem_t PL_NewData (void []data, integer len); +@extern plitem_t PL_NewData (void *data, integer len); @extern plitem_t PL_NewString (string str); @extern void PL_Free (plitem_t pl); diff --git a/ruamoko/include/qfile.h b/ruamoko/include/qfile.h index 168718752..606234ca8 100644 --- a/ruamoko/include/qfile.h +++ b/ruamoko/include/qfile.h @@ -2,7 +2,7 @@ #define __ruamoko_qfile_h struct _qfile_t {}; -typedef struct _qfile_t [] QFile; +typedef struct _qfile_t *QFile; @extern integer Qrename (string old, string new); @extern integer Qremove (string path); @@ -10,10 +10,10 @@ typedef struct _qfile_t [] QFile; @extern void Qclose (QFile file); @extern string Qgetline (QFile file); @extern string Qreadstring (QFile file, integer len); -@extern integer Qread (QFile file, void [] buf, integer count); -@extern integer Qwrite (QFile file, void [] buf, integer count); +@extern integer Qread (QFile file, void *buf, integer count); +@extern integer Qwrite (QFile file, void *buf, integer count); @extern integer Qputs (QFile file, string str); -//@extern integer Qgets (QFile file, void [] buf, integer count); +//@extern integer Qgets (QFile file, void *buf, integer count); @extern integer Qgetc (QFile file); @extern integer Qputc (QFile file, integer c); @extern integer Qseek (QFile file, integer offset, integer whence); diff --git a/ruamoko/include/runtime.h b/ruamoko/include/runtime.h index 95d0ab4f9..46f83b31a 100644 --- a/ruamoko/include/runtime.h +++ b/ruamoko/include/runtime.h @@ -24,17 +24,17 @@ typedef enum { @extern IMP obj_msg_lookup (id receiver, SEL op); @extern IMP obj_msg_lookup_super (Super class, SEL op); @extern @param obj_msg_sendv (id receiver, SEL op, @va_list args); -@extern (void []) obj_malloc (integer size); -@extern (void []) obj_atomic_malloc (integer size); -@extern (void []) obj_valloc (integer size); -@extern (void []) obj_realloc (void [] mem, integer size); -@extern (void []) obj_calloc (integer nelem, integer size); -@extern void obj_free (void [] mem); -//(void []) obj_get_uninstalled_dtable (void); +@extern void *obj_malloc (integer size); +@extern void *obj_atomic_malloc (integer size); +@extern void *obj_valloc (integer size); +@extern void *obj_realloc (void *mem, integer size); +@extern void *obj_calloc (integer nelem, integer size); +@extern void obj_free (void *mem); +//(void *) obj_get_uninstalled_dtable (void); @extern Class obj_get_class (string name); @extern Class obj_lookup_class (string name); -//Class obj_next_class (void [][] enum_stage); +//Class obj_next_class (void **enum_stage); @extern string sel_get_name (SEL selector); @extern string sel_get_type (SEL selector); @@ -46,8 +46,8 @@ typedef enum { //@extern SEL sel_register_typed_name (string name, string type); @extern BOOL sel_is_mapped (SEL aSel); -@extern Method []class_get_class_method (Class class, SEL aSel); -@extern Method []class_get_instance_method (Class class, SEL aSel); +@extern Method *class_get_class_method (Class class, SEL aSel); +@extern Method *class_get_instance_method (Class class, SEL aSel); @extern Class class_pose_as (Class imposter, Class superclass); @extern id class_create_instance (Class class); @extern string class_get_class_name (Class class); @@ -58,10 +58,10 @@ typedef enum { @extern BOOL class_is_class (Class class); @extern BOOL class_is_meta_class (Class class); @extern void class_set_version (Class class, integer version); -@extern (void []) class_get_gc_object_type (Class class); +@extern void *class_get_gc_object_type (Class class); @extern void class_ivar_set_gcinvisible (Class class, string ivarname, BOOL gcInvisible); -@extern IMP method_get_imp (Method []method); +@extern IMP method_get_imp (Method *method); @extern IMP get_imp (Class class, SEL sel); @extern id object_copy (id object); diff --git a/ruamoko/include/script.h b/ruamoko/include/script.h index 53b986639..37a67c17d 100644 --- a/ruamoko/include/script.h +++ b/ruamoko/include/script.h @@ -1,7 +1,7 @@ #ifndef __ruamoko_script_h #define __ruamoko_script_h -typedef struct rua_script [] script_t; +typedef struct rua_script *script_t; @extern script_t Script_New (void); @extern void Script_Delete (script_t script); diff --git a/ruamoko/lib/Array+Private.r b/ruamoko/lib/Array+Private.r index 6f4441732..148942fbc 100644 --- a/ruamoko/lib/Array+Private.r +++ b/ruamoko/lib/Array+Private.r @@ -10,7 +10,7 @@ { if (count == capacity) { capacity += granularity; - _objs = (id [])obj_realloc (_objs, capacity * @sizeof (id)); + _objs = (id *)obj_realloc (_objs, capacity * @sizeof (id)); } _objs[count++] = anObject; } diff --git a/ruamoko/lib/Array.r b/ruamoko/lib/Array.r index e4b796eda..c399f5316 100644 --- a/ruamoko/lib/Array.r +++ b/ruamoko/lib/Array.r @@ -26,14 +26,14 @@ return [[[self alloc] initWithCapacity: cap] autorelease]; } -+ (id) arrayWithArray: (Array [])array ++ (id) arrayWithArray: (Array *)array { return [[array copy] autorelease]; } + (id) arrayWithObject: (id)anObject { - Array [] newArray = (Array [])[self arrayWithCapacity: STANDARD_CAPACITY]; + Array *newArray = (Array *)[self arrayWithCapacity: STANDARD_CAPACITY]; [newArray addObject: anObject]; return newArray; @@ -50,7 +50,7 @@ return [newArray autorelease]; } -+ (id) arrayWithObjects: (id []) objs count: (unsigned)cnt ++ (id) arrayWithObjects: (id *) objs count: (unsigned)cnt { local integer i; id newArray = [self array]; @@ -82,11 +82,11 @@ if (granularity > ARRAY_MAX_GRANULARITY) granularity = ARRAY_MAX_GRANULARITY; - _objs = (id []) obj_malloc (capacity * @sizeof (id)); + _objs = (id *) obj_malloc (capacity * @sizeof (id)); return self; } -- (id) initWithArray: (Array [])array +- (id) initWithArray: (Array *)array { #if 0 local unsigned i; @@ -104,7 +104,7 @@ #endif } -- (id) initWithArray: (Array [])array +- (id) initWithArray: (Array *)array copyItems: (BOOL)copy { local unsigned i; @@ -136,7 +136,7 @@ return self; } -- (id) initWithObjects: (id []) objs count: (unsigned)cnt +- (id) initWithObjects: (id *) objs count: (unsigned)cnt { local integer i; @@ -235,13 +235,13 @@ { if (count == capacity) { capacity += granularity; - _objs = (id [])obj_realloc (_objs, capacity * @sizeof (id)); + _objs = (id *)obj_realloc (_objs, capacity * @sizeof (id)); } _objs[count] = [anObject retain]; count++; } -- (void) addObjectsFromArray: (Array [])array +- (void) addObjectsFromArray: (Array *)array { local unsigned i; @@ -265,7 +265,7 @@ [self error: "-insertObject:atIndex: index out of range"]; if (count == capacity) { // at capacity, expand - _objs = (id [])obj_realloc (_objs, capacity * @sizeof (id)); + _objs = (id *)obj_realloc (_objs, capacity * @sizeof (id)); capacity += granularity; } @@ -299,7 +299,7 @@ [tmp release]; } -- (void) setArray: (Array [])array +- (void) setArray: (Array *)array { if (self == array) return; @@ -381,7 +381,7 @@ } while (i); } -- (void) removeObjectsInArray: (Array [])array +- (void) removeObjectsInArray: (Array *)array { local unsigned i = [array count]; diff --git a/ruamoko/lib/AutoreleasePool.r b/ruamoko/lib/AutoreleasePool.r index 5092c7de1..a787811b0 100644 --- a/ruamoko/lib/AutoreleasePool.r +++ b/ruamoko/lib/AutoreleasePool.r @@ -4,7 +4,7 @@ #include "Array.h" #include "Array+Private.h" -@static Array[] poolStack; +@static Array *poolStack; @implementation AutoreleasePool diff --git a/ruamoko/lib/Object.r b/ruamoko/lib/Object.r index 5ef3472b8..7543b8725 100644 --- a/ruamoko/lib/Object.r +++ b/ruamoko/lib/Object.r @@ -1,26 +1,26 @@ #include "Object.h" #include "AutoreleasePool.h" -void (obj_module_t [] msg) __obj_exec_class = #0; +void (obj_module_t *msg) __obj_exec_class = #0; void (id object, integer code, string fmt, ...) obj_error = #0; void (id object, integer code, string fmt, @va_list args) obj_verror = #0; //obj_error_handler (objc_error_handler func) obj_set_error_handler = #0; IMP (id receiver, SEL op) obj_msg_lookup = #0; IMP (Super class, SEL op) obj_msg_lookup_super = #0; id (id receiver, SEL op, ...) obj_msgSend = #0; -id (Super[] class, SEL op, ...) obj_msgSend_super = #0; +id (Super*class, SEL op, ...) obj_msgSend_super = #0; @param (id receiver, SEL op, @va_list args) obj_msg_sendv = #0; -(void []) (integer size) obj_malloc = #0; -(void []) (integer size) obj_atomic_malloc = #0; -(void []) (integer size) obj_valloc = #0; -(void []) (void [] mem, integer size) obj_realloc = #0; -(void []) (integer nelem, integer size) obj_calloc = #0; -void (void [] mem) obj_free = #0; -//(void []) (void) obj_get_uninstalled_dtable = #0; +void *obj_malloc (integer size) = #0; +void *obj_atomic_malloc (integer size) = #0; +void *obj_valloc (integer size) = #0; +void *obj_realloc (void *mem, integer size) = #0; +void *obj_calloc (integer nelem, integer size) = #0; +void (void *mem) obj_free = #0; +//(void *) (void) obj_get_uninstalled_dtable = #0; Class (string name) obj_get_class = #0; Class (string name) obj_lookup_class = #0; -//Class (void [][] enum_stage) obj_next_class = #0; +//Class (void **enum_stage) obj_next_class = #0; string (SEL selector) sel_get_name = #0; string (SEL selector) sel_get_type = #0; @@ -32,8 +32,8 @@ SEL (string name) sel_register_name = #0; //SEL (string name, string type) sel_register_typed_name = #0; BOOL (SEL aSel) sel_is_mapped = #0; -Method [](Class class, SEL aSel) class_get_class_method = #0; -Method [](Class class, SEL aSel) class_get_instance_method = #0; +Method *class_get_class_method (Class class, SEL aSel) = #0; +Method *class_get_instance_method (Class class, SEL aSel) = #0; Class (Class imposter, Class superclass) class_pose_as = #0; id (Class class) class_create_instance = #0; string (Class class) class_get_class_name = #0; @@ -44,10 +44,10 @@ integer (Class class) class_get_version = #0; BOOL (Class class) class_is_class = #0; BOOL (Class class) class_is_meta_class = #0; void (Class class, integer version) class_set_version = #0; -(void []) (Class class) class_get_gc_object_type = #0; +void *class_get_gc_object_type (Class class) = #0; void (Class class, string ivarname, BOOL gcInvisible) class_ivar_set_gcinvisible = #0; -IMP (Method []method) method_get_imp = #0; +IMP (Method *method) method_get_imp = #0; IMP (Class class, SEL sel) get_imp = #0; id (id object) object_copy = #0; @@ -206,7 +206,7 @@ BOOL (id object) object_is_meta_class = #0; return (class_get_instance_method ([self class], aSelector) != nil); } -- (BOOL) conformsToProtocol: (Protocol [])aProtocol +- (BOOL) conformsToProtocol: (Protocol *)aProtocol { return [[self class] conformsToProtocol: aProtocol]; } diff --git a/ruamoko/lib/Protocol.r b/ruamoko/lib/Protocol.r index efcd108e8..0ccf827bf 100644 --- a/ruamoko/lib/Protocol.r +++ b/ruamoko/lib/Protocol.r @@ -1,14 +1,14 @@ #include "Protocol.h" struct obj_protocol_list { - struct obj_protocol_list [] next; + struct obj_protocol_list *next; integer count; - Protocol[] [1] list; + Protocol *list[1]; }; struct obj_method_description_list { integer count; - struct obj_method_description [1] list; + struct obj_method_description list[1]; }; @implementation Protocol @@ -17,10 +17,10 @@ struct obj_method_description_list { return protocol_name; } -- (BOOL) conformsTo: (Protocol [])aProtocolObject +- (BOOL) conformsTo: (Protocol *)aProtocolObject { local integer i; - local struct obj_protocol_list [] proto_list; + local struct obj_protocol_list *proto_list; if (aProtocolObject.protocol_name == protocol_name) return YES; @@ -35,12 +35,12 @@ struct obj_method_description_list { return NO; } -- (struct obj_method_description []) descriptionForInstanceMethod: (SEL)aSel +- (struct obj_method_description *) descriptionForInstanceMethod: (SEL)aSel { local integer i; - local struct obj_protocol_list [] proto_list; + local struct obj_protocol_list *proto_list; local string name = sel_get_name (aSel); - local struct obj_method_description [] result; + local struct obj_method_description *result; for (i = 0; i < instance_methods.count; i++) { if (instance_methods.list[i].name == name) @@ -58,12 +58,12 @@ struct obj_method_description_list { return nil; } -- (struct obj_method_description []) descriptionForClassMethod: (SEL)aSel +- (struct obj_method_description *) descriptionForClassMethod: (SEL)aSel { local integer i; - local struct obj_protocol_list [] proto_list; + local struct obj_protocol_list *proto_list; local string name = sel_get_name (aSel); - local struct obj_method_description [] result; + local struct obj_method_description *result; for (i = 0; i < class_methods.count; i++) { if (class_methods.list[i].name == name) diff --git a/ruamoko/lib/plist.r b/ruamoko/lib/plist.r index eb59327a4..0acb95b0e 100644 --- a/ruamoko/lib/plist.r +++ b/ruamoko/lib/plist.r @@ -17,6 +17,6 @@ integer PL_A_InsertObjectAtIndex (plitem_t array_item, plitem_t item, integer in plitem_t PL_RemoveObjectAtIndex (plitem_t array_item, integer index) = #0; plitem_t PL_NewDictionary (void) = #0; plitem_t PL_NewArray (void) = #0; -plitem_t PL_NewData (void []data, integer len) = #0; +plitem_t PL_NewData (void *data, integer len) = #0; plitem_t PL_NewString (string str) = #0; void PL_Free (plitem_t pl) = #0; diff --git a/ruamoko/lib/qfile.r b/ruamoko/lib/qfile.r index 2cca4ef03..eba2f0dd2 100644 --- a/ruamoko/lib/qfile.r +++ b/ruamoko/lib/qfile.r @@ -6,10 +6,10 @@ QFile (string path, string mode) Qopen = #0; void (QFile file) Qclose = #0; string (QFile file) Qgetline = #0; string (QFile file, integer length) Qreadstring = #0; -integer (QFile file, void [] buf, integer count) Qread = #0; -integer (QFile file, void [] buf, integer count) Qwrite = #0; +integer (QFile file, void *buf, integer count) Qread = #0; +integer (QFile file, void *buf, integer count) Qwrite = #0; integer (QFile file, string str) Qputs = #0; -//integer (QFile file, void [] buf, integer count) Qgets = #0; +//integer (QFile file, void *buf, integer count) Qgets = #0; integer (QFile file) Qgetc = #0; integer (QFile file, integer c) Qputc = #0; integer (QFile file, integer offset, integer whence) Qseek = #0; diff --git a/tools/qwaq/defs.qc b/tools/qwaq/defs.qc index 664e40288..06460266f 100644 --- a/tools/qwaq/defs.qc +++ b/tools/qwaq/defs.qc @@ -3,7 +3,7 @@ integer () errno = #0; string (integer err) strerror = #0; integer (...) open = #0; // string path, float flags[, float mode] integer (integer handle) close = #0; -string (integer handle, integer count, integer []result) read = #0; +string (integer handle, integer count, integer *result) read = #0; integer (integer handle, string buffer, integer count) write = #0; integer (integer handle, integer pos, integer whence) seek = #0;