2020-03-31 17:59:35 +02:00
|
|
|
/*
|
|
|
|
* plist.h
|
|
|
|
*
|
|
|
|
* Created on: 31 Mar 2020
|
|
|
|
* Author: jief
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLATFORM_PLIST_H_
|
|
|
|
#define PLATFORM_PLIST_H_
|
|
|
|
|
|
|
|
|
2020-04-22 19:52:21 +02:00
|
|
|
/* XML Tags */
|
|
|
|
#define kXMLTagPList "plist"
|
|
|
|
#define kXMLTagDict "dict"
|
|
|
|
#define kXMLTagKey "key"
|
|
|
|
#define kXMLTagString "string"
|
|
|
|
#define kXMLTagInteger "integer"
|
|
|
|
#define kXMLTagData "data"
|
|
|
|
#define kXMLTagDate "date"
|
|
|
|
#define kXMLTagFalse "false/"
|
|
|
|
#define kXMLTagTrue "true/"
|
|
|
|
#define kXMLTagArray "array"
|
|
|
|
#define kXMLTagReference "reference"
|
|
|
|
#define kXMLTagID "ID="
|
|
|
|
#define kXMLTagIDREF "IDREF="
|
|
|
|
#define kXMLTagFloat "real"
|
|
|
|
|
|
|
|
|
2020-03-31 17:59:35 +02:00
|
|
|
|
|
|
|
typedef struct TagStruct {
|
|
|
|
|
|
|
|
UINTN type;
|
2020-08-15 15:47:56 +02:00
|
|
|
XString8 string;
|
|
|
|
INTN intValue;
|
|
|
|
float floatValue;
|
2020-03-31 17:59:35 +02:00
|
|
|
UINT8 *data;
|
|
|
|
UINTN dataLen;
|
|
|
|
UINTN offset;
|
|
|
|
struct TagStruct *tag;
|
|
|
|
struct TagStruct *tagNext;
|
|
|
|
|
|
|
|
} TagStruct, *TagPtr;
|
|
|
|
|
2020-04-22 19:52:21 +02:00
|
|
|
typedef union {
|
|
|
|
struct {
|
|
|
|
float fNum; //4 bytes
|
|
|
|
UINT32 pad; // else 4
|
|
|
|
} B;
|
|
|
|
CHAR8 *string;
|
|
|
|
} FlMix;
|
2020-03-31 17:59:35 +02:00
|
|
|
|
|
|
|
|
2020-04-16 09:15:26 +02:00
|
|
|
CHAR8*
|
|
|
|
XMLDecode (
|
|
|
|
CHAR8 *src
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2020-05-15 05:23:33 +02:00
|
|
|
ParseXML(
|
2020-04-16 09:15:26 +02:00
|
|
|
CONST CHAR8 *buffer,
|
|
|
|
TagPtr *dict,
|
|
|
|
UINT32 bufSize
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
//VOID RenderSVGfont(NSVGfont *fontSVG);
|
|
|
|
|
|
|
|
TagPtr
|
2020-04-23 11:08:10 +02:00
|
|
|
GetProperty(
|
2020-04-16 09:15:26 +02:00
|
|
|
TagPtr dict,
|
|
|
|
CONST CHAR8* key
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
XMLParseNextTag (
|
|
|
|
CHAR8 *buffer,
|
|
|
|
TagPtr *tag,
|
|
|
|
UINT32 *lenPtr
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FreeTag (
|
|
|
|
TagPtr tag
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
GetNextTag (
|
|
|
|
UINT8 *buffer,
|
|
|
|
CHAR8 **tag,
|
|
|
|
UINT32 *start,
|
|
|
|
UINT32 *length
|
|
|
|
);
|
|
|
|
|
|
|
|
INTN
|
|
|
|
GetTagCount (
|
|
|
|
TagPtr dict
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2020-05-11 08:30:45 +02:00
|
|
|
GetElement(
|
2020-04-16 09:15:26 +02:00
|
|
|
TagPtr dict,
|
|
|
|
INTN id,
|
|
|
|
TagPtr *dict1
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
2020-05-11 08:30:45 +02:00
|
|
|
IsPropertyTrue(
|
2020-04-16 09:15:26 +02:00
|
|
|
TagPtr Prop
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
2020-05-11 08:30:45 +02:00
|
|
|
IsPropertyFalse(
|
2020-04-16 09:15:26 +02:00
|
|
|
TagPtr Prop
|
|
|
|
);
|
|
|
|
|
|
|
|
INTN
|
2020-04-23 11:08:10 +02:00
|
|
|
GetPropertyInteger(
|
2020-04-16 09:15:26 +02:00
|
|
|
TagPtr Prop,
|
|
|
|
INTN Default
|
|
|
|
);
|
|
|
|
|
2020-04-22 19:52:21 +02:00
|
|
|
float GetPropertyFloat (TagPtr Prop, float Default);
|
|
|
|
|
2020-04-16 09:15:26 +02:00
|
|
|
|
2020-03-31 17:59:35 +02:00
|
|
|
#endif /* PLATFORM_PLIST_H_ */
|