/home/dko/projects/mobilec/trunk/src/mxml-2.2.2/mxml-file.c File Reference

#include "config.h"
#include "mxml.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 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_tmxml_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_tmxmlLoadFd (mxml_node_t *top, int fd, mxml_type_t(*cb)(mxml_node_t *node))
mxml_node_tmxmlLoadFile (mxml_node_t *top, FILE *fp, mxml_type_t(*cb)(mxml_node_t *node))
mxml_node_tmxmlLoadString (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 Documentation

#define ENCODE_UTF16BE   1

Definition at line 65 of file mxml-file.c.

Referenced by mxml_fd_getc(), mxml_file_getc(), and mxml_string_getc().

#define ENCODE_UTF16LE   2

Definition at line 66 of file mxml-file.c.

Referenced by mxml_fd_getc(), mxml_file_getc(), and mxml_string_getc().

#define ENCODE_UTF8   0

Definition at line 64 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 73 of file mxml-file.c.

Referenced by mxml_fd_getc(), mxml_file_getc(), mxml_get_entity(), and mxml_string_getc().


Typedef Documentation

typedef struct mxml_fdbuf_s mxml_fdbuf_t


Function Documentation

static int mxml_add_char ( int  ch,
char **  ptr,
char **  buffer,
int bufsize 
) [static]

Definition at line 480 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 560 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().

static int mxml_fd_putc ( int  ch,
void *  p 
) [static]

Definition at line 847 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 916 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 955 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 998 of file mxml-file.c.

References ENCODE_UTF16BE, ENCODE_UTF16LE, ENCODE_UTF8, mxml_bad_char, and mxml_error().

Referenced by mxmlLoadFile().

static int mxml_file_putc ( int  ch,
void *  p 
) [static]

Definition at line 1197 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 1252 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 1313 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 1837 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().

static int mxml_string_getc ( void *  p,
int encoding 
) [static]

Definition at line 2099 of file mxml-file.c.

References ENCODE_UTF16BE, ENCODE_UTF16LE, ENCODE_UTF8, mxml_bad_char, and mxml_error().

Referenced by mxmlLoadString().

static int mxml_string_putc ( int  ch,
void *  p 
) [static]

Definition at line 2335 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 2409 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 2484 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().

static int mxml_write_string ( const char *  s,
void *  p,
int(*)(int, void *)  putc_cb 
) [static]

Definition at line 2765 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]

Definition at line 2805 of file mxml-file.c.

References MXML_TAB.

Referenced by mxml_write_node().

mxml_node_t* mxmlLoadFd ( mxml_node_t top,
int  fd,
mxml_type_t(*)(mxml_node_t *node 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(), 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 196 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 225 of file mxml-file.c.

References mxml_load_data(), and mxml_string_getc().

Referenced by acc_Thread(), agent_xml_compose(), fipa_envelope_Compose(), fipa_envelope_Parse(), main(), and message_InitializeFromConnection().

char* mxmlSaveAllocString ( mxml_node_t node,
const char *(*)(mxml_node_t *node, int ws)  cb 
)

Definition at line 255 of file mxml-file.c.

References mxmlSaveString().

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 312 of file mxml-file.c.

References 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 359 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 401 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 453 of file mxml-file.c.

References mxml_custom_load_cb, and mxml_custom_save_cb.

void mxmlSetErrorCallback ( void(*)(const char *)  cb  ) 

Definition at line 468 of file mxml-file.c.

References mxml_error_cb.


Variable Documentation

mxml_custom_load_cb_t mxml_custom_load_cb = NULL [static]

Definition at line 100 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 101 of file mxml-file.c.

Referenced by mxml_write_node(), and mxmlSetCustomHandlers().

void(* mxml_error_cb)(const char *)

Referenced by mxml_error(), and mxmlSetErrorCallback().


Generated on Fri May 16 14:49:56 2008 for Mobile-C by  doxygen 1.5.4