Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
xmltok.h File Reference

Go to the source code of this file.

Classes

struct  position
 
struct  ATTRIBUTE
 
struct  encoding
 
struct  INIT_ENCODING
 

Macros

#define XML_TOK_TRAILING_RSQB
 
#define XML_TOK_NONE   -4 /* The string to be scanned is empty */
 
#define XML_TOK_TRAILING_CR
 
#define XML_TOK_PARTIAL_CHAR   -2 /* only part of a multibyte sequence */
 
#define XML_TOK_PARTIAL   -1 /* only part of a token */
 
#define XML_TOK_INVALID   0
 
#define XML_TOK_START_TAG_WITH_ATTS   1
 
#define XML_TOK_START_TAG_NO_ATTS   2
 
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS   3 /* empty element tag <e/> */
 
#define XML_TOK_EMPTY_ELEMENT_NO_ATTS   4
 
#define XML_TOK_END_TAG   5
 
#define XML_TOK_DATA_CHARS   6
 
#define XML_TOK_DATA_NEWLINE   7
 
#define XML_TOK_CDATA_SECT_OPEN   8
 
#define XML_TOK_ENTITY_REF   9
 
#define XML_TOK_CHAR_REF   10 /* numeric character reference */
 
#define XML_TOK_PI   11 /* processing instruction */
 
#define XML_TOK_XML_DECL   12 /* XML decl or text decl */
 
#define XML_TOK_COMMENT   13
 
#define XML_TOK_BOM   14 /* Byte order mark */
 
#define XML_TOK_PROLOG_S   15
 
#define XML_TOK_DECL_OPEN   16 /* <!foo */
 
#define XML_TOK_DECL_CLOSE   17 /* > */
 
#define XML_TOK_NAME   18
 
#define XML_TOK_NMTOKEN   19
 
#define XML_TOK_POUND_NAME   20 /* #name */
 
#define XML_TOK_OR   21 /* | */
 
#define XML_TOK_PERCENT   22
 
#define XML_TOK_OPEN_PAREN   23
 
#define XML_TOK_CLOSE_PAREN   24
 
#define XML_TOK_OPEN_BRACKET   25
 
#define XML_TOK_CLOSE_BRACKET   26
 
#define XML_TOK_LITERAL   27
 
#define XML_TOK_PARAM_ENTITY_REF   28
 
#define XML_TOK_INSTANCE_START   29
 
#define XML_TOK_NAME_QUESTION   30 /* name? */
 
#define XML_TOK_NAME_ASTERISK   31 /* name* */
 
#define XML_TOK_NAME_PLUS   32 /* name+ */
 
#define XML_TOK_COND_SECT_OPEN   33 /* <![ */
 
#define XML_TOK_COND_SECT_CLOSE   34 /* ]]> */
 
#define XML_TOK_CLOSE_PAREN_QUESTION   35 /* )? */
 
#define XML_TOK_CLOSE_PAREN_ASTERISK   36 /* )* */
 
#define XML_TOK_CLOSE_PAREN_PLUS   37 /* )+ */
 
#define XML_TOK_COMMA   38
 
#define XML_TOK_ATTRIBUTE_VALUE_S   39
 
#define XML_TOK_CDATA_SECT_CLOSE   40
 
#define XML_TOK_PREFIXED_NAME   41
 
#define XML_N_STATES   3
 
#define XML_PROLOG_STATE   0
 
#define XML_CONTENT_STATE   1
 
#define XML_CDATA_SECTION_STATE   2
 
#define XML_N_LITERAL_TYPES   2
 
#define XML_ATTRIBUTE_VALUE_LITERAL   0
 
#define XML_ENTITY_VALUE_LITERAL   1
 
#define XML_UTF8_ENCODE_MAX   4
 
#define XML_UTF16_ENCODE_MAX   2
 
#define XmlTok(enc, state, ptr, end, nextTokPtr)    (((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
 
#define XmlPrologTok(enc, ptr, end, nextTokPtr)    XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
 
#define XmlContentTok(enc, ptr, end, nextTokPtr)    XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
 
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr)    XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
 
#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr)    (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
 
#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr)    XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
 
