Geant4  10.01.p03
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"
+ Include dependency graph for xmltok.cc:

Go to the source code of this file.

Classes

struct  normal_encoding
 
struct  unknown_encoding
 

Macros

#define IGNORE_SECTION_TOK_VTABLE   /* as nothing */
 
#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)   /* as nothing */
 
#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

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)
 
static int PTRFASTCALL utf8_isNmstrt2 (const ENCODING *enc, const char *p)
 
static int PTRFASTCALL utf8_isNmstrt3 (const ENCODING *enc, const char *p)
 
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)
 
static int FASTCALL checkCharRefNumber (int)
 
static void PTRCALL utf8_toUtf8 (const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
 
static void PTRCALL utf8_toUtf16 (const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
 
static void PTRCALL latin1_toUtf8 (const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
 
static void PTRCALL latin1_toUtf16 (const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
 
static void PTRCALL ascii_toUtf8 (const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
 
static int PTRFASTCALL unicode_byte_type (char hi, char lo)
 
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 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)
 
int FASTCALL XmlUtf8Encode (int c, char *buf)
 
int FASTCALL XmlUtf16Encode (int charNum, unsigned short *buf)
 
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 void PTRCALL unknown_toUtf8 (const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
 
static void 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)
 
static int FASTCALL getEncodingIndex (const char *name)
 
static int initScan (const ENCODING *const *encodingTable, const INIT_ENCODING *enc, int state, const char *ptr, const char *end, const char **nextTokPtr)
 

Variables

static const struct normal_encoding utf8_encoding
 
static const struct normal_encoding internal_utf8_encoding
 
static const struct normal_encoding latin1_encoding
 
static const struct normal_encoding ascii_encoding
 
static const struct normal_encoding little2_encoding
 
static const struct normal_encoding internal_little2_encoding
 
static const struct normal_encoding big2_encoding
 
static const struct normal_encoding internal_big2_encoding
 
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 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 []
 

Macro Definition Documentation

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

Definition at line 197 of file xmltok.cc.

Referenced by unknown_toUtf16(), and unknown_toUtf8().

#define AS_UNKNOWN_ENCODING (   enc)    ((const struct unknown_encoding *) (enc))
#define BIG2_BYTE_TO_ASCII (   enc,
 
)    ((p)[0] == 0 ? (p)[1] : -1)

Definition at line 784 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]))
static int PTRFASTCALL unicode_byte_type(char hi, char lo)
Definition: xmltok.cc:520

Definition at line 780 of file xmltok.cc.

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

Definition at line 785 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 786 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 788 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,
 
)    (*(p))

Definition at line 833 of file xmltok.cc.

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

Definition at line 833 of file xmltok.cc.

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

Definition at line 833 of file xmltok.cc.

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

Definition at line 832 of file xmltok.cc.

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

Definition at line 832 of file xmltok.cc.

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

Definition at line 832 of file xmltok.cc.

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

Definition at line 834 of file xmltok.cc.

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

Definition at line 834 of file xmltok.cc.

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

Definition at line 834 of file xmltok.cc.

#define DEFINE_UTF16_TO_UTF16 (   E)
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); \
}
#define GET_HI(ptr)
Definition: xmltok.cc:630
#define GET_LO(ptr)
Definition: xmltok.cc:629

Definition at line 601 of file xmltok.cc.

#define DEFINE_UTF16_TO_UTF8 (   E)

Definition at line 538 of file xmltok.cc.

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

Definition at line 630 of file xmltok.cc.

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

Definition at line 630 of file xmltok.cc.

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

Definition at line 629 of file xmltok.cc.

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

Definition at line 629 of file xmltok.cc.

#define IGNORE_SECTION_TOK_VTABLE   /* as nothing */

Definition at line 29 of file xmltok.cc.

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

Definition at line 1485 of file xmltok.cc.

Referenced by initScan().

#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 
)    (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p))

Definition at line 835 of file xmltok.cc.

#define IS_NAME_CHAR (   enc,
  p,
  n 
)    0

Definition at line 835 of file xmltok.cc.

#define IS_NAME_CHAR (   enc,
  p,
  n 
)    0

Definition at line 835 of file xmltok.cc.

#define IS_NAME_CHAR_MINBPC (   enc,
 
)    (0)

Definition at line 836 of file xmltok.cc.

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

Definition at line 836 of file xmltok.cc.

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

Definition at line 836 of file xmltok.cc.

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

Definition at line 837 of file xmltok.cc.

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

