xmltok.h (104349) | xmltok.h (178848) |
---|---|
1/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 See the file COPYING for copying permission. 3*/ 4 5#ifndef XmlTok_INCLUDED 6#define XmlTok_INCLUDED 1 7 8#ifdef __cplusplus 9extern "C" { 10#endif 11 12/* The following token may be returned by XmlContentTok */ 13#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be 14 start of illegal ]]> sequence */ 15/* The following tokens may be returned by both XmlPrologTok and 16 XmlContentTok. 17*/ 18#define XML_TOK_NONE -4 /* The string to be scanned is empty */ 19#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; | 1/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 See the file COPYING for copying permission. 3*/ 4 5#ifndef XmlTok_INCLUDED 6#define XmlTok_INCLUDED 1 7 8#ifdef __cplusplus 9extern "C" { 10#endif 11 12/* The following token may be returned by XmlContentTok */ 13#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be 14 start of illegal ]]> sequence */ 15/* The following tokens may be returned by both XmlPrologTok and 16 XmlContentTok. 17*/ 18#define XML_TOK_NONE -4 /* The string to be scanned is empty */ 19#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; |
20 might be part of CRLF sequence */ | 20 might be part of CRLF sequence */ |
21#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ 22#define XML_TOK_PARTIAL -1 /* only part of a token */ 23#define XML_TOK_INVALID 0 24 25/* The following tokens are returned by XmlContentTok; some are also 26 returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok. 27*/ 28#define XML_TOK_START_TAG_WITH_ATTS 1 --- 77 unchanged lines hidden (view full) --- 106 107/* The size of the buffer passed to XmlUtf8Encode must be at least this. */ 108#define XML_UTF8_ENCODE_MAX 4 109/* The size of the buffer passed to XmlUtf16Encode must be at least this. */ 110#define XML_UTF16_ENCODE_MAX 2 111 112typedef struct position { 113 /* first line and first column are 0 not 1 */ | 21#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ 22#define XML_TOK_PARTIAL -1 /* only part of a token */ 23#define XML_TOK_INVALID 0 24 25/* The following tokens are returned by XmlContentTok; some are also 26 returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok. 27*/ 28#define XML_TOK_START_TAG_WITH_ATTS 1 --- 77 unchanged lines hidden (view full) --- 106 107/* The size of the buffer passed to XmlUtf8Encode must be at least this. */ 108#define XML_UTF8_ENCODE_MAX 4 109/* The size of the buffer passed to XmlUtf16Encode must be at least this. */ 110#define XML_UTF16_ENCODE_MAX 2 111 112typedef struct position { 113 /* first line and first column are 0 not 1 */ |
114 unsigned long lineNumber; 115 unsigned long columnNumber; | 114 XML_Size lineNumber; 115 XML_Size columnNumber; |
116} POSITION; 117 118typedef struct { 119 const char *name; 120 const char *valuePtr; 121 const char *valueEnd; 122 char normalized; 123} ATTRIBUTE; 124 125struct encoding; 126typedef struct encoding ENCODING; 127 | 116} POSITION; 117 118typedef struct { 119 const char *name; 120 const char *valuePtr; 121 const char *valueEnd; 122 char normalized; 123} ATTRIBUTE; 124 125struct encoding; 126typedef struct encoding ENCODING; 127 |
128typedef int (FASTCALL *SCANNER)(const ENCODING *, 129 const char *, 130 const char *, 131 const char **); | 128typedef int (PTRCALL *SCANNER)(const ENCODING *, 129 const char *, 130 const char *, 131 const char **); |
132 133struct encoding { 134 SCANNER scanners[XML_N_STATES]; 135 SCANNER literalScanners[XML_N_LITERAL_TYPES]; | 132 133struct encoding { 134 SCANNER scanners[XML_N_STATES]; 135 SCANNER literalScanners[XML_N_LITERAL_TYPES]; |
136 int (FASTCALL *sameName)(const ENCODING *, 137 const char *, 138 const char *); 139 int (FASTCALL *nameMatchesAscii)(const ENCODING *, 140 const char *, 141 const char *, 142 const char *); 143 int (FASTCALL *nameLength)(const ENCODING *, const char *); 144 const char *(FASTCALL *skipS)(const ENCODING *, const char *); 145 int (FASTCALL *getAtts)(const ENCODING *enc, 146 const char *ptr, 147 int attsMax, 148 ATTRIBUTE *atts); 149 int (FASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); 150 int (FASTCALL *predefinedEntityName)(const ENCODING *, 151 const char *, 152 const char *); 153 void (FASTCALL *updatePosition)(const ENCODING *, 154 const char *ptr, 155 const char *end, 156 POSITION *); 157 int (FASTCALL *isPublicId)(const ENCODING *enc, 158 const char *ptr, 159 const char *end, 160 const char **badPtr); 161 void (FASTCALL *utf8Convert)(const ENCODING *enc, | 136 int (PTRCALL *sameName)(const ENCODING *, 137 const char *, 138 const char *); 139 int (PTRCALL *nameMatchesAscii)(const ENCODING *, 140 const char *, 141 const char *, 142 const char *); 143 int (PTRFASTCALL *nameLength)(const ENCODING *, const char *); 144 const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *); 145 int (PTRCALL *getAtts)(const ENCODING *enc, 146 const char *ptr, 147 int attsMax, 148 ATTRIBUTE *atts); 149 int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); 150 int (PTRCALL *predefinedEntityName)(const ENCODING *, 151 const char *, 152 const char *); 153 void (PTRCALL *updatePosition)(const ENCODING *, 154 const char *ptr, 155 const char *end, 156 POSITION *); 157 int (PTRCALL *isPublicId)(const ENCODING *enc, 158 const char *ptr, 159 const char *end, 160 const char **badPtr); 161 void (PTRCALL *utf8Convert)(const ENCODING *enc, 162 const char **fromP, 163 const char *fromLim, 164 char **toP, 165 const char *toLim); 166 void (PTRCALL *utf16Convert)(const ENCODING *enc, |
162 const char **fromP, 163 const char *fromLim, | 167 const char **fromP, 168 const char *fromLim, |
164 char **toP, 165 const char *toLim); 166 void (FASTCALL *utf16Convert)(const ENCODING *enc, 167 const char **fromP, 168 const char *fromLim, 169 unsigned short **toP, 170 const unsigned short *toLim); | 169 unsigned short **toP, 170 const unsigned short *toLim); |
171 int minBytesPerChar; 172 char isUtf8; 173 char isUtf16; 174}; 175 176/* Scan the string starting at ptr until the end of the next complete 177 token, but do not scan past eptr. Return an integer giving the 178 type of token. --- 79 unchanged lines hidden (view full) --- 258#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ 259 (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) 260 261typedef struct { 262 ENCODING initEnc; 263 const ENCODING **encPtr; 264} INIT_ENCODING; 265 | 171 int minBytesPerChar; 172 char isUtf8; 173 char isUtf16; 174}; 175 176/* Scan the string starting at ptr until the end of the next complete 177 token, but do not scan past eptr. Return an integer giving the 178 type of token. --- 79 unchanged lines hidden (view full) --- 258#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ 259 (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) 260 261typedef struct { 262 ENCODING initEnc; 263 const ENCODING **encPtr; 264} INIT_ENCODING; 265 |
266int XmlParseXmlDecl(int isGeneralTextEntity, 267 const ENCODING *enc, 268 const char *ptr, 269 const char *end, 270 const char **badPtr, 271 const char **versionPtr, 272 const char **versionEndPtr, 273 const char **encodingNamePtr, 274 const ENCODING **namedEncodingPtr, 275 int *standalonePtr); | 266int XmlParseXmlDecl(int isGeneralTextEntity, 267 const ENCODING *enc, 268 const char *ptr, 269 const char *end, 270 const char **badPtr, 271 const char **versionPtr, 272 const char **versionEndPtr, 273 const char **encodingNamePtr, 274 const ENCODING **namedEncodingPtr, 275 int *standalonePtr); |
276 | 276 |
277int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); 278const ENCODING *XmlGetUtf8InternalEncoding(void); 279const ENCODING *XmlGetUtf16InternalEncoding(void); 280int XmlUtf8Encode(int charNumber, char *buf); 281int XmlUtf16Encode(int charNumber, unsigned short *buf); | 277int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); 278const ENCODING *XmlGetUtf8InternalEncoding(void); 279const ENCODING *XmlGetUtf16InternalEncoding(void); 280int FASTCALL XmlUtf8Encode(int charNumber, char *buf); 281int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf); 282int XmlSizeOfUnknownEncoding(void); |
282 | 283 |
283int XmlSizeOfUnknownEncoding(void); 284ENCODING * | 284 285typedef int (XMLCALL *CONVERTER) (void *userData, const char *p); 286 287ENCODING * |
285XmlInitUnknownEncoding(void *mem, 286 int *table, | 288XmlInitUnknownEncoding(void *mem, 289 int *table, |
287 int (*conv)(void *userData, const char *p), | 290 CONVERTER convert, |
288 void *userData); 289 | 291 void *userData); 292 |
290int XmlParseXmlDeclNS(int isGeneralTextEntity, 291 const ENCODING *enc, 292 const char *ptr, 293 const char *end, 294 const char **badPtr, 295 const char **versionPtr, 296 const char **versionEndPtr, 297 const char **encodingNamePtr, 298 const ENCODING **namedEncodingPtr, 299 int *standalonePtr); 300int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); 301const ENCODING *XmlGetUtf8InternalEncodingNS(void); 302const ENCODING *XmlGetUtf16InternalEncodingNS(void); 303ENCODING * | 293int XmlParseXmlDeclNS(int isGeneralTextEntity, 294 const ENCODING *enc, 295 const char *ptr, 296 const char *end, 297 const char **badPtr, 298 const char **versionPtr, 299 const char **versionEndPtr, 300 const char **encodingNamePtr, 301 const ENCODING **namedEncodingPtr, 302 int *standalonePtr); 303 304int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); 305const ENCODING *XmlGetUtf8InternalEncodingNS(void); 306const ENCODING *XmlGetUtf16InternalEncodingNS(void); 307ENCODING * |
304XmlInitUnknownEncodingNS(void *mem, 305 int *table, | 308XmlInitUnknownEncodingNS(void *mem, 309 int *table, |
306 int (*conv)(void *userData, const char *p), | 310 CONVERTER convert, |
307 void *userData); 308#ifdef __cplusplus 309} 310#endif 311 312#endif /* not XmlTok_INCLUDED */ | 311 void *userData); 312#ifdef __cplusplus 313} 314#endif 315 316#endif /* not XmlTok_INCLUDED */ |