Mercurial > hg
comparison mercurial/cffi/mpatchbuild.py @ 32505:05a16c19967e
cffi: rename build scripts
This frees up cffi package for modules to be split from pure.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 02 May 2017 21:04:40 +0900 |
parents | mercurial/cffi/mpatch.py@9cc438bf7d9a |
children | 2dcb3d52ef41 |
comparison
equal
deleted
inserted
replaced
32504:2ba4d3b74ba8 | 32505:05a16c19967e |
---|---|
1 from __future__ import absolute_import | |
2 | |
3 import cffi | |
4 import os | |
5 | |
6 ffi = cffi.FFI() | |
7 mpatch_c = os.path.join(os.path.join(os.path.dirname(__file__), '..', | |
8 'mpatch.c')) | |
9 ffi.set_source("_mpatch_cffi", open(mpatch_c).read(), | |
10 include_dirs=["mercurial"]) | |
11 ffi.cdef(""" | |
12 | |
13 struct mpatch_frag { | |
14 int start, end, len; | |
15 const char *data; | |
16 }; | |
17 | |
18 struct mpatch_flist { | |
19 struct mpatch_frag *base, *head, *tail; | |
20 }; | |
21 | |
22 extern "Python" struct mpatch_flist* cffi_get_next_item(void*, ssize_t); | |
23 | |
24 int mpatch_decode(const char *bin, ssize_t len, struct mpatch_flist** res); | |
25 ssize_t mpatch_calcsize(size_t len, struct mpatch_flist *l); | |
26 void mpatch_lfree(struct mpatch_flist *a); | |
27 static int mpatch_apply(char *buf, const char *orig, size_t len, | |
28 struct mpatch_flist *l); | |
29 struct mpatch_flist *mpatch_fold(void *bins, | |
30 struct mpatch_flist* (*get_next_item)(void*, ssize_t), | |
31 ssize_t start, ssize_t end); | |
32 """) | |
33 | |
34 if __name__ == '__main__': | |
35 ffi.compile() |