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