chiark / gitweb /
plugins/tracklength-gstreamer.c: Rewrite to use `GstDiscoverer'.
[disorder] / lib / regexp.h
CommitLineData
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
16e4a580
MW
24#if defined(HAVE_LIBPCRE2)
25# ifndef PCRE2_CODE_UNIT_WIDTH
26# define PCRE2_CODE_UNIT_WIDTH 8
27# endif
28# include <pcre2.h>
29 typedef pcre2_code regexp;
30# define RXF_CASELESS PCRE2_CASELESS
31# define RXERR_NOMATCH PCRE2_ERROR_NOMATCH
32#elif defined(HAVE_PCRE_H)
a2e9d147
MW
33# include <pcre.h>
34 typedef pcre regexp;
35# define RXF_CASELESS PCRE_CASELESS
36# define RXERR_NOMATCH PCRE_ERROR_NOMATCH
37#else
38# error "no supported regular expression library found"
39#endif
40
41void regexp_setup(void);
42
43#define RXCERR_LEN 128
44regexp *regexp_compile(const char *pat, unsigned f,
45 char *errbuf, size_t errlen, size_t *erroff_out);
46
47int regexp_match(const regexp *re, const char *s, size_t n, unsigned f,
48 size_t *ov, size_t on);
49
50void regexp_free(regexp *re);
51
52#endif /* REGEXP_H */
53
54/*
55Local Variables:
56c-basic-offset:2
57comment-column:40
58End:
59*/