blob: a7b3b2931fc2f88ef056ce0b8daba1a76b0756b5 [file] [log] [blame]
Daniel Veillard4255d502002-04-16 15:50:10 +00001/*
Daniel Veillardbe586972003-11-18 20:56:51 +00002 * Summary: regular expressions handling
3 * Description: basic API for libxml regular expressions handling used
4 * for XML Schemas and validation.
Daniel Veillard4255d502002-04-16 15:50:10 +00005 *
Daniel Veillardbe586972003-11-18 20:56:51 +00006 * Copy: See Copyright for the status of this software.
Daniel Veillard4255d502002-04-16 15:50:10 +00007 *
Daniel Veillardbe586972003-11-18 20:56:51 +00008 * Author: Daniel Veillard
Daniel Veillard4255d502002-04-16 15:50:10 +00009 */
10
11#ifndef __XML_REGEXP_H__
12#define __XML_REGEXP_H__
13
Daniel Veillard4255d502002-04-16 15:50:10 +000014#include <libxml/xmlversion.h>
Daniel Veillard4255d502002-04-16 15:50:10 +000015
Igor Zlatkovic7ae91bc2002-11-08 17:18:52 +000016#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillard4255d502002-04-16 15:50:10 +000017
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/**
23 * xmlRegexpPtr:
24 *
25 * A libxml regular expression, they can actually be far more complex
26 * thank the POSIX regex expressions.
27 */
28typedef struct _xmlRegexp xmlRegexp;
29typedef xmlRegexp *xmlRegexpPtr;
30
31/**
32 * xmlRegExecCtxtPtr:
33 *
34 * A libxml progressive regular expression evaluation context
35 */
36typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
37typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
38
Daniel Veillard84d70a42002-09-16 10:51:38 +000039#ifdef __cplusplus
40}
41#endif
42#include <libxml/tree.h>
43#ifdef __cplusplus
44extern "C" {
45#endif
46
Daniel Veillard4255d502002-04-16 15:50:10 +000047/*
48 * The POSIX like API
49 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +000050XMLPUBFUN xmlRegexpPtr XMLCALL
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +000051 xmlRegexpCompile (const xmlChar *regexp);
52XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp);
53XMLPUBFUN int XMLCALL
54 xmlRegexpExec (xmlRegexpPtr comp,
Daniel Veillard4255d502002-04-16 15:50:10 +000055 const xmlChar *value);
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +000056XMLPUBFUN void XMLCALL
57 xmlRegexpPrint (FILE *output,
Daniel Veillard4255d502002-04-16 15:50:10 +000058 xmlRegexpPtr regexp);
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +000059XMLPUBFUN int XMLCALL
60 xmlRegexpIsDeterminist(xmlRegexpPtr comp);
Daniel Veillard4255d502002-04-16 15:50:10 +000061
62/*
63 * Callback function when doing a transition in the automata
64 */
65typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
66 const xmlChar *token,
67 void *transdata,
68 void *inputdata);
69
70/*
71 * The progressive API
72 */
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +000073XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
74 xmlRegNewExecCtxt (xmlRegexpPtr comp,
75 xmlRegExecCallbacks callback,
76 void *data);
77XMLPUBFUN void XMLCALL
78 xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
79XMLPUBFUN int XMLCALL
80 xmlRegExecPushString(xmlRegExecCtxtPtr exec,
81 const xmlChar *value,
82 void *data);
83XMLPUBFUN int XMLCALL
84 xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
85 const xmlChar *value,
86 const xmlChar *value2,
87 void *data);
Daniel Veillard4255d502002-04-16 15:50:10 +000088
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000089XMLPUBFUN int XMLCALL
90 xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
91 int *nbval,
Daniel Veillardcc026dc2005-01-12 13:21:17 +000092 int *nbneg,
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000093 xmlChar **values,
94 int *terminal);
95XMLPUBFUN int XMLCALL
96 xmlRegExecErrInfo (xmlRegExecCtxtPtr exec,
97 const xmlChar **string,
98 int *nbval,
Daniel Veillardcc026dc2005-01-12 13:21:17 +000099 int *nbneg,
Daniel Veillardfc0b6f62005-01-09 17:48:02 +0000100 xmlChar **values,
101 int *terminal);
Daniel Veillard4255d502002-04-16 15:50:10 +0000102#ifdef __cplusplus
103}
104#endif
105
106#endif /* LIBXML_REGEXP_ENABLED */
107
108#endif /*__XML_REGEXP_H__ */