aboutsummaryrefslogtreecommitdiff
path: root/include/grecs/table.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/grecs/table.h')
-rw-r--r--include/grecs/table.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/include/grecs/table.h b/include/grecs/table.h
new file mode 100644
index 0000000..4210c6f
--- /dev/null
+++ b/include/grecs/table.h
@@ -0,0 +1,98 @@
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
22enum 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
44#define GRECS_AGGR 0x01
45#define GRECS_MULT 0x02
46#define GRECS_INAC 0x04
47#define GRECS_LIST 0x08
48#define GRECS_HIDDEN 0x10
49
50enum grecs_callback_command {
51 grecs_callback_section_begin,
52 grecs_callback_section_end,
53 grecs_callback_set_value
54};
55
56typedef int (*grecs_callback_fn)(
57#if GRECS_TREE_API
58 enum grecs_callback_command cmd,
59 grecs_node_t * /* node */,
60 void * /* varptr */,
61 void * /* cb_data */
62#else
63 enum grecs_callback_command cmd,
64 grecs_locus_t * /* locus */,
65 void * /* varptr */,
66 grecs_value_t * /* value */,
67 void * /* cb_data */
68#endif
69 );
70
71struct grecs_keyword {
72 const char *ident;
73 const char *argname;
74 const char *docstring;
75 enum grecs_data_type type;
76 int flags;
77 void *varptr;
78 size_t offset;
79 grecs_callback_fn callback;
80 void *callback_data;
81 struct grecs_keyword *kwd;
82};
83
84extern int grecs_string_convert(void *target, enum grecs_data_type type,
85 const char *string,
86 grecs_locus_t const *locus);
87extern void grecs_process_ident(struct grecs_keyword *kwp,
88 grecs_value_t *value,
89 void *base,
90 grecs_locus_t *locus);
91
92const char *grecs_data_type_string(enum grecs_data_type type);
93
94int grecs_tree_process(struct grecs_node *node, struct grecs_keyword *kwd);
95int grecs_tree_reduce(struct grecs_node *node, struct grecs_keyword *kwd,
96 int flags);
97
98#endif

Return to:

Send suggestions and report system problems to the System administrator.