1
/* hash.h: declarations for a hash table.
3
Copyright 1999, 2005 Olaf Weber.
4
Copyright 1994, 95 Karl Berry.
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
17
License along with this library; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
#include <kpathsea/c-proto.h>
26
#include <kpathsea/types.h>
29
/* A single (key,value) pair. */
30
typedef struct hash_element_struct
34
struct hash_element_struct *next;
37
/* The usual arrangement of buckets initialized to null. */
40
hash_element_type **buckets;
45
/* How to print the hash results when debugging. */
46
extern KPSEDLL boolean kpse_debug_hash_lookup_int;
49
/* Create a hash table of size SIZE. */
50
extern KPSEDLL hash_table_type hash_create P1H(unsigned size);
52
/* Insert the (KEY,VALUE) association into TABLE. KEY may have more
53
than one VALUE. Neither KEY nor VALUE is copied. */
54
extern KPSEDLL void hash_insert P3H(hash_table_type *table,
58
/* Insert the (KEY, VALUE) association into TABLE. KEY may have more
59
than one VALUE. Neither KEY nor VALUE is copied. Assume that KEY
60
is already normalized (all lowercase) on platforms where this matters. */
61
extern KPSEDLL void hash_insert_normalized P3H(hash_table_type *table,
65
/* Remove the (KEY,VALUE) association from TABLE. */
66
extern KPSEDLL void hash_remove P3H(hash_table_type *table, const_string key,
69
/* Look up KEY in MAP, and return NULL-terminated list of all matching
70
values (not copies), in insertion order. If none, return NULL. */
71
extern KPSEDLL string *hash_lookup P2H(hash_table_type table, const_string key);
73
/* Print TABLE to stderr. */
74
extern void hash_print P2H(hash_table_type table, boolean summary_only);
76
#endif /* not HASH_H */