1 /* This may look like C code, but it is really -*- C++ -*- */
3 /* Hash table used to check for duplicate keyword entries.
5 Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
6 Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
7 and Bruno Haible <bruno@clisp.org>.
9 This file is part of GNU GPERF.
11 GNU GPERF is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2, or (at your option)
16 GNU GPERF is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; see the file COPYING.
23 If not, write to the Free Software Foundation, Inc.,
24 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
27 #define hash_table_h 1
31 /* Hash table of KeywordExt* entries.
32 Two entries are considered equal if their _selchars are the same and
33 - if !ignore_length - if their _allchars_length are the same. */
39 size is the maximum number of entries.
40 ignore_length determines a detail in the comparison function. */
41 Hash_Table (unsigned int size, bool ignore_length);
44 /* Attempts to insert ITEM in the table. If there is already an equal
45 entry in it, returns it. Otherwise inserts ITEM and returns NULL. */
46 KeywordExt * insert (KeywordExt *item);
47 /* Print the table's contents. */
51 /* Vector of entries. */
53 /* Size of the vector. */
56 unsigned int _log_size;
57 /* A detail of the comparison function. */
58 bool const _ignore_length;
59 /* Statistics: Number of collisions so far. */
60 unsigned int _collisions;
62 /* Compares two items. */
63 bool equal (KeywordExt *item1, KeywordExt *item2) const;