Use chunks throughout the disk cache code.
[polipo.git] / config.h
blobca177a7825ab1ea262b420c408c4eb2cd7d6fd19
1 /*
2 Copyright (c) 2003-2006 by Juliusz Chroboczek
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
23 #define CONFIG_INT 0
24 #define CONFIG_OCTAL 1
25 #define CONFIG_HEX 2
26 #define CONFIG_TIME 3
27 #define CONFIG_BOOLEAN 4
28 #define CONFIG_TRISTATE 5
29 #define CONFIG_TETRASTATE 6
30 #define CONFIG_PENTASTATE 7
31 #define CONFIG_FLOAT 8
32 #define CONFIG_ATOM 9
33 #define CONFIG_ATOM_LOWER 10
34 #define CONFIG_PASSWORD 11
35 #define CONFIG_INT_LIST 12
36 #define CONFIG_ATOM_LIST 13
37 #define CONFIG_ATOM_LIST_LOWER 14
39 typedef struct _ConfigVariable {
40 AtomPtr name;
41 int type;
42 union {
43 int *i;
44 float *f;
45 struct _Atom **a;
46 struct _AtomList **al;
47 struct _IntList **il;
48 } value;
49 int (*setter)(struct _ConfigVariable*, void*);
50 char *help;
51 struct _ConfigVariable *next;
52 } ConfigVariableRec, *ConfigVariablePtr;
54 #define CONFIG_VARIABLE(name, type, help) \
55 CONFIG_VARIABLE_SETTABLE(name, type, NULL, help)
57 #define CONFIG_VARIABLE_SETTABLE(name, type, setter, help) \
58 declareConfigVariable(internAtom(#name), type, &name, setter, help)
60 void declareConfigVariable(AtomPtr name, int type, void *value,
61 int (*setter)(ConfigVariablePtr, void*),
62 char *help);
63 void printConfigVariables(FILE *out, int html);
64 int parseConfigLine(char *line, char *filename, int lineno, int set);
65 int parseConfigFile(AtomPtr);
66 int configIntSetter(ConfigVariablePtr, void*);
67 int configFloatSetter(ConfigVariablePtr, void*);
68 int configAtomSetter(ConfigVariablePtr, void*);