Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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.cc"
#include "asciitab.h"
#include "utf8tab.h"
#include "iasciitab.h"
#include "latin1tab.h"
#include "xmltok_ns.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

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

Macro Definition Documentation

◆ AS_NORMAL_ENCODING

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

Definition at line 202 of file xmltok.cc.

◆ AS_UNKNOWN_ENCODING

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

Definition at line 1260 of file xmltok.cc.

◆ BIG2_BYTE_TO_ASCII

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

Definition at line 789 of file xmltok.cc.

◆ BIG2_BYTE_TYPE

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

◆ BIG2_CHAR_MATCHES

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

Definition at line 790 of file xmltok.cc.

◆ BIG2_IS_NAME_CHAR_MINBPC

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

Definition at line 791 of file xmltok.cc.

◆ BIG2_IS_NMSTRT_CHAR_MINBPC

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

Definition at line 793 of file xmltok.cc.

◆ BT_COLON [1/8]

#define BT_COLON   BT_NMSTRT

◆ BT_COLON [2/8]

#define BT_COLON   BT_NMSTRT

◆ BT_COLON [3/8]

#define BT_COLON   BT_NMSTRT

◆ BT_COLON [4/8]

#define BT_COLON   BT_NMSTRT

◆ BT_COLON [5/8]

#define BT_COLON   BT_NMSTRT

◆ BT_COLON [6/8]

#define BT_COLON   BT_NMSTRT

◆ BT_COLON [7/8]

#define BT_COLON   BT_NMSTRT

◆ BT_COLON [8/8]

#define BT_COLON   BT_NMSTRT

◆ BYTE_TO_ASCII [1/3]

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

Definition at line 838 of file xmltok.cc.

◆ BYTE_TO_ASCII [2/3]

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

Definition at line 838 of file xmltok.cc.

◆ BYTE_TO_ASCII [3/3]

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

Definition at line 838 of file xmltok.cc.

◆ BYTE_TYPE [1/3]

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

Definition at line 837 of file xmltok.cc.

◆ BYTE_TYPE [2/3]

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

Definition at line 837 of file xmltok.cc.

◆ BYTE_TYPE [3/3]

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

Definition at line 837 of file xmltok.cc.

◆ CHAR_MATCHES [1/3]

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

Definition at line 839 of file xmltok.cc.

◆ CHAR_MATCHES [2/3]

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

Definition at line 839 of file xmltok.cc.

◆ CHAR_MATCHES [3/3]

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

Definition at line 839 of file xmltok.cc.

◆ DEFINE_UTF16_TO_UTF16

#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:635
#define GET_LO(ptr)
Definition: xmltok.cc:634

Definition at line 606 of file xmltok.cc.

◆ DEFINE_UTF16_TO_UTF8

#define DEFINE_UTF16_TO_UTF8 (   E)

Definition at line 543 of file xmltok.cc.

◆ GET_HI [1/2]

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

Definition at line 635 of file xmltok.cc.

◆ GET_HI [2/2]

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

Definition at line 635 of file xmltok.cc.

◆ GET_LO [1/2]

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

Definition at line 634 of file xmltok.cc.

◆ GET_LO [2/2]

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

Definition at line 634 of file xmltok.cc.

◆ IGNORE_SECTION_TOK_VTABLE

#define IGNORE_SECTION_TOK_VTABLE   /* as nothing */

Definition at line 34 of file xmltok.cc.

◆ INIT_ENC_INDEX

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

Definition at line 1490 of file xmltok.cc.

◆ IS_INVALID_CHAR

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

Definition at line 278 of file xmltok.cc.

◆ IS_NAME_CHAR [1/3]

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

Definition at line 840 of file xmltok.cc.

◆ IS_NAME_CHAR [2/3]

#define IS_NAME_CHAR (   enc,
  p,
 
)    0

Definition at line 840 of file xmltok.cc.

◆ IS_NAME_CHAR [3/3]

#define IS_NAME_CHAR (   enc,
  p,
 
)    0

Definition at line 840 of file xmltok.cc.

◆ IS_NAME_CHAR_MINBPC [1/3]

#define IS_NAME_CHAR_MINBPC (   enc,
 
)    (0)

Definition at line 841 of file xmltok.cc.

