1
0

regex.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef _REGEX_H
  2. #define _REGEX_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #if __STDC_VERSION__ >= 199901L
  7. #define __restrict restrict
  8. #elif !defined(__GNUC__)
  9. #define __restrict
  10. #endif
  11. #define __NEED_size_t
  12. #include <bits/alltypes.h>
  13. typedef long regoff_t;
  14. typedef struct {
  15. size_t re_nsub;
  16. void *__opaque, *__padding[4];
  17. size_t __nsub2;
  18. } regex_t;
  19. typedef struct {
  20. regoff_t rm_so;
  21. regoff_t rm_eo;
  22. } regmatch_t;
  23. #define REG_EXTENDED 1
  24. #define REG_ICASE 2
  25. #define REG_NEWLINE 4
  26. #define REG_NOSUB 8
  27. #define REG_NOTBOL 1
  28. #define REG_NOTEOL 2
  29. #define REG_OK 0
  30. #define REG_NOMATCH 1
  31. #define REG_BADPAT 2
  32. #define REG_ECOLLATE 3
  33. #define REG_ECTYPE 4
  34. #define REG_EESCAPE 5
  35. #define REG_ESUBREG 6
  36. #define REG_EBRACK 7
  37. #define REG_EPAREN 8
  38. #define REG_EBRACE 9
  39. #define REG_BADBR 10
  40. #define REG_ERANGE 11
  41. #define REG_ESPACE 12
  42. #define REG_BADRPT 13
  43. #define REG_ENOSYS -1
  44. int regcomp(regex_t *__restrict, const char *__restrict, int);
  45. int regexec(const regex_t *__restrict, const char *__restrict, size_t, regmatch_t *__restrict, int);
  46. void regfree(regex_t *);
  47. size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t);
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #endif