source: trunk/minix/commands/m4/Hash.m4@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 425 bytes
Line 
1dnl This probably will not run on any m4 that cannot
2dnl handle char constants in eval.
3dnl
4changequote(<,>) define(HASHVAL,99) dnl
5define(hash,<eval(str(substr($1,1),0)%HASHVAL)>) dnl
6define(str,
7 <ifelse($1,",$2,
8 <str(substr(<$1>,1),<eval($2+'substr($1,0,1)')>)>)
9 >) dnl
10define(KEYWORD,<$1,hash($1),>) dnl
11define(TSTART,
12<struct prehash {
13 char *keyword;
14 int hashval;
15} keytab[] = {>) dnl
16define(TEND,< "",0
17};>) dnl
Note: See TracBrowser for help on using the repository browser.