mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-23 14:45:04 +08:00
applied patch 890642: wxRE_ADVANCED flag and docs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25866 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
+6
-30
@@ -31,9 +31,9 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
**********************************************************************
|
||||
|
||||
PostgreSQL adopted the code out of Tcl 8.4.1. Portions of regc_locale.c
|
||||
and re_syntax.n were developed by Tcl developers other than Henry; these
|
||||
files bear the Tcl copyright and license notice:
|
||||
wxWindows adopted the code out of Tcl 8.4.5. Portions of regc_locale.c
|
||||
and re_syntax.n were developed by Tcl developers other than Henry Spencer;
|
||||
these files bear the Tcl copyright and license notice:
|
||||
|
||||
**********************************************************************
|
||||
|
||||
@@ -80,31 +80,7 @@ terms specified in this license.
|
||||
|
||||
**********************************************************************
|
||||
|
||||
Subsequent modifications to the code by the PostgreSQL project follow
|
||||
the same license terms as the rest of PostgreSQL.
|
||||
(License follows)
|
||||
****************************************************************************
|
||||
PostgreSQL Database Management System
|
||||
(formerly known as Postgres, then as Postgres95)
|
||||
|
||||
Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
|
||||
Portions Copyright (c) 1994, The Regents of the University of California
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose, without fee, and without a written agreement
|
||||
is hereby granted, provided that the above copyright notice and this
|
||||
paragraph and the following two paragraphs appear in all copies.
|
||||
|
||||
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
|
||||
LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
|
||||
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
|
||||
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
The wxWindows license applies to further modifications to regcustom.h
|
||||
and regc_locale.c.
|
||||
|
||||
****************************************************************************
|
||||
|
||||
+31
-59
@@ -1,69 +1,41 @@
|
||||
wxWindows regex
|
||||
----------------
|
||||
This is a version of Henry Spencer's regex,
|
||||
which was taken from postresql, which was
|
||||
taken from the source of TCL (Toolkit Command Language).
|
||||
---------------
|
||||
This is a version of Henry Spencer's regex, which was taken from the
|
||||
source of TCL (Toolkit Command Language). It implements POSIX regular
|
||||
expressions and also supports Unicode and some Perl5 extensions.
|
||||
|
||||
This is version of Henry Spencer's library is
|
||||
modified by the wxWindows team. The modifications
|
||||
made by the wxWindows team are as follows:
|
||||
regcustom.h (all source code)
|
||||
regex.h (function wrappers, other)
|
||||
regc_locale.c (A function or two).
|
||||
All the rest (Using standard c library routines instead of
|
||||
postresql routines, various cleanup/optimizations)
|
||||
The modifications made by the wxWindows team are as follows:
|
||||
|
||||
The source code that is wxWindows-specific is as follows:
|
||||
regcustom.h (all source code, see comments in source on how to replace)
|
||||
regex.h (where noted with comments in source, compiler workarounds)
|
||||
regcomp.c (a few of the functions prefixed with wx_,
|
||||
these may be replaced by c library routines)
|
||||
regcustom.h
|
||||
-----------
|
||||
Types and constants appropriate for our use of the library are defined
|
||||
here.
|
||||
|
||||
This newer library was chosen over the old one because
|
||||
Henry Spencer's old library did not support unicode and
|
||||
had some other bugs that were fixed by this one, and
|
||||
the license was incompatible with the wxWindows license
|
||||
and the gpl.
|
||||
regex.h
|
||||
-------
|
||||
This is unmodified. Note though, that a portion of it (clearly marked)
|
||||
is copied from regcustom.h as part of the build process.
|
||||
|
||||
Regular Expression syntax documentation is in re_syntax.n.
|
||||
Programming information (from older regex, but with
|
||||
the function wrappers implemented in the wxWindows
|
||||
version, the usage is somewhat the same) is in regex.3.
|
||||
regc_locale.c
|
||||
-------------
|
||||
This module provides character classifications.
|
||||
|
||||
Modifications made by the wxWindows team are not licensed.
|
||||
Contact - Ryan Norton <wxprojects@comcast.net>
|
||||
The current version from Tcl supports only a Unicode build. The
|
||||
original code from Henry Spencer, on the other hand, was ASCII only.
|
||||
Therefore, in order to support both, code from the ASCII version has been
|
||||
incorporated into the Unicode version, conditionally compiled depending
|
||||
on wxUSE_UNICODE.
|
||||
|
||||
The original readme (from the TCL distribution) follows:
|
||||
The only non-trivial dependencies were: Tcl_UniCharToUpper,
|
||||
Tcl_UniCharToLower and Tcl_UniCharToTitle. The implementations of these
|
||||
have also been incorporated (from Tcl). These in turn depend only the data
|
||||
tables in tclUniData.c (which is unmodified). At some point wxWindows
|
||||
may have it's own Unicode character classification code, at which point
|
||||
these should be used instead.
|
||||
|
||||
alpha3.8 release.
|
||||
Tue Aug 10 15:51:48 EDT 1999
|
||||
henry@spsystems.net (formerly henry@zoo.toronto.edu)
|
||||
Other dependencies (on Tcl_DString) have been eliminated using wxWindows
|
||||
wxChar functions.
|
||||
|
||||
See WHATSNEW for change listing.
|
||||
The ASCII version has also been extended to support character
|
||||
classifications based on the current locale rather than ASCII only.
|
||||
|
||||
installation notes:
|
||||
--------
|
||||
Read the comments at the beginning of Makefile before running.
|
||||
|
||||
Utils.h contains some things that just might have to be modified on
|
||||
some systems, as well as a nested include (ugh) of <assert.h>.
|
||||
|
||||
The "fake" directory contains quick-and-dirty fakes for some header
|
||||
files and routines that old systems may not have. Note also that
|
||||
-DUSEBCOPY will make utils.h substitute bcopy() for memmove().
|
||||
|
||||
After that, "make r" will build regcomp.o, regexec.o, regfree.o,
|
||||
and regerror.o (the actual routines), bundle them together into a test
|
||||
program, and run regression tests on them. No output is good output.
|
||||
|
||||
"make lib" builds just the .o files for the actual routines (when
|
||||
you're happy with testing and have adjusted CFLAGS for production),
|
||||
and puts them together into libregex.a. You can pick up either the
|
||||
library or *.o ("make lib" makes sure there are no other .o files left
|
||||
around to confuse things).
|
||||
|
||||
Main.c, debug.c, split.c are used for regression testing but are not part
|
||||
of the RE routines themselves.
|
||||
|
||||
Regex.h goes in /usr/include. All other .h files are internal only.
|
||||
--------
|
||||
|
||||
+305
-116
File diff suppressed because it is too large
Load Diff
+49
-44
@@ -27,15 +27,16 @@
|
||||
*/
|
||||
|
||||
/* headers if any */
|
||||
#include "tclInt.h"
|
||||
#include "wx/wxchar.h"
|
||||
|
||||
/* overrides for regguts.h definitions, if any */
|
||||
#define FUNCPTR(name, args) (*name) _ANSI_ARGS_(args)
|
||||
#define MALLOC(n) ckalloc(n)
|
||||
#define FREE(p) ckfree(VS(p))
|
||||
#define REALLOC(p,n) ckrealloc(VS(p),n)
|
||||
|
||||
|
||||
/* regguts only includes standard headers if NULL is not defined, so do it
|
||||
* ourselves here */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Do not insert extras between the "begin" and "end" lines -- this
|
||||
@@ -67,53 +68,57 @@
|
||||
#ifdef __REG_NOCHAR
|
||||
#undef __REG_NOCHAR
|
||||
#endif
|
||||
/* interface types */
|
||||
#define __REG_WIDE_T Tcl_UniChar
|
||||
#define __REG_REGOFF_T long /* not really right, but good enough... */
|
||||
#define __REG_VOID_T VOID
|
||||
#define __REG_CONST CONST
|
||||
/* names and declarations */
|
||||
#define __REG_WIDE_COMPILE TclReComp
|
||||
#define __REG_WIDE_EXEC TclReExec
|
||||
#define __REG_NOFRONT /* don't want regcomp() and regexec() */
|
||||
#define __REG_NOCHAR /* or the char versions */
|
||||
#define regfree TclReFree
|
||||
#define regerror TclReError
|
||||
#if wxUSE_UNICODE
|
||||
# define __REG_WIDE_T wxChar
|
||||
# define __REG_WIDE_COMPILE re_comp
|
||||
# define __REG_WIDE_EXEC re_exec
|
||||
# define __REG_NOCHAR /* don't want the char versions */
|
||||
#endif
|
||||
#define __REG_NOFRONT /* don't want regcomp() and regexec() */
|
||||
#define _ANSI_ARGS_(x) x
|
||||
/* --- end --- */
|
||||
|
||||
|
||||
|
||||
/* internal character type and related */
|
||||
typedef Tcl_UniChar chr; /* the type itself */
|
||||
typedef int pchr; /* what it promotes to */
|
||||
typedef unsigned uchr; /* unsigned type that will hold a chr */
|
||||
typedef int celt; /* type to hold chr, MCCE number, or NOCELT */
|
||||
#define NOCELT (-1) /* celt value which is not valid chr or MCCE */
|
||||
#define CHR(c) (UCHAR(c)) /* turn char literal into chr literal */
|
||||
#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
|
||||
#if TCL_UTF_MAX > 3
|
||||
#define CHRBITS 32 /* bits in a chr; must not use sizeof */
|
||||
#define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
|
||||
#define CHR_MAX 0xffffffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
|
||||
typedef wxChar chr; /* the type itself */
|
||||
typedef int pchr; /* what it promotes to */
|
||||
typedef unsigned uchr; /* unsigned type that will hold a chr */
|
||||
typedef int celt; /* type to hold chr, MCCE number, or NOCELT */
|
||||
#define NOCELT (-1) /* celt value which is not valid chr or MCCE */
|
||||
#define UCHAR(c) ((unsigned char) (c))
|
||||
#define CHR(c) (UCHAR(c)) /* turn char literal into chr literal */
|
||||
#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
|
||||
#if !wxUSE_UNICODE
|
||||
# define CHRBITS 8 /* bits in a chr; must not use sizeof */
|
||||
# define CHR_MIN 0x00 /* smallest and largest chr; the value */
|
||||
# define CHR_MAX 0xff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
|
||||
#elif SIZEOF_WCHAR_T == 4
|
||||
# define CHRBITS 32 /* bits in a chr; must not use sizeof */
|
||||
# define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
|
||||
# define CHR_MAX 0xffffffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
|
||||
#else
|
||||
#define CHRBITS 16 /* bits in a chr; must not use sizeof */
|
||||
#define CHR_MIN 0x0000 /* smallest and largest chr; the value */
|
||||
#define CHR_MAX 0xffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
|
||||
# define CHRBITS 16 /* bits in a chr; must not use sizeof */
|
||||
# define CHR_MIN 0x0000 /* smallest and largest chr; the value */
|
||||
# define CHR_MAX 0xffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
|
||||
#endif
|
||||
|
||||
/* functions operating on chr */
|
||||
#define iscalnum(x) Tcl_UniCharIsAlnum(x)
|
||||
#define iscalpha(x) Tcl_UniCharIsAlpha(x)
|
||||
#define iscdigit(x) Tcl_UniCharIsDigit(x)
|
||||
#define iscspace(x) Tcl_UniCharIsSpace(x)
|
||||
/*
|
||||
* I'm using isalpha et al. instead of wxIsalpha since BCC 5.5's iswalpha
|
||||
* seems not to work on Windows 9x? Note that these are only used by the
|
||||
* lexer, and although they must work for wxChars, they need only return
|
||||
* true for characters within the ascii range.
|
||||
*/
|
||||
#define iscalnum(x) ((wxUChar)(x) < 128 && isalnum(x))
|
||||
#define iscalpha(x) ((wxUChar)(x) < 128 && isalpha(x))
|
||||
#define iscdigit(x) ((wxUChar)(x) < 128 && isdigit(x))
|
||||
#define iscspace(x) ((wxUChar)(x) < 128 && isspace(x))
|
||||
|
||||
/* name the external functions */
|
||||
#define compile TclReComp
|
||||
#define exec TclReExec
|
||||
#define compile re_comp
|
||||
#define exec re_exec
|
||||
|
||||
/* enable/disable debugging code (by whether REG_DEBUG is defined or not) */
|
||||
#if 0 /* no debug unless requested by makefile */
|
||||
#define REG_DEBUG /* */
|
||||
#if 0 /* no debug unless requested by makefile */
|
||||
#define REG_DEBUG /* */
|
||||
#endif
|
||||
|
||||
/* and pick up the standard header */
|
||||
|
||||
+8
-12
@@ -107,18 +107,14 @@ extern "C" {
|
||||
#ifdef __REG_NOCHAR
|
||||
#undef __REG_NOCHAR
|
||||
#endif
|
||||
/* interface types */
|
||||
#define __REG_WIDE_T Tcl_UniChar
|
||||
#define __REG_REGOFF_T long /* not really right, but good enough... */
|
||||
#define __REG_VOID_T VOID
|
||||
#define __REG_CONST CONST
|
||||
/* names and declarations */
|
||||
#define __REG_WIDE_COMPILE TclReComp
|
||||
#define __REG_WIDE_EXEC TclReExec
|
||||
#define __REG_NOFRONT /* don't want regcomp() and regexec() */
|
||||
#define __REG_NOCHAR /* or the char versions */
|
||||
#define regfree TclReFree
|
||||
#define regerror TclReError
|
||||
#if wxUSE_UNICODE
|
||||
# define __REG_WIDE_T wxChar
|
||||
# define __REG_WIDE_COMPILE re_comp
|
||||
# define __REG_WIDE_EXEC re_exec
|
||||
# define __REG_NOCHAR /* don't want the char versions */
|
||||
#endif
|
||||
#define __REG_NOFRONT /* don't want regcomp() and regexec() */
|
||||
#define _ANSI_ARGS_(x) x
|
||||
/* --- end --- */
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user