1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/*
Low level interface to Meta's zstd library for use in the compression.zstd
Python module.
*/
/* Declarations shared between different parts of the _zstd module*/
#ifndef ZSTD_MODULE_H
#define ZSTD_MODULE_H
/* Type specs */
extern PyType_Spec zstd_dict_type_spec;
extern PyType_Spec zstd_compressor_type_spec;
extern PyType_Spec zstd_decompressor_type_spec;
typedef struct {
/* Module heap types. */
PyTypeObject *ZstdDict_type;
PyTypeObject *ZstdCompressor_type;
PyTypeObject *ZstdDecompressor_type;
PyObject *ZstdError;
/* enum types set by set_parameter_types. */
PyTypeObject *CParameter_type;
PyTypeObject *DParameter_type;
} _zstd_state;
typedef enum {
ERR_DECOMPRESS,
ERR_COMPRESS,
ERR_LOAD_D_DICT,
ERR_LOAD_C_DICT,
ERR_GET_C_BOUNDS,
ERR_GET_D_BOUNDS,
ERR_SET_C_LEVEL,
ERR_TRAIN_DICT,
ERR_FINALIZE_DICT,
} error_type;
typedef enum {
DICT_TYPE_DIGESTED = 0,
DICT_TYPE_UNDIGESTED = 1,
DICT_TYPE_PREFIX = 2
} dictionary_type;
/* Format error message and set ZstdError. */
extern void
set_zstd_error(const _zstd_state* const state,
const error_type type, size_t zstd_ret);
extern void
set_parameter_error(const _zstd_state* const state, int is_compress,
int key_v, int value_v);
#endif // !ZSTD_MODULE_H
|