◆ IS_NAME_CHAR_MINBPC [2/3]

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

Definition at line 841 of file xmltok.cc.

◆ IS_NAME_CHAR_MINBPC [3/3]

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

Definition at line 841 of file xmltok.cc.

◆ IS_NMSTRT_CHAR [1/3]

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

Definition at line 842 of file xmltok.cc.

◆ IS_NMSTRT_CHAR [2/3]

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

Definition at line 842 of file xmltok.cc.

◆ IS_NMSTRT_CHAR [3/3]

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

Definition at line 842 of file xmltok.cc.

◆ IS_NMSTRT_CHAR_MINBPC [1/3]

#define IS_NMSTRT_CHAR_MINBPC (   enc,
 
)    (0)

Definition at line 843 of file xmltok.cc.

◆ IS_NMSTRT_CHAR_MINBPC [2/3]

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

Definition at line 843 of file xmltok.cc.

◆ IS_NMSTRT_CHAR_MINBPC [3/3]

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

Definition at line 843 of file xmltok.cc.

◆ LITTLE2_BYTE_TO_ASCII

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

Definition at line 648 of file xmltok.cc.

◆ LITTLE2_BYTE_TYPE

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

◆ LITTLE2_CHAR_MATCHES

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

Definition at line 649 of file xmltok.cc.

◆ LITTLE2_IS_NAME_CHAR_MINBPC

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

Definition at line 650 of file xmltok.cc.

◆ LITTLE2_IS_NMSTRT_CHAR_MINBPC

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

Definition at line 652 of file xmltok.cc.

◆ MINBPC [1/3]

#define MINBPC (   enc)    1

Definition at line 835 of file xmltok.cc.

◆ MINBPC [2/3]

#define MINBPC (   enc)    2

Definition at line 835 of file xmltok.cc.

◆ MINBPC [3/3]

#define MINBPC (   enc)    2

Definition at line 835 of file xmltok.cc.

◆ NORMAL_VTABLE

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

◆ NS

#define NS (   x)    x

Definition at line 1624 of file xmltok.cc.

◆ ns

#define ns (   x)    x

Definition at line 1625 of file xmltok.cc.

◆ PREFIX [1/3]

#define PREFIX (   ident)    normal_ ## ident

Definition at line 834 of file xmltok.cc.

◆ PREFIX [2/3]

#define PREFIX (   ident)    little2_ ## ident

Definition at line 834 of file xmltok.cc.

◆ PREFIX [3/3]

#define PREFIX (   ident)    big2_ ## ident

Definition at line 834 of file xmltok.cc.

◆ SB_BYTE_TYPE

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

Definition at line 247 of file xmltok.cc.

◆ SET2 [1/2]

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

Definition at line 632 of file xmltok.cc.

◆ SET2 [2/2]

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

Definition at line 632 of file xmltok.cc.

◆ SET_INIT_ENC_INDEX

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

Definition at line 1491 of file xmltok.cc.

◆ STANDARD_VTABLE

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

Definition at line 215 of file xmltok.cc.

◆ UCS2_GET_NAMING

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

Definition at line 53 of file xmltok.cc.

◆ UTF8_GET_NAMING

#define UTF8_GET_NAMING (   pages,
  p,
 
)
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_NAMING3(pages, byte)
Definition: xmltok.cc:71
#define UTF8_GET_NAMING2(pages, byte)
Definition: xmltok.cc:60

Definition at line 79 of file xmltok.cc.

◆ UTF8_GET_NAMING2

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

◆ UTF8_GET_NAMING3

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

◆ UTF8_INVALID2

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

Definition at line 96 of file xmltok.cc.

◆ UTF8_INVALID3

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

◆ UTF8_INVALID4

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

◆ utf8_isName4

#define utf8_isName4   isNever

Definition at line 147 of file xmltok.cc.

◆ utf8_isNmstrt4

#define utf8_isNmstrt4   isNever

Definition at line 161 of file xmltok.cc.

◆ VTABLE

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

Definition at line 51 of file xmltok.cc.

◆ VTABLE1

#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:34
#define PREFIX(ident)
Definition: xmltok.cc:834

Definition at line 37 of file xmltok.cc.

◆ XML_TOK_IMPL_C [1/3]

#define XML_TOK_IMPL_C

