Converted tooling to C.
This commit is contained in:
@ -9,26 +9,59 @@
|
||||
#include "common.h"
|
||||
#include "file.h"
|
||||
|
||||
#define XML_NODE_CHILD_MAX 32
|
||||
#define XML_NODE_NAME_MAX 32
|
||||
#define XML_NODE_ATTRIBUTES_MAX 32
|
||||
#define XML_DOING_NOTHING 0x00
|
||||
#define XML_PARSING_TAG_NAME 0x01
|
||||
#define XML_LOOKING_FOR_ATTRIBUTE 0x02
|
||||
#define XML_PARSING_ATTRIBUTE_NAME 0x03
|
||||
#define XML_LOOKING_FOR_ATTRIBUTE_VALUE 0x04
|
||||
#define XML_PARSING_ATTRIBUTE_VALUE 0x05
|
||||
#define XML_PARSING_VALUE 0x06
|
||||
#define XML_PARSING_CHILD 0x07
|
||||
#define XML_PARSING_CLOSE 0x08
|
||||
|
||||
#define XML_STATE_NOTHING 0x00
|
||||
#define XML_STATE_PARSING_NAME 0x01
|
||||
#define XML_STATE_PARSING_ATTRIBUTES 0x02
|
||||
#define XML_TEXT_BUFFER_MAX 256
|
||||
#define XML_CHILD_COUNT_MAX 16
|
||||
#define XML_ATTRIBUTE_MAX 16
|
||||
|
||||
typedef struct {
|
||||
char *start;
|
||||
char *internal;
|
||||
char name[XML_NODE_NAME_MAX];
|
||||
typedef struct _xml_t xml_t;
|
||||
|
||||
char *attributeNames[XML_NODE_ATTRIBUTES_MAX];
|
||||
uint8_t attributeNameLengths[XML_NODE_ATTRIBUTES_MAX];
|
||||
char *attributeValues[XML_NODE_ATTRIBUTES_MAX];
|
||||
uint8_t attributeValueLengths[XML_NODE_ATTRIBUTES_MAX];
|
||||
typedef struct _xml_t {
|
||||
char *node;
|
||||
char *value;
|
||||
|
||||
char *attributeNames[XML_ATTRIBUTE_MAX];
|
||||
char *attributeDatas[XML_ATTRIBUTE_MAX];
|
||||
uint8_t attributeCount;
|
||||
} xmlnode_t;
|
||||
|
||||
xml_t *children;
|
||||
uint8_t childrenCount;
|
||||
} xml_t;
|
||||
|
||||
/**
|
||||
* Load an XML child from a string buffer.
|
||||
*
|
||||
* @param xml XML to load.
|
||||
* @param data Data to parse
|
||||
* @param i Character index within the data
|
||||
* @return The index in the data string this XML node ends.
|
||||
*/
|
||||
int32_t xmlLoadChild(xml_t *xml, char *data, int32_t i);
|
||||
|
||||
void xmlParseElement(xmlnode_t *node, char *string);
|
||||
/**
|
||||
* Load an XML String into an XML memory.
|
||||
*
|
||||
* @param xml XML to load into.
|
||||
* @param data XML string.
|
||||
*/
|
||||
void xmlLoad(xml_t *xml, char *data);
|
||||
|
||||
/**
|
||||
* Dispose a previously loaded XML.
|
||||
*
|
||||
* @param xml XML to dispose.
|
||||
*/
|
||||
void xmlDispose(xml_t *xml);
|
||||
|
||||
int16_t xmlGetAttributeByName(xml_t *xml, char *name);
|
||||
|
||||
bool xmlIsWhitespace(char c);
|
Reference in New Issue
Block a user