#define XmlEntityValueTok(enc, ptr, end, nextTokPtr)    XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
 
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2)    (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
 
#define XmlNameLength(enc, ptr)   (((enc)->nameLength)(enc, ptr))
 
#define XmlSkipS(enc, ptr)   (((enc)->skipS)(enc, ptr))
 
#define XmlGetAttributes(enc, ptr, attsMax, atts)    (((enc)->getAtts)(enc, ptr, attsMax, atts))
 
#define XmlCharRefNumber(enc, ptr)   (((enc)->charRefNumber)(enc, ptr))
 
#define XmlPredefinedEntityName(enc, ptr, end)    (((enc)->predefinedEntityName)(enc, ptr, end))
 
#define XmlUpdatePosition(enc, ptr, end, pos)    (((enc)->updatePosition)(enc, ptr, end, pos))
 
#define XmlIsPublicId(enc, ptr, end, badPtr)    (((enc)->isPublicId)(enc, ptr, end, badPtr))
 
#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim)    (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
 
#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim)    (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
 

Typedefs

typedef struct position POSITION
 
typedef struct encoding ENCODING
 
typedef int(PTRCALLSCANNER) (const ENCODING *, const char *, const char *, const char **)
 
typedef int(XMLCALLCONVERTER) (void *userData, const char *p)
 

Enumerations

enum  XML_Convert_Result { XML_CONVERT_COMPLETED = 0 , XML_CONVERT_INPUT_INCOMPLETE = 1 , XML_CONVERT_OUTPUT_EXHAUSTED = 2 }
 

Functions

int XmlParseXmlDecl (int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **versionEndPtr, const char **encodingNamePtr, const ENCODING **namedEncodingPtr, int *standalonePtr)
 
int XmlInitEncoding (INIT_ENCODING *, const ENCODING **, const char *name)
 
const ENCODINGXmlGetUtf8InternalEncoding (void)
 
const ENCODINGXmlGetUtf16InternalEncoding (void)
 
int FASTCALL XmlUtf8Encode (int charNumber, char *buf)
 
int FASTCALL XmlUtf16Encode (int charNumber, unsigned short *buf)
 
int XmlSizeOfUnknownEncoding (void)
 
ENCODINGXmlInitUnknownEncoding (void *mem, int *table, CONVERTER convert, void *userData)
 
int XmlParseXmlDeclNS (int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **versionEndPtr, const char **encodingNamePtr, const ENCODING **namedEncodingPtr, int *standalonePtr)
 
int XmlInitEncodingNS (INIT_ENCODING *, const ENCODING **, const char *name)
 
const ENCODINGXmlGetUtf8InternalEncodingNS (void)
 
const ENCODINGXmlGetUtf16InternalEncodingNS (void)
 
ENCODINGXmlInitUnknownEncodingNS (void *mem, int *table, CONVERTER convert, void *userData)
 

Macro Definition Documentation

◆ XML_ATTRIBUTE_VALUE_LITERAL

#define XML_ATTRIBUTE_VALUE_LITERAL   0

Definition at line 136 of file xmltok.h.

◆ XML_CDATA_SECTION_STATE

#define XML_CDATA_SECTION_STATE   2

Definition at line 130 of file xmltok.h.

◆ XML_CONTENT_STATE

#define XML_CONTENT_STATE   1

Definition at line 129 of file xmltok.h.

◆ XML_ENTITY_VALUE_LITERAL

#define XML_ENTITY_VALUE_LITERAL   1

Definition at line 137 of file xmltok.h.

◆ XML_N_LITERAL_TYPES

#define XML_N_LITERAL_TYPES   2

Definition at line 135 of file xmltok.h.

◆ XML_N_STATES

#define XML_N_STATES   3

Definition at line 125 of file xmltok.h.

◆ XML_PROLOG_STATE

#define XML_PROLOG_STATE   0

Definition at line 128 of file xmltok.h.

◆ XML_TOK_ATTRIBUTE_VALUE_S

#define XML_TOK_ATTRIBUTE_VALUE_S   39

Definition at line 108 of file xmltok.h.

◆ XML_TOK_BOM

#define XML_TOK_BOM   14 /* Byte order mark */

Definition at line 77 of file xmltok.h.

◆ XML_TOK_CDATA_SECT_CLOSE

#define XML_TOK_CDATA_SECT_CLOSE   40

Definition at line 111 of file xmltok.h.

◆ XML_TOK_CDATA_SECT_OPEN

#define XML_TOK_CDATA_SECT_OPEN   8

Definition at line 67 of file xmltok.h.

◆ XML_TOK_CHAR_REF

#define XML_TOK_CHAR_REF   10 /* numeric character reference */

Definition at line 69 of file xmltok.h.

◆ XML_TOK_CLOSE_BRACKET

#define XML_TOK_CLOSE_BRACKET   26

Definition at line 91 of file xmltok.h.

◆ XML_TOK_CLOSE_PAREN

#define XML_TOK_CLOSE_PAREN   24

Definition at line 89 of file xmltok.h.

◆ XML_TOK_CLOSE_PAREN_ASTERISK

#define XML_TOK_CLOSE_PAREN_ASTERISK   36 /* )* */

Definition at line 103 of file xmltok.h.

◆ XML_TOK_CLOSE_PAREN_PLUS

#define XML_TOK_CLOSE_PAREN_PLUS   37 /* )+ */

Definition at line 104 of file xmltok.h.

◆ XML_TOK_CLOSE_PAREN_QUESTION

#define XML_TOK_CLOSE_PAREN_QUESTION   35 /* )? */

Definition at line 102 of file xmltok.h.

◆ XML_TOK_COMMA

#define XML_TOK_COMMA   38

Definition at line 105 of file xmltok.h.

◆ XML_TOK_COMMENT

#define XML_TOK_COMMENT   13

Definition at line 76 of file xmltok.h.

◆ XML_TOK_COND_SECT_CLOSE

#define XML_TOK_COND_SECT_CLOSE   34 /* ]]> */

Definition at line 101 of file xmltok.h.

◆ XML_TOK_COND_SECT_OPEN

#define XML_TOK_COND_SECT_OPEN   33 /* <![ */

Definition at line 100 of file xmltok.h.

◆ XML_TOK_DATA_CHARS

#define XML_TOK_DATA_CHARS   6

Definition at line 65 of file xmltok.h.

◆ XML_TOK_DATA_NEWLINE

#define XML_TOK_DATA_NEWLINE   7

Definition at line 66 of file xmltok.h.

◆ XML_TOK_DECL_CLOSE

#define XML_TOK_DECL_CLOSE   17 /* > */

Definition at line 82 of file xmltok.h.

◆ XML_TOK_DECL_OPEN

#define XML_TOK_DECL_OPEN   16 /* <!foo */

Definition at line 81 of file xmltok.h.

◆ XML_TOK_EMPTY_ELEMENT_NO_ATTS

#define XML_TOK_EMPTY_ELEMENT_NO_ATTS   4

Definition at line 63 of file xmltok.h.

◆ XML_TOK_EMPTY_ELEMENT_WITH_ATTS

#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS   3 /* empty element tag <e/> */

Definition at line 62 of file xmltok.h.

◆ XML_TOK_END_TAG

#define XML_TOK_END_TAG   5

Definition at line 64 of file xmltok.h.

◆ XML_TOK_ENTITY_REF

#define XML_TOK_ENTITY_REF   9

Definition at line 68 of file xmltok.h.

◆ XML_TOK_INSTANCE_START

#define XML_TOK_INSTANCE_START   29

Definition at line 94 of file xmltok.h.

◆ XML_TOK_INVALID

#define XML_TOK_INVALID   0

Definition at line 55 of file xmltok.h.

◆ XML_TOK_LITERAL

#define XML_TOK_LITERAL   27

Definition at line 92 of file xmltok.h.

◆ XML_TOK_NAME

#define XML_TOK_NAME   18

Definition at line 83 of file xmltok.h.

◆ XML_TOK_NAME_ASTERISK

#define XML_TOK_NAME_ASTERISK   31 /* name* */

Definition at line 98 of file xmltok.h.

◆ XML_TOK_NAME_PLUS

#define XML_TOK_NAME_PLUS   32 /* name+ */

Definition at line 99 of file xmltok.h.

◆ XML_TOK_NAME_QUESTION

#define XML_TOK_NAME_QUESTION   30 /* name? */

Definition at line 97 of file xmltok.h.

◆ XML_TOK_NMTOKEN

#define XML_TOK_NMTOKEN   19

Definition at line 84 of file xmltok.h.

◆ XML_TOK_NONE

#define XML_TOK_NONE   -4 /* The string to be scanned is empty */

Definition at line 50 of file xmltok.h.

◆ XML_TOK_OPEN_BRACKET

#define XML_TOK_OPEN_BRACKET   25

Definition at line 90 of file xmltok.h.

◆ XML_TOK_OPEN_PAREN

#define XML_TOK_OPEN_PAREN   23

Definition at line 88 of file xmltok.h.

◆ XML_TOK_OR

#define XML_TOK_OR   21 /* | */

Definition at line 86 of file xmltok.h.

◆ XML_TOK_PARAM_ENTITY_REF

#define XML_TOK_PARAM_ENTITY_REF   28

Definition at line 93 of file xmltok.h.

◆ XML_TOK_PARTIAL

#define XML_TOK_PARTIAL   -1 /* only part of a token */

Definition at line 54 of file xmltok.h.

◆ XML_TOK_PARTIAL_CHAR

#define XML_TOK_PARTIAL_CHAR   -2 /* only part of a multibyte sequence */

Definition at line 53 of file xmltok.h.

◆ XML_TOK_PERCENT

#define XML_TOK_PERCENT   22

Definition at line 87 of file xmltok.h.

◆ XML_TOK_PI

#define XML_TOK_PI   11 /* processing instruction */

Definition at line 74 of file xmltok.h.

◆ XML_TOK_POUND_NAME

#define XML_TOK_POUND_NAME   20 /* #name */

Definition at line 85 of file xmltok.h.

◆ XML_TOK_PREFIXED_NAME

#define XML_TOK_PREFIXED_NAME   41

Definition at line 116 of file xmltok.h.

◆ XML_TOK_PROLOG_S

#define XML_TOK_PROLOG_S   15

Definition at line 80 of file xmltok.h.

◆ XML_TOK_START_TAG_NO_ATTS

#define XML_TOK_START_TAG_NO_ATTS   2

Definition at line 61 of file xmltok.h.

◆ XML_TOK_START_TAG_WITH_ATTS

#define XML_TOK_START_TAG_WITH_ATTS   1

Definition at line 60 of file xmltok.h.

◆ XML_TOK_TRAILING_CR

#define XML_TOK_TRAILING_CR
Value:
-3 /* A CR at the end of the scan; \
might be part of CRLF sequence */

Definition at line 51 of file xmltok.h.

◆ XML_TOK_TRAILING_RSQB

#define XML_TOK_TRAILING_RSQB
Value:
-5 /* ] or ]] at the end of the scan; might be \
start of illegal ]]> sequence */

Definition at line 45 of file xmltok.h.

◆ XML_TOK_XML_DECL

#define XML_TOK_XML_DECL   12 /* XML decl or text decl */

Definition at line 75 of file xmltok.h.

◆ XML_UTF16_ENCODE_MAX

#define XML_UTF16_ENCODE_MAX   2

Definition at line 142 of file xmltok.h.

◆ XML_UTF8_ENCODE_MAX

#define XML_UTF8_ENCODE_MAX   4

Definition at line 140 of file xmltok.h.

◆ XmlAttributeValueTok

#define XmlAttributeValueTok (   enc,
  ptr,
  end,
  nextTokPtr 
)     XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)

