1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#ifdef WIN32
#include<stdlib.h>
#endif
#ifndef NULL
#define NULL 0x00
#endif
struct nodec {
struct nodec *curchild;
struct nodec *parent;
struct nodec *next;
struct nodec *firstchild;
struct nodec *lastchild;
struct attc *firstatt;
struct attc *lastatt;
int numchildren;
int numatt;
char *name;
int namelen;
char *value;
char *comment;
int vallen;
int comlen;
int type;// cdata or normal
int numvals;
int numcoms;
int pos;
int err;
int z;
};
struct nodec *nodec_addchildr( struct nodec *self, char *newname, int newnamelen );//, char *newval, int newvallen, int newtype );
//struct nodec *nodec_addchild( struct nodec *self, char *newname, int newnamelen );
struct attc *nodec_addattr ( struct nodec *self, char *newname, int newnamelen );//, char *newval, int newvallen );
//struct attc *nodec_addatt ( struct nodec *self, char *newname, int newnamelen );
struct nodec *new_nodecp( struct nodec *newparent );
struct nodec *new_nodec();
void del_nodec( struct nodec *node );
struct attc {
struct nodec *parent;
struct attc *next;
char *name;
int namelen;
char *value;
int vallen;
};
struct attc* new_attc( struct nodec *newparent );
struct parserc {
struct nodec *curnode;
struct attc *curatt;
struct nodec *rootnode;
int err;
char *tagname; int tagname_len;
char *attname; int attname_len;
char *attval; int attval_len;
int att_has_val;
int last_state;
char *rootpos;
};
int parserc_parse( struct parserc *self, char *newbuf );
int parserc_parse_unsafely( struct parserc *self, char *newbuf );
|