svn commit: r224893 - in user/gabor/tre-integration:
contrib/tre/lib include lib/libc/regex
Gabor Kovesdan
gabor at FreeBSD.org
Mon Aug 15 17:23:07 UTC 2011
Author: gabor
Date: Mon Aug 15 17:23:06 2011
New Revision: 224893
URL: http://svn.freebsd.org/changeset/base/224893
Log:
- Clean up header files
Deleted:
user/gabor/tre-integration/contrib/tre/lib/tre-config.h
user/gabor/tre-integration/contrib/tre/lib/tre.h
Modified:
user/gabor/tre-integration/contrib/tre/lib/regcomp.c
user/gabor/tre-integration/contrib/tre/lib/regerror.c
user/gabor/tre-integration/contrib/tre/lib/regexec.c
user/gabor/tre-integration/contrib/tre/lib/tre-compile.c
user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c
user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.h
user/gabor/tre-integration/contrib/tre/lib/tre-internal.h
user/gabor/tre-integration/contrib/tre/lib/tre-match-approx.c
user/gabor/tre-integration/contrib/tre/lib/tre-match-backtrack.c
user/gabor/tre-integration/contrib/tre/lib/tre-match-parallel.c
user/gabor/tre-integration/contrib/tre/lib/tre-stack.h
user/gabor/tre-integration/include/regex.h
user/gabor/tre-integration/lib/libc/regex/Makefile.inc
Modified: user/gabor/tre-integration/contrib/tre/lib/regcomp.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/regcomp.c Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/regcomp.c Mon Aug 15 17:23:06 2011 (r224893)
@@ -12,13 +12,14 @@
#include <string.h>
#include <errno.h>
+#include <regex.h>
#include <stdlib.h>
+#include "tre-fastmatch.h"
#include "tre-internal.h"
-#include "tre.h"
#include "xmalloc.h"
-#ifdef TRE_WEAK_REF
+#ifdef TRE_LIBC_BUILD
__weak_reference(tre_regcomp, regcomp);
__weak_reference(tre_regncomp, regncomp);
__weak_reference(tre_regwcomp, regwcomp);
Modified: user/gabor/tre-integration/contrib/tre/lib/regerror.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/regerror.c Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/regerror.c Mon Aug 15 17:23:06 2011 (r224893)
@@ -10,6 +10,7 @@
#include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <regex.h>
#include <string.h>
#ifdef HAVE_WCHAR_H
#include <wchar.h>
@@ -19,7 +20,6 @@
#endif /* HAVE_WCTYPE_H */
#include "tre-internal.h"
-#include "tre.h"
#ifdef HAVE_GETTEXT
#include <libintl.h>
@@ -28,7 +28,7 @@
#define gettext(s) s
#endif
-#ifdef TRE_WEAK_REF
+#ifdef TRE_LIBC_BUILD
__weak_reference(tre_regerror, regerror);
#endif
Modified: user/gabor/tre-integration/contrib/tre/lib/regexec.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/regexec.c Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/regexec.c Mon Aug 15 17:23:06 2011 (r224893)
@@ -28,6 +28,7 @@ char *alloca ();
#endif /* TRE_USE_ALLOCA */
#include <assert.h>
+#include <regex.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_WCHAR_H
@@ -46,10 +47,9 @@ char *alloca ();
#include "tre-fastmatch.h"
#include "tre-internal.h"
-#include "tre.h"
#include "xmalloc.h"
-#ifdef TRE_WEAK_REF
+#ifdef TRE_LIBC_BUILD
__weak_reference(tre_regexec, regexec);
__weak_reference(tre_regnexec, regnexec);
__weak_reference(tre_regwexec, regwexec);
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-compile.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-compile.c Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-compile.c Mon Aug 15 17:23:06 2011 (r224893)
@@ -18,6 +18,7 @@
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <assert.h>
+#include <regex.h>
#include <string.h>
#include "tre-fastmatch.h"
@@ -27,7 +28,6 @@
#include "tre-ast.h"
#include "tre-parse.h"
#include "tre-compile.h"
-#include "tre.h"
#include "xmalloc.h"
/*
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Mon Aug 15 17:23:06 2011 (r224893)
@@ -29,6 +29,7 @@
#include <config.h>
#endif /* HAVE_CONFIG_H */
#include <limits.h>
+#include <regex.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
@@ -38,7 +39,6 @@
#endif
#include "hashtable.h"
-#include "tre.h"
#include "tre-fastmatch.h"
#include "tre-internal.h"
#include "xmalloc.h"
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.h
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.h Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.h Mon Aug 15 17:23:06 2011 (r224893)
@@ -29,10 +29,10 @@
#define TRE_FASTMATCH_H 1
#include <limits.h>
+#include <regex.h>
#include <stdbool.h>
#include "hashtable.h"
-#include "tre.h"
#include "tre-internal.h"
#define BM_MAX_LEN 1024
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-internal.h
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-internal.h Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-internal.h Mon Aug 15 17:23:06 2011 (r224893)
@@ -9,6 +9,8 @@
#ifndef TRE_INTERNAL_H
#define TRE_INTERNAL_H 1
+#include <regex.h>
+
#ifdef HAVE_WCHAR_H
#include <wchar.h>
#endif /* HAVE_WCHAR_H */
@@ -18,7 +20,6 @@
#endif /* !HAVE_WCTYPE_H */
#include <ctype.h>
-#include "tre.h"
#ifdef TRE_DEBUG
#include <stdio.h>
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-match-approx.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-match-approx.c Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-match-approx.c Mon Aug 15 17:23:06 2011 (r224893)
@@ -31,6 +31,7 @@ char *alloca ();
#undef __NO_INLINE__
#include <assert.h>
+#include <regex.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
@@ -49,7 +50,6 @@ char *alloca ();
#include "tre-internal.h"
#include "tre-match-utils.h"
-#include "tre.h"
#include "xmalloc.h"
#define TRE_M_COST 0
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-match-backtrack.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-match-backtrack.c Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-match-backtrack.c Mon Aug 15 17:23:06 2011 (r224893)
@@ -52,6 +52,7 @@ char *alloca ();
#endif /* TRE_USE_ALLOCA */
#include <assert.h>
+#include <regex.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_WCHAR_H
@@ -70,7 +71,6 @@ char *alloca ();
#include "tre-internal.h"
#include "tre-mem.h"
#include "tre-match-utils.h"
-#include "tre.h"
#include "xmalloc.h"
typedef struct {
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-match-parallel.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-match-parallel.c Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-match-parallel.c Mon Aug 15 17:23:06 2011 (r224893)
@@ -45,6 +45,7 @@ char *alloca ();
#endif /* TRE_USE_ALLOCA */
#include <assert.h>
+#include <regex.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_WCHAR_H
@@ -62,7 +63,6 @@ char *alloca ();
#include "tre-internal.h"
#include "tre-match-utils.h"
-#include "tre.h"
#include "xmalloc.h"
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-stack.h
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-stack.h Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-stack.h Mon Aug 15 17:23:06 2011 (r224893)
@@ -10,7 +10,7 @@
#ifndef TRE_STACK_H
#define TRE_STACK_H 1
-#include "tre.h"
+#include <regex.h>
typedef struct tre_stack_rec tre_stack_t;
Modified: user/gabor/tre-integration/include/regex.h
==============================================================================
--- user/gabor/tre-integration/include/regex.h Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/include/regex.h Mon Aug 15 17:23:06 2011 (r224893)
@@ -18,6 +18,7 @@
extern "C" {
#endif
+#ifndef TRE_LIBC_BUILD
#define tre_regcomp regcomp
#define tre_regerror regerror
#define tre_regexec regexec
@@ -36,6 +37,29 @@ extern "C" {
#define tre_regwncomp regwncomp
#define tre_regwnexec regwnexec
+#define FUNC_DECL(f) f
+#else
+#define regcomp tre_regcomp
+#define regerror tre_regerror
+#define regexec tre_regexec
+#define regfree tre_regfree
+
+#define regacomp tre_regacomp
+#define regaexec tre_regaexec
+#define regancomp tre_regancomp
+#define reganexec tre_reganexec
+#define regawncomp tre_regawncomp
+#define regawnexec tre_regawnexec
+#define regncomp tre_regncomp
+#define regnexec tre_regnexec
+#define regwcomp tre_regwcomp
+#define regwexec tre_regwexec
+#define regwncomp tre_regwncomp
+#define regwnexec tre_regwnexec
+
+#define FUNC_DECL(f) tre_##f
+#endif
+
typedef int regoff_t;
typedef struct {
size_t re_nsub; /* Number of parenthesized subexpressions. */
@@ -106,46 +130,46 @@ typedef enum {
/* The POSIX.2 regexp functions */
extern int
-regcomp(regex_t *preg, const char *regex, int cflags);
+FUNC_DECL(regcomp)(regex_t *preg, const char *regex, int cflags);
extern int
-regexec(const regex_t *preg, const char *string, size_t nmatch,
+FUNC_DECL(regexec)(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags);
extern size_t
-regerror(int errcode, const regex_t *preg, char *errbuf,
+FUNC_DECL(regerror)(int errcode, const regex_t *preg, char *errbuf,
size_t errbuf_size);
extern void
-regfree(regex_t *preg);
+FUNC_DECL(regfree)(regex_t *preg);
#ifdef TRE_WCHAR
#include <wchar.h>
/* Wide character versions (not in POSIX.2). */
extern int
-regwcomp(regex_t *preg, const wchar_t *regex, int cflags);
+FUNC_DECL(regwcomp)(regex_t *preg, const wchar_t *regex, int cflags);
extern int
-regwexec(const regex_t *preg, const wchar_t *string,
+FUNC_DECL(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
-regncomp(regex_t *preg, const char *regex, size_t len, int cflags);
+FUNC_DECL(regncomp)(regex_t *preg, const char *regex, size_t len, int cflags);
extern int
-regnexec(const regex_t *preg, const char *string, size_t len,
+FUNC_DECL(regnexec)(const regex_t *preg, const char *string, size_t len,
size_t nmatch, regmatch_t pmatch[], int eflags);
#ifdef TRE_WCHAR
extern int
-regwncomp(regex_t *preg, const wchar_t *regex, size_t len, int cflags);
+FUNC_DECL(regwncomp)(regex_t *preg, const wchar_t *regex, size_t len, int cflags);
extern int
-regwnexec(const regex_t *preg, const wchar_t *string, size_t len,
+FUNC_DECL(regwnexec)(const regex_t *preg, const wchar_t *string, size_t len,
size_t nmatch, regmatch_t pmatch[], int eflags);
#endif /* TRE_WCHAR */
@@ -177,20 +201,20 @@ typedef struct {
/* Approximate matching functions. */
extern int
-regaexec(const regex_t *preg, const char *string,
+FUNC_DECL(regaexec)(const regex_t *preg, const char *string,
regamatch_t *match, regaparams_t params, int eflags);
extern int
-reganexec(const regex_t *preg, const char *string, size_t len,
+FUNC_DECL(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
-regawexec(const regex_t *preg, const wchar_t *string,
+FUNC_DECL(regawexec)(const regex_t *preg, const wchar_t *string,
regamatch_t *match, regaparams_t params, int eflags);
extern int
-regawnexec(const regex_t *preg, const wchar_t *string, size_t len,
+FUNC_DECL(regawnexec)(const regex_t *preg, const wchar_t *string, size_t len,
regamatch_t *match, regaparams_t params, int eflags);
#endif /* TRE_WCHAR */
@@ -213,7 +237,7 @@ typedef struct {
} tre_str_source;
extern int
-reguexec(const regex_t *preg, const tre_str_source *string,
+FUNC_DECL(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. */
Modified: user/gabor/tre-integration/lib/libc/regex/Makefile.inc
==============================================================================
--- user/gabor/tre-integration/lib/libc/regex/Makefile.inc Mon Aug 15 17:10:23 2011 (r224892)
+++ user/gabor/tre-integration/lib/libc/regex/Makefile.inc Mon Aug 15 17:23:06 2011 (r224893)
@@ -3,12 +3,11 @@
.PATH: ${.CURDIR}/../../contrib/tre/lib ${.CURDIR}/regex
-CFLAGS+=-DHAVE_CONFIG_H -DTRE_WEAK_REF -I${.CURDIR}/../../contrib/tre
+CFLAGS+=-DHAVE_CONFIG_H -DTRE_LIBC_BUILD -I${.CURDIR}/../../contrib/tre
-SRCS+= fastmatch.c hashtable.c \
- regcomp.c regerror.c regexec.c tre-ast.c tre-compile.c \
- tre-match-approx.c tre-match-backtrack.c tre-match-parallel.c \
- tre-mem.c tre-parse.c tre-stack.c xmalloc.c
+SRCS+= hashtable.c regcomp.c regerror.c regexec.c tre-ast.c tre-compile.c \
+ tre-fastmatch.c tre-match-approx.c tre-match-backtrack.c \
+ tre-match-parallel.c tre-mem.c tre-parse.c tre-stack.c xmalloc.c
MAN+= regex.3 re_format.7
More information about the svn-src-user
mailing list