mxml-file.c File Reference

#include "mxml-private.h"
#include <unistd.h>
Include dependency graph for mxml-file.c:

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_tmxml_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_tmxmlLoadFd (mxml_node_t *top, int fd, mxml_load_cb_t cb)
mxml_node_tmxmlLoadFile (mxml_node_t *top, FILE *fp, mxml_load_cb_t cb)
mxml_node_tmxmlLoadString (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_tmxmlSAXLoadFd (mxml_node_t *top, int fd, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void *sax_data)
mxml_node_tmxmlSAXLoadFile (mxml_node_t *top, FILE *fp, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void *sax_data)
mxml_node_tmxmlSAXLoadString (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 Documentation

#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 Documentation

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.


Function Documentation

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]
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]
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]
static int mxml_get_entity ( mxml_node_t parent,
void *  p,
int *  encoding,
_mxml_getc_cb_t  getc_cb 
) [static]
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]
static int mxml_parse_element ( mxml_node_t node,
void *  p,
int *  encoding,
_mxml_getc_cb_t  getc_cb 
) [static]
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]
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]

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

References MXML_TAB.

Referenced by mxml_write_node().

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 
)

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 
)
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 
)
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 
)

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 
)
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.


Generated by  doxygen 1.6.2