[ruamoko] Make plitem_t easier to use

Or more accurately, struct plitem_s. Including the pointer in the
typedef made things a little awkward.
This commit is contained in:
Bill Currie 2021-12-22 00:21:27 +09:00
parent bdc9e9c39f
commit 5e273a3693
5 changed files with 53 additions and 53 deletions

View file

@ -28,7 +28,7 @@
@interface PLItem: Object <PLDictionary, PLArray, PLString>
{
plitem_t item;
plitem_t *item;
int own;
}
+ (PLItem *) newDictionary;
@ -38,8 +38,8 @@
+ (PLItem *) fromString:(string) str;
+ (PLItem *) fromFile:(QFile) file;
- initWithItem:(plitem_t) item;
- initWithOwnItem:(plitem_t) item;
- initWithItem:(plitem_t *) item;
- initWithOwnItem:(plitem_t *) item;
- (string) write;
- (pltype_t) type;
- (int) line;

View file

@ -3,29 +3,29 @@
#include <qfile.h>
typedef struct plitem_s *plitem_t;
typedef struct plitem_s plitem_t;
typedef enum {QFDictionary, QFArray, QFBinary, QFString} pltype_t; // possible types
@extern plitem_t PL_GetFromFile (QFile file);
@extern plitem_t PL_GetPropertyList (string str);
@extern string PL_WritePropertyList (plitem_t pl);
@extern pltype_t PL_Type (plitem_t str);
@extern int PL_Line (plitem_t str);
@extern string PL_String (plitem_t str);
@extern plitem_t PL_ObjectForKey (plitem_t item, string key);
@extern plitem_t PL_RemoveObjectForKey (plitem_t item, string key);
@extern plitem_t PL_ObjectAtIndex (plitem_t item, int index);
@extern plitem_t PL_D_AllKeys (plitem_t item);
@extern int PL_D_NumKeys (plitem_t item);
@extern int PL_D_AddObject (plitem_t dict, string key, plitem_t value);
@extern int PL_A_AddObject (plitem_t array_item, plitem_t item);
@extern int PL_A_NumObjects (plitem_t item);
@extern int PL_A_InsertObjectAtIndex (plitem_t array_item, plitem_t item, int index);
@extern plitem_t PL_RemoveObjectAtIndex (plitem_t array_item, int index);
@extern plitem_t PL_NewDictionary ();
@extern plitem_t PL_NewArray ();
@extern plitem_t PL_NewData (void *data, int len);
@extern plitem_t PL_NewString (string str);
@extern void PL_Free (plitem_t pl);
@extern plitem_t *PL_GetFromFile (QFile file);
@extern plitem_t *PL_GetPropertyList (string str);
@extern string PL_WritePropertyList (plitem_t *pl);
@extern pltype_t PL_Type (plitem_t *str);
@extern int PL_Line (plitem_t *str);
@extern string PL_String (plitem_t *str);
@extern plitem_t *PL_ObjectForKey (plitem_t *item, string key);
@extern plitem_t *PL_RemoveObjectForKey (plitem_t *item, string key);
@extern plitem_t *PL_ObjectAtIndex (plitem_t *item, int index);
@extern plitem_t *PL_D_AllKeys (plitem_t *item);
@extern int PL_D_NumKeys (plitem_t *item);
@extern int PL_D_AddObject (plitem_t *dict, string key, plitem_t *value);
@extern int PL_A_AddObject (plitem_t *array_item, plitem_t *item);
@extern int PL_A_NumObjects (plitem_t *item);
@extern int PL_A_InsertObjectAtIndex (plitem_t *array_item, plitem_t *item, int index);
@extern plitem_t *PL_RemoveObjectAtIndex (plitem_t *array_item, int index);
@extern plitem_t *PL_NewDictionary ();
@extern plitem_t *PL_NewArray ();
@extern plitem_t *PL_NewData (void *data, int len);
@extern plitem_t *PL_NewString (string str);
@extern void PL_Free (plitem_t *pl);
#endif//__ruamoko_plist_h

View file