Definition at line 845 of file xmltok.cc.

◆ XML_TOK_IMPL_C [2/3]

#define XML_TOK_IMPL_C

Definition at line 845 of file xmltok.cc.

◆ XML_TOK_IMPL_C [3/3]

#define XML_TOK_IMPL_C

Definition at line 845 of file xmltok.cc.

◆ XML_TOK_NS_C

#define XML_TOK_NS_C

Definition at line 1626 of file xmltok.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
UTF8_cval1 
UTF8_cval2 
UTF8_cval3 
UTF8_cval4 

Definition at line 319 of file xmltok.cc.

319 { /* UTF8_cvalN is value of masked first byte of N byte sequence */
320 UTF8_cval1 = 0x00,
321 UTF8_cval2 = 0xc0,
322 UTF8_cval3 = 0xe0,
323 UTF8_cval4 = 0xf0
324};
@ UTF8_cval4
Definition: xmltok.cc:323
@ UTF8_cval1
Definition: xmltok.cc:320
@ UTF8_cval2
Definition: xmltok.cc:321
@ UTF8_cval3
Definition: xmltok.cc:322

◆ anonymous enum

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

1431 {
1432 UNKNOWN_ENC = -1,
1433 ISO_8859_1_ENC = 0,
1435 UTF_8_ENC,
1436 UTF_16_ENC,
1439 /* must match encodingNames up to here */
1440 NO_ENC
1441};
@ NO_ENC
Definition: xmltok.cc:1440
@ US_ASCII_ENC
Definition: xmltok.cc:1434
@ ISO_8859_1_ENC
Definition: xmltok.cc:1433
@ UTF_8_ENC
Definition: xmltok.cc:1435
@ UTF_16_ENC
Definition: xmltok.cc:1436
@ UNKNOWN_ENC
Definition: xmltok.cc:1432
@ UTF_16BE_ENC
Definition: xmltok.cc:1437
@ UTF_16LE_ENC
Definition: xmltok.cc:1438

Function Documentation

◆ XmlInitUnknownEncoding()

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

Definition at line 1351 of file xmltok.cc.

1355{
1356 int i;
1357 struct unknown_encoding *e = (struct unknown_encoding *)mem;
1358 for (i = 0; i < (int)sizeof(struct normal_encoding); i++)
1359 ((char *)mem)[i] = ((char *)&latin1_encoding)[i];
1360 for (i = 0; i < 128; i++)
1361 if (latin1_encoding.type[i] != BT_OTHER
1362 && latin1_encoding.type[i] != BT_NONXML
1363 && table[i] != i)
1364 return 0;
1365 for (i = 0; i < 256; i++) {
1366 int c = table[i];
1367 if (c == -1) {
1368 e->normal.type[i] = BT_MALFORM;
1369 /* This shouldn't really get used. */
1370 e->utf16[i] = 0xFFFF;
1371 e->utf8[i][0] = 1;
1372 e->utf8[i][1] = 0;
1373 }
1374 else if (c < 0) {
1375 if (c < -4)
1376 return 0;
1377 e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2));
1378 e->utf8[i][0] = 0;
1379 e->utf16[i] = 0;
1380 }
1381 else if (c < 0x80) {
1382 if (latin1_encoding.type[c] != BT_OTHER
1383 && latin1_encoding.type[c] != BT_NONXML
1384 && c != i)
1385 return 0;
1386 e->normal.type[i] = latin1_encoding.type[c];
1387 e->utf8[i][0] = 1;
1388 e->utf8[i][1] = (char)c;
1389 e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c);
1390 }
1391 else if (checkCharRefNumber(c) < 0) {
1392 e->normal.type[i] = BT_NONXML;
1393 /* This shouldn't really get used. */
1394 e->utf16[i] = 0xFFFF;
1395 e->utf8[i][0] = 1;
1396 e->utf8[i][1] = 0;
1397 }
1398 else {
1399 if (c > 0xFFFF)
1400 return 0;
1401 if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff))
1402 e->normal.type[i] = BT_NMSTRT;
1403 else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff))
1404 e->normal.type[i] = BT_NAME;
1405 else
1406 e->normal.type[i] = BT_OTHER;
1407 e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1);
1408 e->utf16[i] = (unsigned short)c;
1409 }
1410 }
1411 e->userData = userData;
1412 e->convert = convert;
1413 if (convert) {
1414 e->normal.isName2 = unknown_isName;
1415 e->normal.isName3 = unknown_isName;
1416 e->normal.isName4 = unknown_isName;
1417 e->normal.isNmstrt2 = unknown_isNmstrt;
1418 e->normal.isNmstrt3 = unknown_isNmstrt;
1419 e->normal.isNmstrt4 = unknown_isNmstrt;
1420 e->normal.isInvalid2 = unknown_isInvalid;
1421 e->normal.isInvalid3 = unknown_isInvalid;
1422 e->normal.isInvalid4 = unknown_isInvalid;
1423 }
1424 e->normal.enc.utf8Convert = unknown_toUtf8;
1425 e->normal.enc.utf16Convert = unknown_toUtf16;
1426 return &(e->normal.enc);
1427}
BT_OTHER
Definition: asciitab.h:14
BT_NMSTRT
Definition: asciitab.h:22
BT_NAME
Definition: asciitab.h:16
BT_NONXML
Definition: asciitab.h:5
unsigned char type[256]
Definition: xmltok.cc:183
ENCODING enc
Definition: xmltok.cc:182
unsigned short utf16[256]
Definition: xmltok.cc:1256
CONVERTER convert
Definition: xmltok.cc:1254
void * userData
Definition: xmltok.cc:1255
char utf8[256][4]
Definition: xmltok.cc:1257
struct normal_encoding normal
Definition: xmltok.cc:1253
BT_MALFORM
Definition: utf8tab.h:37
BT_LEAD2
Definition: utf8tab.h:22
#define userData
Definition: xmlparse.cc:572
#define UCS2_GET_NAMING(pages, hi, lo)
Definition: xmltok.cc:53
int FASTCALL XmlUtf8Encode(int c, char *buf)
Definition: xmltok.cc:1198