Definition at line 837 of file xmltok.cc.

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

Definition at line 837 of file xmltok.cc.

#define IS_NMSTRT_CHAR_MINBPC (   enc,
 
)    (0)

Definition at line 838 of file xmltok.cc.

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

Definition at line 838 of file xmltok.cc.

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

Definition at line 838 of file xmltok.cc.

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

Definition at line 643 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]))
static int PTRFASTCALL unicode_byte_type(char hi, char lo)
Definition: xmltok.cc:520

Definition at line 639 of file xmltok.cc.

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

Definition at line 644 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 645 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 647 of file xmltok.cc.

#define MINBPC (   enc)    1

Definition at line 830 of file xmltok.cc.

#define MINBPC (   enc)    2

Definition at line 830 of file xmltok.cc.

#define MINBPC (   enc)    2

Definition at line 830 of file xmltok.cc.

#define NORMAL_VTABLE (   E)
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)    x

Definition at line 1619 of file xmltok.cc.

Referenced by G4NistElementBuilder::Initialise().

#define ns (   x)    x

Definition at line 1620 of file xmltok.cc.

#define PREFIX (   ident)    normal_ ## ident

Definition at line 829 of file xmltok.cc.

#define PREFIX (   ident)    little2_ ## ident

Definition at line 829 of file xmltok.cc.

#define PREFIX (   ident)    big2_ ## ident

Definition at line 829 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) & 0xff)), ((ptr)[1] = ((ch) >> 8)))

Definition at line 627 of file xmltok.cc.

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

Definition at line 627 of file xmltok.cc.

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

Definition at line 1486 of file xmltok.cc.

#define STANDARD_VTABLE (   E)    /* as nothing */

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.

Referenced by unknown_isName(), unknown_isNmstrt(), and XmlInitUnknownEncoding().

#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))
#define UTF8_GET_NAMING2(pages, byte)
Definition: xmltok.cc:55
const G4int n
#define UTF8_GET_NAMING3(pages, byte)
Definition: xmltok.cc:66

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.

Referenced by utf8_isName2(), and utf8_isNmstrt2().

#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.

Referenced by utf8_isName3(), and utf8_isNmstrt3().

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

Definition at line 91 of file xmltok.cc.

Referenced by utf8_isInvalid2().

#define UTF8_INVALID3 (   p)
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.

Referenced by utf8_isInvalid3().

#define UTF8_INVALID4 (   p)
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.

Referenced by utf8_isInvalid4().

#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)
#define IGNORE_SECTION_TOK_VTABLE
Definition: xmltok.cc:29
#define PREFIX(ident)
Definition: xmltok.cc:829

Definition at line 32 of file xmltok.cc.

#define XML_TOK_IMPL_C

Definition at line 840 of file xmltok.cc.

#define XML_TOK_IMPL_C

Definition at line 840 of file xmltok.cc.

#define XML_TOK_IMPL_C

Definition at line 840 of file xmltok.cc.

#define XML_TOK_NS_C

Definition at line 1621 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.

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 1426 of file xmltok.cc.

Function Documentation

static void PTRCALL ascii_toUtf8 ( const ENCODING *  enc,
const char **  fromP,
const char *  fromLim,
char **  toP,
const char *  toLim 
)
static

Definition at line 487 of file xmltok.cc.

static int FASTCALL checkCharRefNumber ( int  result)
static

Definition at line 1174 of file xmltok.cc.

References normal_encoding::type.

Referenced by unknown_isInvalid(), and XmlInitUnknownEncoding().

+ Here is the caller graph for this function:

