aboutsummaryrefslogtreecommitdiff
path: root/include/argot/tree.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/argot/tree.h')
-rw-r--r--include/argot/tree.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/include/argot/tree.h b/include/argot/tree.h
new file mode 100644
index 0000000..a3ad5c6
--- /dev/null
+++ b/include/argot/tree.h
@@ -0,0 +1,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

Return to:

Send suggestions and report system problems to the System administrator.