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