/* * guts.h -- * * Regexp package file: Misc. utilities. * * Copyright (c) 1998 Henry Spencer. All rights reserved. * * Development of this software was funded, in part, by Cray Research Inc., * UUNET Communications Services Inc., and Sun Microsystems Inc., none of * whom are responsible for the results. The author thanks all of them. * * Redistribution and use in source and binary forms -- with or without * modification -- are permitted for any purpose, provided that * redistributions in source form retain this entire copyright notice and * indicate the origin and nature of any modifications. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Copyright (c) 1998 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: guts.h,v 1.1.2.2 1998/10/03 01:56:40 stanton Exp $ */ #include "tclInt.h" #define NOTREACHED 0 #define xxx 1 #ifndef _POSIX2_RE_DUP_MAX #define _POSIX2_RE_DUP_MAX 255 #endif #define DUPMAX _POSIX2_RE_DUP_MAX #define INFINITY (DUPMAX+1) /* bitmap manipulation */ #define UBITS (CHAR_BIT * sizeof(unsigned)) #define BSET(uv, sn) ((uv)[(sn)/UBITS] |= (unsigned)1 << ((sn)%UBITS)) #define ISBSET(uv, sn) ((uv)[(sn)/UBITS] & ((unsigned)1 << ((sn)%UBITS))) /* * Map a truth value into -1 for false, 1 for true. This is so it is * possible to write compile-time assertions by declaring a dummy array * of this size. (Why not #if? Because sizeof is not available there.) */ #define NEGIFNOT(x) (2*!!(x) - 1) /* !! ensures 0 or 1 */ /* * We dissect a chr into byts for colormap table indexing. Here we define * a byt, which will be the same as a byte on most machines... The exact * size of a byt is not critical, but about 8 bits is good, and extraction * of 8-bit chunks is sometimes especially fast. * * Changes in several places are needed to handle an increase in MAXBYTS. * Those places check whether MAXBYTS is larger than they expect. */ #ifndef BYTBITS #define BYTBITS 8 /* bits in a byt */ #endif #define BYTTAB (1<