Debian Codegraph @

Modules/_zstd/_zstdmodule.h

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