Lines Matching defs:enc
133 isNever(const ENCODING *enc, const char *p) {
134 UNUSED_P(enc);
140 utf8_isName2(const ENCODING *enc, const char *p) {
141 UNUSED_P(enc);
146 utf8_isName3(const ENCODING *enc, const char *p) {
147 UNUSED_P(enc);
154 utf8_isNmstrt2(const ENCODING *enc, const char *p) {
155 UNUSED_P(enc);
160 utf8_isNmstrt3(const ENCODING *enc, const char *p) {
161 UNUSED_P(enc);
168 utf8_isInvalid2(const ENCODING *enc, const char *p) {
169 UNUSED_P(enc);
174 utf8_isInvalid3(const ENCODING *enc, const char *p) {
175 UNUSED_P(enc);
180 utf8_isInvalid4(const ENCODING *enc, const char *p) {
181 UNUSED_P(enc);
186 ENCODING enc;
206 #define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *)(enc))
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)])
250 sb_byteType(const ENCODING *enc, const char *p) {
251 return SB_BYTE_TYPE(enc, 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))
261 sb_byteToAscii(const ENCODING *enc, const char *p) {
262 UNUSED_P(enc);
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))
294 sb_charMatches(const ENCODING *enc, const char *p, int c) {
295 UNUSED_P(enc);
300 # define CHAR_MATCHES(enc, p, c) (*(p) == (c))
365 utf8_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
373 UNUSED_P(enc);
404 utf8_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,
410 switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) {
502 latin1_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
504 UNUSED_P(enc);
525 latin1_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,
527 UNUSED_P(enc);
560 ascii_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
562 UNUSED_P(enc);
622 const ENCODING *enc, const char **fromP, const char *fromLim, \
625 UNUSED_P(enc); \
699 const ENCODING *enc, const char **fromP, const char *fromLim, \
702 UNUSED_P(enc); \
740 #define LITTLE2_BYTE_TYPE(enc, p) \
741 ((p)[1] == 0 ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \
753 little2_byteType(const ENCODING *enc, const char *p) {
754 return LITTLE2_BYTE_TYPE(enc, p);
758 little2_byteToAscii(const ENCODING *enc, const char *p) {
759 UNUSED_P(enc);
764 little2_charMatches(const ENCODING *enc, const char *p, int c) {
765 UNUSED_P(enc);
770 little2_isNameMin(const ENCODING *enc, const char *p) {
771 UNUSED_P(enc);
776 little2_isNmstrtMin(const ENCODING *enc, const char *p) {
777 UNUSED_P(enc);
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)
874 #define BIG2_BYTE_TYPE(enc, p) \
876 ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \
888 big2_byteType(const ENCODING *enc, const char *p) {
889 return BIG2_BYTE_TYPE(enc, p);
893 big2_byteToAscii(const ENCODING *enc, const char *p) {
894 UNUSED_P(enc);
899 big2_charMatches(const ENCODING *enc, const char *p, int c) {
900 UNUSED_P(enc);
905 big2_isNameMin(const ENCODING *enc, const char *p) {
906 UNUSED_P(enc);
911 big2_isNmstrtMin(const ENCODING *enc, const char *p) {
912 UNUSED_P(enc);
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)
1033 initUpdatePosition(const ENCODING *enc, const char *ptr, const char *end,
1035 UNUSED_P(enc);
1036 normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);
1040 toAscii(const ENCODING *enc, const char *ptr, const char *end) {
1043 XmlUtf8Convert(enc, &ptr, end, &p, p + 1);
1066 parsePseudoAttribute(const ENCODING *enc, const char *ptr, const char *end,
1075 if (! isSpace(toAscii(enc, ptr, end))) {
1080 ptr += enc->minBytesPerChar;
1081 } while (isSpace(toAscii(enc, ptr, end)));
1088 c = toAscii(enc, ptr, end);
1100 ptr += enc->minBytesPerChar;
1101 } while (isSpace(c = toAscii(enc, ptr, end)));
1108 ptr += enc->minBytesPerChar;
1114 ptr += enc->minBytesPerChar;
1115 c = toAscii(enc, ptr, end);
1117 ptr += enc->minBytesPerChar;
1118 c = toAscii(enc, ptr, end);
1125 ptr += enc->minBytesPerChar;
1127 for (;; ptr += enc->minBytesPerChar) {
1128 c = toAscii(enc, ptr, end);
1138 *nextTokPtr = ptr + enc->minBytesPerChar;
1159 int isGeneralTextEntity, const ENCODING *enc, const char *ptr,
1166 ptr += 5 * enc->minBytesPerChar;
1167 end -= 2 * enc->minBytesPerChar;
1168 if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)
1173 if (! XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) {
1183 if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
1196 if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) {
1197 int c = toAscii(enc, val, end);
1205 *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar);
1206 if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
1213 if (! XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone)
1218 if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) {
1221 } else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) {
1228 while (isSpace(toAscii(enc, ptr, end)))
1229 ptr += enc->minBytesPerChar;
1322 #define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *)(enc))
1330 unknown_isName(const ENCODING *enc, const char *p) {
1331 const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
1339 unknown_isNmstrt(const ENCODING *enc, const char *p) {
1340 const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
1348 unknown_isInvalid(const ENCODING *enc, const char *p) {
1349 const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
1355 unknown_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
1357 const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
1372 *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]
1385 unknown_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,
1387 const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
1392 *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]
1472 e->normal.enc.utf8Convert = unknown_toUtf8;
1473 e->normal.enc.utf16Convert = unknown_toUtf16;
1474 return &(e->normal.enc);
1526 #define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16)
1527 #define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i)
1530 encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
1537 initScan(const ENCODING *const *encodingTable, const INIT_ENCODING *enc,
1543 encPtr = enc->encPtr;
1553 switch (INIT_ENC_INDEX(enc)) {
1563 if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE)
1573 if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE)
1580 if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC
1581 || INIT_ENC_INDEX(enc) == UTF_16_ENC)
1587 if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE)
1601 int e = INIT_ENC_INDEX(enc);
1622 if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC)
1644 *encPtr = encodingTable[INIT_ENC_INDEX(enc)];
1671 ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData);
1672 if (enc)
1673 ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON;
1674 return enc;