a better fix for using builtin regex under BSD (also fixes compilation for Mac OS X) (patch 1089445)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31747 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2005-02-04 09:37:55 +00:00
parent 1b072e196e
commit 2af7511ea7
3 changed files with 10 additions and 22 deletions

View File

@ -199,7 +199,7 @@ bool wxRegExImpl::Compile(const wxString& expr, int flags)
// compile it // compile it
#ifdef __REG_NOFRONT #ifdef __REG_NOFRONT
bool conv = true; bool conv = true;
int errorcode = re_comp(&m_RegEx, expr, expr.length(), flagsRE); int errorcode = wx_re_comp(&m_RegEx, expr, expr.length(), flagsRE);
#else #else
const wxWX2MBbuf conv = expr.mbc_str(); const wxWX2MBbuf conv = expr.mbc_str();
int errorcode = conv ? regcomp(&m_RegEx, conv, flagsRE) : REG_BADPAT; int errorcode = conv ? regcomp(&m_RegEx, conv, flagsRE) : REG_BADPAT;
@ -283,7 +283,7 @@ bool wxRegExImpl::Matches(const wxChar *str, int flags) const
// do match it // do match it
#ifdef __REG_NOFRONT #ifdef __REG_NOFRONT
bool conv = true; bool conv = true;
int rc = re_exec(&self->m_RegEx, str, wxStrlen(str), NULL, m_nMatches, m_Matches, flagsRE); int rc = wx_re_exec(&self->m_RegEx, str, wxStrlen(str), NULL, m_nMatches, m_Matches, flagsRE);
#else #else
const wxWX2MBbuf conv = wxConvertWX2MB(str); const wxWX2MBbuf conv = wxConvertWX2MB(str);
int rc = conv ? regexec(&self->m_RegEx, conv, m_nMatches, m_Matches, flagsRE) : REG_BADPAT; int rc = conv ? regexec(&self->m_RegEx, conv, m_nMatches, m_Matches, flagsRE) : REG_BADPAT;

View File

@ -70,18 +70,12 @@
#endif #endif
#if wxUSE_UNICODE #if wxUSE_UNICODE
# define __REG_WIDE_T wxChar # define __REG_WIDE_T wxChar
# define __REG_WIDE_COMPILE re_comp # define __REG_WIDE_COMPILE wx_re_comp
# define __REG_WIDE_EXEC re_exec # define __REG_WIDE_EXEC wx_re_exec
# define __REG_NOCHAR /* don't want the char versions */ # define __REG_NOCHAR /* don't want the char versions */
#endif #endif
#define __REG_NOFRONT /* don't want regcomp() and regexec() */ #define __REG_NOFRONT /* don't want regcomp() and regexec() */
#define _ANSI_ARGS_(x) x #define _ANSI_ARGS_(x) x
/* under FreeBSD re_comp and re_exec are declared (differently) in unistd.h */
#ifdef __FreeBSD__
#define re_comp wx_re_comp
#define re_exec wx_re_exec
#endif
/* --- end --- */ /* --- end --- */
/* internal character type and related */ /* internal character type and related */
@ -119,8 +113,8 @@ typedef int celt; /* type to hold chr, MCCE number, or NOCELT */
#define iscspace(x) ((wxUChar)(x) < 128 && isspace(x)) #define iscspace(x) ((wxUChar)(x) < 128 && isspace(x))
/* name the external functions */ /* name the external functions */
#define compile re_comp #define compile wx_re_comp
#define exec re_exec #define exec wx_re_exec
/* enable/disable debugging code (by whether REG_DEBUG is defined or not) */ /* enable/disable debugging code (by whether REG_DEBUG is defined or not) */
#if 0 /* no debug unless requested by makefile */ #if 0 /* no debug unless requested by makefile */

View File

@ -109,18 +109,12 @@ extern "C" {
#endif #endif
#if wxUSE_UNICODE #if wxUSE_UNICODE
# define __REG_WIDE_T wxChar # define __REG_WIDE_T wxChar
# define __REG_WIDE_COMPILE re_comp # define __REG_WIDE_COMPILE wx_re_comp
# define __REG_WIDE_EXEC re_exec # define __REG_WIDE_EXEC wx_re_exec
# define __REG_NOCHAR /* don't want the char versions */ # define __REG_NOCHAR /* don't want the char versions */
#endif #endif
#define __REG_NOFRONT /* don't want regcomp() and regexec() */ #define __REG_NOFRONT /* don't want regcomp() and regexec() */
#define _ANSI_ARGS_(x) x #define _ANSI_ARGS_(x) x
/* under FreeBSD re_comp and re_exec are declared (differently) in unistd.h */
#ifdef __FreeBSD__
#define re_comp wx_re_comp
#define re_exec wx_re_exec
#endif
/* --- end --- */ /* --- end --- */
@ -307,7 +301,7 @@ typedef struct {
/* automatically gathered by fwd; do not hand-edit */ /* automatically gathered by fwd; do not hand-edit */
/* === regproto.h === */ /* === regproto.h === */
#ifndef __REG_NOCHAR #ifndef __REG_NOCHAR
int re_comp _ANSI_ARGS_((regex_t *, __REG_CONST char *, size_t, int)); int wx_re_comp _ANSI_ARGS_((regex_t *, __REG_CONST char *, size_t, int));
#endif #endif
#ifndef __REG_NOFRONT #ifndef __REG_NOFRONT
int regcomp _ANSI_ARGS_((regex_t *, __REG_CONST char *, int)); int regcomp _ANSI_ARGS_((regex_t *, __REG_CONST char *, int));
@ -316,7 +310,7 @@ int regcomp _ANSI_ARGS_((regex_t *, __REG_CONST char *, int));
int __REG_WIDE_COMPILE _ANSI_ARGS_((regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int)); int __REG_WIDE_COMPILE _ANSI_ARGS_((regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int));
#endif #endif
#ifndef __REG_NOCHAR #ifndef __REG_NOCHAR
int re_exec _ANSI_ARGS_((regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmatch_t [], int)); int wx_re_exec _ANSI_ARGS_((regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmatch_t [], int));
#endif #endif
#ifndef __REG_NOFRONT #ifndef __REG_NOFRONT
int regexec _ANSI_ARGS_((regex_t *, __REG_CONST char *, size_t, regmatch_t [], int)); int regexec _ANSI_ARGS_((regex_t *, __REG_CONST char *, size_t, regmatch_t [], int));