new copyright; att/bsd/shared
[unix-history] / usr / src / usr.bin / m4 / TEST / hash.m4
CommitLineData
bfab3640
KB
1#
2# Copyright (c) 1989 The Regents of the University of California.
3# All rights reserved.
4#
5# This code is derived from software contributed to Berkeley by
6# Ozan Yigit.
7#
7430d53a 8# %sccs.include.redist.sh%
bfab3640 9#
7430d53a 10# @(#)hash.m4 5.2 (Berkeley) %G%
bfab3640
KB
11#
12
13dnl This probably will not run on any m4 that cannot
14dnl handle char constants in eval.
15dnl
16changequote(<,>) define(HASHVAL,99) dnl
17define(hash,<eval(str(substr($1,1),0)%HASHVAL)>) dnl
18define(str,
19 <ifelse($1,",$2,
20 <str(substr(<$1>,1),<eval($2+'substr($1,0,1)')>)>)
21 >) dnl
22define(KEYWORD,<$1,hash($1),>) dnl
23define(TSTART,
24<struct prehash {
25 char *keyword;
26 int hashval;
27} keytab[] = {>) dnl
28define(TEND,< "",0
29};>) dnl