| 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 <string.h> |
| 47 | #include <ctype.h> |
| 48 | #include <limits.h> |
| 49 | |
| 50 | #include "wx/wxchar.h" |
| 51 | |
| 52 | /** |
| 53 | * |
| 54 | * wx_wchar == wxChar |
| 55 | * |
| 56 | */ |
| 57 | #define wx_wchar wxChar |
| 58 | |
| 59 | /* overrides for regguts.h definitions, if any */ |
| 60 | #define FUNCPTR(name, args) (*name) args |
| 61 | #define MALLOC(n) malloc(n) |
| 62 | #define FREE(p) free(VS(p)) |
| 63 | #define REALLOC(p,n) realloc(VS(p),n) |
| 64 | |
| 65 | /* internal character type and related */ |
| 66 | typedef wx_wchar chr; /* the type itself */ |
| 67 | typedef unsigned long uchr; /* unsigned type that will hold a chr */ |
| 68 | typedef long celt; /* type to hold chr, MCCE number, or |
| 69 | * NOCELT */ |
| 70 | |
| 71 | #define NOCELT (-1) /* celt value which is not valid chr or |
| 72 | * MCCE */ |
| 73 | #define CHR(c) ((unsigned char) (c)) /* turn char literal into chr |
| 74 | * literal */ |
| 75 | #define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */ |
| 76 | |
| 77 | #if wxUSE_WCHAR_T |
| 78 | # define CHRBITS (SIZEOF_WCHAR_T << 3) /* bits in a chr; must not use sizeof */ |
| 79 | # define CHR_MAX ((1 << CHRBITS) - 1) |
| 80 | # define CHR_MIN 0x00000000 /* smallest and largest chr; the value */ |
| 81 | #else /*ANSI*/ |
| 82 | # define CHRBITS 8 |
| 83 | # define CHR_MAX 0xFF |
| 84 | # define CHR_MIN 0x00 |
| 85 | #endif /*wxUSE_WCHAR_T*/ |
| 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 | extern int wx_strlen(const wx_wchar* szString); |
| 94 | |
| 95 | /* and pick up the standard header */ |
| 96 | #include "regex.h" |
| 97 | |
| 98 | #endif /* _REGEX_CUSTOM_H_ */ |