diff options
Diffstat (limited to 'include/grecs/table.h')
-rw-r--r-- | include/grecs/table.h | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/include/grecs/table.h b/include/grecs/table.h deleted file mode 100644 index d7d0a8c..0000000 --- a/include/grecs/table.h +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | /* grecs - Gray's Extensible Configuration System -*- c -*- | ||
2 | Copyright (C) 2007-2016 Sergey Poznyakoff | ||
3 | |||
4 | Grecs is free software; you can redistribute it and/or modify it | ||
5 | under the terms of the GNU General Public License as published by the | ||
6 | Free Software Foundation; either version 3 of the License, or (at your | ||
7 | option) any later version. | ||
8 | |||
9 | Grecs is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with Grecs. If not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #ifndef _GRECS_TABLE_H | ||
18 | #define _GRECS_TABLE_H | ||
19 | |||
20 | #include <grecs/node.h> | ||
21 | |||
22 | enum grecs_data_type { | ||
23 | grecs_type_void, | ||
24 | grecs_type_string, | ||
25 | grecs_type_short, | ||
26 | grecs_type_ushort, | ||
27 | grecs_type_int, | ||
28 | grecs_type_uint, | ||
29 | grecs_type_long, | ||
30 | grecs_type_ulong, | ||
31 | grecs_type_size, | ||
32 | /* grecs_type_off,*/ | ||
33 | grecs_type_time, | ||
34 | grecs_type_bool, | ||
35 | grecs_type_ipv4, | ||
36 | grecs_type_cidr, | ||
37 | grecs_type_host, | ||
38 | grecs_type_sockaddr, | ||
39 | grecs_type_section, | ||
40 | grecs_type_null | ||
41 | }; | ||
42 | |||
43 | #define GRECS_DFLT 0x00 /* Default keyword flags */ | ||
44 | #define GRECS_AGGR 0x01 /* Multiple entries aggregate */ | ||
45 | #define GRECS_MULT 0x02 /* Statement can appear multiple times */ | ||
46 | #define GRECS_INAC 0x04 /* Inactive keyword */ | ||
47 | #define GRECS_LIST 0x08 /* Value is a list of declared type */ | ||
48 | #define GRECS_HIDDEN 0x10 /* Hidden keyword: don't display in help output */ | ||
49 | #define GRECS_CONST 0x20 /* For string types: initial value is constant, | ||
50 | don't try to free it before assigning new value. | ||
51 | This flag is cleared after the first assignment. | ||
52 | */ | ||
53 | |||
54 | enum grecs_callback_command { | ||
55 | grecs_callback_section_begin, | ||
56 | grecs_callback_section_end, | ||
57 | grecs_callback_set_value | ||
58 | }; | ||
59 | |||
60 | typedef int (*grecs_callback_fn)( | ||
61 | #if GRECS_TREE_API | ||
62 | enum grecs_callback_command cmd, | ||
63 | grecs_node_t * /* node */, | ||
64 | void * /* varptr */, | ||
65 | void * /* cb_data */ | ||
66 | #else | ||
67 | enum grecs_callback_command cmd, | ||
68 | grecs_locus_t * /* locus */, | ||
69 | void * /* varptr */, | ||
70 | grecs_value_t * /* value */, | ||
71 | void * /* cb_data */ | ||
72 | #endif | ||
73 | ); | ||
74 | |||
75 | struct grecs_keyword { | ||
76 | const char *ident; | ||
77 | const char *argname; | ||
78 | const char *docstring; | ||
79 | enum grecs_data_type type; | ||
80 | int flags; | ||
81 | void *varptr; | ||
82 | size_t offset; | ||
83 | grecs_callback_fn callback; | ||
84 | void *callback_data; | ||
85 | struct grecs_keyword *kwd; | ||
86 | }; | ||
87 | |||
88 | extern int grecs_string_convert(void *target, enum grecs_data_type type, | ||
89 | const char *string, | ||
90 | grecs_locus_t const *locus); | ||
91 | extern void grecs_process_ident(struct grecs_keyword *kwp, | ||
92 | grecs_value_t *value, | ||
93 | void *base, | ||
94 | grecs_locus_t *locus); | ||
95 | |||
96 | const char *grecs_data_type_string(enum grecs_data_type type); | ||
97 | |||
98 | int grecs_tree_process(struct grecs_node *node, struct grecs_keyword *kwd); | ||
99 | int grecs_tree_reduce(struct grecs_node *node, struct grecs_keyword *kwd, | ||
100 | int flags); | ||
101 | |||
102 | #endif | ||