Apache HTTPD
Classes | Macros | Enumerations | Functions | Variables
xmltok.c File Reference
#include "expat_config.h"
#include <stddef.h>
#include <string.h>
#include <stdbool.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.

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)] & (1u << ((lo) & 0x1F)))
 
#define UTF8_GET_NAMING2(pages, byte)
 
#define UTF8_GET_NAMING3(pages, byte)
 
#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 NULL_VTABLE
 
#define MINBPC(enc)   1
 
#define SB_BYTE_TYPE(enc, p)    (((const 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 GET_LO(ptr)   ((unsigned char)(ptr)[0])
 
#define GET_HI(ptr)   ((unsigned char)(ptr)[1])
 
#define GET_LO(ptr)   ((unsigned char)(ptr)[1])
 
#define GET_HI(ptr)   ((unsigned char)(ptr)[0])
 
#define LITTLE2_BYTE_TYPE(enc, p)    ((p)[1] == 0 ? SB_BYTE_TYPE(enc, p) : unicode_byte_type((p)[1], (p)[0]))
 
#define LITTLE2_BYTE_TO_ASCII(p)   ((p)[1] == 0 ? (p)[0] : -1)
 
#define LITTLE2_CHAR_MATCHES(p, c)   ((p)[1] == 0 && (p)[0] == (c))
 
#define LITTLE2_IS_NAME_CHAR_MINBPC(p)    UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
 
#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(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(p)
 
#define CHAR_MATCHES(enc, p, c)   LITTLE2_CHAR_MATCHES(p, c)
 
#define IS_NAME_CHAR(enc, p, n)   0
 
#define IS_NAME_CHAR_MINBPC(enc, p)   LITTLE2_IS_NAME_CHAR_MINBPC(p)
 
#define IS_NMSTRT_CHAR(enc, p, n)   (0)
 
#define IS_NMSTRT_CHAR_MINBPC(enc, p)   LITTLE2_IS_NMSTRT_CHAR_MINBPC(p)
 
#define XML_TOK_IMPL_C
 
#define BT_COLON   BT_NMSTRT
 
#define BT_COLON   BT_NMSTRT
 
#define BIG2_BYTE_TYPE(enc, p)    ((p)[0] == 0 ? SB_BYTE_TYPE(enc, p + 1) : unicode_byte_type((p)[0], (p)[1]))
 
#define BIG2_BYTE_TO_ASCII(p)   ((p)[0] == 0 ? (p)[1] : -1)
 
#define BIG2_CHAR_MATCHES(p, c)   ((p)[0] == 0 && (p)[1] == (c))
 
#define BIG2_IS_NAME_CHAR_MINBPC(p)    UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
 
#define BIG2_IS_NMSTRT_CHAR_MINBPC(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(p)
 
#define CHAR_MATCHES(enc, p, c)   BIG2_CHAR_MATCHES(p, c)
 
#define IS_NAME_CHAR(enc, p, n)   0
 
#define IS_NAME_CHAR_MINBPC(enc, p)   BIG2_IS_NAME_CHAR_MINBPC(p)
 
#define IS_NMSTRT_CHAR(enc, p, n)   (0)
 
#define IS_NMSTRT_CHAR_MINBPC(enc, p)   BIG2_IS_NMSTRT_CHAR_MINBPC(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 isNever (const ENCODING *enc, const char *p)
 
static int utf8_isName2 (const ENCODING *enc, const char *p)
 
static int utf8_isName3 (const ENCODING *enc, const char *p)
 
static int utf8_isNmstrt2 (const ENCODING *enc, const char *p)
 
static int utf8_isNmstrt3 (const ENCODING *enc, const char *p)
 
static int utf8_isInvalid2 (const ENCODING *enc, const char *p)
 
static int utf8_isInvalid3 (const ENCODING *enc, const char *p)
 
static int utf8_isInvalid4 (const ENCODING *enc, const char *p)
 
static int checkCharRefNumber (int result)
 
void _INTERNAL_trim_to_complete_utf8_characters (const char *from, const char **fromLimRef)
 
