xmltok.cc File Reference

#include <stddef.h>
#include "expat_external.h"
#include "internal.h"
#include "xmltok.h"
#include "nametab.h"
#include "xmltok_impl.h"
#include "ascii.h"
#include "xmltok_impl.c"
#include "asciitab.h"
#include "utf8tab.h"
#include "iasciitab.h"
#include "latin1tab.h"
#include "xmltok_ns.c"

Go to the source code of this file.

Data Structures

struct  normal_encoding
struct  unknown_encoding

Defines

#define IGNORE_SECTION_TOK_VTABLE
#define VTABLE1
#define VTABLE   VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16)
#define UCS2_GET_NAMING(pages, hi, lo)   (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
#define UTF8_GET_NAMING2(pages, byte)
#define UTF8_GET_NAMING3(pages, byte)
#define UTF8_GET_NAMING(pages, p, n)
#define UTF8_INVALID2(p)   ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0)
#define UTF8_INVALID3(p)
#define UTF8_INVALID4(p)
#define utf8_isName4   isNever
#define utf8_isNmstrt4   isNever
#define AS_NORMAL_ENCODING(enc)   ((const struct normal_encoding *) (enc))
#define STANDARD_VTABLE(E)
#define NORMAL_VTABLE(E)
#define MINBPC(enc)   1
#define SB_BYTE_TYPE(enc, p)   (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
#define BYTE_TYPE(enc, p)   SB_BYTE_TYPE(enc, p)
#define BYTE_TO_ASCII(enc, p)   (*(p))
#define IS_NAME_CHAR(enc, p, n)   (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p))
#define IS_NMSTRT_CHAR(enc, p, n)   (AS_NORMAL_ENCODING(enc)->isNmstrt ## n(enc, p))
#define IS_INVALID_CHAR(enc, p, n)   (AS_NORMAL_ENCODING(enc)->isInvalid ## n(enc, p))
#define IS_NAME_CHAR_MINBPC(enc, p)   (0)
#define IS_NMSTRT_CHAR_MINBPC(enc, p)   (0)
#define CHAR_MATCHES(enc, p, c)   (*(p) == c)
#define PREFIX(ident)   normal_ ## ident
#define XML_TOK_IMPL_C
#define BT_COLON   BT_NMSTRT
#define BT_COLON   BT_NMSTRT
#define BT_COLON   BT_NMSTRT
#define BT_COLON   BT_NMSTRT
#define DEFINE_UTF16_TO_UTF8(E)
#define DEFINE_UTF16_TO_UTF16(E)
#define SET2(ptr, ch)   (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8)))
#define GET_LO(ptr)   ((unsigned char)(ptr)[0])
#define GET_HI(ptr)   ((unsigned char)(ptr)[1])
#define SET2(ptr, ch)   (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF)))
#define GET_LO(ptr)   ((unsigned char)(ptr)[1])
#define GET_HI(ptr)   ((unsigned char)(ptr)[0])
#define LITTLE2_BYTE_TYPE(enc, p)
#define LITTLE2_BYTE_TO_ASCII(enc, p)   ((p)[1] == 0 ? (p)[0] : -1)
#define LITTLE2_CHAR_MATCHES(enc, p, c)   ((p)[1] == 0 && (p)[0] == c)
#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p)   UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p)   UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0])
#define PREFIX(ident)   little2_ ## ident
#define MINBPC(enc)   2
#define BYTE_TYPE(enc, p)   LITTLE2_BYTE_TYPE(enc, p)
#define BYTE_TO_ASCII(enc, p)   LITTLE2_BYTE_TO_ASCII(enc, p)
#define CHAR_MATCHES(enc, p, c)   LITTLE2_CHAR_MATCHES(enc, p, c)
#define IS_NAME_CHAR(enc, p, n)   0
#define IS_NAME_CHAR_MINBPC(enc, p)   LITTLE2_IS_NAME_CHAR_MINBPC(enc, p)
#define IS_NMSTRT_CHAR(enc, p, n)   (0)
#define IS_NMSTRT_CHAR_MINBPC(enc, p)   LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p)
#define XML_TOK_IMPL_C
#define BT_COLON   BT_NMSTRT
#define BT_COLON   BT_NMSTRT
#define BIG2_BYTE_TYPE(enc, p)
#define BIG2_BYTE_TO_ASCII(enc, p)   ((p)[0] == 0 ? (p)[1] : -1)
#define BIG2_CHAR_MATCHES(enc, p, c)   ((p)[0] == 0 && (p)[1] == c)
#define BIG2_IS_NAME_CHAR_MINBPC(enc, p)   UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p)   UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1])
#define PREFIX(ident)   big2_ ## ident
#define MINBPC(enc)   2
#define BYTE_TYPE(enc, p)   BIG2_BYTE_TYPE(enc, p)
#define BYTE_TO_ASCII(enc, p)   BIG2_BYTE_TO_ASCII(enc, p)
#define CHAR_MATCHES(enc, p, c)   BIG2_CHAR_MATCHES(enc, p, c)
#define IS_NAME_CHAR(enc, p, n)   0
#define IS_NAME_CHAR_MINBPC(enc, p)   BIG2_IS_NAME_CHAR_MINBPC(enc, p)
#define IS_NMSTRT_CHAR(enc, p, n)   (0)
#define IS_NMSTRT_CHAR_MINBPC(enc, p)   BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p)
#define XML_TOK_IMPL_C
#define BT_COLON   BT_NMSTRT
#define BT_COLON   BT_NMSTRT
#define AS_UNKNOWN_ENCODING(enc)   ((const struct unknown_encoding *) (enc))
#define INIT_ENC_INDEX(enc)   ((int)(enc)->initEnc.isUtf16)
#define SET_INIT_ENC_INDEX(enc, i)   ((enc)->initEnc.isUtf16 = (char)i)
#define NS(x)   x
#define ns(x)   x
#define XML_TOK_NS_C

