[ruamoko] Add a wrapper for PL_Line

Makes error reporting in rua code easier.
This commit is contained in:
Bill Currie 2020-12-23 21:52:42 +09:00
parent 7fb335a215
commit e1e2a0e712
5 changed files with 18 additions and 0 deletions

View file

@ -229,6 +229,15 @@ bi_PL_Type (progs_t *pr)
R_INT (pr) = PL_Type (plist->plitem); R_INT (pr) = PL_Type (plist->plitem);
} }
static void
bi_PL_Line (progs_t *pr)
{
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle);
R_INT (pr) = PL_Line (plist->plitem);
}
static void static void
bi_PL_String (progs_t *pr) bi_PL_String (progs_t *pr)
{ {
@ -432,6 +441,7 @@ static builtin_t builtins[] = {
{"PL_GetPropertyList", bi_PL_GetPropertyList, -1}, {"PL_GetPropertyList", bi_PL_GetPropertyList, -1},
{"PL_WritePropertyList", bi_PL_WritePropertyList, -1}, {"PL_WritePropertyList", bi_PL_WritePropertyList, -1},
{"PL_Type", bi_PL_Type, -1}, {"PL_Type", bi_PL_Type, -1},
{"PL_Line", bi_PL_Line, -1},
{"PL_String", bi_PL_String, -1}, {"PL_String", bi_PL_String, -1},
{"PL_ObjectForKey", bi_PL_ObjectForKey, -1}, {"PL_ObjectForKey", bi_PL_ObjectForKey, -1},
{"PL_RemoveObjectForKey", bi_PL_RemoveObjectForKey, -1}, {"PL_RemoveObjectForKey", bi_PL_RemoveObjectForKey, -1},

View file

@ -42,6 +42,7 @@
- initWithOwnItem:(plitem_t) item; - initWithOwnItem:(plitem_t) item;
- (string) write; - (string) write;
- (pltype_t) type; - (pltype_t) type;
- (int) line;
@end @end
@interface PLDictionary: PLItem <PLDictionary> @interface PLDictionary: PLItem <PLDictionary>

View file

@ -10,6 +10,7 @@ typedef enum {QFDictionary, QFArray, QFBinary, QFString} pltype_t; // possible t
@extern plitem_t PL_GetPropertyList (string str); @extern plitem_t PL_GetPropertyList (string str);
@extern string PL_WritePropertyList (plitem_t pl); @extern string PL_WritePropertyList (plitem_t pl);
@extern pltype_t PL_Type (plitem_t str); @extern pltype_t PL_Type (plitem_t str);
@extern int PL_Line (plitem_t str);
@extern string PL_String (plitem_t str); @extern string PL_String (plitem_t str);
@extern plitem_t PL_ObjectForKey (plitem_t item, string key); @extern plitem_t PL_ObjectForKey (plitem_t item, string key);
@extern plitem_t PL_RemoveObjectForKey (plitem_t item, string key); @extern plitem_t PL_RemoveObjectForKey (plitem_t item, string key);

View file

@ -94,6 +94,11 @@
return PL_Type (item); return PL_Type (item);
} }
- (int) line
{
return PL_Line (item);
}
- (int) count - (int) count
{ {
if ([self class] == [PLDictionary class]) { if ([self class] == [PLDictionary class]) {

View file

@ -4,6 +4,7 @@ plitem_t PL_GetFromFile (QFile file) = #0;
plitem_t PL_GetPropertyList (string str) = #0; plitem_t PL_GetPropertyList (string str) = #0;
string PL_WritePropertyList (plitem_t pl) = #0; string PL_WritePropertyList (plitem_t pl) = #0;
pltype_t PL_Type (plitem_t str) = #0; pltype_t PL_Type (plitem_t str) = #0;
int PL_Line (plitem_t str) = #0;
string PL_String (plitem_t str) = #0; string PL_String (plitem_t str) = #0;
plitem_t PL_ObjectForKey (plitem_t item, string key) = #0; plitem_t PL_ObjectForKey (plitem_t item, string key) = #0;
plitem_t PL_RemoveObjectForKey (plitem_t item, string key) = #0; plitem_t PL_RemoveObjectForKey (plitem_t item, string key) = #0;