Lumiera  0.pre.03
»edit your freedom«
config-lookup.h
Go to the documentation of this file.
1 /*
2  CONFIG-LOOKUP.h - Lookup functions for the config subsystem
3 
4  Copyright (C) Lumiera.org
5  2008, Christian Thaeter <ct@pipapo.org>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
37 #ifndef COMMON_CONFIG_LOOKUP_H
38 #define COMMON_CONFIG_LOOKUP_H
39 
40 #include "lib/psplay.h"
41 #include "lib/llist.h"
42 #include "lib/error.h"
43 
44 typedef struct lumiera_config_lookup_struct lumiera_config_lookup;
45 typedef lumiera_config_lookup* LumieraConfigLookup;
46 
47 typedef struct lumiera_config_lookupentry_struct lumiera_config_lookupentry;
48 typedef lumiera_config_lookupentry* LumieraConfigLookupentry;
49 
50 
51 #include "common/configitem.h"
52 
53 #include <nobug.h>
54 
55 
56 LUMIERA_ERROR_DECLARE (CONFIG_LOOKUP);
57 
58 
63 {
64  psplay tree;
65 };
66 
72 LumieraConfigLookup
73 lumiera_config_lookup_init (LumieraConfigLookup self);
74 
80 LumieraConfigLookup
81 lumiera_config_lookup_destroy (LumieraConfigLookup self);
82 
90 LumieraConfigLookupentry
91 lumiera_config_lookup_insert (LumieraConfigLookup self, LumieraConfigitem item);
92 
93 
102 LumieraConfigLookupentry
103 lumiera_config_lookup_insert_default (LumieraConfigLookup self, LumieraConfigitem item);
104 
105 
115 LumieraConfigitem
116 lumiera_config_lookup_remove (LumieraConfigLookup self, LumieraConfigitem item);
117 
125 LumieraConfigLookupentry
126 lumiera_config_lookup_find (LumieraConfigLookup self, const char* key);
127 
134 LumieraConfigitem
135 lumiera_config_lookup_item_find (LumieraConfigLookup self, const char* key);
136 
143 LumieraConfigitem
144 lumiera_config_lookup_item_tail_find (LumieraConfigLookup self, const char* key);
145 
146 
147 
148 /* == lookup hash entries using the PSplay tree */
149 
150 
153 {
154  psplaynode node;
155 
157  llist configitems;
158 
165  char* full_key;
166 };
167 
168 
169 /* internal */
170 LumieraConfigLookupentry
171 lumiera_config_lookupentry_init (LumieraConfigLookupentry self, const char* key);
172 
173 LumieraConfigLookupentry
174 lumiera_config_lookupentry_new (const char* key);
175 
176 /* internal */
177 LumieraConfigLookupentry
178 lumiera_config_lookupentry_destroy (LumieraConfigLookupentry self);
179 
180 
181 void
182 lumiera_config_lookupentry_delete (LumieraConfigLookupentry self);
183 
184 
185 #endif /*COMMON_CONFIG_LOOKUP_H*/
186 /*
187 // Local Variables:
188 // mode: C
189 // c-file-style: "gnu"
190 // indent-tabs-mode: nil
191 // End:
192 */
LumieraConfigLookup lumiera_config_lookup_init(LumieraConfigLookup self)
Initialise a lookup structure.
Definition: config-lookup.c:59
Draft for a configuration system (2008).
llist configitems
stack of all configitems stored under this key
LumieraConfigLookupentry lumiera_config_lookup_insert(LumieraConfigLookup self, LumieraConfigitem item)
Add a config item to a lookup structure.
Definition: config-lookup.c:78
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Definition: error.h:71
Lumiera error handling (C interface).
Just contains a hashtable to give sufficient abstraction.
Definition: config-lookup.h:62
LumieraConfigLookupentry lumiera_config_lookup_find(LumieraConfigLookup self, const char *key)
Find a hashtable entry in the lookup structure.
LumieraConfigitem lumiera_config_lookup_item_find(LumieraConfigLookup self, const char *key)
Find a the topmost config item stored to a given key.
Probabilistic splay tree.
LumieraConfigLookup lumiera_config_lookup_destroy(LumieraConfigLookup self)
Destroy a lookup structure.
Definition: config-lookup.c:68
LumieraConfigLookupentry lumiera_config_lookup_insert_default(LumieraConfigLookup self, LumieraConfigitem item)
LumieraConfigitem lumiera_config_lookup_item_tail_find(LumieraConfigLookup self, const char *key)
Find a the bottom most config item stored to a given key.
Intrusive cyclic double linked list There is only one node type which contains a forward and a backwa...
char * full_key
we store a copy of the full key here configentry keys are complete as expected section keys are the p...
LumieraConfigitem lumiera_config_lookup_remove(LumieraConfigLookup self, LumieraConfigitem item)
Remove a config item from a lookup structure.