#include <expat_config.h>
#endif /* ndef COMPILED_FROM_DSP */
+#include "internal.h"
#include "xmltok.h"
#include "nametab.h"
|| \
((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0)))
-static int
+static int FASTCALL
isNever(const ENCODING *enc, const char *p)
{
return 0;
}
-static int
+static int FASTCALL
utf8_isName2(const ENCODING *enc, const char *p)
{
return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);
}
-static int
+static int FASTCALL
utf8_isName3(const ENCODING *enc, const char *p)
{
return UTF8_GET_NAMING3(namePages, (const unsigned char *)p);
#define utf8_isName4 isNever
-static int
+static int FASTCALL
utf8_isNmstrt2(const ENCODING *enc, const char *p)
{
return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);
}
-static int
+static int FASTCALL
utf8_isNmstrt3(const ENCODING *enc, const char *p)
{
return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p);
#define utf8_isNmstrt4 isNever
-static int
+static int FASTCALL
utf8_isInvalid2(const ENCODING *enc, const char *p)
{
return UTF8_INVALID2((const unsigned char *)p);
}
-static int
+static int FASTCALL
utf8_isInvalid3(const ENCODING *enc, const char *p)
{
return UTF8_INVALID3((const unsigned char *)p);
}
-static int
+static int FASTCALL
utf8_isInvalid4(const ENCODING *enc, const char *p)
{
return UTF8_INVALID4((const unsigned char *)p);
ENCODING enc;
unsigned char type[256];
#ifdef XML_MIN_SIZE
- int (*byteType)(const ENCODING *, const char *);
- int (*isNameMin)(const ENCODING *, const char *);
- int (*isNmstrtMin)(const ENCODING *, const char *);
- int (*byteToAscii)(const ENCODING *, const char *);
- int (*charMatches)(const ENCODING *, const char *, int);
+ int (FASTCALL *byteType)(const ENCODING *, const char *);
+ int (FASTCALL *isNameMin)(const ENCODING *, const char *);
+ int (FASTCALL *isNmstrtMin)(const ENCODING *, const char *);
+ int (FASTCALL *byteToAscii)(const ENCODING *, const char *);
+ int (FASTCALL *charMatches)(const ENCODING *, const char *, int);
#endif /* XML_MIN_SIZE */
- int (*isName2)(const ENCODING *, const char *);
- int (*isName3)(const ENCODING *, const char *);
- int (*isName4)(const ENCODING *, const char *);
- int (*isNmstrt2)(const ENCODING *, const char *);
- int (*isNmstrt3)(const ENCODING *, const char *);
- int (*isNmstrt4)(const ENCODING *, const char *);
- int (*isInvalid2)(const ENCODING *, const char *);
- int (*isInvalid3)(const ENCODING *, const char *);
- int (*isInvalid4)(const ENCODING *, const char *);
+ int (FASTCALL *isName2)(const ENCODING *, const char *);
+ int (FASTCALL *isName3)(const ENCODING *, const char *);
+ int (FASTCALL *isName4)(const ENCODING *, const char *);
+ int (FASTCALL *isNmstrt2)(const ENCODING *, const char *);
+ int (FASTCALL *isNmstrt3)(const ENCODING *, const char *);
+ int (FASTCALL *isNmstrt4)(const ENCODING *, const char *);
+ int (FASTCALL *isInvalid2)(const ENCODING *, const char *);
+ int (FASTCALL *isInvalid3)(const ENCODING *, const char *);
+ int (FASTCALL *isInvalid4)(const ENCODING *, const char *);
};
#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *) (enc))
E ## isInvalid3, \
E ## isInvalid4
-static int checkCharRefNumber(int);
+static int FASTCALL checkCharRefNumber(int);
#include "xmltok_impl.h"
#include "ascii.h"
(((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
#ifdef XML_MIN_SIZE
-static int
+static int FASTCALL
sb_byteType(const ENCODING *enc, const char *p)
{
return SB_BYTE_TYPE(enc, p);
#ifdef XML_MIN_SIZE
#define BYTE_TO_ASCII(enc, p) \
(AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p))
-static int
+static int FASTCALL
sb_byteToAscii(const ENCODING *enc, const char *p)
{
return *p;
#ifdef XML_MIN_SIZE
#define CHAR_MATCHES(enc, p, c) \
(AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c))
-static int
+static int FASTCALL
sb_charMatches(const ENCODING *enc, const char *p, int c)
{
return *p == c;
UTF8_cval4 = 0xf0
};
-static void
+static void FASTCALL
utf8_toUtf8(const ENCODING *enc,
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
*toP = to;
}
-static void
+static void FASTCALL
utf8_toUtf16(const ENCODING *enc,
const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim)
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
};
-static void
+static void FASTCALL
latin1_toUtf8(const ENCODING *enc,
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
}
}
-static void
+static void FASTCALL
latin1_toUtf16(const ENCODING *enc,
const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim)
STANDARD_VTABLE(sb_)
};
-static void
+static void FASTCALL
ascii_toUtf8(const ENCODING *enc,
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
STANDARD_VTABLE(sb_)
};
-static int
+static int FASTCALL
unicode_byte_type(char hi, char lo)
{
switch ((unsigned char)hi) {
}
#define DEFINE_UTF16_TO_UTF8(E) \
-static void \
+static void FASTCALL \
E ## toUtf8(const ENCODING *enc, \
const char **fromP, const char *fromLim, \
char **toP, const char *toLim) \
}
#define DEFINE_UTF16_TO_UTF16(E) \
-static void \
+static void FASTCALL \
E ## toUtf16(const ENCODING *enc, \
const char **fromP, const char *fromLim, \
unsigned short **toP, const unsigned short *toLim) \
#ifdef XML_MIN_SIZE
-static int
+static int FASTCALL
little2_byteType(const ENCODING *enc, const char *p)
{
return LITTLE2_BYTE_TYPE(enc, p);
}
-static int
+static int FASTCALL
little2_byteToAscii(const ENCODING *enc, const char *p)
{
return LITTLE2_BYTE_TO_ASCII(enc, p);
}
-static int
+static int FASTCALL
little2_charMatches(const ENCODING *enc, const char *p, int c)
{
return LITTLE2_CHAR_MATCHES(enc, p, c);
}
-static int
+static int FASTCALL
little2_isNameMin(const ENCODING *enc, const char *p)
{
return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p);
}
-static int
+static int FASTCALL
little2_isNmstrtMin(const ENCODING *enc, const char *p)
{
return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p);
#ifdef XML_MIN_SIZE
-static int
+static int FASTCALL
big2_byteType(const ENCODING *enc, const char *p)
{
return BIG2_BYTE_TYPE(enc, p);
}
-static int
+static int FASTCALL
big2_byteToAscii(const ENCODING *enc, const char *p)
{
return BIG2_BYTE_TO_ASCII(enc, p);
}
-static int
+static int FASTCALL
big2_charMatches(const ENCODING *enc, const char *p, int c)
{
return BIG2_CHAR_MATCHES(enc, p, c);
}
-static int
+static int FASTCALL
big2_isNameMin(const ENCODING *enc, const char *p)
{
return BIG2_IS_NAME_CHAR_MINBPC(enc, p);
}
-static int
+static int FASTCALL
big2_isNmstrtMin(const ENCODING *enc, const char *p)
{
return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p);
#undef PREFIX
-static int
+static int FASTCALL
streqci(const char *s1, const char *s2)
{
for (;;) {
return 1;
}
-static void
+static void FASTCALL
initUpdatePosition(const ENCODING *enc, const char *ptr,
const char *end, POSITION *pos)
{
normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);
}
-static int
+static int FASTCALL
toAscii(const ENCODING *enc, const char *ptr, const char *end)
{
char buf[1];
return buf[0];
}
-static int
+static int FASTCALL
isSpace(int c)
{
switch (c) {
/* Return 1 if there's just optional white space or there's an S
followed by name=val.
*/
-static int
+static int FASTCALL
parsePseudoAttribute(const ENCODING *enc,
const char *ptr,
const char *end,
return 1;
}
-static int
+static int FASTCALL
checkCharRefNumber(int result)
{
switch (result >> 8) {
return sizeof(struct unknown_encoding);
}
-static int
+static int FASTCALL
unknown_isName(const ENCODING *enc, const char *p)
{
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF);
}
-static int
+static int FASTCALL
unknown_isNmstrt(const ENCODING *enc, const char *p)
{
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF);
}
-static int
+static int FASTCALL
unknown_isInvalid(const ENCODING *enc, const char *p)
{
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
return (c & ~0xFFFF) || checkCharRefNumber(c) < 0;
}
-static void
+static void FASTCALL
unknown_toUtf8(const ENCODING *enc,
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
}
}
-static void
+static void FASTCALL
unknown_toUtf16(const ENCODING *enc,
const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim)
'\0'
};
-static int
+static int FASTCALL
getEncodingIndex(const char *name)
{
static const char *encodingNames[] = {
*/
-static int
+static int FASTCALL
initScan(const ENCODING **encodingTable,
const INIT_ENCODING *enc,
int state,
struct encoding;
typedef struct encoding ENCODING;
-struct encoding {
- int (*scanners[XML_N_STATES])(const ENCODING *,
+typedef int (FASTCALL *SCANNER)(const ENCODING *,
const char *,
const char *,
const char **);
- int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *,
- const char *,
- const char *,
- const char **);
- int (*sameName)(const ENCODING *,
- const char *, const char *);
- int (*nameMatchesAscii)(const ENCODING *,
- const char *, const char *, const char *);
- int (*nameLength)(const ENCODING *, const char *);
- const char *(*skipS)(const ENCODING *, const char *);
- int (*getAtts)(const ENCODING *enc, const char *ptr,
- int attsMax, ATTRIBUTE *atts);
- int (*charRefNumber)(const ENCODING *enc, const char *ptr);
- int (*predefinedEntityName)(const ENCODING *, const char *, const char *);
- void (*updatePosition)(const ENCODING *,
- const char *ptr,
- const char *end,
- POSITION *);
- int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
- const char **badPtr);
- void (*utf8Convert)(const ENCODING *enc,
- const char **fromP,
- const char *fromLim,
- char **toP,
- const char *toLim);
- void (*utf16Convert)(const ENCODING *enc,
- const char **fromP,
- const char *fromLim,
- unsigned short **toP,
- const unsigned short *toLim);
+
+struct encoding {
+ SCANNER scanners[XML_N_STATES];
+ SCANNER literalScanners[XML_N_LITERAL_TYPES];
+ int (FASTCALL *sameName)(const ENCODING *,
+ const char *,
+ const char *);
+ int (FASTCALL *nameMatchesAscii)(const ENCODING *,
+ const char *,
+ const char *,
+ const char *);
+ int (FASTCALL *nameLength)(const ENCODING *, const char *);
+ const char *(FASTCALL *skipS)(const ENCODING *, const char *);
+ int (FASTCALL *getAtts)(const ENCODING *enc,
+ const char *ptr,
+ int attsMax,
+ ATTRIBUTE *atts);
+ int (FASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);
+ int (FASTCALL *predefinedEntityName)(const ENCODING *,
+ const char *,
+ const char *);
+ void (FASTCALL *updatePosition)(const ENCODING *,
+ const char *ptr,
+ const char *end,
+ POSITION *);
+ int (FASTCALL *isPublicId)(const ENCODING *enc,
+ const char *ptr,
+ const char *end,
+ const char **badPtr);
+ void (FASTCALL *utf8Convert)(const ENCODING *enc,
+ const char **fromP,
+ const char *fromLim,
+ char **toP,
+ const char *toLim);
+ void (FASTCALL *utf16Convert)(const ENCODING *enc,
+ const char **fromP,
+ const char *fromLim,
+ unsigned short **toP,
+ const unsigned short *toLim);
int minBytesPerChar;
char isUtf8;
char isUtf16;
/* ptr points to character following "<!-" */
-static int
+static int FASTCALL
PREFIX(scanComment)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
/* ptr points to character following "<!" */
-static int
+static int FASTCALL
PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
return XML_TOK_PARTIAL;
}
-static int
+static int FASTCALL
PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr,
const char *end, int *tokPtr)
{
/* ptr points to character following "<?" */
-static int
+static int FASTCALL
PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
return XML_TOK_PARTIAL;
}
-static int
+static int FASTCALL
PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
return XML_TOK_CDATA_SECT_OPEN;
}
-static int
+static int FASTCALL
PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
/* ptr points to character following "</" */
-static int
+static int FASTCALL
PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
/* ptr points to character following "&#X" */
-static int
+static int FASTCALL
PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
/* ptr points to character following "&#" */
-static int
+static int FASTCALL
PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
/* ptr points to character following "&" */
-static int
+static int FASTCALL
PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
/* ptr points to character following first character of attribute name */
-static int
+static int FASTCALL
PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
/* ptr points to character following "<" */
-static int
+static int FASTCALL
PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
return XML_TOK_PARTIAL;
}
-static int
+static int FASTCALL
PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
/* ptr points to character following "%" */
-static int
+static int FASTCALL
PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
return XML_TOK_PARTIAL;
}
-static int
+static int FASTCALL
PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
return -XML_TOK_POUND_NAME;
}
-static int
+static int FASTCALL
PREFIX(scanLit)(int open, const ENCODING *enc,
const char *ptr, const char *end,
const char **nextTokPtr)
return XML_TOK_PARTIAL;
}
-static int
+static int FASTCALL
PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
return -tok;
}
-static int
+static int FASTCALL
PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
return XML_TOK_DATA_CHARS;
}
-static int
+static int FASTCALL
PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
#ifdef XML_DTD
-static int
+static int FASTCALL
PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
#endif /* XML_DTD */
-static int
+static int FASTCALL
PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
const char **badPtr)
{
first attsMax attributes are stored in atts.
*/
-static int
+static int FASTCALL
PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
int attsMax, ATTRIBUTE *atts)
{
/* not reached */
}
-static int
+static int FASTCALL
PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
{
int result = 0;
return checkCharRefNumber(result);
}
-static int
+static int FASTCALL
PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr,
const char *end)
{
return 0;
}
-static int
+static int FASTCALL
PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
{
for (;;) {
/* not reached */
}
-static int
+static int FASTCALL
PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
const char *end1, const char *ptr2)
{
return ptr1 == end1;
}
-static int
+static int FASTCALL
PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
{
const char *start = ptr;
}
}
-static const char *
+static const char * FASTCALL
PREFIX(skipS)(const ENCODING *enc, const char *ptr)
{
for (;;) {
}
}
-static void
+static void FASTCALL
PREFIX(updatePosition)(const ENCODING *enc,
const char *ptr,
const char *end,