annotate mercurial/thirdparty/xdiff/xdiff.h @ 51691:3cb2b5b6626f

hghave: update detection of black version to a newer minimum The CI has moved to version 23.3.0, which is the last one to support 3.7 at runtime.
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 18 Jul 2024 12:37:13 +0200
parents a2baa61bbb14
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36671
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
1 /*
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
2 * LibXDiff by Davide Libenzi ( File Differential Library )
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
3 * Copyright (C) 2003 Davide Libenzi
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
4 *
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
8 * version 2.1 of the License, or (at your option) any later version.
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
9 *
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
13 * Lesser General Public License for more details.
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
14 *
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
16 * License along with this library; if not, see
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
17 * <http://www.gnu.org/licenses/>.
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
18 *
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
19 * Davide Libenzi <davidel@xmailserver.org>
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
20 *
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
21 */
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
22
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
23 #if !defined(XDIFF_H)
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
24 #define XDIFF_H
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
25
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
26 #ifdef __cplusplus
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
27 extern "C" {
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
28 #endif /* #ifdef __cplusplus */
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
29
36672
9e7b14caf67f xdiff: remove patience and histogram diff algorithms
Jun Wu <quark@fb.com>
parents: 36671
diff changeset
30 #include <stddef.h> /* size_t */
9e7b14caf67f xdiff: remove patience and histogram diff algorithms
Jun Wu <quark@fb.com>
parents: 36671
diff changeset
31
36936
a2baa61bbb14 xdiff: move stdint.h to xdiff.h
Jun Wu <quark@fb.com>
parents: 36822
diff changeset
32 #if !defined(_MSC_VER) || _MSC_VER >= 1600
a2baa61bbb14 xdiff: move stdint.h to xdiff.h
Jun Wu <quark@fb.com>
parents: 36822
diff changeset
33 #include <stdint.h>
a2baa61bbb14 xdiff: move stdint.h to xdiff.h
Jun Wu <quark@fb.com>
parents: 36822
diff changeset
34 #else
a2baa61bbb14 xdiff: move stdint.h to xdiff.h
Jun Wu <quark@fb.com>
parents: 36822
diff changeset
35 /* prior to Visual Studio 2010 */
a2baa61bbb14 xdiff: move stdint.h to xdiff.h
Jun Wu <quark@fb.com>
parents: 36822
diff changeset
36 typedef long long int64_t;
a2baa61bbb14 xdiff: move stdint.h to xdiff.h
Jun Wu <quark@fb.com>
parents: 36822
diff changeset
37 typedef unsigned long long uint64_t;
a2baa61bbb14 xdiff: move stdint.h to xdiff.h
Jun Wu <quark@fb.com>
parents: 36822
diff changeset
38 #endif
a2baa61bbb14 xdiff: move stdint.h to xdiff.h
Jun Wu <quark@fb.com>
parents: 36822
diff changeset
39
36671
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
40 /* xpparm_t.flags */
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
41 #define XDF_NEED_MINIMAL (1 << 0)
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
42
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
43 #define XDF_INDENT_HEURISTIC (1 << 23)
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
44
36673
b3c9c483cac9 xdiff: add a bdiff hunk mode
Jun Wu <quark@fb.com>
parents: 36672
diff changeset
45 /* emit bdiff-style "matched" (a1, a2, b1, b2) hunks instead of "different"
b3c9c483cac9 xdiff: add a bdiff hunk mode
Jun Wu <quark@fb.com>
parents: 36672
diff changeset
46 * (a1, a2 - a1, b1, b2 - b1) hunks */
b3c9c483cac9 xdiff: add a bdiff hunk mode
Jun Wu <quark@fb.com>
parents: 36672
diff changeset
47 #define XDL_EMIT_BDIFFHUNK (1 << 4)
36671
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
48
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
49 typedef struct s_mmfile {
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
50 char *ptr;
36822
882657a9f768 xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents: 36764
diff changeset
51 int64_t size;
36671
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
52 } mmfile_t;
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
53
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
54 typedef struct s_mmbuffer {
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
55 char *ptr;
36822
882657a9f768 xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents: 36764
diff changeset
56 int64_t size;
36671
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
57 } mmbuffer_t;
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
58
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
59 typedef struct s_xpparam {
36822
882657a9f768 xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents: 36764
diff changeset
60 uint64_t flags;
36671
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
61 } xpparam_t;
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
62
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
63 typedef struct s_xdemitcb {
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
64 void *priv;
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
65 } xdemitcb_t;
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
66
36822
882657a9f768 xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents: 36764
diff changeset
67 typedef int (*xdl_emit_hunk_consume_func_t)(int64_t start_a, int64_t count_a,
882657a9f768 xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents: 36764
diff changeset
68 int64_t start_b, int64_t count_b,
36671
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
69 void *cb_data);
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
70
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
71 typedef struct s_xdemitconf {
36822
882657a9f768 xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents: 36764
diff changeset
72 uint64_t flags;
36671
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
73 xdl_emit_hunk_consume_func_t hunk_func;
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
74 } xdemitconf_t;
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
75
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
76
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
77 #define xdl_malloc(x) malloc(x)
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
78 #define xdl_free(ptr) free(ptr)
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
79 #define xdl_realloc(ptr,x) realloc(ptr,x)
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
80
36822
882657a9f768 xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents: 36764
diff changeset
81 void *xdl_mmfile_first(mmfile_t *mmf, int64_t *size);
882657a9f768 xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents: 36764
diff changeset
82 int64_t xdl_mmfile_size(mmfile_t *mmf);
36671
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
83
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
84 int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
85 xdemitconf_t const *xecfg, xdemitcb_t *ecb);
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
86
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
87 #ifdef __cplusplus
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
88 }
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
89 #endif /* #ifdef __cplusplus */
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
90
34e2ff1f9cd8 xdiff: vendor xdiff library from git
Jun Wu <quark@fb.com>
parents:
diff changeset
91 #endif /* #if !defined(XDIFF_H) */