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