@ -35,7 +35,7 @@ int PR_SetField (entity ent, string field, string value) = #0;
return self;
}
- (id) initWithEntity: (entity)e fromPlist: (plitem_t) dict
- (id) initWithEntity: (entity)e fromPlist: (plitem_t *) dict
{
self = [self initWithEntity: e];
return self;
@ -58,14 +58,14 @@ int PR_SetField (entity ent, string field, string value) = #0;
//XXX EntityParseFunction (ParseEntities);
}
+ createFromPlist:(plitem_t) dict
+ createFromPlist:(plitem_t *) dict
{
local string classname;
local id class;
local entity ent;
local int count;
local string field, value;
local plitem_t keys;
local plitem_t *keys;
local @function func;
local Entity *e;
@ -104,7 +104,7 @@ int PR_SetField (entity ent, string field, string value) = #0;
@static void ParseEntities (string ent_data)
{
local script_t script;
local plitem_t plist, ent, key, value;
local plitem_t *plist, *ent, *key, *value;
local string token;
local int anglehack, i, count;

View file

@ -22,7 +22,7 @@
return [PLString new:str];
}
+ itemClass:(plitem_t) item
+ itemClass:(plitem_t *) item
{
local string classname = nil;
local id class;
@ -59,7 +59,7 @@
return [[PLItem itemClass: PL_GetFromFile (file)] autorelease];
}
- initWithItem:(plitem_t) item
- initWithItem:(plitem_t *) item
{
if (!(self = [super init]))
return self;
@ -68,7 +68,7 @@
return self;
}
-initWithOwnItem:(plitem_t) item
-initWithOwnItem:(plitem_t *) item
{
if (!(self = [super init]))
return self;

View file

@ -1,23 +1,23 @@
#include <plist.h>
plitem_t PL_GetFromFile (QFile file) = #0;
plitem_t PL_GetPropertyList (string str) = #0;
string PL_WritePropertyList (plitem_t pl) = #0;
pltype_t PL_Type (plitem_t str) = #0;
int PL_Line (plitem_t str) = #0;
string PL_String (plitem_t str) = #0;
plitem_t PL_ObjectForKey (plitem_t item, string key) = #0;
plitem_t PL_RemoveObjectForKey (plitem_t item, string key) = #0;
plitem_t PL_ObjectAtIndex (plitem_t item, int index) = #0;
plitem_t PL_D_AllKeys (plitem_t item) = #0;
int PL_D_NumKeys (plitem_t item) = #0;
int PL_D_AddObject (plitem_t dict, string key, plitem_t value) = #0;
int PL_A_AddObject (plitem_t array_item, plitem_t item) = #0;
int PL_A_NumObjects (plitem_t item) = #0;
int PL_A_InsertObjectAtIndex (plitem_t array_item, plitem_t item, int index) = #0;
plitem_t PL_RemoveObjectAtIndex (plitem_t array_item, int index) = #0;
plitem_t PL_NewDictionary (void) = #0;
plitem_t PL_NewArray (void) = #0;
plitem_t PL_NewData (void *data, int len) = #0;
plitem_t PL_NewString (string str) = #0;
void PL_Free (plitem_t pl) = #0;
plitem_t *PL_GetFromFile (QFile file) = #0;
plitem_t *PL_GetPropertyList (string str) = #0;
string PL_WritePropertyList (plitem_t *pl) = #0;
pltype_t PL_Type (plitem_t *str) = #0;
int PL_Line (plitem_t *str) = #0;
string PL_String (plitem_t *str) = #0;
plitem_t *PL_ObjectForKey (plitem_t *item, string key) = #0;
plitem_t *PL_RemoveObjectForKey (plitem_t *item, string key) = #0;
plitem_t *PL_ObjectAtIndex (plitem_t *item, int index) = #0;
plitem_t *PL_D_AllKeys (plitem_t *item) = #0;
int PL_D_NumKeys (plitem_t *item) = #0;
int PL_D_AddObject (plitem_t *dict, string key, plitem_t *value) = #0;
int PL_A_AddObject (plitem_t *array_item, plitem_t *item) = #0;
int PL_A_NumObjects (plitem_t *item) = #0;
int PL_A_InsertObjectAtIndex (plitem_t *array_item, plitem_t *item, int index) = #0;
plitem_t *PL_RemoveObjectAtIndex (plitem_t *array_item, int index) = #0;
plitem_t *PL_NewDictionary (void) = #0;
plitem_t *PL_NewArray (void) = #0;
plitem_t *PL_NewData (void *data, int len) = #0;
plitem_t *PL_NewString (string str) = #0;
void PL_Free (plitem_t *pl) = #0;