42 #ifndef COMMON_CONFIG_H 43 #define COMMON_CONFIG_H 59 #define LUMIERA_CONFIG_KEY_CHARS "abcdefghijklmnopqrstuvwxyz0123456789_." 60 #define LUMIERA_CONFIG_ENV_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789__" 66 lumiera_config_lookup keys;
68 lumiera_configitem defaults;
69 lumiera_configitem files;
70 lumiera_configitem TODO_unknown;
76 typedef lumiera_config* LumieraConfig;
82 #define LUMIERA_CONFIG_TYPES \ 83 LUMIERA_CONFIG_TYPE(link, const char*) \ 84 LUMIERA_CONFIG_TYPE(number, long long) \ 85 LUMIERA_CONFIG_TYPE(real, long double) \ 86 LUMIERA_CONFIG_TYPE(string, const char*) \ 87 LUMIERA_CONFIG_TYPE(wordlist, const char*) \ 88 LUMIERA_CONFIG_TYPE(word, const char*) \ 89 LUMIERA_CONFIG_TYPE(bool, int) 116 lumiera_config_load (
const char* file);
129 lumiera_config_save ();
137 lumiera_config_purge (
const char* filename);
156 lumiera_config_get (
const char* key,
const char** value);
160 lumiera_config_get_default (
const char* key,
const char** value);
205 #define LUMIERA_CONFIG_TYPE(name, type) \ 207 lumiera_config_##name##_get (const char* key, type* value); 209 #undef LUMIERA_CONFIG_TYPE 272 #define LUMIERA_CONFIG_TYPE(name, type) \ 274 lumiera_config_##name##_set (const char* key, type* value); 276 #undef LUMIERA_CONFIG_TYPE 286 lumiera_config_reset (
const char* key);
294 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.