1      * Summary: regular expressions handling
2      * Description: basic API for libxml regular expressions handling used
3      *              for XML Schemas and validation.
4      *
5      * Copy: See Copyright for the status of this software.
6      *
7      * Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
8
9      /if not defined(XML_REGEXP_H__)
10      /define XML_REGEXP_H__
11
12      /include "libxmlrpg/xmlversion"
13
14      /if defined(LIBXML_REGEXP_ENABLED)
15
16      /include "libxmlrpg/xmlTypesC"
17
18      * xmlRegexpPtr:
19      *
20      * A libxml regular expression, they can actually be far more complex
21      * thank the POSIX regex expressions.
22
23     d xmlRegexpPtr    s               *   based(######typedef######)
24
25      * xmlRegExecCtxtPtr:
26      *
27      * A libxml progressive regular expression evaluation context
28
29     d xmlRegExecCtxtPtr...
30     d                 s               *   based(######typedef######)
31
32      /include "libxmlrpg/tree"
33      /include "libxmlrpg/dict"
34
35      * The POSIX like API
36
37     d xmlRegexpCompile...
38     d                 pr                  extproc('xmlRegexpCompile')
39     d                                     like(xmlRegexpPtr)
40     d  regexp                         *   value options(*string)               const xmlChar *
41
42     d xmlRegFreeRegexp...
43     d                 pr                  extproc('xmlRegFreeRegexp')
44     d  regexp                             value like(xmlRegexpPtr)
45
46     d xmlRegexpExec   pr                  extproc('xmlRegexpExec')
47     d                                     like(xmlCint)
48     d  comp                               value like(xmlRegexpPtr)
49     d  value                          *   value options(*string)               const xmlChar *
50
51     d xmlRegexpPrint  pr                  extproc('xmlRegexpPrint')
52     d  output                         *   value                                FILE *
53     d  regexp                             value like(xmlRegexpPtr)
54
55     d xmlRegexpIsDeterminist...
56     d                 pr                  extproc('xmlRegexpIsDeterminist')
57     d                                     like(xmlCint)
58     d  comp                               value like(xmlRegexpPtr)
59
60      * xmlRegExecCallbacks:
61      * @exec: the regular expression context
62      * @token: the current token string
63      * @transdata: transition data
64      * @inputdata: input data
65      *
66      * Callback function when doing a transition in the automata
67
68     d xmlRegExecCallbacks...
69     d                 s               *   based(######typedef######)
70     d                                     procptr
71
72      * The progressive API
73
74     d xmlRegNewExecCtxt...
75     d                 pr                  extproc('xmlRegNewExecCtxt')
76     d                                     like(xmlRegExecCtxtPtr)
77     d  comp                               value like(xmlRegexpPtr)
78     d  callback                           value like(xmlRegExecCallbacks)
79     d  data                           *   value                                void *
80
81     d xmlRegFreeExecCtxt...
82     d                 pr                  extproc('xmlRegFreeExecCtxt')
83     d  exec                               value like(xmlRegExecCtxtPtr)
84
85     d xmlRegExecPushString...
86     d                 pr                  extproc('xmlRegExecPushString')
87     d                                     like(xmlCint)
88     d  exec                               value like(xmlRegExecCtxtPtr)
89     d  value                          *   value options(*string)               const xmlChar *
90     d  data                           *   value                                void *
91
92     d xmlRegExecPushString2...
93     d                 pr                  extproc('xmlRegExecPushString2')
94     d                                     like(xmlCint)
95     d  exec                               value like(xmlRegExecCtxtPtr)
96     d  value                          *   value options(*string)               const xmlChar *
97     d  value2                         *   value options(*string)               const xmlChar *
98     d  data                           *   value                                void *
99
100     d xmlRegExecNextValues...
101     d                 pr                  extproc('xmlRegExecNextValues')
102     d                                     like(xmlCint)
103     d  exec                               value like(xmlRegExecCtxtPtr)
104     d  nbval                              like(xmlCint)
105     d  nbneg                              like(xmlCint)
106     d  values                         *                                        xmlChar * (*)
107     d  terminal                           like(xmlCint)
108
109     d xmlRegExecErrInfo...
110     d                 pr                  extproc('xmlRegExecErrInfo')
111     d                                     like(xmlCint)
112     d  exec                               value like(xmlRegExecCtxtPtr)
113     d  string                         *                                        const xmlChar * (*)
114     d  nbval                              like(xmlCint)
115     d  nbneg                              like(xmlCint)
116     d  values                         *                                        xmlChar * (*)
117     d  terminal                           like(xmlCint)
118
119      /if defined(LIBXML_EXPR_ENABLED)
120
121      * Formal regular expression handling
122      * Its goal is to do some formal work on content models
123
124      * expressions are used within a context
125
126     d xmlExpCtxtPtr   s               *   based(######typedef######)
127
128     d xmlExpFreeCtxt  pr                  extproc('xmlExpFreeCtxt')
129     d  ctxt                               value like(xmlExpCtxtPtr)
130
131     d xmlExpNewCtxt   pr                  extproc('xmlExpNewCtxt')
132     d                                     like(xmlExpCtxtPtr)
133     d  maxNodes                           value like(xmlCint)
134     d  dict                               value like(xmlDictPtr)
135
136     d xmlExpCtxtNbNodes...
137     d                 pr                  extproc('xmlExpCtxtNbNodes')
138     d                                     like(xmlCint)
139     d  ctxt                               value like(xmlExpCtxtPtr)
140
141     d xmlExpCtxtNbCons...
142     d                 pr                  extproc('xmlExpCtxtNbCons')
143     d                                     like(xmlCint)
144     d  ctxt                               value like(xmlExpCtxtPtr)
145
146      * Expressions are trees but the tree is opaque
147
148     d xmlExpNodePtr   s               *   based(######typedef######)
149
150     d xmlExpNodeType  s                   based(######typedef######)
151     d                                     like(xmlCenum)
152     d  XML_EXP_EMPTY  c                   0
153     d  XML_EXP_FORBID...
154     d                 c                   1
155     d  XML_EXP_ATOM   c                   2
156     d  XML_EXP_SEQ    c                   3
157     d  XML_EXP_OR     c                   4
158     d  XML_EXP_COUNT  c                   5
159
160      * 2 core expressions shared by all for the empty language set
161      * and for the set with just the empty token
162
163     d forbiddenExp    s                   import('forbiddenExp')
164     d                                     like(xmlExpNodePtr)
165
166     d emptyExp        s                   import('emptyExp')
167     d                                     like(xmlExpNodePtr)
168
169
170      * Expressions are reference counted internally
171
172     d xmlExpFree      pr                  extproc('xmlExpFree')
173     d  expr                               value like(xmlExpNodePtr)
174
175     d xmlExpRef       pr                  extproc('xmlExpRef')
176     d  expr                               value like(xmlExpNodePtr)
177
178      * constructors can be either manual or from a string
179
180     d xmlExpParse     pr                  extproc('xmlExpParse')
181     d                                     like(xmlExpNodePtr)
182     d  ctxt                               value like(xmlExpCtxtPtr)
183     d  expr                           *   value options(*string)               const char *
184
185     d xmlExpNewAtom   pr                  extproc('xmlExpNewAtom')
186     d                                     like(xmlExpNodePtr)
187     d  ctxt                               value like(xmlExpCtxtPtr)
188     d  name                           *   value options(*string)               const xmlChar *
189     d  len                                value like(xmlCint)
190
191     d xmlExpNewOr     pr                  extproc('xmlExpNewOr')
192     d                                     like(xmlExpNodePtr)
193     d  ctxt                               value like(xmlExpCtxtPtr)
194     d  left                               value like(xmlExpNodePtr)
195     d  right                              value like(xmlExpNodePtr)
196
197     d xmlExpNewSeq    pr                  extproc('xmlExpNewSeq')
198     d                                     like(xmlExpNodePtr)
199     d  ctxt                               value like(xmlExpCtxtPtr)
200     d  left                               value like(xmlExpNodePtr)
201     d  right                              value like(xmlExpNodePtr)
202
203     d xmlExpNewRange  pr                  extproc('xmlExpNewRange')
204     d                                     like(xmlExpNodePtr)
205     d  ctxt                               value like(xmlExpCtxtPtr)
206     d  subset                             value like(xmlExpNodePtr)
207     d  min                                value like(xmlCint)
208     d  max                                value like(xmlCint)
209
210      * The really interesting APIs
211
212     d xmlExpIsNillable...
213     d                 pr                  extproc('xmlExpIsNillable')
214     d                                     like(xmlCint)
215     d  expr                               value like(xmlExpNodePtr)
216
217     d xmlExpMaxToken  pr                  extproc('xmlExpMaxToken')
218     d                                     like(xmlCint)
219     d  expr                               value like(xmlExpNodePtr)
220
221     d xmlExpGetLanguage...
222     d                 pr                  extproc('xmlExpGetLanguage')
223     d                                     like(xmlCint)
224     d  ctxt                               value like(xmlExpCtxtPtr)
225     d  expr                               value like(xmlExpNodePtr)
226     d  langList                       *                                        const xmlChar *(*)
227     d  len                                value like(xmlCint)
228
229     d xmlExpGetStart  pr                  extproc('xmlExpGetStart')
230     d                                     like(xmlCint)
231     d  ctxt                               value like(xmlExpCtxtPtr)
232     d  expr                               value like(xmlExpNodePtr)
233     d  tokList                        *                                        const xmlChar *(*)
234     d  len                                value like(xmlCint)
235
236     d xmlExpStringDerive...
237     d                 pr                  extproc('xmlExpStringDerive')
238     d                                     like(xmlExpNodePtr)
239     d  ctxt                               value like(xmlExpCtxtPtr)
240     d  expr                               value like(xmlExpNodePtr)
241     d  str                            *   value options(*string)               const xmlChar *
242     d  len                                value like(xmlCint)
243
244     d xmlExpExpDerive...
245     d                 pr                  extproc('xmlExpExpDerive')
246     d                                     like(xmlExpNodePtr)
247     d  ctxt                               value like(xmlExpCtxtPtr)
248     d  expr                               value like(xmlExpNodePtr)
249     d  sub                                value like(xmlExpNodePtr)
250
251     d xmlExpSubsume   pr                  extproc('xmlExpSubsume')
252     d                                     like(xmlCint)
253     d  ctxt                               value like(xmlExpCtxtPtr)
254     d  expr                               value like(xmlExpNodePtr)
255     d  sub                                value like(xmlExpNodePtr)
256
257     d xmlExpDump      pr                  extproc('xmlExpDump')
258     d  buf                                value like(xmlBufferPtr)
259     d  expr                               value like(xmlExpNodePtr)
260      /endif                                                                    LIBXML_EXPR_ENABLED
261      /endif                                                                    LIBXML_REGEXP_ENABLD
262      /endif                                                                    XML_REGEXP_H__
263