From 1195df968607ec25b50cfd8f0c2f7889bd80d73e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 13 Feb 2011 21:25:36 +0900 Subject: [PATCH] Update for the new syntax. --- ruamoko/include/List.h | 4 ++-- ruamoko/include/ListNode.h | 2 +- ruamoko/include/PropertyList.h | 32 ++++++++++++++++---------------- ruamoko/include/cmd.h | 2 +- ruamoko/include/draw.h | 2 +- ruamoko/include/entities.h | 2 +- ruamoko/include/gib.h | 2 +- ruamoko/include/hash.h | 28 ++++++++++++++-------------- ruamoko/include/qfs.h | 8 ++++---- ruamoko/lib/Entity.r | 3 ++- ruamoko/lib/List.r | 26 +++++++++++++------------- ruamoko/lib/PropertyList.r | 32 ++++++++++++++++---------------- ruamoko/lib/entities.r | 2 +- ruamoko/lib/gib.r | 2 +- ruamoko/lib/hash.r | 34 +++++++++++++++++----------------- ruamoko/lib/qfile.r | 34 +++++++++++++++++----------------- ruamoko/lib/qfs.r | 16 ++++++++-------- 17 files changed, 116 insertions(+), 115 deletions(-) diff --git a/ruamoko/include/List.h b/ruamoko/include/List.h index ff8ee3abf..de9835726 100644 --- a/ruamoko/include/List.h +++ b/ruamoko/include/List.h @@ -6,8 +6,8 @@ @interface List: Object { integer count; - struct list_bucket_s [] head; - struct list_bucket_s [][] tail; + struct list_bucket_s *head; + struct list_bucket_s **tail; } - (id) init; - (id) getItemAt: (integer) index; diff --git a/ruamoko/include/ListNode.h b/ruamoko/include/ListNode.h index 7c27e7d25..30c69b057 100644 --- a/ruamoko/include/ListNode.h +++ b/ruamoko/include/ListNode.h @@ -34,7 +34,7 @@ @interface ListNode: Object { - ListNode[] nextNode; + ListNode *nextNode; id data; } diff --git a/ruamoko/include/PropertyList.h b/ruamoko/include/PropertyList.h index 016371a6e..77146686a 100644 --- a/ruamoko/include/PropertyList.h +++ b/ruamoko/include/PropertyList.h @@ -9,12 +9,12 @@ plitem_t item; integer own; } -+ (PLItem []) newDictionary; -+ (PLItem []) newArray; -+ (PLItem []) newData:(void[]) data size:(integer) len; -+ (PLItem []) newString:(string) str; -+ (PLItem []) fromString:(string) str; -+ (PLItem []) fromFile:(QFile) file; ++ (PLItem *) newDictionary; ++ (PLItem *) newArray; ++ (PLItem *) newData:(void*) data size:(integer) len; ++ (PLItem *) newString:(string) str; ++ (PLItem *) fromString:(string) str; ++ (PLItem *) fromFile:(QFile) file; - initWithItem:(plitem_t) item; - initWithOwnItem:(plitem_t) item; @@ -23,31 +23,31 @@ @end @interface PLDictionary: PLItem -+ (PLDictionary []) new; ++ (PLDictionary *) new; - (integer) count; - (integer) numKeys; -- (PLItem []) getObjectForKey:(string) key; -- (PLItem []) allKeys; -- addKey:(string) key value:(PLItem []) value; +- (PLItem *) getObjectForKey:(string) key; +- (PLItem *) allKeys; +- addKey:(string) key value:(PLItem *) value; @end @interface PLArray: PLItem -+ (PLArray []) new; ++ (PLArray *) new; - (integer) count; - (integer) numObjects; -- (PLItem []) getObjectAtIndex:(integer) index; -- addObject:(PLItem []) object; -- insertObject:(PLItem []) object atIndex:(integer) index; +- (PLItem *) getObjectAtIndex:(integer) index; +- addObject:(PLItem *) object; +- insertObject:(PLItem *) object atIndex:(integer) index; @end @interface PLData: PLItem -+ (PLData []) new:(void[]) data size:(integer) len; ++ (PLData *) new:(void*) data size:(integer) len; @end @interface PLString: PLItem -+ (PLString []) new:(string) str; ++ (PLString *) new:(string) str; - (string) string; @end diff --git a/ruamoko/include/cmd.h b/ruamoko/include/cmd.h index dc072c6f1..a07b7e93f 100644 --- a/ruamoko/include/cmd.h +++ b/ruamoko/include/cmd.h @@ -1,7 +1,7 @@ #ifndef __ruamoko_cmd_h #define __ruamoko_cmd_h -@extern void Cmd_AddCommand (string name, void () func); +@extern void Cmd_AddCommand (string name, void func ()); @extern integer Cmd_Argc (void); @extern string Cmd_Argv (integer arg); @extern string Cmd_Args (integer arg); diff --git a/ruamoko/include/draw.h b/ruamoko/include/draw.h index 91e2505d4..4ae19fc06 100644 --- a/ruamoko/include/draw.h +++ b/ruamoko/include/draw.h @@ -7,7 +7,7 @@ struct _qpic_t { integer width; integer height; }; -typedef struct _qpic_t [] qpic_t; +typedef struct _qpic_t *qpic_t; @extern qpic_t Draw_CachePic (string name, integer alpha); diff --git a/ruamoko/include/entities.h b/ruamoko/include/entities.h index 8ecc6edae..167aaa573 100644 --- a/ruamoko/include/entities.h +++ b/ruamoko/include/entities.h @@ -112,6 +112,6 @@ */ @extern entity nextent (entity e); -@extern void EntityParseFunction (void (string ent_data) func); +@extern void EntityParseFunction (void func (string ent_data)); ///\} #endif //__ruamoko_entities_h diff --git a/ruamoko/include/gib.h b/ruamoko/include/gib.h index f33acc6c1..df26b7010 100644 --- a/ruamoko/include/gib.h +++ b/ruamoko/include/gib.h @@ -1,7 +1,7 @@ #ifndef __ruamoko_gib_h #define __ruamoko_gib_h -@extern void GIB_Builtin_Add (string name, void (integer argc, string [] argv) func); +@extern void GIB_Builtin_Add (string name, void func (integer argc, string *argv)); @extern integer GIB_Return (string value); #endif//__ruamoko_gib_h diff --git a/ruamoko/include/hash.h b/ruamoko/include/hash.h index 60ad0d72a..eb2bbe924 100644 --- a/ruamoko/include/hash.h +++ b/ruamoko/include/hash.h @@ -2,24 +2,24 @@ #define __ruamoko_hash_h struct _hashtab_t {}; -typedef struct _hashtab_t [] hashtab_t; +typedef struct _hashtab_t *hashtab_t; -@extern hashtab_t Hash_NewTable (integer size, string (void []ele, void []data) gk, void (void []ele, void []data) f, void [] ud); -@extern void Hash_SetHashCompare (hashtab_t tab, unsigned (void []ele, void []data) gh, integer (void [] ele1, void [] ele2, void [] data) cmp); +@extern hashtab_t Hash_NewTable (integer size, string gk (void *ele, void *data), void f (void *ele, void *data), void *ud); +@extern void Hash_SetHashCompare (hashtab_t tab, unsigned gh (void *ele, void *data), integer cmp (void *ele1, void *ele2, void *data)); @extern void Hash_DelTable (hashtab_t tab); @extern void Hash_FlushTable (hashtab_t tab); -@extern integer Hash_Add (hashtab_t tab, void [] ele); -@extern integer Hash_AddElement (hashtab_t tab, void [] ele); -@extern (void []) Hash_Find (hashtab_t tab, string key); -@extern (void []) Hash_FindElement (hashtab_t tab, void [] ele); -@extern (void [][]) Hash_FindList (hashtab_t tab, string key); -@extern (void [][]) Hash_FindElementList (hashtab_t tab, void [] ele); -@extern (void []) Hash_Del (hashtab_t tab, string key); -@extern (void []) Hash_DelElement (hashtab_t tab, void [] ele); -@extern void Hash_Free (hashtab_t tab, void [] ele); +@extern integer Hash_Add (hashtab_t tab, void *ele); +@extern integer Hash_AddElement (hashtab_t tab, void *ele); +@extern void *Hash_Find (hashtab_t tab, string key); +@extern void *Hash_FindElement (hashtab_t tab, void *ele); +@extern void **Hash_FindList (hashtab_t tab, string key); +@extern void **Hash_FindElementList (hashtab_t tab, void *ele); +@extern void *Hash_Del (hashtab_t tab, string key); +@extern void *Hash_DelElement (hashtab_t tab, void *ele); +@extern void Hash_Free (hashtab_t tab, void *ele); @extern integer Hash_String (string str); -@extern integer Hash_Buffer (void [] buf, integer len); -@extern (void [][]) Hash_GetList (hashtab_t tab); +@extern integer Hash_Buffer (void *buf, integer len); +@extern void **Hash_GetList (hashtab_t tab); @extern void Hash_Stats (hashtab_t tab); #endif // __ruamoko_hash_h diff --git a/ruamoko/include/qfs.h b/ruamoko/include/qfs.h index 6bf933f76..95c000e6c 100644 --- a/ruamoko/include/qfs.h +++ b/ruamoko/include/qfs.h @@ -5,16 +5,16 @@ struct _qfslist_t { integer count; - string []list; + string *list; }; -typedef struct _qfslist_t [] QFSlist; +typedef struct _qfslist_t *QFSlist; @extern QFile QFS_Open (string path, string mode); @extern QFile QFS_WOpen (string path, integer zip); @extern integer QFS_Rename (string old, string new); -@extern (void []) QFS_LoadFile (string filename); +@extern void *QFS_LoadFile (string filename); @extern QFile QFS_OpenFile (string filename); -@extern integer QFS_WriteFile (string filename, void [] buf, integer count); +@extern integer QFS_WriteFile (string filename, void *buf, integer count); @extern QFSlist QFS_Filelist (string path, string ext, integer strip); @extern void QFS_FilelistFree (QFSlist list); diff --git a/ruamoko/lib/Entity.r b/ruamoko/lib/Entity.r index 1e9c2e33b..e64855452 100644 --- a/ruamoko/lib/Entity.r +++ b/ruamoko/lib/Entity.r @@ -67,7 +67,7 @@ function PR_FindFunction (string func) = #0; local string field, value; local plitem_t keys; local function func; - local Entity [] e; + local Entity *e; classname = PL_String (PL_ObjectForKey (dict, "classname")); if (classname == "worldspawn") @@ -96,6 +96,7 @@ function PR_FindFunction (string func) = #0; } if (ent) [e own]; + return e; } @end diff --git a/ruamoko/lib/List.r b/ruamoko/lib/List.r index a2ad6ec65..e49bb58c7 100644 --- a/ruamoko/lib/List.r +++ b/ruamoko/lib/List.r @@ -1,8 +1,8 @@ #include "List.h" struct list_bucket_s { - struct list_bucket_s [] next; - struct list_bucket_s [][] prev; + struct list_bucket_s *next; + struct list_bucket_s **prev; id obj; }; typedef struct list_bucket_s list_bucket_t; @@ -19,7 +19,7 @@ typedef struct list_bucket_s list_bucket_t; - (void) dealloc { - local list_bucket_t [] e, t = nil; //FIXME t uninitialized + local list_bucket_t *e, *t = nil; //FIXME t uninitialized for (e = head; e; e = t) { t = e.next; @@ -31,7 +31,7 @@ typedef struct list_bucket_s list_bucket_t; - (id) getItemAt: (integer) index { - local list_bucket_t [] e; + local list_bucket_t *e; if (index < 0 || index >= count) return nil; for (e = head; e && index; index--) @@ -48,7 +48,7 @@ typedef struct list_bucket_s list_bucket_t; -(id) tail { - local list_bucket_t [] e = (list_bucket_t []) tail; + local list_bucket_t *e = (list_bucket_t *) tail; if (!e) return nil; return e.obj; @@ -56,7 +56,7 @@ typedef struct list_bucket_s list_bucket_t; -(void) addItemAtHead: (id) item { - local list_bucket_t [] e = obj_malloc (@sizeof (list_bucket_t)); + local list_bucket_t *e = obj_malloc (@sizeof (list_bucket_t)); e.obj = item; e.next = head; e.prev = &head; @@ -68,7 +68,7 @@ typedef struct list_bucket_s list_bucket_t; -(void) addItemAtTail: (id) item { - local list_bucket_t [] e = obj_malloc (@sizeof (list_bucket_t)); + local list_bucket_t *e = obj_malloc (@sizeof (list_bucket_t)); e.obj = item; e.next = nil; e.prev = tail; @@ -79,7 +79,7 @@ typedef struct list_bucket_s list_bucket_t; - (id) removeItem: (id) item { - local list_bucket_t [] e; + local list_bucket_t *e; for (e = head; e; e = e.next) { if (e.obj == item) { @@ -96,7 +96,7 @@ typedef struct list_bucket_s list_bucket_t; - (id) removeItemAtHead { - local list_bucket_t [] e; + local list_bucket_t *e; local id obj; if (!count) @@ -115,12 +115,12 @@ typedef struct list_bucket_s list_bucket_t; - (id) removeItemAtTail { - local list_bucket_t [] e; + local list_bucket_t *e; local id obj; if (!count) return nil; - e = (list_bucket_t []) tail; + e = (list_bucket_t *) tail; obj = e.obj; e.prev[0] = e.next; if (e.next) @@ -137,14 +137,14 @@ typedef struct list_bucket_s list_bucket_t; -(void)makeObjectsPerformSelector:(SEL)selector { - local list_bucket_t [] e; + local list_bucket_t *e; for (e = head; e; e = e.next) [e.obj performSelector:selector]; } -(void)makeObjectsPerformSelector:(SEL)selector withObject:(id)arg { - local list_bucket_t [] e; + local list_bucket_t *e; for (e = head; e; e = e.next) [e.obj performSelector:selector withObject:arg]; } diff --git a/ruamoko/lib/PropertyList.r b/ruamoko/lib/PropertyList.r index 13be92d7f..047eeac74 100644 --- a/ruamoko/lib/PropertyList.r +++ b/ruamoko/lib/PropertyList.r @@ -2,22 +2,22 @@ @implementation PLItem -+ (PLItem []) newDictionary ++ (PLItem *) newDictionary { return [PLDictionary new]; } -+ (PLItem []) newArray ++ (PLItem *) newArray { return [PLArray new]; } -+ (PLItem []) newData:(void[]) data size:(integer) len ++ (PLItem *) newData:(void*) data size:(integer) len { return [PLData new:data size:len]; } -+ (PLItem []) newString:(string) str ++ (PLItem *) newString:(string) str { return [PLString new:str]; } @@ -49,12 +49,12 @@ return [[class alloc] initWithItem: item]; } -+ (PLItem []) fromString:(string) str ++ (PLItem *) fromString:(string) str { return [[PLItem itemClass: PL_GetPropertyList (str)] autorelease]; } -+ (PLItem []) fromFile:(QFile) file ++ (PLItem *) fromFile:(QFile) file { return [[PLItem itemClass: PL_GetFromFile (file)] autorelease]; } @@ -99,7 +99,7 @@ @implementation PLDictionary -+ (PLDictionary []) new ++ (PLDictionary *) new { return [[PLDictionary alloc] initWithOwnItem: PL_NewDictionary ()]; } @@ -114,17 +114,17 @@ return PL_D_NumKeys (item); } -- (PLItem []) getObjectForKey:(string) key +- (PLItem *) getObjectForKey:(string) key { return [[PLItem itemClass: PL_ObjectForKey (item, key)] autorelease]; } -- (PLItem []) allKeys +- (PLItem *) allKeys { return [[PLItem itemClass: PL_D_AllKeys (item)] autorelease]; } -- addKey:(string) key value:(PLItem []) value +- addKey:(string) key value:(PLItem *) value { if (!value.own) { obj_error (self, 0, "add of unowned key/value to PLDictionary"); @@ -140,7 +140,7 @@ @implementation PLArray -+ (PLArray []) new ++ (PLArray *) new { return [[PLArray alloc] initWithOwnItem: PL_NewArray ()]; } @@ -155,12 +155,12 @@ return PL_A_NumObjects (item); } -- (PLItem []) getObjectAtIndex:(integer) index +- (PLItem *) getObjectAtIndex:(integer) index { return [[PLItem itemClass: PL_ObjectAtIndex (item, index)] autorelease]; } -- addObject:(PLItem []) object +- addObject:(PLItem *) object { if (!object.own) { obj_error (self, 0, "add of unowned object to PLArray"); @@ -172,7 +172,7 @@ return self; } -- insertObject:(PLItem []) object atIndex:(integer) index +- insertObject:(PLItem *) object atIndex:(integer) index { if (!object.own) { obj_error (self, 0, "add of unowned object to PLArray"); @@ -188,7 +188,7 @@ @implementation PLData -+ (PLData []) new:(void[]) data size:(integer) len ++ (PLData *) new:(void*) data size:(integer) len { return [[PLData alloc] initWithOwnItem: PL_NewData (data, len)]; } @@ -197,7 +197,7 @@ @implementation PLString -+ (PLString []) new: (string) str ++ (PLString *) new: (string) str { return [[PLString alloc] initWithOwnItem: PL_NewString (str)]; } diff --git a/ruamoko/lib/entities.r b/ruamoko/lib/entities.r index 259e40eea..f55bd91a7 100644 --- a/ruamoko/lib/entities.r +++ b/ruamoko/lib/entities.r @@ -15,4 +15,4 @@ entity nextent (entity e) = #47; void makestatic (entity e) = #69; void setspawnparms (entity e) = #78; -void EntityParseFunction (void (string ent_data) func) = #0; +void EntityParseFunction (void func (string ent_data)) = #0; diff --git a/ruamoko/lib/gib.r b/ruamoko/lib/gib.r index 7dabb5975..dd241a331 100644 --- a/ruamoko/lib/gib.r +++ b/ruamoko/lib/gib.r @@ -1,4 +1,4 @@ #include "gib.h" -void (string name, void (integer argc, string [] argv) func) GIB_Builtin_Add = #0; +void GIB_Builtin_Add (string name, void func (integer argc, string *argv)) = #0; integer (string value) GIB_Return = #0; diff --git a/ruamoko/lib/hash.r b/ruamoko/lib/hash.r index 83410ff2b..f405a7450 100644 --- a/ruamoko/lib/hash.r +++ b/ruamoko/lib/hash.r @@ -1,19 +1,19 @@ #include "hash.h" -hashtab_t (integer size, string (void []ele, void []data) gk, void (void []ele, void []data) f, void [] ud) Hash_NewTable = #0; -void (hashtab_t tab, unsigned (void []ele, void []data) gh, integer (void [] ele1, void [] ele2, void [] data) cmp) Hash_SetHashCompare = #0; -void (hashtab_t tab) Hash_DelTable = #0; -void (hashtab_t tab) Hash_FlushTable = #0; -integer (hashtab_t tab, void [] ele) Hash_Add = #0; -integer (hashtab_t tab, void [] ele) Hash_AddElement = #0; -(void []) (hashtab_t tab, string key) Hash_Find = #0; -(void []) (hashtab_t tab, void [] ele) Hash_FindElement = #0; -(void [][]) (hashtab_t tab, string key) Hash_FindList = #0; -(void [][]) (hashtab_t tab, void [] ele) Hash_FindElementList = #0; -(void []) (hashtab_t tab, string key) Hash_Del = #0; -(void []) (hashtab_t tab, void [] ele) Hash_DelElement = #0; -void (hashtab_t tab, void [] ele) Hash_Free = #0; -integer (string str) Hash_String = #0; -integer (void [] buf, integer len) Hash_Buffer = #0; -(void [][]) (hashtab_t tab) Hash_GetList = #0; -void (hashtab_t tab) Hash_Stats = #0; +hashtab_t Hash_NewTable (integer size, string gk (void *ele, void *data), void f (void *ele, void *data), void *ud) = #0; +void Hash_SetHashCompare (hashtab_t tab, unsigned gh (void *ele, void *data), integer cmp (void *ele1, void *ele2, void *data)) = #0; +void Hash_DelTable (hashtab_t tab) = #0; +void Hash_FlushTable (hashtab_t tab) = #0; +integer Hash_Add (hashtab_t tab, void *ele) = #0; +integer Hash_AddElement (hashtab_t tab, void *ele) = #0; +void *Hash_Find (hashtab_t tab, string key) = #0; +void *Hash_FindElement (hashtab_t tab, void *ele) = #0; +void **Hash_FindList (hashtab_t tab, string key) = #0; +void **Hash_FindElementList (hashtab_t tab, void *ele) = #0; +void *Hash_Del (hashtab_t tab, string key) = #0; +void *Hash_DelElement (hashtab_t tab, void *ele) = #0; +void Hash_Free (hashtab_t tab, void *ele) = #0; +integer Hash_String (string str) = #0; +integer Hash_Buffer (void *buf, integer len) = #0; +void **Hash_GetList (hashtab_t tab) = #0; +void Hash_Stats (hashtab_t tab) = #0; diff --git a/ruamoko/lib/qfile.r b/ruamoko/lib/qfile.r index eba2f0dd2..9588aed02 100644 --- a/ruamoko/lib/qfile.r +++ b/ruamoko/lib/qfile.r @@ -1,19 +1,19 @@ #include "qfile.h" -integer (string old, string new) Qrename = #0; -integer (string path) Qremove = #0; -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, string str) Qputs = #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; -integer (QFile file) Qtell = #0; -integer (QFile file) Qflush = #0; -integer (QFile file) Qeof = #0; -integer (QFile file) Qfilesize = #0; +integer Qrename (string old, string new) = #0; +integer Qremove (string path) = #0; +QFile Qopen (string path, string mode) = #0; +void Qclose (QFile file) = #0; +string Qgetline (QFile file) = #0; +string Qreadstring (QFile file, integer length) = #0; +integer Qread (QFile file, void *buf, integer count) = #0; +integer Qwrite (QFile file, void *buf, integer count) = #0; +integer Qputs (QFile file, string str) = #0; +//integer Qgets (QFile file, void *buf, integer count) = #0; +integer Qgetc (QFile file) = #0; +integer Qputc (QFile file, integer c) = #0; +integer Qseek (QFile file, integer offset, integer whence) = #0; +integer Qtell (QFile file) = #0; +integer Qflush (QFile file) = #0; +integer Qeof (QFile file) = #0; +integer Qfilesize (QFile file) = #0; diff --git a/ruamoko/lib/qfs.r b/ruamoko/lib/qfs.r index 92452f850..0049e1594 100644 --- a/ruamoko/lib/qfs.r +++ b/ruamoko/lib/qfs.r @@ -1,10 +1,10 @@ #include "qfs.h" -QFile (string path, string mode) QFS_Open = #0; -QFile (string path, integer zip) QFS_WOpen = #0; -integer (string old, string new) QFS_Rename = #0; -(void []) (string filename) QFS_LoadFile = #0; -QFile (string filename) QFS_OpenFile = #0; -integer (string filename, void [] buf, integer count) QFS_WriteFile = #0; -QFSlist (string path, string ext, integer strip) QFS_Filelist = #0; -void (QFSlist list) QFS_FilelistFree = #0; +QFile QFS_Open (string path, string mode) = #0; +QFile QFS_WOpen (string path, integer zip) = #0; +integer QFS_Rename (string old, string new) = #0; +void *QFS_LoadFile (string filename) = #0; +QFile QFS_OpenFile (string filename) = #0; +integer QFS_WriteFile (string filename, void *buf, integer count) = #0; +QFSlist QFS_Filelist (string path, string ext, integer strip) = #0; +void QFS_FilelistFree (QFSlist list) = #0;