static enum XML_Convert_Result utf8_toUtf8 (const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
 
static enum XML_Convert_Result utf8_toUtf16 (const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
 
static enum XML_Convert_Result latin1_toUtf8 (const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
 
static enum XML_Convert_Result latin1_toUtf16 (const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
 
static enum XML_Convert_Result ascii_toUtf8 (const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
 
static int unicode_byte_type (char hi, char lo)
 
static enum XML_Convert_Result little2_toUtf8 (const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
 
static enum XML_Convert_Result little2_toUtf16 (const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
 
static enum XML_Convert_Result big2_toUtf8 (const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
 
static enum XML_Convert_Result big2_toUtf16 (const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
 
static int streqci (const char *s1, const char *s2)
 
static void 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 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 XmlUtf8Encode (int c, char *buf)
 
int XmlUtf16Encode (int charNum, unsigned short *buf)
 
int XmlSizeOfUnknownEncoding (void)
 
static int unknown_isName (const ENCODING *enc, const char *p)
 
static int unknown_isNmstrt (const ENCODING *enc, const char *p)
 
static int unknown_isInvalid (const ENCODING *enc, const char *p)
 
static enum XML_Convert_Result unknown_toUtf8 (const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
 
static enum XML_Convert_Result unknown_toUtf16 (const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
 
ENCODINGXmlInitUnknownEncoding (void *mem, int *table, CONVERTER convert, void *userData)
 
static int 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 [] = { 0x76 , 0x65 , 0x72 , 0x73 , 0x69 , 0x6F , 0x6E , '\0'}
 
static const char KW_encoding []
 
static const char KW_standalone []
 
static const char KW_yes [] = { 0x79 , 0x65 , 0x73 , '\0'}
 
static const char KW_no [] = { 0x6E , 0x6F , '\0'}
 
static const char KW_ISO_8859_1 []
 
static const char KW_US_ASCII []
 
static const char KW_UTF_8 [] = { 0x55 , 0x54 , 0x46 , 0x2D , 0x38 , '\0'}
 
static const char KW_UTF_16 [] = { 0x55 , 0x54 , 0x46 , 0x2D , 0x31 , 0x36 , '\0'}
 
static const char KW_UTF_16BE []
 
static const char KW_UTF_16LE []
 

Macro Definition Documentation

◆ AS_NORMAL_ENCODING

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

Definition at line 208 of file xmltok.c.

◆ AS_UNKNOWN_ENCODING

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

Definition at line 1317 of file xmltok.c.

◆ BIG2_BYTE_TO_ASCII

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

Definition at line 873 of file xmltok.c.

◆ BIG2_BYTE_TYPE

#define BIG2_BYTE_TYPE (   enc,
  p 
)     ((p)[0] == 0 ? SB_BYTE_TYPE(enc, p + 1) : unicode_byte_type((p)[0], (p)[1]))

Definition at line 871 of file xmltok.c.

◆ BIG2_CHAR_MATCHES

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

Definition at line 874 of file xmltok.c.

◆ BIG2_IS_NAME_CHAR_MINBPC

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

Definition at line 875 of file xmltok.c.

◆ BIG2_IS_NMSTRT_CHAR_MINBPC

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

Definition at line 877 of file xmltok.c.

◆ 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 
)    (*(p))

Definition at line 268 of file xmltok.c.

◆ BYTE_TO_ASCII [2/3]

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

Definition at line 268 of file xmltok.c.

◆ BYTE_TO_ASCII [3/3]

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

Definition at line 268 of file xmltok.c.

◆ BYTE_TYPE [1/3]

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

Definition at line 257 of file xmltok.c.

◆ BYTE_TYPE [2/3]

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

Definition at line 257 of file xmltok.c.

◆ BYTE_TYPE [3/3]

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

Definition at line 257 of file xmltok.c.

◆ CHAR_MATCHES [1/3]

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

Definition at line 302 of file xmltok.c.

◆ CHAR_MATCHES [2/3]

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

Definition at line 302 of file xmltok.c.

◆ CHAR_MATCHES [3/3]

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

Definition at line 302 of file xmltok.c.

◆ DEFINE_UTF16_TO_UTF16

#define DEFINE_UTF16_TO_UTF16 (   E)
Value:
const ENCODING *enc, const char **fromP, const char *fromLim, \
unsigned short **toP, const unsigned short *toLim) { \
UNUSED_P(enc); \
fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */ \
/* 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); \
if ((*toP == toLim) && (*fromP < fromLim)) \
}
apr_pool_t apr_dbd_t apr_dbd_results_t ** res
Definition apr_dbd.h:287
apr_size_t size
#define PTRCALL
Definition internal.h:87
#define GET_HI(ptr)
Definition xmltok.c:721
#define GET_LO(ptr)
Definition xmltok.c:720
XML_Convert_Result
Definition xmltok.h:163
@ XML_CONVERT_OUTPUT_EXHAUSTED
Definition xmltok.h:166
@ XML_CONVERT_COMPLETED
Definition xmltok.h:164
@ XML_CONVERT_INPUT_INCOMPLETE
Definition xmltok.h:165

Definition at line 699 of file xmltok.c.

◆ DEFINE_UTF16_TO_UTF8

#define DEFINE_UTF16_TO_UTF8 (   E)

Definition at line 622 of file xmltok.c.

◆ GET_HI [1/2]

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

Definition at line 721 of file xmltok.c.

◆ GET_HI [2/2]

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

Definition at line 721 of file xmltok.c.

◆ GET_LO [1/2]

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

Definition at line 720 of file xmltok.c.

◆ GET_LO [2/2]

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

Definition at line 720 of file xmltok.c.

◆ IGNORE_SECTION_TOK_VTABLE

#define IGNORE_SECTION_TOK_VTABLE   /* as nothing */

Definition at line 67 of file xmltok.c.

◆ INIT_ENC_INDEX

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

Definition at line 1521 of file xmltok.c.

◆ IS_INVALID_CHAR

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

Definition at line 278 of file xmltok.c.

◆ IS_NAME_CHAR [1/3]

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

Definition at line 271 of file xmltok.c.

◆ IS_NAME_CHAR [2/3]

#define IS_NAME_CHAR (   enc,
  p,
  n 
)    0

Definition at line 271 of file xmltok.c.

◆ IS_NAME_CHAR [3/3]

#define IS_NAME_CHAR (   enc,
  p,
  n 
)    0

Definition at line 271 of file xmltok.c.

◆ IS_NAME_CHAR_MINBPC [1/3]

#define IS_NAME_CHAR_MINBPC (   enc,
  p 
)    (0)

Definition at line 288 of file xmltok.c.

◆ IS_NAME_CHAR_MINBPC [2/3]

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

Definition at line 288 of file xmltok.c.

◆ IS_NAME_CHAR_MINBPC [3/3]

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

Definition at line 288 of file xmltok.c.

◆ IS_NMSTRT_CHAR [1/3]

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

Definition at line 272 of file xmltok.c.

◆ IS_NMSTRT_CHAR [2/3]

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

Definition at line 272 of file xmltok.c.

◆ IS_NMSTRT_CHAR [3/3]

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

Definition at line 272 of file xmltok.c.

◆ IS_NMSTRT_CHAR_MINBPC [1/3]

#define IS_NMSTRT_CHAR_MINBPC (   enc,
  p 
)    (0)

Definition at line 289 of file xmltok.c.

◆ IS_NMSTRT_CHAR_MINBPC [2/3]

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

Definition at line 289 of file xmltok.c.

◆ IS_NMSTRT_CHAR_MINBPC [3/3]

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

Definition at line 289 of file xmltok.c.

◆ LITTLE2_BYTE_TO_ASCII

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

Definition at line 740 of file xmltok.c.

◆ LITTLE2_BYTE_TYPE

#define LITTLE2_BYTE_TYPE (   enc,
  p 
)     ((p)[1] == 0 ? SB_BYTE_TYPE(enc, p) : unicode_byte_type((p)[1], (p)[0]))

Definition at line 738 of file xmltok.c.

◆ LITTLE2_CHAR_MATCHES

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

Definition at line 741 of file xmltok.c.

◆ LITTLE2_IS_NAME_CHAR_MINBPC

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

Definition at line 742 of file xmltok.c.

◆ LITTLE2_IS_NMSTRT_CHAR_MINBPC

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

Definition at line 744 of file xmltok.c.

◆ MINBPC [1/3]

#define MINBPC (   enc)    1

Definition at line 244 of file xmltok.c.

◆ MINBPC [2/3]

#define MINBPC (   enc)    2

Definition at line 244 of file xmltok.c.

◆ MINBPC [3/3]

#define MINBPC (   enc)    2

Definition at line 244 of file xmltok.c.

◆ 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 221 of file xmltok.c.

◆ NS

#define NS (   x)    x

Definition at line 1643 of file xmltok.c.

◆ ns

#define ns (   x)    x

Definition at line 1644 of file xmltok.c.

◆ NULL_VTABLE

#define NULL_VTABLE
Value:
/* isName2 */ NULL, /* isName3 */ NULL, /* isName4 */ NULL, \
/* isNmstrt2 */ NULL, /* isNmstrt3 */ NULL, /* isNmstrt4 */ NULL, \
/* isInvalid2 */ NULL, /* isInvalid3 */ NULL, /* isInvalid4 */ NULL
return NULL
Definition mod_so.c:359

Definition at line 225 of file xmltok.c.

◆ PREFIX [1/3]

#define PREFIX (   ident)    normal_##ident

Definition at line 305 of file xmltok.c.

◆ PREFIX [2/3]

#define PREFIX (   ident)    little2_##ident

Definition at line 305 of file xmltok.c.

◆ PREFIX [3/3]

#define PREFIX (   ident)    big2_##ident

Definition at line 305 of file xmltok.c.

◆ SB_BYTE_TYPE

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

Definition at line 247 of file xmltok.c.

◆ SET_INIT_ENC_INDEX

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

Definition at line 1522 of file xmltok.c.

◆ STANDARD_VTABLE

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

Definition at line 217 of file xmltok.c.

◆ UCS2_GET_NAMING

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

Definition at line 80 of file xmltok.c.

◆ 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)] \
& (1u << (((byte)[1]) & 0x1F)))
static const unsigned namingBitmap[]
Definition nametab.h:33

Definition at line 87 of file xmltok.c.

◆ UTF8_GET_NAMING3

#define UTF8_GET_NAMING3 (   pages,
  byte 
)
Value:
[((pages)[((((byte)[0]) & 0xF) << 4) + ((((byte)[1]) >> 2) & 0xF)] \
<< 3) \
+ ((((byte)[1]) & 3) << 1) + ((((byte)[2]) >> 5) & 1)] \
& (1u << (((byte)[2]) & 0x1F)))

