1 /* hash.h: declarations for a hash table.
3 Copyright 1994, 1995, 2008 Karl Berry.
4 Copyright 1999, 2005 Olaf Weber.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this library; if not, see <http://www.gnu.org/licenses/>. */
22 #include <kpathsea/c-proto.h>
23 #include <kpathsea/types.h>
26 /* A single (key,value) pair. */
27 typedef struct hash_element_struct
31 struct hash_element_struct *next;
34 /* The usual arrangement of buckets initialized to null. */
37 hash_element_type **buckets;
42 /* How to print the hash results when debugging. */
43 extern KPSEDLL boolean kpse_debug_hash_lookup_int;
46 /* Create a hash table of size SIZE. */
47 extern KPSEDLL hash_table_type hash_create P1H(unsigned size);
49 /* Insert the (KEY,VALUE) association into TABLE. KEY may have more
50 than one VALUE. Neither KEY nor VALUE is copied. */
51 extern KPSEDLL void hash_insert P3H(hash_table_type *table,
55 /* Insert the (KEY, VALUE) association into TABLE. KEY may have more
56 than one VALUE. Neither KEY nor VALUE is copied. Assume that KEY
57 is already normalized (all lowercase) on platforms where this matters. */
58 extern KPSEDLL void hash_insert_normalized P3H(hash_table_type *table,
62 /* Remove the (KEY,VALUE) association from TABLE. */
63 extern KPSEDLL void hash_remove P3H(hash_table_type *table, const_string key,
66 /* Look up KEY in MAP, and return NULL-terminated list of all matching
67 values (not copies), in insertion order. If none, return NULL. */
68 extern KPSEDLL string *hash_lookup P2H(hash_table_type table, const_string key);
70 /* Print TABLE to stderr. */
71 extern void hash_print P2H(hash_table_type table, boolean summary_only);
73 #endif /* not HASH_H */