equal
deleted
inserted
replaced
6 * of the BSD license. See the LICENSE file for details. |
6 * of the BSD license. See the LICENSE file for details. |
7 */ |
7 */ |
8 |
8 |
9 #define PY_SSIZE_T_CLEAN |
9 #define PY_SSIZE_T_CLEAN |
10 #include <Python.h> |
10 #include <Python.h> |
|
11 #include "structmember.h" |
11 |
12 |
12 #define ZSTD_STATIC_LINKING_ONLY |
13 #define ZSTD_STATIC_LINKING_ONLY |
13 #define ZDICT_STATIC_LINKING_ONLY |
14 #define ZDICT_STATIC_LINKING_ONLY |
14 #include "mem.h" |
15 #include "mem.h" |
15 #include "zstd.h" |
16 #include "zstd.h" |
16 #include "zdict.h" |
17 #include "zdict.h" |
17 |
18 |
18 #define PYTHON_ZSTANDARD_VERSION "0.6.0" |
19 #define PYTHON_ZSTANDARD_VERSION "0.7.0" |
19 |
20 |
20 typedef enum { |
21 typedef enum { |
21 compressorobj_flush_finish, |
22 compressorobj_flush_finish, |
22 compressorobj_flush_block, |
23 compressorobj_flush_block, |
23 } CompressorObj_Flush; |
24 } CompressorObj_Flush; |
32 unsigned targetLength; |
33 unsigned targetLength; |
33 ZSTD_strategy strategy; |
34 ZSTD_strategy strategy; |
34 } CompressionParametersObject; |
35 } CompressionParametersObject; |
35 |
36 |
36 extern PyTypeObject CompressionParametersType; |
37 extern PyTypeObject CompressionParametersType; |
|
38 |
|
39 typedef struct { |
|
40 PyObject_HEAD |
|
41 unsigned long long frameContentSize; |
|
42 unsigned windowSize; |
|
43 unsigned dictID; |
|
44 char checksumFlag; |
|
45 } FrameParametersObject; |
|
46 |
|
47 extern PyTypeObject FrameParametersType; |
37 |
48 |
38 typedef struct { |
49 typedef struct { |
39 PyObject_HEAD |
50 PyObject_HEAD |
40 unsigned selectivityLevel; |
51 unsigned selectivityLevel; |
41 int compressionLevel; |
52 int compressionLevel; |
113 extern PyTypeObject ZstdCompressorIteratorType; |
124 extern PyTypeObject ZstdCompressorIteratorType; |
114 |
125 |
115 typedef struct { |
126 typedef struct { |
116 PyObject_HEAD |
127 PyObject_HEAD |
117 |
128 |
118 ZSTD_DCtx* refdctx; |
129 ZSTD_DCtx* dctx; |
119 |
130 |
120 ZstdCompressionDict* dict; |
131 ZstdCompressionDict* dict; |
121 ZSTD_DDict* ddict; |
132 ZSTD_DDict* ddict; |
122 } ZstdDecompressor; |
133 } ZstdDecompressor; |
123 |
134 |
170 PyObject* chunk; |
181 PyObject* chunk; |
171 } DecompressorIteratorResult; |
182 } DecompressorIteratorResult; |
172 |
183 |
173 void ztopy_compression_parameters(CompressionParametersObject* params, ZSTD_compressionParameters* zparams); |
184 void ztopy_compression_parameters(CompressionParametersObject* params, ZSTD_compressionParameters* zparams); |
174 CompressionParametersObject* get_compression_parameters(PyObject* self, PyObject* args); |
185 CompressionParametersObject* get_compression_parameters(PyObject* self, PyObject* args); |
|
186 FrameParametersObject* get_frame_parameters(PyObject* self, PyObject* args); |
175 PyObject* estimate_compression_context_size(PyObject* self, PyObject* args); |
187 PyObject* estimate_compression_context_size(PyObject* self, PyObject* args); |
176 ZSTD_CStream* CStream_from_ZstdCompressor(ZstdCompressor* compressor, Py_ssize_t sourceSize); |
188 ZSTD_CStream* CStream_from_ZstdCompressor(ZstdCompressor* compressor, Py_ssize_t sourceSize); |
177 ZSTD_DStream* DStream_from_ZstdDecompressor(ZstdDecompressor* decompressor); |
189 ZSTD_DStream* DStream_from_ZstdDecompressor(ZstdDecompressor* decompressor); |
178 ZstdCompressionDict* train_dictionary(PyObject* self, PyObject* args, PyObject* kwargs); |
190 ZstdCompressionDict* train_dictionary(PyObject* self, PyObject* args, PyObject* kwargs); |