Debian Codegraph @

libutil/kazlib/dict.h

raw symbols SCIP
1 /*
2 * Dictionary Abstract Data Type
3 * Copyright (C) 1997 Kaz Kylheku <[email protected]>
4 *
5 * Free Software License:
6 *
7 * All rights are reserved by the author, with the following exceptions:
8 * Permission is granted to freely reproduce and distribute this software,
9 * possibly in exchange for a fee, provided that this copyright notice appears
10 * intact. Permission is also granted to adapt this software to produce
11 * derivative works, as long as the modified versions carry this copyright
12 * notice and additional notices stating that the work has been modified.
13 * This source code may be translated into executable form and incorporated
14 * into proprietary software; there is no requirement for such software to
15 * contain a copyright notice related to this source.
16 *
17 */
18
19 #ifndef DICT_H
20 #define DICT_Hcxx . . $ `libutil/kazlib/dict.h:20:9`!
21
22 #include <limits.h>
23 #ifdef KAZLIB_SIDEEFFECT_DEBUG
24 #include "sfx.h"
25 #endif
26
27 /*
28 * Blurb for inclusion into C++ translation units
29 */
30
31 #ifdef __cpluspluscxx . . $ `<built-in>:471:9`!
32 extern "C" {
33 #endif
34
35 typedef unsigned long dictcount_tcxx . . $ dictcount_t#;
36 #define DICTCOUNT_T_MAXcxx . . $ `libutil/kazlib/dict.h:36:9`! ULONG_MAXcxx . . $ `<external>/67164224788392828/limits.h:135:9`!
37
38 /*
39 * The dictionary is implemented as a red-black tree
40 */
41
42 typedef enumcxx . . $ $anonymous_type_2ffa56ece0cc5018_0# { dnode_redcxx . . $ dnode_red., dnode_blackcxx . . $ dnode_black. } dnode_color_tcxx . . $ dnode_color_t#;
43
44 typedef struct dnode_tcxx . . $ dnode_t# {
45 #if defined(DICT_IMPLEMENTATIONcxx . . $ `libutil/kazlib/dict.c:25:9`!) || !defined(KAZLIB_OPAQUE_DEBUG)
46 struct dnode_tcxx . . $ dnode_t# *dict_leftcxx . . $ dnode_t#dict_left.;
47 struct dnode_tcxx . . $ dnode_t# *dict_rightcxx . . $ dnode_t#dict_right.;
48 struct dnode_tcxx . . $ dnode_t# *dict_parentcxx . . $ dnode_t#dict_parent.;
49 dnode_color_tcxx . . $ dnode_color_t# dict_colorcxx . . $ dnode_t#dict_color.;
50 const void *dict_keycxx . . $ dnode_t#dict_key.;
51 void *dict_datacxx . . $ dnode_t#dict_data.;
52 #else
53 int dict_dummy;
54 #endif
55 } dnode_tcxx . . $ dnode_t#;
56
57 typedef int (*dict_comp_tcxx . . $ dict_comp_t#)(const void *, const void *);
58 typedef dnode_tcxx . . $ dnode_t# *(*dnode_alloc_tcxx . . $ dnode_alloc_t#)(void *);
59 typedef void (*dnode_free_tcxx . . $ dnode_free_t#)(dnode_tcxx . . $ dnode_t# *, void *);
60
61 typedef struct dict_tcxx . . $ dict_t# {
62 #if defined(DICT_IMPLEMENTATIONcxx . . $ `libutil/kazlib/dict.c:25:9`!) || !defined(KAZLIB_OPAQUE_DEBUG)
63 dnode_tcxx . . $ dnode_t# dict_nilnodecxx . . $ dict_t#dict_nilnode.;
64 dictcount_tcxx . . $ dictcount_t# dict_nodecountcxx . . $ dict_t#dict_nodecount.;
65 dictcount_tcxx . . $ dictcount_t# dict_maxcountcxx . . $ dict_t#dict_maxcount.;
66 dict_comp_tcxx . . $ dict_comp_t# dict_comparecxx . . $ dict_t#dict_compare.;
67 dnode_alloc_tcxx . . $ dnode_alloc_t# dict_allocnodecxx . . $ dict_t#dict_allocnode.;
68 dnode_free_tcxx . . $ dnode_free_t# dict_freenodecxx . . $ dict_t#dict_freenode.;
69 void *dict_contextcxx . . $ dict_t#dict_context.;
70 int dict_dupescxx . . $ dict_t#dict_dupes.;
71 #else
72 int dict_dummmy;
73 #endif
74 } dict_tcxx . . $ dict_t#;
75
76 typedef void (*dnode_process_tcxx . . $ dnode_process_t#)(dict_tcxx . . $ dict_t# *, dnode_tcxx . . $ dnode_t# *, void *);
77
78 typedef struct dict_load_tcxx . . $ dict_load_t# {
79 #if defined(DICT_IMPLEMENTATIONcxx . . $ `libutil/kazlib/dict.c:25:9`!) || !defined(KAZLIB_OPAQUE_DEBUG)
80 dict_tcxx . . $ dict_t# *dict_dictptrcxx . . $ dict_load_t#dict_dictptr.;
81 dnode_tcxx . . $ dnode_t# dict_nilnodecxx . . $ dict_load_t#dict_nilnode.;
82 #else
83 int dict_dummmy;
84 #endif
85 } dict_load_tcxx . . $ dict_load_t#;
86
87 extern dict_tcxx . . $ dict_t# *dict_createcxx . . $ dict_create(409c0fa7df18392f).(dictcount_tcxx . . $ dictcount_t#, dict_comp_tcxx . . $ dict_comp_t#);
88 extern void dict_set_allocatorcxx . . $ dict_set_allocator(3a2b21975abbd610).(dict_tcxx . . $ dict_t# *, dnode_alloc_tcxx . . $ dnode_alloc_t#, dnode_free_tcxx . . $ dnode_free_t#, void *);
89 extern void dict_destroycxx . . $ dict_destroy(800a663dd6649ec3).(dict_tcxx . . $ dict_t# *);
90 extern void dict_free_nodescxx . . $ dict_free_nodes(800a663dd6649ec3).(dict_tcxx . . $ dict_t# *);
91 extern void dict_freecxx . . $ dict_free(800a663dd6649ec3).(dict_tcxx . . $ dict_t# *);
92 extern dict_tcxx . . $ dict_t# *dict_initcxx . . $ dict_init(53dde83a78ed021f).(dict_tcxx . . $ dict_t# *, dictcount_tcxx . . $ dictcount_t#, dict_comp_tcxx . . $ dict_comp_t#);
93 extern void dict_init_likecxx . . $ dict_init_like(581e1afc54b74ec7).(dict_tcxx . . $ dict_t# *, const dict_tcxx . . $ dict_t# *);
94 extern int dict_verifycxx . . $ dict_verify(486defedf50490c0).(dict_tcxx . . $ dict_t# *);
95 extern int dict_similarcxx . . $ dict_similar(9b7e36c0c88c8e7).(const dict_tcxx . . $ dict_t# *, const dict_tcxx . . $ dict_t# *);
96 extern dnode_tcxx . . $ dnode_t# *dict_lookupcxx . . $ dict_lookup(3cf9253b4ec3740a).(dict_tcxx . . $ dict_t# *, const void *);
97 extern dnode_tcxx . . $ dnode_t# *dict_lower_boundcxx . . $ dict_lower_bound(3cf9253b4ec3740a).(dict_tcxx . . $ dict_t# *, const void *);
98 extern dnode_tcxx . . $ dnode_t# *dict_upper_boundcxx . . $ dict_upper_bound(3cf9253b4ec3740a).(dict_tcxx . . $ dict_t# *, const void *);
99 extern void dict_insertcxx . . $ dict_insert(9b8b447ccd595f54).(dict_tcxx . . $ dict_t# *, dnode_tcxx . . $ dnode_t# *, const void *);
100 extern dnode_tcxx . . $ dnode_t# *dict_deletecxx . . $ dict_delete(ab0ddc8b5730ea06).(dict_tcxx . . $ dict_t# *, dnode_tcxx . . $ dnode_t# *);
101 extern int dict_alloc_insertcxx . . $ dict_alloc_insert(ee9713c829deea05).(dict_tcxx . . $ dict_t# *, const void *, void *);
102 extern void dict_delete_freecxx . . $ dict_delete_free(8342a7252ed3fca4).(dict_tcxx . . $ dict_t# *, dnode_tcxx . . $ dnode_t# *);
103 extern dnode_tcxx . . $ dnode_t# *dict_firstcxx . . $ dict_first(91bb227e15b06379).(dict_tcxx . . $ dict_t# *);
104 extern dnode_tcxx . . $ dnode_t# *dict_lastcxx . . $ dict_last(91bb227e15b06379).(dict_tcxx . . $ dict_t# *);
105 extern dnode_tcxx . . $ dnode_t# *dict_nextcxx . . $ dict_next(ab0ddc8b5730ea06).(dict_tcxx . . $ dict_t# *, dnode_tcxx . . $ dnode_t# *);
106 extern dnode_tcxx . . $ dnode_t# *dict_prevcxx . . $ dict_prev(ab0ddc8b5730ea06).(dict_tcxx . . $ dict_t# *, dnode_tcxx . . $ dnode_t# *);
107 extern dictcount_tcxx . . $ dictcount_t# dict_countcxx . . $ dict_count(af82f1cb217f415b).(dict_tcxx . . $ dict_t# *);
108 extern int dict_isemptycxx . . $ dict_isempty(486defedf50490c0).(dict_tcxx . . $ dict_t# *);
109 extern int dict_isfullcxx . . $ dict_isfull(486defedf50490c0).(dict_tcxx . . $ dict_t# *);
110 extern int dict_containscxx . . $ dict_contains(9a254b93545920ef).(dict_tcxx . . $ dict_t# *, dnode_tcxx . . $ dnode_t# *);
111 extern void dict_allow_dupescxx . . $ dict_allow_dupes(800a663dd6649ec3).(dict_tcxx . . $ dict_t# *);
112 extern int dnode_is_in_a_dictcxx . . $ dnode_is_in_a_dict(f89c808959580504).(dnode_tcxx . . $ dnode_t# *);
113 extern dnode_tcxx . . $ dnode_t# *dnode_createcxx . . $ dnode_create(7b926da9c864cd9a).(void *);
114 extern dnode_tcxx . . $ dnode_t# *dnode_initcxx . . $ dnode_init(1e9a3092fde647bc).(dnode_tcxx . . $ dnode_t# *, void *);
115 extern void dnode_destroycxx . . $ dnode_destroy(6a57193b2f11ad37).(dnode_tcxx . . $ dnode_t# *);
116 extern void *dnode_getcxx . . $ dnode_get(f831aa5c81a2a467).(dnode_tcxx . . $ dnode_t# *);
117 extern const void *dnode_getkeycxx . . $ dnode_getkey(3372bd56e4d6a976).(dnode_tcxx . . $ dnode_t# *);
118 extern void dnode_putcxx . . $ dnode_put(5979ed8d600b6ad8).(dnode_tcxx . . $ dnode_t# *, void *);
119 extern void dict_processcxx . . $ dict_process(7aac4f2ba3a497df).(dict_tcxx . . $ dict_t# *, void *, dnode_process_tcxx . . $ dnode_process_t#);
120 extern void dict_load_begincxx . . $ dict_load_begin(e24f983fdb8b73ba).(dict_load_tcxx . . $ dict_load_t# *, dict_tcxx . . $ dict_t# *);
121 extern void dict_load_nextcxx . . $ dict_load_next(ed3a052514d37ae0).(dict_load_tcxx . . $ dict_load_t# *, dnode_tcxx . . $ dnode_t# *, const void *);
122 extern void dict_load_endcxx . . $ dict_load_end(95a2509e6390632c).(dict_load_tcxx . . $ dict_load_t# *);
123 extern void dict_mergecxx . . $ dict_merge(27d992ac36bb9ffd).(dict_tcxx . . $ dict_t# *, dict_tcxx . . $ dict_t# *);
124
125 #if defined(DICT_IMPLEMENTATIONcxx . . $ `libutil/kazlib/dict.c:25:9`!) || !defined(KAZLIB_OPAQUE_DEBUG)
126 #ifdef KAZLIB_SIDEEFFECT_DEBUG
127 #define dict_isfull(D) (SFX_CHECK(D)->dict_nodecount == (D)->dict_maxcount)
128 #else
129 #define dict_isfullcxx . . $ `libutil/kazlib/dict.h:129:9`!(D) ((D)->dict_nodecount == (D)->dict_maxcount)
130 #endif
131 #define dict_countcxx . . $ `libutil/kazlib/dict.h:131:9`!(D) ((D)->dict_nodecount)
132 #define dict_isemptycxx . . $ `libutil/kazlib/dict.h:132:9`!(D) ((D)->dict_nodecount == 0)
133 #define dnode_getcxx . . $ `libutil/kazlib/dict.h:133:9`!(N) ((N)->dict_data)
134 #define dnode_getkeycxx . . $ `libutil/kazlib/dict.h:134:9`!(N) ((N)->dict_key)
135 #define dnode_putcxx . . $ `libutil/kazlib/dict.h:135:9`!(N, X) ((N)->dict_data = (X))
136 #endif
137
138 #ifdef __cpluspluscxx . . $ `<built-in>:471:9`!
139 }
140 #endif
141
142 #endif