Show More
@@ -1,83 +1,91 | |||
|
1 | 1 | /* |
|
2 | 2 | * LibXDiff by Davide Libenzi ( File Differential Library ) |
|
3 | 3 | * Copyright (C) 2003 Davide Libenzi |
|
4 | 4 | * |
|
5 | 5 | * This library is free software; you can redistribute it and/or |
|
6 | 6 | * modify it under the terms of the GNU Lesser General Public |
|
7 | 7 | * License as published by the Free Software Foundation; either |
|
8 | 8 | * version 2.1 of the License, or (at your option) any later version. |
|
9 | 9 | * |
|
10 | 10 | * This library is distributed in the hope that it will be useful, |
|
11 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 | 13 | * Lesser General Public License for more details. |
|
14 | 14 | * |
|
15 | 15 | * You should have received a copy of the GNU Lesser General Public |
|
16 | 16 | * License along with this library; if not, see |
|
17 | 17 | * <http://www.gnu.org/licenses/>. |
|
18 | 18 | * |
|
19 | 19 | * Davide Libenzi <davidel@xmailserver.org> |
|
20 | 20 | * |
|
21 | 21 | */ |
|
22 | 22 | |
|
23 | 23 | #if !defined(XDIFF_H) |
|
24 | 24 | #define XDIFF_H |
|
25 | 25 | |
|
26 | 26 | #ifdef __cplusplus |
|
27 | 27 | extern "C" { |
|
28 | 28 | #endif /* #ifdef __cplusplus */ |
|
29 | 29 | |
|
30 | 30 | #include <stddef.h> /* size_t */ |
|
31 | 31 | |
|
32 | #if !defined(_MSC_VER) || _MSC_VER >= 1600 | |
|
33 | #include <stdint.h> | |
|
34 | #else | |
|
35 | /* prior to Visual Studio 2010 */ | |
|
36 | typedef long long int64_t; | |
|
37 | typedef unsigned long long uint64_t; | |
|
38 | #endif | |
|
39 | ||
|
32 | 40 | /* xpparm_t.flags */ |
|
33 | 41 | #define XDF_NEED_MINIMAL (1 << 0) |
|
34 | 42 | |
|
35 | 43 | #define XDF_INDENT_HEURISTIC (1 << 23) |
|
36 | 44 | |
|
37 | 45 | /* emit bdiff-style "matched" (a1, a2, b1, b2) hunks instead of "different" |
|
38 | 46 | * (a1, a2 - a1, b1, b2 - b1) hunks */ |
|
39 | 47 | #define XDL_EMIT_BDIFFHUNK (1 << 4) |
|
40 | 48 | |
|
41 | 49 | typedef struct s_mmfile { |
|
42 | 50 | char *ptr; |
|
43 | 51 | int64_t size; |
|
44 | 52 | } mmfile_t; |
|
45 | 53 | |
|
46 | 54 | typedef struct s_mmbuffer { |
|
47 | 55 | char *ptr; |
|
48 | 56 | int64_t size; |
|
49 | 57 | } mmbuffer_t; |
|
50 | 58 | |
|
51 | 59 | typedef struct s_xpparam { |
|
52 | 60 | uint64_t flags; |
|
53 | 61 | } xpparam_t; |
|
54 | 62 | |
|
55 | 63 | typedef struct s_xdemitcb { |
|
56 | 64 | void *priv; |
|
57 | 65 | } xdemitcb_t; |
|
58 | 66 | |
|
59 | 67 | typedef int (*xdl_emit_hunk_consume_func_t)(int64_t start_a, int64_t count_a, |
|
60 | 68 | int64_t start_b, int64_t count_b, |
|
61 | 69 | void *cb_data); |
|
62 | 70 | |
|
63 | 71 | typedef struct s_xdemitconf { |
|
64 | 72 | uint64_t flags; |
|
65 | 73 | xdl_emit_hunk_consume_func_t hunk_func; |
|
66 | 74 | } xdemitconf_t; |
|
67 | 75 | |
|
68 | 76 | |
|
69 | 77 | #define xdl_malloc(x) malloc(x) |
|
70 | 78 | #define xdl_free(ptr) free(ptr) |
|
71 | 79 | #define xdl_realloc(ptr,x) realloc(ptr,x) |
|
72 | 80 | |
|
73 | 81 | void *xdl_mmfile_first(mmfile_t *mmf, int64_t *size); |
|
74 | 82 | int64_t xdl_mmfile_size(mmfile_t *mmf); |
|
75 | 83 | |
|
76 | 84 | int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, |
|
77 | 85 | xdemitconf_t const *xecfg, xdemitcb_t *ecb); |
|
78 | 86 | |
|
79 | 87 | #ifdef __cplusplus |
|
80 | 88 | } |
|
81 | 89 | #endif /* #ifdef __cplusplus */ |
|
82 | 90 | |
|
83 | 91 | #endif /* #if !defined(XDIFF_H) */ |
@@ -1,47 +1,40 | |||
|
1 | 1 | /* |
|
2 | 2 | * LibXDiff by Davide Libenzi ( File Differential Library ) |
|
3 | 3 | * Copyright (C) 2003 Davide Libenzi |
|
4 | 4 | * |
|
5 | 5 | * This library is free software; you can redistribute it and/or |
|
6 | 6 | * modify it under the terms of the GNU Lesser General Public |
|
7 | 7 | * License as published by the Free Software Foundation; either |
|
8 | 8 | * version 2.1 of the License, or (at your option) any later version. |
|
9 | 9 | * |
|
10 | 10 | * This library is distributed in the hope that it will be useful, |
|
11 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 | 13 | * Lesser General Public License for more details. |
|
14 | 14 | * |
|
15 | 15 | * You should have received a copy of the GNU Lesser General Public |
|
16 | 16 | * License along with this library; if not, see |
|
17 | 17 | * <http://www.gnu.org/licenses/>. |
|
18 | 18 | * |
|
19 | 19 | * Davide Libenzi <davidel@xmailserver.org> |
|
20 | 20 | * |
|
21 | 21 | */ |
|
22 | 22 | |
|
23 | 23 | #if !defined(XINCLUDE_H) |
|
24 | 24 | #define XINCLUDE_H |
|
25 | 25 | |
|
26 | 26 | #include <ctype.h> |
|
27 | #if !defined(_MSC_VER) || _MSC_VER >= 1600 | |
|
28 | #include <stdint.h> | |
|
29 | #else | |
|
30 | /* prior to Visual Studio 2010 */ | |
|
31 | typedef long long int64_t; | |
|
32 | typedef unsigned long long uint64_t; | |
|
33 | #endif | |
|
34 | 27 | #include <stdio.h> |
|
35 | 28 | #include <stdlib.h> |
|
36 | 29 | #include <string.h> |
|
37 | 30 | #include <limits.h> |
|
38 | 31 | |
|
39 | 32 | #include "xmacros.h" |
|
40 | 33 | #include "xdiff.h" |
|
41 | 34 | #include "xtypes.h" |
|
42 | 35 | #include "xutils.h" |
|
43 | 36 | #include "xprepare.h" |
|
44 | 37 | #include "xdiffi.h" |
|
45 | 38 | |
|
46 | 39 | |
|
47 | 40 | #endif /* #if !defined(XINCLUDE_H) */ |
General Comments 0
You need to be logged in to leave comments.
Login now