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