Rizin
unix-like reverse engineering framework and cli tools
rz_tree.h
Go to the documentation of this file.
1 #ifndef RZ_TREE_H
2 #define RZ_TREE_H
3 #include <rz_list.h>
4 
5 struct rz_tree_t;
6 
7 typedef struct rz_tree_node_t {
9  struct rz_tree_t *tree;
10  RzList *children; // <RTreeNode>
11  unsigned int n_children;
12  int depth;
14  void *data;
16 
17 typedef struct rz_tree_t {
20 
21 typedef struct rz_tree_visitor_t {
22  void (*pre_visit)(RTreeNode *, struct rz_tree_visitor_t *);
23  void (*post_visit)(RTreeNode *, struct rz_tree_visitor_t *);
25  void *data;
27 typedef void (*RTreeNodeVisitCb)(RTreeNode *n, RTreeVisitor *vis);
28 
29 RZ_API RTree *rz_tree_new(void);
30 RZ_API RTreeNode *rz_tree_add_node(RTree *t, RTreeNode *node, void *child_data);
31 RZ_API void rz_tree_reset(RTree *t);
32 RZ_API void rz_tree_free(RTree *t);
33 RZ_API void rz_tree_dfs(RTree *t, RTreeVisitor *vis);
34 RZ_API void rz_tree_bfs(RTree *t, RTreeVisitor *vis);
35 #endif // RZ_TREE_H
#define RZ_API
int n
Definition: mipsasm.c:19
void(* RzListFree)(void *ptr)
Definition: rz_list.h:11
struct rz_tree_visitor_t RTreeVisitor
RZ_API RTreeNode * rz_tree_add_node(RTree *t, RTreeNode *node, void *child_data)
Definition: tree.c:99
RZ_API void rz_tree_reset(RTree *t)
Definition: tree.c:85
RZ_API void rz_tree_free(RTree *t)
Definition: tree.c:76
RZ_API void rz_tree_bfs(RTree *t, RTreeVisitor *vis)
Definition: tree.c:132
void(* RTreeNodeVisitCb)(RTreeNode *n, RTreeVisitor *vis)
Definition: rz_tree.h:27
RZ_API RTree * rz_tree_new(void)
Definition: tree.c:72
RZ_API void rz_tree_dfs(RTree *t, RTreeVisitor *vis)
Definition: tree.c:124
struct rz_tree_node_t RTreeNode
struct rz_tree_t RTree
unsigned int n_children
Definition: rz_tree.h:11
RzListFree free
Definition: rz_tree.h:13
struct rz_tree_node_t * parent
Definition: rz_tree.h:8
struct rz_tree_t * tree
Definition: rz_tree.h:9
RzList * children
Definition: rz_tree.h:10
void * data
Definition: rz_tree.h:14
RTreeNode * root
Definition: rz_tree.h:18
void(* discover_child)(RTreeNode *, struct rz_tree_visitor_t *)
Definition: rz_tree.h:24
void(* pre_visit)(RTreeNode *, struct rz_tree_visitor_t *)
Definition: rz_tree.h:22
void(* post_visit)(RTreeNode *, struct rz_tree_visitor_t *)
Definition: rz_tree.h:23