Implement chunk allocator on Windows.
[polipo.git] / config.h
blob8715c8dcd447a1de31532bbf3b4f8bf20ad1b557
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_INT_LIST 11
35 #define CONFIG_ATOM_LIST 12
36 #define CONFIG_ATOM_LIST_LOWER 13
38 typedef struct _ConfigVariable {
39 AtomPtr name;
40 int type;
41 union {
42 int *i;
43 float *f;
44 struct _Atom **a;
45 struct _AtomList **al;
46 struct _IntList **il;
47 } value;
48 int (*setter)(struct _ConfigVariable*, void*);
49 char *help;
50 struct _ConfigVariable *next;
51 } ConfigVariableRec, *ConfigVariablePtr;
53 #define CONFIG_VARIABLE(name, type, help) \
54 CONFIG_VARIABLE_SETTABLE(name, type, NULL, help)
56 #define CONFIG_VARIABLE_SETTABLE(name, type, setter, help) \
57 declareConfigVariable(internAtom(#name), type, &name, setter, help)
59 void declareConfigVariable(AtomPtr name, int type, void *value,
60 int (*setter)(ConfigVariablePtr, void*),
61 char *help);
62 void printConfigVariables(FILE *out, int html);
63 int parseConfigLine(char *line, char *filename, int lineno, int set);
64 int parseConfigFile(AtomPtr);
65 int configIntSetter(ConfigVariablePtr, void*);
66 int configFloatSetter(ConfigVariablePtr, void*);
67 int configAtomSetter(ConfigVariablePtr, void*);