]> git.saurik.com Git - wxWidgets.git/blame - src/regex/regcustom.h
oops, added missing const_cast to make last check in compile
[wxWidgets.git] / src / regex / regcustom.h
CommitLineData
c0a7edde 1/*
3ca4086b
VS
2 * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
3 *
c0a7edde
RN
4 * Development of this software was funded, in part, by Cray Research Inc.,
5 * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics
6 * Corporation, none of whom are responsible for the results. The author
3ca4086b
VS
7 * thanks all of them.
8 *
c0a7edde
RN
9 * Redistribution and use in source and binary forms -- with or without
10 * modification -- are permitted for any purpose, provided that
11 * redistributions in source form retain this entire copyright notice and
12 * indicate the origin and nature of any modifications.
3ca4086b 13 *
c0a7edde
RN
14 * I'd appreciate being given credit for this package in the documentation
15 * of software which uses it, but that is not a requirement.
3ca4086b 16 *
c0a7edde
RN
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20 * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
c0a7edde
RN
27 */
28
29/* headers if any */
1701c4d4 30#include "wx/wxchar.h"
04fdd873 31
3ca4086b 32/* overrides for regguts.h definitions, if any */
1701c4d4
VS
33/* regguts only includes standard headers if NULL is not defined, so do it
34 * ourselves here */
35#include <stdio.h>
36#include <stdlib.h>
37#include <ctype.h>
38#include <limits.h>
39#include <string.h>
c0a7edde 40
3ca4086b
VS
41/*
42 * Do not insert extras between the "begin" and "end" lines -- this
43 * chunk is automatically extracted to be fitted into regex.h.
44 */
45/* --- begin --- */
46/* ensure certain things don't sneak in from system headers */
47#ifdef __REG_WIDE_T
48#undef __REG_WIDE_T
49#endif
50#ifdef __REG_WIDE_COMPILE
51#undef __REG_WIDE_COMPILE
52#endif
53#ifdef __REG_WIDE_EXEC
54#undef __REG_WIDE_EXEC
55#endif
56#ifdef __REG_REGOFF_T
57#undef __REG_REGOFF_T
58#endif
59#ifdef __REG_VOID_T
60#undef __REG_VOID_T
61#endif
62#ifdef __REG_CONST
63#undef __REG_CONST
64#endif
65#ifdef __REG_NOFRONT
66#undef __REG_NOFRONT
67#endif
68#ifdef __REG_NOCHAR
69#undef __REG_NOCHAR
70#endif
1701c4d4
VS
71#if wxUSE_UNICODE
72# define __REG_WIDE_T wxChar
73# define __REG_WIDE_COMPILE re_comp
74# define __REG_WIDE_EXEC re_exec
75# define __REG_NOCHAR /* don't want the char versions */
76#endif
77#define __REG_NOFRONT /* don't want regcomp() and regexec() */
78#define _ANSI_ARGS_(x) x
3ca4086b 79/* --- end --- */
c0a7edde 80
3ca4086b 81/* internal character type and related */
1701c4d4
VS
82typedef wxChar chr; /* the type itself */
83typedef int pchr; /* what it promotes to */
84typedef unsigned uchr; /* unsigned type that will hold a chr */
85typedef int celt; /* type to hold chr, MCCE number, or NOCELT */
86#define NOCELT (-1) /* celt value which is not valid chr or MCCE */
87#define UCHAR(c) ((unsigned char) (c))
88#define CHR(c) (UCHAR(c)) /* turn char literal into chr literal */
89#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
90#if !wxUSE_UNICODE
91# define CHRBITS 8 /* bits in a chr; must not use sizeof */
92# define CHR_MIN 0x00 /* smallest and largest chr; the value */
93# define CHR_MAX 0xff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
94#elif SIZEOF_WCHAR_T == 4
95# define CHRBITS 32 /* bits in a chr; must not use sizeof */
96# define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
97# define CHR_MAX 0xffffffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
3ca4086b 98#else
1701c4d4
VS
99# define CHRBITS 16 /* bits in a chr; must not use sizeof */
100# define CHR_MIN 0x0000 /* smallest and largest chr; the value */
101# define CHR_MAX 0xffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
3ca4086b 102#endif
c0a7edde 103
1701c4d4
VS
104/*
105 * I'm using isalpha et al. instead of wxIsalpha since BCC 5.5's iswalpha
106 * seems not to work on Windows 9x? Note that these are only used by the
107 * lexer, and although they must work for wxChars, they need only return
108 * true for characters within the ascii range.
109 */
110#define iscalnum(x) ((wxUChar)(x) < 128 && isalnum(x))
111#define iscalpha(x) ((wxUChar)(x) < 128 && isalpha(x))
112#define iscdigit(x) ((wxUChar)(x) < 128 && isdigit(x))
113#define iscspace(x) ((wxUChar)(x) < 128 && isspace(x))
c0a7edde 114
3ca4086b 115/* name the external functions */
1701c4d4
VS
116#define compile re_comp
117#define exec re_exec
3ca4086b
VS
118
119/* enable/disable debugging code (by whether REG_DEBUG is defined or not) */
1701c4d4
VS
120#if 0 /* no debug unless requested by makefile */
121#define REG_DEBUG /* */
3ca4086b 122#endif
b8f896a1 123
c0a7edde
RN
124/* and pick up the standard header */
125#include "regex.h"