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)
5  2008, Christian Thaeter <ct@pipapo.org>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
28 #ifndef COMMON_CONFIG_LOOKUP_H
29 #define COMMON_CONFIG_LOOKUP_H
30 
31 #include "lib/psplay.h"
32 #include "lib/llist.h"
33 #include "lib/error.h"
34 
35 typedef struct lumiera_config_lookup_struct lumiera_config_lookup;
36 typedef lumiera_config_lookup* LumieraConfigLookup;
37 
38 typedef struct lumiera_config_lookupentry_struct lumiera_config_lookupentry;
39 typedef lumiera_config_lookupentry* LumieraConfigLookupentry;
40 
41 
42 #include "common/configitem.h"
43 
44 #include <nobug.h>
45 
46 
47 LUMIERA_ERROR_DECLARE (CONFIG_LOOKUP);
48 
49 
54 {
55  psplay tree;
56 };
57 
63 LumieraConfigLookup
64 lumiera_config_lookup_init (LumieraConfigLookup self);
65 
71 LumieraConfigLookup
72 lumiera_config_lookup_destroy (LumieraConfigLookup self);
73 
81 LumieraConfigLookupentry
82 lumiera_config_lookup_insert (LumieraConfigLookup self, LumieraConfigitem item);
83 
84 
93 LumieraConfigLookupentry
94 lumiera_config_lookup_insert_default (LumieraConfigLookup self, LumieraConfigitem item);
95 
96 
106 LumieraConfigitem
107 lumiera_config_lookup_remove (LumieraConfigLookup self, LumieraConfigitem item);
108 
116 LumieraConfigLookupentry
117 lumiera_config_lookup_find (LumieraConfigLookup self, const char* key);
118 
125 LumieraConfigitem
126 lumiera_config_lookup_item_find (LumieraConfigLookup self, const char* key);
127 
134 LumieraConfigitem
135 lumiera_config_lookup_item_tail_find (LumieraConfigLookup self, const char* key);
136 
137 
138 
139 /* == lookup hash entries using the PSplay tree */
140 
141 
144 {
145  psplaynode node;
146 
148  llist configitems;
149 
156  char* full_key;
157 };
158 
159 
160 /* internal */
161 LumieraConfigLookupentry
162 lumiera_config_lookupentry_init (LumieraConfigLookupentry self, const char* key);
163 
164 LumieraConfigLookupentry
165 lumiera_config_lookupentry_new (const char* key);
166 
167 /* internal */
168 LumieraConfigLookupentry
169 lumiera_config_lookupentry_destroy (LumieraConfigLookupentry self);
170 
171 
172 void
173 lumiera_config_lookupentry_delete (LumieraConfigLookupentry self);
174 
175 
176 #endif /*COMMON_CONFIG_LOOKUP_H*/
177 /*
178 // Local Variables:
179 // mode: C
180 // c-file-style: "gnu"
181 // indent-tabs-mode: nil
182 // End:
183 */
LumieraConfigLookup lumiera_config_lookup_init(LumieraConfigLookup self)
Initialise a lookup structure.
Definition: config-lookup.c:50
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:69
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Definition: error.h:62
Lumiera error handling (C interface).
Just contains a hashtable to give sufficient abstraction.
Definition: config-lookup.h:53
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:59
LumieraConfigLookupentry lumiera_config_lookup_insert_default(LumieraConfigLookup self, LumieraConfigitem item)
Definition: config-lookup.c:91
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.