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
70
71
|
/* argot - Gray's Extensible Configuration System -*- c -*-
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs 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.
Grecs 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 along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _ARGOT_TREE_H
#define _ARGOT_TREE_H
#include <argot/node.h>
int argot_tree_free(struct argot_node *node);
void argot_tree_sort(struct argot_node *node,
int (*compare)(struct argot_node const *,
struct argot_node const *));
struct argot_node *argot_tree_first_node(struct argot_node *tree);
struct argot_node *argot_next_node(struct argot_node *node);
struct argot_node *argot_find_node(struct argot_node *node, const char *path);
enum argot_tree_recurse_op {
argot_tree_recurse_set,
argot_tree_recurse_pre,
argot_tree_recurse_post
};
enum argot_tree_recurse_res {
argot_tree_recurse_ok,
argot_tree_recurse_fail,
argot_tree_recurse_skip,
argot_tree_recurse_stop
};
typedef enum argot_tree_recurse_res
(*argot_tree_recursor_t)(enum argot_tree_recurse_op,
struct argot_node *, void *);
int argot_tree_recurse(struct argot_node *node, argot_tree_recursor_t recfun,
void *data);
int argot_tree_join(struct argot_node *dst, struct argot_node *src);
enum argot_tree_recurse_res argot_node_exact_match(
enum argot_tree_recurse_op op,
struct argot_node *node, void *data);
typedef struct argot_match_buf *argot_match_buf_t;
struct argot_node *argot_match_first(struct argot_node *tree,
const char *pattern,
argot_match_buf_t *buf);
struct argot_node *argot_match_next(struct argot_match_buf *buf);
void argot_match_buf_free(struct argot_match_buf *buf);
argot_match_buf_t argot_match_buf_create(int argc, char **argv,
struct argot_value **labelv);
struct argot_node *argot_match_buf_first(struct argot_match_buf *buf,
struct argot_node *tree);
struct argot_node *argot_match_buf_get_node(argot_match_buf_t buf);
size_t argot_match_buf_get_args(argot_match_buf_t buf, char ***argv);
struct argot_node *argot_match_buf_get_root(argot_match_buf_t buf);
void argot_match_buf_set_root(argot_match_buf_t buf, struct argot_node *root);
#endif
|