Definition at line 97 of file xmltok.c.

◆ UTF8_INVALID2

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

Definition at line 114 of file xmltok.c.

◆ 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)))
apr_pool_t * p
Definition md_event.c:32

Definition at line 117 of file xmltok.c.

◆ 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 126 of file xmltok.c.

◆ utf8_isName4

#define utf8_isName4   isNever

Definition at line 153 of file xmltok.c.

◆ utf8_isNmstrt4

#define utf8_isNmstrt4   isNever

Definition at line 167 of file xmltok.c.

◆ VTABLE

Definition at line 78 of file xmltok.c.

◆ VTABLE1

#define VTABLE1

◆ XML_TOK_IMPL_C [1/3]

#define XML_TOK_IMPL_C

Definition at line 306 of file xmltok.c.

◆ XML_TOK_IMPL_C [2/3]

#define XML_TOK_IMPL_C

Definition at line 306 of file xmltok.c.

◆ XML_TOK_IMPL_C [3/3]

#define XML_TOK_IMPL_C

Definition at line 306 of file xmltok.c.

◆ XML_TOK_NS_C

#define XML_TOK_NS_C

Definition at line 1645 of file xmltok.c.

Enumeration Type Documentation

◆ anonymous enum

Enumerator
UTF8_cval1 
UTF8_cval2 
UTF8_cval3 
UTF8_cval4 

