]> code.delx.au - pulseaudio/blob - src/pulsecore/conf-parser.h
really create glitch-free branch
[pulseaudio] / src / pulsecore / conf-parser.h
1 #ifndef fooconfparserhfoo
2 #define fooconfparserhfoo
3
4 /* $Id$ */
5
6 /***
7 This file is part of PulseAudio.
8
9 Copyright 2004-2006 Lennart Poettering
10
11 PulseAudio is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published
13 by the Free Software Foundation; either version 2 of the License,
14 or (at your option) any later version.
15
16 PulseAudio is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with PulseAudio; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 USA.
25 ***/
26
27 #include <stdio.h>
28
29 /* An abstract parser for simple, line based, shallow configuration
30 * files consisting of variable assignments only. */
31
32 /* Wraps info for parsing a specific configuration variable */
33 typedef struct pa_config_item {
34 const char *lvalue; /* name of the variable */
35 int (*parse)(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata); /* Function that is called to parse the variable's value */
36 void *data; /* Where to store the variable's data */
37 } pa_config_item;
38
39 /* The configuration file parsing routine. Expects a table of
40 * pa_config_items in *t that is terminated by an item where lvalue is
41 * NULL */
42 int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, void *userdata);
43
44 /* Generic parsers for integers, booleans and strings */
45 int pa_config_parse_int(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata);
46 int pa_config_parse_bool(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata);
47 int pa_config_parse_string(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata);
48
49 #endif