12df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens/*- 22df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * This code is derived from OpenBSD's libc/regex, original license follows: 32df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * 42df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * Copyright (c) 1992, 1993, 1994 Henry Spencer. 52df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * Copyright (c) 1992, 1993, 1994 62df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * The Regents of the University of California. All rights reserved. 72df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * 82df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * This code is derived from software contributed to Berkeley by 92df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * Henry Spencer. 102df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * 112df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * Redistribution and use in source and binary forms, with or without 122df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * modification, are permitted provided that the following conditions 132df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * are met: 142df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * 1. Redistributions of source code must retain the above copyright 152df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * notice, this list of conditions and the following disclaimer. 162df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * 2. Redistributions in binary form must reproduce the above copyright 172df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * notice, this list of conditions and the following disclaimer in the 182df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * documentation and/or other materials provided with the distribution. 192df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * 3. Neither the name of the University nor the names of its contributors 202df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * may be used to endorse or promote products derived from this software 212df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * without specific prior written permission. 222df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * 232df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 242df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 252df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 262df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 272df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 282df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 292df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 302df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 312df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 322df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 332df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * SUCH DAMAGE. 342df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * 352df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens * @(#)utils.h 8.3 (Berkeley) 3/20/94 362df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens */ 372df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens 382df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#ifndef LLVM_SUPPORT_REGUTILS_H 392df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#define LLVM_SUPPORT_REGUTILS_H 402df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens 412df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens/* utility definitions */ 422df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#define NC (CHAR_MAX - CHAR_MIN + 1) 432df178997d17474042e8c3704cc93ab2db6619bfNicolas Capenstypedef unsigned char uch; 442df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens 452df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens/* switch off assertions (if not already off) if no REDEBUG */ 462df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#ifndef REDEBUG 472df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#ifndef NDEBUG 482df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#define NDEBUG /* no assertions please */ 492df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#endif 502df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#endif 512df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#include <assert.h> 522df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens 532df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens/* for old systems with bcopy() but no memmove() */ 542df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#ifdef USEBCOPY 552df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#define memmove(d, s, c) bcopy(s, d, c) 562df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#endif 572df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens 582df178997d17474042e8c3704cc93ab2db6619bfNicolas Capens#endif 59