1/**
2 * @file
3 *
4 * @brief Regular expressions
5 *
6 * A regular expression engine used for DTD and XML Schema
7 * validation.
8 *
9 * @copyright See Copyright for the status of this software.
10 *
11 * @author Daniel Veillard
12 */
13
14#ifndef __XML_REGEXP_H__
15#define __XML_REGEXP_H__
16
17#include <stdio.h>
18#include <libxml/xmlversion.h>
19#include <libxml/xmlstring.h>
20
21#ifdef LIBXML_REGEXP_ENABLED
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/**
28 * A libxml regular expression
29 */
30typedef struct _xmlRegexp xmlRegexp;
31typedef xmlRegexp *xmlRegexpPtr;
32
33/**
34 * A libxml progressive regular expression evaluation context
35 */
36typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
37typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
38
39/*
40 * The POSIX like API
41 */
42XMLPUBFUN xmlRegexp *
43 xmlRegexpCompile (const xmlChar *regexp);
44XMLPUBFUN void xmlRegFreeRegexp(xmlRegexp *regexp);
45XMLPUBFUN int
46 xmlRegexpExec (xmlRegexp *comp,
47 const xmlChar *value);
48XML_DEPRECATED
49XMLPUBFUN void
50 xmlRegexpPrint (FILE *output,
51 xmlRegexp *regexp);
52XMLPUBFUN int
53 xmlRegexpIsDeterminist(xmlRegexp *comp);
54
55/**
56 * Callback function when doing a transition in the automata
57 *
58 * @param exec the regular expression context
59 * @param token the current token string
60 * @param transdata transition data
61 * @param inputdata input data
62 */
63typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxt *exec,
64 const xmlChar *token,
65 void *transdata,
66 void *inputdata);
67
68/*
69 * The progressive API
70 */
71XML_DEPRECATED
72XMLPUBFUN xmlRegExecCtxt *
73 xmlRegNewExecCtxt (xmlRegexp *comp,
74 xmlRegExecCallbacks callback,
75 void *data);
76XML_DEPRECATED
77XMLPUBFUN void
78 xmlRegFreeExecCtxt (xmlRegExecCtxt *exec);
79XML_DEPRECATED
80XMLPUBFUN int
81 xmlRegExecPushString(xmlRegExecCtxt *exec,
82 const xmlChar *value,
83 void *data);
84XML_DEPRECATED
85XMLPUBFUN int
86 xmlRegExecPushString2(xmlRegExecCtxt *exec,
87 const xmlChar *value,
88 const xmlChar *value2,
89 void *data);
90
91XML_DEPRECATED
92XMLPUBFUN int
93 xmlRegExecNextValues(xmlRegExecCtxt *exec,
94 int *nbval,
95 int *nbneg,
96 xmlChar **values,
97 int *terminal);
98XML_DEPRECATED
99XMLPUBFUN int
100 xmlRegExecErrInfo (xmlRegExecCtxt *exec,
101 const xmlChar **string,
102 int *nbval,
103 int *nbneg,
104 xmlChar **values,
105 int *terminal);
106
107#ifdef __cplusplus
108}
109#endif
110
111#endif /* LIBXML_REGEXP_ENABLED */
112
113#endif /*__XML_REGEXP_H__ */
114