Enumerations

enum  { UTF8_cval1 = 0x00, UTF8_cval2 = 0xc0, UTF8_cval3 = 0xe0, UTF8_cval4 = 0xf0 }
enum  {
  UNKNOWN_ENC = -1, ISO_8859_1_ENC = 0, US_ASCII_ENC, UTF_8_ENC,
  UTF_16_ENC, UTF_16BE_ENC, UTF_16LE_ENC, NO_ENC
}

Functions

int FASTCALL XmlUtf8Encode (int c, char *buf)
int FASTCALL XmlUtf16Encode (int charNum, unsigned short *buf)
int XmlSizeOfUnknownEncoding (void)
ENCODING * XmlInitUnknownEncoding (void *mem, int *table, CONVERTER convert, void *userData)


Define Documentation

#define AS_NORMAL_ENCODING ( enc   )     ((const struct normal_encoding *) (enc))

Definition at line 197 of file xmltok.cc.

#define AS_UNKNOWN_ENCODING ( enc   )     ((const struct unknown_encoding *) (enc))

Definition at line 1404 of file xmltok.cc.

#define BIG2_BYTE_TO_ASCII ( enc,
 )     ((p)[0] == 0 ? (p)[1] : -1)

Definition at line 933 of file xmltok.cc.

#define BIG2_BYTE_TYPE ( enc,
 ) 

Value:

((p)[0] == 0 \
  ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \
  : unicode_byte_type((p)[0], (p)[1]))

Definition at line 929 of file xmltok.cc.

#define BIG2_CHAR_MATCHES ( enc,
p,
 )     ((p)[0] == 0 && (p)[1] == c)

Definition at line 934 of file xmltok.cc.

#define BIG2_IS_NAME_CHAR_MINBPC ( enc,
 )     UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])

Definition at line 935 of file xmltok.cc.

#define BIG2_IS_NMSTRT_CHAR_MINBPC ( enc,
 )     UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1])

Definition at line 937 of file xmltok.cc.

#define BT_COLON   BT_NMSTRT

#define BT_COLON   BT_NMSTRT

#define BT_COLON   BT_NMSTRT

#define BT_COLON   BT_NMSTRT

#define BT_COLON   BT_NMSTRT

#define BT_COLON   BT_NMSTRT

#define BT_COLON   BT_NMSTRT

#define BT_COLON   BT_NMSTRT

#define BYTE_TO_ASCII ( enc,
 )     BIG2_BYTE_TO_ASCII(enc, p)

