regex.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef _HSREGEX_H_
  2. #define _HSREGEX_H_
  3. #ifndef _HSREGEX_H
  4. #define _HSREGEX_H /* never again */
  5. /* ========= begin header generated by ././mkh ========= */
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. /* === regex2.h === */
  10. #ifdef WIN32
  11. #define API_EXPORT(type) __declspec(dllexport) type __stdcall
  12. #elif defined(__GNUC__) && __GNUC__ >= 4
  13. #define API_EXPORT(type) __attribute__ ((visibility("default"))) type
  14. #else
  15. #define API_EXPORT(type) type
  16. #endif
  17. typedef off_t regoff_t;
  18. typedef struct {
  19. int re_magic;
  20. size_t re_nsub; /* number of parenthesized subexpressions */
  21. const char *re_endp; /* end pointer for REG_PEND */
  22. struct re_guts *re_g; /* none of your business :-) */
  23. } regex_t;
  24. typedef struct {
  25. regoff_t rm_so; /* start of match */
  26. regoff_t rm_eo; /* end of match */
  27. } regmatch_t;
  28. /* === regcomp.c === */
  29. API_EXPORT(int) regcomp(regex_t *, const char *, int);
  30. #define REG_BASIC 0000
  31. #define REG_EXTENDED 0001
  32. #define REG_ICASE 0002
  33. #define REG_NOSUB 0004
  34. #define REG_NEWLINE 0010
  35. #define REG_NOSPEC 0020
  36. #define REG_PEND 0040
  37. #define REG_DUMP 0200
  38. /* === regerror.c === */
  39. #define REG_OKAY 0
  40. #define REG_NOMATCH 1
  41. #define REG_BADPAT 2
  42. #define REG_ECOLLATE 3
  43. #define REG_ECTYPE 4
  44. #define REG_EESCAPE 5
  45. #define REG_ESUBREG 6
  46. #define REG_EBRACK 7
  47. #define REG_EPAREN 8
  48. #define REG_EBRACE 9
  49. #define REG_BADBR 10
  50. #define REG_ERANGE 11
  51. #define REG_ESPACE 12
  52. #define REG_BADRPT 13
  53. #define REG_EMPTY 14
  54. #define REG_ASSERT 15
  55. #define REG_INVARG 16
  56. #define REG_ATOI 255 /* convert name to number (!) */
  57. #define REG_ITOA 0400 /* convert number to name (!) */
  58. API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
  59. /* === regexec.c === */
  60. API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
  61. #define REG_NOTBOL 00001
  62. #define REG_NOTEOL 00002
  63. #define REG_STARTEND 00004
  64. #define REG_TRACE 00400 /* tracing of execution */
  65. #define REG_LARGE 01000 /* force large representation */
  66. #define REG_BACKR 02000 /* force use of backref code */
  67. /* === regfree.c === */
  68. API_EXPORT(void) regfree(regex_t *);
  69. #ifdef __cplusplus
  70. }
  71. #endif
  72. /* ========= end header generated by ././mkh ========= */
  73. #endif
  74. #endif