radare2/libr/include/r_diff.h
pancake 822a33377b * Initial working implementation of the r_diff with delta in C
- Uses the mercurial's C algorithm for delta diffing
  - Remove r_diff_lines .. do we need a line-level diffing tool?
  - Remove -l flag from radiff2
* Rename RIo to RIO
* Added r_reg_arena_new () to simplify arena creation
  - Some sanity fixes in r_reg arena.c
* Add -C in rasm2 to output in C string format
* Initial working implementation of r_debug_execute to inject code
  in child process and restore memory and registers
  - Returns %a0 register value in ut64
* Added 'c' command to r_core - to compare -- just dummy
  - Will use r_diff
  - if rdiff callback returns NULL, we must stop scanning
  - old r_diff_buffers_delta is now named buffers_radiff
  - Added test files in diff/t/{file1,file2}
* Added doc/plugins documentation file
* Fix ${EXT_SO} in bin/p and asm/p (dejavu?)
* Added dummy asm_gas r_asm plugin
* Various random syntax fixes
* Rename 'dbg.ptrace' to 'dbg.native'
* Added r_debug_io_bind () to sync dbg and bp io_bind
* r_debug_map_list is now in a nicer format
* Append ${EXT_EXE} in diff/t
* Add missing util/log.c and vapi/r_line.vapi

--HG--
rename : libr/debug/p/debug_ptrace.c => libr/debug/p/debug_native.c
rename : libr/debug/p/ptrace.mk => libr/debug/p/native.mk
2010-02-05 12:21:37 +01:00

51 lines
1.6 KiB
C

#ifndef _INCLUDE_DIFF_H_
#define _INCLUDE_DIFF_H_
#include <r_types.h>
#include <r_util.h>
typedef struct r_diff_op_t {
/* file A */
ut64 a_off;
const ut8 *a_buf;
int a_len;
/* file B */
ut64 b_off;
const ut8 *b_buf;
int b_len;
} RDiffOp;
typedef struct r_diff_t {
ut64 off_a;
ut64 off_b;
int delta;
void *user;
int (*callback)(struct r_diff_t *d, void *user,
struct r_diff_op_t *op);
} RDiff;
/* XXX: this api needs to be reviewed , constructor with offa+offb?? */
#ifdef R_API
R_API struct r_diff_t *r_diff_new(ut64 off_a, ut64 off_b);
R_API int r_diff_init(struct r_diff_t *d, ut64 off_a, ut64 off_b);
R_API struct r_diff_t *r_diff_free(struct r_diff_t *d);
R_API int r_diff_buffers(struct r_diff_t *d, const ut8 *a, ut32 la, const ut8 *b, ut32 lb);
R_API int r_diff_buffers_static(struct r_diff_t *d, const ut8 *a, int la, const ut8 *b, int lb);
R_API int r_diff_buffers_radiff(struct r_diff_t *d, const ut8 *a, int la, const ut8 *b, int lb);
R_API int r_diff_buffers_delta(RDiff *diff, const char *sa, int la, const char *sb, int lb);
R_API int r_diff_buffers(struct r_diff_t *d, const ut8 *a, ut32 la, const ut8 *b, ut32 lb);
R_API int r_diff_set_callback(struct r_diff_t *d,
int (*callback)(struct r_diff_t *d, void *user, struct r_diff_op_t *op),
void *user);
R_API int r_diff_buffers_distance(struct r_diff_t *d,
const ut8 *a, ut32 la, const ut8 *b, ut32 lb, ut32 *distance,
double *similarity);
/* static method !??! */
R_API int r_diff_lines(const char *file1, const char *sa, int la, const char *file2, const char *sb, int lb);
R_API int r_diff_set_delta(struct r_diff_t *d, int delta);
#endif
#endif