Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_cons.h>
Go to the source code of this file.
Macros | |
#define | Color_RANGE Color_BBLUE |
#define | Color_INSERT Color_BGREEN |
#define | Color_DELETE Color_BRED |
#define | Color_BGINSERT "\x1b[48;5;22m" |
#define | Color_BGDELETE "\x1b[48;5;52m" |
#define | FAST_MOD2(x, y) ((x) & (y - 1)) |
#define | FAST_MOD64(x) FAST_MOD2(x, 64) |
#define | DIFF_COLOR(prefix) (prefix == '+' ? Color_INSERT : (prefix == '-' ? Color_DELETE : "")) |
#define | DIFF_BGCOLOR(prefix) (prefix == '+' ? Color_BGINSERT : (prefix == '-' ? Color_BGDELETE : "")) |
Functions | |
static ut32 | count_newlines (RzDiff *diff, const void *array, st32 beg, st32 end) |
static void | diff_unified_append_ranges (RzList *opcodes, RzStrBuf *sb, bool color) |
static void | diff_unified_json_ranges (RzList *opcodes, PJ *pj) |
static void | diff_unified_append_data (RzDiff *diff, const void *array, st32 beg, st32 end, RzStrBuf *sb, char prefix, bool color) |
static void | diff_unified_lines_hl (RzDiff *diff, RzDiffOp *op, RzStrBuf *sb, char del_prefix, char ins_prefix) |
static void | diff_unified_json_data (RzDiff *diff, const void *array, st32 beg, st32 end, PJ *pj, const char *op) |
RZ_API RZ_OWN char * | rz_diff_unified_text (RZ_NONNULL RzDiff *diff, RZ_NULLABLE const char *from, RZ_NULLABLE const char *to, bool show_time, bool color) |
Produces a diff output with A and B inputs presented immediately adjacent to each other. More... | |
RZ_API RZ_OWN PJ * | rz_diff_unified_json (RZ_NONNULL RzDiff *diff, RZ_NULLABLE const char *from, RZ_NULLABLE const char *to, bool show_time) |
Produces a diff output to convert A in B in a JSON format. More... | |
#define Color_BGDELETE "\x1b[48;5;52m" |
Definition at line 11 of file unified_diff.c.
#define Color_BGINSERT "\x1b[48;5;22m" |
Definition at line 10 of file unified_diff.c.
#define Color_DELETE Color_BRED |
Definition at line 9 of file unified_diff.c.
#define Color_INSERT Color_BGREEN |
Definition at line 8 of file unified_diff.c.
#define Color_RANGE Color_BBLUE |
Definition at line 7 of file unified_diff.c.
#define DIFF_BGCOLOR | ( | prefix | ) | (prefix == '+' ? Color_BGINSERT : (prefix == '-' ? Color_BGDELETE : "")) |
Definition at line 16 of file unified_diff.c.
#define DIFF_COLOR | ( | prefix | ) | (prefix == '+' ? Color_INSERT : (prefix == '-' ? Color_DELETE : "")) |
Definition at line 15 of file unified_diff.c.
Definition at line 13 of file unified_diff.c.
Definition at line 14 of file unified_diff.c.
Definition at line 18 of file unified_diff.c.
References count, methods_internal_t::elem_at, test_evm::end, i, len, rz_diff_t::methods, p, rz_strbuf_fini(), rz_strbuf_get(), rz_strbuf_init(), rz_strbuf_length(), st32, methods_internal_t::stringify, and autogen_x86imm::tmp.
Referenced by diff_unified_lines_hl(), and rz_diff_unified_text().
|
inlinestatic |
Definition at line 70 of file unified_diff.c.
References color, Color_RESET, count, DIFF_COLOR, DIFF_IS_BYTES_METHOD, methods_internal_t::elem_at, test_evm::end, FAST_MOD64, i, len, rz_diff_t::methods, p, prefix, rz_strbuf_append_n(), rz_strbuf_appendf(), rz_strbuf_fini(), rz_strbuf_get(), rz_strbuf_init(), rz_strbuf_length(), sb, st32, methods_internal_t::stringify, and autogen_x86imm::tmp.
Referenced by rz_diff_unified_text().
Definition at line 41 of file unified_diff.c.
References rz_diff_op_t::a_beg, rz_diff_op_t::a_end, rz_diff_op_t::b_beg, rz_diff_op_t::b_end, color, Color_RANGE, Color_RESET, opcodes, rz_list_first(), rz_list_last(), rz_strbuf_appendf(), sb, and st32.
Referenced by rz_diff_unified_text().
|
inlinestatic |
Definition at line 282 of file unified_diff.c.
References count, DIFF_IS_BYTES_METHOD, methods_internal_t::elem_at, test_evm::end, FAST_MOD64, i, len, rz_diff_t::methods, p, pj_end(), pj_ks(), pj_o(), rz_strbuf_fini(), rz_strbuf_get(), rz_strbuf_init(), rz_strbuf_length(), st32, methods_internal_t::stringify, and autogen_x86imm::tmp.
Referenced by rz_diff_unified_json().
Definition at line 53 of file unified_diff.c.
References rz_diff_op_t::a_beg, rz_diff_op_t::a_end, rz_diff_op_t::b_beg, rz_diff_op_t::b_end, opcodes, pj_end(), pj_ka(), pj_N(), rz_list_first(), rz_list_last(), and st32.
Referenced by rz_diff_unified_json().
|
inlinestatic |
Definition at line 113 of file unified_diff.c.
References rz_diff_t::a, rz_diff_t::b, Color_RESET, Color_RESET_BG, count_newlines(), DIFF_BGCOLOR, DIFF_COLOR, methods_internal_t::elem_at, free(), i, len, malloc(), rz_diff_t::methods, p, prefix, RZ_MIN, rz_strbuf_append(), rz_strbuf_append_n(), rz_strbuf_appendf(), rz_strbuf_fini(), rz_strbuf_get(), rz_strbuf_init(), rz_strbuf_length(), sb, st32, methods_internal_t::stringify, and autogen_x86imm::tmp.
Referenced by rz_diff_unified_text().
RZ_API RZ_OWN PJ* rz_diff_unified_json | ( | RZ_NONNULL RzDiff * | diff, |
RZ_NULLABLE const char * | from, | ||
RZ_NULLABLE const char * | to, | ||
bool | show_time | ||
) |
Produces a diff output to convert A in B in a JSON format.
Produces a diff output with A and B inputs and contains the operations required to convert A in B and the values to remove, insert or keep.
Definition at line 409 of file unified_diff.c.
References diff_unified_json_data(), diff_unified_json_ranges(), free(), from, make_dist_html::groups, NULL, opcodes, pj_end(), pj_free(), pj_ka(), pj_ks(), pj_new(), pj_o(), RZ_DIFF_DEFAULT_N_GROUPS, RZ_DIFF_OP_DELETE, RZ_DIFF_OP_EQUAL, RZ_DIFF_OP_INSERT, RZ_DIFF_OP_REPLACE, rz_diff_opcodes_grouped_new(), rz_list_free(), rz_list_length(), RZ_LOG_ERROR, rz_return_val_if_fail, rz_time_date_now_to_string(), time, and to.
Referenced by rz_diff_unified_files().
RZ_API RZ_OWN char* rz_diff_unified_text | ( | RZ_NONNULL RzDiff * | diff, |
RZ_NULLABLE const char * | from, | ||
RZ_NULLABLE const char * | to, | ||
bool | show_time, | ||
bool | color | ||
) |
Produces a diff output with A and B inputs presented immediately adjacent to each other.
Produces a diff output with A and B inputs presented immediately adjacent to each other. It begins with range information and is immediately followed with the line additions, line deletions, and any number of the contextual lines.
Definition at line 333 of file unified_diff.c.
References color, count_newlines(), DIFF_IS_LINES_METHOD, diff_unified_append_data(), diff_unified_append_ranges(), diff_unified_lines_hl(), free(), from, make_dist_html::groups, NULL, opcodes, RZ_DIFF_DEFAULT_N_GROUPS, RZ_DIFF_OP_DELETE, RZ_DIFF_OP_EQUAL, RZ_DIFF_OP_INSERT, RZ_DIFF_OP_REPLACE, rz_diff_opcodes_grouped_new(), rz_list_free(), rz_list_length(), RZ_LOG_ERROR, rz_return_val_if_fail, rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_free(), rz_strbuf_new(), rz_time_date_now_to_string(), sb, time, and to.
Referenced by core_analysis_graph_construct_nodes(), graph_construct_nodes(), print_diff(), rz_cmd_debug(), and rz_diff_unified_files().