cdata works
This commit is contained in:
parent
54806705c5
commit
1113b2dbe3
7 changed files with 196 additions and 126 deletions
|
|
@ -8,42 +8,44 @@
|
|||
|
||||
#define XLDECL extern
|
||||
|
||||
typedef struct xmllib_driver xmllib_driver_t;
|
||||
typedef struct xmllib xmllib_t;
|
||||
typedef struct xmllib_node xmllib_node_t;
|
||||
typedef struct xl_driver xl_driver_t;
|
||||
typedef struct xmllib xmllib_t;
|
||||
typedef struct xl_node xl_node_t;
|
||||
|
||||
struct xmllib_driver {
|
||||
#define XL_SKIPPABLE(x) (((x) == ' ') || ((x) == '\t') || ((x) == '\n') || ((x) == '\r'))
|
||||
|
||||
struct xl_driver {
|
||||
int (*open)(xmllib_t* handle);
|
||||
int (*read)(xmllib_t* handle, void* data, int size);
|
||||
void (*close)(xmllib_t* handle);
|
||||
};
|
||||
|
||||
enum XMLLIB_NODE_TYPE {
|
||||
XMLLIB_NODE_COMMENT = 0,
|
||||
XMLLIB_NODE_NODE,
|
||||
XMLLIB_NODE_PROCESS,
|
||||
XMLLIB_NODE_DOCTYPE
|
||||
enum XL_NODE_TYPE {
|
||||
XL_NODE_COMMENT = 0,
|
||||
XL_NODE_NODE,
|
||||
XL_NODE_PROCESS,
|
||||
XL_NODE_DOCTYPE
|
||||
};
|
||||
|
||||
struct xmllib_node {
|
||||
struct xl_node {
|
||||
int type;
|
||||
char* name;
|
||||
char* text;
|
||||
|
||||
xmllib_node_t* root;
|
||||
xmllib_node_t* parent;
|
||||
xl_node_t* root;
|
||||
xl_node_t* parent;
|
||||
|
||||
xmllib_node_t* first_child;
|
||||
xl_node_t* first_child;
|
||||
|
||||
xmllib_node_t* prev;
|
||||
xmllib_node_t* next;
|
||||
xl_node_t* prev;
|
||||
xl_node_t* next;
|
||||
};
|
||||
|
||||
struct xmllib {
|
||||
xmllib_driver_t* driver;
|
||||
void* drv_opaque;
|
||||
void* drv_arg;
|
||||
xmllib_node_t* root;
|
||||
xl_driver_t* driver;
|
||||
void* drv_opaque;
|
||||
void* drv_arg;
|
||||
xl_node_t* root;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -51,23 +53,26 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/* core.c */
|
||||
XLDECL xmllib_t* xmllib_open(xmllib_driver_t* driver, void* arg);
|
||||
XLDECL xmllib_t* xl_open(xl_driver_t* driver, void* arg);
|
||||
|
||||
XLDECL int xmllib_parse(xmllib_t* handle);
|
||||
XLDECL int xl_parse(xmllib_t* handle);
|
||||
|
||||
XLDECL void xmllib_close(xmllib_t* handle);
|
||||
XLDECL void xl_close(xmllib_t* handle);
|
||||
|
||||
/* file.c */
|
||||
XLDECL xmllib_driver_t* xmllib_driver_file;
|
||||
XLDECL xl_driver_t* xl_driver_file;
|
||||
|
||||
XLDECL xmllib_t* xmllib_open_file(const char* filename);
|
||||
XLDECL xmllib_t* xl_open_file(const char* filename);
|
||||
|
||||
/* util.c */
|
||||
XLDECL char* xl_util_trim(const char* str);
|
||||
|
||||
/* unicode.c */
|
||||
XLDECL int xmllib_unicode_count(unsigned char c);
|
||||
XLDECL int xl_unicode_count(unsigned char c);
|
||||
|
||||
XLDECL int xmllib_unicode_8_to_32(const char* input, int* output);
|
||||
XLDECL int xl_unicode_8_to_32(const char* input, int* output);
|
||||
|
||||
XLDECL int xmllib_unicode_32_to_8(const int input, char* output);
|
||||
XLDECL int xl_unicode_32_to_8(const int input, char* output);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue