forked from gphilippot/purebasic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiff.h
52 lines (42 loc) · 1.05 KB
/
diff.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef MBA_DIFF_H
#define MBA_DIFF_H
/* diff - compute a shortest edit script (SES) given two sequences
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef LIBMBA_API
#ifdef WIN32
# ifdef LIBMBA_EXPORTS
# define LIBMBA_API __declspec(dllexport)
# else /* LIBMBA_EXPORTS */
# define LIBMBA_API __declspec(dllimport)
# endif /* LIBMBA_EXPORTS */
#else /* WIN32 */
# define LIBMBA_API extern
#endif /* WIN32 */
#endif /* LIBMBA_API */
#include <mba/varray.h>
#include <mba/hashmap.h> /* cmp_fn */
typedef const void *(*idx_fn)(const void *s, int idx, void *context);
typedef enum {
DIFF_MATCH = 1,
DIFF_DELETE,
DIFF_INSERT
} diff_op;
struct diff_edit {
short op;
int off; /* off into s1 if MATCH or DELETE but s2 if INSERT */
int len;
};
/* consider alternate behavior for each NULL parameter
*/
LIBMBA_API 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);
#ifdef __cplusplus
}
#endif
#endif /* MBA_DIFF_H */