geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Go to the documentation of this file.
3* Copyright (c) 2014, Red Hat, Inc.
4* Copyright (c) 2014, Masatake YAMATO
6* This source code is released for free distribution under the terms of the
7* GNU General Public License version 2 or (at your option) any later version.
9* Defines hashtable
14#include "general.h"
15#include <stdint.h>
17/* This hashtable allows adding multiple items for the same key.
18 *
19 * hashTablePutItem() adds a key/item pair to the htable even if the
20 * htable has an item for the key already.
21 *
22 * hashTableGetItem() returns the first occurrence item for the given
23 * key.
24 *
25 * hashTableDeleteItem() deletes the first occurrence item for the given
26 * key.
27 *
28 * Use hashTableForeachItemOnChain () to process all items for the same key.
29 */
30typedef struct sHashTable hashTable;
31typedef unsigned int (* hashTableHashFunc) (const void * const key);
32typedef bool (* hashTableEqualFunc) (const void* a, const void* b);
33typedef void (* hashTableFreeFunc) (void * ptr);
35/* To continue interation, return true.
36 * To break interation, return false. */
37typedef bool (* hashTableForeachFunc) (const void *key, void *value, void *user_data);
39unsigned int hashPtrhash (const void * x);
40bool hashPtreq (const void * a, const void * constb);
42unsigned int hashCstrhash (const void * x);
43bool hashCstreq (const void * a, const void * b);
45unsigned int hashCstrcasehash (const void * x);
46bool hashCstrcaseeq (const void * a, const void * b);
48unsigned int hashInthash (const void * x);
49bool hashInteq (const void * a, const void * b);
51extern hashTable* hashTableNew (unsigned int size,
57extern void hashTableDelete (hashTable *htable);
58extern void hashTableClear (hashTable *htable);
59extern void hashTablePutItem (hashTable *htable, void *key, void *value);
60extern void* hashTableGetItem (hashTable *htable, const void * key);
61extern bool hashTableHasItem (hashTable * htable, const void * key);
62extern bool hashTableDeleteItem (hashTable *htable, const void *key);
64/* Return true if proc never returns false; proc returns true for all
65 * the items, or htable holds no item.
66 *
67 * Return false if htable holds at least one item and proc returns false
68 * for one of the items. */
69extern bool hashTableForeachItem (hashTable *htable, hashTableForeachFunc proc, void *user_data);
71/* This function is useful for htable having multiple items for a key.
72 * By giving a key, you can traverse all the items associated with the
73 * key via proc. * "Chain" means group of items associated with a
74 * key. */
75extern bool hashTableForeachItemOnChain (hashTable *htable, const void *key, hashTableForeachFunc proc, void *user_data);
77extern int hashTableCountItem (hashTable *htable);
79extern hashTable* hashTableIntNew (unsigned int size,
83#define HT_PTR_TO_INT(P) ((int)(intptr_t)(P))
84#define HT_INT_TO_PTR(P) ((void*)(intptr_t)(P))
85#define HT_PTR_TO_UINT(P) ((unsigned int)(uintptr_t)(P))
86#define HT_UINT_TO_PTR(P) ((void*)(uintptr_t)(P))
88#endif /* CTAGS_MAIN_HTABLE_H */
GeanyBuildCommand ** ptr
Definition: build.c:2679
bool hashTableForeachItemOnChain(hashTable *htable, const void *key, hashTableForeachFunc proc, void *user_data)
Definition: htable.c:238
bool hashCstreq(const void *a, const void *b)
Definition: htable.c:322
bool(* hashTableForeachFunc)(const void *key, void *value, void *user_data)
Definition: htable.h:37
void hashTablePutItem(hashTable *htable, void *key, void *value)
Definition: htable.c:186
void(* hashTableFreeFunc)(void *ptr)
Definition: htable.h:33
unsigned int hashCstrhash(const void *x)
Definition: htable.c:316
bool hashTableForeachItem(hashTable *htable, hashTableForeachFunc proc, void *user_data)
Definition: htable.c:216
hashTable * hashTableNew(unsigned int size, hashTableHashFunc hashfn, hashTableEqualFunc equalfn, hashTableFreeFunc keyfreefn, hashTableFreeFunc valfreefn)
Definition: htable.c:131
bool hashCstrcaseeq(const void *a, const void *b)
Definition: htable.c:354
void hashTableDelete(hashTable *htable)
Definition: htable.c:159
unsigned int hashInthash(const void *x)
Definition: htable.c:327
void * hashTableGetItem(hashTable *htable, const void *key)
Definition: htable.c:194
bool hashTableHasItem(hashTable *htable, const void *key)
Definition: htable.c:211
bool hashPtreq(const void *a, const void *constb)
Definition: htable.c:280
int hashTableCountItem(hashTable *htable)
Definition: htable.c:261
unsigned int(* hashTableHashFunc)(const void *const key)
Definition: htable.h:31
hashTable * hashTableIntNew(unsigned int size, hashTableHashFunc hashfn, hashTableEqualFunc equalfn, hashTableFreeFunc keyfreefn)
Definition: htable.c:151
bool(* hashTableEqualFunc)(const void *a, const void *b)
Definition: htable.h:32
bool hashTableDeleteItem(hashTable *htable, const void *key)
Definition: htable.c:202
unsigned int hashCstrcasehash(const void *x)
Definition: htable.c:348
void hashTableClear(hashTable *htable)
Definition: htable.c:170
bool hashInteq(const void *a, const void *b)
Definition: htable.c:339
unsigned int hashPtrhash(const void *x)
Definition: htable.c:268
unsigned int size
Definition: htable.c:43
hashTableHashFunc hashfn
Definition: htable.c:44
hashTableFreeFunc keyfreefn
Definition: htable.c:46
hashTableEqualFunc equalfn
Definition: htable.c:45
hashTableFreeFunc valfreefn
Definition: htable.c:47