static int doParseXmlDecl ( const ENCODING *(*)(const ENCODING *, const char *, const char *)  encodingFinder,
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

Definition at line 1082 of file xmltok.cc.

References isSpace(), name, parsePseudoAttribute(), and toAscii().

+ Here is the call graph for this function:

static int FASTCALL getEncodingIndex ( const char *  name)
static

Definition at line 1462 of file xmltok.cc.

References KW_ISO_8859_1, KW_US_ASCII, KW_UTF_16, KW_UTF_16BE, KW_UTF_16LE, KW_UTF_8, NO_ENC, streqci(), and UNKNOWN_ENC.

+ Here is the call graph for this function:

static int initScan ( const ENCODING *const *  encodingTable,
const INIT_ENCODING *  enc,
int  state,
const char *  ptr,
const char *  end,
const char **  nextTokPtr 
)
static

Definition at line 1497 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.

static void PTRCALL initUpdatePosition ( const ENCODING *  enc,
const char *  ptr,
const char *  end,
POSITION pos 
)
static

Definition at line 941 of file xmltok.cc.

References normal_encoding::enc.

static int PTRFASTCALL isNever ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 125 of file xmltok.cc.

static int FASTCALL isSpace ( int  c)
static

Definition at line 960 of file xmltok.cc.

Referenced by doParseXmlDecl(), and parsePseudoAttribute().

+ Here is the caller graph for this function:

static void PTRCALL latin1_toUtf16 ( const ENCODING *  enc,
const char **  fromP,
const char *  fromLim,
unsigned short **  toP,
const unsigned short *  toLim 
)
static

Definition at line 454 of file xmltok.cc.

static void PTRCALL latin1_toUtf8 ( const ENCODING *  enc,
const char **  fromP,
const char *  fromLim,
char **  toP,
const char *  toLim 
)
static

Definition at line 429 of file xmltok.cc.

References UTF8_cval2.

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

Definition at line 976 of file xmltok.cc.

References isSpace(), and toAscii().

Referenced by doParseXmlDecl().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int FASTCALL streqci ( const char *  s1,
const char *  s2 
)
static

Definition at line 923 of file xmltok.cc.

References c1, and c2.

Referenced by getEncodingIndex().

+ Here is the caller graph for this function:

static int toAscii ( const ENCODING *  enc,
const char *  ptr,
const char *  end 
)
static

Definition at line 948 of file xmltok.cc.

Referenced by doParseXmlDecl(), and parsePseudoAttribute().

+ Here is the caller graph for this function:

static int PTRFASTCALL unicode_byte_type ( char  hi,
char  lo 
)
static

Definition at line 520 of file xmltok.cc.

static int PTRFASTCALL unknown_isInvalid ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 1284 of file xmltok.cc.

References AS_UNKNOWN_ENCODING, checkCharRefNumber(), unknown_encoding::convert, and unknown_encoding::userData.

Referenced by XmlInitUnknownEncoding().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int PTRFASTCALL unknown_isName ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 1264 of file xmltok.cc.

References AS_UNKNOWN_ENCODING, unknown_encoding::convert, UCS2_GET_NAMING, and unknown_encoding::userData.

Referenced by XmlInitUnknownEncoding().

+ Here is the caller graph for this function:

static int PTRFASTCALL unknown_isNmstrt ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 1274 of file xmltok.cc.

References AS_UNKNOWN_ENCODING, unknown_encoding::convert, UCS2_GET_NAMING, and unknown_encoding::userData.

Referenced by XmlInitUnknownEncoding().

+ Here is the caller graph for this function:

static void PTRCALL unknown_toUtf16 ( const ENCODING *  enc,
const char **  fromP,
const char *  fromLim,
unsigned short **  toP,
const unsigned short *  toLim 
)
static

Definition at line 1326 of file xmltok.cc.

References AS_NORMAL_ENCODING, AS_UNKNOWN_ENCODING, unknown_encoding::convert, unknown_encoding::userData, and unknown_encoding::utf16.

Referenced by XmlInitUnknownEncoding().

+ Here is the caller graph for this function:

static void PTRCALL unknown_toUtf8 ( const ENCODING *  enc,
const char **  fromP,
const char *  fromLim,
char **  toP,
const char *  toLim 
)
static

Definition at line 1292 of file xmltok.cc.

References AS_NORMAL_ENCODING, AS_UNKNOWN_ENCODING, unknown_encoding::convert, n, unknown_encoding::userData, unknown_encoding::utf8, and XmlUtf8Encode().

Referenced by XmlInitUnknownEncoding().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int PTRFASTCALL utf8_isInvalid2 ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 159 of file xmltok.cc.

References UTF8_INVALID2.

static int PTRFASTCALL utf8_isInvalid3 ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 165 of file xmltok.cc.

References UTF8_INVALID3.

static int PTRFASTCALL utf8_isInvalid4 ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 171 of file xmltok.cc.

References UTF8_INVALID4.

static int PTRFASTCALL utf8_isName2 ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 131 of file xmltok.cc.

References UTF8_GET_NAMING2.

static int PTRFASTCALL utf8_isName3 ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 137 of file xmltok.cc.

References UTF8_GET_NAMING3.

static int PTRFASTCALL utf8_isNmstrt2 ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 145 of file xmltok.cc.

References UTF8_GET_NAMING2.

static int PTRFASTCALL utf8_isNmstrt3 ( const ENCODING *  enc,
const char *  p 
)
static

Definition at line 151 of file xmltok.cc.

References UTF8_GET_NAMING3.

static void PTRCALL utf8_toUtf16 ( const ENCODING *  enc,
const char **  fromP,
const char *  fromLim,
unsigned short **  toP,
const unsigned short *  toLim 
)
static

Definition at line 341 of file xmltok.cc.

References n.

static void PTRCALL utf8_toUtf8 ( const ENCODING *  enc,
const char **  fromP,
const char *  fromLim,
char **  toP,
const char *  toLim 
)
static

Definition at line 322 of file xmltok.cc.

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

Definition at line 1346 of file xmltok.cc.

References checkCharRefNumber(), unknown_encoding::convert, normal_encoding::enc, latin1_encoding, unknown_encoding::normal, normal_encoding::type, UCS2_GET_NAMING, unknown_isInvalid(), unknown_isName(), unknown_isNmstrt(), unknown_toUtf16(), unknown_toUtf8(), userData, unknown_encoding::userData, unknown_encoding::utf16, unknown_encoding::utf8, and XmlUtf8Encode().

Referenced by handleUnknownEncoding().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int XmlSizeOfUnknownEncoding ( void  )

Definition at line 1258 of file xmltok.cc.

Referenced by handleUnknownEncoding().

+ Here is the caller graph for this function:

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

Definition at line 1230 of file xmltok.cc.

int FASTCALL XmlUtf8Encode ( int  c,
char *  buf 
)

Definition at line 1193 of file xmltok.cc.

References UTF8_cval1, UTF8_cval2, UTF8_cval3, and UTF8_cval4.

Referenced by unknown_toUtf8(), and XmlInitUnknownEncoding().

+ Here is the caller graph for this function:

Variable Documentation

const struct normal_encoding ascii_encoding
static

Definition at line 508 of file xmltok.cc.

const struct normal_encoding big2_encoding
static

Definition at line 875 of file xmltok.cc.

const struct normal_encoding internal_big2_encoding
static

Definition at line 907 of file xmltok.cc.

const struct normal_encoding internal_little2_encoding
static

Definition at line 766 of file xmltok.cc.

const struct normal_encoding internal_utf8_encoding
static

Definition at line 417 of file xmltok.cc.

const char KW_encoding[]
static
Initial value:
= {
ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0'
}

Definition at line 1064 of file xmltok.cc.

const char KW_ISO_8859_1[]
static
Initial value:
= {
ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9,
ASCII_MINUS, ASCII_1, '\0'
}

Definition at line 1438 of file xmltok.cc.

Referenced by getEncodingIndex().

const char KW_no[]
static
Initial value:
= {
ASCII_n, ASCII_o, '\0'
}

Definition at line 1077 of file xmltok.cc.

const char KW_standalone[]
static
Initial value:
= {
ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o,
ASCII_n, ASCII_e, '\0'
}

Definition at line 1068 of file xmltok.cc.

const char KW_US_ASCII[]
static
Initial value:
= {
ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I,
'\0'
}

Definition at line 1442 of file xmltok.cc.

Referenced by getEncodingIndex().

const char KW_UTF_16[]
static
Initial value:
= {
ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0'
}

Definition at line 1449 of file xmltok.cc.

Referenced by getEncodingIndex().

const char KW_UTF_16BE[]
static
Initial value:
= {
ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E,
'\0'
}

Definition at line 1452 of file xmltok.cc.

Referenced by getEncodingIndex().

const char KW_UTF_16LE[]
static
Initial value:
= {
ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E,
'\0'
}

Definition at line 1456 of file xmltok.cc.

Referenced by getEncodingIndex().

const char KW_UTF_8[]
static
Initial value:
= {
ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0'
}

Definition at line 1446 of file xmltok.cc.

Referenced by getEncodingIndex().

const char KW_version[]
static
Initial value:
= {
ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0'
}

Definition at line 1060 of file xmltok.cc.

const char KW_yes[]
static
Initial value:
= {
ASCII_y, ASCII_e, ASCII_s, '\0'
}

Definition at line 1073 of file xmltok.cc.

const struct normal_encoding latin1_encoding
static

Definition at line 475 of file xmltok.cc.

Referenced by XmlInitUnknownEncoding().

const struct normal_encoding little2_encoding
static

Definition at line 734 of file xmltok.cc.

const struct normal_encoding utf8_encoding
static

Definition at line 393 of file xmltok.cc.