]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/regex/regcustom.h
OpenVMS compile support for wxSPLASH and sample
[wxWidgets.git] / src / regex / regcustom.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
3 *
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
7 * thanks all of them.
8 *
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.
13 *
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.
16 *
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.
27 */
28
29/* overrides for regguts.h definitions, if any */
30/* regguts only includes standard headers if NULL is not defined, so do it
31 * ourselves here */
32#include <stdio.h>
33#include <stdlib.h>
34#include <ctype.h>
35#include <limits.h>
36#include <string.h>
37
38/* must include this after ctype.h inclusion for CodeWarrior/Mac */
39#include "wx/defs.h"
40#include "wx/chartype.h"
41#include "wx/wxcrtbase.h"
42
43/*
44 * Do not insert extras between the "begin" and "end" lines -- this
45 * chunk is automatically extracted to be fitted into regex.h.
46 */
47/* --- begin --- */
48/* ensure certain things don't sneak in from system headers */
49#ifdef __REG_WIDE_T
50#undef __REG_WIDE_T
51#endif
52#ifdef __REG_WIDE_COMPILE
53#undef __REG_WIDE_COMPILE
54#endif
55#ifdef __REG_WIDE_EXEC
56#undef __REG_WIDE_EXEC
57#endif
58#ifdef __REG_REGOFF_T
59#undef __REG_REGOFF_T
60#endif
61#ifdef __REG_VOID_T
62#undef __REG_VOID_T
63#endif
64#ifdef __REG_CONST
65#undef __REG_CONST
66#endif
67#ifdef __REG_NOFRONT
68#undef __REG_NOFRONT
69#endif
70#ifdef __REG_NOCHAR
71#undef __REG_NOCHAR
72#endif
73#if wxUSE_UNICODE
74# define __REG_WIDE_T wxChar
75# define __REG_WIDE_COMPILE wx_re_comp
76# define __REG_WIDE_EXEC wx_re_exec
77# define __REG_NOCHAR /* don't want the char versions */
78#endif
79#define __REG_NOFRONT /* don't want regcomp() and regexec() */
80#define _ANSI_ARGS_(x) x
81/* --- end --- */
82
83/* internal character type and related */
84typedef wxChar chr; /* the type itself */
85typedef int pchr; /* what it promotes to */
86typedef unsigned uchr; /* unsigned type that will hold a chr */
87typedef int celt; /* type to hold chr, MCCE number, or NOCELT */
88#define NOCELT (-1) /* celt value which is not valid chr or MCCE */
89#define UCHAR(c) ((unsigned char) (c))
90#define CHR(c) (UCHAR(c)) /* turn char literal into chr literal */
91#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
92#if !wxUSE_UNICODE
93# define CHRBITS 8 /* bits in a chr; must not use sizeof */
94# define CHR_MIN 0x00 /* smallest and largest chr; the value */
95# define CHR_MAX 0xff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
96#elif SIZEOF_WCHAR_T == 4
97# define CHRBITS 32 /* bits in a chr; must not use sizeof */
98# define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
99# define CHR_MAX 0xffffffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
100#else
101# define CHRBITS 16 /* bits in a chr; must not use sizeof */
102# define CHR_MIN 0x0000 /* smallest and largest chr; the value */
103# define CHR_MAX 0xffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
104#endif
105
106/*
107 * I'm using isalpha et al. instead of wxIsalpha since BCC 5.5's iswalpha
108 * seems not to work on Windows 9x? Note that these are only used by the
109 * lexer, and although they must work for wxChars, they need only return
110 * true for characters within the ascii range.
111 */
112#define iscalnum(x) ((wxUChar)(x) < 128 && isalnum(x))
113#define iscalpha(x) ((wxUChar)(x) < 128 && isalpha(x))
114#define iscdigit(x) ((wxUChar)(x) < 128 && isdigit(x))
115#define iscspace(x) ((wxUChar)(x) < 128 && isspace(x))
116
117/* name the external functions */
118#define compile wx_re_comp
119#define exec wx_re_exec
120
121/* enable/disable debugging code (by whether REG_DEBUG is defined or not) */
122#if 0 /* no debug unless requested by makefile */
123#define REG_DEBUG /* */
124#endif
125
126/* and pick up the standard header */
127#include "regex.h"