xref: /freebsd/contrib/less/pattern.h (revision b7780dbe98fc88da65024e697529ea7883064275)
1f0be0a1fSXin LI /*
2*b7780dbeSXin LI  * Copyright (C) 1984-2019  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  *
796e55cc7SXin LI  * For more information, see the README file.
8f0be0a1fSXin LI  */
9f0be0a1fSXin LI 
1096e55cc7SXin LI #if HAVE_GNU_REGEX
1196e55cc7SXin LI #define __USE_GNU 1
1296e55cc7SXin LI #include <regex.h>
13f6b74a7dSXin LI #define PATTERN_TYPE          struct re_pattern_buffer *
1496e55cc7SXin LI #define CLEAR_PATTERN(name)   name = NULL
1596e55cc7SXin LI #endif
1696e55cc7SXin 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
25f6b74a7dSXin LI #define PATTERN_TYPE          regex_t *
26f0be0a1fSXin LI #define CLEAR_PATTERN(name)   name = NULL
27f0be0a1fSXin LI #endif
28f0be0a1fSXin LI 
29f0be0a1fSXin LI #if HAVE_PCRE
30f0be0a1fSXin LI #include <pcre.h>
31f6b74a7dSXin LI #define PATTERN_TYPE          pcre *
32f0be0a1fSXin LI #define CLEAR_PATTERN(name)   name = NULL
33f0be0a1fSXin LI #endif
34f0be0a1fSXin LI 
35*b7780dbeSXin LI #if HAVE_PCRE2
36*b7780dbeSXin LI #define PCRE2_CODE_UNIT_WIDTH 8
37*b7780dbeSXin LI #include <pcre2.h>
38*b7780dbeSXin LI #define PATTERN_TYPE          pcre2_code *
39*b7780dbeSXin LI #define CLEAR_PATTERN(name)   name = NULL
40*b7780dbeSXin LI #endif
41*b7780dbeSXin LI 
42f0be0a1fSXin LI #if HAVE_RE_COMP
43b2ea2440SXin LI char *re_comp LESSPARAMS ((char*));
44b2ea2440SXin LI int re_exec LESSPARAMS ((char*));
45f6b74a7dSXin LI #define PATTERN_TYPE          int
46f0be0a1fSXin LI #define CLEAR_PATTERN(name)   name = 0
47f0be0a1fSXin LI #endif
48f0be0a1fSXin LI 
49f0be0a1fSXin LI #if HAVE_REGCMP
50b2ea2440SXin LI char *regcmp LESSPARAMS ((char*));
51b2ea2440SXin LI char *regex LESSPARAMS ((char**, char*));
52f0be0a1fSXin LI extern char *__loc1;
53f6b74a7dSXin LI #define PATTERN_TYPE          char **
54f0be0a1fSXin LI #define CLEAR_PATTERN(name)   name = NULL
55f0be0a1fSXin LI #endif
56f0be0a1fSXin LI 
57f0be0a1fSXin LI #if HAVE_V8_REGCOMP
58f0be0a1fSXin LI #include "regexp.h"
59a15691bfSXin LI extern int reg_show_error;
60f6b74a7dSXin LI #define PATTERN_TYPE          struct regexp *
61f0be0a1fSXin LI #define CLEAR_PATTERN(name)   name = NULL
62f0be0a1fSXin LI #endif
63f0be0a1fSXin LI 
6496e55cc7SXin LI #if NO_REGEX
65f6b74a7dSXin LI #define PATTERN_TYPE          void *
6696e55cc7SXin LI #define CLEAR_PATTERN(name)
6796e55cc7SXin LI #endif
68