X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ca4086b22723db16d7e0fc23aa9021b4785096a..a7d5151df02bf70a9f6ff1c5c7fd33ab07bf409c:/src/regex/regcustom.h?ds=sidebyside diff --git a/src/regex/regcustom.h b/src/regex/regcustom.h index e258acd540..cd77bf6dbe 100644 --- a/src/regex/regcustom.h +++ b/src/regex/regcustom.h @@ -26,16 +26,18 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* headers if any */ -#include "tclInt.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 +#include +#include +#include +#include +/* must include this after ctype.h inclusion for CodeWarrior/Mac */ +#include "wx/defs.h" +#include "wx/wxchar.h" /* * Do not insert extras between the "begin" and "end" lines -- this @@ -67,53 +69,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 wx_re_comp +# define __REG_WIDE_EXEC wx_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 wx_re_comp +#define exec wx_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 */