File: conffile_internal.h

package info (click to toggle)
secnet 0.6.8
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,956 kB
  • sloc: ansic: 15,234; python: 1,057; perl: 966; sh: 596; tcl: 484; java: 231; asm: 114; yacc: 89; php: 64; makefile: 48; awk: 40
file content (69 lines) | stat: -rw-r--r-- 1,782 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * This file is part of secnet.
 * See README for full list of copyright holders.
 *
 * secnet is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 * 
 * secnet is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * version 3 along with secnet; if not, see
 * https://www.gnu.org/licenses/gpl.html.
 */

#ifndef conffile_internal_h
#define conffile_internal_h

#include <stdio.h>
#include "secnet.h"

typedef cstring_t atom_t;

/* Parse tree for configuration file */

#define YYSTYPE struct p_node *

#define T_STRING 1
#define T_NUMBER 2
#define T_KEY    3
#define T_ASSIGNMENT 10
#define T_LISTITEM   11
#define T_EXEC       12
#define T_PATHELEM   13
#define T_ABSPATH    14
#define T_RELPATH    15
#define T_DICT       16
#define T_ALIST      17
#define T_ERROR      20

#define T_IS_PRIMITIVE(NTYPE) ((NTYPE) < T_ASSIGNMENT)

struct p_node {
    uint32_t type;
    struct cloc loc;
    union {
	atom_t key;
	string_t string;
	uint32_t number;
    } data;
    struct p_node *l;
    struct p_node *r;
};

extern cstring_t config_file;
extern int config_lineno;
extern int yynerrs;

/* Keys in dictionaries are 'atoms', which are constructed from strings
   using this call. Atoms may be compared using '=='. */
extern atom_t intern(cstring_t string);

extern struct p_node *parse_conffile(FILE *conffile);

#endif /* conffile_internal_h */