Definition at line 246 of file xmltok.h.

◆ XmlCdataSectionTok

#define XmlCdataSectionTok (   enc,
  ptr,
  end,
  nextTokPtr 
)     XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)

Definition at line 230 of file xmltok.h.

◆ XmlCharRefNumber

#define XmlCharRefNumber (   enc,
  ptr 
)    (((enc)->charRefNumber)(enc, ptr))

Definition at line 262 of file xmltok.h.

◆ XmlContentTok

#define XmlContentTok (   enc,
  ptr,
  end,
  nextTokPtr 
)     XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)

Definition at line 227 of file xmltok.h.

◆ XmlEntityValueTok

#define XmlEntityValueTok (   enc,
  ptr,
  end,
  nextTokPtr 
)     XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)

Definition at line 249 of file xmltok.h.

◆ XmlGetAttributes

#define XmlGetAttributes (   enc,
  ptr,
  attsMax,
  atts 
)     (((enc)->getAtts)(enc, ptr, attsMax, atts))

Definition at line 259 of file xmltok.h.

◆ XmlIsPublicId

#define XmlIsPublicId (   enc,
  ptr,
  end,
  badPtr 
)     (((enc)->isPublicId)(enc, ptr, end, badPtr))

Definition at line 270 of file xmltok.h.

