Commit | Line | Data |
---|---|---|
a2e9d147 MW |
1 | /* |
2 | * This file is part of DisOrder | |
3 | * Copyright (C) 2017 Mark Wooding | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | /** @file lib/regexp.h | |
19 | * @brief Regular expressions | |
20 | */ | |
21 | #ifndef REGEXP_H | |
22 | #define REGEXP_H | |
23 | ||
24 | #if defined(HAVE_PCRE_H) | |
25 | # include <pcre.h> | |
26 | typedef pcre regexp; | |
27 | # define RXF_CASELESS PCRE_CASELESS | |
28 | # define RXERR_NOMATCH PCRE_ERROR_NOMATCH | |
29 | #else | |
30 | # error "no supported regular expression library found" | |
31 | #endif | |
32 | ||
33 | void regexp_setup(void); | |
34 | ||
35 | #define RXCERR_LEN 128 | |
36 | regexp *regexp_compile(const char *pat, unsigned f, | |
37 | char *errbuf, size_t errlen, size_t *erroff_out); | |
38 | ||
39 | int regexp_match(const regexp *re, const char *s, size_t n, unsigned f, | |
40 | size_t *ov, size_t on); | |
41 | ||
42 | void regexp_free(regexp *re); | |
43 | ||
44 | #endif /* REGEXP_H */ | |
45 | ||
46 | /* | |
47 | Local Variables: | |
48 | c-basic-offset:2 | |
49 | comment-column:40 | |
50 | End: | |
51 | */ |