3 * Copyright (c) 1995, 1996, 1997 Markku Rossi.
5 * Author: Markku Rossi <mtr@iki.fi>
9 * Enscript is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * Enscript 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 Enscript. If not, see <http://www.gnu.org/licenses/>.
28 #define ___P(protos) protos
29 #else /* no PROTOTYPES */
30 #define ___P(protos) ()
31 #endif /* no PROTOTYPES */
34 typedef struct stringhash_st *StringHashPtr;
37 * Init a hash and return a hash handle or NULL if there were errors.
39 StringHashPtr strhash_init ___P ((void));
42 * Free hash <hash>. Frees all resources that hash has allocated. <hash>
43 * shouldn't be used after this function is called.
45 void strhash_free ___P ((StringHashPtr hash));
48 * Put key <key> to hash <hash>. <data> will be bind to <key>. Returns
49 * true (1) if operation was successful or false (0) otherwise. If <key>
50 * is already bind to another data, then <old_data> will be set to old
51 * data. Otherwise it will be set to NULL.
53 int strhash_put ___P ((StringHashPtr hash, char *key, int keylen, void *data,
54 void **old_data_return));
57 * Get data associated to key <key>. Data is returned in <*data>.
58 * Returns true (1) is key was found or false (0) otherwise.
60 int strhash_get ___P ((StringHashPtr hash, const char *key, int keylen,
64 * Deletes key <key> form <hash>. Data is returned in <*data>. Returns
65 * true (1) if <key> was found or false (0) if <key> was not found or
66 * errors were encountered.
68 int strhash_delete ___P ((StringHashPtr hash, const char *key, int keylen,
72 * Get first item from hash <hash>. Returns 1 if there were items
75 int strhash_get_first ___P ((StringHashPtr hash, char **key_return,
76 int *keylen_return, void **data_return));
79 * Get next item from hash <hash>. Returns 1 if there were items
82 int strhash_get_next ___P ((StringHashPtr hash, char **key_return,
83 int *keylen_return, void **data_return));
85 #endif /* not STRHASH_H */