home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / py2s152.zip / Modules / pcre.h < prev    next >
C/C++ Source or Header  |  1999-06-27  |  2KB  |  83 lines

  1. /*************************************************
  2. *       Perl-Compatible Regular Expressions      *
  3. *************************************************/
  4.  
  5. /* Copyright (c) 1998 University of Cambridge */
  6.  
  7. #ifndef _PCRE_H
  8. #define _PCRE_H
  9.  
  10. #ifdef FOR_PYTHON
  11. #include "Python.h"
  12. #endif
  13.  
  14. /* Have to include stdlib.h in order to ensure that size_t is defined;
  15. it is needed here for malloc. */
  16.  
  17. #include <sys/types.h>
  18. #include <stdlib.h>
  19.  
  20. /* Allow for C++ users */
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26. /* Options */
  27.  
  28. #define PCRE_CASELESS        0x0001
  29. #define PCRE_EXTENDED        0x0002
  30. #define PCRE_ANCHORED        0x0004
  31. #define PCRE_MULTILINE       0x0008
  32. #define PCRE_DOTALL          0x0010
  33. #define PCRE_DOLLAR_ENDONLY  0x0020
  34. #define PCRE_EXTRA           0x0040
  35. #define PCRE_NOTBOL          0x0080
  36. #define PCRE_NOTEOL          0x0100
  37. #define PCRE_UNGREEDY        0x0400
  38. #ifdef FOR_PYTHON
  39. #define PCRE_LOCALE          0x0200
  40. #endif
  41.  
  42. /* Exec-time error codes */
  43.  
  44. #define PCRE_ERROR_NOMATCH        (-1)
  45. #define PCRE_ERROR_BADREF         (-2)
  46. #define PCRE_ERROR_NULL           (-3)
  47. #define PCRE_ERROR_BADOPTION      (-4)
  48. #define PCRE_ERROR_BADMAGIC       (-5)
  49. #define PCRE_ERROR_UNKNOWN_NODE   (-6)
  50. #define PCRE_ERROR_NOMEMORY       (-7)
  51.  
  52. /* Types */
  53.  
  54. typedef void pcre;
  55. typedef void pcre_extra;
  56.  
  57. /* Store get and free functions. These can be set to alternative malloc/free
  58. functions if required. */
  59.  
  60. extern void *(*pcre_malloc)(size_t);
  61. extern void  (*pcre_free)(void *);
  62.  
  63. /* Functions */
  64.  
  65. #ifdef FOR_PYTHON
  66. extern pcre *pcre_compile(const char *, int, const char **, int *, PyObject *);
  67. extern int pcre_exec(const pcre *, const pcre_extra *, const char *,
  68.   int, int, int, int *, int);
  69. #else
  70. extern pcre *pcre_compile(const char *, int, const char **, int *);
  71. extern int pcre_exec(const pcre *, const pcre_extra *, const char *,
  72.   int, int, int *, int);
  73. #endif
  74. extern int pcre_info(const pcre *, int *, int *);
  75. extern pcre_extra *pcre_study(const pcre *, int, const char **);
  76. extern const char *pcre_version(void);
  77.  
  78. #ifdef __cplusplus
  79. }  /* extern "C" */
  80. #endif
  81.  
  82. #endif /* End of pcre.h */
  83.