Add libc glue for libtre.
tre will be compiled without approx and wchar/mulibyte support to only match the minimum requirement to replace our spencer regex. This needs a lot of testing. Only enabled when USE_LIBTRE is set to `yes'.
This commit is contained in:
parent
1720465890
commit
82e82fca50
23
external/bsd/tre/Makefile.inc
vendored
Normal file
23
external/bsd/tre/Makefile.inc
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# $NetBSD: Makefile.inc,v 1.1 2010/09/04 12:17:58 ahoka Exp $
|
||||
# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
|
||||
|
||||
# regex sources
|
||||
TREDIST= ${NETBSDSRCDIR}/external/bsd/tre/dist
|
||||
|
||||
# Add libc/regex for manpages
|
||||
.PATH: ${TREDIST}/lib ${NETBSDSRCDIR}/lib/libc/regex
|
||||
|
||||
CPPFLAGS+= -I${TREDIST} -I${TREDIST}/lib
|
||||
CPPFLAGS+= -DHAVE_CONFIG_H=1
|
||||
|
||||
SRCS+= regcomp.c regerror.c regexec.c
|
||||
SRCS+= tre-ast.c tre-compile.c
|
||||
SRCS+= tre-match-backtrack.c tre-match-parallel.c tre-mem.c
|
||||
SRCS+= tre-parse.c tre-stack.c
|
||||
|
||||
WARNS= 4
|
||||
|
||||
MAN+= regex.3 re_format.7
|
||||
|
||||
MLINKS+=regex.3 regcomp.3 regex.3 regexec.3 regex.3 regerror.3 \
|
||||
regex.3 regfree.3
|
259
external/bsd/tre/dist/config.h
vendored
Normal file
259
external/bsd/tre/dist/config.h
vendored
Normal file
@ -0,0 +1,259 @@
|
||||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
/* #undef C_ALLOCA */
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
/* #undef ENABLE_NLS */
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
/* #undef HAVE_ALLOCA */
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
/* #undef HAVE_ALLOCA_H */
|
||||
|
||||
/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
|
||||
CoreFoundation framework. */
|
||||
/* #undef HAVE_CFLOCALECOPYCURRENT */
|
||||
|
||||
/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
|
||||
the CoreFoundation framework. */
|
||||
/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
|
||||
|
||||
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
||||
*/
|
||||
/* #undef HAVE_DCGETTEXT */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#define HAVE_GETOPT_H 1
|
||||
|
||||
/* Define to 1 if you have the `getopt_long' function. */
|
||||
#define HAVE_GETOPT_LONG 1
|
||||
|
||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||
/* #undef HAVE_GETTEXT */
|
||||
|
||||
/* Define if you have the iconv() function and it works. */
|
||||
#define HAVE_ICONV 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
/* #undef HAVE_INTTYPES_H */
|
||||
|
||||
/* Define to 1 if you have the `isascii' function. */
|
||||
#define HAVE_ISASCII 1
|
||||
|
||||
/* Define to 1 if you have the `isblank' function. */
|
||||
#define HAVE_ISBLANK 1
|
||||
|
||||
/* Define to 1 if you have the `iswascii' function or macro. */
|
||||
/* #undef HAVE_ISWASCII */
|
||||
|
||||
/* Define to 1 if you have the `iswblank' function or macro. */
|
||||
/* #undef HAVE_ISWBLANK */
|
||||
|
||||
/* Define to 1 if you have the `iswctype' function or macro. */
|
||||
/* #undef HAVE_ISWCTYPE */
|
||||
|
||||
/* Define to 1 if you have the `iswlower' function or macro. */
|
||||
/* #undef HAVE_ISWLOWER */
|
||||
|
||||
/* Define to 1 if you have the `iswupper' function or macro. */
|
||||
/* #undef HAVE_ISWUPPER */
|
||||
|
||||
/* Define to 1 if you have the <libutf8.h> header file. */
|
||||
/* #undef HAVE_LIBUTF8_H */
|
||||
|
||||
/* Define to 1 if you have the `mbrtowc' function or macro. */
|
||||
/* #undef HAVE_MBRTOWC */
|
||||
|
||||
/* Define to 1 if the system has the type `mbstate_t'. */
|
||||
/* #undef HAVE_MBSTATE_T */
|
||||
|
||||
/* Define to 1 if you have the `mbtowc' function or macro. */
|
||||
/* #undef HAVE_MBTOWC */
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
/* #undef HAVE_MEMORY_H */
|
||||
|
||||
/* Define to 1 if you have the <regex.h> header file. */
|
||||
#define HAVE_REGEX_H 1
|
||||
|
||||
/* Define to 1 if the system has the type `reg_errcode_t'. */
|
||||
/* #undef HAVE_REG_ERRCODE_T */
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
/* #undef HAVE_STDINT_H */
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
/* #undef HAVE_STDLIB_H */
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
/* #undef HAVE_STRINGS_H */
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
/* #undef HAVE_STRING_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
/* #undef HAVE_SYS_STAT_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `towlower' function or macro. */
|
||||
/* #undef HAVE_TOWLOWER */
|
||||
|
||||
/* Define to 1 if you have the `towupper' function or macro. */
|
||||
/* #undef HAVE_TOWUPPER */
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
/* #undef HAVE_UNISTD_H */
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
/* #undef HAVE_WCHAR_H */
|
||||
|
||||
/* Define to 1 if the system has the type `wchar_t'. */
|
||||
/* #undef HAVE_WCHAR_T */
|
||||
|
||||
/* Define to 1 if you have the `wcschr' function or macro. */
|
||||
/* #undef HAVE_WCSCHR */
|
||||
|
||||
/* Define to 1 if you have the `wcscpy' function or macro. */
|
||||
/* #undef HAVE_WCSCPY */
|
||||
|
||||
/* Define to 1 if you have the `wcslen' function or macro. */
|
||||
/* #undef HAVE_WCSLEN */
|
||||
|
||||
/* Define to 1 if you have the `wcsncpy' function or macro. */
|
||||
/* #undef HAVE_WCSNCPY */
|
||||
|
||||
/* Define to 1 if you have the `wcsrtombs' function or macro. */
|
||||
/* #undef HAVE_WCSRTOMBS */
|
||||
|
||||
/* Define to 1 if you have the `wcstombs' function or macro. */
|
||||
/* #undef HAVE_WCSTOMBS */
|
||||
|
||||
/* Define to 1 if you have the `wctype' function or macro. */
|
||||
/* #undef HAVE_WCTYPE */
|
||||
|
||||
/* Define to 1 if you have the <wctype.h> header file. */
|
||||
/* #undef HAVE_WCTYPE_H */
|
||||
|
||||
/* Define to 1 if the system has the type `wint_t'. */
|
||||
/* #undef HAVE_WINT_T */
|
||||
|
||||
/* Define if you want to disable debug assertions. */
|
||||
#define NDEBUG 1
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "tre"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "tre-general@lists.laurikari.net"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "TRE"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "TRE 0.8.0"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "tre"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "0.8.0"
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at runtime.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
/* #undef STACK_DIRECTION */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you want to enable approximate matching functionality. */
|
||||
/* #undef TRE_APPROX */
|
||||
|
||||
/* Define if you want TRE to print debug messages to stdout. */
|
||||
/* #undef TRE_DEBUG */
|
||||
|
||||
/* Define to enable multibyte character set support. */
|
||||
/* #undef TRE_MULTIBYTE */
|
||||
|
||||
/* Define to a field in the regex_t struct where TRE should store a pointer to
|
||||
the internal tre_tnfa_t structure */
|
||||
#define TRE_REGEX_T_FIELD re_g
|
||||
|
||||
/* Define to the absolute path to the system regex.h */
|
||||
#define TRE_SYSTEM_REGEX_H_PATH "../../../include/regex.h"
|
||||
|
||||
/* Define if you want TRE to use alloca() instead of malloc() when allocating
|
||||
memory needed for regexec operations. */
|
||||
/* #undef TRE_USE_ALLOCA */
|
||||
|
||||
/* Define to include the system regex.h from TRE regex.h */
|
||||
#define TRE_USE_SYSTEM_REGEX_H 1
|
||||
|
||||
/* TRE version string. */
|
||||
#define TRE_VERSION "0.8.0"
|
||||
|
||||
/* TRE version level 1. */
|
||||
#define TRE_VERSION_1 0
|
||||
|
||||
/* TRE version level 2. */
|
||||
#define TRE_VERSION_2 8
|
||||
|
||||
/* TRE version level 3. */
|
||||
#define TRE_VERSION_3 0
|
||||
|
||||
/* Define to enable wide character (wchar_t) support. */
|
||||
/* #undef TRE_WCHAR */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "0.8.0"
|
||||
|
||||
/* Define to the maximum value of wchar_t if not already defined elsewhere */
|
||||
/* #undef WCHAR_MAX */
|
||||
|
||||
/* Define if wchar_t is signed */
|
||||
/* #undef WCHAR_T_SIGNED */
|
||||
|
||||
/* Define if wchar_t is unsigned */
|
||||
/* #undef WCHAR_T_UNSIGNED */
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
/* #undef _FILE_OFFSET_BITS */
|
||||
|
||||
/* Define to enable GNU extensions in glibc */
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef _LARGE_FILES */
|
||||
|
||||
/* Define on IRIX */
|
||||
#define _REGCOMP_INTERNAL 1
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
/* #undef inline */
|
||||
#endif
|
5
external/bsd/tre/dist/lib/regcomp.c
vendored
5
external/bsd/tre/dist/lib/regcomp.c
vendored
@ -18,6 +18,11 @@
|
||||
#include "tre-internal.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(regcomp,_regcomp)
|
||||
__weak_alias(regfree,_regfree)
|
||||
#endif
|
||||
|
||||
int
|
||||
tre_regncomp(regex_t *preg, const char *regex, size_t n, int cflags)
|
||||
{
|
||||
|
4
external/bsd/tre/dist/lib/regerror.c
vendored
4
external/bsd/tre/dist/lib/regerror.c
vendored
@ -21,6 +21,10 @@
|
||||
#include "tre-internal.h"
|
||||
#include "tre.h"
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(regerror,_regerror)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETTEXT
|
||||
#include <libintl.h>
|
||||
#else
|
||||
|
6
external/bsd/tre/dist/lib/regexec.c
vendored
6
external/bsd/tre/dist/lib/regexec.c
vendored
@ -48,6 +48,9 @@ char *alloca ();
|
||||
#include "tre.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(regexec,_regexec)
|
||||
#endif
|
||||
|
||||
/* Fills the POSIX.2 regmatch_t array according to the TNFA tag and match
|
||||
endpoint values. */
|
||||
@ -204,6 +207,7 @@ tre_regnexec(const regex_t *preg, const char *str, size_t len,
|
||||
size_t nmatch, regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
|
||||
/* CONSTCOND */
|
||||
tre_str_type_t type = (TRE_MB_CUR_MAX == 1) ? STR_BYTE : STR_MBS;
|
||||
|
||||
return tre_match(tnfa, str, len, type, nmatch, pmatch, eflags);
|
||||
@ -218,7 +222,9 @@ tre_regexec(const regex_t *preg, const char *str,
|
||||
size_t newlen;
|
||||
|
||||
if (eflags & REG_STARTEND) {
|
||||
/* LINTED */
|
||||
newstr = &str[pmatch[0].rm_so];
|
||||
/* LINTED */
|
||||
newlen = pmatch[0].rm_eo;
|
||||
newflags = (unsigned)(eflags & ~REG_STARTEND);
|
||||
} else {
|
||||
|
44
external/bsd/tre/dist/lib/tre-config.h
vendored
Normal file
44
external/bsd/tre/dist/lib/tre-config.h
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
/* lib/tre-config.h. Generated from tre-config.h.in by configure. */
|
||||
/* tre-config.h.in. This file has all definitions that are needed in
|
||||
`tre.h'. Note that this file must contain only the bare minimum
|
||||
of definitions without the TRE_ prefix to avoid conflicts between
|
||||
definitions here and definitions included from somewhere else. */
|
||||
|
||||
/* Define to 1 if you have the <libutf8.h> header file. */
|
||||
/* #undef HAVE_LIBUTF8_H */
|
||||
|
||||
/* Define to 1 if the system has the type `reg_errcode_t'. */
|
||||
/* #undef HAVE_REG_ERRCODE_T */
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
/* #undef HAVE_WCHAR_H */
|
||||
|
||||
/* Define if you want to enable approximate matching functionality. */
|
||||
/* #undef TRE_APPROX */
|
||||
|
||||
/* Define to enable multibyte character set support. */
|
||||
/* #undef TRE_MULTIBYTE */
|
||||
|
||||
/* Define to the absolute path to the system tre.h */
|
||||
#define TRE_SYSTEM_REGEX_H_PATH "../../../include/regex.h"
|
||||
|
||||
/* Define to include the system regex.h from tre.h */
|
||||
#define TRE_USE_SYSTEM_REGEX_H 1
|
||||
|
||||
/* Define to enable wide character (wchar_t) support. */
|
||||
/* #undef TRE_WCHAR */
|
||||
|
||||
/* TRE version string. */
|
||||
#define TRE_VERSION "0.8.0"
|
||||
|
||||
/* TRE version level 1. */
|
||||
#define TRE_VERSION_1 0
|
||||
|
||||
/* TRE version level 2. */
|
||||
#define TRE_VERSION_2 8
|
||||
|
||||
/* TRE version level 3. */
|
||||
#define TRE_VERSION_3 0
|
20
external/bsd/tre/dist/lib/tre-match-backtrack.c
vendored
20
external/bsd/tre/dist/lib/tre-match-backtrack.c
vendored
@ -417,17 +417,17 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string,
|
||||
/* This is a back reference state. All transitions leaving from
|
||||
this state have the same back reference "assertion". Instead
|
||||
of reading the next character, we match the back reference. */
|
||||
int so, eo, bt = trans_i->u.backref;
|
||||
int bt_len;
|
||||
int result;
|
||||
regoff_t so, eo, bt = trans_i->u.backref;
|
||||
regoff_t bt_len;
|
||||
regoff_t result;
|
||||
|
||||
DPRINT((" should match back reference %d\n", bt));
|
||||
/* Get the substring we need to match against. Remember to
|
||||
turn off REG_NOSUB temporarily. */
|
||||
tre_fill_pmatch(bt + 1, pmatch, tnfa->cflags & /*LINTED*/!REG_NOSUB,
|
||||
tnfa, tags, pos);
|
||||
so = pmatch[bt].rm_so;
|
||||
eo = pmatch[bt].rm_eo;
|
||||
/* LINTED */so = pmatch[bt].rm_so;
|
||||
/* LINTED */eo = pmatch[bt].rm_eo;
|
||||
bt_len = eo - so;
|
||||
|
||||
#ifdef TRE_DEBUG
|
||||
@ -468,7 +468,7 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string,
|
||||
(size_t)bt_len);
|
||||
#endif /* TRE_WCHAR */
|
||||
else
|
||||
result = strncmp((const char*)string + so, str_byte - 1,
|
||||
/* LINTED */result = strncmp((const char*)string + so, str_byte - 1,
|
||||
(size_t)bt_len);
|
||||
}
|
||||
else if (len - pos < bt_len)
|
||||
@ -479,7 +479,7 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string,
|
||||
(size_t)bt_len);
|
||||
#endif /* TRE_WCHAR */
|
||||
else
|
||||
result = memcmp((const char*)string + so, str_byte - 1,
|
||||
/* LINTED */result = memcmp((const char*)string + so, str_byte - 1,
|
||||
(size_t)bt_len);
|
||||
|
||||
if (result == 0)
|
||||
@ -498,11 +498,11 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string,
|
||||
/* Advance in input string and resync `prev_c', `next_c'
|
||||
and pos. */
|
||||
DPRINT((" back reference matched\n"));
|
||||
str_byte += bt_len - 1;
|
||||
/* LINTED */str_byte += bt_len - 1;
|
||||
#ifdef TRE_WCHAR
|
||||
str_wide += bt_len - 1;
|
||||
/* LINTED */str_wide += bt_len - 1;
|
||||
#endif /* TRE_WCHAR */
|
||||
pos += bt_len - 1;
|
||||
/* LINTED */pos += bt_len - 1;
|
||||
GET_NEXT_WCHAR();
|
||||
DPRINT((" pos now %d\n", pos));
|
||||
}
|
||||
|
20
external/bsd/tre/dist/lib/tre-parse.c
vendored
20
external/bsd/tre/dist/lib/tre-parse.c
vendored
@ -174,6 +174,20 @@ tre_compare_items(const void *a, const void *b)
|
||||
|
||||
#ifndef TRE_USE_SYSTEM_WCTYPE
|
||||
|
||||
int tre_isalnum_func(tre_cint_t);
|
||||
int tre_isalpha_func(tre_cint_t);
|
||||
int tre_isascii_func(tre_cint_t);
|
||||
int tre_isblank_func(tre_cint_t);
|
||||
int tre_iscntrl_func(tre_cint_t);
|
||||
int tre_isdigit_func(tre_cint_t);
|
||||
int tre_isgraph_func(tre_cint_t);
|
||||
int tre_islower_func(tre_cint_t);
|
||||
int tre_isprint_func(tre_cint_t);
|
||||
int tre_ispunct_func(tre_cint_t);
|
||||
int tre_isspace_func(tre_cint_t);
|
||||
int tre_isupper_func(tre_cint_t);
|
||||
int tre_isxdigit_func(tre_cint_t);
|
||||
|
||||
/* isalnum() and the rest may be macros, so wrap them to functions. */
|
||||
int tre_isalnum_func(tre_cint_t c) { return tre_isalnum(c); }
|
||||
int tre_isalpha_func(tre_cint_t c) { return tre_isalpha(c); }
|
||||
@ -201,7 +215,7 @@ int tre_isupper_func(tre_cint_t c) { return tre_isupper(c); }
|
||||
int tre_isxdigit_func(tre_cint_t c) { return tre_isxdigit(c); }
|
||||
|
||||
struct {
|
||||
char *name;
|
||||
const char *name;
|
||||
int (*func)(tre_cint_t);
|
||||
} tre_ctype_map[] = {
|
||||
{ "alnum", &tre_isalnum_func },
|
||||
@ -324,7 +338,7 @@ tre_parse_bracket_items(tre_parse_ctx_t *ctx, int negate,
|
||||
#endif /* defined HAVE_WCSTOMBS */
|
||||
}
|
||||
#else /* !TRE_WCHAR */
|
||||
strncpy(tmp_str, (const char*)re + 2, len);
|
||||
/* LINTED */strncpy(tmp_str, (const char*)re + 2, len);
|
||||
#endif /* !TRE_WCHAR */
|
||||
tmp_str[len] = '\0';
|
||||
DPRINT((" class name: %s\n", tmp_str));
|
||||
@ -332,7 +346,7 @@ tre_parse_bracket_items(tre_parse_ctx_t *ctx, int negate,
|
||||
if (!class)
|
||||
status = REG_ECTYPE;
|
||||
/* Optimize character classes for 8 bit character sets. */
|
||||
if (status == REG_OK && TRE_MB_CUR_MAX == 1)
|
||||
/* CONSTCOND */if (status == REG_OK && TRE_MB_CUR_MAX == 1)
|
||||
{
|
||||
status = tre_expand_ctype(ctx->mem, class, items,
|
||||
&i, &max_i, ctx->cflags);
|
||||
|
119
external/bsd/tre/dist/lib/tre.h
vendored
119
external/bsd/tre/dist/lib/tre.h
vendored
@ -9,58 +9,7 @@
|
||||
#ifndef TRE_H
|
||||
#define TRE_H 1
|
||||
|
||||
/* #include "tre-config.h" */
|
||||
|
||||
/* included tre-config.h inline below - agc */
|
||||
/* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */
|
||||
/* lib/tre-config.h. Generated from tre-config.h.in by configure. */
|
||||
/* tre-config.h.in. This file has all definitions that are needed in
|
||||
`tre.h'. Note that this file must contain only the bare minimum
|
||||
of definitions without the TRE_ prefix to avoid conflicts between
|
||||
definitions here and definitions included from somewhere else. */
|
||||
|
||||
/* Define to 1 if you have the <libutf8.h> header file. */
|
||||
/* #undef HAVE_LIBUTF8_H */
|
||||
|
||||
/* Define to 1 if the system has the type `reg_errcode_t'. */
|
||||
/* #undef HAVE_REG_ERRCODE_T */
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
/* #undef HAVE_SYS_TYPES_H */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#define HAVE_WCHAR_H 1
|
||||
|
||||
/* Define if you want to enable approximate matching functionality. */
|
||||
#define TRE_APPROX 1
|
||||
|
||||
/* Define to enable multibyte character set support. */
|
||||
#define TRE_MULTIBYTE 1
|
||||
|
||||
/* Define to the absolute path to the system tre.h */
|
||||
/* #undef TRE_SYSTEM_REGEX_H_PATH */
|
||||
|
||||
/* Define to include the system regex.h from tre.h */
|
||||
/* #undef TRE_USE_SYSTEM_REGEX_H */
|
||||
|
||||
/* Define to enable wide character (wchar_t) support. */
|
||||
#define TRE_WCHAR 1
|
||||
|
||||
/* TRE version string. */
|
||||
#define TRE_VERSION "0.8.0"
|
||||
|
||||
/* TRE version level 1. */
|
||||
#define TRE_VERSION_1 0
|
||||
|
||||
/* TRE version level 2. */
|
||||
#define TRE_VERSION_2 8
|
||||
|
||||
/* TRE version level 3. */
|
||||
#define TRE_VERSION_3 0
|
||||
|
||||
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */
|
||||
/* end of tre-config.h */
|
||||
#include "tre-config.h"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
@ -74,10 +23,17 @@
|
||||
/* Include the system regex.h to make TRE ABI compatible with the
|
||||
system regex. */
|
||||
#include TRE_SYSTEM_REGEX_H_PATH
|
||||
#ifdef __weak_alias
|
||||
#define tre_regcomp _regcomp
|
||||
#define tre_regexec _regexec
|
||||
#define tre_regerror _regerror
|
||||
#define tre_regfree _regfree
|
||||
#else
|
||||
#define tre_regcomp regcomp
|
||||
#define tre_regexec regexec
|
||||
#define tre_regerror regerror
|
||||
#define tre_regfree regfree
|
||||
#endif
|
||||
#endif /* TRE_USE_SYSTEM_REGEX_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -165,9 +121,6 @@ typedef enum {
|
||||
#define REG_APPROX_MATCHER (REG_NOTEOL << 1)
|
||||
#define REG_BACKTRACKING_MATCHER (REG_APPROX_MATCHER << 1)
|
||||
|
||||
/* emulate Spencer regexp behavior with tre_regnexec */
|
||||
#define REG_STARTEND (REG_BACKTRACKING_MATCHER << 1)
|
||||
|
||||
#endif /* !TRE_USE_SYSTEM_REGEX_H */
|
||||
|
||||
/* REG_NOSPEC and REG_LITERAL mean the same thing. */
|
||||
@ -183,16 +136,18 @@ typedef enum {
|
||||
|
||||
/* The POSIX.2 regexp functions */
|
||||
extern int
|
||||
tre_regcomp(regex_t *, const char *, int);
|
||||
tre_regcomp(regex_t *preg, const char *regex, int cflags);
|
||||
|
||||
extern int
|
||||
tre_regexec(const regex_t *, const char *, size_t, regmatch_t *, int);
|
||||
tre_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags);
|
||||
|
||||
extern size_t
|
||||
tre_regerror(int, const regex_t *, char *, size_t);
|
||||
tre_regerror(int errcode, const regex_t *preg, char *errbuf,
|
||||
size_t errbuf_size);
|
||||
|
||||
extern void
|
||||
tre_regfree(regex_t *);
|
||||
tre_regfree(regex_t *preg);
|
||||
|
||||
#ifdef TRE_WCHAR
|
||||
#ifdef HAVE_WCHAR_H
|
||||
@ -201,29 +156,29 @@ tre_regfree(regex_t *);
|
||||
|
||||
/* Wide character versions (not in POSIX.2). */
|
||||
extern int
|
||||
tre_regwcomp(regex_t *, const wchar_t *, int);
|
||||
tre_regwcomp(regex_t *preg, const wchar_t *regex, int cflags);
|
||||
|
||||
extern int
|
||||
tre_regwexec(const regex_t *, const wchar_t *,
|
||||
size_t, regmatch_t [], int);
|
||||
tre_regwexec(const regex_t *preg, const wchar_t *string,
|
||||
size_t nmatch, regmatch_t pmatch[], int eflags);
|
||||
#endif /* TRE_WCHAR */
|
||||
|
||||
/* Versions with a maximum length argument and therefore the capability to
|
||||
handle null characters in the middle of the strings (not in POSIX.2). */
|
||||
extern int
|
||||
tre_regncomp(regex_t *, const char *, size_t, int);
|
||||
tre_regncomp(regex_t *preg, const char *regex, size_t len, int cflags);
|
||||
|
||||
extern int
|
||||
tre_regnexec(const regex_t *, const char *, size_t,
|
||||
size_t, regmatch_t [], int);
|
||||
tre_regnexec(const regex_t *preg, const char *string, size_t len,
|
||||
size_t nmatch, regmatch_t pmatch[], int eflags);
|
||||
|
||||
#ifdef TRE_WCHAR
|
||||
extern int
|
||||
tre_regwncomp(regex_t *, const wchar_t *, size_t, int);
|
||||
tre_regwncomp(regex_t *preg, const wchar_t *regex, size_t len, int cflags);
|
||||
|
||||
extern int
|
||||
tre_regwnexec(const regex_t *, const wchar_t *, size_t,
|
||||
size_t, regmatch_t [], int);
|
||||
tre_regwnexec(const regex_t *preg, const wchar_t *string, size_t len,
|
||||
size_t nmatch, regmatch_t pmatch[], int eflags);
|
||||
#endif /* TRE_WCHAR */
|
||||
|
||||
#ifdef TRE_APPROX
|
||||
@ -254,26 +209,26 @@ typedef struct {
|
||||
|
||||
/* Approximate matching functions. */
|
||||
extern int
|
||||
tre_regaexec(const regex_t *, const char *,
|
||||
regamatch_t *, regaparams_t, int );
|
||||
tre_regaexec(const regex_t *preg, const char *string,
|
||||
regamatch_t *match, regaparams_t params, int eflags);
|
||||
|
||||
extern int
|
||||
tre_reganexec(const regex_t *, const char *, size_t,
|
||||
regamatch_t *, regaparams_t, int);
|
||||
tre_reganexec(const regex_t *preg, const char *string, size_t len,
|
||||
regamatch_t *match, regaparams_t params, int eflags);
|
||||
#ifdef TRE_WCHAR
|
||||
/* Wide character approximate matching. */
|
||||
extern int
|
||||
tre_regawexec(const regex_t *, const wchar_t *,
|
||||
regamatch_t *, regaparams_t, int);
|
||||
tre_regawexec(const regex_t *preg, const wchar_t *string,
|
||||
regamatch_t *match, regaparams_t params, int eflags);
|
||||
|
||||
extern int
|
||||
tre_regawnexec(const regex_t *, const wchar_t *, size_t,
|
||||
regamatch_t *, regaparams_t, int );
|
||||
tre_regawnexec(const regex_t *preg, const wchar_t *string, size_t len,
|
||||
regamatch_t *match, regaparams_t params, int eflags);
|
||||
#endif /* TRE_WCHAR */
|
||||
|
||||
/* Sets the parameters to default values. */
|
||||
extern void
|
||||
tre_regaparams_default(regaparams_t *);
|
||||
tre_regaparams_default(regaparams_t *params);
|
||||
#endif /* TRE_APPROX */
|
||||
|
||||
#ifdef TRE_WCHAR
|
||||
@ -290,8 +245,8 @@ typedef struct {
|
||||
} tre_str_source;
|
||||
|
||||
extern int
|
||||
tre_reguexec(const regex_t *, const tre_str_source *,
|
||||
size_t, regmatch_t [], int);
|
||||
tre_reguexec(const regex_t *preg, const tre_str_source *string,
|
||||
size_t nmatch, regmatch_t pmatch[], int eflags);
|
||||
|
||||
/* Returns the version string. The returned string is static. */
|
||||
extern char *
|
||||
@ -301,7 +256,7 @@ tre_version(void);
|
||||
must point to depends of the value of `query', see documentation for
|
||||
more details. */
|
||||
extern int
|
||||
tre_config(int, void *);
|
||||
tre_config(int query, void *result);
|
||||
|
||||
enum {
|
||||
TRE_CONFIG_APPROX,
|
||||
@ -313,12 +268,12 @@ enum {
|
||||
|
||||
/* Returns 1 if the compiled pattern has back references, 0 if not. */
|
||||
extern int
|
||||
tre_have_backrefs(const regex_t *);
|
||||
tre_have_backrefs(const regex_t *preg);
|
||||
|
||||
/* Returns 1 if the compiled pattern uses approximate matching features,
|
||||
0 if not. */
|
||||
extern int
|
||||
tre_have_approx(const regex_t *);
|
||||
tre_have_approx(const regex_t *preg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.142 2010/05/30 08:28:53 tnozaki Exp $
|
||||
# $NetBSD: Makefile,v 1.143 2010/09/04 12:17:58 ahoka Exp $
|
||||
# @(#)Makefile 8.2 (Berkeley) 2/3/94
|
||||
#
|
||||
# All library objects contain sccsid strings by default; they may be
|
||||
@ -78,7 +78,11 @@ COMPATDIR=${.CURDIR}/compat
|
||||
.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
|
||||
.include "${.CURDIR}/quad/Makefile.inc"
|
||||
.endif
|
||||
.if (${USE_LIBTRE} == "yes")
|
||||
.include "${NETBSDSRCDIR}/external/bsd/tre/Makefile.inc"
|
||||
.else
|
||||
.include "${.CURDIR}/regex/Makefile.inc"
|
||||
.endif
|
||||
.include "${.CURDIR}/resolv/Makefile.inc"
|
||||
.include "${.CURDIR}/rpc/Makefile.inc"
|
||||
.include "${.CURDIR}/ssp/Makefile.inc"
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: bsd.own.mk,v 1.640 2010/08/22 18:56:21 rmind Exp $
|
||||
# $NetBSD: bsd.own.mk,v 1.641 2010/09/04 12:17:58 ahoka Exp $
|
||||
|
||||
# This needs to be before bsd.init.mk
|
||||
.if defined(BSD_MK_COMPAT_FILE)
|
||||
@ -871,7 +871,7 @@ ${var}?= yes
|
||||
# USE_* options which default to "no".
|
||||
#
|
||||
# For now, disable pigz as compressor by default
|
||||
.for var in USE_PIGZGZIP
|
||||
.for var in USE_PIGZGZIP USE_LIBTRE
|
||||
${var}?= no
|
||||
.endfor
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user