Bump to libxml2 2.9.4
[platform/upstream/libxml2.git] / os400 / libxmlrpg / parserInternals.rpgle
1       * Summary: internals routines and limits exported by the parser.
2       * Description: this module exports a number of internal parsing routines
3       *              they are not really all intended for applications but
4       *              can prove useful doing low level processing.
5       *
6       * Copy: See Copyright for the status of this software.
7       *
8       * Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
9
10       /if not defined(XML_PARSER_INTERNALS_H__)
11       /define XML_PARSER_INTERNALS_H__
12
13       /include "libxmlrpg/xmlversion"
14       /include "libxmlrpg/xmlTypesC"
15       /include "libxmlrpg/parser"
16       /include "libxmlrpg/HTMLparser"
17       /include "libxmlrpg/chvalid"
18
19       * xmlParserMaxDepth:
20       *
21       * arbitrary depth limit for the XML documents that we allow to
22       * process. This is not a limitation of the parser but a safety
23       * boundary feature, use XML_PARSE_HUGE option to override it.
24
25      d xmlParserMaxDepth...
26      d                 s                   import('xmlParserMaxDepth')
27      d                                     like(xmlCuint)
28
29       * XML_MAX_TEXT_LENGTH:
30       *
31       * Maximum size allowed for a single text node when building a tree.
32       * This is not a limitation of the parser but a safety boundary feature,
33       * use XML_PARSE_HUGE option to override it.
34       * Introduced in 2.9.0
35
36      d XML_MAX_TEXT_LENGTH...
37      d                 c                   10000000
38
39       * XML_MAX_NAME_LENGTH:
40       *
41       * Maximum size allowed for a markup identitier
42       * This is not a limitation of the parser but a safety boundary feature,
43       * use XML_PARSE_HUGE option to override it.
44       * Note that with the use of parsing dictionaries overriding the limit
45       * may result in more runtime memory usage in face of "unfriendly' content
46       * Introduced in 2.9.0
47
48      d XML_MAX_NAME_LENGTH...
49      d                 c                   50000
50
51       * XML_MAX_DICTIONARY_LIMIT:
52       *
53       * Maximum size allowed by the parser for a dictionary by default
54       * This is not a limitation of the parser but a safety boundary feature,
55       * use XML_PARSE_HUGE option to override it.
56       * Introduced in 2.9.0
57
58      d XML_MAX_DICTIONARY_LIMIT...
59      d                 c                   10000000
60
61       * XML_MAX_LOOKUP_LIMIT:
62       *
63       * Maximum size allowed by the parser for ahead lookup
64       * This is an upper boundary enforced by the parser to avoid bad
65       * behaviour on "unfriendly' content
66       * Introduced in 2.9.0
67
68      d XML_MAX_LOOKUP_LIMIT...
69      d                 c                   10000000
70
71       * XML_MAX_NAMELEN:
72       *
73       * Identifiers can be longer, but this will be more costly
74       * at runtime.
75
76      d XML_MAX_NAMELEN...
77      d                 c                   100
78
79       * INPUT_CHUNK:
80       *
81       * The parser tries to always have that amount of input ready.
82       * One of the point is providing context when reporting errors.
83
84      d INPUT_CHUNK     c                   250
85
86       * Global variables used for predefined strings.
87
88      d xmlStringText   s              4    import('xmlStringText')              \0 in 5th byte
89
90      d xmlStringTextNoenc...
91      d                 s              9    import('xmlStringTextNoenc')         \0 in 10th byte
92
93      d xmlStringComment...
94      d                 s              7    import('xmlStringComment')           \0 in 8th byte
95
96       * Function to finish the work of the macros where needed.
97
98      d xmlIsLetter     pr                  extproc('xmlIsLetter')
99      d                                     like(xmlCint)
100      d c                                   value like(xmlCint)
101
102       * Parser context.
103
104      d xmlCreateFileParserCtxt...
105      d                 pr                  extproc('xmlCreateFileParserCtxt')
106      d                                     like(xmlParserCtxtPtr)
107      d filename                        *   value options(*string)               const char *
108
109      d xmlCreateURLParserCtxt...
110      d                 pr                  extproc('xmlCreateURLParserCtxt')
111      d                                     like(xmlParserCtxtPtr)
112      d filename                        *   value options(*string)               const char *
113      d options                             value like(xmlCint)
114
115      d xmlCreateMemoryParserCtxt...
116      d                 pr                  extproc('xmlCreateMemoryParserCtxt')
117      d                                     like(xmlParserCtxtPtr)
118      d buffer                          *   value options(*string)               const char *
119      d size                                value like(xmlCint)
120
121      d xmlCreateEntityParserCtxt...
122      d                 pr                  extproc('xmlCreateEntityParserCtxt')
123      d                                     like(xmlParserCtxtPtr)
124      d URL                             *   value options(*string)               const xmlChar *
125      d ID                              *   value options(*string)               const xmlChar *
126      d base                            *   value options(*string)               const xmlChar *
127
128      d xmlSwitchEncoding...
129      d                 pr                  extproc('xmlSwitchEncoding')
130      d                                     like(xmlCint)
131      d ctxt                                value like(xmlParserCtxtPtr)
132      d enc                                 value like(xmlCharEncoding)
133
134      d xmlSwitchToEncoding...
135      d                 pr                  extproc('xmlSwitchToEncoding')
136      d                                     like(xmlCint)
137      d ctxt                                value like(xmlParserCtxtPtr)
138      d handler                             value like(xmlCharEncodingHandlerPtr)
139
140      d xmlSwitchInputEncoding...
141      d                 pr                  extproc('xmlSwitchInputEncoding')
142      d                                     like(xmlCint)
143      d ctxt                                value like(xmlParserCtxtPtr)
144      d input                               value like(xmlParserInputPtr)
145      d handler                             value like(xmlCharEncodingHandlerPtr)
146
147       * Input Streams.
148
149      d xmlNewStringInputStream...
150      d                 pr                  extproc('xmlNewStringInputStream')
151      d                                     like(xmlParserInputPtr)
152      d ctxt                                value like(xmlParserCtxtPtr)
153      d buffer                          *   value options(*string)               const xmlChar *
154
155      d xmlNewEntityInputStream...
156      d                 pr                  extproc('xmlNewEntityInputStream')
157      d                                     like(xmlParserInputPtr)
158      d ctxt                                value like(xmlParserCtxtPtr)
159      d entity                              value like(xmlEntityPtr)
160
161      d xmlPushInput    pr                  extproc('xmlPushInput')
162      d                                     like(xmlCint)
163      d ctxt                                value like(xmlParserCtxtPtr)
164      d input                               value like(xmlParserInputPtr)
165
166      d xmlPopInput     pr                  extproc('xmlPopInput')
167      d                                     like(xmlChar)
168      d ctxt                                value like(xmlParserCtxtPtr)
169
170      d xmlFreeInputStream...
171      d                 pr                  extproc('xmlFreeInputStream')
172      d input                               value like(xmlParserInputPtr)
173
174      d xmlNewInputFromFile...
175      d                 pr                  extproc('xmlNewInputFromFile')
176      d                                     like(xmlParserInputPtr)
177      d ctxt                                value like(xmlParserCtxtPtr)
178      d filename                        *   value options(*string)               const char *
179
180      d xmlNewInputStream...
181      d                 pr                  extproc('xmlNewInputStream')
182      d                                     like(xmlParserInputPtr)
183      d ctxt                                value like(xmlParserCtxtPtr)
184
185       * Namespaces.
186
187      d xmlSplitQName   pr              *   extproc('xmlSplitQName')             xmlChar *
188      d ctxt                                value like(xmlParserCtxtPtr)
189      d name                            *   value options(*string)               const xmlChar *
190      d prefix                          *                                        xmlChar *(*)
191
192       * Generic production rules.
193
194      d xmlParseName    pr              *   extproc('xmlParseName')              const xmlChar *
195      d ctxt                                value like(xmlParserCtxtPtr)
196
197      d xmlParseNmtoken...
198      d                 pr              *   extproc('xmlParseNmtoken')           xmlChar *
199      d ctxt                                value like(xmlParserCtxtPtr)
200
201      d xmlParseEntityValue...
202      d                 pr              *   extproc('xmlParseEntityValue')       xmlChar *
203      d ctxt                                value like(xmlParserCtxtPtr)
204      d orig                            *                                        xmlChar *(*)
205
206      d xmlParseAttValue...
207      d                 pr              *   extproc('xmlParseAttValue')          xmlChar *
208      d ctxt                                value like(xmlParserCtxtPtr)
209
210      d xmlParseSystemLiteral...
211      d                 pr              *   extproc('xmlParseSystemLiteral')     xmlChar *
212      d ctxt                                value like(xmlParserCtxtPtr)
213
214      d xmlParsePubidLiteral...
215      d                 pr              *   extproc('xmlParsePubidLiteral')      xmlChar *
216      d ctxt                                value like(xmlParserCtxtPtr)
217
218      d xmlParseCharData...
219      d                 pr                  extproc('xmlParseCharData')
220      d ctxt                                value like(xmlParserCtxtPtr)
221      d cdata                               value like(xmlCint)
222
223      d xmlParseExternalID...
224      d                 pr              *   extproc('xmlParseExternalID')        xmlChar *
225      d ctxt                                value like(xmlParserCtxtPtr)
226      d publicID                        *                                        xmlChar *(*)
227      d strict                              value like(xmlCint)
228
229      d xmlParseComment...
230      d                 pr                  extproc('xmlParseComment')
231      d ctxt                                value like(xmlParserCtxtPtr)
232
233      d xmlParsePITarget...
234      d                 pr              *   extproc('xmlParsePITarget')          const xmlChar *
235      d ctxt                                value like(xmlParserCtxtPtr)
236
237      d xmlParsePI      pr                  extproc('xmlParsePI')
238      d ctxt                                value like(xmlParserCtxtPtr)
239
240      d xmlParseNotationDecl...
241      d                 pr                  extproc('xmlParseNotationDecl')
242      d ctxt                                value like(xmlParserCtxtPtr)
243
244      d xmlParseEntityDecl...
245      d                 pr                  extproc('xmlParseEntityDecl')
246      d ctxt                                value like(xmlParserCtxtPtr)
247
248      d xmlParseDefaultDecl...
249      d                 pr                  extproc('xmlParseDefaultDecl')
250      d                                     like(xmlCint)
251      d ctxt                                value like(xmlParserCtxtPtr)
252      d value                           *                                        xmlChar *(*)
253
254      d xmlParseNotationType...
255      d                 pr                  extproc('xmlParseNotationType')
256      d                                     like(xmlEnumerationPtr)
257      d ctxt                                value like(xmlParserCtxtPtr)
258
259      d xmlParseEnumerationType...
260      d                 pr                  extproc('xmlParseEnumerationType')
261      d                                     like(xmlEnumerationPtr)
262      d ctxt                                value like(xmlParserCtxtPtr)
263
264      d xmlParseEnumeratedType...
265      d                 pr                  extproc('xmlParseEnumeratedType')
266      d                                     like(xmlCint)
267      d ctxt                                value like(xmlParserCtxtPtr)
268      d tree                            *   value                                xmlEnumerationPtr *
269
270      d xmlParseAttributeType...
271      d                 pr                  extproc('xmlParseAttributeType')
272      d                                     like(xmlCint)
273      d ctxt                                value like(xmlParserCtxtPtr)
274      d tree                            *   value                                xmlEnumerationPtr *
275
276      d xmlParseAttributeListDecl...
277      d                 pr                  extproc('xmlParseAttributeListDecl')
278      d ctxt                                value like(xmlParserCtxtPtr)
279
280      d xmlParseElementMixedContentDecl...
281      d                 pr                  extproc(
282      d                                     'xmlParseElementMixedContentDecl')
283      d                                     like(xmlElementContentPtr)
284      d ctxt                                value like(xmlParserCtxtPtr)
285      d inputchk                            value like(xmlCint)
286
287      d xmlParseElementChildrenContentDecl...
288      d                 pr                  extproc(
289      d                                     'xmlParseElementChildrenContentDecl')
290      d                                     like(xmlElementContentPtr)
291      d ctxt                                value like(xmlParserCtxtPtr)
292      d inputchk                            value like(xmlCint)
293
294      d xmlParseElementContentDecl...
295      d                 pr                  extproc('xmlParseElementContentDecl')
296      d                                     like(xmlCint)
297      d ctxt                                value like(xmlParserCtxtPtr)
298      d name                            *   value options(*string)               const xmlChar *
299      d result                          *   value                                xmlElementContentPtr
300      d                                                                          *
301
302      d xmlParseElementDecl...
303      d                 pr                  extproc('xmlParseElementDecl')
304      d                                     like(xmlCint)
305      d ctxt                                value like(xmlParserCtxtPtr)
306
307      d xmlParseMarkupDecl...
308      d                 pr                  extproc('xmlParseMarkupDecl')
309      d ctxt                                value like(xmlParserCtxtPtr)
310
311      d xmlParseCharRef...
312      d                 pr                  extproc('xmlParseCharRef')
313      d                                     like(xmlCint)
314      d ctxt                                value like(xmlParserCtxtPtr)
315
316      d xmlParseEntityRef...
317      d                 pr                  extproc('xmlParseEntityRef')
318      d                                     like(xmlEntityPtr)
319      d ctxt                                value like(xmlParserCtxtPtr)
320
321      d xmlParseReference...
322      d                 pr                  extproc('xmlParseReference')
323      d ctxt                                value like(xmlParserCtxtPtr)
324
325      d xmlParsePEReference...
326      d                 pr                  extproc('xmlParsePEReference')
327      d ctxt                                value like(xmlParserCtxtPtr)
328
329      d xmlParseDocTypeDecl...
330      d                 pr                  extproc('xmlParseDocTypeDecl')
331      d ctxt                                value like(xmlParserCtxtPtr)
332
333       /if defined(LIBXML_SAX1_ENABLED)
334      d xmlParseAttribute...
335      d                 pr              *   extproc('xmlParseAttribute')         const xmlChar *
336      d ctxt                                value like(xmlParserCtxtPtr)
337      d value                           *                                        xmlChar *(*)
338
339      d xmlParseStartTag...
340      d                 pr              *   extproc('xmlParseStartTag')          const xmlChar *
341      d ctxt                                value like(xmlParserCtxtPtr)
342
343      d xmlParseEndTag  pr                  extproc('xmlParseEndTag')
344      d ctxt                                value like(xmlParserCtxtPtr)
345       /endif                                                                    LIBXML_SAX1_ENABLED
346
347      d xmlParseCDSect  pr                  extproc('xmlParseCDSect')
348      d ctxt                                value like(xmlParserCtxtPtr)
349
350      d xmlParseContent...
351      d                 pr                  extproc('xmlParseContent')
352      d ctxt                                value like(xmlParserCtxtPtr)
353
354      d xmlParseElement...
355      d                 pr                  extproc('xmlParseElement')
356      d ctxt                                value like(xmlParserCtxtPtr)
357
358      d xmlParseVersionNum...
359      d                 pr              *   extproc('xmlParseVersionNum')        xmlChar *
360      d ctxt                                value like(xmlParserCtxtPtr)
361
362      d xmlParseVersionInfo...
363      d                 pr              *   extproc('xmlParseVersionInfo')       xmlChar *
364      d ctxt                                value like(xmlParserCtxtPtr)
365
366      d xmlParseEncName...
367      d                 pr              *   extproc('xmlParseEncName')           xmlChar *
368      d ctxt                                value like(xmlParserCtxtPtr)
369
370      d xmlParseEncodingDecl...
371      d                 pr              *   extproc('xmlParseEncodingDecl')      const xmlChar *
372      d ctxt                                value like(xmlParserCtxtPtr)
373
374      d xmlParseSDDecl  pr                  extproc('xmlParseSDDecl')
375      d                                     like(xmlCint)
376      d ctxt                                value like(xmlParserCtxtPtr)
377
378      d xmlParseXMLDecl...
379      d                 pr                  extproc('xmlParseXMLDecl')
380      d ctxt                                value like(xmlParserCtxtPtr)
381
382      d xmlParseTextDecl...
383      d                 pr                  extproc('xmlParseTextDecl')
384      d ctxt                                value like(xmlParserCtxtPtr)
385
386      d xmlParseMisc    pr                  extproc('xmlParseMisc')
387      d ctxt                                value like(xmlParserCtxtPtr)
388
389      d xmlParseExternalSubset...
390      d                 pr                  extproc('xmlParseExternalSubset')
391      d ctxt                                value like(xmlParserCtxtPtr)
392      d ExternalID                      *   value options(*string)               const xmlChar *
393      d SystemID                        *   value options(*string)               const xmlChar *
394
395       * XML_SUBSTITUTE_NONE:
396       *
397       * If no entities need to be substituted.
398
399      d XML_SUBSTITUTE_NONE...
400      d                 c                   0
401
402       * XML_SUBSTITUTE_REF:
403       *
404       * Whether general entities need to be substituted.
405
406      d XML_SUBSTITUTE_REF...
407      d                 c                   1
408
409       * XML_SUBSTITUTE_PEREF:
410       *
411       * Whether parameter entities need to be substituted.
412
413      d XML_SUBSTITUTE_PEREF...
414      d                 c                   2
415
416       * XML_SUBSTITUTE_BOTH:
417       *
418       * Both general and parameter entities need to be substituted.
419
420      d XML_SUBSTITUTE_BOTH...
421      d                 c                   3
422
423      d xmlStringDecodeEntities...
424      d                 pr              *   extproc('xmlStringDecodeEntities')   xmlChar *
425      d ctxt                                value like(xmlParserCtxtPtr)
426      d str                             *   value options(*string)               const xmlChar *
427      d what                                value like(xmlCint)
428      d end                                 value like(xmlChar)
429      d end2                                value like(xmlChar)
430      d end3                                value like(xmlChar)
431
432      d xmlStringLenDecodeEntities...
433      d                 pr              *   extproc('xmlStringLenDecodeEntities')xmlChar *
434      d ctxt                                value like(xmlParserCtxtPtr)
435      d str                             *   value options(*string)               const xmlChar *
436      d len                                 value like(xmlCint)
437      d what                                value like(xmlCint)
438      d end                                 value like(xmlChar)
439      d end2                                value like(xmlChar)
440      d end3                                value like(xmlChar)
441
442       * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
443
444      d nodePush        pr                  extproc('nodePush')
445      d                                     like(xmlCint)
446      d ctxt                                value like(xmlParserCtxtPtr)
447      d value                               value like(xmlNodePtr)
448
449      d nodePop         pr                  extproc('nodePop')
450      d                                     like(xmlNodePtr)
451      d ctxt                                value like(xmlParserCtxtPtr)
452
453      d inputPush       pr                  extproc('inputPush')
454      d                                     like(xmlCint)
455      d ctxt                                value like(xmlParserCtxtPtr)
456      d value                               value like(xmlParserInputPtr)
457
458      d inputPop        pr                  extproc('inputPop')
459      d                                     like(xmlParserInputPtr)
460      d ctxt                                value like(xmlParserCtxtPtr)
461
462      d namePop         pr              *   extproc('namePop')                   const xmlChar *
463      d ctxt                                value like(xmlParserCtxtPtr)
464
465      d namePush        pr                  extproc('namePush')
466      d                                     like(xmlCint)
467      d ctxt                                value like(xmlParserCtxtPtr)
468      d value                           *   value options(*string)               const xmlChar *
469
470       * other commodities shared between parser.c and parserInternals.
471
472      d xmlSkipBlankChars...
473      d                 pr                  extproc('xmlSkipBlankChars')
474      d                                     like(xmlCint)
475      d ctxt                                value like(xmlParserCtxtPtr)
476
477      d xmlStringCurrentChar...
478      d                 pr                  extproc('xmlStringCurrentChar')
479      d                                     like(xmlCint)
480      d ctxt                                value like(xmlParserCtxtPtr)
481      d cur                             *   value options(*string)               const xmlChar *
482      d len                             *   value                                int *
483
484      d xmlParserHandlePEReference...
485      d                 pr                  extproc('xmlParserHandlePEReference')
486      d ctxt                                value like(xmlParserCtxtPtr)
487
488      d xmlCheckLanguageID...
489      d                 pr                  extproc('xmlCheckLanguageID')
490      d                                     like(xmlCint)
491      d lang                            *   value options(*string)               const xmlChar *
492
493       * Really core function shared with HTML parser.
494
495      d xmlCurrentChar  pr                  extproc('xmlCurrentChar')
496      d                                     like(xmlCint)
497      d ctxt                                value like(xmlParserCtxtPtr)
498      d len                             *   value                                int *
499
500      d xmlCopyCharMultiByte...
501      d                 pr                  extproc('xmlCopyCharMultiByte')
502      d                                     like(xmlCint)
503      d out                             *   value options(*string)               xmlChar *
504      d val                                 value like(xmlCint)
505
506      d xmlCopyChar     pr                  extproc('xmlCopyChar')
507      d                                     like(xmlCint)
508      d len                                 value like(xmlCint)
509      d out                             *   value options(*string)               xmlChar *
510      d val                                 value like(xmlCint)
511
512      d xmlNextChar     pr                  extproc('xmlNextChar')
513      d ctxt                                value like(xmlParserCtxtPtr)
514
515      d xmlParserInputShrink...
516      d                 pr                  extproc('xmlParserInputShrink')
517      d in                                  value like(xmlParserInputPtr)
518
519       /if defined(LIBXML_HTML_ENABLED)
520
521       * Actually comes from the HTML parser but launched from the init stuff.
522
523      d htmlInitAutoClose...
524      d                 pr                  extproc('htmlInitAutoClose')
525
526      d htmlCreateFileParserCtxt...
527      d                 pr                  extproc('htmlCreateFileParserCtxt')
528      d                                     like(htmlParserCtxtPtr)
529      d filename                        *   value options(*string)               const char *
530      d encoding                        *   value options(*string)               const char *
531       /endif
532
533       * Specific function to keep track of entities references
534       * and used by the XSLT debugger.
535
536       /if defined(LIBXML_LEGACY_ENABLED)
537       * xmlEntityReferenceFunc:
538       * @ent: the entity
539       * @firstNode:  the fist node in the chunk
540       * @lastNode:  the last nod in the chunk
541       *
542       * Callback function used when one needs to be able to track back the
543       * provenance of a chunk of nodes inherited from an entity replacement.
544
545      d xmlEntityReferenceFunc...
546      d                 s               *   based(######typedef######)
547      d                                     procptr
548
549      d xmlSetEntityReferenceFunc...
550      d                 pr                  extproc('xmlSetEntityReferenceFunc')
551      d func                                value like(xmlEntityReferenceFunc)
552
553      d xmlParseQuotedString...
554      d                 pr              *   extproc('xmlParseQuotedString')      xmlChar *
555      d ctxt                                value like(xmlParserCtxtPtr)
556
557      d xmlParseNamespace...
558      d                 pr                  extproc('xmlParseNamespace')
559      d ctxt                                value like(xmlParserCtxtPtr)
560
561      d xmlNamespaceParseNSDef...
562      d                 pr              *   extproc('xmlNamespaceParseNSDef')    xmlChar *
563      d ctxt                                value like(xmlParserCtxtPtr)
564
565      d xmlScanName     pr              *   extproc('xmlScanName')               xmlChar *
566      d ctxt                                value like(xmlParserCtxtPtr)
567
568      d xmlNamespaceParseNCName...
569      d                 pr              *   extproc('xmlNamespaceParseNCName')   xmlChar *
570      d ctxt                                value like(xmlParserCtxtPtr)
571
572      d xmlParserHandleReference...
573      d                 pr                  extproc('xmlParserHandleReference')
574      d ctxt                                value like(xmlParserCtxtPtr)
575
576      d xmlNamespaceParseQName...
577      d                 pr              *   extproc('xmlNamespaceParseQName')    xmlChar *
578      d ctxt                                value like(xmlParserCtxtPtr)
579      d prefix                          *                                        xmlChar *(*)
580
581       * Entities
582
583      d xmlDecodeEntities...
584      d                 pr              *   extproc('xmlDecodeEntities')         xmlChar *
585      d ctxt                                value like(xmlParserCtxtPtr)
586      d len                                 value like(xmlCint)
587      d what                                value like(xmlCint)
588      d end                                 value like(xmlChar)
589      d end2                                value like(xmlChar)
590      d end3                                value like(xmlChar)
591
592      d xmlHandleEntity...
593      d                 pr                  extproc('xmlHandleEntity')
594      d ctxt                                value like(xmlParserCtxtPtr)
595      d entity                              value like(xmlEntityPtr)
596       /endif                                                                    LIBXML_LEGACY_ENABLD
597
598       /endif