2 typedef enum _snd_config_type {
3 SND_CONFIG_TYPE_INTEGER,
5 SND_CONFIG_TYPE_STRING,
6 SND_CONFIG_TYPE_COMPOUND,
9 typedef struct _snd_config snd_config_t;
13 snd_config_type_t type;
19 struct list_head fields;
23 struct list_head list;
27 static inline snd_config_type_t snd_config_type(snd_config_t *config)
32 static inline char *snd_config_id(snd_config_t *config)
37 int snd_config_top(snd_config_t **config);
39 int snd_config_load(snd_config_t *config, snd_input_t *in);
40 int snd_config_save(snd_config_t *config, snd_output_t *out);
42 int snd_config_search(snd_config_t *config, char *key, snd_config_t **result);
43 int snd_config_searchv(snd_config_t *config,
44 snd_config_t **result, ...);
46 int snd_config_add(snd_config_t *config, snd_config_t *leaf);
47 int snd_config_delete(snd_config_t *config);
49 int snd_config_make(snd_config_t **config, char *key,
50 snd_config_type_t type);
51 int snd_config_integer_make(snd_config_t **config, char *key);
52 int snd_config_real_make(snd_config_t **config, char *key);
53 int snd_config_string_make(snd_config_t **config, char *key);
54 int snd_config_compound_make(snd_config_t **config, char *key, int join);
56 int snd_config_integer_set(snd_config_t *config, long value);
57 int snd_config_real_set(snd_config_t *config, double value);
58 int snd_config_string_set(snd_config_t *config, char *value);
59 int snd_config_integer_get(snd_config_t *config, long *value);
60 int snd_config_real_get(snd_config_t *config, double *value);
61 int snd_config_string_get(snd_config_t *config, char **value);
63 /* One argument: long, double or char* */
64 int snd_config_set(snd_config_t *config, ...);
65 int snd_config_get(snd_config_t *config, void *);
67 typedef struct list_head *snd_config_iterator_t;
69 #define snd_config_foreach(iterator, node) \
70 assert((node)->type == SND_CONFIG_TYPE_COMPOUND); \
71 for (iterator = (node)->u.compound.fields.next; iterator != &(node)->u.compound.fields; iterator = iterator->next)
73 #define snd_config_entry(iterator) list_entry(iterator, snd_config_t, list)
75 snd_config_type_t snd_config_type(snd_config_t *config);
76 char *snd_config_id(snd_config_t *config);
78 extern snd_config_t *snd_config;
79 int snd_config_update();