hash.m4 revision 16748
116748Sjmallett# $OpenBSD: hash.m4,v 1.2 1996/06/26 05:36:19 deraadt Exp $ 216748Sjmallett# $NetBSD: hash.m4,v 1.4 1995/09/28 05:37:58 tls Exp $ 31590Srgrimes# 41590Srgrimes# Copyright (c) 1989, 1993 51590Srgrimes# The Regents of the University of California. All rights reserved. 61590Srgrimes# 71590Srgrimes# This code is derived from software contributed to Berkeley by 81590Srgrimes# Ozan Yigit. 91590Srgrimes# 101590Srgrimes# Redistribution and use in source and binary forms, with or without 111590Srgrimes# modification, are permitted provided that the following conditions 121590Srgrimes# are met: 131590Srgrimes# 1. Redistributions of source code must retain the above copyright 141590Srgrimes# notice, this list of conditions and the following disclaimer. 151590Srgrimes# 2. Redistributions in binary form must reproduce the above copyright 161590Srgrimes# notice, this list of conditions and the following disclaimer in the 171590Srgrimes# documentation and/or other materials provided with the distribution. 181590Srgrimes# 3. All advertising materials mentioning features or use of this software 191590Srgrimes# must display the following acknowledgement: 201590Srgrimes# This product includes software developed by the University of 211590Srgrimes# California, Berkeley and its contributors. 221590Srgrimes# 4. Neither the name of the University nor the names of its contributors 231590Srgrimes# may be used to endorse or promote products derived from this software 241590Srgrimes# without specific prior written permission. 251590Srgrimes# 261590Srgrimes# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 271590Srgrimes# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 281590Srgrimes# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 291590Srgrimes# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 301590Srgrimes# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 311590Srgrimes# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 321590Srgrimes# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 331590Srgrimes# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 341590Srgrimes# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 351590Srgrimes# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 361590Srgrimes# SUCH DAMAGE. 371590Srgrimes# 381590Srgrimes# @(#)hash.m4 8.1 (Berkeley) 6/6/93 391590Srgrimes# 401590Srgrimes 411590Srgrimesdnl This probably will not run on any m4 that cannot 421590Srgrimesdnl handle char constants in eval. 431590Srgrimesdnl 441590Srgrimeschangequote(<,>) define(HASHVAL,99) dnl 451590Srgrimesdefine(hash,<eval(str(substr($1,1),0)%HASHVAL)>) dnl 461590Srgrimesdefine(str, 471590Srgrimes <ifelse($1,",$2, 481590Srgrimes <str(substr(<$1>,1),<eval($2+'substr($1,0,1)')>)>) 491590Srgrimes >) dnl 501590Srgrimesdefine(KEYWORD,<$1,hash($1),>) dnl 511590Srgrimesdefine(TSTART, 521590Srgrimes<struct prehash { 531590Srgrimes char *keyword; 541590Srgrimes int hashval; 551590Srgrimes} keytab[] = {>) dnl 561590Srgrimesdefine(TEND,< "",0 571590Srgrimes};>) dnl 58