chiark / gitweb /
Import release 0.07
[secnet.git] / conffile_internal.h
1 /*
2  * $Log$
3  */
4
5 #ifndef conffile_internal_h
6 #define conffile_internal_h
7
8 #include <stdio.h>
9 #include "secnet.h"
10
11 extern FILE *yyin;
12
13 typedef string_t atom_t;
14
15 /* Parse tree for configuration file */
16
17 #define YYSTYPE struct p_node *
18
19 #define T_STRING 1
20 #define T_NUMBER 2
21 #define T_KEY    3
22 #define T_ASSIGNMENT 10
23 #define T_LISTITEM   11
24 #define T_EXEC       12
25 #define T_PATHELEM   13
26 #define T_ABSPATH    14
27 #define T_RELPATH    15
28 #define T_DICT       16
29 #define T_ALIST      17
30 #define T_ERROR      20
31
32 struct p_node {
33     uint32_t type;
34     struct cloc loc;
35     union {
36         atom_t key;
37         string_t string;
38         uint32_t number;
39     } data;
40     struct p_node *l;
41     struct p_node *r;
42 };
43
44 extern int yylex(void);
45 extern string_t config_file;
46 extern uint32_t config_lineno;
47
48 /* Keys in dictionaries are 'atoms', which are constructed from strings
49    using this call. Atoms may be compared using '=='. */
50 extern atom_t intern(string_t string);
51
52 extern struct p_node *parse_conffile(FILE *conffile);
53
54 #endif /* conffile_internal_h */