Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
74 
82 
92 
93 
104 
105 
117 
126 lumiera_config_lookup_find (LumieraConfigLookup self, const char* key);
127 
136 
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 */
172 
174 lumiera_config_lookupentry_new (const char* key);
175 
176 /* internal */
179 
180 
181 void
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
lumiera_configitem * LumieraConfigitem
Definition: configitem.h:62
void lumiera_config_lookupentry_delete(LumieraConfigLookupentry self)
Lumiera error handling (C interface).
lumiera_config_lookup * LumieraConfigLookup
Definition: config-lookup.h:45
LUMIERA_ERROR_DECLARE(CONFIG_LOOKUP)
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.
LumieraConfigLookupentry lumiera_config_lookupentry_new(const char *key)
Probabilistic splay tree.
lumiera_config_lookupentry * LumieraConfigLookupentry
Definition: config-lookup.h:48
LumieraConfigLookup lumiera_config_lookup_destroy(LumieraConfigLookup self)
Destroy a lookup structure.
Definition: config-lookup.c:68
LumieraConfigLookupentry lumiera_config_lookupentry_destroy(LumieraConfigLookupentry self)
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...
LumieraConfigLookupentry lumiera_config_lookupentry_init(LumieraConfigLookupentry self, const char *key)
LumieraConfigitem lumiera_config_lookup_remove(LumieraConfigLookup self, LumieraConfigitem item)
Remove a config item from a lookup structure.