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 XMLPUBFUN xmlRegExecCtxtPtr 74 xmlRegNewExecCtxt (xmlRegexpPtr comp, 75 xmlRegExecCallbacks callback, 76 void *data); 77 XMLPUBFUN void 78 xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); 79 XMLPUBFUN int 80 xmlRegExecPushString(xmlRegExecCtxtPtr exec, 81 const xmlChar *value, 82 void *data); 83 XMLPUBFUN int 84 xmlRegExecPushString2(xmlRegExecCtxtPtr exec, 85 const xmlChar *value, 86 const xmlChar *value2, 87 void *data); 88 89 XMLPUBFUN int 90 xmlRegExecNextValues(xmlRegExecCtxtPtr exec, 91 int *nbval, 92 int *nbneg, 93 xmlChar **values, 94 int *terminal); 95 XMLPUBFUN int 96 xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, 97 const xmlChar **string, 98 int *nbval, 99 int *nbneg, 100 xmlChar **values, 101 int *terminal); 102 103 #ifdef __cplusplus 104 } 105 #endif 106 107 #endif /* LIBXML_REGEXP_ENABLED */ 108 109 #endif /*__XML_REGEXP_H__ */ 110