Definition at line 320 of file xmltok.c.

◆ 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 1474 of file xmltok.c.

Function Documentation

◆ _INTERNAL_trim_to_complete_utf8_characters()

void _INTERNAL_trim_to_complete_utf8_characters ( const char from,
const char **  fromLimRef 
)

Definition at line 328 of file xmltok.c.

◆ ascii_toUtf8()

static enum XML_Convert_Result ascii_toUtf8 ( const ENCODING enc,
const char **  fromP,
const char fromLim,
char **  toP,
const char toLim 
)
static

Definition at line 562 of file xmltok.c.

◆ big2_toUtf16()

static enum XML_Convert_Result big2_toUtf16 ( const ENCODING enc,
const char **  fromP,
const char fromLim,
unsigned short **  toP,
const unsigned short toLim 
)
static

Definition at line 733 of file xmltok.c.

◆ big2_toUtf8()

static enum XML_Convert_Result big2_toUtf8 ( const ENCODING enc,
const char **  fromP,
const char fromLim,
char **  toP,
const char toLim 
)
static

Definition at line 732 of file xmltok.c.

◆ checkCharRefNumber()

static int checkCharRefNumber ( int  result)
static

Definition at line 1233 of file xmltok.c.

◆ doParseXmlDecl()

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 1152 of file xmltok.c.

◆ getEncodingIndex()

static int getEncodingIndex ( const char name)
static

Definition at line 1504 of file xmltok.c.

◆ initScan()

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 1532 of file xmltok.c.

