os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/generic/regcustom.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
 * Copyright (c) 1998, 1999 Henry Spencer.  All rights reserved.
sl@0
     3
 * 
sl@0
     4
 * Development of this software was funded, in part, by Cray Research Inc.,
sl@0
     5
 * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics
sl@0
     6
 * Corporation, none of whom are responsible for the results.  The author
sl@0
     7
 * thanks all of them. 
sl@0
     8
 * 
sl@0
     9
 * Redistribution and use in source and binary forms -- with or without
sl@0
    10
 * modification -- are permitted for any purpose, provided that
sl@0
    11
 * redistributions in source form retain this entire copyright notice and
sl@0
    12
 * indicate the origin and nature of any modifications.
sl@0
    13
 * 
sl@0
    14
 * I'd appreciate being given credit for this package in the documentation
sl@0
    15
 * of software which uses it, but that is not a requirement.
sl@0
    16
 * 
sl@0
    17
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
sl@0
    18
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
sl@0
    19
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
sl@0
    20
 * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
sl@0
    21
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
sl@0
    22
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
sl@0
    23
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
sl@0
    24
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
sl@0
    25
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
sl@0
    26
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sl@0
    27
 */
sl@0
    28
sl@0
    29
/* headers if any */
sl@0
    30
#include "tclInt.h"
sl@0
    31
sl@0
    32
/* overrides for regguts.h definitions, if any */
sl@0
    33
#define	FUNCPTR(name, args)	(*name) _ANSI_ARGS_(args)
sl@0
    34
#define	MALLOC(n)		ckalloc(n)
sl@0
    35
#define	FREE(p)			ckfree(VS(p))
sl@0
    36
#define	REALLOC(p,n)		ckrealloc(VS(p),n)
sl@0
    37
sl@0
    38
sl@0
    39
sl@0
    40
/*
sl@0
    41
 * Do not insert extras between the "begin" and "end" lines -- this
sl@0
    42
 * chunk is automatically extracted to be fitted into regex.h.
sl@0
    43
 */
sl@0
    44
/* --- begin --- */
sl@0
    45
/* ensure certain things don't sneak in from system headers */
sl@0
    46
#ifdef __REG_WIDE_T
sl@0
    47
#undef __REG_WIDE_T
sl@0
    48
#endif
sl@0
    49
#ifdef __REG_WIDE_COMPILE
sl@0
    50
#undef __REG_WIDE_COMPILE
sl@0
    51
#endif
sl@0
    52
#ifdef __REG_WIDE_EXEC
sl@0
    53
#undef __REG_WIDE_EXEC
sl@0
    54
#endif
sl@0
    55
#ifdef __REG_REGOFF_T
sl@0
    56
#undef __REG_REGOFF_T
sl@0
    57
#endif
sl@0
    58
#ifdef __REG_VOID_T
sl@0
    59
#undef __REG_VOID_T
sl@0
    60
#endif
sl@0
    61
#ifdef __REG_CONST
sl@0
    62
#undef __REG_CONST
sl@0
    63
#endif
sl@0
    64
#ifdef __REG_NOFRONT
sl@0
    65
#undef __REG_NOFRONT
sl@0
    66
#endif
sl@0
    67
#ifdef __REG_NOCHAR
sl@0
    68
#undef __REG_NOCHAR
sl@0
    69
#endif
sl@0
    70
/* interface types */
sl@0
    71
#define	__REG_WIDE_T	Tcl_UniChar
sl@0
    72
#define	__REG_REGOFF_T	long	/* not really right, but good enough... */
sl@0
    73
#define	__REG_VOID_T	VOID
sl@0
    74
#define	__REG_CONST	CONST
sl@0
    75
/* names and declarations */
sl@0
    76
#define	__REG_WIDE_COMPILE	TclReComp
sl@0
    77
#define	__REG_WIDE_EXEC		TclReExec
sl@0
    78
#define	__REG_NOFRONT		/* don't want regcomp() and regexec() */
sl@0
    79
#define	__REG_NOCHAR		/* or the char versions */
sl@0
    80
#define	regfree		TclReFree
sl@0
    81
#define	regerror	TclReError
sl@0
    82
/* --- end --- */
sl@0
    83
sl@0
    84
sl@0
    85
sl@0
    86
/* internal character type and related */
sl@0
    87
typedef Tcl_UniChar chr;	/* the type itself */
sl@0
    88
typedef int pchr;		/* what it promotes to */
sl@0
    89
typedef unsigned uchr;		/* unsigned type that will hold a chr */
sl@0
    90
typedef int celt;		/* type to hold chr, MCCE number, or NOCELT */
sl@0
    91
#define	NOCELT	(-1)		/* celt value which is not valid chr or MCCE */
sl@0
    92
#define	CHR(c)	(UCHAR(c))	/* turn char literal into chr literal */
sl@0
    93
#define	DIGITVAL(c)	((c)-'0')	/* turn chr digit into its value */
sl@0
    94
#if TCL_UTF_MAX > 3
sl@0
    95
#define	CHRBITS	32		/* bits in a chr; must not use sizeof */
sl@0
    96
#define	CHR_MIN	0x00000000	/* smallest and largest chr; the value */
sl@0
    97
#define	CHR_MAX	0xffffffff	/*  CHR_MAX-CHR_MIN+1 should fit in uchr */
sl@0
    98
#else
sl@0
    99
#define	CHRBITS	16		/* bits in a chr; must not use sizeof */
sl@0
   100
#define	CHR_MIN	0x0000		/* smallest and largest chr; the value */
sl@0
   101
#define	CHR_MAX	0xffff		/*  CHR_MAX-CHR_MIN+1 should fit in uchr */
sl@0
   102
#endif
sl@0
   103
sl@0
   104
/* functions operating on chr */
sl@0
   105
#define	iscalnum(x)	Tcl_UniCharIsAlnum(x)
sl@0
   106
#define	iscalpha(x)	Tcl_UniCharIsAlpha(x)
sl@0
   107
#define	iscdigit(x)	Tcl_UniCharIsDigit(x)
sl@0
   108
#define	iscspace(x)	Tcl_UniCharIsSpace(x)
sl@0
   109
sl@0
   110
/* name the external functions */
sl@0
   111
#define	compile		TclReComp
sl@0
   112
#define	exec		TclReExec
sl@0
   113
sl@0
   114
/* enable/disable debugging code (by whether REG_DEBUG is defined or not) */
sl@0
   115
#if 0		/* no debug unless requested by makefile */
sl@0
   116
#define	REG_DEBUG	/* */
sl@0
   117
#endif
sl@0
   118
sl@0
   119
/* and pick up the standard header */
sl@0
   120
#include "regex.h"