40 extern LumieraConfig lumiera_global_config;
46 lumiera_config_link_get (
const char* key,
const char** value)
48 (void) key; (void) value;
49 TRACE (configtyped_dbg);
55 lumiera_config_link_set (
const char* key,
const char** value)
57 (void) key; (void) value;
58 TRACE (configtyped_dbg);
71 TRACE (configtyped_dbg);
73 const char* raw_value = NULL;
77 if (lumiera_config_get (key, &raw_value))
82 if (sscanf (raw_value,
"%Li", value) != 1)
97 lumiera_config_number_set (
const char* key,
long long* value)
99 TRACE (configtyped_dbg);
101 LumieraConfigitem item = NULL;
105 const char* fmt =
"= %lld"; TODO (
"use the config system (config.format*...) to deduce the desired format for this key");
120 (void) key; (void) value;
121 TRACE (configtyped_dbg);
127 lumiera_config_real_set (
const char* key,
long double* value)
129 (void) key; (void) value;
130 TRACE (configtyped_dbg);
152 in += strspn(in,
" \t");
158 if (quote ==
'"' || quote ==
'\'')
162 end = strchr (in, quote);
163 while (end && end[1] == quote)
164 end = strchr (end + 2, quote);
173 for (wpos = rpos = ret; *rpos; ++rpos, ++wpos)
191 end = ret + strlen (ret) - 1;
192 while (end > ret && (*end ==
' ' || *end ==
'\t'))
200 lumiera_config_string_get (
const char* key,
const char** value)
202 TRACE (configtyped_dbg);
204 const char* raw_value = *value = NULL;
208 if (lumiera_config_get (key, &raw_value))
223 lumiera_config_string_set (
const char* key,
const char** value)
225 TRACE (configtyped_dbg);
227 LumieraConfigitem item = NULL;
231 const char* fmt =
"= %s"; TODO (
"use the config system (config.format*...) to deduce the desired format for this key");
247 TRACE (configtyped_dbg,
"KEY %s", key);
249 const char* raw_value = *value = NULL;
253 if (lumiera_config_get (key, &raw_value))
271 lumiera_config_wordlist_set (
const char* key,
const char** value)
273 TRACE (configtyped_dbg);
275 LumieraConfigitem item = NULL;
279 const char* fmt =
"= %s"; TODO (
"use the config system (config.format*...) to deduce the desired format for this key");
296 in += strspn(in,
" \t");
302 while (*end && *end !=
' ' && *end !=
'\t')
311 lumiera_config_word_get (
const char* key,
const char** value)
313 TRACE (configtyped_dbg,
"KEY %s", key);
315 const char* raw_value = *value = NULL;
319 if (lumiera_config_get (key, &raw_value))
334 lumiera_config_word_set (
const char* key,
const char** value)
336 TRACE (configtyped_dbg);
338 LumieraConfigitem item = NULL;
342 const char* fmt =
"= %s";
357 (void) key; (void) value;
358 TRACE (configtyped_dbg);
359 UNIMPLEMENTED(
"get bool from config system");
365 lumiera_config_bool_set (
const char* key,
int* value)
367 (void) key; (void) value;
368 TRACE (configtyped_dbg);
369 UNIMPLEMENTED(
"set bool in config system");
#define LUMIERA_ERROR_SET(flag, err, extra)
Helper macro to raise an error for the current thread.
#define LUMIERA_ERROR_SET_WARNING(flag, err, extra)
Helper macro to raise an error for the current thread.
char * lumiera_tmpbuf_strndup(const char *src, size_t size)
Duplicate string to a tmpbuf.
Interface for a lumiera configuration system (draft).
#define LUMIERA_MUTEX_SECTION(nobugflag, mtx)
Mutual exclusive section.
This header is for including and configuring NoBug.
const char * lumiera_config_real_get(const char *key, long double *value)
Real floating point number in standard formats (see printf/scanf)
Round robin temporary buffers.
static char * scan_string(const char *in)
String unquoted string which covers the whole value area and gets chopped or quoted string which pres...
const char * lumiera_config_bool_get(const char *key, int *value)
Bool Bool in various formats, (0,1(!1), yes/no, true/false, on/off, set/clear)
static char * scan_word(const char *in)
helper function, takes a raw input string and give a tmpbuf with the word parsed back.
const char * lumiera_config_wordlist_get(const char *key, const char **value)
Wordlist words delimited by any of " \t,;".
const char * lumiera_config_number_get(const char *key, long long *value)
Number signed integer numbers, in different formats (decimal, hex, oct, binary(for masks)) ...
LumieraConfigitem lumiera_config_set(const char *key, const char *delim_value)
char * lumiera_tmpbuf_snprintf(size_t size, const char *fmt,...)
Construct a string in a tmpbuf.