Geant4 Cross Reference |
1 /* 1 /* 2 __ __ 2 __ __ _ 3 ___\ \/ /_ __ __ _| 3 ___\ \/ /_ __ __ _| |_ 4 / _ \\ /| '_ \ / _` | 4 / _ \\ /| '_ \ / _` | __| 5 | __// \| |_) | (_| | 5 | __// \| |_) | (_| | |_ 6 \___/_/\_\ .__/ \__,_| 6 \___/_/\_\ .__/ \__,_|\__| 7 |_| XML parse 7 |_| XML parser 8 8 9 Copyright (c) 1997-2000 Thai Open Source So 9 Copyright (c) 1997-2000 Thai Open Source Software Center Ltd 10 Copyright (c) 2000 Clark Cooper <coope 10 Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> 11 Copyright (c) 2002 Fred L. Drake, Jr. 11 Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> 12 Copyright (c) 2002-2005 Karl Waclawek <karl 12 Copyright (c) 2002-2005 Karl Waclawek <karl@waclawek.net> 13 Copyright (c) 2016-2017 Sebastian Pipping < 13 Copyright (c) 2016-2017 Sebastian Pipping <sebastian@pipping.org> 14 Copyright (c) 2017 Rhodri James <rhodr 14 Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk> 15 Licensed under the MIT license: 15 Licensed under the MIT license: 16 16 17 Permission is hereby granted, free of cha 17 Permission is hereby granted, free of charge, to any person obtaining 18 a copy of this software and associat 18 a copy of this software and associated documentation files (the 19 "Software"), to deal in the Software w 19 "Software"), to deal in the Software without restriction, including 20 without limitation the rights to use, c 20 without limitation the rights to use, copy, modify, merge, publish, 21 distribute, sublicense, and/or sell copies 21 distribute, sublicense, and/or sell copies of the Software, and to permit 22 persons to whom the Software is furnish 22 persons to whom the Software is furnished to do so, subject to the 23 following conditions: 23 following conditions: 24 24 25 The above copyright notice and this permis 25 The above copyright notice and this permission notice shall be included 26 in all copies or substantial portions of th 26 in all copies or substantial portions of the Software. 27 27 28 THE SOFTWARE IS PROVIDED "AS IS", WIT 28 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 29 EXPRESS OR IMPLIED, INCLUDING BUT NOT L 29 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 30 MERCHANTABILITY, FITNESS FOR A PARTICULAR P 30 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 31 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HO 31 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 32 DAMAGES OR OTHER LIABILITY, WHETHER IN AN 32 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 33 OTHERWISE, ARISING FROM, OUT OF OR IN CONNE 33 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 34 USE OR OTHER DEALINGS IN THE SOFTWARE. 34 USE OR OTHER DEALINGS IN THE SOFTWARE. 35 */ 35 */ 36 36 37 #ifndef XmlTok_INCLUDED 37 #ifndef XmlTok_INCLUDED 38 #define XmlTok_INCLUDED 1 38 #define XmlTok_INCLUDED 1 39 39 40 #ifdef __cplusplus 40 #ifdef __cplusplus 41 extern "C" { 41 extern "C" { 42 #endif 42 #endif 43 43 44 /* The following token may be returned by XmlC 44 /* The following token may be returned by XmlContentTok */ 45 #define XML_TOK_TRAILING_RSQB 45 #define XML_TOK_TRAILING_RSQB \ 46 -5 /* ] or ]] at the end of the scan; might 46 -5 /* ] or ]] at the end of the scan; might be \ 47 start of illegal ]]> sequence */ 47 start of illegal ]]> sequence */ 48 /* The following tokens may be returned by bot 48 /* The following tokens may be returned by both XmlPrologTok and 49 XmlContentTok. 49 XmlContentTok. 50 */ 50 */ 51 #define XML_TOK_NONE -4 /* The string to be sc 51 #define XML_TOK_NONE -4 /* The string to be scanned is empty */ 52 #define XML_TOK_TRAILING_CR 52 #define XML_TOK_TRAILING_CR \ 53 -3 /* A CR at the 53 -3 /* A CR at the end of the scan; \ 54 might be pa 54 might be part of CRLF sequence */ 55 #define XML_TOK_PARTIAL_CHAR -2 /* only part o 55 #define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ 56 #define XML_TOK_PARTIAL -1 /* only part o 56 #define XML_TOK_PARTIAL -1 /* only part of a token */ 57 #define XML_TOK_INVALID 0 57 #define XML_TOK_INVALID 0 58 58 59 /* The following tokens are returned by XmlCon 59 /* The following tokens are returned by XmlContentTok; some are also 60 returned by XmlAttributeValueTok, XmlEntity 60 returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok. 61 */ 61 */ 62 #define XML_TOK_START_TAG_WITH_ATTS 1 62 #define XML_TOK_START_TAG_WITH_ATTS 1 63 #define XML_TOK_START_TAG_NO_ATTS 2 63 #define XML_TOK_START_TAG_NO_ATTS 2 64 #define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* e 64 #define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */ 65 #define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 65 #define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 66 #define XML_TOK_END_TAG 5 66 #define XML_TOK_END_TAG 5 67 #define XML_TOK_DATA_CHARS 6 67 #define XML_TOK_DATA_CHARS 6 68 #define XML_TOK_DATA_NEWLINE 7 68 #define XML_TOK_DATA_NEWLINE 7 69 #define XML_TOK_CDATA_SECT_OPEN 8 69 #define XML_TOK_CDATA_SECT_OPEN 8 70 #define XML_TOK_ENTITY_REF 9 70 #define XML_TOK_ENTITY_REF 9 71 #define XML_TOK_CHAR_REF 10 /* numeric charact 71 #define XML_TOK_CHAR_REF 10 /* numeric character reference */ 72 72 73 /* The following tokens may be returned by bot 73 /* The following tokens may be returned by both XmlPrologTok and 74 XmlContentTok. 74 XmlContentTok. 75 */ 75 */ 76 #define XML_TOK_PI 11 /* processing inst 76 #define XML_TOK_PI 11 /* processing instruction */ 77 #define XML_TOK_XML_DECL 12 /* XML decl or tex 77 #define XML_TOK_XML_DECL 12 /* XML decl or text decl */ 78 #define XML_TOK_COMMENT 13 78 #define XML_TOK_COMMENT 13 79 #define XML_TOK_BOM 14 /* Byte order mark */ 79 #define XML_TOK_BOM 14 /* Byte order mark */ 80 80 81 /* The following tokens are returned only by X 81 /* The following tokens are returned only by XmlPrologTok */ 82 #define XML_TOK_PROLOG_S 15 82 #define XML_TOK_PROLOG_S 15 83 #define XML_TOK_DECL_OPEN 16 /* <!foo */ 83 #define XML_TOK_DECL_OPEN 16 /* <!foo */ 84 #define XML_TOK_DECL_CLOSE 17 /* > */ 84 #define XML_TOK_DECL_CLOSE 17 /* > */ 85 #define XML_TOK_NAME 18 85 #define XML_TOK_NAME 18 86 #define XML_TOK_NMTOKEN 19 86 #define XML_TOK_NMTOKEN 19 87 #define XML_TOK_POUND_NAME 20 /* #name */ 87 #define XML_TOK_POUND_NAME 20 /* #name */ 88 #define XML_TOK_OR 21 /* | */ 88 #define XML_TOK_OR 21 /* | */ 89 #define XML_TOK_PERCENT 22 89 #define XML_TOK_PERCENT 22 90 #define XML_TOK_OPEN_PAREN 23 90 #define XML_TOK_OPEN_PAREN 23 91 #define XML_TOK_CLOSE_PAREN 24 91 #define XML_TOK_CLOSE_PAREN 24 92 #define XML_TOK_OPEN_BRACKET 25 92 #define XML_TOK_OPEN_BRACKET 25 93 #define XML_TOK_CLOSE_BRACKET 26 93 #define XML_TOK_CLOSE_BRACKET 26 94 #define XML_TOK_LITERAL 27 94 #define XML_TOK_LITERAL 27 95 #define XML_TOK_PARAM_ENTITY_REF 28 95 #define XML_TOK_PARAM_ENTITY_REF 28 96 #define XML_TOK_INSTANCE_START 29 96 #define XML_TOK_INSTANCE_START 29 97 97 98 /* The following occur only in element type de 98 /* The following occur only in element type declarations */ 99 #define XML_TOK_NAME_QUESTION 30 /* nam 99 #define XML_TOK_NAME_QUESTION 30 /* name? */ 100 #define XML_TOK_NAME_ASTERISK 31 /* nam 100 #define XML_TOK_NAME_ASTERISK 31 /* name* */ 101 #define XML_TOK_NAME_PLUS 32 /* nam 101 #define XML_TOK_NAME_PLUS 32 /* name+ */ 102 #define XML_TOK_COND_SECT_OPEN 33 /* <![ 102 #define XML_TOK_COND_SECT_OPEN 33 /* <![ */ 103 #define XML_TOK_COND_SECT_CLOSE 34 /* ]]> 103 #define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */ 104 #define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? 104 #define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ 105 #define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* 105 #define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ 106 #define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ 106 #define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ 107 #define XML_TOK_COMMA 38 107 #define XML_TOK_COMMA 38 108 108 109 /* The following token is returned only by Xml 109 /* The following token is returned only by XmlAttributeValueTok */ 110 #define XML_TOK_ATTRIBUTE_VALUE_S 39 110 #define XML_TOK_ATTRIBUTE_VALUE_S 39 111 111 112 /* The following token is returned only by Xml 112 /* The following token is returned only by XmlCdataSectionTok */ 113 #define XML_TOK_CDATA_SECT_CLOSE 40 113 #define XML_TOK_CDATA_SECT_CLOSE 40 114 114 115 /* With namespace processing this is returned 115 /* With namespace processing this is returned by XmlPrologTok for a 116 name with a colon. 116 name with a colon. 117 */ 117 */ 118 #define XML_TOK_PREFIXED_NAME 41 118 #define XML_TOK_PREFIXED_NAME 41 119 119 120 #ifdef XML_DTD 120 #ifdef XML_DTD 121 # define XML_TOK_IGNORE_SECT 42 121 # define XML_TOK_IGNORE_SECT 42 122 #endif /* XML_DTD */ 122 #endif /* XML_DTD */ 123 123 124 #ifdef XML_DTD 124 #ifdef XML_DTD 125 # define XML_N_STATES 4 125 # define XML_N_STATES 4 126 #else /* not XML_DTD */ 126 #else /* not XML_DTD */ 127 # define XML_N_STATES 3 127 # define XML_N_STATES 3 128 #endif /* not XML_DTD */ 128 #endif /* not XML_DTD */ 129 129 130 #define XML_PROLOG_STATE 0 130 #define XML_PROLOG_STATE 0 131 #define XML_CONTENT_STATE 1 131 #define XML_CONTENT_STATE 1 132 #define XML_CDATA_SECTION_STATE 2 132 #define XML_CDATA_SECTION_STATE 2 133 #ifdef XML_DTD 133 #ifdef XML_DTD 134 # define XML_IGNORE_SECTION_STATE 3 134 # define XML_IGNORE_SECTION_STATE 3 135 #endif /* XML_DTD */ 135 #endif /* XML_DTD */ 136 136 137 #define XML_N_LITERAL_TYPES 2 137 #define XML_N_LITERAL_TYPES 2 138 #define XML_ATTRIBUTE_VALUE_LITERAL 0 138 #define XML_ATTRIBUTE_VALUE_LITERAL 0 139 #define XML_ENTITY_VALUE_LITERAL 1 139 #define XML_ENTITY_VALUE_LITERAL 1 140 140 141 /* The size of the buffer passed to XmlUtf8Enc 141 /* The size of the buffer passed to XmlUtf8Encode must be at least this. */ 142 #define XML_UTF8_ENCODE_MAX 4 142 #define XML_UTF8_ENCODE_MAX 4 143 /* The size of the buffer passed to XmlUtf16En 143 /* The size of the buffer passed to XmlUtf16Encode must be at least this. */ 144 #define XML_UTF16_ENCODE_MAX 2 144 #define XML_UTF16_ENCODE_MAX 2 145 145 146 typedef struct position { 146 typedef struct position { 147 /* first line and first column are 0 not 1 * 147 /* first line and first column are 0 not 1 */ 148 XML_Size lineNumber; 148 XML_Size lineNumber; 149 XML_Size columnNumber; 149 XML_Size columnNumber; 150 } POSITION; 150 } POSITION; 151 151 152 typedef struct { 152 typedef struct { 153 const char *name; 153 const char *name; 154 const char *valuePtr; 154 const char *valuePtr; 155 const char *valueEnd; 155 const char *valueEnd; 156 char normalized; 156 char normalized; 157 } ATTRIBUTE; 157 } ATTRIBUTE; 158 158 159 struct encoding; 159 struct encoding; 160 typedef struct encoding ENCODING; 160 typedef struct encoding ENCODING; 161 161 162 typedef int(PTRCALL *SCANNER)(const ENCODING * 162 typedef int(PTRCALL *SCANNER)(const ENCODING *, const char *, const char *, 163 const char **); 163 const char **); 164 164 165 enum XML_Convert_Result { 165 enum XML_Convert_Result { 166 XML_CONVERT_COMPLETED = 0, 166 XML_CONVERT_COMPLETED = 0, 167 XML_CONVERT_INPUT_INCOMPLETE = 1, 167 XML_CONVERT_INPUT_INCOMPLETE = 1, 168 XML_CONVERT_OUTPUT_EXHAUSTED 168 XML_CONVERT_OUTPUT_EXHAUSTED 169 = 2 /* and therefore potentially input remai 169 = 2 /* and therefore potentially input remaining as well */ 170 }; 170 }; 171 171 172 struct encoding { 172 struct encoding { 173 SCANNER scanners[XML_N_STATES]; 173 SCANNER scanners[XML_N_STATES]; 174 SCANNER literalScanners[XML_N_LITERAL_TYPES] 174 SCANNER literalScanners[XML_N_LITERAL_TYPES]; 175 int(PTRCALL *nameMatchesAscii)(const ENCODIN 175 int(PTRCALL *nameMatchesAscii)(const ENCODING *, const char *, const char *, 176 const char *) 176 const char *); 177 int(PTRFASTCALL *nameLength)(const ENCODING 177 int(PTRFASTCALL *nameLength)(const ENCODING *, const char *); 178 const char *(PTRFASTCALL *skipS)(const ENCOD 178 const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *); 179 int(PTRCALL *getAtts)(const ENCODING *enc, c 179 int(PTRCALL *getAtts)(const ENCODING *enc, const char *ptr, int attsMax, 180 ATTRIBUTE *atts); 180 ATTRIBUTE *atts); 181 int(PTRFASTCALL *charRefNumber)(const ENCODI 181 int(PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); 182 int(PTRCALL *predefinedEntityName)(const ENC 182 int(PTRCALL *predefinedEntityName)(const ENCODING *, const char *, 183 const cha 183 const char *); 184 void(PTRCALL *updatePosition)(const ENCODING 184 void(PTRCALL *updatePosition)(const ENCODING *, const char *ptr, 185 const char *en 185 const char *end, POSITION *); 186 int(PTRCALL *isPublicId)(const ENCODING *enc 186 int(PTRCALL *isPublicId)(const ENCODING *enc, const char *ptr, 187 const char *end, co 187 const char *end, const char **badPtr); 188 enum XML_Convert_Result(PTRCALL *utf8Convert 188 enum XML_Convert_Result(PTRCALL *utf8Convert)(const ENCODING *enc, 189 189 const char **fromP, 190 190 const char *fromLim, char **toP, 191 191 const char *toLim); 192 enum XML_Convert_Result(PTRCALL *utf16Conver 192 enum XML_Convert_Result(PTRCALL *utf16Convert)(const ENCODING *enc, 193 193 const char **fromP, 194 194 const char *fromLim, 195 195 unsigned short **toP, 196 196 const unsigned short *toLim); 197 int minBytesPerChar; 197 int minBytesPerChar; 198 char isUtf8; 198 char isUtf8; 199 char isUtf16; 199 char isUtf16; 200 }; 200 }; 201 201 202 /* Scan the string starting at ptr until the e 202 /* Scan the string starting at ptr until the end of the next complete 203 token, but do not scan past eptr. Return a 203 token, but do not scan past eptr. Return an integer giving the 204 type of token. 204 type of token. 205 205 206 Return XML_TOK_NONE when ptr == eptr; nextT 206 Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. 207 207 208 Return XML_TOK_PARTIAL when the string does 208 Return XML_TOK_PARTIAL when the string does not contain a complete 209 token; nextTokPtr will not be set. 209 token; nextTokPtr will not be set. 210 210 211 Return XML_TOK_INVALID when the string does 211 Return XML_TOK_INVALID when the string does not start a valid 212 token; nextTokPtr will be set to point to t 212 token; nextTokPtr will be set to point to the character which made 213 the token invalid. 213 the token invalid. 214 214 215 Otherwise the string starts with a valid to 215 Otherwise the string starts with a valid token; nextTokPtr will be 216 set to point to the character following the 216 set to point to the character following the end of that token. 217 217 218 Each data character counts as a single toke 218 Each data character counts as a single token, but adjacent data 219 characters may be returned together. Simil 219 characters may be returned together. Similarly for characters in 220 the prolog outside literals, comments and p 220 the prolog outside literals, comments and processing instructions. 221 */ 221 */ 222 222 223 #define XmlTok(enc, state, ptr, end, nextTokPt 223 #define XmlTok(enc, state, ptr, end, nextTokPtr) \ 224 (((enc)->scanners[state])(enc, ptr, end, nex 224 (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) 225 225 226 #define XmlPrologTok(enc, ptr, end, nextTokPtr 226 #define XmlPrologTok(enc, ptr, end, nextTokPtr) \ 227 XmlTok(enc, XML_PROLOG_STATE, ptr, end, next 227 XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) 228 228 229 #define XmlContentTok(enc, ptr, end, nextTokPt 229 #define XmlContentTok(enc, ptr, end, nextTokPtr) \ 230 XmlTok(enc, XML_CONTENT_STATE, ptr, end, nex 230 XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) 231 231 232 #define XmlCdataSectionTok(enc, ptr, end, next 232 #define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ 233 XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, en 233 XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) 234 234 235 #ifdef XML_DTD 235 #ifdef XML_DTD 236 236 237 # define XmlIgnoreSectionTok(enc, ptr, end, n 237 # define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ 238 XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, 238 XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) 239 239 240 #endif /* XML_DTD */ 240 #endif /* XML_DTD */ 241 241 242 /* This is used for performing a 2nd-level tok 242 /* This is used for performing a 2nd-level tokenization on the content 243 of a literal that has already been returned 243 of a literal that has already been returned by XmlTok. 244 */ 244 */ 245 #define XmlLiteralTok(enc, literalType, ptr, e 245 #define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ 246 (((enc)->literalScanners[literalType])(enc, 246 (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) 247 247 248 #define XmlAttributeValueTok(enc, ptr, end, ne 248 #define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ 249 XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITER 249 XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) 250 250 251 #define XmlEntityValueTok(enc, ptr, end, nextT 251 #define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ 252 XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, 252 XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) 253 253 254 #define XmlNameMatchesAscii(enc, ptr1, end1, p 254 #define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ 255 (((enc)->nameMatchesAscii)(enc, ptr1, end1, 255 (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) 256 256 257 #define XmlNameLength(enc, ptr) (((enc)->nameL 257 #define XmlNameLength(enc, ptr) (((enc)->nameLength)(enc, ptr)) 258 258 259 #define XmlSkipS(enc, ptr) (((enc)->skipS)(enc 259 #define XmlSkipS(enc, ptr) (((enc)->skipS)(enc, ptr)) 260 260 261 #define XmlGetAttributes(enc, ptr, attsMax, at 261 #define XmlGetAttributes(enc, ptr, attsMax, atts) \ 262 (((enc)->getAtts)(enc, ptr, attsMax, atts)) 262 (((enc)->getAtts)(enc, ptr, attsMax, atts)) 263 263 264 #define XmlCharRefNumber(enc, ptr) (((enc)->ch 264 #define XmlCharRefNumber(enc, ptr) (((enc)->charRefNumber)(enc, ptr)) 265 265 266 #define XmlPredefinedEntityName(enc, ptr, end) 266 #define XmlPredefinedEntityName(enc, ptr, end) \ 267 (((enc)->predefinedEntityName)(enc, ptr, end 267 (((enc)->predefinedEntityName)(enc, ptr, end)) 268 268 269 #define XmlUpdatePosition(enc, ptr, end, pos) 269 #define XmlUpdatePosition(enc, ptr, end, pos) \ 270 (((enc)->updatePosition)(enc, ptr, end, pos) 270 (((enc)->updatePosition)(enc, ptr, end, pos)) 271 271 272 #define XmlIsPublicId(enc, ptr, end, badPtr) 272 #define XmlIsPublicId(enc, ptr, end, badPtr) \ 273 (((enc)->isPublicId)(enc, ptr, end, badPtr)) 273 (((enc)->isPublicId)(enc, ptr, end, badPtr)) 274 274 275 #define XmlUtf8Convert(enc, fromP, fromLim, to 275 #define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ 276 (((enc)->utf8Convert)(enc, fromP, fromLim, t 276 (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) 277 277 278 #define XmlUtf16Convert(enc, fromP, fromLim, t 278 #define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ 279 (((enc)->utf16Convert)(enc, fromP, fromLim, 279 (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) 280 280 281 typedef struct { 281 typedef struct { 282 ENCODING initEnc; 282 ENCODING initEnc; 283 const ENCODING **encPtr; 283 const ENCODING **encPtr; 284 } INIT_ENCODING; 284 } INIT_ENCODING; 285 285 286 int XmlParseXmlDecl(int isGeneralTextEntity, c 286 int XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc, 287 const char *ptr, const cha 287 const char *ptr, const char *end, const char **badPtr, 288 const char **versionPtr, c 288 const char **versionPtr, const char **versionEndPtr, 289 const char **encodingNameP 289 const char **encodingNamePtr, 290 const ENCODING **namedEnco 290 const ENCODING **namedEncodingPtr, int *standalonePtr); 291 291 292 int XmlInitEncoding(INIT_ENCODING *, const ENC 292 int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); 293 const ENCODING *XmlGetUtf8InternalEncoding(voi 293 const ENCODING *XmlGetUtf8InternalEncoding(void); 294 const ENCODING *XmlGetUtf16InternalEncoding(vo 294 const ENCODING *XmlGetUtf16InternalEncoding(void); 295 int FASTCALL XmlUtf8Encode(int charNumber, cha 295 int FASTCALL XmlUtf8Encode(int charNumber, char *buf); 296 int FASTCALL XmlUtf16Encode(int charNumber, un 296 int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf); 297 int XmlSizeOfUnknownEncoding(void); 297 int XmlSizeOfUnknownEncoding(void); 298 298 299 typedef int(XMLCALL *CONVERTER)(void *userData 299 typedef int(XMLCALL *CONVERTER)(void *userData, const char *p); 300 300 301 ENCODING *XmlInitUnknownEncoding(void *mem, in 301 ENCODING *XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert, 302 void *userDat 302 void *userData); 303 303 304 int XmlParseXmlDeclNS(int isGeneralTextEntity, 304 int XmlParseXmlDeclNS(int isGeneralTextEntity, const ENCODING *enc, 305 const char *ptr, const c 305 const char *ptr, const char *end, const char **badPtr, 306 const char **versionPtr, 306 const char **versionPtr, const char **versionEndPtr, 307 const char **encodingNam 307 const char **encodingNamePtr, 308 const ENCODING **namedEn 308 const ENCODING **namedEncodingPtr, int *standalonePtr); 309 309 310 int XmlInitEncodingNS(INIT_ENCODING *, const E 310 int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); 311 const ENCODING *XmlGetUtf8InternalEncodingNS(v 311 const ENCODING *XmlGetUtf8InternalEncodingNS(void); 312 const ENCODING *XmlGetUtf16InternalEncodingNS( 312 const ENCODING *XmlGetUtf16InternalEncodingNS(void); 313 ENCODING *XmlInitUnknownEncodingNS(void *mem, 313 ENCODING *XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert, 314 void *userD 314 void *userData); 315 #ifdef __cplusplus 315 #ifdef __cplusplus 316 } 316 } 317 #endif 317 #endif 318 318 319 #endif /* not XmlTok_INCLUDED */ 319 #endif /* not XmlTok_INCLUDED */ 320 320