#include "mxml.h"
#include <unistd.h>
#include "config.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 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, int(*getc_cb)(void *, int *)) |
static mxml_node_t * | mxml_load_data (mxml_node_t *top, void *p, mxml_type_t(*cb)(mxml_node_t *), int(*getc_cb)(void *, int *)) |
static int | mxml_parse_element (mxml_node_t *node, void *p, int *encoding, int(*getc_cb)(void *, int *)) |
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, int(*putc_cb)(int, void *)) |
static int | mxml_write_node (mxml_node_t *node, void *p, const char *(*cb)(mxml_node_t *, int), int col, int(*putc_cb)(int, void *)) |
static int | mxml_write_string (const char *s, void *p, int(*putc_cb)(int, void *)) |
static int | mxml_write_ws (mxml_node_t *node, void *p, const char *(*cb)(mxml_node_t *, int), int ws, int col, int(*putc_cb)(int, void *)) |
mxml_node_t * | mxmlLoadFd (mxml_node_t *top, int fd, mxml_type_t(*cb)(mxml_node_t *node)) |
mxml_node_t * | mxmlLoadFile (mxml_node_t *top, FILE *fp, mxml_type_t(*cb)(mxml_node_t *node)) |
mxml_node_t * | mxmlLoadString (mxml_node_t *top, const char *s, mxml_type_t(*cb)(mxml_node_t *node)) |
char * | mxmlSaveAllocString (mxml_node_t *node, const char *(*cb)(mxml_node_t *node, int ws)) |
int | mxmlSaveFd (mxml_node_t *node, int fd, const char *(*cb)(mxml_node_t *node, int ws)) |
int | mxmlSaveFile (mxml_node_t *node, FILE *fp, const char *(*cb)(mxml_node_t *node, int ws)) |
int | mxmlSaveString (mxml_node_t *node, char *buffer, int bufsize, const char *(*cb)(mxml_node_t *node, int ws)) |
void | mxmlSetCustomHandlers (mxml_custom_load_cb_t load, mxml_custom_save_cb_t save) |
void | mxmlSetErrorCallback (void(*cb)(const char *)) |
Variables | |
void(* | mxml_error_cb )(const char *) |
static mxml_custom_load_cb_t | mxml_custom_load_cb = NULL |
static mxml_custom_save_cb_t | mxml_custom_save_cb = NULL |
#define ENCODE_UTF16BE 1 |
Definition at line 69 of file mxml-file.c.
Referenced by mxml_fd_getc(), mxml_file_getc(), and mxml_string_getc().
#define ENCODE_UTF16LE 2 |
Definition at line 70 of file mxml-file.c.
Referenced by mxml_fd_getc(), mxml_file_getc(), and mxml_string_getc().
#define ENCODE_UTF8 0 |
Definition at line 68 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 77 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 |
Definition at line 484 of file mxml-file.c.
References mxml_error().
Referenced by mxml_load_data(), and mxml_parse_element().
Definition at line 564 of file mxml-file.c.
References buf, 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().
Definition at line 851 of file mxml-file.c.
References buf, 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 920 of file mxml-file.c.
References mxml_fdbuf_s::buffer, mxml_fdbuf_s::current, mxml_fdbuf_s::end, and mxml_fdbuf_s::fd.
Referenced by mxml_fd_getc().
static int mxml_fd_write | ( | mxml_fdbuf_t * | buf | ) | [static] |
Definition at line 959 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().
Definition at line 1002 of file mxml-file.c.
References ENCODE_UTF16BE, ENCODE_UTF16LE, ENCODE_UTF8, mxml_bad_char, and mxml_error().
Referenced by mxmlLoadFile().
Definition at line 1201 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 1256 of file mxml-file.c.
References mxml_value_u::element, mxml_bad_char, mxml_error(), mxmlEntityGetValue(), mxml_value_s::name, and mxml_node_s::value.
Referenced by mxml_load_data(), and mxml_parse_element().
static mxml_node_t * mxml_load_data | ( | mxml_node_t * | top, | |
void * | p, | |||
mxml_type_t(*)(mxml_node_t *) | cb, | |||
int(*)(void *, int *) | getc_cb | |||
) | [static] |
Definition at line 1317 of file mxml-file.c.
References mxml_value_u::element, ENCODE_UTF8, mxml_add_char(), MXML_CUSTOM, mxml_custom_load_cb, mxml_error(), mxml_get_entity(), MXML_INTEGER, MXML_OPAQUE, mxml_parse_element(), MXML_REAL, MXML_TEXT, mxmlDelete(), mxmlNewCustom(), mxmlNewElement(), mxmlNewInteger(), mxmlNewOpaque(), mxmlNewReal(), mxmlNewText(), mxml_value_s::name, mxml_node_s::parent, and mxml_node_s::value.
Referenced by mxmlLoadFd(), mxmlLoadFile(), and mxmlLoadString().
static int mxml_parse_element | ( | mxml_node_t * | node, | |
void * | p, | |||
int * | encoding, | |||
int(*)(void *, int *) | getc_cb | |||
) | [static] |
Definition at line 1841 of file mxml-file.c.
References mxml_value_u::element, mxml_add_char(), mxml_error(), mxml_get_entity(), mxmlElementGetAttr(), mxmlElementSetAttr(), mxml_value_s::name, and mxml_node_s::value.
Referenced by mxml_load_data().
Definition at line 2103 of file mxml-file.c.
References ENCODE_UTF16BE, ENCODE_UTF16LE, ENCODE_UTF8, mxml_bad_char, and mxml_error().
Referenced by mxmlLoadString().
Definition at line 2339 of file mxml-file.c.
Referenced by mxmlSaveString().
Definition at line 2413 of file mxml-file.c.
References mxmlEntityGetName().
Referenced by mxml_write_node().
static int mxml_write_node | ( | mxml_node_t * | node, | |
void * | p, | |||
const char *(*)(mxml_node_t *, int) | cb, | |||
int | col, | |||
int(*)(int, void *) | putc_cb | |||
) | [static] |
Definition at line 2488 of file mxml-file.c.
References mxml_value_s::attrs, mxml_node_s::child, mxml_value_u::element, mxml_value_u::integer, MXML_CUSTOM, mxml_custom_save_cb, MXML_ELEMENT, MXML_INTEGER, MXML_OPAQUE, MXML_REAL, MXML_TEXT, MXML_WRAP, 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_value_s::name, mxml_node_s::next, mxml_value_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, and mxml_text_s::whitespace.
Referenced by mxmlSaveFd(), mxmlSaveFile(), and mxmlSaveString().
Definition at line 2769 of file mxml-file.c.
References mxmlEntityGetName().
Referenced by mxml_write_node().
static int mxml_write_ws | ( | mxml_node_t * | node, | |
void * | p, | |||
const char *(*)(mxml_node_t *, int) | cb, | |||
int | ws, | |||
int | col, | |||
int(*)(int, void *) | putc_cb | |||
) | [static] |
mxml_node_t* mxmlLoadFd | ( | mxml_node_t * | top, | |
int | fd, | |||
mxml_type_t(*)(mxml_node_t *node) | cb | |||
) |
Definition at line 160 of file mxml-file.c.
References buf, mxml_fdbuf_s::buffer, mxml_fdbuf_s::current, mxml_fdbuf_s::end, mxml_fdbuf_s::fd, mxml_fd_getc(), and mxml_load_data().
Referenced by main().
mxml_node_t* mxmlLoadFile | ( | mxml_node_t * | top, | |
FILE * | fp, | |||
mxml_type_t(*)(mxml_node_t *node) | cb | |||
) |
Definition at line 200 of file mxml-file.c.
References mxml_file_getc(), and mxml_load_data().
Referenced by main().
mxml_node_t* mxmlLoadString | ( | mxml_node_t * | top, | |
const char * | s, | |||
mxml_type_t(*)(mxml_node_t *node) | cb | |||
) |
Definition at line 229 of file mxml-file.c.
References mxml_load_data(), and mxml_string_getc().
Referenced by acc_connection_Thread(), agent_xml_compose(), fipa_envelope_Compose(), fipa_envelope_Parse(), main(), MC_LoadAgentFromFile(), message_InitializeFromConnection(), and message_InitializeFromString().
char* mxmlSaveAllocString | ( | mxml_node_t * | node, | |
const char *(*)(mxml_node_t *node, int ws) | cb | |||
) |
Definition at line 259 of file mxml-file.c.
References mxmlSaveString(), and strdup.
Referenced by fipa_envelope_Compose(), MC_GetAgentXMLString(), and message_InitializeFromAgent().
int mxmlSaveFd | ( | mxml_node_t * | node, | |
int | fd, | |||
const char *(*)(mxml_node_t *node, int ws) | cb | |||
) |
Definition at line 316 of file mxml-file.c.
References buf, 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().
Referenced by main().
int mxmlSaveFile | ( | mxml_node_t * | node, | |
FILE * | fp, | |||
const char *(*)(mxml_node_t *node, int ws) | cb | |||
) |
Definition at line 363 of file mxml-file.c.
References mxml_file_putc(), and mxml_write_node().
Referenced by main().
int mxmlSaveString | ( | mxml_node_t * | node, | |
char * | buffer, | |||
int | bufsize, | |||
const char *(*)(mxml_node_t *node, int ws) | cb | |||
) |
Definition at line 405 of file mxml-file.c.
References mxml_string_putc(), and mxml_write_node().
Referenced by main(), and mxmlSaveAllocString().
void mxmlSetCustomHandlers | ( | mxml_custom_load_cb_t | load, | |
mxml_custom_save_cb_t | save | |||
) |
Definition at line 457 of file mxml-file.c.
References mxml_custom_load_cb, and mxml_custom_save_cb.
void mxmlSetErrorCallback | ( | void(*)(const char *) | cb | ) |
Definition at line 472 of file mxml-file.c.
References mxml_error_cb.
mxml_custom_load_cb_t mxml_custom_load_cb = NULL [static] |
Definition at line 104 of file mxml-file.c.
Referenced by mxml_load_data(), and mxmlSetCustomHandlers().
mxml_custom_save_cb_t mxml_custom_save_cb = NULL [static] |
Definition at line 105 of file mxml-file.c.
Referenced by mxml_write_node(), and mxmlSetCustomHandlers().
void(* mxml_error_cb)(const char *) |
Definition at line 45 of file mxml-private.c.
Referenced by mxml_error(), and mxmlSetErrorCallback().