◆ initUpdatePosition()

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

Definition at line 1028 of file xmltok.c.

◆ isNever()

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

Definition at line 135 of file xmltok.c.

◆ isSpace()

static int isSpace ( int  c)
static

Definition at line 1046 of file xmltok.c.

◆ latin1_toUtf16()

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

Definition at line 527 of file xmltok.c.

◆ latin1_toUtf8()

static enum XML_Convert_Result latin1_toUtf8 ( const ENCODING enc,
const char **  fromP,
const char fromLim,
char **  toP,
const char toLim 
)
static

Definition at line 504 of file xmltok.c.

◆ little2_toUtf16()

static enum XML_Convert_Result little2_toUtf16 ( const ENCODING enc,
const char **  fromP,
const char fromLim,
unsigned short **  toP,
const unsigned short toLim 
)
static

Definition at line 724 of file xmltok.c.

◆ little2_toUtf8()

static enum XML_Convert_Result little2_toUtf8 ( const ENCODING enc,
const char **  fromP,
const char fromLim,
char **  toP,
const char toLim 
)
static

Definition at line 723 of file xmltok.c.

◆ parsePseudoAttribute()

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 1061 of file xmltok.c.

◆ streqci()

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

Definition at line 1007 of file xmltok.c.

◆ toAscii()

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

Definition at line 1035 of file xmltok.c.

◆ unicode_byte_type()

static int unicode_byte_type ( char  hi,
char  lo 
)
static

Definition at line 597 of file xmltok.c.

◆ unknown_isInvalid()

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

Definition at line 1343 of file xmltok.c.

◆ unknown_isName()

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

Definition at line 1325 of file xmltok.c.

◆ unknown_isNmstrt()

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

Definition at line 1334 of file xmltok.c.

◆ unknown_toUtf16()

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

Definition at line 1380 of file xmltok.c.

◆ unknown_toUtf8()

static enum XML_Convert_Result unknown_toUtf8 ( const ENCODING enc,
const char **  fromP,
const char fromLim,
char **  toP,
const char toLim 
)
static

Definition at line 1350 of file xmltok.c.

◆ utf8_isInvalid2()

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

Definition at line 170 of file xmltok.c.

◆ utf8_isInvalid3()

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

Definition at line 176 of file xmltok.c.

◆ utf8_isInvalid4()

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

Definition at line 182 of file xmltok.c.

◆ utf8_isName2()

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

Definition at line 142 of file xmltok.c.

◆ utf8_isName3()

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

Definition at line 148 of file xmltok.c.

◆ utf8_isNmstrt2()

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

Definition at line 156 of file xmltok.c.

◆ utf8_isNmstrt3()

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

Definition at line 162 of file xmltok.c.

◆ utf8_toUtf16()

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

Definition at line 406 of file xmltok.c.

◆ utf8_toUtf8()

static enum XML_Convert_Result utf8_toUtf8 ( const ENCODING enc,
const char **  fromP,
const char fromLim,
char **  toP,
const char toLim 
)
static

Definition at line 367 of file xmltok.c.

◆ XmlInitUnknownEncoding()

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

Definition at line 1401 of file xmltok.c.

◆ XmlSizeOfUnknownEncoding()

int XmlSizeOfUnknownEncoding ( void  )

Definition at line 1320 of file xmltok.c.

◆ XmlUtf16Encode()

int XmlUtf16Encode ( int  charNum,
unsigned short buf 
)

Definition at line 1293 of file xmltok.c.

◆ XmlUtf8Encode()

int XmlUtf8Encode ( int  c,
char buf 
)

Definition at line 1257 of file xmltok.c.

Variable Documentation

◆ ascii_encoding

const struct normal_encoding ascii_encoding
static
Initial value:
{
#define BT_COLON
},
static enum XML_Convert_Result latin1_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
Definition xmltok.c:527
static enum XML_Convert_Result ascii_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
Definition xmltok.c:562

Definition at line 586 of file xmltok.c.

◆ big2_encoding

const struct normal_encoding big2_encoding
static
Initial value:
0
},
{
#define BT_COLON
},
static enum XML_Convert_Result big2_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
Definition xmltok.c:732
static enum XML_Convert_Result big2_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
Definition xmltok.c:733

Definition at line 962 of file xmltok.c.

◆ internal_big2_encoding

const struct normal_encoding internal_big2_encoding
static

◆ internal_little2_encoding

