]> git.saurik.com Git - wxWidgets.git/blame - src/regex/regcustom.h
Added debug unicode config
[wxWidgets.git] / src / regex / regcustom.h
CommitLineData
c0a7edde
RN
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 * $Id$
29 */
30
31/* headers if any */
32#include <sys/types.h>
33#include <stdio.h>
34#include <stdlib.h>
35#include <ctype.h>
36#include <limits.h>
37#ifndef wxCHECK_GCC_VERSION
38#define wxCHECK_GCC_VERSION( major, minor ) \
39 ( defined(__GNUC__) && defined(__GNUC_MINOR__) \
40 && ( ( __GNUC__ > (major) ) \
41 || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) )
42#endif
43
1ce5dd35
RN
44#if !wxUSE_UNICODE
45# define wx_wchar char
46#else // Unicode
47 #if (defined(__GNUC__) && !wxCHECK_GCC_VERSION(2, 96))
48 # define wx_wchar __WCHAR_TYPE__
49 #else // __WCHAR_TYPE__ and gcc < 2.96
50 // standard case
51 # define wx_wchar wchar_t
52 #endif // __WCHAR_TYPE__
53#endif // ASCII/Unicode
c0a7edde
RN
54
55/* overrides for regguts.h definitions, if any */
56#define FUNCPTR(name, args) (*name) args
57#define MALLOC(n) malloc(n)
58#define FREE(p) free(VS(p))
59#define REALLOC(p,n) realloc(VS(p),n)
60
61/* internal character type and related */
62typedef wx_wchar chr; /* the type itself */
80e10e8b
RN
63typedef unsigned long uchr; /* unsigned type that will hold a chr */
64typedef long celt; /* type to hold chr, MCCE number, or
c0a7edde
RN
65 * NOCELT */
66
67#define NOCELT (-1) /* celt value which is not valid chr or
68 * MCCE */
69#define CHR(c) ((unsigned char) (c)) /* turn char literal into chr
70 * literal */
71#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
80e10e8b 72
f5386212 73/* RN - the "not use sizeof() thing is really annoying!" */
83842a0b 74#if wxUSE_UNICODE
dece3bfd 75# define CHRBITS 32
80e10e8b 76#else
dece3bfd 77# define CHRBITS 8 /* bits in a chr; must not use sizeof */
80e10e8b 78#endif
c0a7edde 79#define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
f5386212
RN
80/*
81 PUTTING PARENTHASES AROUND THIS, I.E. (1 << CHRBITS) WILL
82 CAUSE ALL CHARACTERS TO BE MATCHED!!!
83*/
84#define CHR_MAX 1 << CHRBITS /*0xfffffffe*/ /* CHR_MAX-CHR_MIN+1 should fit in uchr */
85
c0a7edde
RN
86
87/* functions operating on chr */
88#define iscalnum(x) wx_isalnum(x)
89#define iscalpha(x) wx_isalpha(x)
90#define iscdigit(x) wx_isdigit(x)
91#define iscspace(x) wx_isspace(x)
92
93/* and pick up the standard header */
94#include "regex.h"