◆ XmlLiteralTok

#define XmlLiteralTok (   enc,
  literalType,
  ptr,
  end,
  nextTokPtr 
)     (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))

Definition at line 243 of file xmltok.h.

◆ XmlNameLength

#define XmlNameLength (   enc,
  ptr 
)    (((enc)->nameLength)(enc, ptr))

Definition at line 255 of file xmltok.h.

◆ XmlNameMatchesAscii

#define XmlNameMatchesAscii (   enc,
  ptr1,
  end1,
  ptr2 
)     (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))

Definition at line 252 of file xmltok.h.

◆ XmlPredefinedEntityName

#define XmlPredefinedEntityName (   enc,
  ptr,
  end 
)     (((enc)->predefinedEntityName)(enc, ptr, end))

Definition at line 264 of file xmltok.h.

◆ XmlPrologTok

#define XmlPrologTok (   enc,
  ptr,
  end,
  nextTokPtr 
)     XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)

Definition at line 224 of file xmltok.h.

◆ XmlSkipS

#define XmlSkipS (   enc,
  ptr 
)    (((enc)->skipS)(enc, ptr))

Definition at line 257 of file xmltok.h.

◆ XmlTok

#define XmlTok (   enc,
  state,
  ptr,
  end,
  nextTokPtr 
)     (((enc)->scanners[state])(enc, ptr, end, nextTokPtr))