const struct normal_encoding internal_little2_encoding
static
Initial value:
{
# define BT_COLON
},
static enum XML_Convert_Result little2_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
Definition xmltok.c:723
static enum XML_Convert_Result little2_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
Definition xmltok.c:724

Definition at line 859 of file xmltok.c.

◆ internal_utf8_encoding

const struct normal_encoding internal_utf8_encoding
static
Initial value:
{
#define BT_COLON
},
static int utf8_isNmstrt2(const ENCODING *enc, const char *p)
Definition xmltok.c:156
static int utf8_isNmstrt3(const ENCODING *enc, const char *p)
Definition xmltok.c:162
static int isNever(const ENCODING *enc, const char *p)
Definition xmltok.c:135
static int utf8_isName3(const ENCODING *enc, const char *p)
Definition xmltok.c:148
static int utf8_isInvalid2(const ENCODING *enc, const char *p)
Definition xmltok.c:170
static int utf8_isInvalid3(const ENCODING *enc, const char *p)
Definition xmltok.c:176
static int utf8_isName2(const ENCODING *enc, const char *p)
Definition xmltok.c:142
static enum XML_Convert_Result utf8_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim)
Definition xmltok.c:406
static int utf8_isInvalid4(const ENCODING *enc, const char *p)
Definition xmltok.c:182
static enum XML_Convert_Result utf8_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
Definition xmltok.c:367

Definition at line 493 of file xmltok.c.

◆ KW_encoding

const char KW_encoding[]
static
Initial value:
= { 0x65 , 0x6E , 0x63 , 0x6F , 0x64 ,
0x69 , 0x6E , 0x67 , '\0'}

Definition at line 1140 of file xmltok.c.

◆ KW_ISO_8859_1

const char KW_ISO_8859_1[]
static
Initial value:
= { 0x49 , 0x53 , 0x4F , 0x2D , 0x38 , 0x38 ,
0x35 , 0x39 , 0x2D , 0x31 , '\0'}

Definition at line 1486 of file xmltok.c.

◆ KW_no

const char KW_no[] = { 0x6E , 0x6F , '\0'}
static

Definition at line 1149 of file xmltok.c.

◆ KW_standalone

const char KW_standalone[]
static
Initial value:
= { 0x73 , 0x74 , 0x61 , 0x6E , 0x64 , 0x61 ,
0x6C , 0x6F , 0x6E , 0x65 , '\0'}

Definition at line 1143 of file xmltok.c.

◆ KW_US_ASCII

const char KW_US_ASCII[]
static
Initial value:
= { 0x55 , 0x53 , 0x2D , 0x41 , 0x53 ,
0x43 , 0x49 , 0x49 , '\0'}

Definition at line 1489 of file xmltok.c.

◆ KW_UTF_16

const char KW_UTF_16[] = { 0x55 , 0x54 , 0x46 , 0x2D , 0x31 , 0x36 , '\0'}
static

Definition at line 1494 of file xmltok.c.

◆ KW_UTF_16BE

const char KW_UTF_16BE[]
static
Initial value:
= { 0x55 , 0x54 , 0x46 , 0x2D , 0x31 ,
0x36 , 0x42 , 0x45 , '\0'}

Definition at line 1496 of file xmltok.c.

◆ KW_UTF_16LE

const char KW_UTF_16LE[]
static
Initial value:
= { 0x55 , 0x54 , 0x46 , 0x2D , 0x31 ,
0x36 , 0x4C , 0x45 , '\0'}

Definition at line 1499 of file xmltok.c.

◆ KW_UTF_8

const char KW_UTF_8[] = { 0x55 , 0x54 , 0x46 , 0x2D , 0x38 , '\0'}
static

Definition at line 1492 of file xmltok.c.

◆ KW_version

const char KW_version[] = { 0x76 , 0x65 , 0x72 , 0x73 , 0x69 , 0x6F , 0x6E , '\0'}
static

Definition at line 1137 of file xmltok.c.

◆ KW_yes

const char KW_yes[] = { 0x79 , 0x65 , 0x73 , '\0'}
static

Definition at line 1147 of file xmltok.c.

◆ latin1_encoding

const struct normal_encoding latin1_encoding
static
Initial value:
{
#define BT_COLON
},
static enum XML_Convert_Result latin1_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim)
Definition xmltok.c:504

Definition at line 551 of file xmltok.c.

◆ little2_encoding

const struct normal_encoding little2_encoding
static

◆ utf8_encoding

const struct normal_encoding utf8_encoding
static