1*838f5788Ssimonb /* $NetBSD: pattern.h,v 1.5 2023/10/06 05:49:49 simonb Exp $ */ 220006a0bStron 320006a0bStron /* 4*838f5788Ssimonb * Copyright (C) 1984-2023 Mark Nudelman 520006a0bStron * 620006a0bStron * You may distribute under the terms of either the GNU General Public 720006a0bStron * License or the Less License, as specified in the README file. 820006a0bStron * 9ec18bca0Stron * For more information, see the README file. 1020006a0bStron */ 1120006a0bStron 12ec18bca0Stron #if HAVE_GNU_REGEX 13ec18bca0Stron #define __USE_GNU 1 14ec18bca0Stron #include <regex.h> 15*838f5788Ssimonb #define PATTERN_TYPE struct re_pattern_buffer * 16*838f5788Ssimonb #define SET_NULL_PATTERN(name) name = NULL 17ec18bca0Stron #endif 18ec18bca0Stron 19*838f5788Ssimonb /* ---- POSIX ---- */ 2020006a0bStron #if HAVE_POSIX_REGCOMP 2120006a0bStron #include <regex.h> 2220006a0bStron #ifdef REG_EXTENDED 23824a88bbStron extern int more_mode; 24824a88bbStron #define REGCOMP_FLAG (more_mode ? 0 : REG_EXTENDED) 2520006a0bStron #else 2620006a0bStron #define REGCOMP_FLAG 0 2720006a0bStron #endif 28*838f5788Ssimonb #define PATTERN_TYPE regex_t * 29*838f5788Ssimonb #define SET_NULL_PATTERN(name) name = NULL 30*838f5788Ssimonb #define re_handles_caseless TRUE 3120006a0bStron #endif 3220006a0bStron 33*838f5788Ssimonb /* ---- PCRE ---- */ 3420006a0bStron #if HAVE_PCRE 3520006a0bStron #include <pcre.h> 36*838f5788Ssimonb #define PATTERN_TYPE pcre * 37*838f5788Ssimonb #define SET_NULL_PATTERN(name) name = NULL 38*838f5788Ssimonb #define re_handles_caseless TRUE 3920006a0bStron #endif 4020006a0bStron 41*838f5788Ssimonb /* ---- PCRE2 ---- */ 42*838f5788Ssimonb #if HAVE_PCRE2 43*838f5788Ssimonb #define PCRE2_CODE_UNIT_WIDTH 8 44*838f5788Ssimonb #include <pcre2.h> 45*838f5788Ssimonb #define PATTERN_TYPE pcre2_code * 46*838f5788Ssimonb #define SET_NULL_PATTERN(name) name = NULL 47*838f5788Ssimonb #define re_handles_caseless TRUE 48*838f5788Ssimonb #endif 49*838f5788Ssimonb 50*838f5788Ssimonb /* ---- RE_COMP ---- */ 5120006a0bStron #if HAVE_RE_COMP 52*838f5788Ssimonb char *re_comp(char*); 53*838f5788Ssimonb int re_exec(char*); 54*838f5788Ssimonb #define PATTERN_TYPE int 55*838f5788Ssimonb #define SET_NULL_PATTERN(name) name = 0 5620006a0bStron #endif 5720006a0bStron 58*838f5788Ssimonb /* ---- REGCMP ---- */ 5920006a0bStron #if HAVE_REGCMP 60*838f5788Ssimonb char *regcmp(char*); 61*838f5788Ssimonb char *regex(char**, char*); 6220006a0bStron extern char *__loc1; 63*838f5788Ssimonb #define PATTERN_TYPE char ** 64*838f5788Ssimonb #define SET_NULL_PATTERN(name) name = NULL 6520006a0bStron #endif 6620006a0bStron 67*838f5788Ssimonb /* ---- REGCOMP ---- */ 6820006a0bStron #if HAVE_V8_REGCOMP 6920006a0bStron #include "regexp.h" 70*838f5788Ssimonb extern int reg_show_error; 71*838f5788Ssimonb #define PATTERN_TYPE struct regexp * 72*838f5788Ssimonb #define SET_NULL_PATTERN(name) name = NULL 7320006a0bStron #endif 7420006a0bStron 75*838f5788Ssimonb /* ---- NONE ---- */ 76ec18bca0Stron #if NO_REGEX 77*838f5788Ssimonb #define PATTERN_TYPE void * 78*838f5788Ssimonb #define SET_NULL_PATTERN(name) 79*838f5788Ssimonb #endif 80*838f5788Ssimonb 81*838f5788Ssimonb #ifndef re_handles_caseless 82*838f5788Ssimonb #define re_handles_caseless FALSE 83ec18bca0Stron #endif 84