1 /* 2 * Summary: regular expressions handling 3 * Description: basic API for libxml regular expressions handling used 4 * for XML Schemas and validation. 5 * 6 * Copy: See Copyright for the status of this software. 7 * 8 * Author: Daniel Veillard 9 */ 10 11 #ifndef __XML_REGEXP_H__ 12 #define __XML_REGEXP_H__ 13 14 #include <stdio.h> 15 #include <libxml/xmlversion.h> 16 #include <libxml/xmlstring.h> 17 18 #ifdef LIBXML_REGEXP_ENABLED 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 /** 25 * xmlRegexpPtr: 26 * 27 * A libxml regular expression, they can actually be far more complex 28 * thank the POSIX regex expressions. 29 */ 30 typedef struct _xmlRegexp xmlRegexp; 31 typedef xmlRegexp *xmlRegexpPtr; 32 33 /** 34 * xmlRegExecCtxtPtr: 35 * 36 * A libxml progressive regular expression evaluation context 37 */ 38 typedef struct _xmlRegExecCtxt xmlRegExecCtxt; 39 typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; 40 41 /* 42 * The POSIX like API 43 */ 44 XMLPUBFUN xmlRegexpPtr 45 xmlRegexpCompile (const xmlChar *regexp); 46 XMLPUBFUN void xmlRegFreeRegexp(xmlRegexpPtr regexp); 47 XMLPUBFUN int 48 xmlRegexpExec (xmlRegexpPtr comp, 49 const xmlChar *value); 50 XMLPUBFUN void 51 xmlRegexpPrint (FILE *output, 52 xmlRegexpPtr regexp); 53 XMLPUBFUN int 54 xmlRegexpIsDeterminist(xmlRegexpPtr comp); 55 56 /** 57 * xmlRegExecCallbacks: 58 * @exec: the regular expression context 59 * @token: the current token string 60 * @transdata: transition data 61 * @inputdata: input data 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 */ 73 XML_DEPRECATED 74 XMLPUBFUN xmlRegExecCtxtPtr 75 xmlRegNewExecCtxt (xmlRegexpPtr comp, 76 xmlRegExecCallbacks callback, 77 void *data); 78 XML_DEPRECATED 79 XMLPUBFUN void 80 xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); 81 XML_DEPRECATED 82 XMLPUBFUN int 83 xmlRegExecPushString(xmlRegExecCtxtPtr exec, 84 const xmlChar *value, 85 void *data); 86 XML_DEPRECATED 87 XMLPUBFUN int 88 xmlRegExecPushString2(xmlRegExecCtxtPtr exec, 89 const xmlChar *value, 90 const xmlChar *value2, 91 void *data); 92 93 XML_DEPRECATED 94 XMLPUBFUN int 95 xmlRegExecNextValues(xmlRegExecCtxtPtr exec, 96 int *nbval, 97 int *nbneg, 98 xmlChar **values, 99 int *terminal); 100 XML_DEPRECATED 101 XMLPUBFUN int 102 xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, 103 const xmlChar **string, 104 int *nbval, 105 int *nbneg, 106 xmlChar **values, 107 int *terminal); 108 109 #ifdef __cplusplus 110 } 111 #endif 112 113 #endif /* LIBXML_REGEXP_ENABLED */ 114 115 #endif /*__XML_REGEXP_H__ */ 116