From: Karl Waclawek Date: Thu, 5 Sep 2002 18:21:01 +0000 (+0000) Subject: Fred and I added FASTCALL directives to xmltok.c and related files. X-Git-Tag: R_1_95_5~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=633caf8040b7ba64bb754ce05649f03b88199e22;p=libexpat Fred and I added FASTCALL directives to xmltok.c and related files. --- diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c index 37b12880..ab877fef 100644 --- a/expat/lib/xmlparse.c +++ b/expat/lib/xmlparse.c @@ -94,8 +94,8 @@ typedef char ICHAR; #endif /* HAVE_BCOPY */ #endif /* HAVE_MEMMOVE */ -#include "xmltok.h" #include "internal.h" +#include "xmltok.h" #include "xmlrole.h" typedef const XML_Char *KEY; @@ -899,7 +899,7 @@ XML_ExternalEntityParserCreate(XML_Parser oldParser, int oldParamEntityParsing = paramEntityParsing; int oldInEntityValue = prologState.inEntityValue; #endif - int oldns_triplets = ns_triplets; + XML_Bool oldns_triplets = ns_triplets; /* Note that the magical uses of the pre-processor to make field access look more like C++ require that `parser' be overwritten diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c index 0e9a18a2..4b887228 100644 --- a/expat/lib/xmltok.c +++ b/expat/lib/xmltok.c @@ -10,6 +10,7 @@ #include #endif /* ndef COMPILED_FROM_DSP */ +#include "internal.h" #include "xmltok.h" #include "nametab.h" @@ -111,19 +112,19 @@ || \ ((*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); @@ -131,13 +132,13 @@ utf8_isName3(const ENCODING *enc, const 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); @@ -145,19 +146,19 @@ utf8_isNmstrt3(const ENCODING *enc, const 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); @@ -167,21 +168,21 @@ struct normal_encoding { 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)) @@ -212,7 +213,7 @@ struct normal_encoding { E ## isInvalid3, \ E ## isInvalid4 -static int checkCharRefNumber(int); +static int FASTCALL checkCharRefNumber(int); #include "xmltok_impl.h" #include "ascii.h" @@ -233,7 +234,7 @@ static int checkCharRefNumber(int); (((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); @@ -247,7 +248,7 @@ sb_byteType(const ENCODING *enc, const char *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; @@ -276,7 +277,7 @@ sb_byteToAscii(const ENCODING *enc, const char *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; @@ -306,7 +307,7 @@ enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ UTF8_cval4 = 0xf0 }; -static void +static void FASTCALL utf8_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) @@ -325,7 +326,7 @@ utf8_toUtf8(const ENCODING *enc, *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) @@ -413,7 +414,7 @@ static const struct normal_encoding internal_utf8_encoding = { 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) @@ -438,7 +439,7 @@ latin1_toUtf8(const ENCODING *enc, } } -static void +static void FASTCALL latin1_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) @@ -471,7 +472,7 @@ static const struct normal_encoding latin1_encoding = { STANDARD_VTABLE(sb_) }; -static void +static void FASTCALL ascii_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) @@ -504,7 +505,7 @@ static const struct normal_encoding ascii_encoding = { STANDARD_VTABLE(sb_) }; -static int +static int FASTCALL unicode_byte_type(char hi, char lo) { switch ((unsigned char)hi) { @@ -524,7 +525,7 @@ unicode_byte_type(char hi, char lo) } #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) \ @@ -587,7 +588,7 @@ E ## toUtf8(const ENCODING *enc, \ } #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) \ @@ -637,31 +638,31 @@ DEFINE_UTF16_TO_UTF16(big2_) #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); @@ -776,31 +777,31 @@ static const struct normal_encoding internal_little2_encoding = { #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); @@ -903,7 +904,7 @@ static const struct normal_encoding internal_big2_encoding = { #undef PREFIX -static int +static int FASTCALL streqci(const char *s1, const char *s2) { for (;;) { @@ -921,14 +922,14 @@ streqci(const char *s1, const char *s2) 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]; @@ -940,7 +941,7 @@ toAscii(const ENCODING *enc, const char *ptr, const char *end) return buf[0]; } -static int +static int FASTCALL isSpace(int c) { switch (c) { @@ -956,7 +957,7 @@ isSpace(int 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, @@ -1154,7 +1155,7 @@ doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, return 1; } -static int +static int FASTCALL checkCharRefNumber(int result) { switch (result >> 8) { @@ -1244,7 +1245,7 @@ XmlSizeOfUnknownEncoding(void) 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); @@ -1254,7 +1255,7 @@ unknown_isName(const ENCODING *enc, const char *p) 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); @@ -1264,7 +1265,7 @@ unknown_isNmstrt(const ENCODING *enc, const char *p) 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); @@ -1272,7 +1273,7 @@ unknown_isInvalid(const ENCODING *enc, const char *p) 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) @@ -1306,7 +1307,7 @@ unknown_toUtf8(const ENCODING *enc, } } -static void +static void FASTCALL unknown_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) @@ -1442,7 +1443,7 @@ static const char KW_UTF_16LE[] = { '\0' }; -static int +static int FASTCALL getEncodingIndex(const char *name) { static const char *encodingNames[] = { @@ -1477,7 +1478,7 @@ getEncodingIndex(const char *name) */ -static int +static int FASTCALL initScan(const ENCODING **encodingTable, const INIT_ENCODING *enc, int state, diff --git a/expat/lib/xmltok.h b/expat/lib/xmltok.h index 6f94dec6..55cc181e 100644 --- a/expat/lib/xmltok.h +++ b/expat/lib/xmltok.h @@ -125,41 +125,49 @@ typedef struct { 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; diff --git a/expat/lib/xmltok_impl.c b/expat/lib/xmltok_impl.c index f4a34387..be3d1d31 100644 --- a/expat/lib/xmltok_impl.c +++ b/expat/lib/xmltok_impl.c @@ -86,7 +86,7 @@ /* ptr points to character following "