Definition at line 221 of file xmltok.h.

◆ XmlUpdatePosition

#define XmlUpdatePosition (   enc,
  ptr,
  end,
  pos 
)     (((enc)->updatePosition)(enc, ptr, end, pos))

Definition at line 267 of file xmltok.h.

◆ XmlUtf16Convert

#define XmlUtf16Convert (   enc,
  fromP,
  fromLim,
  toP,
  toLim 
)     (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))

Definition at line 276 of file xmltok.h.

◆ XmlUtf8Convert

#define XmlUtf8Convert (   enc,
  fromP,
  fromLim,
  toP,
  toLim 
)     (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))

Definition at line 273 of file xmltok.h.

Typedef Documentation

◆ CONVERTER

typedef int(XMLCALL * CONVERTER) (void *userData, const char *p)

Definition at line 297 of file xmltok.h.

◆ ENCODING

typedef struct encoding ENCODING

Definition at line 158 of file xmltok.h.

◆ POSITION

typedef struct position POSITION

◆ SCANNER

typedef int(PTRCALL * SCANNER) (const ENCODING *, const char *, const char *, const char **)

Definition at line 160 of file xmltok.h.

Enumeration Type Documentation

◆ XML_Convert_Result

Enumerator
XML_CONVERT_COMPLETED 
XML_CONVERT_INPUT_INCOMPLETE 
XML_CONVERT_OUTPUT_EXHAUSTED 

Definition at line 163 of file xmltok.h.

