]> www.fi.muni.cz Git - evince.git/blob - dvi/mdvi-lib/hash.h
Do not include ev-poppler.h when pdf is disabled.
[evince.git] / dvi / mdvi-lib / hash.h
1 #ifndef MDVI_HASH
2 #define MDVI_HASH
3
4 /* Hash tables */
5
6
7 typedef struct _DviHashBucket DviHashBucket;
8 typedef struct _DviHashTable DviHashTable;
9
10 /*
11  * Hash tables
12  */
13
14 typedef Uchar   *DviHashKey;
15 #define MDVI_KEY(x)     ((DviHashKey)(x))
16
17 typedef Ulong   (*DviHashFunc) __PROTO((DviHashKey key));
18 typedef int     (*DviHashComp) __PROTO((DviHashKey key1, DviHashKey key2));
19 typedef void    (*DviHashFree) __PROTO((DviHashKey key, void *data));
20
21
22 struct _DviHashTable {
23         DviHashBucket   **buckets;
24         int     nbucks;
25         int     nkeys;
26         DviHashFunc hash_func;
27         DviHashComp hash_comp;
28         DviHashFree hash_free;
29 };
30 #define MDVI_EMPTY_HASH_TABLE {NULL, 0, 0, NULL, NULL, NULL}
31
32 #define MDVI_HASH_REPLACE       0
33 #define MDVI_HASH_UNIQUE        1
34 #define MDVI_HASH_UNCHECKED     2
35
36 extern void mdvi_hash_init __PROTO((DviHashTable *));
37 extern void mdvi_hash_create __PROTO((DviHashTable *, int));
38 extern int  mdvi_hash_add __PROTO((DviHashTable *, DviHashKey, void *, int));
39 extern int  mdvi_hash_destroy_key __PROTO((DviHashTable *, DviHashKey));
40 extern void mdvi_hash_reset __PROTO((DviHashTable *, int));
41 extern void *mdvi_hash_lookup __PROTO((DviHashTable *, DviHashKey));
42 extern void *mdvi_hash_remove __PROTO((DviHashTable *, DviHashKey));
43 extern void *mdvi_hash_remove_ptr __PROTO((DviHashTable *, DviHashKey));
44
45 #define mdvi_hash_flush(h)      mdvi_hash_reset((h), 1)
46 #define mdvi_hash_destroy(h)    mdvi_hash_reset((h), 0)
47
48 #endif
49