Mercurial > hg
annotate setup_bdiff_cffi.py @ 29870:6d11ae3c4c4b
journal: rename on disk files to 'namejournal'
The 'journal' naming is already used by the transaction journal. Having an
unrelated group of file with such a close naming is confusing and error prone.
We rename the file used by the 'journal' extension to use 'namejournal' as the
extension track the location of various 'names'.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 24 Aug 2016 03:59:19 +0200 |
parents | a8933d992a71 |
children |
rev | line source |
---|---|
29833
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
1 from __future__ import absolute_import |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
2 |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
3 import cffi |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
4 import os |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
5 |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
6 ffi = cffi.FFI() |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
7 ffi.set_source("_bdiff_cffi", |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
8 open(os.path.join(os.path.join(os.path.dirname(__file__), 'mercurial'), |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
9 'bdiff.c')).read(), include_dirs=['mercurial']) |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
10 ffi.cdef(""" |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
11 struct bdiff_line { |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
12 int hash, n, e; |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
13 ssize_t len; |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
14 const char *l; |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
15 }; |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
16 |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
17 struct bdiff_hunk; |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
18 struct bdiff_hunk { |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
19 int a1, a2, b1, b2; |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
20 struct bdiff_hunk *next; |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
21 }; |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
22 |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
23 int bdiff_splitlines(const char *a, ssize_t len, struct bdiff_line **lr); |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
24 int bdiff_diff(struct bdiff_line *a, int an, struct bdiff_line *b, int bn, |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
25 struct bdiff_hunk *base); |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
26 void bdiff_freehunks(struct bdiff_hunk *l); |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
27 void free(void*); |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
28 """) |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
29 |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
30 if __name__ == '__main__': |
a8933d992a71
bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff
changeset
|
31 ffi.compile() |