Mercurial > vim
annotate src/xdiff/xmacros.h @ 34251:9870ee5a6a16
runtime(Filelist): include README_vimlogo.txt (#13944)
Commit: https://github.com/vim/vim/commit/f430e7daebc8fb0023884e753c99c3d2f51936af
Author: Philip H <47042125+pheiduck@users.noreply.github.com>
Date: Wed Jan 31 20:51:48 2024 +0100
runtime(Filelist): include README_vimlogo.txt (https://github.com/vim/vim/issues/13944)
Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 31 Jan 2024 21:00:02 +0100 |
parents | cb88e5c589d0 |
children |
rev | line source |
---|---|
14696
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 /* |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 * LibXDiff by Davide Libenzi ( File Differential Library ) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 * Copyright (C) 2003 Davide Libenzi |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 * |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 * This library is free software; you can redistribute it and/or |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 * modify it under the terms of the GNU Lesser General Public |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 * License as published by the Free Software Foundation; either |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 * version 2.1 of the License, or (at your option) any later version. |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 * |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 * This library is distributed in the hope that it will be useful, |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 * Lesser General Public License for more details. |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 * |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU Lesser General Public |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 * License along with this library; if not, see |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 * <http://www.gnu.org/licenses/>. |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 * |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 * Davide Libenzi <davidel@xmailserver.org> |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 * |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 */ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 #if !defined(XMACROS_H) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 #define XMACROS_H |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
33888
cb88e5c589d0
patch 9.0.2153: no support to build on OpenVMS
Christian Brabandt <cb@256bit.org>
parents:
32178
diff
changeset
|
27 #if defined(__hpux) || defined(VMS) |
32178
9493de63a3f6
patch 9.0.1420: build failure because SIZE_MAX is not defined
Bram Moolenaar <Bram@vim.org>
parents:
32174
diff
changeset
|
28 # ifndef SIZE_MAX |
9493de63a3f6
patch 9.0.1420: build failure because SIZE_MAX is not defined
Bram Moolenaar <Bram@vim.org>
parents:
32174
diff
changeset
|
29 # define SIZE_MAX ((size_t)(-1)) |
9493de63a3f6
patch 9.0.1420: build failure because SIZE_MAX is not defined
Bram Moolenaar <Bram@vim.org>
parents:
32174
diff
changeset
|
30 # endif |
9493de63a3f6
patch 9.0.1420: build failure because SIZE_MAX is not defined
Bram Moolenaar <Bram@vim.org>
parents:
32174
diff
changeset
|
31 #endif |
14696
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 #define XDL_MIN(a, b) ((a) < (b) ? (a): (b)) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 #define XDL_MAX(a, b) ((a) > (b) ? (a): (b)) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 #define XDL_ABS(v) ((v) >= 0 ? (v): -(v)) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 #define XDL_ISDIGIT(c) ((c) >= '0' && (c) <= '9') |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 #define XDL_ISSPACE(c) (isspace((unsigned char)(c))) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 #define XDL_ADDBITS(v,b) ((v) + ((v) >> (b))) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 #define XDL_MASKBITS(b) ((1UL << (b)) - 1) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 #define XDL_HASHLONG(v,b) (XDL_ADDBITS((unsigned long)(v), b) & XDL_MASKBITS(b)) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 #define XDL_LE32_PUT(p, v) \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 do { \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 unsigned char *__p = (unsigned char *) (p); \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 *__p++ = (unsigned char) (v); \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 *__p++ = (unsigned char) ((v) >> 8); \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 *__p++ = (unsigned char) ((v) >> 16); \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 *__p = (unsigned char) ((v) >> 24); \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 } while (0) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 #define XDL_LE32_GET(p, v) \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 do { \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 unsigned char const *__p = (unsigned char const *) (p); \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 (v) = (unsigned long) __p[0] | ((unsigned long) __p[1]) << 8 | \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 ((unsigned long) __p[2]) << 16 | ((unsigned long) __p[3]) << 24; \ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 } while (0) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 |
32174
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
56 /* Allocate an array of nr elements, returns NULL on failure */ |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
57 #define XDL_ALLOC_ARRAY(p, nr) \ |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
58 ((p) = SIZE_MAX / sizeof(*(p)) >= (size_t)(nr) \ |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
59 ? xdl_malloc((nr) * sizeof(*(p))) \ |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
60 : NULL) |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
61 |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
62 /* Allocate an array of nr zeroed out elements, returns NULL on failure */ |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
63 #define XDL_CALLOC_ARRAY(p, nr) ((p) = xdl_calloc(nr, sizeof(*(p)))) |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
64 |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
65 /* |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
66 * Ensure array p can accommodate at least nr elements, growing the |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
67 * array and updating alloc (which is the number of allocated |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
68 * elements) as necessary. Frees p and returns -1 on failure, returns |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
69 * 0 on success |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
70 */ |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
71 #define XDL_ALLOC_GROW(p, nr, alloc) \ |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
72 (-!((nr) <= (alloc) || \ |
f84e5db372ea
patch 9.0.1418: the included xdiff code is a bit outdated
Bram Moolenaar <Bram@vim.org>
parents:
25709
diff
changeset
|
73 ((p) = xdl_alloc_grow_helper((p), (nr), &(alloc), sizeof(*(p)))))) |
14696
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 |
25709
d5142d87f898
patch 8.2.3390: included xdiff code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
18802
diff
changeset
|
75 #endif /* #if !defined(XMACROS_H) */ |