pybase16384 0.3.8__cp313-cp313-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pybase16384 might be problematic. Click here for more details.
- pybase16384/__init__.py +205 -0
- pybase16384/backends/__init__.py +1 -0
- pybase16384/backends/cffi/__init__.py +463 -0
- pybase16384/backends/cffi/_core.abi3.so +0 -0
- pybase16384/backends/cffi/build.py +183 -0
- pybase16384/backends/cython/__init__.py +36 -0
- pybase16384/backends/cython/_core.abi3.so +0 -0
- pybase16384/backends/cython/_core.c +39876 -0
- pybase16384/backends/cython/_core.pxi +12 -0
- pybase16384/backends/cython/_core.pyx +619 -0
- pybase16384/backends/cython/base16384.pxd +113 -0
- pybase16384-0.3.8.dist-info/LICENSE +674 -0
- pybase16384-0.3.8.dist-info/METADATA +215 -0
- pybase16384-0.3.8.dist-info/RECORD +16 -0
- pybase16384-0.3.8.dist-info/WHEEL +5 -0
- pybase16384-0.3.8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# cython: language_level=3
|
|
2
|
+
# cython: cdivision=True
|
|
3
|
+
from libc.stdint cimport int32_t
|
|
4
|
+
from libc.stdio cimport FILE
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
cdef extern from "base16384.h" nogil:
|
|
8
|
+
int BASE16384_ENCBUFSZ
|
|
9
|
+
int BASE16384_DECBUFSZ
|
|
10
|
+
|
|
11
|
+
int BASE16384_FLAG_NOHEADER
|
|
12
|
+
int BASE16384_FLAG_SUM_CHECK_ON_REMAIN
|
|
13
|
+
int BASE16384_FLAG_DO_SUM_CHECK_FORCELY
|
|
14
|
+
|
|
15
|
+
ctypedef enum base16384_err_t:
|
|
16
|
+
base16384_err_ok
|
|
17
|
+
base16384_err_get_file_size
|
|
18
|
+
base16384_err_fopen_output_file
|
|
19
|
+
base16384_err_fopen_input_file
|
|
20
|
+
base16384_err_write_file
|
|
21
|
+
base16384_err_open_input_file
|
|
22
|
+
base16384_err_map_input_file
|
|
23
|
+
base16384_err_read_file
|
|
24
|
+
base16384_err_invalid_file_name
|
|
25
|
+
base16384_err_invalid_commandline_parameter
|
|
26
|
+
base16384_err_invalid_decoding_checksum
|
|
27
|
+
# encode_len calc min buf size to fill encode result
|
|
28
|
+
int b14_encode_len "base16384_encode_len" (int dlen)
|
|
29
|
+
# decode_len calc min buf size to fill decode result
|
|
30
|
+
int b14_decode_len "base16384_decode_len" (int dlen, int offset)
|
|
31
|
+
|
|
32
|
+
int b14_encode_safe "base16384_encode_safe" (const char * data, int dlen, char * buf)
|
|
33
|
+
# encode data and write result into buf
|
|
34
|
+
int b14_encode "base16384_encode" (const char* data, int dlen, char* buf)
|
|
35
|
+
|
|
36
|
+
int b14_encode_unsafe "base16384_encode_unsafe" (const char * data, int dlen, char * buf)
|
|
37
|
+
# decode data and write result into buf
|
|
38
|
+
int b14_decode_safe "base16384_decode_safe" (const char * data, int dlen, char * buf)
|
|
39
|
+
|
|
40
|
+
int b14_decode "base16384_decode" (const char* data, int dlen, char* buf)
|
|
41
|
+
|
|
42
|
+
int b14_decode_unsafe "base16384_decode_unsafe"(const char * data, int dlen, char * buf)
|
|
43
|
+
|
|
44
|
+
base16384_err_t b14_encode_file "base16384_encode_file" (const char * input, const char * output, char * encbuf, char * decbuf)
|
|
45
|
+
base16384_err_t b14_decode_file "base16384_decode_file" (const char * input, const char * output, char * encbuf, char * decbuf)
|
|
46
|
+
|
|
47
|
+
base16384_err_t b14_encode_fp "base16384_encode_fp" (FILE* input, FILE* output, char* encbuf, char* decbuf)
|
|
48
|
+
|
|
49
|
+
# base16384_encode_fd encodes input fd to output fd.
|
|
50
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
51
|
+
base16384_err_t b14_encode_fd "base16384_encode_fd" (int input, int output, char* encbuf, char* decbuf)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# base16384_decode_fp decodes input file to output file.
|
|
55
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
56
|
+
base16384_err_t b14_decode_fp "base16384_decode_fp"(FILE* input, FILE* output, char* encbuf, char* decbuf)
|
|
57
|
+
|
|
58
|
+
# base16384_decode_fd decodes input fd to output fd.
|
|
59
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
60
|
+
base16384_err_t b14_decode_fd "base16384_decode_fd"(int input, int output, char* encbuf, char* decbuf)
|
|
61
|
+
|
|
62
|
+
# detailed
|
|
63
|
+
# base16384_encode_file_detailed encodes input file to output file.
|
|
64
|
+
# use `-` to specify stdin/stdout
|
|
65
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
66
|
+
base16384_err_t b14_encode_file_detailed "base16384_encode_file_detailed" (const char* input, const char* output, char* encbuf, char* decbuf, int flag)
|
|
67
|
+
|
|
68
|
+
# base16384_encode_fp_detailed encodes input file to output file.
|
|
69
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
70
|
+
base16384_err_t b14_encode_fp_detailed "base16384_encode_fp_detailed" (FILE* input, FILE* output, char* encbuf, char* decbuf, int flag)
|
|
71
|
+
|
|
72
|
+
# base16384_encode_fd_detailed encodes input fd to output fd.
|
|
73
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
74
|
+
base16384_err_t b14_encode_fd_detailed "base16384_encode_fd_detailed" (int input, int output, char* encbuf, char* decbuf, int flag)
|
|
75
|
+
|
|
76
|
+
# base16384_decode_file_detailed decodes input file to output file.
|
|
77
|
+
# use `-` to specify stdin/stdout
|
|
78
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
79
|
+
base16384_err_t b14_decode_file_detailed "base16384_decode_file_detailed" (const char* input, const char* output, char* encbuf, char* decbuf, int flag)
|
|
80
|
+
|
|
81
|
+
# base16384_decode_fp_detailed decodes input file to output file.
|
|
82
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
83
|
+
base16384_err_t b14_decode_fp_detailed "base16384_decode_fp_detailed" (FILE* input, FILE* output, char* encbuf, char* decbuf, int flag)
|
|
84
|
+
|
|
85
|
+
# base16384_decode_fd_detailed decodes input fd to output fd.
|
|
86
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
87
|
+
base16384_err_t b14_decode_fd_detailed "base16384_decode_fd_detailed" (int input, int output, char* encbuf, char* decbuf, int flag)
|
|
88
|
+
# stream
|
|
89
|
+
ctypedef ssize_t (*base16384_reader_t) (const void *client_data, void *buffer, size_t count) except -100
|
|
90
|
+
ctypedef ssize_t (*base16384_writer_t) (const void *client_data, const void *buffer, size_t count) except -100
|
|
91
|
+
|
|
92
|
+
ctypedef union base16384_io_function_t:
|
|
93
|
+
base16384_reader_t reader
|
|
94
|
+
base16384_writer_t writer
|
|
95
|
+
|
|
96
|
+
ctypedef struct base16384_stream_t:
|
|
97
|
+
base16384_io_function_t f
|
|
98
|
+
void* client_data
|
|
99
|
+
|
|
100
|
+
base16384_err_t b14_encode_stream "base16384_encode_stream"(base16384_stream_t* input, base16384_stream_t* output, char* encbuf, char* decbuf)
|
|
101
|
+
base16384_err_t b14_encode_stream_detailed "base16384_encode_stream_detailed"(base16384_stream_t* input, base16384_stream_t* output, char* encbuf, char* decbuf, int flag)
|
|
102
|
+
base16384_err_t b14_decode_stream "base16384_decode_stream"(base16384_stream_t* input, base16384_stream_t* output, char* encbuf, char* decbuf)
|
|
103
|
+
base16384_err_t b14_decode_stream_detailed "base16384_decode_stream_detailed"(base16384_stream_t* input, base16384_stream_t* output, char* encbuf, char* decbuf, int flag)
|
|
104
|
+
|
|
105
|
+
cdef extern from * nogil:
|
|
106
|
+
"""
|
|
107
|
+
#ifdef CPUBIT32
|
|
108
|
+
#define pybase16384_64bits() (0)
|
|
109
|
+
#else
|
|
110
|
+
#define pybase16384_64bits() (1)
|
|
111
|
+
#endif
|
|
112
|
+
"""
|
|
113
|
+
int32_t pybase16384_64bits()
|