![]() |
Lumiera 0.pre.04
»edit your freedom«
|
Implementation of a draft for application configuration from 2008. More...
Go to the source code of this file.
Implementation of a draft for application configuration from 2008.
Definition in file config.c.
#include "include/logging.h"#include "lib/safeclib.h"#include "lib/tmpbuf.h"#include "common/config.h"#include <stdint.h>#include <stdlib.h>#include <ctype.h>Functions | |
| LUMIERA_ERROR_DEFINE (CONFIG_SYNTAX, "syntax error in configfile") | |
| LUMIERA_ERROR_DEFINE (CONFIG_SYNTAX_KEY, "syntax error in key") | |
| LUMIERA_ERROR_DEFINE (CONFIG_SYNTAX_VALUE, "syntax error in value") | |
| LUMIERA_ERROR_DEFINE (CONFIG_NO_ENTRY, "no configuration entry") | |
| int | lumiera_config_init (const char *path) |
| Initialise the configuration subsystem. | |
| void | lumiera_config_destroy () |
| Destroys the configuration subsystem. | |
| int | lumiera_config_load (const char *file) |
| int | lumiera_config_save () |
| int | lumiera_config_purge (const char *filename) |
| const char * | lumiera_config_get (const char *key, const char **value) |
| const char * | lumiera_config_get_default (const char *key, const char **value) |
| LumieraConfigitem | lumiera_config_set (const char *key, const char *delim_value) |
| LumieraConfigitem | lumiera_config_setdefault (const char *line) |
| Installs a default value for a config key. | |
| void | lumiera_config_dump (FILE *out) |
| Does a diagnostic dump of the whole config database. | |
| int | lumiera_config_reset (const char *key) |
| int | lumiera_config_info (const char *key, const char **filename, unsigned *line) |
Variables | |
| const char * | lumiera_config_defaults [] |
| defaults for the configuration system itself | |
| LumieraConfig | lumiera_global_config = NULL |
| LUMIERA_ERROR_DEFINE | ( | CONFIG_SYNTAX | , |
| "syntax error in configfile" | |||
| ) |
| LUMIERA_ERROR_DEFINE | ( | CONFIG_SYNTAX_KEY | , |
| "syntax error in key" | |||
| ) |
| LUMIERA_ERROR_DEFINE | ( | CONFIG_SYNTAX_VALUE | , |
| "syntax error in value" | |||
| ) |
| LUMIERA_ERROR_DEFINE | ( | CONFIG_NO_ENTRY | , |
| "no configuration entry" | |||
| ) |
| int lumiera_config_init | ( | const char * | path | ) |
Initialise the configuration subsystem.
| path | search path for config files. Must be called only once |
Definition at line 77 of file config.c.
References lumiera_config_defaults, lumiera_config_lookup_init(), lumiera_config_setdefault(), lumiera_configitem_init(), lumiera_global_config, lumiera_malloc(), lumiera_mutex_init(), and lumiera_tmpbuf_snprintf().
Referenced by Config::Config().
Here is the call graph for this function:
Here is the caller graph for this function:| void lumiera_config_destroy | ( | ) |
Destroys the configuration subsystem.
Subsequent calls are no-ops.
Definition at line 105 of file config.c.
References lumiera_config_lookup_destroy(), lumiera_configitem_destroy(), lumiera_free(), lumiera_global_config, lumiera_mutex_destroy(), and NULL.
Referenced by Config::~Config(), TEST(), and TEST().
Here is the call graph for this function:
Here is the caller graph for this function:| const char * lumiera_config_get | ( | const char * | key, |
| const char ** | value | ||
| ) |
Definition at line 154 of file config.c.
References LUMIERA_CONFIG_ENV_CHARS, LUMIERA_CONFIG_KEY_CHARS, lumiera_config_lookup_item_find(), LUMIERA_ERROR_SET, LUMIERA_ERROR_SET_WARNING, lumiera_global_config, lumiera_tmpbuf_snprintf(), lumiera_tmpbuf_tr(), and NULL.
Referenced by lumiera_config_number_get(), lumiera_config_string_get(), lumiera_config_word_get(), lumiera_config_wordlist_add(), lumiera_config_wordlist_get(), lumiera_config_wordlist_replace(), TEST(), and TEST().
Here is the call graph for this function:
Here is the caller graph for this function:| const char * lumiera_config_get_default | ( | const char * | key, |
| const char ** | value | ||
| ) |
Definition at line 201 of file config.c.
References lumiera_config_lookup_item_tail_find(), lumiera_global_config, and NULL.
Here is the call graph for this function:| LumieraConfigitem lumiera_config_set | ( | const char * | key, |
| const char * | delim_value | ||
| ) |
| key | |
| delim_value | delimiter (= or <) followed by the value to be set |
Definition at line 223 of file config.c.
References llist_insert_tail, lumiera_config_lookup_insert(), lumiera_config_lookup_item_find(), lumiera_configitem_new(), lumiera_configitem_set_value(), lumiera_global_config, and lumiera_tmpbuf_snprintf().
Referenced by lumiera_config_number_set(), lumiera_config_string_set(), lumiera_config_word_set(), lumiera_config_wordlist_add(), lumiera_config_wordlist_replace(), lumiera_config_wordlist_set(), TEST(), and TEST().
Here is the call graph for this function:
Here is the caller graph for this function:| LumieraConfigitem lumiera_config_setdefault | ( | const char * | line | ) |
Installs a default value for a config key.
Any key might have an associated default value which is used when no other configuration is available, this can be set once. Any subsequent call will be a no-op. This function locks the config system.
| line | line with key, delimiter and value to store as default value |
Definition at line 265 of file config.c.
References llist_insert_head, LUMIERA_CONFIG_KEY_CHARS, lumiera_config_lookup_insert(), lumiera_config_lookup_item_find(), lumiera_configitem_new(), lumiera_global_config, LUMIERA_MUTEX_SECTION, lumiera_tmpbuf_strndup(), and NULL.
Referenced by lumiera_config_init(), LUMIERA_EXPORT(), lumiera_plugin_discover(), TEST(), TEST(), and TEST().
Here is the call graph for this function:
Here is the caller graph for this function:| void lumiera_config_dump | ( | FILE * | out | ) |
Does a diagnostic dump of the whole config database.
Definition at line 303 of file config.c.
References LLIST_FOREACH, and lumiera_global_config.
| int lumiera_config_info | ( | const char * | key, |
| const char ** | filename, | ||
| unsigned * | line | ||
| ) |
| const char* lumiera_config_defaults[] |
defaults for the configuration system itself
Definition at line 41 of file config.c.
Referenced by lumiera_config_init().
| LumieraConfig lumiera_global_config = NULL |
Definition at line 73 of file config.c.
Referenced by lumiera_config_destroy(), lumiera_config_dump(), lumiera_config_get(), lumiera_config_get_default(), lumiera_config_init(), lumiera_config_number_get(), lumiera_config_number_set(), lumiera_config_set(), lumiera_config_setdefault(), lumiera_config_string_get(), lumiera_config_string_set(), lumiera_config_word_get(), lumiera_config_word_set(), lumiera_config_wordlist_add(), lumiera_config_wordlist_get(), lumiera_config_wordlist_replace(), and lumiera_config_wordlist_set().