165 {
@ XML_CONVERT_OUTPUT_EXHAUSTED
Definition: xmltok.h:166
@ XML_CONVERT_COMPLETED
Definition: xmltok.h:164
@ XML_CONVERT_INPUT_INCOMPLETE
Definition: xmltok.h:165

Function Documentation

◆ XmlGetUtf16InternalEncoding()

const ENCODING * XmlGetUtf16InternalEncoding ( void  )

◆ XmlGetUtf16InternalEncodingNS()

const ENCODING * XmlGetUtf16InternalEncodingNS ( void  )

◆ XmlGetUtf8InternalEncoding()

const ENCODING * XmlGetUtf8InternalEncoding ( void  )

◆ XmlGetUtf8InternalEncodingNS()

const ENCODING * XmlGetUtf8InternalEncodingNS ( void  )

◆ XmlInitEncoding()

int XmlInitEncoding ( INIT_ENCODING ,
const ENCODING **  ,
const char *  name 
)

◆ XmlInitEncodingNS()

int XmlInitEncodingNS ( INIT_ENCODING ,
const ENCODING **  ,
const char *  name 
)

◆ XmlInitUnknownEncoding()

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

Definition at line 1406 of file xmltok.c.

1407 {
1408 int i;
1409 struct unknown_encoding *e = (struct unknown_encoding *)mem;
1410 memcpy(mem, &latin1_encoding, sizeof(struct normal_encoding));
1411 for (i = 0; i < 128; i++)
1412 if (latin1_encoding.type[i] != BT_OTHER
1413 && latin1_encoding.type[i] != BT_NONXML && table[i] != i)
1414 return 0;
1415 for (i = 0; i < 256; i++) {
1416 int c = table[i];
1417 if (c == -1) {
1418 e->normal.type[i] = BT_MALFORM;
1419 /* This shouldn't really get used. */
1420 e->utf16[i] = 0xFFFF;
1421 e->utf8[i][0] = 1;
1422 e->utf8[i][1] = 0;
1423 } else if (c < 0) {
1424 if (c < -4)
1425 return 0;
1426 /* Multi-byte sequences need a converter function */
1427 if (! convert)
1428 return 0;
1429 e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2));
1430 e->utf8[i][0] = 0;
1431 e->utf16[i] = 0;
1432 } else if (c < 0x80) {
1433 if (latin1_encoding.type[c] != BT_OTHER
1434 && latin1_encoding.type[c] != BT_NONXML && c != i)
1435 return 0;
1436 e->normal.type[i] = latin1_encoding.type[c];
1437 e->utf8[i][0] = 1;
1438 e->utf8[i][1] = (char)c;
1439 e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c);
1440 } else if (checkCharRefNumber(c) < 0) {
1441 e->normal.type[i] = BT_NONXML;
1442 /* This shouldn't really get used. */
1443 e->utf16[i] = 0xFFFF;
1444 e->utf8[i][0] = 1;
1445 e->utf8[i][1] = 0;
1446 } else {
1447 if (c > 0xFFFF)
1448 return 0;
1449 if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff))
1450 e->normal.type[i] = BT_NMSTRT;
1451 else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff))
1452 e->normal.type[i] = BT_NAME;
1453 else
1454 e->normal.type[i] = BT_OTHER;
1455 e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1);
1456 e->utf16[i] = (unsigned short)c;
1457 }
1458 }
1459 e->userData = userData;
1460 e->convert = convert;
1461 if (convert) {
1462 e->normal.isName2 = unknown_isName;
1463 e->normal.isName3 = unknown_isName;
1464 e->normal.isName4 = unknown_isName;
1465 e->normal.isNmstrt2 = unknown_isNmstrt;
1466 e->normal.isNmstrt3 = unknown_isNmstrt;
1467 e->normal.isNmstrt4 = unknown_isNmstrt;
1468 e->normal.isInvalid2 = unknown_isInvalid;
1469 e->normal.isInvalid3 = unknown_isInvalid;
1470 e->normal.isInvalid4 = unknown_isInvalid;
1471 }
1472 e->normal.enc.utf8Convert = unknown_toUtf8;
1473 e->normal.enc.utf16Convert = unknown_toUtf16;
1474 return &(e->normal.enc);
1475}
BT_OTHER
Definition: asciitab.h:44
BT_NMSTRT
Definition: asciitab.h:52
BT_NAME
Definition: asciitab.h:46
BT_NONXML
Definition: asciitab.h:35
unsigned char type[256]
Definition: xmltok.c:187
ENCODING enc
Definition: xmltok.c:186
unsigned short utf16[256]
Definition: xmltok.c:1318
CONVERTER convert
Definition: xmltok.c:1316
void * userData
Definition: xmltok.c:1317
char utf8[256][4]
Definition: xmltok.c:1319
struct normal_encoding normal
Definition: xmltok.c:1315
BT_MALFORM
Definition: utf8tab.h:66
BT_LEAD2
Definition: utf8tab.h:51
#define UCS2_GET_NAMING(pages, hi, lo)
Definition: xmltok.c:78
int FASTCALL XmlUtf8Encode(int c, char *buf)
Definition: xmltok.c:1262

