xref: /minix3/lib/libc/regex/utils.h (revision 2fe8fb192fe7e8720e3e7a77f928da545e872a6a)
1*2fe8fb19SBen Gras /*	$NetBSD: utils.h,v 1.6 2003/08/07 16:43:21 agc Exp $	*/
2*2fe8fb19SBen Gras 
3b7061124SArun Thomas /*-
4b7061124SArun Thomas  * Copyright (c) 1992, 1993, 1994
5b7061124SArun Thomas  *	The Regents of the University of California.  All rights reserved.
6b7061124SArun Thomas  *
7b7061124SArun Thomas  * This code is derived from software contributed to Berkeley by
8b7061124SArun Thomas  * Henry Spencer.
9b7061124SArun Thomas  *
10b7061124SArun Thomas  * Redistribution and use in source and binary forms, with or without
11b7061124SArun Thomas  * modification, are permitted provided that the following conditions
12b7061124SArun Thomas  * are met:
13b7061124SArun Thomas  * 1. Redistributions of source code must retain the above copyright
14b7061124SArun Thomas  *    notice, this list of conditions and the following disclaimer.
15b7061124SArun Thomas  * 2. Redistributions in binary form must reproduce the above copyright
16b7061124SArun Thomas  *    notice, this list of conditions and the following disclaimer in the
17b7061124SArun Thomas  *    documentation and/or other materials provided with the distribution.
18*2fe8fb19SBen Gras  * 3. Neither the name of the University nor the names of its contributors
19*2fe8fb19SBen Gras  *    may be used to endorse or promote products derived from this software
20*2fe8fb19SBen Gras  *    without specific prior written permission.
21*2fe8fb19SBen Gras  *
22*2fe8fb19SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23*2fe8fb19SBen Gras  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*2fe8fb19SBen Gras  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*2fe8fb19SBen Gras  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26*2fe8fb19SBen Gras  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*2fe8fb19SBen Gras  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*2fe8fb19SBen Gras  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*2fe8fb19SBen Gras  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*2fe8fb19SBen Gras  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*2fe8fb19SBen Gras  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*2fe8fb19SBen Gras  * SUCH DAMAGE.
33*2fe8fb19SBen Gras  *
34*2fe8fb19SBen Gras  *	@(#)utils.h	8.3 (Berkeley) 3/20/94
35*2fe8fb19SBen Gras  */
36*2fe8fb19SBen Gras 
37*2fe8fb19SBen Gras /*-
38*2fe8fb19SBen Gras  * Copyright (c) 1992, 1993, 1994 Henry Spencer.
39*2fe8fb19SBen Gras  *
40*2fe8fb19SBen Gras  * This code is derived from software contributed to Berkeley by
41*2fe8fb19SBen Gras  * Henry Spencer.
42*2fe8fb19SBen Gras  *
43*2fe8fb19SBen Gras  * Redistribution and use in source and binary forms, with or without
44*2fe8fb19SBen Gras  * modification, are permitted provided that the following conditions
45*2fe8fb19SBen Gras  * are met:
46*2fe8fb19SBen Gras  * 1. Redistributions of source code must retain the above copyright
47*2fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer.
48*2fe8fb19SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
49*2fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer in the
50*2fe8fb19SBen Gras  *    documentation and/or other materials provided with the distribution.
51b7061124SArun Thomas  * 3. All advertising materials mentioning features or use of this software
52b7061124SArun Thomas  *    must display the following acknowledgement:
53b7061124SArun Thomas  *	This product includes software developed by the University of
54b7061124SArun Thomas  *	California, Berkeley and its contributors.
55b7061124SArun Thomas  * 4. Neither the name of the University nor the names of its contributors
56b7061124SArun Thomas  *    may be used to endorse or promote products derived from this software
57b7061124SArun Thomas  *    without specific prior written permission.
58b7061124SArun Thomas  *
59b7061124SArun Thomas  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
60b7061124SArun Thomas  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61b7061124SArun Thomas  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62b7061124SArun Thomas  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63b7061124SArun Thomas  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
64b7061124SArun Thomas  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
65b7061124SArun Thomas  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66b7061124SArun Thomas  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67b7061124SArun Thomas  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68b7061124SArun Thomas  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69b7061124SArun Thomas  * SUCH DAMAGE.
70b7061124SArun Thomas  *
71b7061124SArun Thomas  *	@(#)utils.h	8.3 (Berkeley) 3/20/94
72b7061124SArun Thomas  */
73b7061124SArun Thomas 
74b7061124SArun Thomas /* utility definitions */
75b7061124SArun Thomas #define	DUPMAX		_POSIX2_RE_DUP_MAX	/* xxx is this right? */
76b7061124SArun Thomas #define	INFINITY	(DUPMAX + 1)
77b7061124SArun Thomas #define	NC		(CHAR_MAX - CHAR_MIN + 1)
78b7061124SArun Thomas typedef unsigned char uch;
79b7061124SArun Thomas 
80b7061124SArun Thomas /* switch off assertions (if not already off) if no REDEBUG */
81b7061124SArun Thomas #ifndef REDEBUG
82b7061124SArun Thomas #ifndef NDEBUG
83b7061124SArun Thomas #define	NDEBUG	/* no assertions please */
84b7061124SArun Thomas #endif
85b7061124SArun Thomas #endif
86b7061124SArun Thomas #include <assert.h>
87b7061124SArun Thomas 
88b7061124SArun Thomas /* for old systems with bcopy() but no memmove() */
89b7061124SArun Thomas #ifdef USEBCOPY
90b7061124SArun Thomas #define	memmove(d, s, c)	bcopy(s, d, c)
91b7061124SArun Thomas #endif
92