Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
config-interface.c
Go to the documentation of this file.
1/*
2 Config-interface - Lumiera configuration interface implementation
3
4 Copyright (C)
5 2008, Christian Thaeter <ct@pipapo.org>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
14
24#include "common/config.h"
25
26
27
29 LUMIERA_INTERFACE_DEFINE (lumieraorg_configuration, 0,
30 lumieraorg_configuration,
31 NULL,
32 NULL,
33 NULL,
34 LUMIERA_INTERFACE_MAP (load,
36 LUMIERA_INTERFACE_MAP (save,
38 LUMIERA_INTERFACE_MAP (purge,
40 LUMIERA_INTERFACE_MAP (dump,
42 LUMIERA_INTERFACE_INLINE (setdefault,
43 int, (const char* line),
44 {return !!lumiera_config_setdefault (line);}
45 ),
46 LUMIERA_INTERFACE_MAP (reset,
48 LUMIERA_INTERFACE_MAP (info,
50
51 LUMIERA_INTERFACE_MAP (wordlist_get_nth,
53 LUMIERA_INTERFACE_MAP (wordlist_find,
55 LUMIERA_INTERFACE_INLINE (wordlist_replace,
56 int, (const char* key,
57 const char* value,
58 const char* subst1,
59 const char* subst2,
60 const char* delims),
61 {return !!lumiera_config_wordlist_replace (key, value, subst1, subst2, delims);}
62 ),
63 LUMIERA_INTERFACE_INLINE (wordlist_add,
64 int, (const char* key, const char* value, const char* delims),
65 {return !!lumiera_config_wordlist_add (key, value, delims);}
66 ),
67
68 LUMIERA_INTERFACE_INLINE (link_get,
69 int, (const char* key, const char** value),
70 {return !!lumiera_config_link_get (key, value);}
71 ),
72 LUMIERA_INTERFACE_INLINE (link_set,
73 int, (const char* key, const char** value),
74 {return !!lumiera_config_link_set (key, value);}
75 ),
76
77 LUMIERA_INTERFACE_INLINE (number_get,
78 int, (const char* key, long long* value),
79 {return !!lumiera_config_number_get (key, value);}
80 ),
81 LUMIERA_INTERFACE_INLINE (number_set,
82 int, (const char* key, long long* value),
83 {return !!lumiera_config_number_set (key, value);}
84 ),
85
86 LUMIERA_INTERFACE_INLINE (real_get,
87 int, (const char* key, long double* value),
88 {return !!lumiera_config_real_get (key, value);}
89 ),
90 LUMIERA_INTERFACE_INLINE (real_set,
91 int, (const char* key, long double* value),
92 {return !!lumiera_config_real_set (key, value);}
93 ),
94
95 LUMIERA_INTERFACE_INLINE (string_get,
96 int, (const char* key, const char** value),
97 {return !!lumiera_config_string_get (key, value);}
98 ),
99 LUMIERA_INTERFACE_INLINE (string_set,
100 int, (const char* key, const char** value),
101 {return !!lumiera_config_string_set (key, value);}
102 ),
103
104 LUMIERA_INTERFACE_INLINE (wordlist_get,
105 int, (const char* key, const char** value),
106 {return !!lumiera_config_wordlist_get (key, value);}
107 ),
108 LUMIERA_INTERFACE_INLINE (wordlist_set,
109 int, (const char* key, const char** value),
110 {return !!lumiera_config_wordlist_set (key, value);}
111 ),
112
113 LUMIERA_INTERFACE_INLINE (word_get,
114 int, (const char* key, const char** value),
115 {return !!lumiera_config_word_get (key, value);}
116 ),
117 LUMIERA_INTERFACE_INLINE (word_set,
118 int, (const char* key, const char** value),
119 {return !!lumiera_config_word_set (key, value);}
120 ),
121
122 LUMIERA_INTERFACE_INLINE (bool_get,
123 int, (const char* key, int* value),
124 {return !!lumiera_config_bool_get (key, value);}
125 ),
126 LUMIERA_INTERFACE_INLINE (bool_set,
127 int, (const char* key, int* value),
128 {return !!lumiera_config_bool_set (key, value);}
129 ),
130 )
131 );
132
133
134#ifndef LUMIERA_PLUGIN
135
137void
142
143void
148
149#endif
150
void lumiera_config_interface_destroy(void)
void lumiera_config_interface_init(void)
External interface to the lumiera configuration system.
LumieraConfigitem lumiera_config_wordlist_set(const char *key, const char **value)
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))
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)
const char * lumiera_config_string_get(const char *key, const char **value)
LumieraConfigitem lumiera_config_real_set(const char *key, long double *value)
const char * lumiera_config_wordlist_get(const char *key, const char **value)
Wordlist words delimited by any of " \t,;".
LumieraConfigitem lumiera_config_word_set(const char *key, const char **value)
LumieraConfigitem lumiera_config_link_set(const char *key, const char **value)
LumieraConfigitem lumiera_config_string_set(const char *key, const char **value)
LumieraConfigitem lumiera_config_number_set(const char *key, long long *value)
const char * lumiera_config_link_get(const char *key, const char **value)
LumieraConfigitem lumiera_config_bool_set(const char *key, int *value)
const char * lumiera_config_real_get(const char *key, long double *value)
Real floating point number in standard formats (see printf/scanf)
const char * lumiera_config_word_get(const char *key, const char **value)
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.
int lumiera_config_wordlist_find(const char *key, const char *value, const char *delims)
Find the index of a word in a wordlist.
const char * lumiera_config_wordlist_get_nth(const char *key, unsigned nth, const char *delims)
return nth word of a wordlist
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.
int lumiera_config_purge(const char *filename)
Definition config.c:143
void lumiera_config_dump(FILE *out)
Does a diagnostic dump of the whole config database.
Definition config.c:303
int lumiera_config_info(const char *key, const char **filename, unsigned *line)
Definition config.c:332
int lumiera_config_load(const char *file)
Definition config.c:124
int lumiera_config_save()
Definition config.c:134
LumieraConfigitem lumiera_config_setdefault(const char *line)
Installs a default value for a config key.
Definition config.c:265
int lumiera_config_reset(const char *key)
Definition config.c:322
Interface for a lumiera configuration system (draft).
#define LUMIERA_INTERFACE_UNREGISTEREXPORTED
Unregister all exported interfaces when not a plugin This is a no-op when LUMIERA_PLUGIN is defined,...
Definition interface.h:330
#define LUMIERA_EXPORT(...)
Generate interface container suitable for enumerating interfaces.
Definition interface.h:273
#define LUMIERA_INTERFACE_REGISTEREXPORTED
Register all exported interfaces when not a plugin This is a no-op when LUMIERA_PLUGIN is defined,...
Definition interface.h:324
Global registry for interfaces (extension points).
return NULL
Definition llist.h:586