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
use libc::{c_char, c_int};

use crate::object::PyObject;

#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
    pub fn PyCodec_Register(search_function: *mut PyObject) -> c_int;
    pub fn PyCodec_KnownEncoding(encoding: *const c_char) -> c_int;
    pub fn PyCodec_Encode(
        object: *mut PyObject,
        encoding: *const c_char,
        errors: *const c_char,
    ) -> *mut PyObject;
    pub fn PyCodec_Decode(
        object: *mut PyObject,
        encoding: *const c_char,
        errors: *const c_char,
    ) -> *mut PyObject;
    pub fn PyCodec_Encoder(encoding: *const c_char) -> *mut PyObject;
    pub fn PyCodec_Decoder(encoding: *const c_char) -> *mut PyObject;
    pub fn PyCodec_IncrementalEncoder(
        encoding: *const c_char,
        errors: *const c_char,
    ) -> *mut PyObject;
    pub fn PyCodec_IncrementalDecoder(
        encoding: *const c_char,
        errors: *const c_char,
    ) -> *mut PyObject;
    pub fn PyCodec_StreamReader(
        encoding: *const c_char,
        stream: *mut PyObject,
        errors: *const c_char,
    ) -> *mut PyObject;
    pub fn PyCodec_StreamWriter(
        encoding: *const c_char,
        stream: *mut PyObject,
        errors: *const c_char,
    ) -> *mut PyObject;
    pub fn PyCodec_RegisterError(name: *const c_char, error: *mut PyObject) -> c_int;
    pub fn PyCodec_LookupError(name: *const c_char) -> *mut PyObject;
    pub fn PyCodec_StrictErrors(exc: *mut PyObject) -> *mut PyObject;
    pub fn PyCodec_IgnoreErrors(exc: *mut PyObject) -> *mut PyObject;
    pub fn PyCodec_ReplaceErrors(exc: *mut PyObject) -> *mut PyObject;
    pub fn PyCodec_XMLCharRefReplaceErrors(exc: *mut PyObject) -> *mut PyObject;
    pub fn PyCodec_BackslashReplaceErrors(exc: *mut PyObject) -> *mut PyObject;
    #[cfg(Py_3_5)]
    pub fn PyCodec_NameReplaceErrors(exc: *mut PyObject) -> *mut PyObject;
}