#include "expat_config.h"
#include <stddef.h>
#include <string.h>
#include <stdbool.h>
#ifdef _WIN32
# include "winconfig.h"
#endif
#include "expat_external.h"
#include "internal.h"
#include "xmltok.h"
#include "nametab.h"
#ifdef XML_DTD
#define IGNORE_SECTION_TOK_VTABLE …
#else
#define IGNORE_SECTION_TOK_VTABLE …
#endif
#define VTABLE1 …
#define VTABLE …
#define UCS2_GET_NAMING(pages, hi, lo) …
#define UTF8_GET_NAMING2(pages, byte) …
#define UTF8_GET_NAMING3(pages, byte) …
#define UTF8_INVALID2(p) …
#define UTF8_INVALID3(p) …
#define UTF8_INVALID4(p) …
static int PTRFASTCALL
isNever(const ENCODING *enc, const char *p) { … }
static int PTRFASTCALL
utf8_isName2(const ENCODING *enc, const char *p) { … }
static int PTRFASTCALL
utf8_isName3(const ENCODING *enc, const char *p) { … }
#define utf8_isName4 …
static int PTRFASTCALL
utf8_isNmstrt2(const ENCODING *enc, const char *p) { … }
static int PTRFASTCALL
utf8_isNmstrt3(const ENCODING *enc, const char *p) { … }
#define utf8_isNmstrt4 …
static int PTRFASTCALL
utf8_isInvalid2(const ENCODING *enc, const char *p) { … }
static int PTRFASTCALL
utf8_isInvalid3(const ENCODING *enc, const char *p) { … }
static int PTRFASTCALL
utf8_isInvalid4(const ENCODING *enc, const char *p) { … }
struct normal_encoding { … };
#define AS_NORMAL_ENCODING(enc) …
#ifdef XML_MIN_SIZE
#define STANDARD_VTABLE …
#else
#define STANDARD_VTABLE(E) …
#endif
#define NORMAL_VTABLE(E) …
#define NULL_VTABLE …
static int FASTCALL checkCharRefNumber(int result);
#include "xmltok_impl.h"
#include "ascii.h"
#ifdef XML_MIN_SIZE
#define sb_isNameMin …
#define sb_isNmstrtMin …
#endif
#ifdef XML_MIN_SIZE
#define MINBPC …
#else
#define MINBPC …
#endif
#define SB_BYTE_TYPE(enc, p) …
#ifdef XML_MIN_SIZE
static int PTRFASTCALL
sb_byteType(const ENCODING *enc, const char *p) {
return SB_BYTE_TYPE(enc, p);
}
#define BYTE_TYPE …
#else
#define BYTE_TYPE …
#endif
#ifdef XML_MIN_SIZE
#define BYTE_TO_ASCII …
static int PTRFASTCALL
sb_byteToAscii(const ENCODING *enc, const char *p) {
UNUSED_P(enc);
return *p;
}
#else
#define BYTE_TO_ASCII …
#endif
#define IS_NAME_CHAR …
#define IS_NMSTRT_CHAR …
#ifdef XML_MIN_SIZE
#define IS_INVALID_CHAR …
#else
#define IS_INVALID_CHAR …
#endif
#ifdef XML_MIN_SIZE
#define IS_NAME_CHAR_MINBPC …
#define IS_NMSTRT_CHAR_MINBPC …
#else
#define IS_NAME_CHAR_MINBPC …
#define IS_NMSTRT_CHAR_MINBPC …
#endif
#ifdef XML_MIN_SIZE
#define CHAR_MATCHES …
static int PTRCALL
sb_charMatches(const ENCODING *enc, const char *p, int c) {
UNUSED_P(enc);
return *p == c;
}
#else
#define CHAR_MATCHES …
#endif
#define PREFIX …
#define XML_TOK_IMPL_C
#include "xmltok_impl.c"
#undef XML_TOK_IMPL_C
#undef MINBPC
#undef BYTE_TYPE
#undef BYTE_TO_ASCII
#undef CHAR_MATCHES
#undef IS_NAME_CHAR
#undef IS_NAME_CHAR_MINBPC
#undef IS_NMSTRT_CHAR
#undef IS_NMSTRT_CHAR_MINBPC
#undef IS_INVALID_CHAR
enum { … };
void
_INTERNAL_trim_to_complete_utf8_characters(const char *from,
const char **fromLimRef) { … }
static enum XML_Convert_Result PTRCALL
utf8_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
char **toP, const char *toLim) { … }
static enum XML_Convert_Result PTRCALL
utf8_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim) { … }
#ifdef XML_NS
static const struct normal_encoding utf8_encoding_ns
= …;
#endif
static const struct normal_encoding utf8_encoding
= …;
#ifdef XML_NS
static const struct normal_encoding internal_utf8_encoding_ns
= …;
#endif
static const struct normal_encoding internal_utf8_encoding
= …;
static enum XML_Convert_Result PTRCALL
latin1_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
char **toP, const char *toLim) { … }
static enum XML_Convert_Result PTRCALL
latin1_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim) { … }
#ifdef XML_NS
static const struct normal_encoding latin1_encoding_ns
= …;
#endif
static const struct normal_encoding latin1_encoding
= …;
static enum XML_Convert_Result PTRCALL
ascii_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
char **toP, const char *toLim) { … }
#ifdef XML_NS
static const struct normal_encoding ascii_encoding_ns
= …;
#endif
static const struct normal_encoding ascii_encoding
= …;
static int PTRFASTCALL
unicode_byte_type(char hi, char lo) { … }
#define DEFINE_UTF16_TO_UTF8(E) …
#define DEFINE_UTF16_TO_UTF16(E) …
#define GET_LO …
#define GET_HI …
DEFINE_UTF16_TO_UTF8(little2_)
DEFINE_UTF16_TO_UTF16(little2_)
#undef GET_LO
#undef GET_HI
#define GET_LO …
#define GET_HI …
DEFINE_UTF16_TO_UTF8(big2_)
DEFINE_UTF16_TO_UTF16(big2_)
#undef GET_LO
#undef GET_HI
#define LITTLE2_BYTE_TYPE(enc, p) …
#define LITTLE2_BYTE_TO_ASCII(p) …
#define LITTLE2_CHAR_MATCHES(p, c) …
#define LITTLE2_IS_NAME_CHAR_MINBPC(p) …
#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(p) …
#ifdef XML_MIN_SIZE
static int PTRFASTCALL
little2_byteType(const ENCODING *enc, const char *p) {
return LITTLE2_BYTE_TYPE(enc, p);
}
static int PTRFASTCALL
little2_byteToAscii(const ENCODING *enc, const char *p) {
UNUSED_P(enc);
return LITTLE2_BYTE_TO_ASCII(p);
}
static int PTRCALL
little2_charMatches(const ENCODING *enc, const char *p, int c) {
UNUSED_P(enc);
return LITTLE2_CHAR_MATCHES(p, c);
}
static int PTRFASTCALL
little2_isNameMin(const ENCODING *enc, const char *p) {
UNUSED_P(enc);
return LITTLE2_IS_NAME_CHAR_MINBPC(p);
}
static int PTRFASTCALL
little2_isNmstrtMin(const ENCODING *enc, const char *p) {
UNUSED_P(enc);
return LITTLE2_IS_NMSTRT_CHAR_MINBPC(p);
}
# undef VTABLE
#define VTABLE …
#else
# undef PREFIX
#define PREFIX …
#define MINBPC …
#define BYTE_TYPE …
#define BYTE_TO_ASCII …
#define CHAR_MATCHES …
#define IS_NAME_CHAR …
#define IS_NAME_CHAR_MINBPC …
#define IS_NMSTRT_CHAR …
#define IS_NMSTRT_CHAR_MINBPC …
#define XML_TOK_IMPL_C
# include "xmltok_impl.c"
# undef XML_TOK_IMPL_C
# undef MINBPC
# undef BYTE_TYPE
# undef BYTE_TO_ASCII
# undef CHAR_MATCHES
# undef IS_NAME_CHAR
# undef IS_NAME_CHAR_MINBPC
# undef IS_NMSTRT_CHAR
# undef IS_NMSTRT_CHAR_MINBPC
# undef IS_INVALID_CHAR
#endif
#ifdef XML_NS
static const struct normal_encoding little2_encoding_ns
= …;
#endif
static const struct normal_encoding little2_encoding
= …;
#if BYTEORDER != 4321
# ifdef XML_NS
static const struct normal_encoding internal_little2_encoding_ns
= …;
# endif
static const struct normal_encoding internal_little2_encoding
= …;
#endif
#define BIG2_BYTE_TYPE(enc, p) …
#define BIG2_BYTE_TO_ASCII(p) …
#define BIG2_CHAR_MATCHES(p, c) …
#define BIG2_IS_NAME_CHAR_MINBPC(p) …
#define BIG2_IS_NMSTRT_CHAR_MINBPC(p) …
#ifdef XML_MIN_SIZE
static int PTRFASTCALL
big2_byteType(const ENCODING *enc, const char *p) {
return BIG2_BYTE_TYPE(enc, p);
}
static int PTRFASTCALL
big2_byteToAscii(const ENCODING *enc, const char *p) {
UNUSED_P(enc);
return BIG2_BYTE_TO_ASCII(p);
}
static int PTRCALL
big2_charMatches(const ENCODING *enc, const char *p, int c) {
UNUSED_P(enc);
return BIG2_CHAR_MATCHES(p, c);
}
static int PTRFASTCALL
big2_isNameMin(const ENCODING *enc, const char *p) {
UNUSED_P(enc);
return BIG2_IS_NAME_CHAR_MINBPC(p);
}
static int PTRFASTCALL
big2_isNmstrtMin(const ENCODING *enc, const char *p) {
UNUSED_P(enc);
return BIG2_IS_NMSTRT_CHAR_MINBPC(p);
}
# undef VTABLE
#define VTABLE …
#else
# undef PREFIX
#define PREFIX …
#define MINBPC …
#define BYTE_TYPE …
#define BYTE_TO_ASCII …
#define CHAR_MATCHES …
#define IS_NAME_CHAR …
#define IS_NAME_CHAR_MINBPC …
#define IS_NMSTRT_CHAR …
#define IS_NMSTRT_CHAR_MINBPC …
#define XML_TOK_IMPL_C
# include "xmltok_impl.c"
# undef XML_TOK_IMPL_C
# undef MINBPC
# undef BYTE_TYPE
# undef BYTE_TO_ASCII
# undef CHAR_MATCHES
# undef IS_NAME_CHAR
# undef IS_NAME_CHAR_MINBPC
# undef IS_NMSTRT_CHAR
# undef IS_NMSTRT_CHAR_MINBPC
# undef IS_INVALID_CHAR
#endif
#ifdef XML_NS
static const struct normal_encoding big2_encoding_ns
= …;
#endif
static const struct normal_encoding big2_encoding
= …;
#if BYTEORDER != 1234
# ifdef XML_NS
static const struct normal_encoding internal_big2_encoding_ns
= {{VTABLE, 2, 0, 1},
{
# include "iasciitab.h"
# include "latin1tab.h"
},
STANDARD_VTABLE(big2_) NULL_VTABLE};
# endif
static const struct normal_encoding internal_big2_encoding
= {{VTABLE, 2, 0, 1},
{
#define BT_COLON …
# include "iasciitab.h"
# undef BT_COLON
# include "latin1tab.h"
},
STANDARD_VTABLE(big2_) NULL_VTABLE};
#endif
#undef PREFIX
static int FASTCALL
streqci(const char *s1, const char *s2) { … }
static void PTRCALL
initUpdatePosition(const ENCODING *enc, const char *ptr, const char *end,
POSITION *pos) { … }
static int
toAscii(const ENCODING *enc, const char *ptr, const char *end) { … }
static int FASTCALL
isSpace(int c) { … }
static int
parsePseudoAttribute(const ENCODING *enc, const char *ptr, const char *end,
const char **namePtr, const char **nameEndPtr,
const char **valPtr, const char **nextTokPtr) { … }
static const char KW_version[]
= …;
static const char KW_encoding[] = …;
static const char KW_standalone[]
= …;
static const char KW_yes[] = …;
static const char KW_no[] = …;
static int
doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, const char *,
const char *),
int isGeneralTextEntity, const ENCODING *enc, const char *ptr,
const char *end, const char **badPtr, const char **versionPtr,
const char **versionEndPtr, const char **encodingName,
const ENCODING **encoding, int *standalone) { … }
static int FASTCALL
checkCharRefNumber(int result) { … }
int FASTCALL
XmlUtf8Encode(int c, char *buf) { … }
int FASTCALL
XmlUtf16Encode(int charNum, unsigned short *buf) { … }
struct unknown_encoding { … };
#define AS_UNKNOWN_ENCODING(enc) …
int
XmlSizeOfUnknownEncoding(void) { … }
static int PTRFASTCALL
unknown_isName(const ENCODING *enc, const char *p) { … }
static int PTRFASTCALL
unknown_isNmstrt(const ENCODING *enc, const char *p) { … }
static int PTRFASTCALL
unknown_isInvalid(const ENCODING *enc, const char *p) { … }
static enum XML_Convert_Result PTRCALL
unknown_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
char **toP, const char *toLim) { … }
static enum XML_Convert_Result PTRCALL
unknown_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim) { … }
ENCODING *
XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert,
void *userData) { … }
enum { … };
static const char KW_ISO_8859_1[]
= …;
static const char KW_US_ASCII[]
= …;
static const char KW_UTF_8[]
= …;
static const char KW_UTF_16[]
= …;
static const char KW_UTF_16BE[]
= …;
static const char KW_UTF_16LE[]
= …;
static int FASTCALL
getEncodingIndex(const char *name) { … }
#define INIT_ENC_INDEX(enc) …
#define SET_INIT_ENC_INDEX(enc, i) …
static int
initScan(const ENCODING *const *encodingTable, const INIT_ENCODING *enc,
int state, const char *ptr, const char *end, const char **nextTokPtr) { … }
#define NS …
#define ns …
#define XML_TOK_NS_C
#include "xmltok_ns.c"
#undef XML_TOK_NS_C
#undef NS
#undef ns
#ifdef XML_NS
#define NS …
#define ns …
#define XML_TOK_NS_C
# include "xmltok_ns.c"
# undef XML_TOK_NS_C
# undef NS
# undef ns
ENCODING *
XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert,
void *userData) { … }
#endif