xref: /freebsd/contrib/llvm-project/llvm/lib/Support/regutils.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric /*-
2*0b57cec5SDimitry Andric  * This code is derived from OpenBSD's libc/regex, original license follows:
3*0b57cec5SDimitry Andric  *
4*0b57cec5SDimitry Andric  * Copyright (c) 1992, 1993, 1994 Henry Spencer.
5*0b57cec5SDimitry Andric  * Copyright (c) 1992, 1993, 1994
6*0b57cec5SDimitry Andric  *	The Regents of the University of California.  All rights reserved.
7*0b57cec5SDimitry Andric  *
8*0b57cec5SDimitry Andric  * This code is derived from software contributed to Berkeley by
9*0b57cec5SDimitry Andric  * Henry Spencer.
10*0b57cec5SDimitry Andric  *
11*0b57cec5SDimitry Andric  * Redistribution and use in source and binary forms, with or without
12*0b57cec5SDimitry Andric  * modification, are permitted provided that the following conditions
13*0b57cec5SDimitry Andric  * are met:
14*0b57cec5SDimitry Andric  * 1. Redistributions of source code must retain the above copyright
15*0b57cec5SDimitry Andric  *    notice, this list of conditions and the following disclaimer.
16*0b57cec5SDimitry Andric  * 2. Redistributions in binary form must reproduce the above copyright
17*0b57cec5SDimitry Andric  *    notice, this list of conditions and the following disclaimer in the
18*0b57cec5SDimitry Andric  *    documentation and/or other materials provided with the distribution.
19*0b57cec5SDimitry Andric  * 3. Neither the name of the University nor the names of its contributors
20*0b57cec5SDimitry Andric  *    may be used to endorse or promote products derived from this software
21*0b57cec5SDimitry Andric  *    without specific prior written permission.
22*0b57cec5SDimitry Andric  *
23*0b57cec5SDimitry Andric  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24*0b57cec5SDimitry Andric  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25*0b57cec5SDimitry Andric  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26*0b57cec5SDimitry Andric  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27*0b57cec5SDimitry Andric  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28*0b57cec5SDimitry Andric  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29*0b57cec5SDimitry Andric  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30*0b57cec5SDimitry Andric  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31*0b57cec5SDimitry Andric  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32*0b57cec5SDimitry Andric  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33*0b57cec5SDimitry Andric  * SUCH DAMAGE.
34*0b57cec5SDimitry Andric  *
35*0b57cec5SDimitry Andric  *	@(#)utils.h	8.3 (Berkeley) 3/20/94
36*0b57cec5SDimitry Andric  */
37*0b57cec5SDimitry Andric 
38*0b57cec5SDimitry Andric #ifndef LLVM_SUPPORT_REGUTILS_H
39*0b57cec5SDimitry Andric #define LLVM_SUPPORT_REGUTILS_H
40*0b57cec5SDimitry Andric 
41*0b57cec5SDimitry Andric /* utility definitions */
42*0b57cec5SDimitry Andric #define	NC		(CHAR_MAX - CHAR_MIN + 1)
43*0b57cec5SDimitry Andric typedef unsigned char uch;
44*0b57cec5SDimitry Andric 
45*0b57cec5SDimitry Andric /* switch off assertions (if not already off) if no REDEBUG */
46*0b57cec5SDimitry Andric #ifndef REDEBUG
47*0b57cec5SDimitry Andric #ifndef NDEBUG
48*0b57cec5SDimitry Andric #define	NDEBUG	/* no assertions please */
49*0b57cec5SDimitry Andric #endif
50*0b57cec5SDimitry Andric #endif
51*0b57cec5SDimitry Andric #include <assert.h>
52*0b57cec5SDimitry Andric 
53*0b57cec5SDimitry Andric /* for old systems with bcopy() but no memmove() */
54*0b57cec5SDimitry Andric #ifdef USEBCOPY
55*0b57cec5SDimitry Andric #define	memmove(d, s, c)	bcopy(s, d, c)
56*0b57cec5SDimitry Andric #endif
57*0b57cec5SDimitry Andric 
58*0b57cec5SDimitry Andric #endif
59