2 * Copyright (C) 2013 Andy Spencer <andy753421@gmail.com>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 typedef void (*parser_t)(const char *group, const char *name,
20 const char *key, const char *value);
23 #define get_map(value, map) \
24 get_enum(value, map, 1, N_ELEMENTS(map))
25 #define get_mapv(value, map) \
26 get_enum(value, *map, N_ELEMENTS(*map), N_ELEMENTS(map))
28 int get_enum(const char *value, const char **map, int s, int n);
29 int get_bool(const char *value);
30 int get_number(const char *value);
31 char *get_string(const char *value);
32 char *get_name(const char *name);
33 const char *get_const(const char *name);
36 void set_enum(const char *group, const char *name,
37 const char *key, int value,
38 const char **map, int n);
39 void set_bool(const char *group, const char *name,
40 const char *key, int value);
41 void set_number(const char *group, const char *name,
42 const char *key, int value);
43 void set_string(const char *group, const char *name,
44 const char *key, const char *value);
45 void set_name(const char *group, const char *name,
49 void conf_setup(const char *name, parser_t parser);