Commit | Line | Data |
---|---|---|
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 | ||
13 | dnl This probably will not run on any m4 that cannot | |
14 | dnl handle char constants in eval. | |
15 | dnl | |
16 | changequote(<,>) define(HASHVAL,99) dnl | |
17 | define(hash,<eval(str(substr($1,1),0)%HASHVAL)>) dnl | |
18 | define(str, | |
19 | <ifelse($1,",$2, | |
20 | <str(substr(<$1>,1),<eval($2+'substr($1,0,1)')>)>) | |
21 | >) dnl | |
22 | define(KEYWORD,<$1,hash($1),>) dnl | |
23 | define(TSTART, | |
24 | <struct prehash { | |
25 | char *keyword; | |
26 | int hashval; | |
27 | } keytab[] = {>) dnl | |
28 | define(TEND,< "",0 | |
29 | };>) dnl |