xref: /dragonfly/contrib/less/pattern.h (revision 7485684f)
1 /*
2  * Copyright (C) 1984-2023  Mark Nudelman
3  *
4  * You may distribute under the terms of either the GNU General Public
5  * License or the Less License, as specified in the README file.
6  *
7  * For more information, see the README file.
8  */
9 
10 #if HAVE_GNU_REGEX
11 #define __USE_GNU 1
12 #include <regex.h>
13 #define PATTERN_TYPE             struct re_pattern_buffer *
14 #define SET_NULL_PATTERN(name)   name = NULL
15 #endif
16 
17 /* ---- POSIX ---- */
18 #if HAVE_POSIX_REGCOMP
19 #include <regex.h>
20 #ifdef REG_EXTENDED
21 #define REGCOMP_FLAG             REG_EXTENDED
22 #else
23 #define REGCOMP_FLAG             0
24 #endif
25 #define PATTERN_TYPE             regex_t *
26 #define SET_NULL_PATTERN(name)   name = NULL
27 #define re_handles_caseless      TRUE
28 #endif
29 
30 /* ---- PCRE ---- */
31 #if HAVE_PCRE
32 #include <pcre.h>
33 #define PATTERN_TYPE             pcre *
34 #define SET_NULL_PATTERN(name)   name = NULL
35 #define re_handles_caseless      TRUE
36 #endif
37 
38 /* ---- PCRE2 ---- */
39 #if HAVE_PCRE2
40 #define PCRE2_CODE_UNIT_WIDTH 8
41 #include <pcre2.h>
42 #define PATTERN_TYPE             pcre2_code *
43 #define SET_NULL_PATTERN(name)   name = NULL
44 #define re_handles_caseless      TRUE
45 #endif
46 
47 /* ---- RE_COMP  ---- */
48 #if HAVE_RE_COMP
49 char *re_comp(char*);
50 int re_exec(char*);
51 #define PATTERN_TYPE             int
52 #define SET_NULL_PATTERN(name)   name = 0
53 #endif
54 
55 /* ---- REGCMP  ---- */
56 #if HAVE_REGCMP
57 char *regcmp(char*);
58 char *regex(char**, char*);
59 extern char *__loc1;
60 #define PATTERN_TYPE             char **
61 #define SET_NULL_PATTERN(name)   name = NULL
62 #endif
63 
64 /* ---- REGCOMP  ---- */
65 #if HAVE_V8_REGCOMP
66 #include "regexp.h"
67 extern int reg_show_error;
68 #define PATTERN_TYPE             struct regexp *
69 #define SET_NULL_PATTERN(name)   name = NULL
70 #endif
71 
72 /* ---- NONE  ---- */
73 #if NO_REGEX
74 #define PATTERN_TYPE             void *
75 #define SET_NULL_PATTERN(name)
76 #endif
77 
78 #ifndef re_handles_caseless
79 #define re_handles_caseless      FALSE
80 #endif
81