chiark / gitweb /
Makefile.in: Putative dual (backport and not) release build process doc.
[secnet.git] / conffile_internal.h
1 /*
2  * This file is part of secnet.
3  * See README for full list of copyright holders.
4  *
5  * secnet is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version d of the License, or
8  * (at your option) any later version.
9  * 
10  * secnet is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * version 3 along with secnet; if not, see
17  * https://www.gnu.org/licenses/gpl.html.
18  */
19
20 #ifndef conffile_internal_h
21 #define conffile_internal_h
22
23 #include <stdio.h>
24 #include "secnet.h"
25
26 typedef cstring_t atom_t;
27
28 /* Parse tree for configuration file */
29
30 #define YYSTYPE struct p_node *
31
32 #define T_STRING 1
33 #define T_NUMBER 2
34 #define T_KEY    3
35 #define T_ASSIGNMENT 10
36 #define T_LISTITEM   11
37 #define T_EXEC       12
38 #define T_PATHELEM   13
39 #define T_ABSPATH    14
40 #define T_RELPATH    15
41 #define T_DICT       16
42 #define T_ALIST      17
43 #define T_ERROR      20
44
45 #define T_IS_PRIMITIVE(NTYPE) ((NTYPE) < T_ASSIGNMENT)
46
47 struct p_node {
48     uint32_t type;
49     struct cloc loc;
50     union {
51         atom_t key;
52         string_t string;
53         uint32_t number;
54     } data;
55     struct p_node *l;
56     struct p_node *r;
57 };
58
59 extern cstring_t config_file;
60 extern int config_lineno;
61 extern int yynerrs;
62
63 /* Keys in dictionaries are 'atoms', which are constructed from strings
64    using this call. Atoms may be compared using '=='. */
65 extern atom_t intern(cstring_t string);
66
67 extern struct p_node *parse_conffile(FILE *conffile);
68
69 #endif /* conffile_internal_h */