Definition at line 982 of file xmltok.cc.

#define BYTE_TO_ASCII ( enc,
 )     LITTLE2_BYTE_TO_ASCII(enc, p)

Definition at line 982 of file xmltok.cc.

#define BYTE_TO_ASCII ( enc,
 )     (*(p))

Definition at line 982 of file xmltok.cc.

#define BYTE_TYPE ( enc,
 )     BIG2_BYTE_TYPE(enc, p)

Definition at line 981 of file xmltok.cc.

#define BYTE_TYPE ( enc,
 )     LITTLE2_BYTE_TYPE(enc, p)

Definition at line 981 of file xmltok.cc.

#define BYTE_TYPE ( enc,
 )     SB_BYTE_TYPE(enc, p)

Definition at line 981 of file xmltok.cc.

#define CHAR_MATCHES ( enc,
p,
 )     BIG2_CHAR_MATCHES(enc, p, c)

Definition at line 983 of file xmltok.cc.

#define CHAR_MATCHES ( enc,
p,
 )     LITTLE2_CHAR_MATCHES(enc, p, c)

Definition at line 983 of file xmltok.cc.

#define CHAR_MATCHES ( enc,
p,
 )     (*(p) == c)

Definition at line 983 of file xmltok.cc.

#define DEFINE_UTF16_TO_UTF16 (  ) 

Value:

static void  PTRCALL \
E ## toUtf16(const ENCODING *enc, \
             const char **fromP, const char *fromLim, \
             unsigned short **toP, const unsigned short *toLim) \
{ \
  /* Avoid copying first half only of surrogate */ \
  if (fromLim - *fromP > ((toLim - *toP) << 1) \
      && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \
    fromLim -= 2; \
  for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \
    *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \
}

Definition at line 863 of file xmltok.cc.

#define DEFINE_UTF16_TO_UTF8 (  ) 

Definition at line 800 of file xmltok.cc.

#define GET_HI ( ptr   )     ((unsigned char)(ptr)[0])

Definition at line 892 of file xmltok.cc.

#define GET_HI ( ptr   )     ((unsigned char)(ptr)[1])

Definition at line 892 of file xmltok.cc.

#define GET_LO ( ptr   )     ((unsigned char)(ptr)[1])

Definition at line 891 of file xmltok.cc.

#define GET_LO ( ptr   )     ((unsigned char)(ptr)[0])

Definition at line 891 of file xmltok.cc.

#define IGNORE_SECTION_TOK_VTABLE

Definition at line 29 of file xmltok.cc.

#define INIT_ENC_INDEX ( enc   )     ((int)(enc)->initEnc.isUtf16)

Definition at line 1634 of file xmltok.cc.

Referenced by XmlInitUnknownEncoding().

#define IS_INVALID_CHAR ( enc,
p,
n   )     (AS_NORMAL_ENCODING(enc)->isInvalid ## n(enc, p))

Definition at line 273 of file xmltok.cc.

#define IS_NAME_CHAR ( enc,
p,
n   )     0

Definition at line 984 of file xmltok.cc.

#define IS_NAME_CHAR ( enc,
p,
n   )     0

Definition at line 984 of file xmltok.cc.

#define IS_NAME_CHAR ( enc,
p,
n   )     (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p))

Definition at line 984 of file xmltok.cc.

#define IS_NAME_CHAR_MINBPC ( enc,
 )     BIG2_IS_NAME_CHAR_MINBPC(enc, p)

Definition at line 985 of file xmltok.cc.

#define IS_NAME_CHAR_MINBPC ( enc,
 )     LITTLE2_IS_NAME_CHAR_MINBPC(enc, p)

Definition at line 985 of file xmltok.cc.

#define IS_NAME_CHAR_MINBPC ( enc,
 )     (0)

Definition at line 985 of file xmltok.cc.

#define IS_NMSTRT_CHAR ( enc,
p,
n   )     (0)

Definition at line 986 of file xmltok.cc.

#define IS_NMSTRT_CHAR ( enc,
p,
n   )     (0)

Definition at line 986 of file xmltok.cc.

#define IS_NMSTRT_CHAR ( enc,
p,
n   )     (AS_NORMAL_ENCODING(enc)->isNmstrt ## n(enc, p))

Definition at line 986 of file xmltok.cc.

#define IS_NMSTRT_CHAR_MINBPC ( enc,
 )     BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p)

