]> git.saurik.com Git - wxWidgets.git/blame - src/regex/regcustom.h
Wrap some functions with wxAutoNSAutoreleasePool
[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 */
04fdd873
DS
32
33// FreeBSD, Watcom and DMars require this, CW doesn't have nor need it.
34// Others also don't seem to need it. If you have an error related to
35// (not) including <sys/types.h> please report details to
36// wx-dev@lists.wxwindows.org
37#if defined(__UNIX__) || defined(__WATCOMC__) || defined(__DIGITALMARS__)
38# include <sys/types.h>
39#endif
40
c0a7edde
RN
41#include <stdio.h>
42#include <stdlib.h>
43#include <ctype.h>
44#include <limits.h>
45#ifndef wxCHECK_GCC_VERSION
46#define wxCHECK_GCC_VERSION( major, minor ) \
47 ( defined(__GNUC__) && defined(__GNUC_MINOR__) \
48 && ( ( __GNUC__ > (major) ) \
49 || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) )
50#endif
51
1ce5dd35 52#if !wxUSE_UNICODE
c2935c26 53# define wx_wchar char
1ce5dd35
RN
54#else // Unicode
55 #if (defined(__GNUC__) && !wxCHECK_GCC_VERSION(2, 96))
c2935c26 56 # define wx_wchar __WCHAR_TYPE__
1ce5dd35
RN
57 #else // __WCHAR_TYPE__ and gcc < 2.96
58 // standard case
c2935c26 59 # define wx_wchar wchar_t
1ce5dd35
RN
60 #endif // __WCHAR_TYPE__
61#endif // ASCII/Unicode
c0a7edde
RN
62
63/* overrides for regguts.h definitions, if any */
64#define FUNCPTR(name, args) (*name) args
65#define MALLOC(n) malloc(n)
66#define FREE(p) free(VS(p))
67#define REALLOC(p,n) realloc(VS(p),n)
68
69/* internal character type and related */
70typedef wx_wchar chr; /* the type itself */
80e10e8b
RN
71typedef unsigned long uchr; /* unsigned type that will hold a chr */
72typedef long celt; /* type to hold chr, MCCE number, or
c0a7edde
RN
73 * NOCELT */
74
75#define NOCELT (-1) /* celt value which is not valid chr or
76 * MCCE */
77#define CHR(c) ((unsigned char) (c)) /* turn char literal into chr
78 * literal */
79#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
80e10e8b 80
f5386212 81/* RN - the "not use sizeof() thing is really annoying!" */
83842a0b 82#if wxUSE_UNICODE
960cb7d7
RN
83# if defined(__WINDOWS__)
84# define CHRBITS 16
85# define CHR_MAX 0xfffe
86# else /* !__WINDOWS__ */
87# if defined(__MACH__)
88# define CHRBITS 32
89# define CHR_MAX 0xfffffffe
90# else /* !__MACH__ */
91# if !defined(SIZEOF_WCHAR_T)
92# define CHRBITS 16
93# define CHR_MAX 0xfffe
94# else /* defined(SIZEOF_WCHAR_T) */
95# define CHRBITS SIZEOF_WCHAR_T
96# define CHR_MAX ((1 << CHRBITS) - 1)
97# endif /* !defined(SIZEOF_WCHAR_T) */
98# endif /* defined(__MACH__) */
99# endif /* defined(__WINDOWS__) */
2a68dd9e 100#else /* !wxUSE_UNICODE */
960cb7d7
RN
101# define CHRBITS 8 /* bits in a chr; must not use sizeof */
102# define CHR_MAX 0xfe
2a68dd9e
RN
103#endif /* wxUSE_UNICODE */
104
c0a7edde 105#define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
f5386212
RN
106/*
107 PUTTING PARENTHASES AROUND THIS, I.E. (1 << CHRBITS) WILL
108 CAUSE ALL CHARACTERS TO BE MATCHED!!!
109*/
7b0f0de3 110/*#define CHR_MAX 1 << CHRBITS / CHR_MAX-CHR_MIN+1 should fit in uchr */
f5386212 111
c0a7edde
RN
112
113/* functions operating on chr */
114#define iscalnum(x) wx_isalnum(x)
115#define iscalpha(x) wx_isalpha(x)
116#define iscdigit(x) wx_isdigit(x)
117#define iscspace(x) wx_isspace(x)
118
119/* and pick up the standard header */
120#include "regex.h"