#include "mxml-private.h"
#include <unistd.h>
Go to the source code of this file.
Data Structures | |
struct | _mxml_fdbuf_s |
Defines | |
#define | ENCODE_UTF8 0 |
#define | ENCODE_UTF16BE 1 |
#define | ENCODE_UTF16LE 2 |
#define | mxml_bad_char(ch) ((ch) < ' ' && (ch) != '\n' && (ch) != '\r' && (ch) != '\t') |
Typedefs | |
typedef int(* | _mxml_getc_cb_t )(void *, int *) |
typedef int(* | _mxml_putc_cb_t )(int, void *) |
typedef struct _mxml_fdbuf_s | _mxml_fdbuf_t |
Functions | |
static int | mxml_add_char (int ch, char **ptr, char **buffer, int *bufsize) |
static int | mxml_fd_getc (void *p, int *encoding) |
static int | mxml_fd_putc (int ch, void *p) |
static int | mxml_fd_read (_mxml_fdbuf_t *buf) |
static int | mxml_fd_write (_mxml_fdbuf_t *buf) |
static int | mxml_file_getc (void *p, int *encoding) |
static int | mxml_file_putc (int ch, void *p) |
static int | mxml_get_entity (mxml_node_t *parent, void *p, int *encoding, _mxml_getc_cb_t getc_cb) |
static int | mxml_isspace (int ch) |
static mxml_node_t * | mxml_load_data (mxml_node_t *top, void *p, mxml_load_cb_t cb, _mxml_getc_cb_t getc_cb, mxml_sax_cb_t sax_cb, void *sax_data) |
static int | mxml_parse_element (mxml_node_t *node, void *p, int *encoding, _mxml_getc_cb_t getc_cb) |
static int | mxml_string_getc (void *p, int *encoding) |
static int | mxml_string_putc (int ch, void *p) |
static int | mxml_write_name (const char *s, void *p, _mxml_putc_cb_t putc_cb) |
static int | mxml_write_node (mxml_node_t *node, void *p, mxml_save_cb_t cb, int col, _mxml_putc_cb_t putc_cb, _mxml_global_t *global) |
static int | mxml_write_string (const char *s, void *p, _mxml_putc_cb_t putc_cb) |
static int | mxml_write_ws (mxml_node_t *node, void *p, mxml_save_cb_t cb, int ws, int col, _mxml_putc_cb_t putc_cb) |
mxml_node_t * | mxmlLoadFd (mxml_node_t *top, int fd, mxml_load_cb_t cb) |
mxml_node_t * | mxmlLoadFile (mxml_node_t *top, FILE *fp, mxml_load_cb_t cb) |
mxml_node_t * | mxmlLoadString (mxml_node_t *top, const char *s, mxml_load_cb_t cb) |
char * | mxmlSaveAllocString (mxml_node_t *node, mxml_save_cb_t cb) |
int | mxmlSaveFd (mxml_node_t *node, int fd, mxml_save_cb_t cb) |
int | mxmlSaveFile (mxml_node_t *node, FILE *fp, mxml_save_cb_t cb) |
int | mxmlSaveString (mxml_node_t *node, char *buffer, int bufsize, mxml_save_cb_t cb) |
mxml_node_t * | mxmlSAXLoadFd (mxml_node_t *top, int fd, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void *sax_data) |
mxml_node_t * | mxmlSAXLoadFile (mxml_node_t *top, FILE *fp, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void *sax_data) |
mxml_node_t * | mxmlSAXLoadString (mxml_node_t *top, const char *s, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void *sax_data) |
void | mxmlSetCustomHandlers (mxml_custom_load_cb_t load, mxml_custom_save_cb_t save) |
void | mxmlSetErrorCallback (mxml_error_cb_t cb) |
void | mxmlSetWrapMargin (int column) |
static int | mxml_get_entity (mxml_node_t *parent, void *p, int *encoding, int(*getc_cb)(void *, int *)) |
static int | mxml_write_name (const char *s, void *p, int(*putc_cb)(int, void *)) |
#define ENCODE_UTF16BE 1 |
Definition at line 71 of file mxml-file.c.
Referenced by mxml_fd_getc(), mxml_file_getc(), and mxml_string_getc().
#define ENCODE_UTF16LE 2 |
Definition at line 72 of file mxml-file.c.
Referenced by mxml_fd_getc(), mxml_file_getc(), and mxml_string_getc().
#define ENCODE_UTF8 0 |
Definition at line 70 of file mxml-file.c.
Referenced by mxml_fd_getc(), mxml_file_getc(), mxml_load_data(), and mxml_string_getc().
#define mxml_bad_char | ( | ch | ) | ((ch) < ' ' && (ch) != '\n' && (ch) != '\r' && (ch) != '\t') |
Definition at line 79 of file mxml-file.c.
Referenced by mxml_fd_getc(), mxml_file_getc(), mxml_get_entity(), and mxml_string_getc().
typedef struct _mxml_fdbuf_s _mxml_fdbuf_t |
typedef int(* _mxml_getc_cb_t)(void *, int *) |
Definition at line 86 of file mxml-file.c.
typedef int(* _mxml_putc_cb_t)(int, void *) |
Definition at line 87 of file mxml-file.c.
static int mxml_add_char | ( | int | ch, | |
char ** | ptr, | |||
char ** | buffer, | |||
int * | bufsize | |||
) | [static] |
Definition at line 633 of file mxml-file.c.
References mxml_error().
Referenced by mxml_load_data(), and mxml_parse_element().
static int mxml_fd_getc | ( | void * | p, | |
int * | encoding | |||
) | [static] |
Definition at line 713 of file mxml-file.c.
References _mxml_fdbuf_s::current, ENCODE_UTF16BE, ENCODE_UTF16LE, ENCODE_UTF8, _mxml_fdbuf_s::end, mxml_bad_char, mxml_error(), and mxml_fd_read().
Referenced by mxmlLoadFd(), and mxmlSAXLoadFd().
static int mxml_fd_putc | ( | int | ch, | |
void * | p | |||
) | [static] |
Definition at line 1000 of file mxml-file.c.
References _mxml_fdbuf_s::current, _mxml_fdbuf_s::end, and mxml_fd_write().
Referenced by mxmlSaveFd().
static int mxml_fd_read | ( | _mxml_fdbuf_t * | buf | ) | [static] |
Definition at line 1069 of file mxml-file.c.
References _mxml_fdbuf_s::buffer, _mxml_fdbuf_s::current, _mxml_fdbuf_s::end, errno, and _mxml_fdbuf_s::fd.
Referenced by mxml_fd_getc().
static int mxml_fd_write | ( | _mxml_fdbuf_t * | buf | ) | [static] |
Definition at line 1112 of file mxml-file.c.
References _mxml_fdbuf_s::buffer, _mxml_fdbuf_s::current, and _mxml_fdbuf_s::fd.
Referenced by mxml_fd_putc(), and mxmlSaveFd().
static int mxml_file_getc | ( | void * | p, | |
int * | encoding | |||
) | [static] |
Definition at line 1155 of file mxml-file.c.
References ENCODE_UTF16BE, ENCODE_UTF16LE, ENCODE_UTF8, mxml_bad_char, and mxml_error().
Referenced by mxmlLoadFile(), and mxmlSAXLoadFile().
static int mxml_file_putc | ( | int | ch, | |
void * | p | |||
) | [static] |
Definition at line 1354 of file mxml-file.c.
Referenced by mxmlSaveFile().
static int mxml_get_entity | ( | mxml_node_t * | parent, | |
void * | p, | |||
int * | encoding, | |||
int(*)(void *, int *) | getc_cb | |||
) | [static] |
Definition at line 1409 of file mxml-file.c.
References mxml_value_u::element, mxml_bad_char, mxml_error(), mxmlEntityGetValue(), mxml_element_s::name, and mxml_node_s::value.
static int mxml_get_entity | ( | mxml_node_t * | parent, | |
void * | p, | |||
int * | encoding, | |||
_mxml_getc_cb_t | getc_cb | |||
) | [static] |
Referenced by mxml_load_data(), and mxml_parse_element().
static int mxml_isspace | ( | int | ch | ) | [inline, static] |
Definition at line 113 of file mxml-file.c.
Referenced by mxml_load_data(), and mxml_parse_element().
static mxml_node_t * mxml_load_data | ( | mxml_node_t * | top, | |
void * | p, | |||
mxml_load_cb_t | cb, | |||
_mxml_getc_cb_t | getc_cb, | |||
mxml_sax_cb_t | sax_cb, | |||
void * | sax_data | |||
) | [static] |
Definition at line 1470 of file mxml-file.c.
References _mxml_global(), _mxml_global_s::custom_load_cb, mxml_value_u::element, ENCODE_UTF8, error(), mxml_add_char(), MXML_CUSTOM, mxml_error(), mxml_get_entity(), MXML_IGNORE, MXML_INTEGER, mxml_isspace(), MXML_OPAQUE, mxml_parse_element(), MXML_REAL, MXML_SAX_CDATA, MXML_SAX_COMMENT, MXML_SAX_DATA, MXML_SAX_DIRECTIVE, MXML_SAX_ELEMENT_CLOSE, MXML_SAX_ELEMENT_OPEN, MXML_TEXT, mxmlDelete(), mxmlNewCustom(), mxmlNewElement(), mxmlNewInteger(), mxmlNewOpaque(), mxmlNewReal(), mxmlNewText(), mxmlRelease(), mxml_element_s::name, mxml_node_s::parent, type, and mxml_node_s::value.
Referenced by mxmlLoadFd(), mxmlLoadFile(), mxmlLoadString(), mxmlSAXLoadFd(), mxmlSAXLoadFile(), and mxmlSAXLoadString().
static int mxml_parse_element | ( | mxml_node_t * | node, | |
void * | p, | |||
int * | encoding, | |||
_mxml_getc_cb_t | getc_cb | |||
) | [static] |
Definition at line 2113 of file mxml-file.c.
References mxml_value_u::element, error(), mxml_add_char(), mxml_error(), mxml_get_entity(), mxml_isspace(), mxmlElementGetAttr(), mxmlElementSetAttr(), mxml_element_s::name, name, and mxml_node_s::value.
Referenced by mxml_load_data().
static int mxml_string_getc | ( | void * | p, | |
int * | encoding | |||
) | [static] |
Definition at line 2381 of file mxml-file.c.
References ENCODE_UTF16BE, ENCODE_UTF16LE, ENCODE_UTF8, mxml_bad_char, and mxml_error().
Referenced by mxmlLoadString(), and mxmlSAXLoadString().
static int mxml_string_putc | ( | int | ch, | |
void * | p | |||
) | [static] |
Definition at line 2617 of file mxml-file.c.
Referenced by mxmlSaveString().
static int mxml_write_name | ( | const char * | s, | |
void * | p, | |||
int(*)(int, void *) | putc_cb | |||
) | [static] |
Definition at line 2691 of file mxml-file.c.
References mxmlEntityGetName(), and name.
static int mxml_write_name | ( | const char * | s, | |
void * | p, | |||
_mxml_putc_cb_t | putc_cb | |||
) | [static] |
Referenced by mxml_write_node().
static int mxml_write_node | ( | mxml_node_t * | node, | |
void * | p, | |||
mxml_save_cb_t | cb, | |||
int | col, | |||
_mxml_putc_cb_t | putc_cb, | |||
_mxml_global_t * | global | |||
) | [static] |
Definition at line 2766 of file mxml-file.c.
References mxml_element_s::attrs, mxml_node_s::child, _mxml_global_s::custom_save_cb, data, mxml_value_u::element, i, mxml_value_u::integer, MXML_CUSTOM, MXML_ELEMENT, MXML_INTEGER, MXML_OPAQUE, MXML_REAL, MXML_TEXT, mxml_write_name(), mxml_write_string(), mxml_write_ws(), MXML_WS_AFTER_CLOSE, MXML_WS_AFTER_OPEN, MXML_WS_BEFORE_CLOSE, MXML_WS_BEFORE_OPEN, mxml_attr_s::name, mxml_element_s::name, mxml_node_s::next, mxml_element_s::num_attrs, mxml_value_u::opaque, mxml_node_s::prev, mxml_value_u::real, mxml_text_s::string, mxml_value_u::text, mxml_node_s::type, mxml_attr_s::value, mxml_node_s::value, mxml_text_s::whitespace, and _mxml_global_s::wrap.
Referenced by mxmlSaveFd(), mxmlSaveFile(), and mxmlSaveString().
static int mxml_write_string | ( | const char * | s, | |
void * | p, | |||
_mxml_putc_cb_t | putc_cb | |||
) | [static] |
Definition at line 3048 of file mxml-file.c.
References mxmlEntityGetName(), and name.
Referenced by mxml_write_node().
static int mxml_write_ws | ( | mxml_node_t * | node, | |
void * | p, | |||
mxml_save_cb_t | cb, | |||
int | ws, | |||
int | col, | |||
_mxml_putc_cb_t | putc_cb | |||
) | [static] |
mxml_node_t* mxmlLoadFd | ( | mxml_node_t * | top, | |
int | fd, | |||
mxml_load_cb_t | cb | |||
) |
Definition at line 156 of file mxml-file.c.
References _mxml_fdbuf_s::buffer, _mxml_fdbuf_s::current, _mxml_fdbuf_s::end, _mxml_fdbuf_s::fd, mxml_fd_getc(), mxml_load_data(), and MXML_NO_CALLBACK.
mxml_node_t* mxmlLoadFile | ( | mxml_node_t * | top, | |
FILE * | fp, | |||
mxml_load_cb_t | cb | |||
) |
Definition at line 195 of file mxml-file.c.
References mxml_file_getc(), mxml_load_data(), and MXML_NO_CALLBACK.
mxml_node_t* mxmlLoadString | ( | mxml_node_t * | top, | |
const char * | s, | |||
mxml_load_cb_t | cb | |||
) |
Definition at line 223 of file mxml-file.c.
References mxml_load_data(), MXML_NO_CALLBACK, and mxml_string_getc().
Referenced by MP_LoadTeamMultiplayer(), and SAV_GameLoad().
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_load_cb_t | cb, | |||
mxml_sax_cb_t | sax_cb, | |||
void * | sax_data | |||
) |
Definition at line 465 of file mxml-file.c.
References _mxml_fdbuf_s::buffer, _mxml_fdbuf_s::current, _mxml_fdbuf_s::end, _mxml_fdbuf_s::fd, mxml_fd_getc(), and mxml_load_data().
mxml_node_t* mxmlSAXLoadFile | ( | mxml_node_t * | top, | |
FILE * | fp, | |||
mxml_load_cb_t | cb, | |||
mxml_sax_cb_t | sax_cb, | |||
void * | sax_data | |||
) |
Definition at line 513 of file mxml-file.c.
References mxml_file_getc(), and mxml_load_data().
mxml_node_t* mxmlSAXLoadString | ( | mxml_node_t * | top, | |
const char * | s, | |||
mxml_load_cb_t | cb, | |||
mxml_sax_cb_t | sax_cb, | |||
void * | sax_data | |||
) |
Definition at line 551 of file mxml-file.c.
References mxml_load_data(), and mxml_string_getc().
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.
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.
void mxmlSetWrapMargin | ( | int | column | ) |
Definition at line 615 of file mxml-file.c.
References _mxml_global(), and _mxml_global_s::wrap.