11590Srgrimes/*
218905Swosch * Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
31590Srgrimes * Copyright (c) 1989, 1993
41590Srgrimes *	The Regents of the University of California.  All rights reserved.
51590Srgrimes *
61590Srgrimes * Redistribution and use in source and binary forms, with or without
71590Srgrimes * modification, are permitted provided that the following conditions
81590Srgrimes * are met:
91590Srgrimes * 1. Redistributions of source code must retain the above copyright
101590Srgrimes *    notice, this list of conditions and the following disclaimer.
111590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
121590Srgrimes *    notice, this list of conditions and the following disclaimer in the
131590Srgrimes *    documentation and/or other materials provided with the distribution.
141590Srgrimes * 3. All advertising materials mentioning features or use of this software
151590Srgrimes *    must display the following acknowledgement:
161590Srgrimes *	This product includes software developed by the University of
171590Srgrimes *	California, Berkeley and its contributors.
181590Srgrimes * 4. Neither the name of the University nor the names of its contributors
191590Srgrimes *    may be used to endorse or promote products derived from this software
201590Srgrimes *    without specific prior written permission.
211590Srgrimes *
221590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251590Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321590Srgrimes * SUCH DAMAGE.
331590Srgrimes *
341590Srgrimes *	@(#)locate.h	8.1 (Berkeley) 6/6/93
3550477Speter * $FreeBSD$
361590Srgrimes */
371590Srgrimes
381590Srgrimes/* Symbolic constants shared by locate.c and code.c */
391590Srgrimes
401590Srgrimes#define	NBG		128		/* number of bigrams considered */
411590Srgrimes#define	OFFSET		14		/* abs value of max likely diff */
421590Srgrimes#define	PARITY		0200		/* parity bit */
431590Srgrimes#define	SWITCH		30		/* switch code */
4418905Swosch#define UMLAUT          31              /* an 8 bit char followed */
4517592Swosch
4617592Swosch/* 	0-28	likeliest differential counts + offset to make nonnegative */
4717592Swosch#define LDC_MIN         0
4817592Swosch#define LDC_MAX        28
4917592Swosch
5017592Swosch/*	128-255 bigram codes (128 most common, as determined by 'updatedb') */
51215752Snwhitehorn#define BIGRAM_MIN    (UCHAR_MAX - SCHAR_MAX)
5217592Swosch#define BIGRAM_MAX    UCHAR_MAX
5317592Swosch
5417592Swosch/*	32-127  single character (printable) ascii residue (ie, literal) */
5517592Swosch#define ASCII_MIN      32
56215752Snwhitehorn#define ASCII_MAX     SCHAR_MAX
5717592Swosch
58215752Snwhitehorn/* #define TO7BIT(x)     (x = ( ((u_char)x) & SCHAR_MAX )) */
59215752Snwhitehorn#define TO7BIT(x)     (x = x & SCHAR_MAX )
6017592Swosch
6117592Swosch
6217592Swosch#if UCHAR_MAX >= 4096
6317592Swosch   define TOLOWER(ch)	  tolower(ch)
6417592Swosch#else
6517592Swosch
6617592Swoschu_char myctype[UCHAR_MAX + 1];
6717592Swosch#define TOLOWER(ch)	(myctype[ch])
6817592Swosch#endif
6917592Swosch
7017592Swosch#define INTSIZE (sizeof(int))
7118829Swosch
7218829Swosch#define LOCATE_REG "*?[]\\"  /* fnmatch(3) meta characters */
73