4 * Copyright (C) 1989 Free Software Foundation, Inc.
5 * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu)
7 * This file is part of GNU GPERF.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #include "Bool_Array.h"
30 #include "ace/Copy_Disabled.h"
33 * Provides high-level routines to manipulate the keyword list
34 * structures the code generation output.
36 class Gen_Perf
: private ACE_Copy_Disabled
45 /// Attempt to generate a perfect hash function.
50 int change (List_Node
*prior
, List_Node
*curr
);
51 int affects_prev (char c
, List_Node
*curr
);
52 int compute_perfect_hash ();
53 int compute_binary_search ();
54 int compute_linear_search ();
55 static int hash (List_Node
*key_node
);
56 static int compute_disjoint_union (char *s1
, char *s2
, char *s3
);
57 static void sort_set (char *union_set
, int len
);
59 /// Maximum possible hash value.
62 /// Records fewest # of collisions for asso value.
63 int fewest_collisions
;
65 /// Number of keywords processed without a collision.
71 /// List of the keys we're trying to map into a perfect hash
75 /// Table that keeps track of key collisions.
76 Bool_Array char_search
;
79 #endif /* GEN_PERF_H */