Definition at line 987 of file xmltok.cc.

#define IS_NMSTRT_CHAR_MINBPC ( enc,
 )     LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p)

Definition at line 987 of file xmltok.cc.

#define IS_NMSTRT_CHAR_MINBPC ( enc,
 )     (0)

Definition at line 987 of file xmltok.cc.

#define LITTLE2_BYTE_TO_ASCII ( enc,
 )     ((p)[1] == 0 ? (p)[0] : -1)

Definition at line 905 of file xmltok.cc.

#define LITTLE2_BYTE_TYPE ( enc,
 ) 

Value:

((p)[1] == 0 \
  ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \
  : unicode_byte_type((p)[1], (p)[0]))

Definition at line 901 of file xmltok.cc.

#define LITTLE2_CHAR_MATCHES ( enc,
p,
 )     ((p)[1] == 0 && (p)[0] == c)

Definition at line 906 of file xmltok.cc.

#define LITTLE2_IS_NAME_CHAR_MINBPC ( enc,
 )     UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])

Definition at line 907 of file xmltok.cc.

#define LITTLE2_IS_NMSTRT_CHAR_MINBPC ( enc,
 )     UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0])

Definition at line 909 of file xmltok.cc.

#define MINBPC ( enc   )     2

Definition at line 979 of file xmltok.cc.

#define MINBPC ( enc   )     2

Definition at line 979 of file xmltok.cc.

#define MINBPC ( enc   )     1

Definition at line 979 of file xmltok.cc.

#define NORMAL_VTABLE (  ) 

Value:

E ## isName2, \
 E ## isName3, \
 E ## isName4, \
 E ## isNmstrt2, \
 E ## isNmstrt3, \
 E ## isNmstrt4, \
 E ## isInvalid2, \
 E ## isInvalid3, \
 E ## isInvalid4

Definition at line 214 of file xmltok.cc.

#define ns (  )     x

Definition at line 1769 of file xmltok.cc.

#define NS (  )     x

Definition at line 1768 of file xmltok.cc.

#define PREFIX ( ident   )     big2_ ## ident

Definition at line 978 of file xmltok.cc.

#define PREFIX ( ident   )     little2_ ## ident

Definition at line 978 of file xmltok.cc.

#define PREFIX ( ident   )     normal_ ## ident

Definition at line 978 of file xmltok.cc.

#define SB_BYTE_TYPE ( enc,
 )     (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])

Definition at line 242 of file xmltok.cc.

#define SET2 ( ptr,
ch   )     (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF)))

Definition at line 889 of file xmltok.cc.

#define SET2 ( ptr,
ch   )     (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8)))

Definition at line 889 of file xmltok.cc.

#define SET_INIT_ENC_INDEX ( enc,
 )     ((enc)->initEnc.isUtf16 = (char)i)

Definition at line 1635 of file xmltok.cc.

#define STANDARD_VTABLE (  ) 

Definition at line 210 of file xmltok.cc.

#define UCS2_GET_NAMING ( pages,
hi,
lo   )     (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))

Definition at line 48 of file xmltok.cc.

#define UTF8_GET_NAMING ( pages,
p,
n   ) 

Value:

((n) == 2 \
  ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \
  : ((n) == 3 \
     ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \
     : 0))

Definition at line 74 of file xmltok.cc.

#define UTF8_GET_NAMING2 ( pages,
byte   ) 

Value:

(namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \
                      + ((((byte)[0]) & 3) << 1) \
                      + ((((byte)[1]) >> 5) & 1)] \
         & (1 << (((byte)[1]) & 0x1F)))

Definition at line 55 of file xmltok.cc.

#define UTF8_GET_NAMING3 ( pages,
byte   ) 

Value:

(namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \
                             + ((((byte)[1]) >> 2) & 0xF)] \
                       << 3) \
                      + ((((byte)[1]) & 3) << 1) \
                      + ((((byte)[2]) >> 5) & 1)] \
         & (1 << (((byte)[2]) & 0x1F)))

Definition at line 66 of file xmltok.cc.

#define UTF8_INVALID2 (  )     ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0)