◆ XmlSizeOfUnknownEncoding()

int XmlSizeOfUnknownEncoding ( void  )

Definition at line 1263 of file xmltok.cc.

1264{
1265 return sizeof(struct unknown_encoding);
1266}

◆ XmlUtf16Encode()

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

Definition at line 1235 of file xmltok.cc.

1236{
1237 if (charNum < 0)
1238 return 0;
1239 if (charNum < 0x10000) {
1240 buf[0] = (unsigned short)charNum;
1241 return 1;
1242 }
1243 if (charNum < 0x110000) {
1244 charNum -= 0x10000;
1245 buf[0] = (unsigned short)((charNum >> 10) + 0xD800);
1246 buf[1] = (unsigned short)((charNum & 0x3FF) + 0xDC00);
1247 return 2;
1248 }
1249 return 0;
1250}

◆ XmlUtf8Encode()

int FASTCALL XmlUtf8Encode ( int  c,
char *  buf 
)

Definition at line 1198 of file xmltok.cc.

1199{
1200 enum {
1201 /* minN is minimum legal resulting value for N byte sequence */
1202 min2 = 0x80,
1203 min3 = 0x800,
1204 min4 = 0x10000
1205 };
1206
1207 if (c < 0)
1208 return 0;
1209 if (c < min2) {
1210 buf[0] = (char)(c | UTF8_cval1);
1211 return 1;
1212 }
1213 if (c < min3) {
1214 buf[0] = (char)((c >> 6) | UTF8_cval2);
1215 buf[1] = (char)((c & 0x3f) | 0x80);
1216 return 2;
1217 }
1218 if (c < min4) {
1219 buf[0] = (char)((c >> 12) | UTF8_cval3);
1220 buf[1] = (char)(((c >> 6) & 0x3f) | 0x80);
1221 buf[2] = (char)((c & 0x3f) | 0x80);
1222 return 3;
1223 }
1224 if (c < 0x110000) {
1225 buf[0] = (char)((c >> 18) | UTF8_cval4);
1226 buf[1] = (char)(((c >> 12) & 0x3f) | 0x80);
1227 buf[2] = (char)(((c >> 6) & 0x3f) | 0x80);
1228 buf[3] = (char)((c & 0x3f) | 0x80);
1229 return 4;
1230 }
1231 return 0;
1232}

Referenced by XmlInitUnknownEncoding().