◆ XmlInitUnknownEncodingNS()

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

◆ XmlParseXmlDecl()

int XmlParseXmlDecl ( int  isGeneralTextEntity,
const ENCODING enc,
const char *  ptr,
const char *  end,
const char **  badPtr,
const char **  versionPtr,
const char **  versionEndPtr,
const char **  encodingNamePtr,
const ENCODING **  namedEncodingPtr,
int *  standalonePtr 
)

◆ XmlParseXmlDeclNS()

int XmlParseXmlDeclNS ( int  isGeneralTextEntity,
const ENCODING enc,
const char *  ptr,
const char *  end,
const char **  badPtr,
const char **  versionPtr,
const char **  versionEndPtr,
const char **  encodingNamePtr,
const ENCODING **  namedEncodingPtr,
int *  standalonePtr 
)

◆ XmlSizeOfUnknownEncoding()

int XmlSizeOfUnknownEncoding ( void  )

Definition at line 1325 of file xmltok.c.

1325 {
1326 return sizeof(struct unknown_encoding);
1327}

◆ XmlUtf16Encode()

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

Definition at line 1298 of file xmltok.c.

1298 {
1299 if (charNum < 0)
1300 return 0;
1301 if (charNum < 0x10000) {
1302 buf[0] = (unsigned short)charNum;
1303 return 1;
1304 }
1305 if (charNum < 0x110000) {
1306 charNum -= 0x10000;
1307 buf[0] = (unsigned short)((charNum >> 10) + 0xD800);
1308 buf[1] = (unsigned short)((charNum & 0x3FF) + 0xDC00);
1309 return 2;
1310 }
1311 return 0;
1312}

◆ XmlUtf8Encode()

int FASTCALL XmlUtf8Encode ( int  charNumber,
char *  buf 
)

Definition at line 1262 of file xmltok.c.

1262 {
1263 enum {
1264 /* minN is minimum legal resulting value for N byte sequence */
1265 min2 = 0x80,
1266 min3 = 0x800,
1267 min4 = 0x10000
1268 };
1269
1270 if (c < 0)
1271 return 0; /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
1272 if (c < min2) {
1273 buf[0] = (char)(c | UTF8_cval1);
1274 return 1;
1275 }
1276 if (c < min3) {
1277 buf[0] = (char)((c >> 6) | UTF8_cval2);
1278 buf[1] = (char)((c & 0x3f) | 0x80);
1279 return 2;
1280 }
1281 if (c < min4) {
1282 buf[0] = (char)((c >> 12) | UTF8_cval3);
1283 buf[1] = (char)(((c >> 6) & 0x3f) | 0x80);
1284 buf[2] = (char)((c & 0x3f) | 0x80);
1285 return 3;
1286 }
1287 if (c < 0x110000) {
1288 buf[0] = (char)((c >> 18) | UTF8_cval4);
1289 buf[1] = (char)(((c >> 12) & 0x3f) | 0x80);
1290 buf[2] = (char)(((c >> 6) & 0x3f) | 0x80);
1291 buf[3] = (char)((c & 0x3f) | 0x80);
1292 return 4;
1293 }
1294 return 0; /* LCOV_EXCL_LINE: this case too is eliminated before calling */
1295}
@ UTF8_cval4
Definition: xmltok.c:322
@ UTF8_cval1
Definition: xmltok.c:319
@ UTF8_cval2
Definition: xmltok.c:320
@ UTF8_cval3
Definition: xmltok.c:321

Referenced by XmlInitUnknownEncoding().