xmlregexp.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. #ifndef __XML_REGEXP_H__
  14. #define __XML_REGEXP_H__
  15. #include <stdio.h>
  16. #include <libxml/xmlversion.h>
  17. #include <libxml/xmlstring.h>
  18. #ifdef LIBXML_REGEXP_ENABLED
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /**
  23. * A libxml regular expression
  24. */
  25. typedef struct _xmlRegexp xmlRegexp;
  26. typedef xmlRegexp *xmlRegexpPtr;
  27. /**
  28. * A libxml progressive regular expression evaluation context
  29. */
  30. typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
  31. typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
  32. /*
  33. * The POSIX like API
  34. */
  35. XMLPUBFUN xmlRegexp *
  36. xmlRegexpCompile (const xmlChar *regexp);
  37. XMLPUBFUN void xmlRegFreeRegexp(xmlRegexp *regexp);
  38. XMLPUBFUN int
  39. xmlRegexpExec (xmlRegexp *comp,
  40. const xmlChar *value);
  41. XML_DEPRECATED
  42. XMLPUBFUN void
  43. xmlRegexpPrint (FILE *output,
  44. xmlRegexp *regexp);
  45. XMLPUBFUN int
  46. xmlRegexpIsDeterminist(xmlRegexp *comp);
  47. /**
  48. * Callback function when doing a transition in the automata
  49. *
  50. * @param exec the regular expression context
  51. * @param token the current token string
  52. * @param transdata transition data
  53. * @param inputdata input data
  54. */
  55. typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxt *exec,
  56. const xmlChar *token,
  57. void *transdata,
  58. void *inputdata);
  59. /*
  60. * The progressive API
  61. */
  62. XML_DEPRECATED
  63. XMLPUBFUN xmlRegExecCtxt *
  64. xmlRegNewExecCtxt (xmlRegexp *comp,
  65. xmlRegExecCallbacks callback,
  66. void *data);
  67. XML_DEPRECATED
  68. XMLPUBFUN void
  69. xmlRegFreeExecCtxt (xmlRegExecCtxt *exec);
  70. XML_DEPRECATED
  71. XMLPUBFUN int
  72. xmlRegExecPushString(xmlRegExecCtxt *exec,
  73. const xmlChar *value,
  74. void *data);
  75. XML_DEPRECATED
  76. XMLPUBFUN int
  77. xmlRegExecPushString2(xmlRegExecCtxt *exec,
  78. const xmlChar *value,
  79. const xmlChar *value2,
  80. void *data);
  81. XML_DEPRECATED
  82. XMLPUBFUN int
  83. xmlRegExecNextValues(xmlRegExecCtxt *exec,
  84. int *nbval,
  85. int *nbneg,
  86. xmlChar **values,
  87. int *terminal);
  88. XML_DEPRECATED
  89. XMLPUBFUN int
  90. xmlRegExecErrInfo (xmlRegExecCtxt *exec,
  91. const xmlChar **string,
  92. int *nbval,
  93. int *nbneg,
  94. xmlChar **values,
  95. int *terminal);
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif /* LIBXML_REGEXP_ENABLED */
  100. #endif /*__XML_REGEXP_H__ */