Rizin
unix-like reverse engineering framework and cli tools
rz_agraph.h
Go to the documentation of this file.
1 #ifndef RZ_AGRAPH_H
2 #define RZ_AGRAPH_H
3 
4 #include <rz_types.h>
5 #include <rz_cons.h>
6 #include <rz_util/rz_graph.h>
7 
8 typedef struct rz_ascii_node_t {
10  char *title;
11  char *body;
12 
13  int x;
14  int y;
15  int w;
16  int h;
17 
18  int layer;
22  int is_dummy;
24  int klass;
25  int difftype;
26  bool is_mini;
28 
29 typedef struct rz_core_graph_hits_t {
30  char *old_word;
32  int word_nth;
34 
35 #define RZ_AGRAPH_MODE_NORMAL 0
36 #define RZ_AGRAPH_MODE_OFFSET 1
37 #define RZ_AGRAPH_MODE_MINI 2
38 #define RZ_AGRAPH_MODE_TINY 3
39 #define RZ_AGRAPH_MODE_SUMMARY 4
40 #define RZ_AGRAPH_MODE_COMMENTS 5
41 #define RZ_AGRAPH_MODE_MAX 6
42 
43 typedef void (*RzANodeCallback)(RzANode *n, void *user);
44 typedef void (*RAEdgeCallback)(RzANode *from, RzANode *to, void *user);
45 
46 typedef struct rz_ascii_graph_t {
50  char *title;
51  Sdb *db;
52  HtPP *nodes; // HT with title(key)=RzANode*(value)
54 
55  int layout;
56  int is_instep;
57  bool is_tiny;
58  bool is_dis;
59  int edgemode;
60  int mode;
63  int zoom;
64  int movspeed;
65  bool hints;
66 
72 
73  /* events */
76  bool dummy; // enable the dummy nodes for better layouting
79 
80  int x, y;
81  int w, h;
82 
83  /* layout algorithm info */
86  struct layer_t *layers;
87  unsigned int n_layers;
88  RzList *dists; /* RzList<struct dist_t> */
89  RzList *edges; /* RzList<AEdge> */
92 
93 #ifdef RZ_API
97 RZ_API void rz_agraph_set_title(RzAGraph *g, const char *title);
99 RZ_API RzANode *rz_agraph_get_node(const RzAGraph *g, const char *title);
100 RZ_API RzANode *rz_agraph_add_node(const RzAGraph *g, const char *title, const char *body);
101 RZ_API RzANode *rz_agraph_add_node_with_color(const RzAGraph *g, const char *title, const char *body, int color);
102 RZ_API bool rz_agraph_del_node(const RzAGraph *g, const char *title);
104 RZ_API void rz_agraph_add_edge_at(const RzAGraph *g, RzANode *a, RzANode *b, int nth);
112 RZ_API RzAGraph *create_agraph_from_graph(const RzGraph /*<RzGraphNodeInfo *>*/ *graph);
113 #endif
114 
115 #endif
RZ_API RzANode * rz_agraph_add_node_with_color(const RzAGraph *g, const char *title, const char *body, int color)
Definition: agraph.c:3726
RZ_API bool rz_agraph_del_node(const RzAGraph *g, const char *title)
Definition: agraph.c:3769
RZ_API void rz_agraph_free(RzAGraph *g)
Definition: agraph.c:3909
RZ_API void rz_agraph_set_title(RzAGraph *g, const char *title)
Definition: agraph.c:3720
RZ_API RzAGraph * rz_agraph_new(RzConsCanvas *can)
Definition: agraph.c:3922
RZ_API RzANode * rz_agraph_get_first_node(const RzAGraph *g)
Definition: agraph.c:3846
RZ_API void rz_agraph_del_edge(const RzAGraph *g, RzANode *a, RzANode *b)
Definition: agraph.c:3880
RZ_API RzANode * rz_agraph_add_node(const RzAGraph *g, const char *title, const char *body)
Definition: agraph.c:3765
RZ_API Sdb * rz_agraph_get_sdb(RzAGraph *g)
Definition: agraph.c:3679
RZ_API void rz_agraph_set_curnode(RzAGraph *g, RzANode *a)
Definition: agraph.c:2696
RZ_API void rz_agraph_reset(RzAGraph *g)
Definition: agraph.c:3889
RZ_API void rz_agraph_foreach_edge(RzAGraph *g, RAEdgeCallback cb, void *user)
Definition: agraph.c:3837
RZ_API RzANode * rz_agraph_get_node(const RzAGraph *g, const char *title)
Definition: agraph.c:3852
RZ_API void rz_agraph_print(RzAGraph *g)
Definition: agraph.c:3687
RZ_API RzAGraph * create_agraph_from_graph(const RzGraph *graph)
Create RzAGraph from generic RzGraph with RzGraphNodeInfo as node data.
Definition: agraph.c:4916
RZ_API void rz_agraph_add_edge_at(const RzAGraph *g, RzANode *a, RzANode *b, int nth)
Definition: agraph.c:3871
RZ_API void rz_agraph_foreach(RzAGraph *g, RzANodeCallback cb, void *user)
Definition: agraph.c:3829
RZ_API void rz_agraph_print_json(RzAGraph *g, PJ *pj)
Definition: agraph.c:3694
RZ_API void rz_agraph_add_edge(const RzAGraph *g, RzANode *a, RzANode *b)
Definition: agraph.c:3862
#define RZ_API
struct @667 g
int n
Definition: mipsasm.c:19
struct rz_ascii_graph_t RzAGraph
struct rz_core_graph_hits_t RzAGraphHits
void(* RAEdgeCallback)(RzANode *from, RzANode *to, void *user)
Definition: rz_agraph.h:44
void(* RzANodeCallback)(RzANode *n, void *user)
Definition: rz_agraph.h:43
struct rz_ascii_node_t RzANode
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr from
Definition: sfsocketcall.h:123
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
Definition: sfsocketcall.h:125
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41
Definition: agraph.c:87
Definition: rz_pj.h:12
RzANodeCallback on_curnode_change
Definition: rz_agraph.h:74
int force_update_seek
Definition: rz_agraph.h:71
bool is_interactive
Definition: rz_agraph.h:62
bool show_node_titles
Definition: rz_agraph.h:77
RzList * long_edges
Definition: rz_agraph.h:85
RzList * back_edges
Definition: rz_agraph.h:84
bool need_set_layout
Definition: rz_agraph.h:69
bool show_node_body
Definition: rz_agraph.h:78
RzGraph * graph
Definition: rz_agraph.h:48
struct layer_t * layers
Definition: rz_agraph.h:86
void * on_curnode_change_data
Definition: rz_agraph.h:75
RzList * dummy_nodes
Definition: rz_agraph.h:53
RzANode * update_seek_on
Definition: rz_agraph.h:67
RzAGraphHits ghits
Definition: rz_agraph.h:90
const RzGraphNode * curnode
Definition: rz_agraph.h:49
unsigned int n_layers
Definition: rz_agraph.h:87
bool need_reload_nodes
Definition: rz_agraph.h:68
RzList * edges
Definition: rz_agraph.h:89
RzList * dists
Definition: rz_agraph.h:88
RzConsCanvas * can
Definition: rz_agraph.h:47
char * title
Definition: rz_agraph.h:10
RzGraphNode * gnode
Definition: rz_agraph.h:9
RzVector word_list
Definition: rz_agraph.h:31
Definition: sdb.h:63
static int color
Definition: visual.c:20
static const char * cb[]
Definition: z80_tab.h:176