Debian Codegraph @

include/libxml/parserInternals.h

raw
1 /**
2 * @file
3 *
4 * @brief Internals routines and limits exported by the parser.
5 *
6 * Except for some I/O-related functions, most of these macros and
7 * functions are deprecated.
8 *
9 * @copyright See Copyright for the status of this software.
10 *
11 * @author Daniel Veillard
12 */
13
14 #ifndef __XML_PARSER_INTERNALS_H__
15 #define __XML_PARSER_INTERNALS_H__
16
17 #include <libxml/xmlversion.h>
18 #include <libxml/parser.h>
19 #include <libxml/HTMLparser.h>
20 #include <libxml/chvalid.h>
21 #include <libxml/SAX2.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28 * Push an input on the stack.
29 *
30 * @deprecated Use #xmlCtxtPushInput
31 */
32 #define inputPush xmlCtxtPushInput
33 /**
34 * Pop an input from the stack.
35 *
36 * @deprecated Use #xmlCtxtPushInput
37 */
38 #define inputPop xmlCtxtPopInput
39 /**
40 * Maximum element nesting depth (without XML_PARSE_HUGE).
41 */
42 #define xmlParserMaxDepth 256
43
44 /**
45 * Maximum size allowed for a single text node when building a tree.
46 * This is not a limitation of the parser but a safety boundary feature,
47 * use XML_PARSE_HUGE option to override it.
48 * Introduced in 2.9.0
49 */
50 #define XML_MAX_TEXT_LENGTH 10000000
51
52 /**
53 * Maximum size allowed when XML_PARSE_HUGE is set.
54 */
55 #define XML_MAX_HUGE_LENGTH 1000000000
56
57 /**
58 * Maximum size allowed for a markup identifier.
59 * This is not a limitation of the parser but a safety boundary feature,
60 * use XML_PARSE_HUGE option to override it.
61 * Note that with the use of parsing dictionaries overriding the limit
62 * may result in more runtime memory usage in face of "unfriendly' content
63 * Introduced in 2.9.0
64 */
65 #define XML_MAX_NAME_LENGTH 50000
66
67 /**
68 * Maximum size allowed by the parser for a dictionary by default
69 * This is not a limitation of the parser but a safety boundary feature,
70 * use XML_PARSE_HUGE option to override it.
71 * Introduced in 2.9.0
72 */
73 #define XML_MAX_DICTIONARY_LIMIT 100000000
74
75 /**
76 * Maximum size allowed by the parser for ahead lookup
77 * This is an upper boundary enforced by the parser to avoid bad
78 * behaviour on "unfriendly' content
79 * Introduced in 2.9.0
80 */
81 #define XML_MAX_LOOKUP_LIMIT 10000000
82
83 /**
84 * Identifiers can be longer, but this will be more costly
85 * at runtime.
86 */
87 #define XML_MAX_NAMELEN 100
88
89 /************************************************************************
90 * *
91 * UNICODE version of the macros. *
92 * *
93 ************************************************************************/
94 /**
95 * Macro to check the following production in the XML spec:
96 *
97 * [2] Char ::= #x9 | #xA | #xD | [#x20...]
98 *
99 * any byte character in the accepted range
100 *
101 * @param c an byte value (int)
102 */
103 #define IS_BYTE_CHAR(c) xmlIsChar_ch(c)
104
105 /**
106 * Macro to check the following production in the XML spec:
107 *
108 * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
109 * | [#x10000-#x10FFFF]
110 *
111 * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
112 *
113 * @param c an UNICODE value (int)
114 */
115 #define IS_CHAR(c) xmlIsCharQ(c)
116
117 /**
118 * Behaves like IS_CHAR on single-byte value
119 *
120 * @param c an xmlChar (usually an unsigned char)
121 */
122 #define IS_CHAR_CH(c) xmlIsChar_ch(c)
123
124 /**
125 * Macro to check the following production in the XML spec:
126 *
127 * [3] S ::= (#x20 | #x9 | #xD | #xA)+
128 * @param c an UNICODE value (int)
129 */
130 #define IS_BLANK(c) xmlIsBlankQ(c)
131
132 /**
133 * Behaviour same as IS_BLANK
134 *
135 * @param c an xmlChar value (normally unsigned char)
136 */
137 #define IS_BLANK_CH(c) xmlIsBlank_ch(c)
138
139 /**
140 * Macro to check the following production in the XML spec:
141 *
142 * [85] BaseChar ::= ... long list see REC ...
143 * @param c an UNICODE value (int)
144 */
145 #define IS_BASECHAR(c) xmlIsBaseCharQ(c)
146
147 /**
148 * Macro to check the following production in the XML spec:
149 *
150 * [88] Digit ::= ... long list see REC ...
151 * @param c an UNICODE value (int)
152 */
153 #define IS_DIGIT(c) xmlIsDigitQ(c)
154
155 /**
156 * Behaves like IS_DIGIT but with a single byte argument
157 *
158 * @param c an xmlChar value (usually an unsigned char)
159 */
160 #define IS_DIGIT_CH(c) xmlIsDigit_ch(c)
161
162 /**
163 * Macro to check the following production in the XML spec:
164 *
165 * [87] CombiningChar ::= ... long list see REC ...
166 * @param c an UNICODE value (int)
167 */
168 #define IS_COMBINING(c) xmlIsCombiningQ(c)
169
170 /**
171 * Always false (all combining chars > 0xff)
172 *
173 * @param c an xmlChar (usually an unsigned char)
174 */
175 #define IS_COMBINING_CH(c) 0
176
177 /**
178 * Macro to check the following production in the XML spec:
179 *
180 * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
181 * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
182 * [#x309D-#x309E] | [#x30FC-#x30FE]
183 * @param c an UNICODE value (int)
184 */
185 #define IS_EXTENDER(c) xmlIsExtenderQ(c)
186
187 /**
188 * Behaves like IS_EXTENDER but with a single-byte argument
189 *
190 * @param c an xmlChar value (usually an unsigned char)
191 */
192 #define IS_EXTENDER_CH(c) xmlIsExtender_ch(c)
193
194 /**
195 * Macro to check the following production in the XML spec:
196 *
197 * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
198 * @param c an UNICODE value (int)
199 */
200 #define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c)
201
202 /**
203 * Macro to check the following production in the XML spec:
204 *
205 * [84] Letter ::= BaseChar | Ideographic
206 * @param c an UNICODE value (int)
207 */
208 #define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
209
210 /**
211 * Macro behaves like IS_LETTER, but only check base chars
212 *
213 * @param c an xmlChar value (normally unsigned char)
214 */
215 #define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
216
217 /**
218 * Macro to check [a-zA-Z]
219 *
220 * @param c an xmlChar value
221 */
222 #define IS_ASCII_LETTER(c) ((0x61 <= ((c) | 0x20)) && \
223 (((c) | 0x20) <= 0x7a))
224
225 /**
226 * Macro to check [0-9]
227 *
228 * @param c an xmlChar value
229 */
230 #define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39))
231
232 /**
233 * Macro to check the following production in the XML spec:
234 *
235 * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] |
236 * [-'()+,./:=?;!*#@$_%]
237 * @param c an UNICODE value (int)
238 */
239 #define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c)
240
241 /**
242 * Same as IS_PUBIDCHAR but for single-byte value
243 *
244 * @param c an xmlChar value (normally unsigned char)
245 */
246 #define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
247
248 /*
249 * Global variables used for predefined strings.
250 */
251 /** @cond ignore */
252 XMLPUBVAR const xmlChar xmlStringText[];
253 XMLPUBVAR const xmlChar xmlStringTextNoenc[];
254 XML_DEPRECATED
255 XMLPUBVAR const xmlChar xmlStringComment[];
256 /** @endcond */
257
258 XML_DEPRECATED
259 XMLPUBFUN int xmlIsLetter (int c);
260
261 /*
262 * Parser context.
263 */
264 XMLPUBFUN xmlParserCtxt *
265 xmlCreateFileParserCtxt (const char *filename);
266 XMLPUBFUN xmlParserCtxt *
267 xmlCreateURLParserCtxt (const char *filename,
268 int options);
269 XMLPUBFUN xmlParserCtxt *
270 xmlCreateMemoryParserCtxt(const char *buffer,
271 int size);
272 XML_DEPRECATED
273 XMLPUBFUN xmlParserCtxt *
274 xmlCreateEntityParserCtxt(const xmlChar *URL,
275 const xmlChar *ID,
276 const xmlChar *base);
277 XMLPUBFUN void
278 xmlCtxtErrMemory (xmlParserCtxt *ctxt);
279 XMLPUBFUN int
280 xmlSwitchEncoding (xmlParserCtxt *ctxt,
281 xmlCharEncoding enc);
282 XMLPUBFUN int
283 xmlSwitchEncodingName (xmlParserCtxt *ctxt,
284 const char *encoding);
285 XMLPUBFUN int
286 xmlSwitchToEncoding (xmlParserCtxt *ctxt,
287 xmlCharEncodingHandler *handler);
288 XML_DEPRECATED
289 XMLPUBFUN int
290 xmlSwitchInputEncoding (xmlParserCtxt *ctxt,
291 xmlParserInput *input,
292 xmlCharEncodingHandler *handler);
293
294 /*
295 * Input Streams.
296 */
297 XMLPUBFUN xmlParserInput *
298 xmlNewStringInputStream (xmlParserCtxt *ctxt,
299 const xmlChar *buffer);
300 XML_DEPRECATED
301 XMLPUBFUN xmlParserInput *
302 xmlNewEntityInputStream (xmlParserCtxt *ctxt,
303 xmlEntity *entity);
304 XMLPUBFUN int
305 xmlCtxtPushInput (xmlParserCtxt *ctxt,
306 xmlParserInput *input);
307 XMLPUBFUN xmlParserInput *
308 xmlCtxtPopInput (xmlParserCtxt *ctxt);
309 XML_DEPRECATED
310 XMLPUBFUN int
311 xmlPushInput (xmlParserCtxt *ctxt,
312 xmlParserInput *input);
313 XML_DEPRECATED
314 XMLPUBFUN xmlChar
315 xmlPopInput (xmlParserCtxt *ctxt);
316 XMLPUBFUN void
317 xmlFreeInputStream (xmlParserInput *input);
318 XMLPUBFUN xmlParserInput *
319 xmlNewInputFromFile (xmlParserCtxt *ctxt,
320 const char *filename);
321 XMLPUBFUN xmlParserInput *
322 xmlNewInputStream (xmlParserCtxt *ctxt);
323
324 /*
325 * Namespaces.
326 */
327 XMLPUBFUN xmlChar *
328 xmlSplitQName (xmlParserCtxt *ctxt,
329 const xmlChar *name,
330 xmlChar **prefix);
331
332 /*
333 * Generic production rules.
334 */
335 XML_DEPRECATED
336 XMLPUBFUN const xmlChar *
337 xmlParseName (xmlParserCtxt *ctxt);
338 XML_DEPRECATED
339 XMLPUBFUN xmlChar *
340 xmlParseNmtoken (xmlParserCtxt *ctxt);
341 XML_DEPRECATED
342 XMLPUBFUN xmlChar *
343 xmlParseEntityValue (xmlParserCtxt *ctxt,
344 xmlChar **orig);
345 XML_DEPRECATED
346 XMLPUBFUN xmlChar *
347 xmlParseAttValue (xmlParserCtxt *ctxt);
348 XML_DEPRECATED
349 XMLPUBFUN xmlChar *
350 xmlParseSystemLiteral (xmlParserCtxt *ctxt);
351 XML_DEPRECATED
352 XMLPUBFUN xmlChar *
353 xmlParsePubidLiteral (xmlParserCtxt *ctxt);
354 XML_DEPRECATED
355 XMLPUBFUN void
356 xmlParseCharData (xmlParserCtxt *ctxt,
357 int cdata);
358 XML_DEPRECATED
359 XMLPUBFUN xmlChar *
360 xmlParseExternalID (xmlParserCtxt *ctxt,
361 xmlChar **publicId,
362 int strict);
363 XML_DEPRECATED
364 XMLPUBFUN void
365 xmlParseComment (xmlParserCtxt *ctxt);
366 XML_DEPRECATED
367 XMLPUBFUN const xmlChar *
368 xmlParsePITarget (xmlParserCtxt *ctxt);
369 XML_DEPRECATED
370 XMLPUBFUN void
371 xmlParsePI (xmlParserCtxt *ctxt);
372 XML_DEPRECATED
373 XMLPUBFUN void
374 xmlParseNotationDecl (xmlParserCtxt *ctxt);
375 XML_DEPRECATED
376 XMLPUBFUN void
377 xmlParseEntityDecl (xmlParserCtxt *ctxt);
378 XML_DEPRECATED
379 XMLPUBFUN int
380 xmlParseDefaultDecl (xmlParserCtxt *ctxt,
381 xmlChar **value);
382 XML_DEPRECATED
383 XMLPUBFUN xmlEnumeration *
384 xmlParseNotationType (xmlParserCtxt *ctxt);
385 XML_DEPRECATED
386 XMLPUBFUN xmlEnumeration *
387 xmlParseEnumerationType (xmlParserCtxt *ctxt);
388 XML_DEPRECATED
389 XMLPUBFUN int
390 xmlParseEnumeratedType (xmlParserCtxt *ctxt,
391 xmlEnumeration **tree);
392 XML_DEPRECATED
393 XMLPUBFUN int
394 xmlParseAttributeType (xmlParserCtxt *ctxt,
395 xmlEnumeration **tree);
396 XML_DEPRECATED
397 XMLPUBFUN void
398 xmlParseAttributeListDecl(xmlParserCtxt *ctxt);
399 XML_DEPRECATED
400 XMLPUBFUN xmlElementContent *
401 xmlParseElementMixedContentDecl
402 (xmlParserCtxt *ctxt,
403 int inputchk);
404 XML_DEPRECATED
405 XMLPUBFUN xmlElementContent *
406 xmlParseElementChildrenContentDecl
407 (xmlParserCtxt *ctxt,
408 int inputchk);
409 XML_DEPRECATED
410 XMLPUBFUN int
411 xmlParseElementContentDecl(xmlParserCtxt *ctxt,
412 const xmlChar *name,
413 xmlElementContent **result);
414 XML_DEPRECATED
415 XMLPUBFUN int
416 xmlParseElementDecl (xmlParserCtxt *ctxt);
417 XML_DEPRECATED
418 XMLPUBFUN void
419 xmlParseMarkupDecl (xmlParserCtxt *ctxt);
420 XML_DEPRECATED
421 XMLPUBFUN int
422 xmlParseCharRef (xmlParserCtxt *ctxt);
423 XML_DEPRECATED
424 XMLPUBFUN xmlEntity *
425 xmlParseEntityRef (xmlParserCtxt *ctxt);
426 XML_DEPRECATED
427 XMLPUBFUN void
428 xmlParseReference (xmlParserCtxt *ctxt);
429 XML_DEPRECATED
430 XMLPUBFUN void
431 xmlParsePEReference (xmlParserCtxt *ctxt);
432 XML_DEPRECATED
433 XMLPUBFUN void
434 xmlParseDocTypeDecl (xmlParserCtxt *ctxt);
435 #ifdef LIBXML_SAX1_ENABLED
436 XML_DEPRECATED
437 XMLPUBFUN const xmlChar *
438 xmlParseAttribute (xmlParserCtxt *ctxt,
439 xmlChar **value);
440 XML_DEPRECATED
441 XMLPUBFUN const xmlChar *
442 xmlParseStartTag (xmlParserCtxt *ctxt);
443 XML_DEPRECATED
444 XMLPUBFUN void
445 xmlParseEndTag (xmlParserCtxt *ctxt);
446 #endif /* LIBXML_SAX1_ENABLED */
447 XML_DEPRECATED
448 XMLPUBFUN void
449 xmlParseCDSect (xmlParserCtxt *ctxt);
450 XMLPUBFUN void
451 xmlParseContent (xmlParserCtxt *ctxt);
452 XML_DEPRECATED
453 XMLPUBFUN void
454 xmlParseElement (xmlParserCtxt *ctxt);
455 XML_DEPRECATED
456 XMLPUBFUN xmlChar *
457 xmlParseVersionNum (xmlParserCtxt *ctxt);
458 XML_DEPRECATED
459 XMLPUBFUN xmlChar *
460 xmlParseVersionInfo (xmlParserCtxt *ctxt);
461 XML_DEPRECATED
462 XMLPUBFUN xmlChar *
463 xmlParseEncName (xmlParserCtxt *ctxt);
464 XML_DEPRECATED
465 XMLPUBFUN const xmlChar *
466 xmlParseEncodingDecl (xmlParserCtxt *ctxt);
467 XML_DEPRECATED
468 XMLPUBFUN int
469 xmlParseSDDecl (xmlParserCtxt *ctxt);
470 XML_DEPRECATED
471 XMLPUBFUN void
472 xmlParseXMLDecl (xmlParserCtxt *ctxt);
473 XML_DEPRECATED
474 XMLPUBFUN void
475 xmlParseTextDecl (xmlParserCtxt *ctxt);
476 XML_DEPRECATED
477 XMLPUBFUN void
478 xmlParseMisc (xmlParserCtxt *ctxt);
479 XML_DEPRECATED
480 XMLPUBFUN void
481 xmlParseExternalSubset (xmlParserCtxt *ctxt,
482 const xmlChar *publicId,
483 const xmlChar *systemId);
484
485 /** @cond ignore */
486 #define XML_SUBSTITUTE_NONE 0
487 #define XML_SUBSTITUTE_REF 1
488 #define XML_SUBSTITUTE_PEREF 2
489 #define XML_SUBSTITUTE_BOTH 3
490 /** @endcond */
491 XML_DEPRECATED
492 XMLPUBFUN xmlChar *
493 xmlStringDecodeEntities (xmlParserCtxt *ctxt,
494 const xmlChar *str,
495 int what,
496 xmlChar end,
497 xmlChar end2,
498 xmlChar end3);
499 XML_DEPRECATED
500 XMLPUBFUN xmlChar *
501 xmlStringLenDecodeEntities (xmlParserCtxt *ctxt,
502 const xmlChar *str,
503 int len,
504 int what,
505 xmlChar end,
506 xmlChar end2,
507 xmlChar end3);
508
509 /*
510 * other commodities shared between parser.c and parserInternals.
511 */
512 XML_DEPRECATED
513 XMLPUBFUN int xmlSkipBlankChars (xmlParserCtxt *ctxt);
514 XML_DEPRECATED
515 XMLPUBFUN int xmlStringCurrentChar (xmlParserCtxt *ctxt,
516 const xmlChar *cur,
517 int *len);
518 XML_DEPRECATED
519 XMLPUBFUN void xmlParserHandlePEReference(xmlParserCtxt *ctxt);
520 XML_DEPRECATED
521 XMLPUBFUN int xmlCheckLanguageID (const xmlChar *lang);
522
523 /*
524 * Really core function shared with HTML parser.
525 */
526 XML_DEPRECATED
527 XMLPUBFUN int xmlCurrentChar (xmlParserCtxt *ctxt,
528 int *len);
529 XML_DEPRECATED
530 XMLPUBFUN int xmlCopyCharMultiByte (xmlChar *out,
531 int val);
532 XML_DEPRECATED
533 XMLPUBFUN int xmlCopyChar (int len,
534 xmlChar *out,
535 int val);
536 XML_DEPRECATED
537 XMLPUBFUN void xmlNextChar (xmlParserCtxt *ctxt);
538 XML_DEPRECATED
539 XMLPUBFUN void xmlParserInputShrink (xmlParserInput *in);
540
541 #ifdef __cplusplus
542 }
543 #endif
544 #endif /* __XML_PARSER_INTERNALS_H__ */