ffi: move initconfig.rs to cpython/initconfig.rs
This commit is contained in:
parent
fa50c11ac4
commit
9ef330d21c
|
@ -19,7 +19,6 @@ pub struct PyStatus {
|
|||
pub exitcode: c_int,
|
||||
}
|
||||
|
||||
#[cfg_attr(windows, link(name = "pythonXY"))]
|
||||
extern "C" {
|
||||
pub fn PyStatus_Ok() -> PyStatus;
|
||||
pub fn PyStatus_Error(err_msg: *const c_char) -> PyStatus;
|
||||
|
@ -39,7 +38,6 @@ pub struct PyWideStringList {
|
|||
pub items: *mut *mut wchar_t,
|
||||
}
|
||||
|
||||
#[cfg_attr(windows, link(name = "pythonXY"))]
|
||||
extern "C" {
|
||||
pub fn PyWideStringList_Append(list: *mut PyWideStringList, item: *const wchar_t) -> PyStatus;
|
||||
pub fn PyWideStringList_Insert(
|
||||
|
@ -70,7 +68,6 @@ pub struct PyPreConfig {
|
|||
pub allocator: c_int,
|
||||
}
|
||||
|
||||
#[cfg_attr(windows, link(name = "pythonXY"))]
|
||||
extern "C" {
|
||||
pub fn PyPreConfig_InitPythonConfig(config: *mut PyPreConfig);
|
||||
pub fn PyPreConfig_InitIsolatedConfig(config: *mut PyPreConfig);
|
||||
|
@ -150,7 +147,6 @@ pub struct PyConfig {
|
|||
pub orig_argv: PyWideStringList,
|
||||
}
|
||||
|
||||
#[cfg_attr(windows, link(name = "pythonXY"))]
|
||||
extern "C" {
|
||||
pub fn PyConfig_InitPythonConfig(config: *mut PyConfig);
|
||||
pub fn PyConfig_InitIsolatedConfig(config: *mut PyConfig);
|
||||
|
@ -186,7 +182,6 @@ extern "C" {
|
|||
|
||||
/* --- Helper functions --------------------------------------- */
|
||||
|
||||
#[cfg_attr(windows, link(name = "pythonXY"))]
|
||||
extern "C" {
|
||||
pub fn Py_GetArgcArgv(argc: *mut c_int, argv: *mut *mut *mut wchar_t);
|
||||
}
|
|
@ -9,10 +9,13 @@ pub mod dictobject;
|
|||
// skipped fileobject.h
|
||||
pub mod frameobject;
|
||||
// skipped import.h
|
||||
// skipped initconfig.h
|
||||
#[cfg(all(Py_3_8, not(PyPy)))]
|
||||
pub mod initconfig;
|
||||
// skipped interpreteridobject.h
|
||||
pub mod listobject;
|
||||
pub mod object;
|
||||
#[cfg(all(Py_3_8, not(PyPy)))]
|
||||
pub mod pylifecycle;
|
||||
|
||||
pub use self::abstract_::*;
|
||||
#[cfg(not(PyPy))]
|
||||
|
@ -22,5 +25,9 @@ pub use self::code::*;
|
|||
#[cfg(not(PyPy))]
|
||||
pub use self::dictobject::*;
|
||||
pub use self::frameobject::*;
|
||||
#[cfg(all(Py_3_8, not(PyPy)))]
|
||||
pub use self::initconfig::*;
|
||||
pub use self::listobject::*;
|
||||
pub use self::object::*;
|
||||
#[cfg(all(Py_3_8, not(PyPy)))]
|
||||
pub use self::pylifecycle::*;
|
||||
|
|
48
src/ffi/cpython/pylifecycle.rs
Normal file
48
src/ffi/cpython/pylifecycle.rs
Normal file
|
@ -0,0 +1,48 @@
|
|||
use crate::ffi::{PyConfig, PyPreConfig, PyStatus, Py_ssize_t};
|
||||
use libc::wchar_t;
|
||||
use std::os::raw::{c_char, c_int};
|
||||
|
||||
// "private" functions in cpython/pylifecycle.h accepted in PEP 587
|
||||
extern "C" {
|
||||
// skipped _Py_SetStandardStreamEncoding;
|
||||
pub fn Py_PreInitialize(src_config: *const PyPreConfig) -> PyStatus;
|
||||
pub fn Py_PreInitializeFromBytesArgs(
|
||||
src_config: *const PyPreConfig,
|
||||
argc: Py_ssize_t,
|
||||
argv: *mut *mut c_char,
|
||||
) -> PyStatus;
|
||||
pub fn Py_PreInitializeFromArgs(
|
||||
src_config: *const PyPreConfig,
|
||||
argc: Py_ssize_t,
|
||||
argv: *mut *mut wchar_t,
|
||||
) -> PyStatus;
|
||||
pub fn _Py_IsCoreInitialized() -> c_int;
|
||||
|
||||
pub fn Py_InitializeFromConfig(config: *const PyConfig) -> PyStatus;
|
||||
// skipped _Py_InitializeMain
|
||||
|
||||
pub fn Py_RunMain() -> c_int;
|
||||
|
||||
// skipped Py_ExitStatusException
|
||||
|
||||
// skipped _Py_RestoreSignals
|
||||
|
||||
// skipped Py_FdIsInteractive
|
||||
// skipped _Py_FdIsInteractive
|
||||
|
||||
// skipped _Py_SetProgramFullPath
|
||||
|
||||
// skipped _Py_gitidentifier
|
||||
// skipped _Py_getversion
|
||||
|
||||
// skipped _Py_IsFinalizing
|
||||
|
||||
// skipped _PyOS_URandom
|
||||
// skipped _PyOS_URandomNonblock
|
||||
|
||||
// skipped _Py_CoerceLegacyLocale
|
||||
// skipped _Py_LegacyLocaleDetected
|
||||
// skipped _Py_SetLocaleFromEnv
|
||||
|
||||
// skipped _Py_NewInterpreter
|
||||
}
|
|
@ -36,8 +36,6 @@ pub use self::funcobject::*;
|
|||
#[cfg(not(Py_LIMITED_API))]
|
||||
pub use self::genobject::*;
|
||||
pub use self::import::*;
|
||||
#[cfg(all(Py_3_8, not(any(PY_LIMITED_API, PyPy))))]
|
||||
pub use self::initconfig::*;
|
||||
pub use self::intrcheck::*;
|
||||
pub use self::iterobject::*;
|
||||
pub use self::listobject::*;
|
||||
|
@ -164,8 +162,6 @@ mod pyport;
|
|||
// [cfg(not(Py_LIMITED_API))]
|
||||
// mod pytime; contains nothing of interest
|
||||
|
||||
#[cfg(all(Py_3_8, not(any(PY_LIMITED_API, PyPy))))]
|
||||
mod initconfig;
|
||||
mod objimpl;
|
||||
mod pydebug;
|
||||
mod pyhash;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use crate::ffi::pystate::PyThreadState;
|
||||
#[cfg(all(Py_3_8, not(any(PY_LIMITED_API, PyPy))))]
|
||||
use crate::ffi::{PyConfig, PyPreConfig, PyStatus, Py_ssize_t};
|
||||
|
||||
use libc::wchar_t;
|
||||
use std::os::raw::{c_char, c_int};
|
||||
|
@ -53,24 +51,3 @@ extern "C" {
|
|||
pub fn PyOS_getsig(arg1: c_int) -> PyOS_sighandler_t;
|
||||
pub fn PyOS_setsig(arg1: c_int, arg2: PyOS_sighandler_t) -> PyOS_sighandler_t;
|
||||
}
|
||||
|
||||
// "private" functions in cpython/pylifecycle.h accepted in PEP 587
|
||||
#[cfg(all(Py_3_8, not(any(PY_LIMITED_API, PyPy))))]
|
||||
#[cfg_attr(windows, link(name = "pythonXY"))]
|
||||
extern "C" {
|
||||
pub fn Py_PreInitialize(src_config: *const PyPreConfig) -> PyStatus;
|
||||
pub fn Py_PreInitializeFromBytesArgs(
|
||||
src_config: *const PyPreConfig,
|
||||
argc: Py_ssize_t,
|
||||
argv: *mut *mut c_char,
|
||||
) -> PyStatus;
|
||||
pub fn Py_PreInitializeFromArgs(
|
||||
src_config: *const PyPreConfig,
|
||||
argc: Py_ssize_t,
|
||||
argv: *mut *mut wchar_t,
|
||||
) -> PyStatus;
|
||||
|
||||
pub fn Py_InitializeFromConfig(config: *const PyConfig) -> PyStatus;
|
||||
|
||||
pub fn Py_RunMain() -> c_int;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue