00001 /* 00002 * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. 00003 * 00004 * Development of this software was funded, in part, by Cray Research Inc., 00005 * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics 00006 * Corporation, none of whom are responsible for the results. The author 00007 * thanks all of them. 00008 * 00009 * Redistribution and use in source and binary forms -- with or without 00010 * modification -- are permitted for any purpose, provided that 00011 * redistributions in source form retain this entire copyright notice and 00012 * indicate the origin and nature of any modifications. 00013 * 00014 * I'd appreciate being given credit for this package in the documentation 00015 * of software which uses it, but that is not a requirement. 00016 * 00017 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 00018 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 00019 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 00020 * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00021 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00022 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00023 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00024 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00025 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00026 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 * 00028 * src/include/regex/regcustom.h 00029 */ 00030 00031 /* headers if any */ 00032 #include "postgres.h" 00033 00034 #include <ctype.h> 00035 #include <limits.h> 00036 00037 /* 00038 * towlower() and friends should be in <wctype.h>, but some pre-C99 systems 00039 * declare them in <wchar.h>. 00040 */ 00041 #ifdef HAVE_WCHAR_H 00042 #include <wchar.h> 00043 #endif 00044 #ifdef HAVE_WCTYPE_H 00045 #include <wctype.h> 00046 #endif 00047 00048 #include "mb/pg_wchar.h" 00049 00050 00051 /* overrides for regguts.h definitions, if any */ 00052 #define FUNCPTR(name, args) (*name) args 00053 #define MALLOC(n) malloc(n) 00054 #define FREE(p) free(VS(p)) 00055 #define REALLOC(p,n) realloc(VS(p),n) 00056 #define assert(x) Assert(x) 00057 00058 /* internal character type and related */ 00059 typedef pg_wchar chr; /* the type itself */ 00060 typedef unsigned uchr; /* unsigned type that will hold a chr */ 00061 typedef int celt; /* type to hold chr, or NOCELT */ 00062 00063 #define NOCELT (-1) /* celt value which is not valid chr */ 00064 #define CHR(c) ((unsigned char) (c)) /* turn char literal into chr literal */ 00065 #define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */ 00066 #define CHRBITS 32 /* bits in a chr; must not use sizeof */ 00067 #define CHR_MIN 0x00000000 /* smallest and largest chr; the value */ 00068 #define CHR_MAX 0xfffffffe /* CHR_MAX-CHR_MIN+1 should fit in uchr */ 00069 00070 /* functions operating on chr */ 00071 #define iscalnum(x) pg_wc_isalnum(x) 00072 #define iscalpha(x) pg_wc_isalpha(x) 00073 #define iscdigit(x) pg_wc_isdigit(x) 00074 #define iscspace(x) pg_wc_isspace(x) 00075 00076 /* and pick up the standard header */ 00077 #include "regex.h"