| 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 |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | /** |
| 28 | * A libxml regular expression |
| 29 | */ |
| 30 | typedef struct _xmlRegexp xmlRegexp; |
| 31 | typedef xmlRegexp *xmlRegexpPtr; |
| 32 | |
| 33 | /** |
| 34 | * A libxml progressive regular expression evaluation context |
| 35 | */ |
| 36 | typedef struct _xmlRegExecCtxt xmlRegExecCtxt; |
| 37 | typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; |
| 38 | |
| 39 | /* |
| 40 | * The POSIX like API |
| 41 | */ |
| 42 | XMLPUBFUN xmlRegexp * |
| 43 | xmlRegexpCompile (const xmlChar *regexp); |
| 44 | XMLPUBFUN void xmlRegFreeRegexp(xmlRegexp *regexp); |
| 45 | XMLPUBFUN int |
| 46 | xmlRegexpExec (xmlRegexp *comp, |
| 47 | const xmlChar *value); |
| 48 | XML_DEPRECATED |
| 49 | XMLPUBFUN void |
| 50 | xmlRegexpPrint (FILE *output, |
| 51 | xmlRegexp *regexp); |
| 52 | XMLPUBFUN 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 | */ |
| 63 | typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxt *exec, |
| 64 | const xmlChar *token, |
| 65 | void *transdata, |
| 66 | void *inputdata); |
| 67 | |
| 68 | /* |
| 69 | * The progressive API |
| 70 | */ |
| 71 | XML_DEPRECATED |
| 72 | XMLPUBFUN xmlRegExecCtxt * |
| 73 | xmlRegNewExecCtxt (xmlRegexp *comp, |
| 74 | xmlRegExecCallbacks callback, |
| 75 | void *data); |
| 76 | XML_DEPRECATED |
| 77 | XMLPUBFUN void |
| 78 | xmlRegFreeExecCtxt (xmlRegExecCtxt *exec); |
| 79 | XML_DEPRECATED |
| 80 | XMLPUBFUN int |
| 81 | xmlRegExecPushString(xmlRegExecCtxt *exec, |
| 82 | const xmlChar *value, |
| 83 | void *data); |
| 84 | XML_DEPRECATED |
| 85 | XMLPUBFUN int |
| 86 | xmlRegExecPushString2(xmlRegExecCtxt *exec, |
| 87 | const xmlChar *value, |
| 88 | const xmlChar *value2, |
| 89 | void *data); |
| 90 | |
| 91 | XML_DEPRECATED |
| 92 | XMLPUBFUN int |
| 93 | xmlRegExecNextValues(xmlRegExecCtxt *exec, |
| 94 | int *nbval, |
| 95 | int *nbneg, |
| 96 | xmlChar **values, |
| 97 | int *terminal); |
| 98 | XML_DEPRECATED |
| 99 | XMLPUBFUN 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 | |