1use crate::object::PyObject;
2use std::os::raw::{c_char, c_int};
3
4extern "C" {
5 pub fn PyCodec_Register(search_function: *mut PyObject) -> c_int;
6 #[cfg(Py_3_10)]
7 #[cfg(not(PyPy))]
8 pub fn PyCodec_Unregister(search_function: *mut PyObject) -> c_int;
9 // skipped non-limited _PyCodec_Lookup from Include/codecs.h
10 // skipped non-limited _PyCodec_Forget from Include/codecs.h
11 pub fn PyCodec_KnownEncoding(encoding: *const c_char) -> c_int;
12 pub fn PyCodec_Encode(
13 object: *mut PyObject,
14 encoding: *const c_char,
15 errors: *const c_char,
16 ) -> *mut PyObject;
17 pub fn PyCodec_Decode(
18 object: *mut PyObject,
19 encoding: *const c_char,
20 errors: *const c_char,
21 ) -> *mut PyObject;
22 // skipped non-limited _PyCodec_LookupTextEncoding from Include/codecs.h
23 // skipped non-limited _PyCodec_EncodeText from Include/codecs.h
24 // skipped non-limited _PyCodec_DecodeText from Include/codecs.h
25 // skipped non-limited _PyCodecInfo_GetIncrementalDecoder from Include/codecs.h
26 // skipped non-limited _PyCodecInfo_GetIncrementalEncoder from Include/codecs.h
27 pub fn PyCodec_Encoder(encoding: *const c_char) -> *mut PyObject;
28 pub fn PyCodec_Decoder(encoding: *const c_char) -> *mut PyObject;
29 #[cfg_attr(PyPy, link_name = "PyPyCodec_IncrementalEncoder")]
30 pub fn PyCodec_IncrementalEncoder(
31 encoding: *const c_char,
32 errors: *const c_char,
33 ) -> *mut PyObject;
34 #[cfg_attr(PyPy, link_name = "PyPyCodec_IncrementalDecoder")]
35 pub fn PyCodec_IncrementalDecoder(
36 encoding: *const c_char,
37 errors: *const c_char,
38 ) -> *mut PyObject;
39 pub fn PyCodec_StreamReader(
40 encoding: *const c_char,
41 stream: *mut PyObject,
42 errors: *const c_char,
43 ) -> *mut PyObject;
44 pub fn PyCodec_StreamWriter(
45 encoding: *const c_char,
46 stream: *mut PyObject,
47 errors: *const c_char,
48 ) -> *mut PyObject;
49 pub fn PyCodec_RegisterError(name: *const c_char, error: *mut PyObject) -> c_int;
50 pub fn PyCodec_LookupError(name: *const c_char) -> *mut PyObject;
51 pub fn PyCodec_StrictErrors(exc: *mut PyObject) -> *mut PyObject;
52 pub fn PyCodec_IgnoreErrors(exc: *mut PyObject) -> *mut PyObject;
53 pub fn PyCodec_ReplaceErrors(exc: *mut PyObject) -> *mut PyObject;
54 pub fn PyCodec_XMLCharRefReplaceErrors(exc: *mut PyObject) -> *mut PyObject;
55 pub fn PyCodec_BackslashReplaceErrors(exc: *mut PyObject) -> *mut PyObject;
56 // skipped non-limited PyCodec_NameReplaceErrors from Include/codecs.h
57 // skipped non-limited Py_hexdigits from Include/codecs.h
58}
59