103 #define yxml_isChar(c) 1
105 #define yxml_isSP(c) (c == 0x20 || c == 0x09 || c == 0x0a)
106 #define yxml_isAlpha(c) ((c|32)-'a' < 26)
107 #define yxml_isNum(c) (c-'0' < 10)
108 #define yxml_isHex(c) (yxml_isNum(c) || (c|32)-'a' < 6)
109 #define yxml_isEncName(c) (yxml_isAlpha(c) || yxml_isNum(c) || c == '.' || c == '_' || c == '-')
110 #define yxml_isNameStart(c) (yxml_isAlpha(c) || c == ':' || c == '_' || c >= 128)
111 #define yxml_isName(c) (yxml_isNameStart(c) || yxml_isNum(c) || c == '-' || c == '.')
113 #define yxml_isAttValue(c) (yxml_isChar(c) && c != x->quote && c != '<' && c != '&')
117 #define yxml_isRef(c) (yxml_isNum(c) || yxml_isAlpha(c) || c == '#')
119 #define INTFROM5CHARS(a, b, c, d, e) ((((uint64_t)(a))<<32) | (((uint64_t)(b))<<24) | (((uint64_t)(c))<<16) | (((uint64_t)(d))<<8) | (uint64_t)(e))
124 *(
unsigned char *)
dest = ch;
133 else if(ch <= 0x07FF) {
136 }
else if(ch <= 0xFFFF) {
198 if(
x->stacklen+2 >=
x->stacksize)
201 *res = (
char *)
x->stack+
x->stacklen;
202 x->stack[
x->stacklen] = ch;
204 x->stack[
x->stacklen] = 0;
210 if(
x->stacklen+1 >=
x->stacksize)
212 x->stack[
x->stacklen] = ch;
214 x->stack[
x->stacklen] = 0;
222 while(
x->stack[
x->stacklen]);
236 x->elem = (
char *)
x->stack+
x->stacklen-1;
241 x->elem = (
char *)
x->stack;
248 if(*((
unsigned char *)
x->elem) != ch)
278 memset(
x->data, 0,
sizeof(
x->data));
285 if(
x->reflen >=
sizeof(
x->data)-1)
294 unsigned char *
r = (
unsigned char *)
x->data;
299 ch = (ch<<4) + (*
r <=
'9' ? *
r-
'0' : (*
r|32)-
'a' + 10);
302 ch = (ch*10) + (*
r-
'0');
316 if(!ch || ch > 0x10FFFF || ch == 0xFFFE || ch == 0xFFFF || (ch-0xDFFF) < 0x7FF)
330 x->stack = (
unsigned char*)
stack;
331 x->stacksize = stacksize;
333 x->elem =
x->pi =
x->attr = (
char *)
x->stack;
341 unsigned ch = (
unsigned)(_ch+256) & 0xff;
350 if(
x->ignore == ch) {
354 x->ignore = (ch == 0xd) * 0xa;
355 if(ch == 0xa || ch == 0xd) {
364 if(ch == *
x->string) {
367 x->state =
x->nextstate;
378 if(ch == (
unsigned char)
'=') {
386 if(ch == (
unsigned char)
'=') {
394 if(ch == (
unsigned char)
'\'' || ch == (
unsigned char)
'"') {
403 if(ch == (
unsigned char)
'&') {
415 if(ch == (
unsigned char)
'\x3b') {
421 if(ch == (
unsigned char)
']') {
429 if(ch == (
unsigned char)
']') {
439 if(ch == (
unsigned char)
']')
441 if(ch == (
unsigned char)
'>') {
451 if(ch == (
unsigned char)
'-') {
457 if(ch == (
unsigned char)
'-') {
463 if(ch == (
unsigned char)
'-') {
471 if(ch == (
unsigned char)
'-') {
481 if(ch == (
unsigned char)
'>') {
482 x->state =
x->nextstate;
487 if(ch == (
unsigned char)
'>') {
491 if(ch == (
unsigned char)
'\'' || ch == (
unsigned char)
'"') {
497 if(ch == (
unsigned char)
'<') {
506 x->state =
x->nextstate;
513 if(ch == (
unsigned char)
'?') {
518 if(ch == (
unsigned char)
'!') {
524 if(ch == (
unsigned char)
'-') {
535 if(ch == (
unsigned char)
'\'' || ch == (
unsigned char)
'"') {
541 if(ch == (
unsigned char)
'>') {
555 if(ch == (
unsigned char)
'/') {
559 if(ch == (
unsigned char)
'>') {
567 if(ch == (
unsigned char)
'/') {
571 if(ch == (
unsigned char)
'>') {
585 if(ch == (
unsigned char)
'/') {
589 if(ch == (
unsigned char)
'>') {
595 if(ch == (
unsigned char)
'>') {
603 if(ch == (
unsigned char)
'=') {
611 if(ch == (
unsigned char)
'\'' || ch == (
unsigned char)
'"') {
644 if(ch == (
unsigned char)
'>') {
652 if(ch == (
unsigned char)
'>') {
658 if(ch == (
unsigned char)
'\xef') {
661 x->string = (
unsigned char *)
"\xbb\xbf";
668 if(ch == (
unsigned char)
'<') {
674 if(ch == (
unsigned char)
'!') {
678 if(ch == (
unsigned char)
'?') {
688 if(ch == (
unsigned char)
'!') {
692 if(ch == (
unsigned char)
'?') {
703 if(ch == (
unsigned char)
'!') {
707 if(ch == (
unsigned char)
'?') {
712 if(ch == (
unsigned char)
'/') {
722 if(ch == (
unsigned char)
'!') {
727 if(ch == (
unsigned char)
'?') {
734 if(ch == (
unsigned char)
'-') {
739 if(ch == (
unsigned char)
'D') {
742 x->string = (
unsigned char *)
"OCTYPE";
747 if(ch == (
unsigned char)
'-') {
752 if(ch == (
unsigned char)
'[') {
755 x->string = (
unsigned char *)
"CDATA[";
760 if(ch == (
unsigned char)
'x') {
774 if(ch == (
unsigned char)
'<') {
782 if(ch == (
unsigned char)
'<') {
788 if(ch == (
unsigned char)
'<') {
792 if(ch == (
unsigned char)
'&') {
802 if(ch == (
unsigned char)
'\x3b') {
810 if(ch == (
unsigned char)
'<') {
824 if(ch == (
unsigned char)
'?') {
834 if(ch == (
unsigned char)
'?') {
842 if(ch == (
unsigned char)
'>') {
843 x->state =
x->nextstate;
852 if(ch == (
unsigned char)
'>') {
853 x->state =
x->nextstate;
860 if(ch == (
unsigned char)
'=') {
868 if(ch == (
unsigned char)
'\'' || ch == (
unsigned char)
'"') {
875 if(ch == (
unsigned char)
'y') {
878 x->string = (
unsigned char *)
"es";
881 if(ch == (
unsigned char)
'n') {
884 x->string = (
unsigned char *)
"o";
897 if(ch == (
unsigned char)
'=') {
905 if(ch == (
unsigned char)
'\'' || ch == (
unsigned char)
'"') {
909 x->string = (
unsigned char *)
"1.";
928 if(ch == (
unsigned char)
'm') {
936 if(ch == (
unsigned char)
'?') {
946 if(ch == (
unsigned char)
'l') {
954 if(ch == (
unsigned char)
'?') {
976 if(ch == (
unsigned char)
'v') {
979 x->string = (
unsigned char *)
"ersion";
988 if(ch == (
unsigned char)
'?') {
996 if(ch == (
unsigned char)
'?') {
1000 if(ch == (
unsigned char)
'e') {
1003 x->string = (
unsigned char *)
"ncoding";
1006 if(ch == (
unsigned char)
's') {
1009 x->string = (
unsigned char *)
"tandalone";
1018 if(ch == (
unsigned char)
'?') {
1026 if(ch == (
unsigned char)
'?') {
1030 if(ch == (
unsigned char)
's') {
1033 x->string = (
unsigned char *)
"tandalone";
1040 if(ch == (
unsigned char)
'?') {
1046 if(ch == (
unsigned char)
'>') {
return memset(p, 0, total)
static void struct sockaddr socklen_t static fromlen static backlog static fork char char char static envp int struct rusage static rusage struct utsname static buf struct sembuf unsigned
static yxml_ret_t yxml_ref(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_pistart(yxml_t *x, unsigned ch)
yxml_ret_t yxml_eof(yxml_t *x)
static yxml_ret_t yxml_refcontent(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_refattrval(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_refend(yxml_t *x, yxml_ret_t ret)
static void yxml_setchar(char *dest, unsigned ch)
static yxml_ret_t yxml_attrvalend(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_attrname(yxml_t *x, unsigned ch)
yxml_ret_t yxml_parse(yxml_t *x, int _ch)
static yxml_ret_t yxml_datacontent(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_pushstackc(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_refstart(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_pushstack(yxml_t *x, char **res, unsigned ch)
static yxml_ret_t yxml_datapi1(yxml_t *x, unsigned ch)
void yxml_init(yxml_t *x, void *stack, size_t stacksize)
static yxml_ret_t yxml_datacd1(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_datacd2(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_attrstart(yxml_t *x, unsigned ch)
#define INTFROM5CHARS(a, b, c, d, e)
static yxml_ret_t yxml_datapi2(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_attrnameend(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_piname(yxml_t *x, unsigned ch)
#define yxml_isNameStart(c)
static void yxml_setutf8(char *dest, unsigned ch)
#define yxml_isAttValue(c)
static yxml_ret_t yxml_pinameend(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_elemcloseend(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_dataattr(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_elemname(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_piabort(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_elemclose(yxml_t *x, unsigned ch)
#define yxml_isEncName(c)
static void yxml_popstack(yxml_t *x)
static yxml_ret_t yxml_selfclose(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_elemstart(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_pivalend(yxml_t *x, unsigned ch)
static yxml_ret_t yxml_elemnameend(yxml_t *x, unsigned ch)