From 2274441da6a3a642412527fd795e1d5aeb44b6b9 Mon Sep 17 00:00:00 2001 From: Hartmut Brandt Date: Thu, 28 Apr 2005 07:55:55 +0000 Subject: Move the hash function for directives into its own file and add a Makefile target to re-created this file. Note, that there is no explicite dependency to automatically re-create the file, because this is needed only when the directive table changes and it requires the (yet to come) devel/mph port. Submitted by: Max Okumoto (first version) --- usr.bin/make/parse.c | 68 +++------------------------------------------------- 1 file changed, 3 insertions(+), 65 deletions(-) (limited to 'usr.bin/make/parse.c') diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 431d854a94cb..05701b599615 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include "cond.h" #include "config.h" #include "dir.h" +#include "directive_hash.h" #include "for.h" #include "globals.h" #include "GNode.h" @@ -231,58 +232,19 @@ static struct { { ".WAIT", Wait, 0 }, }; -/* - * Directive table. We use a hash table. This hash table has been generated - * with mph which can be found on the usual GNU mirrors. If you change the - * directives (adding, deleting, reordering) you need to create a new table - * and hash function (directive_hash). The command line to generate the - * table is: - * - * mph -d2 -m1 9) - return (-1); - - for (f0 = f1 = 0; kp < key + len; ++kp) { - if (*kp < 97 || *kp > 119) - return (-1); - f0 += directive_T0[-97 + *kp]; - f1 += directive_T1[-97 + *kp]; - } - - f0 %= 38; - f1 %= 38; - - return (directive_g[f0] + directive_g[f1]) % 18; -} - /** * parse_directive * Got a line starting with a '.'. Check if this is a directive -- cgit v1.2.3