2
0

regex.h 1.2 KB

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