NAME
diff - compute a shortest edit script (SES) given two
sequences
SYNOPSIS
#include <mba/diff.h>
typedef const void *(*idx_fn)(const void *s, int idx, void *context);
typedef int (*cmp_fn)(const void *e1, const void *e2, void *context);
typedef enum {
DIFF_MATCH = 1,
DIFF_DELETE,
DIFF_INSERT
} diff_op;
struct diff_edit {
short op; /* DIFF_MATCH, DIFF_DELETE or DIFF_INSERT */
int off; /* off into a if MATCH or DELETE, b if INSERT */
int len;
};
int diff(const void *a,
int aoff,
int n,
const void *b,
int boff,
int m,
idx_fn idx,
cmp_fn cmp,
void *context,
int dmax,
struct varray *ses,
int *sn,
struct varray *buf);