63# define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok)
65# define IGNORE_SECTION_TOK_VTABLE
69 {PREFIX(prologTok), PREFIX(contentTok), \
70 PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE}, \
71 {PREFIX(attributeValueTok), PREFIX(entityValueTok)}, \
72 PREFIX(nameMatchesAscii), PREFIX(nameLength), PREFIX(skipS), \
73 PREFIX(getAtts), PREFIX(charRefNumber), PREFIX(predefinedEntityName), \
74 PREFIX(updatePosition), PREFIX(isPublicId)
76#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16)
78#define UCS2_GET_NAMING(pages, hi, lo) \
79 (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1u << ((lo)&0x1F)))
85#define UTF8_GET_NAMING2(pages, byte) \
86 (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \
87 + ((((byte)[0]) & 3) << 1) + ((((byte)[1]) >> 5) & 1)] \
88 & (1u << (((byte)[1]) & 0x1F)))
95#define UTF8_GET_NAMING3(pages, byte) \
97 [((pages)[((((byte)[0]) & 0xF) << 4) + ((((byte)[1]) >> 2) & 0xF)] \
99 + ((((byte)[1]) & 3) << 1) + ((((byte)[2]) >> 5) & 1)] \
100 & (1u << (((byte)[2]) & 0x1F)))
112#define UTF8_INVALID2(p) \
113 ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0)
115#define UTF8_INVALID3(p) \
116 (((p)[2] & 0x80) == 0 \
117 || ((*p) == 0xEF && (p)[1] == 0xBF ? (p)[2] > 0xBD \
118 : ((p)[2] & 0xC0) == 0xC0) \
120 ? (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \
121 : ((p)[1] & 0x80) == 0 \
122 || ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0)))
124#define UTF8_INVALID4(p) \
125 (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 || ((p)[2] & 0x80) == 0 \
126 || ((p)[2] & 0xC0) == 0xC0 \
128 ? (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \
129 : ((p)[1] & 0x80) == 0 \
130 || ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0)))
133isNever(
const ENCODING *enc,
const char *p) {
140utf8_isName2(
const ENCODING *enc,
const char *p) {
146utf8_isName3(
const ENCODING *enc,
const char *p) {
151#define utf8_isName4 isNever
154utf8_isNmstrt2(
const ENCODING *enc,
const char *p) {
160utf8_isNmstrt3(
const ENCODING *enc,
const char *p) {
165#define utf8_isNmstrt4 isNever
168utf8_isInvalid2(
const ENCODING *enc,
const char *p) {
174utf8_isInvalid3(
const ENCODING *enc,
const char *p) {
180utf8_isInvalid4(
const ENCODING *enc,
const char *p) {
206#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *)(enc))
210# define STANDARD_VTABLE(E) \
211 E##byteType, E##isNameMin, E##isNmstrtMin, E##byteToAscii, E##charMatches,
215# define STANDARD_VTABLE(E)
219#define NORMAL_VTABLE(E) \
220 E##isName2, E##isName3, E##isName4, E##isNmstrt2, E##isNmstrt3, \
221 E##isNmstrt4, E##isInvalid2, E##isInvalid3, E##isInvalid4
228static int FASTCALL checkCharRefNumber(
int);
234# define sb_isNameMin isNever
235# define sb_isNmstrtMin isNever
239# define MINBPC(enc) ((enc)->minBytesPerChar)
242# define MINBPC(enc) 1
245#define SB_BYTE_TYPE(enc, p) \
246 (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
250sb_byteType(
const ENCODING *enc,
const char *p) {
253# define BYTE_TYPE(enc, p) (AS_NORMAL_ENCODING(enc)->byteType(enc, p))
255# define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p)
259# define BYTE_TO_ASCII(enc, p) (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p))
261sb_byteToAscii(
const ENCODING *enc,
const char *p) {
266# define BYTE_TO_ASCII(enc, p) (*(p))
269#define IS_NAME_CHAR(enc, p, n) (AS_NORMAL_ENCODING(enc)->isName##n(enc, p))
270#define IS_NMSTRT_CHAR(enc, p, n) (AS_NORMAL_ENCODING(enc)->isNmstrt##n(enc, p))
272# define IS_INVALID_CHAR(enc, p, n) \
273 (AS_NORMAL_ENCODING(enc)->isInvalid##n \
274 && AS_NORMAL_ENCODING(enc)->isInvalid##n(enc, p))
276# define IS_INVALID_CHAR(enc, p, n) \
277 (AS_NORMAL_ENCODING(enc)->isInvalid##n(enc, p))
281# define IS_NAME_CHAR_MINBPC(enc, p) \
282 (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p))
283# define IS_NMSTRT_CHAR_MINBPC(enc, p) \
284 (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p))
286# define IS_NAME_CHAR_MINBPC(enc, p) (0)
287# define IS_NMSTRT_CHAR_MINBPC(enc, p) (0)
291# define CHAR_MATCHES(enc, p, c) \
292 (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c))
294sb_charMatches(
const ENCODING *enc,
const char *p,
int c) {
300# define CHAR_MATCHES(enc, p, c) (*(p) == (c))
303#define PREFIX(ident) normal_##ident
304#define XML_TOK_IMPL_C
313#undef IS_NAME_CHAR_MINBPC
315#undef IS_NMSTRT_CHAR_MINBPC
316#undef IS_INVALID_CHAR
327 const char **fromLimRef) {
328 const char *fromLim = *fromLimRef;
330 for (; fromLim > from; fromLim--, walked++) {
331 const unsigned char prev = (
unsigned char)fromLim[-1];
334 if (walked + 1 >= 4) {
340 }
else if ((prev & 0xf0u)
342 if (walked + 1 >= 3) {
348 }
else if ((prev & 0xe0u)
350 if (walked + 1 >= 2) {
356 }
else if ((prev & 0x80u)
361 *fromLimRef = fromLim;
365utf8_toUtf8(
const ENCODING *enc,
const char **fromP,
const char *fromLim,
366 char **toP,
const char *toLim) {
367 bool input_incomplete =
false;
368 bool output_exhausted =
false;
371 const ptrdiff_t bytesAvailable = fromLim - *fromP;
372 const ptrdiff_t bytesStorable = toLim - *toP;
374 if (bytesAvailable > bytesStorable) {
375 fromLim = *fromP + bytesStorable;
376 output_exhausted =
true;
381 const char *
const fromLimBefore = fromLim;
383 if (fromLim < fromLimBefore) {
384 input_incomplete =
true;
389 const ptrdiff_t bytesToCopy = fromLim - *fromP;
390 memcpy(*toP, *fromP, bytesToCopy);
391 *fromP += bytesToCopy;
395 if (output_exhausted)
397 else if (input_incomplete)
404utf8_toUtf16(
const ENCODING *enc,
const char **fromP,
const char *fromLim,
405 unsigned short **toP,
const unsigned short *toLim) {
407 unsigned short *to = *toP;
408 const char *from = *fromP;
409 while (from < fromLim && to < toLim) {
412 if (fromLim - from < 2) {
416 *to++ = (
unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f));
420 if (fromLim - from < 3) {
424 *to++ = (
unsigned short)(((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6)
430 if (toLim - to < 2) {
434 if (fromLim - from < 4) {
438 n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12)
439 | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f);
441 to[0] = (
unsigned short)((n >> 10) | 0xD800);
442 to[1] = (
unsigned short)((n & 0x3FF) | 0xDC00);
461 = {{
VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},
470 = {{
VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},
472#define BT_COLON BT_NMSTRT
482 = {{
VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},
492 = {{
VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},
494#define BT_COLON BT_NMSTRT
502latin1_toUtf8(
const ENCODING *
enc,
const char **fromP,
const char *fromLim,
503 char **toP,
const char *toLim) {
507 if (*fromP == fromLim)
509 c = (
unsigned char)**fromP;
511 if (toLim - *toP < 2)
514 *(*toP)++ = (char)((c & 0x3f) | 0x80);
519 *(*toP)++ = *(*fromP)++;
525latin1_toUtf16(
const ENCODING *
enc,
const char **fromP,
const char *fromLim,
526 unsigned short **toP,
const unsigned short *toLim) {
528 while (*fromP < fromLim && *toP < toLim)
529 *(*toP)++ = (
unsigned char)*(*fromP)++;
531 if ((*toP == toLim) && (*fromP < fromLim))
540 = {{
VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0},
550 = {{
VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0},
552#define BT_COLON BT_NMSTRT
560ascii_toUtf8(
const ENCODING *
enc,
const char **fromP,
const char *fromLim,
561 char **toP,
const char *toLim) {
563 while (*fromP < fromLim && *toP < toLim)
564 *(*toP)++ = *(*fromP)++;
566 if ((*toP == toLim) && (*fromP < fromLim))
575 = {{
VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0},
585 = {{
VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0},
587#define BT_COLON BT_NMSTRT
595unicode_byte_type(
char hi,
char lo) {
596 switch ((
unsigned char)hi) {
610 switch ((
unsigned char)lo) {
620#define DEFINE_UTF16_TO_UTF8(E) \
621 static enum XML_Convert_Result PTRCALL E##toUtf8( \
622 const ENCODING *enc, const char **fromP, const char *fromLim, \
623 char **toP, const char *toLim) { \
624 const char *from = *fromP; \
626 fromLim = from + (((fromLim - from) >> 1) << 1); \
627 for (; from < fromLim; from += 2) { \
630 unsigned char lo = GET_LO(from); \
631 unsigned char hi = GET_HI(from); \
635 if (*toP == toLim) { \
637 return XML_CONVERT_OUTPUT_EXHAUSTED; \
650 if (toLim - *toP < 2) { \
652 return XML_CONVERT_OUTPUT_EXHAUSTED; \
654 *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \
655 *(*toP)++ = ((lo & 0x3f) | 0x80); \
658 if (toLim - *toP < 3) { \
660 return XML_CONVERT_OUTPUT_EXHAUSTED; \
663 *(*toP)++ = ((hi >> 4) | UTF8_cval3); \
664 *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \
665 *(*toP)++ = ((lo & 0x3f) | 0x80); \
671 if (toLim - *toP < 4) { \
673 return XML_CONVERT_OUTPUT_EXHAUSTED; \
675 if (fromLim - from < 4) { \
677 return XML_CONVERT_INPUT_INCOMPLETE; \
679 plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \
680 *(*toP)++ = (char)((plane >> 2) | UTF8_cval4); \
681 *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \
683 lo2 = GET_LO(from); \
684 *(*toP)++ = (((lo & 0x3) << 4) | ((GET_HI(from) & 0x3) << 2) \
685 | (lo2 >> 6) | 0x80); \
686 *(*toP)++ = ((lo2 & 0x3f) | 0x80); \
691 if (from < fromLim) \
692 return XML_CONVERT_INPUT_INCOMPLETE; \
694 return XML_CONVERT_COMPLETED; \
697#define DEFINE_UTF16_TO_UTF16(E) \
698 static enum XML_Convert_Result PTRCALL E##toUtf16( \
699 const ENCODING *enc, const char **fromP, const char *fromLim, \
700 unsigned short **toP, const unsigned short *toLim) { \
701 enum XML_Convert_Result res = XML_CONVERT_COMPLETED; \
703 fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); \
705 if (fromLim - *fromP > ((toLim - *toP) << 1) \
706 && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) { \
708 res = XML_CONVERT_INPUT_INCOMPLETE; \
710 for (; *fromP < fromLim && *toP < toLim; *fromP += 2) \
711 *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \
712 if ((*toP == toLim) && (*fromP < fromLim)) \
713 return XML_CONVERT_OUTPUT_EXHAUSTED; \
718#define SET2(ptr, ch) (((ptr)[0] = ((ch)&0xff)), ((ptr)[1] = ((ch) >> 8)))
719#define GET_LO(ptr) ((unsigned char)(ptr)[0])
720#define GET_HI(ptr) ((unsigned char)(ptr)[1])
729#define SET2(ptr, ch) (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch)&0xFF)))
730#define GET_LO(ptr) ((unsigned char)(ptr)[1])
731#define GET_HI(ptr) ((unsigned char)(ptr)[0])
740#define LITTLE2_BYTE_TYPE(enc, p) \
741 ((p)[1] == 0 ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \
742 : unicode_byte_type((p)[1], (p)[0]))
743#define LITTLE2_BYTE_TO_ASCII(p) ((p)[1] == 0 ? (p)[0] : -1)
744#define LITTLE2_CHAR_MATCHES(p, c) ((p)[1] == 0 && (p)[0] == (c))
745#define LITTLE2_IS_NAME_CHAR_MINBPC(p) \
746 UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
747#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(p) \
748 UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0])
753little2_byteType(
const ENCODING *
enc,
const char *p) {
758little2_byteToAscii(
const ENCODING *
enc,
const char *p) {
764little2_charMatches(
const ENCODING *
enc,
const char *p,
int c) {
770little2_isNameMin(
const ENCODING *
enc,
const char *p) {
776little2_isNmstrtMin(
const ENCODING *
enc,
const char *p) {
782# define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16
787# define PREFIX(ident) little2_##ident
788# define MINBPC(enc) 2
790# define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p)
791# define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(p)
792# define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(p, c)
793# define IS_NAME_CHAR(enc, p, n) 0
794# define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(p)
795# define IS_NMSTRT_CHAR(enc, p, n) (0)
796# define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(p)
798# define XML_TOK_IMPL_C
800# undef XML_TOK_IMPL_C
807# undef IS_NAME_CHAR_MINBPC
808# undef IS_NMSTRT_CHAR
809# undef IS_NMSTRT_CHAR_MINBPC
810# undef IS_INVALID_CHAR
818# if BYTEORDER == 1234
841#define BT_COLON BT_NMSTRT
865# define BT_COLON BT_NMSTRT
874#define BIG2_BYTE_TYPE(enc, p) \
876 ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \
877 : unicode_byte_type((p)[0], (p)[1]))
878#define BIG2_BYTE_TO_ASCII(p) ((p)[0] == 0 ? (p)[1] : -1)
879#define BIG2_CHAR_MATCHES(p, c) ((p)[0] == 0 && (p)[1] == (c))
880#define BIG2_IS_NAME_CHAR_MINBPC(p) \
881 UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
882#define BIG2_IS_NMSTRT_CHAR_MINBPC(p) \
883 UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1])
893big2_byteToAscii(
const ENCODING *
enc,
const char *p) {
899big2_charMatches(
const ENCODING *
enc,
const char *p,
int c) {
905big2_isNameMin(
const ENCODING *
enc,
const char *p) {
911big2_isNmstrtMin(
const ENCODING *
enc,
const char *p) {
917# define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16
922# define PREFIX(ident) big2_##ident
923# define MINBPC(enc) 2
925# define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p)
926# define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(p)
927# define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(p, c)
928# define IS_NAME_CHAR(enc, p, n) 0
929# define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(p)
930# define IS_NMSTRT_CHAR(enc, p, n) (0)
931# define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(p)
933# define XML_TOK_IMPL_C
935# undef XML_TOK_IMPL_C
942# undef IS_NAME_CHAR_MINBPC
943# undef IS_NMSTRT_CHAR
944# undef IS_NMSTRT_CHAR_MINBPC
945# undef IS_INVALID_CHAR
953# if BYTEORDER == 4321
976#define BT_COLON BT_NMSTRT
1000# define BT_COLON BT_NMSTRT
1012streqci(
const char *s1,
const char *s2) {
1033initUpdatePosition(
const ENCODING *
enc,
const char *ptr,
const char *end,
1036 normal_updatePosition(&utf8_encoding.
enc, ptr, end, pos);
1040toAscii(
const ENCODING *
enc,
const char *ptr,
const char *end) {
1066parsePseudoAttribute(
const ENCODING *
enc,
const char *ptr,
const char *end,
1067 const char **namePtr,
const char **nameEndPtr,
1068 const char **valPtr,
const char **nextTokPtr) {
1075 if (! isSpace(toAscii(
enc, ptr, end))) {
1081 }
while (isSpace(toAscii(
enc, ptr, end)));
1088 c = toAscii(
enc, ptr, end);
1101 }
while (isSpace(c = toAscii(
enc, ptr, end)));
1110 if (ptr == *namePtr) {
1115 c = toAscii(
enc, ptr, end);
1116 while (isSpace(c)) {
1118 c = toAscii(
enc, ptr, end);
1128 c = toAscii(
enc, ptr, end);
1142static const char KW_version[]
1148static const char KW_standalone[]
1157doParseXmlDecl(
const ENCODING *(*encodingFinder)(
const ENCODING *,
const char *,
1159 int isGeneralTextEntity,
const ENCODING *
enc,
const char *ptr,
1160 const char *end,
const char **badPtr,
const char **versionPtr,
1161 const char **versionEndPtr,
const char **encodingName,
1163 const char *val = NULL;
1164 const char *
name = NULL;
1165 const char *nameEnd = NULL;
1168 if (! parsePseudoAttribute(
enc, ptr, end, &name, &nameEnd, &val, &ptr)
1174 if (! isGeneralTextEntity) {
1182 *versionEndPtr = ptr;
1183 if (! parsePseudoAttribute(
enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
1188 if (isGeneralTextEntity) {
1197 int c = toAscii(
enc, val, end);
1203 *encodingName = val;
1206 if (! parsePseudoAttribute(
enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
1214 || isGeneralTextEntity) {
1228 while (isSpace(toAscii(
enc, ptr, end)))
1238checkCharRefNumber(
int result) {
1239 switch (result >> 8) {
1254 if (result == 0xFFFE || result == 0xFFFF)
1278 buf[1] = (char)((c & 0x3f) | 0x80);
1283 buf[1] = (char)(((c >> 6) & 0x3f) | 0x80);
1284 buf[2] = (char)((c & 0x3f) | 0x80);
1289 buf[1] = (char)(((c >> 12) & 0x3f) | 0x80);
1290 buf[2] = (char)(((c >> 6) & 0x3f) | 0x80);
1291 buf[3] = (char)((c & 0x3f) | 0x80);
1301 if (charNum < 0x10000) {
1302 buf[0] = (
unsigned short)charNum;
1305 if (charNum < 0x110000) {
1307 buf[0] = (
unsigned short)((charNum >> 10) + 0xD800);
1308 buf[1] = (
unsigned short)((charNum & 0x3FF) + 0xDC00);
1322#define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *)(enc))
1330unknown_isName(
const ENCODING *enc,
const char *p) {
1339unknown_isNmstrt(
const ENCODING *enc,
const char *p) {
1348unknown_isInvalid(
const ENCODING *enc,
const char *p) {
1351 return (c & ~0xFFFF) || checkCharRefNumber(c) < 0;
1355unknown_toUtf8(
const ENCODING *enc,
const char **fromP,
const char *fromLim,
1356 char **toP,
const char *toLim) {
1362 if (*fromP == fromLim)
1364 utf8 = uenc->
utf8[(
unsigned char)**fromP];
1369 if (n > toLim - *toP)
1375 if (n > toLim - *toP)
1379 memcpy(*toP,
utf8, n);
1385unknown_toUtf16(
const ENCODING *enc,
const char **fromP,
const char *fromLim,
1386 unsigned short **toP,
const unsigned short *toLim) {
1388 while (*fromP < fromLim && *toP < toLim) {
1389 unsigned short c = uenc->
utf16[(
unsigned char)**fromP];
1399 if ((*toP == toLim) && (*fromP < fromLim))
1411 for (i = 0; i < 128; i++)
1415 for (i = 0; i < 256; i++) {
1420 e->
utf16[i] = 0xFFFF;
1432 }
else if (c < 0x80) {
1438 e->
utf8[i][1] = (char)c;
1439 e->
utf16[i] = (
unsigned short)(c == 0 ? 0xFFFF : c);
1440 }
else if (checkCharRefNumber(c) < 0) {
1443 e->
utf16[i] = 0xFFFF;
1456 e->
utf16[i] = (
unsigned short)c;
1462 e->
normal.isName2 = unknown_isName;
1463 e->
normal.isName3 = unknown_isName;
1464 e->
normal.isName4 = unknown_isName;
1465 e->
normal.isNmstrt2 = unknown_isNmstrt;
1466 e->
normal.isNmstrt3 = unknown_isNmstrt;
1467 e->
normal.isNmstrt4 = unknown_isNmstrt;
1468 e->
normal.isInvalid2 = unknown_isInvalid;
1469 e->
normal.isInvalid3 = unknown_isInvalid;
1470 e->
normal.isInvalid4 = unknown_isInvalid;
1472 e->
normal.
enc.utf8Convert = unknown_toUtf8;
1473 e->
normal.
enc.utf16Convert = unknown_toUtf16;
1491static const char KW_ISO_8859_1[]
1494static const char KW_US_ASCII[]
1497static const char KW_UTF_8[]
1499static const char KW_UTF_16[]
1501static const char KW_UTF_16BE[]
1504static const char KW_UTF_16LE[]
1509getEncodingIndex(
const char *name) {
1510 static const char *
const encodingNames[] = {
1511 KW_ISO_8859_1, KW_US_ASCII, KW_UTF_8, KW_UTF_16, KW_UTF_16BE, KW_UTF_16LE,
1516 for (i = 0; i < (int)(
sizeof(encodingNames) /
sizeof(encodingNames[0])); i++)
1517 if (streqci(name, encodingNames[i]))
1526#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16)
1527#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i)
1538 int state,
const char *ptr,
const char *end,
const char **nextTokPtr) {
1544 if (ptr + 1 == end) {
1559 switch ((
unsigned char)*ptr) {
1571 switch (((
unsigned char)ptr[0] << 8) | (
unsigned char)ptr[1]) {
1575 *nextTokPtr = ptr + 2;
1585 return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
1589 *nextTokPtr = ptr + 2;
1608 if ((
unsigned char)ptr[2] == 0xBF) {
1609 *nextTokPtr = ptr + 3;
1615 if (ptr[0] ==
'\0') {
1625 return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
1626 }
else if (ptr[1] ==
'\0') {
1639 return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
1645 return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
1659# define ns(x) x##_ns
1661# define XML_TOK_NS_C
const char * name(G4int ptype)
const char const char const char * int(PTRFASTCALL *isNmstrt2)(const ENCODING *
const char const char const char const char * int(PTRFASTCALL *isNmstrt3)(const ENCODING *
int(PTRFASTCALL *isName2)(const ENCODING *
const char * int(PTRFASTCALL *isName3)(const ENCODING *
const char const char const char const char const char const char const char * int(PTRFASTCALL *isInvalid3)(const ENCODING *
const char const char const char const char const char * int(PTRFASTCALL *isNmstrt4)(const ENCODING *
const char const char const char const char const char const char const char const char * int(PTRFASTCALL *isInvalid4)(const ENCODING *
const char const char const char const char const char const char * int(PTRFASTCALL *isInvalid2)(const ENCODING *
const char const char * int(PTRFASTCALL *isName4)(const ENCODING *
unsigned short utf16[256]
struct normal_encoding normal
#define XmlInitUnknownEncodingNS
#define BIG2_CHAR_MATCHES(p, c)
#define STANDARD_VTABLE(E)
#define UTF8_GET_NAMING3(pages, byte)
#define LITTLE2_BYTE_TO_ASCII(p)
#define DEFINE_UTF16_TO_UTF8(E)
#define BIG2_BYTE_TYPE(enc, p)
void _INTERNAL_trim_to_complete_utf8_characters(const char *from, const char **fromLimRef)
#define INIT_ENC_INDEX(enc)
#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(p)
ENCODING * XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert, void *userData)
int XmlSizeOfUnknownEncoding(void)
#define BIG2_BYTE_TO_ASCII(p)
#define LITTLE2_IS_NAME_CHAR_MINBPC(p)
#define SB_BYTE_TYPE(enc, p)
#define BIG2_IS_NAME_CHAR_MINBPC(p)
#define LITTLE2_BYTE_TYPE(enc, p)
#define AS_UNKNOWN_ENCODING(enc)
#define UCS2_GET_NAMING(pages, hi, lo)
#define UTF8_GET_NAMING2(pages, byte)
int FASTCALL XmlUtf16Encode(int charNum, unsigned short *buf)
#define DEFINE_UTF16_TO_UTF16(E)
#define BIG2_IS_NMSTRT_CHAR_MINBPC(p)
#define AS_NORMAL_ENCODING(enc)
#define LITTLE2_CHAR_MATCHES(p, c)
int FASTCALL XmlUtf8Encode(int c, char *buf)
#define XML_CONTENT_STATE
#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim)
#define XML_UTF8_ENCODE_MAX
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2)
int(XMLCALL * CONVERTER)(void *userData, const char *p)
@ XML_CONVERT_OUTPUT_EXHAUSTED
@ XML_CONVERT_INPUT_INCOMPLETE
#define XmlTok(enc, state, ptr, end, nextTokPtr)