Kstars

dict.h
1 /*
2 ** Author: Eric Veach, July 1994.
3 **
4 */
5 
6 #ifndef __dict_list_h_
7 #define __dict_list_h_
8 
9 /* Use #define's so that another heap implementation can use this one */
10 
11 #define DictKey DictListKey
12 #define Dict DictList
13 #define DictNode DictListNode
14 
15 #define dictNewDict(frame, leq) __gl_dictListNewDict(frame, leq)
16 #define dictDeleteDict(dict) __gl_dictListDeleteDict(dict)
17 
18 #define dictSearch(dict, key) __gl_dictListSearch(dict, key)
19 #define dictInsert(dict, key) __gl_dictListInsert(dict, key)
20 #define dictInsertBefore(dict, node, key) __gl_dictListInsertBefore(dict, node, key)
21 #define dictDelete(dict, node) __gl_dictListDelete(dict, node)
22 
23 #define dictKey(n) __gl_dictListKey(n)
24 #define dictSucc(n) __gl_dictListSucc(n)
25 #define dictPred(n) __gl_dictListPred(n)
26 #define dictMin(d) __gl_dictListMin(d)
27 #define dictMax(d) __gl_dictListMax(d)
28 
29 typedef void *DictKey;
30 typedef struct Dict Dict;
31 typedef struct DictNode DictNode;
32 
33 Dict *dictNewDict(void *frame, int (*leq)(void *frame, DictKey key1, DictKey key2));
34 
35 void dictDeleteDict(Dict *dict);
36 
37 /* Search returns the node with the smallest key greater than or equal
38  * to the given key. If there is no such key, returns a node whose
39  * key is NULL. Similarly, Succ(Max(d)) has a NULL key, etc.
40  */
41 DictNode *dictSearch(Dict *dict, DictKey key);
42 DictNode *dictInsertBefore(Dict *dict, DictNode *node, DictKey key);
43 void dictDelete(Dict *dict, DictNode *node);
44 
45 #define __gl_dictListKey(n) ((n)->key)
46 #define __gl_dictListSucc(n) ((n)->next)
47 #define __gl_dictListPred(n) ((n)->prev)
48 #define __gl_dictListMin(d) ((d)->head.next)
49 #define __gl_dictListMax(d) ((d)->head.prev)
50 #define __gl_dictListInsert(d, k) (dictInsertBefore((d), &(d)->head, (k)))
51 
52 /*** Private data structures ***/
53 
54 struct DictNode
55 {
56  DictKey key;
57  DictNode *next;
58  DictNode *prev;
59 };
60 
61 struct Dict
62 {
63  DictNode head;
64  void *frame;
65  int (*leq)(void *frame, DictKey key1, DictKey key2);
66 };
67 
68 #endif
const QList< QKeySequence > & next()
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 19 2022 03:57:50 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.