31 extern LumieraConfig lumiera_global_config;
37 lumiera_config_link_get (
const char* key,
const char** value)
39 (void) key; (void) value;
40 TRACE (configtyped_dbg);
46 lumiera_config_link_set (
const char* key,
const char** value)
48 (void) key; (void) value;
49 TRACE (configtyped_dbg);
62 TRACE (configtyped_dbg);
64 const char* raw_value = NULL;
68 if (lumiera_config_get (key, &raw_value))
73 if (sscanf (raw_value,
"%Li", value) != 1)
88 lumiera_config_number_set (
const char* key,
long long* value)
90 TRACE (configtyped_dbg);
92 LumieraConfigitem item = NULL;
96 const char* fmt =
"= %lld"; TODO (
"use the config system (config.format*...) to deduce the desired format for this key");
111 (void) key; (void) value;
112 TRACE (configtyped_dbg);
118 lumiera_config_real_set (
const char* key,
long double* value)
120 (void) key; (void) value;
121 TRACE (configtyped_dbg);
143 in += strspn(in,
" \t");
149 if (quote ==
'"' || quote ==
'\'')
153 end = strchr (in, quote);
154 while (end && end[1] == quote)
155 end = strchr (end + 2, quote);
164 for (wpos = rpos = ret; *rpos; ++rpos, ++wpos)
182 end = ret + strlen (ret) - 1;
183 while (end > ret && (*end ==
' ' || *end ==
'\t'))
191 lumiera_config_string_get (
const char* key,
const char** value)
193 TRACE (configtyped_dbg);
195 const char* raw_value = *value = NULL;
199 if (lumiera_config_get (key, &raw_value))
214 lumiera_config_string_set (
const char* key,
const char** value)
216 TRACE (configtyped_dbg);
218 LumieraConfigitem item = NULL;
222 const char* fmt =
"= %s"; TODO (
"use the config system (config.format*...) to deduce the desired format for this key");
238 TRACE (configtyped_dbg,
"KEY %s", key);
240 const char* raw_value = *value = NULL;
244 if (lumiera_config_get (key, &raw_value))
262 lumiera_config_wordlist_set (
const char* key,
const char** value)
264 TRACE (configtyped_dbg);
266 LumieraConfigitem item = NULL;
270 const char* fmt =
"= %s"; TODO (
"use the config system (config.format*...) to deduce the desired format for this key");
287 in += strspn(in,
" \t");
293 while (*end && *end !=
' ' && *end !=
'\t')
302 lumiera_config_word_get (
const char* key,
const char** value)
304 TRACE (configtyped_dbg,
"KEY %s", key);
306 const char* raw_value = *value = NULL;
310 if (lumiera_config_get (key, &raw_value))
325 lumiera_config_word_set (
const char* key,
const char** value)
327 TRACE (configtyped_dbg);
329 LumieraConfigitem item = NULL;
333 const char* fmt =
"= %s";
348 (void) key; (void) value;
349 TRACE (configtyped_dbg);
350 UNIMPLEMENTED(
"get bool from config system");
356 lumiera_config_bool_set (
const char* key,
int* value)
358 (void) key; (void) value;
359 TRACE (configtyped_dbg);
360 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.