Definition at line 91 of file xmltok.cc.

#define UTF8_INVALID3 (  ) 

Value:

(((p)[2] & 0x80) == 0 \
  || \
  ((*p) == 0xEF && (p)[1] == 0xBF \
    ? \
    (p)[2] > 0xBD \
    : \
    ((p)[2] & 0xC0) == 0xC0) \
  || \
  ((*p) == 0xE0 \
    ? \
    (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \
    : \
    ((p)[1] & 0x80) == 0 \
    || \
    ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0)))

Definition at line 94 of file xmltok.cc.

#define UTF8_INVALID4 (  ) 

Value:

(((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 \
  || \
  ((p)[2] & 0x80) == 0 || ((p)[2] & 0xC0) == 0xC0 \
  || \
  ((*p) == 0xF0 \
    ? \
    (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \
    : \
    ((p)[1] & 0x80) == 0 \
    || \
    ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0)))

Definition at line 111 of file xmltok.cc.

#define utf8_isName4   isNever

Definition at line 142 of file xmltok.cc.

#define utf8_isNmstrt4   isNever

Definition at line 156 of file xmltok.cc.

#define VTABLE   VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16)

Definition at line 46 of file xmltok.cc.

#define VTABLE1

Value:

{ PREFIX(prologTok), PREFIX(contentTok), \
    PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \
  { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \
  PREFIX(sameName), \
  PREFIX(nameMatchesAscii), \
  PREFIX(nameLength), \
  PREFIX(skipS), \
  PREFIX(getAtts), \
  PREFIX(charRefNumber), \
  PREFIX(predefinedEntityName), \
  PREFIX(updatePosition), \
  PREFIX(isPublicId)

Definition at line 32 of file xmltok.cc.

#define XML_TOK_IMPL_C

Definition at line 989 of file xmltok.cc.

#define XML_TOK_IMPL_C

Definition at line 989 of file xmltok.cc.

#define XML_TOK_IMPL_C

Definition at line 989 of file xmltok.cc.

#define XML_TOK_NS_C

Definition at line 1770 of file xmltok.cc.


Enumeration Type Documentation

anonymous enum

Enumerator:
UTF8_cval1 
UTF8_cval2 
UTF8_cval3 
UTF8_cval4 

Definition at line 314 of file xmltok.cc.

00314      {  /* UTF8_cvalN is value of masked first byte of N byte sequence */
00315   UTF8_cval1 = 0x00,
00316   UTF8_cval2 = 0xc0,
00317   UTF8_cval3 = 0xe0,
00318   UTF8_cval4 = 0xf0
00319 };

anonymous enum

Enumerator:
UNKNOWN_ENC 
ISO_8859_1_ENC 
US_ASCII_ENC 
UTF_8_ENC 
UTF_16_ENC 
UTF_16BE_ENC 
UTF_16LE_ENC 
NO_ENC 

Definition at line 1575 of file xmltok.cc.

01577                                          {
01578         *nextTokPtr = ptr + 3;
01579         *encPtr = encodingTable[UTF_8_ENC];
01580         return XML_TOK_BOM;
01581       }
01582       break;
01583     default:
01584       if (ptr[0] == '\0') {
01585         /* 0 isn't a legal data character. Furthermore a document


Function Documentation

ENCODING* XmlInitUnknownEncoding ( void *  mem,
int *  table,
CONVERTER  convert,
void *  userData 
)

Definition at line 1495 of file xmltok.cc.

References INIT_ENC_INDEX, ISO_8859_1_ENC, UTF_16_ENC, UTF_16BE_ENC, UTF_16LE_ENC, and UTF_8_ENC.

01503 {
01504   const ENCODING **encPtr;
01505 
01506   if (ptr == end)
01507     return XML_TOK_NONE;
01508   encPtr = enc->encPtr;
01509   if (ptr + 1 == end) {
01510     /* only a single byte available for auto-detection */
01511 #ifndef XML_DTD /* FIXME */
01512     /* a well-formed document entity must have more than one byte */
01513     if (state != XML_CONTENT_STATE)
01514       return XML_TOK_PARTIAL;
01515 #endif
01516     /* so we're parsing an external text entity... */
01517     /* if UTF-16 was externally specified, then we need at least 2 bytes */
01518     switch (INIT_ENC_INDEX(enc)) {
01519     case UTF_16_ENC:
01520     case UTF_16LE_ENC:
01521     case UTF_16BE_ENC:
01522       return XML_TOK_PARTIAL;
01523     }
01524     switch ((unsigned char)*ptr) {
01525     case 0xFE:
01526     case 0xFF:
01527     case 0xEF: /* possibly first byte of UTF-8 BOM */
01528       if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
01529           && state == XML_CONTENT_STATE)
01530         break;
01531       /* fall through */
01532     case 0x00:
01533     case 0x3C:
01534       return XML_TOK_PARTIAL;
01535     }
01536   }
01537   else {
01538     switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) {
01539     case 0xFEFF:
01540       if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
01541           && state == XML_CONTENT_STATE)
01542         break;
01543       *nextTokPtr = ptr + 2;
01544       *encPtr = encodingTable[UTF_16BE_ENC];
01545       return XML_TOK_BOM;
01546     /* 00 3C is handled in the default case */
01547     case 0x3C00:
01548       if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC
01549            || INIT_ENC_INDEX(enc) == UTF_16_ENC)
01550           && state == XML_CONTENT_STATE)
01551         break;
01552       *encPtr = encodingTable[UTF_16LE_ENC];
01553       return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
01554     case 0xFFFE:
01555       if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
01556           && state == XML_CONTENT_STATE)
01557         break;
01558       *nextTokPtr = ptr + 2;
01559       *encPtr = encodingTable[UTF_16LE_ENC];
01560       return XML_TOK_BOM;
01561     case 0xEFBB:
01562       /* Maybe a UTF-8 BOM (EF BB BF) */
01563       /* If there's an explicitly specified (external) encoding
01564          of ISO-8859-1 or some flavour of UTF-16
01565          and this is an external text entity,
01566          don't look for the BOM,
01567          because it might be a legal data.
01568       */
01569       if (state == XML_CONTENT_STATE) {
01570         int e = INIT_ENC_INDEX(enc);
01571         if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC

int XmlSizeOfUnknownEncoding ( void   ) 

Definition at line 1407 of file xmltok.cc.

References unknown_encoding::normal.

01408                {
01409     e->normal.isName2 = unknown_isName;
01410     e->normal.isName3 = unknown_isName;

int FASTCALL XmlUtf16Encode ( int  charNum,
unsigned short *  buf 
)

Definition at line 1379 of file xmltok.cc.

01384                                                      : c);
01385     }
01386     else if (checkCharRefNumber(c) < 0) {
01387       e->normal.type[i] = BT_NONXML;
01388       /* This shouldn't really get used. */
01389       e->utf16[i] = 0xFFFF;
01390       e->utf8[i][0] = 1;
01391       e->utf8[i][1] = 0;
01392     }
01393     else {
01394       if (c > 0xFFFF)

int FASTCALL XmlUtf8Encode ( int  c,
char *  buf 
)

Definition at line 1342 of file xmltok.cc.

01350 {
01351   int i;
01352   struct unknown_encoding *e = (struct unknown_encoding *)mem;
01353   for (i = 0; i < (int)sizeof(struct normal_encoding); i++)
01354     ((char *)mem)[i] = ((char *)&latin1_encoding)[i];
01355   for (i = 0; i < 128; i++)
01356     if (latin1_encoding.type[i] != BT_OTHER
01357         && latin1_encoding.type[i] != BT_NONXML
01358         && table[i] != i)
01359       return 0;
01360   for (i = 0; i < 256; i++) {
01361     int c = table[i];
01362     if (c == -1) {
01363       e->normal.type[i] = BT_MALFORM;
01364       /* This shouldn't really get used. */
01365       e->utf16[i] = 0xFFFF;
01366       e->utf8[i][0] = 1;
01367       e->utf8[i][1] = 0;
01368     }
01369     else if (c < 0) {
01370       if (c < -4)
01371         return 0;
01372       e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2));
01373       e->utf8[i][0] = 0;
01374       e->utf16[i] = 0;
01375     }
01376     else if (c < 0x80) {


Generated on Mon May 27 17:51:18 2013 for Geant4 by  doxygen 1.4.7