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