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