#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
Go to the source code of this file.
#define MXML_ADD_AFTER 1 |
Definition at line 66 of file mxml.h.
Referenced by mxml_new(), and mxmlAdd().
#define MXML_ADD_TO_PARENT NULL |
Definition at line 67 of file mxml.h.
Referenced by mxml_new().
#define MXML_DESCEND 1 |
Definition at line 56 of file mxml.h.
Referenced by mxmlFindElement(), and mxmlIndexNew().
#define MXML_DESCEND_FIRST -1 |
Definition at line 58 of file mxml.h.
Referenced by mxml_GetNode().
#define MXML_NO_CALLBACK 0 |
Definition at line 43 of file mxml.h.
Referenced by MP_SaveTeamMultiplayer(), mxmlLoadFd(), mxmlLoadFile(), mxmlLoadString(), and SAV_GameSave().
#define MXML_NO_DESCEND 0 |
Definition at line 57 of file mxml.h.
Referenced by mxml_GetNextNode().
#define MXML_TAB 8 |
Definition at line 41 of file mxml.h.
Referenced by mxml_write_ws().
#define MXML_WS_AFTER_CLOSE 3 |
Definition at line 63 of file mxml.h.
Referenced by mxml_write_node().
#define MXML_WS_AFTER_OPEN 1 |
Definition at line 61 of file mxml.h.
Referenced by mxml_write_node().
#define MXML_WS_BEFORE_CLOSE 2 |
Definition at line 62 of file mxml.h.
Referenced by mxml_write_node().
#define MXML_WS_BEFORE_OPEN 0 |
Definition at line 60 of file mxml.h.
Referenced by mxml_write_node().
typedef struct mxml_attr_s mxml_attr_t |
typedef void(* mxml_custom_destroy_cb_t)(void *) |
typedef int(* mxml_custom_load_cb_t)(mxml_node_t *, const char *) |
typedef char*(* mxml_custom_save_cb_t)(mxml_node_t *) |
typedef struct mxml_custom_s mxml_custom_t |
typedef struct mxml_element_s mxml_element_t |
typedef void(* mxml_error_cb_t)(const char *) |
typedef struct mxml_index_s mxml_index_t |
typedef mxml_type_t(* mxml_load_cb_t)(mxml_node_t *) |
typedef struct mxml_node_s mxml_node_t |
typedef const char*(* mxml_save_cb_t)(mxml_node_t *, int) |
typedef void(* mxml_sax_cb_t)(mxml_node_t *, mxml_sax_event_t, void *) |
typedef enum mxml_sax_event_e mxml_sax_event_t |
typedef struct mxml_text_s mxml_text_t |
typedef enum mxml_type_e mxml_type_t |
typedef union mxml_value_u mxml_value_t |
enum mxml_sax_event_e |
enum mxml_type_e |
void mxml_error | ( | const char * | format, | |
... | ||||
) |
Definition at line 39 of file mxml-private.c.
References _mxml_global(), and _mxml_global_s::error_cb.
Referenced by mxml_add_char(), mxml_fd_getc(), mxml_file_getc(), mxml_get_entity(), mxml_load_data(), mxml_parse_element(), mxml_set_attr(), mxml_string_getc(), mxmlElementSetAttrf(), mxmlEntityAddCallback(), and mxmlIndexNew().
mxml_type_t mxml_ignore_cb | ( | mxml_node_t * | node | ) |
Definition at line 81 of file mxml-private.c.
References MXML_IGNORE, and void().
mxml_type_t mxml_integer_cb | ( | mxml_node_t * | node | ) |
Definition at line 94 of file mxml-private.c.
References MXML_INTEGER, and void().
mxml_type_t mxml_opaque_cb | ( | mxml_node_t * | node | ) |
Definition at line 107 of file mxml-private.c.
References MXML_OPAQUE, and void().
mxml_type_t mxml_real_cb | ( | mxml_node_t * | node | ) |
Definition at line 120 of file mxml-private.c.
void mxmlAdd | ( | mxml_node_t * | parent, | |
int | where, | |||
mxml_node_t * | child, | |||
mxml_node_t * | node | |||
) |
Definition at line 64 of file mxml-node.c.
References mxml_node_s::child, mxml_node_s::last_child, MXML_ADD_AFTER, MXML_ADD_BEFORE, mxmlRemove(), mxml_node_s::next, mxml_node_s::parent, and mxml_node_s::prev.
Referenced by mxml_new().
void mxmlDelete | ( | mxml_node_t * | node | ) |
Definition at line 198 of file mxml-node.c.
References mxml_element_s::attrs, mxml_node_s::child, mxml_value_u::custom, mxml_custom_s::data, mxml_custom_s::destroy, mxml_value_u::element, i, MXML_CUSTOM, MXML_ELEMENT, MXML_INTEGER, MXML_OPAQUE, MXML_REAL, MXML_TEXT, mxmlDelete(), mxmlRemove(), mxml_attr_s::name, mxml_element_s::name, mxml_element_s::num_attrs, mxml_value_u::opaque, mxml_text_s::string, mxml_value_u::text, mxml_node_s::type, mxml_attr_s::value, and mxml_node_s::value.
Referenced by CP_LoadXML(), MP_LoadTeamMultiplayer(), MP_SaveTeamMultiplayer(), mxml_load_data(), mxmlDelete(), mxmlRelease(), SAV_GameLoad(), SAV_GameSave(), and STATS_LoadXML().
void mxmlElementDeleteAttr | ( | mxml_node_t * | node, | |
const char * | name | |||
) |
Definition at line 50 of file mxml-attr.c.
References mxml_element_s::attrs, mxml_value_u::element, i, MXML_ELEMENT, mxml_attr_s::name, mxml_element_s::num_attrs, mxml_node_s::type, mxml_attr_s::value, and mxml_node_s::value.
const char* mxmlElementGetAttr | ( | mxml_node_t * | node, | |
const char * | name | |||
) |
Definition at line 109 of file mxml-attr.c.
References mxml_element_s::attrs, mxml_value_u::element, i, MXML_ELEMENT, mxml_attr_s::name, mxml_element_s::num_attrs, mxml_node_s::type, mxml_attr_s::value, and mxml_node_s::value.
Referenced by index_compare(), index_find(), mxml_GetBool(), mxml_GetDouble(), mxml_GetFloat(), mxml_GetInt(), mxml_GetLong(), mxml_GetShort(), mxml_GetString(), mxml_parse_element(), mxml_ufo_type_cb(), mxmlFindElement(), and mxmlIndexNew().
void mxmlElementSetAttr | ( | mxml_node_t * | node, | |
const char * | name, | |||
const char * | value | |||
) |
Definition at line 171 of file mxml-attr.c.
References MXML_ELEMENT, mxml_set_attr(), and mxml_node_s::type.
Referenced by mxml_AddBool(), mxml_AddBoolValue(), mxml_AddDouble(), mxml_AddDoubleValue(), mxml_AddLong(), mxml_AddLongValue(), mxml_AddString(), mxml_AddStringValue(), and mxml_parse_element().
void mxmlElementSetAttrf | ( | mxml_node_t * | node, | |
const char * | name, | |||
const char * | format, | |||
... | ||||
) |
Definition at line 212 of file mxml-attr.c.
References _mxml_vstrdupf(), mxml_value_u::element, MXML_ELEMENT, mxml_error(), mxml_set_attr(), mxml_element_s::name, mxml_node_s::type, and mxml_node_s::value.
int mxmlEntityAddCallback | ( | int(*)(const char *name) | cb | ) |
Definition at line 43 of file mxml-entity.c.
References _mxml_global(), _mxml_global_s::entity_cbs, mxml_error(), and _mxml_global_s::num_entity_cbs.
const char* mxmlEntityGetName | ( | int | val | ) |
Definition at line 73 of file mxml-entity.c.
Referenced by mxml_write_name(), and mxml_write_string().
int mxmlEntityGetValue | ( | const char * | name | ) |
Definition at line 103 of file mxml-entity.c.
References _mxml_global(), _mxml_global_s::entity_cbs, i, and _mxml_global_s::num_entity_cbs.
Referenced by mxml_get_entity().
void mxmlEntityRemoveCallback | ( | int(*)(const char *name) | cb | ) |
Definition at line 124 of file mxml-entity.c.
References _mxml_global(), _mxml_global_s::entity_cbs, i, and _mxml_global_s::num_entity_cbs.
mxml_node_t* mxmlFindElement | ( | mxml_node_t * | node, | |
mxml_node_t * | top, | |||
const char * | name, | |||
const char * | attr, | |||
const char * | value, | |||
int | descend | |||
) |
Definition at line 48 of file mxml-search.c.
References mxml_value_u::element, MXML_DESCEND, MXML_ELEMENT, mxmlElementGetAttr(), mxmlWalkNext(), mxml_element_s::name, mxml_node_s::next, mxml_node_s::type, and mxml_node_s::value.
Referenced by mxml_GetNextNode(), mxml_GetNode(), and mxmlIndexNew().
void mxmlIndexDelete | ( | mxml_index_t * | ind | ) |
Definition at line 55 of file mxml-index.c.
References mxml_index_s::alloc_nodes, mxml_index_s::attr, and mxml_index_s::nodes.
Referenced by mxmlIndexNew().
mxml_node_t* mxmlIndexEnum | ( | mxml_index_t * | ind | ) |
Definition at line 85 of file mxml-index.c.
References mxml_index_s::cur_node, mxml_index_s::nodes, and mxml_index_s::num_nodes.
Referenced by mxmlIndexFind().
mxml_node_t* mxmlIndexFind | ( | mxml_index_t * | ind, | |
const char * | element, | |||
const char * | value | |||
) |
Definition at line 115 of file mxml-index.c.
References mxml_index_s::attr, mxml_index_s::cur_node, index_find(), mxmlIndexEnum(), mxml_index_s::nodes, and mxml_index_s::num_nodes.
mxml_index_t* mxmlIndexNew | ( | mxml_node_t * | node, | |
const char * | element, | |||
const char * | attr | |||
) |
Definition at line 298 of file mxml-index.c.
References mxml_index_s::alloc_nodes, mxml_index_s::attr, mxml_value_u::element, errno, i, index_sort(), MXML_DESCEND, mxml_error(), mxmlElementGetAttr(), mxmlFindElement(), mxmlIndexDelete(), mxml_element_s::name, mxml_index_s::nodes, mxml_index_s::num_nodes, and mxml_node_s::value.
mxml_node_t* mxmlIndexReset | ( | mxml_index_t * | ind | ) |
Definition at line 456 of file mxml-index.c.
References mxml_index_s::cur_node, mxml_index_s::nodes, and mxml_index_s::num_nodes.
mxml_node_t* mxmlLoadFd | ( | mxml_node_t * | top, | |
int | fd, | |||
mxml_type_t(*)(mxml_node_t *) | cb | |||
) |
mxml_node_t* mxmlLoadFile | ( | mxml_node_t * | top, | |
FILE * | fp, | |||
mxml_type_t(*)(mxml_node_t *) | cb | |||
) |
mxml_node_t* mxmlLoadString | ( | mxml_node_t * | top, | |
const char * | s, | |||
mxml_type_t(*)(mxml_node_t *) | cb | |||
) |
mxml_node_t* mxmlNewCDATA | ( | mxml_node_t * | parent, | |
const char * | string | |||
) |
Definition at line 293 of file mxml-node.c.
References _mxml_strdupf(), mxml_value_u::element, MXML_ELEMENT, mxml_new(), mxml_element_s::name, and mxml_node_s::value.
mxml_node_t* mxmlNewCustom | ( | mxml_node_t * | parent, | |
void * | data, | |||
mxml_custom_destroy_cb_t | destroy | |||
) |
Definition at line 334 of file mxml-node.c.
References mxml_value_u::custom, mxml_custom_s::data, mxml_custom_s::destroy, MXML_CUSTOM, mxml_new(), and mxml_node_s::value.
Referenced by mxml_load_data().
mxml_node_t* mxmlNewElement | ( | mxml_node_t * | parent, | |
const char * | name | |||
) |
Definition at line 370 of file mxml-node.c.
References mxml_value_u::element, MXML_ELEMENT, mxml_new(), mxml_element_s::name, and mxml_node_s::value.
Referenced by mxml_AddDate(), mxml_AddNode(), mxml_AddPos2(), mxml_AddPos3(), mxml_load_data(), and mxmlNewXML().
mxml_node_t* mxmlNewInteger | ( | mxml_node_t * | parent, | |
int | integer | |||
) |
Definition at line 408 of file mxml-node.c.
References mxml_value_u::integer, MXML_INTEGER, mxml_new(), and mxml_node_s::value.
Referenced by mxml_load_data().
mxml_node_t* mxmlNewOpaque | ( | mxml_node_t * | parent, | |
const char * | opaque | |||
) |
Definition at line 439 of file mxml-node.c.
References mxml_new(), MXML_OPAQUE, mxml_value_u::opaque, and mxml_node_s::value.
Referenced by mxml_load_data().
mxml_node_t* mxmlNewReal | ( | mxml_node_t * | parent, | |
double | real | |||
) |
Definition at line 477 of file mxml-node.c.
References mxml_new(), MXML_REAL, mxml_value_u::real, and mxml_node_s::value.
Referenced by mxml_load_data().
mxml_node_t* mxmlNewText | ( | mxml_node_t * | parent, | |
int | whitespace, | |||
const char * | string | |||
) |
Definition at line 509 of file mxml-node.c.
References mxml_new(), MXML_TEXT, mxml_text_s::string, mxml_value_u::text, mxml_node_s::value, and mxml_text_s::whitespace.
Referenced by mxml_load_data().
mxml_node_t* mxmlNewTextf | ( | mxml_node_t * | parent, | |
int | whitespace, | |||
const char * | format, | |||
... | ||||
) |
Definition at line 553 of file mxml-node.c.
References _mxml_vstrdupf(), mxml_new(), MXML_TEXT, mxml_text_s::string, mxml_value_u::text, mxml_node_s::value, and mxml_text_s::whitespace.
mxml_node_t* mxmlNewXML | ( | const char * | version | ) |
Definition at line 669 of file mxml-node.c.
References mxmlNewElement().
Referenced by MP_SaveTeamMultiplayer(), and SAV_GameSave().
int mxmlRelease | ( | mxml_node_t * | node | ) |
Definition at line 691 of file mxml-node.c.
References mxmlDelete(), and mxml_node_s::ref_count.
Referenced by mxml_load_data().
void mxmlRemove | ( | mxml_node_t * | node | ) |
Definition at line 600 of file mxml-node.c.
References mxml_node_s::child, mxml_node_s::last_child, mxml_node_s::next, mxml_node_s::parent, and mxml_node_s::prev.
Referenced by mxmlAdd(), and mxmlDelete().
int mxmlRetain | ( | mxml_node_t * | node | ) |
Definition at line 715 of file mxml-node.c.
References mxml_node_s::ref_count.
char* mxmlSaveAllocString | ( | mxml_node_t * | node, | |
mxml_save_cb_t | cb | |||
) |
Definition at line 253 of file mxml-file.c.
References mxmlSaveString().
int mxmlSaveFd | ( | mxml_node_t * | node, | |
int | fd, | |||
mxml_save_cb_t | cb | |||
) |
Definition at line 310 of file mxml-file.c.
References _mxml_global(), _mxml_fdbuf_s::buffer, _mxml_fdbuf_s::current, _mxml_fdbuf_s::end, _mxml_fdbuf_s::fd, mxml_fd_putc(), mxml_fd_write(), and mxml_write_node().
int mxmlSaveFile | ( | mxml_node_t * | node, | |
FILE * | fp, | |||
mxml_save_cb_t | cb | |||
) |
Definition at line 358 of file mxml-file.c.
References _mxml_global(), mxml_file_putc(), and mxml_write_node().
int mxmlSaveString | ( | mxml_node_t * | node, | |
char * | buffer, | |||
int | bufsize, | |||
mxml_save_cb_t | cb | |||
) |
Definition at line 401 of file mxml-file.c.
References _mxml_global(), mxml_string_putc(), and mxml_write_node().
Referenced by MP_SaveTeamMultiplayer(), mxmlSaveAllocString(), and SAV_GameSave().
mxml_node_t* mxmlSAXLoadFd | ( | mxml_node_t * | top, | |
int | fd, | |||
mxml_type_t(*)(mxml_node_t *) | cb, | |||
mxml_sax_cb_t | sax, | |||
void * | sax_data | |||
) |
mxml_node_t* mxmlSAXLoadFile | ( | mxml_node_t * | top, | |
FILE * | fp, | |||
mxml_type_t(*)(mxml_node_t *) | cb, | |||
mxml_sax_cb_t | sax, | |||
void * | sax_data | |||
) |
mxml_node_t* mxmlSAXLoadString | ( | mxml_node_t * | top, | |
const char * | s, | |||
mxml_type_t(*)(mxml_node_t *) | cb, | |||
mxml_sax_cb_t | sax, | |||
void * | sax_data | |||
) |
int mxmlSetCDATA | ( | mxml_node_t * | node, | |
const char * | data | |||
) |
Definition at line 82 of file mxml-set.c.
References _mxml_strdupf(), mxml_value_u::element, MXML_ELEMENT, mxml_element_s::name, mxml_node_s::type, and mxml_node_s::value.
int mxmlSetCustom | ( | mxml_node_t * | node, | |
void * | data, | |||
mxml_custom_destroy_cb_t | destroy | |||
) |
Definition at line 47 of file mxml-set.c.
References mxml_value_u::custom, mxml_custom_s::data, mxml_custom_s::destroy, MXML_CUSTOM, mxml_node_s::type, and mxml_node_s::value.
void mxmlSetCustomHandlers | ( | mxml_custom_load_cb_t | load, | |
mxml_custom_save_cb_t | save | |||
) |
Definition at line 578 of file mxml-file.c.
References _mxml_global(), _mxml_global_s::custom_load_cb, and _mxml_global_s::custom_save_cb.
int mxmlSetElement | ( | mxml_node_t * | node, | |
const char * | name | |||
) |
Definition at line 113 of file mxml-set.c.
References mxml_value_u::element, MXML_ELEMENT, mxml_element_s::name, mxml_node_s::type, and mxml_node_s::value.
void mxmlSetErrorCallback | ( | mxml_error_cb_t | cb | ) |
Definition at line 596 of file mxml-file.c.
References _mxml_global(), and _mxml_global_s::error_cb.
int mxmlSetInteger | ( | mxml_node_t * | node, | |
int | integer | |||
) |
Definition at line 143 of file mxml-set.c.
References mxml_value_u::integer, MXML_INTEGER, mxml_node_s::type, and mxml_node_s::value.
int mxmlSetOpaque | ( | mxml_node_t * | node, | |
const char * | opaque | |||
) |
Definition at line 170 of file mxml-set.c.
References MXML_OPAQUE, mxml_value_u::opaque, mxml_node_s::type, and mxml_node_s::value.
int mxmlSetReal | ( | mxml_node_t * | node, | |
double | real | |||
) |
Definition at line 200 of file mxml-set.c.
References MXML_REAL, mxml_value_u::real, mxml_node_s::type, and mxml_node_s::value.
int mxmlSetText | ( | mxml_node_t * | node, | |
int | whitespace, | |||
const char * | string | |||
) |
Definition at line 227 of file mxml-set.c.
References MXML_TEXT, mxml_text_s::string, mxml_value_u::text, mxml_node_s::type, mxml_node_s::value, and mxml_text_s::whitespace.
int mxmlSetTextf | ( | mxml_node_t * | node, | |
int | whitespace, | |||
const char * | format, | |||
... | ||||
) |
Definition at line 259 of file mxml-set.c.
References _mxml_strdupf(), MXML_TEXT, mxml_text_s::string, mxml_value_u::text, mxml_node_s::type, mxml_node_s::value, and mxml_text_s::whitespace.
void mxmlSetWrapMargin | ( | int | column | ) |
Definition at line 615 of file mxml-file.c.
References _mxml_global(), and _mxml_global_s::wrap.
mxml_node_t* mxmlWalkNext | ( | mxml_node_t * | node, | |
mxml_node_t * | top, | |||
int | descend | |||
) |
Definition at line 130 of file mxml-search.c.
References mxml_node_s::child, mxml_node_s::next, and mxml_node_s::parent.
Referenced by mxmlFindElement().
mxml_node_t* mxmlWalkPrev | ( | mxml_node_t * | node, | |
mxml_node_t * | top, | |||
int | descend | |||
) |
Definition at line 168 of file mxml-search.c.
References mxml_node_s::last_child, mxml_node_s::parent, and mxml_node_s::prev.