Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 1 | /* |
Daniel Veillard | be58697 | 2003-11-18 20:56:51 +0000 | [diff] [blame] | 2 | * Summary: regular expressions handling |
| 3 | * Description: basic API for libxml regular expressions handling used |
| 4 | * for XML Schemas and validation. |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 5 | * |
Daniel Veillard | be58697 | 2003-11-18 20:56:51 +0000 | [diff] [blame] | 6 | * Copy: See Copyright for the status of this software. |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 7 | * |
Daniel Veillard | be58697 | 2003-11-18 20:56:51 +0000 | [diff] [blame] | 8 | * Author: Daniel Veillard |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #ifndef __XML_REGEXP_H__ |
| 12 | #define __XML_REGEXP_H__ |
| 13 | |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 14 | #include <libxml/xmlversion.h> |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 15 | |
Igor Zlatkovic | 7ae91bc | 2002-11-08 17:18:52 +0000 | [diff] [blame] | 16 | #ifdef LIBXML_REGEXP_ENABLED |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "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 | */ |
| 28 | typedef struct _xmlRegexp xmlRegexp; |
| 29 | typedef xmlRegexp *xmlRegexpPtr; |
| 30 | |
| 31 | /** |
| 32 | * xmlRegExecCtxtPtr: |
| 33 | * |
| 34 | * A libxml progressive regular expression evaluation context |
| 35 | */ |
| 36 | typedef struct _xmlRegExecCtxt xmlRegExecCtxt; |
| 37 | typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; |
| 38 | |
Daniel Veillard | 84d70a4 | 2002-09-16 10:51:38 +0000 | [diff] [blame] | 39 | #ifdef __cplusplus |
| 40 | } |
| 41 | #endif |
| 42 | #include <libxml/tree.h> |
| 43 | #ifdef __cplusplus |
| 44 | extern "C" { |
| 45 | #endif |
| 46 | |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 47 | /* |
| 48 | * The POSIX like API |
| 49 | */ |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 50 | XMLPUBFUN xmlRegexpPtr XMLCALL |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 51 | xmlRegexpCompile (const xmlChar *regexp); |
| 52 | XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp); |
| 53 | XMLPUBFUN int XMLCALL |
| 54 | xmlRegexpExec (xmlRegexpPtr comp, |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 55 | const xmlChar *value); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 56 | XMLPUBFUN void XMLCALL |
| 57 | xmlRegexpPrint (FILE *output, |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 58 | xmlRegexpPtr regexp); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 59 | XMLPUBFUN int XMLCALL |
| 60 | xmlRegexpIsDeterminist(xmlRegexpPtr comp); |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 61 | |
| 62 | /* |
| 63 | * Callback function when doing a transition in the automata |
| 64 | */ |
| 65 | typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, |
| 66 | const xmlChar *token, |
| 67 | void *transdata, |
| 68 | void *inputdata); |
| 69 | |
| 70 | /* |
| 71 | * The progressive API |
| 72 | */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 73 | XMLPUBFUN xmlRegExecCtxtPtr XMLCALL |
| 74 | xmlRegNewExecCtxt (xmlRegexpPtr comp, |
| 75 | xmlRegExecCallbacks callback, |
| 76 | void *data); |
| 77 | XMLPUBFUN void XMLCALL |
| 78 | xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); |
| 79 | XMLPUBFUN int XMLCALL |
| 80 | xmlRegExecPushString(xmlRegExecCtxtPtr exec, |
| 81 | const xmlChar *value, |
| 82 | void *data); |
| 83 | XMLPUBFUN int XMLCALL |
| 84 | xmlRegExecPushString2(xmlRegExecCtxtPtr exec, |
| 85 | const xmlChar *value, |
| 86 | const xmlChar *value2, |
| 87 | void *data); |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 88 | |
Daniel Veillard | fc0b6f6 | 2005-01-09 17:48:02 +0000 | [diff] [blame] | 89 | XMLPUBFUN int XMLCALL |
| 90 | xmlRegExecNextValues(xmlRegExecCtxtPtr exec, |
| 91 | int *nbval, |
Daniel Veillard | cc026dc | 2005-01-12 13:21:17 +0000 | [diff] [blame] | 92 | int *nbneg, |
Daniel Veillard | fc0b6f6 | 2005-01-09 17:48:02 +0000 | [diff] [blame] | 93 | xmlChar **values, |
| 94 | int *terminal); |
| 95 | XMLPUBFUN int XMLCALL |
| 96 | xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, |
| 97 | const xmlChar **string, |
| 98 | int *nbval, |
Daniel Veillard | cc026dc | 2005-01-12 13:21:17 +0000 | [diff] [blame] | 99 | int *nbneg, |
Daniel Veillard | fc0b6f6 | 2005-01-09 17:48:02 +0000 | [diff] [blame] | 100 | xmlChar **values, |
| 101 | int *terminal); |
Daniel Veillard | 4255d50 | 2002-04-16 15:50:10 +0000 | [diff] [blame] | 102 | #ifdef __cplusplus |
| 103 | } |
| 104 | #endif |
| 105 | |
| 106 | #endif /* LIBXML_REGEXP_ENABLED */ |
| 107 | |
| 108 | #endif /*__XML_REGEXP_H__ */ |