xref: /freebsd/contrib/less/pattern.h (revision 96e55cc72dd4e73f9c43872899beb615aeeed4b6)
1f0be0a1fSXin LI /*
2*96e55cc7SXin LI  * Copyright (C) 1984-2012  Mark Nudelman
3f0be0a1fSXin LI  *
4f0be0a1fSXin LI  * You may distribute under the terms of either the GNU General Public
5f0be0a1fSXin LI  * License or the Less License, as specified in the README file.
6f0be0a1fSXin LI  *
7*96e55cc7SXin LI  * For more information, see the README file.
8f0be0a1fSXin LI  */
9f0be0a1fSXin LI 
10*96e55cc7SXin LI #if HAVE_GNU_REGEX
11*96e55cc7SXin LI #define __USE_GNU 1
12*96e55cc7SXin LI #include <regex.h>
13*96e55cc7SXin LI #define DEFINE_PATTERN(name)  struct re_pattern_buffer *name
14*96e55cc7SXin LI #define CLEAR_PATTERN(name)   name = NULL
15*96e55cc7SXin LI #endif
16*96e55cc7SXin LI 
17f0be0a1fSXin LI #if HAVE_POSIX_REGCOMP
18f0be0a1fSXin LI #include <regex.h>
19f0be0a1fSXin LI #ifdef REG_EXTENDED
20f0be0a1fSXin LI extern int less_is_more;
21f0be0a1fSXin LI #define	REGCOMP_FLAG	(less_is_more ? 0 : REG_EXTENDED)
22f0be0a1fSXin LI #else
23f0be0a1fSXin LI #define	REGCOMP_FLAG	0
24f0be0a1fSXin LI #endif
25f0be0a1fSXin LI #define DEFINE_PATTERN(name)  regex_t *name
26f0be0a1fSXin LI #define CLEAR_PATTERN(name)   name = NULL
27f0be0a1fSXin LI #endif
28f0be0a1fSXin LI 
29f0be0a1fSXin LI #if HAVE_PCRE
30f0be0a1fSXin LI #include <pcre.h>
31f0be0a1fSXin LI #define DEFINE_PATTERN(name)  pcre *name
32f0be0a1fSXin LI #define CLEAR_PATTERN(name)   name = NULL
33f0be0a1fSXin LI #endif
34f0be0a1fSXin LI 
35f0be0a1fSXin LI #if HAVE_RE_COMP
36f0be0a1fSXin LI char *re_comp();
37f0be0a1fSXin LI int re_exec();
38f0be0a1fSXin LI #define DEFINE_PATTERN(name)  int name
39f0be0a1fSXin LI #define CLEAR_PATTERN(name)   name = 0
40f0be0a1fSXin LI #endif
41f0be0a1fSXin LI 
42f0be0a1fSXin LI #if HAVE_REGCMP
43f0be0a1fSXin LI char *regcmp();
44f0be0a1fSXin LI char *regex();
45f0be0a1fSXin LI extern char *__loc1;
46f0be0a1fSXin LI #define DEFINE_PATTERN(name)  char *name
47f0be0a1fSXin LI #define CLEAR_PATTERN(name)   name = NULL
48f0be0a1fSXin LI #endif
49f0be0a1fSXin LI 
50f0be0a1fSXin LI #if HAVE_V8_REGCOMP
51f0be0a1fSXin LI #include "regexp.h"
52f0be0a1fSXin LI #define DEFINE_PATTERN(name)  struct regexp *name
53f0be0a1fSXin LI #define CLEAR_PATTERN(name)   name = NULL
54f0be0a1fSXin LI #endif
55f0be0a1fSXin LI 
56*96e55cc7SXin LI #if NO_REGEX
57*96e55cc7SXin LI #define DEFINE_PATTERN(name)
58*96e55cc7SXin LI #define CLEAR_PATTERN(name)
59*96e55cc7SXin LI #endif
60