1.
[wxWidgets.git] / src / regex / regcustom.h
1 #ifndef _REGEX_CUSTOM_H_
2 #define _REGEX_CUSTOM_H_
3
4 /*
5 * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
6 *
7 * Development of this software was funded, in part, by Cray Research Inc.,
8 * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics
9 * Corporation, none of whom are responsible for the results. The author
10 * thanks all of them.
11 *
12 * Redistribution and use in source and binary forms -- with or without
13 * modification -- are permitted for any purpose, provided that
14 * redistributions in source form retain this entire copyright notice and
15 * indicate the origin and nature of any modifications.
16 *
17 * I'd appreciate being given credit for this package in the documentation
18 * of software which uses it, but that is not a requirement.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23 * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * $Id$
32 */
33
34 /* headers if any */
35
36 /* FreeBSD, Watcom and DMars require this, CW doesn't have nor need it. */
37 /* Others also don't seem to need it. If you have an error related to */
38 /* (not) including <sys/types.h> please report details to */
39 /* wx-dev@lists.wxwindows.org */
40 #if defined(__UNIX__) || defined(__WATCOMC__) || defined(__DIGITALMARS__)
41 # include <sys/types.h>
42 #endif
43
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <ctype.h>
47 #include <limits.h>
48
49 #include "wx/wxchar.h"
50
51 /**
52 *
53 * wx_wchar == wxChar
54 *
55 */
56 #define wx_wchar wxChar
57
58 /* overrides for regguts.h definitions, if any */
59 #define FUNCPTR(name, args) (*name) args
60 #define MALLOC(n) malloc(n)
61 #define FREE(p) free(VS(p))
62 #define REALLOC(p,n) realloc(VS(p),n)
63
64 /* internal character type and related */
65 typedef wx_wchar chr; /* the type itself */
66 typedef unsigned long uchr; /* unsigned type that will hold a chr */
67 typedef long celt; /* type to hold chr, MCCE number, or
68 * NOCELT */
69
70 #define NOCELT (-1) /* celt value which is not valid chr or
71 * MCCE */
72 #define CHR(c) ((unsigned char) (c)) /* turn char literal into chr
73 * literal */
74 #define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
75
76 #define CHRBITS (SIZEOF_WCHAR_T << 3) /* bits in a chr; must not use sizeof */
77 #define CHR_MAX ((1 << CHRBITS) - 1)
78 #define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
79
80
81 /* functions operating on chr */
82 #define iscalnum(x) wx_isalnum(x)
83 #define iscalpha(x) wx_isalpha(x)
84 #define iscdigit(x) wx_isdigit(x)
85 #define iscspace(x) wx_isspace(x)
86
87 /* and pick up the standard header */
88 #include "regex.h"
89
90 #endif /* _REGEX_CUSTOM_H_ */