"Fossies" - the Fresh Open Source Software Archive 
Member "xdelta3-3.0.11/xdelta3.i" (24 Mar 2015, 2103 Bytes) of package /linux/misc/xdelta3-3.0.11.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) ALAN Interactive Fiction Language source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 %module xdelta3
2 %import cstring.i
3 %import argcargv.i
4 %{
5 #include "xdelta3.h"
6
7 int xd3_main_cmdline (int ARGC, char **ARGV);
8 %}
9
10 %cstring_input_binary(const char *input, unsigned int input_size);
11 %cstring_input_binary(const char *source, unsigned int source_size);
12
13 %define %max_output_withsize(TYPEMAP, SIZE, MAXSIZE)
14 %typemap(in) MAXSIZE (unsigned int alloc_size) {
15 $1 = alloc_size = PyInt_AsLong(obj2);
16 }
17 %typemap(in,numinputs=0) (TYPEMAP, SIZE) {
18 }
19 %typemap(check) (TYPEMAP, SIZE) {
20 // alloc_size input is #7th position in xd3_xxcode_memory()
21 $1 = malloc(alloc_size7);
22 $2 = &alloc_size7;
23 }
24 %typemap(argout,fragment="t_output_helper") (TYPEMAP, SIZE) {
25 if (result == 0) {
26 PyObject *o;
27 // alloc_size7 now carries actual size
28 o = PyString_FromStringAndSize($1,alloc_size7);
29 $result = t_output_helper($result,o);
30 } else {
31 $result = t_output_helper($result,Py_None);
32 }
33 free($1);
34 }
35 %typemap(default) int flags {
36 $1 = 0;
37 }
38 %enddef
39
40 %max_output_withsize(char *output_buf, unsigned int *output_size, unsigned int max_output);
41
42 int xd3_encode_memory (const uint8_t *input,
43 usize_t input_size,
44 const uint8_t *source,
45 usize_t source_size,
46 uint8_t *output_buffer,
47 usize_t *output_size,
48 usize_t avail_output,
49 int flags);
50
51 int xd3_decode_memory (const uint8_t *input,
52 usize_t input_size,
53 const uint8_t *source,
54 usize_t source_size,
55 uint8_t *output_buf,
56 usize_t *output_size,
57 usize_t avail_output,
58 int flags);
59
60 int xd3_main_cmdline (int ARGC, char **ARGV);
61
62 /* Is this the right way? */
63 enum {
64 /*XD3_JUST_HDR,*/
65 /*XD3_SKIP_WINDOW,*/
66 /*XD3_SKIP_EMIT,*/
67 /*XD3_FLUSH,*/
68 XD3_SEC_DJW,
69 XD3_SEC_FGK,
70 /*XD3_SEC_TYPE,*/
71 XD3_SEC_NODATA,
72 XD3_SEC_NOINST,
73 XD3_SEC_NOADDR,
74 /*XD3_SEC_OTHER,*/
75 XD3_ADLER32,
76 XD3_ADLER32_NOVER,
77 XD3_NOCOMPRESS,
78 XD3_BEGREEDY,
79 XD3_COMPLEVEL_SHIFT,
80 XD3_COMPLEVEL_MASK,
81 XD3_COMPLEVEL_1,
82 XD3_COMPLEVEL_3,
83 XD3_COMPLEVEL_6,
84 XD3_COMPLEVEL_9,
85 };