33 #ifndef COMMON_CONFIG_H 34 #define COMMON_CONFIG_H 50 #define LUMIERA_CONFIG_KEY_CHARS "abcdefghijklmnopqrstuvwxyz0123456789_." 51 #define LUMIERA_CONFIG_ENV_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789__" 57 lumiera_config_lookup keys;
59 lumiera_configitem defaults;
60 lumiera_configitem files;
61 lumiera_configitem TODO_unknown;
67 typedef lumiera_config* LumieraConfig;
73 #define LUMIERA_CONFIG_TYPES \ 74 LUMIERA_CONFIG_TYPE(link, const char*) \ 75 LUMIERA_CONFIG_TYPE(number, long long) \ 76 LUMIERA_CONFIG_TYPE(real, long double) \ 77 LUMIERA_CONFIG_TYPE(string, const char*) \ 78 LUMIERA_CONFIG_TYPE(wordlist, const char*) \ 79 LUMIERA_CONFIG_TYPE(word, const char*) \ 80 LUMIERA_CONFIG_TYPE(bool, int) 107 lumiera_config_load (
const char* file);
120 lumiera_config_save ();
128 lumiera_config_purge (
const char* filename);
147 lumiera_config_get (
const char* key,
const char** value);
151 lumiera_config_get_default (
const char* key,
const char** value);
196 #define LUMIERA_CONFIG_TYPE(name, type) \ 198 lumiera_config_##name##_get (const char* key, type* value); 200 #undef LUMIERA_CONFIG_TYPE 263 #define LUMIERA_CONFIG_TYPE(name, type) \ 265 lumiera_config_##name##_set (const char* key, type* value); 267 #undef LUMIERA_CONFIG_TYPE 277 lumiera_config_reset (
const char* key);
285 lumiera_config_info (
const char* key,
const char** filename,
unsigned* line);
LUMIERA_CONFIG_TYPES const char * lumiera_config_wordlist_get_nth(const char *key, unsigned nth, const char *delims)
Wordlists Wordlists are lists of single words delimited by any of " \t,;".
Draft for a configuration system (2008).
const char * lumiera_config_wordlist_replace(const char *key, const char *value, const char *subst1, const char *subst2, const char *delims)
Universal word replacement function.
void lumiera_config_destroy()
Destroys the configuration subsystem.
int lumiera_config_wordlist_find(const char *key, const char *value, const char *delims)
Find the index of a word in a wordlist.
#define LUMIERA_CONFIG_TYPES
Supported high level types: TODO documenting.
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Lumiera error handling (C interface).
int lumiera_config_init(const char *path)
Initialise the configuration subsystem.
Lookup of configuration keys in a low-level configuration system.
LumieraConfigitem lumiera_config_set(const char *key, const char *delim_value)
Mutual exclusion locking, header.
void lumiera_config_dump(FILE *out)
Does a diagnostic dump of the whole config database.
const char * lumiera_config_wordlist_add(const char *key, const char *value, const char *delims)
Add a word to the end of a wordlist if it doesn't exist already.
LumieraConfigitem lumiera_config_setdefault(const char *line)
Installs a default value for a config key.