Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | #ifndef _REGEX_H |
| 2 | #define _REGEX_H |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
| 8 | #define __NEED_size_t |
| 9 | |
| 10 | #include <bits/alltypes.h> |
| 11 | |
| 12 | typedef long regoff_t; |
| 13 | |
| 14 | typedef struct { |
| 15 | size_t re_nsub; |
Rich Felker | 32aea20 | 2011-06-16 16:53:11 -0400 | [diff] [blame] | 16 | void *__opaque, *__padding[4]; |
| 17 | size_t __nsub2; |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 18 | } regex_t; |
| 19 | |
| 20 | typedef struct { |
| 21 | regoff_t rm_so; |
| 22 | regoff_t rm_eo; |
| 23 | } regmatch_t; |
| 24 | |
| 25 | #define REG_EXTENDED 1 |
| 26 | #define REG_ICASE 2 |
| 27 | #define REG_NEWLINE 4 |
| 28 | #define REG_NOSUB 8 |
| 29 | |
| 30 | #define REG_NOTBOL 1 |
| 31 | #define REG_NOTEOL 2 |
| 32 | |
| 33 | #define REG_OK 0 |
| 34 | #define REG_NOMATCH 1 |
| 35 | #define REG_BADPAT 2 |
| 36 | #define REG_ECOLLATE 3 |
| 37 | #define REG_ECTYPE 4 |
| 38 | #define REG_EESCAPE 5 |
| 39 | #define REG_ESUBREG 6 |
| 40 | #define REG_EBRACK 7 |
| 41 | #define REG_EPAREN 8 |
| 42 | #define REG_EBRACE 9 |
| 43 | #define REG_BADBR 10 |
| 44 | #define REG_ERANGE 11 |
| 45 | #define REG_ESPACE 12 |
| 46 | #define REG_BADRPT 13 |
| 47 | |
| 48 | #define REG_ENOSYS -1 |
| 49 | |
| 50 | int regcomp(regex_t *, const char *, int); |
| 51 | int regexec(const regex_t *, const char *, size_t, regmatch_t [], int); |
| 52 | void regfree(regex_t *); |
| 53 | |
| 54 | size_t regerror(int, const regex_t *, char *, size_t); |
| 55 | |
| 56 | #ifdef __cplusplus |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | #endif |