1 /* 2 * Copyright (C) 1984-2026 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 extern lbool less_is_more; 22 #define REGCOMP_FLAG (less_is_more ? 0 : REG_EXTENDED) 23 #else 24 #define REGCOMP_FLAG 0 25 #endif 26 #define PATTERN_TYPE regex_t * 27 #define SET_NULL_PATTERN(name) name = NULL 28 #define RE_HANDLES_CASELESS 1 29 30 #undef RM_VALID 31 #undef RM_PTR 32 #undef RM_EPTR 33 #ifndef __WATCOMC__ 34 #define RM_VALID(r) ((r)->rm_so >= 0) 35 #define RM_PTR(r,line) ((line) + (r)->rm_so) 36 #define RM_EPTR(r,line) ((line) + (r)->rm_eo) 37 #else 38 #define RM_VALID(r) ((r)->rm_sp != NULL) 39 #define RM_PTR(r,line) ((r)->rm_sp) 40 #define RM_EPTR(r,line) ((r)->rm_ep) 41 #endif 42 #endif 43 44 /* ---- PCRE ---- */ 45 #if HAVE_PCRE 46 #include <pcre.h> 47 #define PATTERN_TYPE pcre * 48 #define SET_NULL_PATTERN(name) name = NULL 49 #define RE_HANDLES_CASELESS 1 50 #endif 51 52 /* ---- PCRE2 ---- */ 53 #if HAVE_PCRE2 54 #define PCRE2_CODE_UNIT_WIDTH 8 55 #include <pcre2.h> 56 #define PATTERN_TYPE pcre2_code * 57 #define SET_NULL_PATTERN(name) name = NULL 58 #define RE_HANDLES_CASELESS 1 59 #endif 60 61 /* ---- RE_COMP ---- */ 62 #if HAVE_RE_COMP 63 constant char *re_comp(constant char*); 64 int re_exec(constant char*); 65 #define PATTERN_TYPE int 66 #define SET_NULL_PATTERN(name) name = 0 67 #endif 68 69 /* ---- REGCMP ---- */ 70 #if HAVE_REGCMP 71 char *regcmp(char*); 72 char *regex(char**, char*); 73 extern char *__loc1; 74 #define PATTERN_TYPE char ** 75 #define SET_NULL_PATTERN(name) name = NULL 76 #endif 77 78 /* ---- REGCOMP ---- */ 79 #if HAVE_V8_REGCOMP 80 #include "regexp.h" 81 extern int reg_show_error; 82 #define PATTERN_TYPE struct regexp * 83 #define SET_NULL_PATTERN(name) name = NULL 84 #endif 85 86 /* ---- NONE ---- */ 87 #if NO_REGEX 88 #define PATTERN_TYPE void * 89 #define SET_NULL_PATTERN(name) 90 #endif 91 92 #ifndef RE_HANDLES_CASELESS 93 #define RE_HANDLES_CASELESS 0 94 #endif 95