| 1 | use crate::pystate::PyThreadState; |
| 2 | |
| 3 | use libc::wchar_t; |
| 4 | use std::os::raw::{c_char, c_int}; |
| 5 | |
| 6 | unsafeextern "C" { |
| 7 | pub unsafefn Py_Initialize(); |
| 8 | pub unsafefn Py_InitializeEx(arg1: c_int); |
| 9 | pub unsafefn Py_Finalize(); |
| 10 | pub unsafefn Py_FinalizeEx() -> c_int; |
| 11 | |
| 12 | #[cfg_attr (PyPy, link_name = "PyPy_IsInitialized" )] |
| 13 | pub unsafefn Py_IsInitialized() -> c_int; |
| 14 | |
| 15 | pub unsafefn Py_NewInterpreter() -> *mut PyThreadState; |
| 16 | pub unsafefn Py_EndInterpreter(arg1: *mut PyThreadState); |
| 17 | |
| 18 | #[cfg_attr (PyPy, link_name = "PyPy_AtExit" )] |
| 19 | pub unsafefn Py_AtExit(func: Option<extern "C" fn()>) -> c_int; |
| 20 | |
| 21 | pub unsafefn Py_Exit(arg1: c_int); |
| 22 | |
| 23 | pub unsafefn Py_Main(argc: c_int, argv: *mut *mut wchar_t) -> c_int; |
| 24 | pub unsafefn Py_BytesMain(argc: c_int, argv: *mut *mut c_char) -> c_int; |
| 25 | |
| 26 | #[cfg_attr ( |
| 27 | Py_3_11, |
| 28 | deprecated(note = "Deprecated since Python 3.11. Use `PyConfig.program_name` instead." ) |
| 29 | )] |
| 30 | pub unsafefn Py_SetProgramName(arg1: *const wchar_t); |
| 31 | #[cfg_attr (PyPy, link_name = "PyPy_GetProgramName" )] |
| 32 | #[cfg_attr ( |
| 33 | Py_3_13, |
| 34 | deprecated(note = "Deprecated since Python 3.13. Use `sys.executable` instead." ) |
| 35 | )] |
| 36 | pub unsafefn Py_GetProgramName() -> *mut wchar_t; |
| 37 | |
| 38 | #[cfg_attr ( |
| 39 | Py_3_11, |
| 40 | deprecated(note = "Deprecated since Python 3.11. Use `PyConfig.home` instead." ) |
| 41 | )] |
| 42 | pub unsafefn Py_SetPythonHome(arg1: *const wchar_t); |
| 43 | #[cfg_attr ( |
| 44 | Py_3_13, |
| 45 | deprecated( |
| 46 | note = "Deprecated since Python 3.13. Use `PyConfig.home` or the value of the `PYTHONHOME` environment variable instead." |
| 47 | ) |
| 48 | )] |
| 49 | pub unsafefn Py_GetPythonHome() -> *mut wchar_t; |
| 50 | #[cfg_attr ( |
| 51 | Py_3_13, |
| 52 | deprecated(note = "Deprecated since Python 3.13. Use `sys.executable` instead." ) |
| 53 | )] |
| 54 | pub unsafefn Py_GetProgramFullPath() -> *mut wchar_t; |
| 55 | #[cfg_attr ( |
| 56 | Py_3_13, |
| 57 | deprecated(note = "Deprecated since Python 3.13. Use `sys.prefix` instead." ) |
| 58 | )] |
| 59 | pub unsafefn Py_GetPrefix() -> *mut wchar_t; |
| 60 | #[cfg_attr ( |
| 61 | Py_3_13, |
| 62 | deprecated(note = "Deprecated since Python 3.13. Use `sys.exec_prefix` instead." ) |
| 63 | )] |
| 64 | pub unsafefn Py_GetExecPrefix() -> *mut wchar_t; |
| 65 | #[cfg_attr ( |
| 66 | Py_3_13, |
| 67 | deprecated(note = "Deprecated since Python 3.13. Use `sys.path` instead." ) |
| 68 | )] |
| 69 | pub unsafefn Py_GetPath() -> *mut wchar_t; |
| 70 | #[cfg (not(Py_3_13))] |
| 71 | #[cfg_attr ( |
| 72 | Py_3_11, |
| 73 | deprecated(note = "Deprecated since Python 3.11. Use `sys.path` instead." ) |
| 74 | )] |
| 75 | pub unsafefn Py_SetPath(arg1: *const wchar_t); |
| 76 | |
| 77 | // skipped _Py_CheckPython3 |
| 78 | |
| 79 | #[cfg_attr (PyPy, link_name = "PyPy_GetVersion" )] |
| 80 | pub unsafefn Py_GetVersion() -> *const c_char; |
| 81 | pub unsafefn Py_GetPlatform() -> *const c_char; |
| 82 | pub unsafefn Py_GetCopyright() -> *const c_char; |
| 83 | pub unsafefn Py_GetCompiler() -> *const c_char; |
| 84 | pub unsafefn Py_GetBuildInfo() -> *const c_char; |
| 85 | } |
| 86 | |
| 87 | type PyOS_sighandler_t = unsafe extern "C" fn(arg1: c_int); |
| 88 | |
| 89 | unsafeextern "C" { |
| 90 | pub unsafefn PyOS_getsig(arg1: c_int) -> PyOS_sighandler_t; |
| 91 | pub unsafefn PyOS_setsig(arg1: c_int, arg2: PyOS_sighandler_t) -> PyOS_sighandler_t; |
| 92 | } |
| 93 | |