python*-sys: use #![no_std]
This commit is contained in:
parent
67282d2e23
commit
7269dc64c2
|
@ -1,3 +1,4 @@
|
||||||
|
#![no_std]
|
||||||
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
|
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
|
||||||
|
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use libc::{c_char, c_int};
|
use libc::{c_char, c_int};
|
||||||
|
use core::ptr;
|
||||||
//use pyport::Py_ssize_t;
|
//use pyport::Py_ssize_t;
|
||||||
use object::{PyObject, PyTypeObject, Py_TYPE};
|
use object::{PyObject, PyTypeObject, Py_TYPE};
|
||||||
|
|
||||||
|
@ -103,6 +104,6 @@ extern "C" {
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub unsafe fn PyCFunction_New(ml: *mut PyMethodDef, slf: *mut PyObject) -> *mut PyObject {
|
pub unsafe fn PyCFunction_New(ml: *mut PyMethodDef, slf: *mut PyObject) -> *mut PyObject {
|
||||||
PyCFunction_NewEx(ml, slf, ::std::ptr::null_mut())
|
PyCFunction_NewEx(ml, slf, ptr::null_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use libc::{c_char, c_int, c_long};
|
use libc::{c_char, c_int, c_long};
|
||||||
use std::ptr;
|
use core::ptr;
|
||||||
use pyport::Py_ssize_t;
|
use pyport::Py_ssize_t;
|
||||||
use object::PyObject;
|
use object::PyObject;
|
||||||
use methodobject::PyMethodDef;
|
use methodobject::PyMethodDef;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::ptr;
|
use core::ptr;
|
||||||
use libc::{c_void, c_int, c_uint, c_long, c_char, c_double, FILE};
|
use libc::{c_void, c_int, c_uint, c_long, c_char, c_double, FILE};
|
||||||
use pyport::Py_ssize_t;
|
use pyport::Py_ssize_t;
|
||||||
use methodobject::PyMethodDef;
|
use methodobject::PyMethodDef;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use libc::{c_void, c_char, c_int};
|
use libc::{c_void, c_char, c_int};
|
||||||
use pyport::Py_ssize_t;
|
use pyport::Py_ssize_t;
|
||||||
use std::ptr;
|
use core::ptr;
|
||||||
use object::*;
|
use object::*;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -3,6 +3,6 @@ pub type Py_uintptr_t = ::libc::uintptr_t;
|
||||||
pub type Py_intptr_t = ::libc::intptr_t;
|
pub type Py_intptr_t = ::libc::intptr_t;
|
||||||
pub type Py_ssize_t = ::libc::ssize_t;
|
pub type Py_ssize_t = ::libc::ssize_t;
|
||||||
|
|
||||||
pub const PY_SSIZE_T_MIN : Py_ssize_t = ::std::isize::MIN as Py_ssize_t;
|
pub const PY_SSIZE_T_MIN : Py_ssize_t = ::core::isize::MIN as Py_ssize_t;
|
||||||
pub const PY_SSIZE_T_MAX : Py_ssize_t = ::std::isize::MAX as Py_ssize_t;
|
pub const PY_SSIZE_T_MAX : Py_ssize_t = ::core::isize::MAX as Py_ssize_t;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ extern "C" {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn PyEval_CallObject(func: *mut PyObject, arg: *mut PyObject) -> *mut PyObject {
|
pub unsafe fn PyEval_CallObject(func: *mut PyObject, arg: *mut PyObject) -> *mut PyObject {
|
||||||
PyEval_CallObjectWithKeywords(func, arg, ::std::ptr::null_mut())
|
PyEval_CallObjectWithKeywords(func, arg, ::core::ptr::null_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -26,10 +26,7 @@ extern "C" {
|
||||||
pub fn PyEval_GetGlobals() -> *mut PyObject;
|
pub fn PyEval_GetGlobals() -> *mut PyObject;
|
||||||
pub fn PyEval_GetLocals() -> *mut PyObject;
|
pub fn PyEval_GetLocals() -> *mut PyObject;
|
||||||
pub fn PyEval_GetFrame() -> *mut ::PyFrameObject;
|
pub fn PyEval_GetFrame() -> *mut ::PyFrameObject;
|
||||||
pub fn Py_AddPendingCall(func:
|
pub fn Py_AddPendingCall(func: Option<extern "C" fn(arg1: *mut c_void) -> c_int>,
|
||||||
::std::option::Option<extern "C" fn(arg1:
|
|
||||||
*mut c_void)
|
|
||||||
-> c_int>,
|
|
||||||
arg: *mut c_void) -> c_int;
|
arg: *mut c_void) -> c_int;
|
||||||
pub fn Py_MakePendingCalls() -> c_int;
|
pub fn Py_MakePendingCalls() -> c_int;
|
||||||
pub fn Py_SetRecursionLimit(arg1: c_int) -> ();
|
pub fn Py_SetRecursionLimit(arg1: c_int) -> ();
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl Clone for PyCodeObject {
|
||||||
#[inline] fn clone(&self) -> Self { *self }
|
#[inline] fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
impl Default for PyCodeObject {
|
impl Default for PyCodeObject {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Masks for co_flags */
|
/* Masks for co_flags */
|
||||||
|
|
|
@ -62,10 +62,7 @@ extern "C" {
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
pub fn PyImport_AppendInittab(name: *const c_char,
|
pub fn PyImport_AppendInittab(name: *const c_char,
|
||||||
initfunc:
|
initfunc: Option<extern "C" fn() -> *mut PyObject>)
|
||||||
::std::option::Option<extern "C" fn()
|
|
||||||
->
|
|
||||||
*mut PyObject>)
|
|
||||||
-> c_int;
|
-> c_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals, raw_pointer_derive)]
|
#![no_std]
|
||||||
|
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
|
||||||
#![cfg_attr(Py_LIMITED_API, allow(unused_imports))]
|
#![cfg_attr(Py_LIMITED_API, allow(unused_imports))]
|
||||||
|
|
||||||
// old: marked with TODO
|
// old: marked with TODO
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use libc::{c_char, c_int};
|
use libc::{c_char, c_int};
|
||||||
|
use core::{mem, ptr};
|
||||||
use object::{PyObject, PyTypeObject, Py_TYPE};
|
use object::{PyObject, PyTypeObject, Py_TYPE};
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -42,13 +43,13 @@ pub struct PyMethodDef {
|
||||||
impl Clone for PyMethodDef {
|
impl Clone for PyMethodDef {
|
||||||
#[inline] fn clone(&self) -> PyMethodDef { *self }
|
#[inline] fn clone(&self) -> PyMethodDef { *self }
|
||||||
}
|
}
|
||||||
impl ::std::default::Default for PyMethodDef {
|
impl Default for PyMethodDef {
|
||||||
fn default() -> PyMethodDef { unsafe { ::std::mem::zeroed() } }
|
fn default() -> PyMethodDef { unsafe { mem::zeroed() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub unsafe fn PyCFunction_New(ml: *mut PyMethodDef, slf: *mut PyObject) -> *mut PyObject {
|
pub unsafe fn PyCFunction_New(ml: *mut PyMethodDef, slf: *mut PyObject) -> *mut PyObject {
|
||||||
PyCFunction_NewEx(ml, slf, ::std::ptr::null_mut())
|
PyCFunction_NewEx(ml, slf, ptr::null_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub struct PyModuleDef_Base {
|
||||||
pub m_index: Py_ssize_t,
|
pub m_index: Py_ssize_t,
|
||||||
pub m_copy: *mut PyObject,
|
pub m_copy: *mut PyObject,
|
||||||
}
|
}
|
||||||
impl ::std::clone::Clone for PyModuleDef_Base {
|
impl Clone for PyModuleDef_Base {
|
||||||
fn clone(&self) -> PyModuleDef_Base { *self }
|
fn clone(&self) -> PyModuleDef_Base { *self }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ pub struct PyModuleDef {
|
||||||
pub m_clear: Option<inquiry>,
|
pub m_clear: Option<inquiry>,
|
||||||
pub m_free: Option<freefunc>,
|
pub m_free: Option<freefunc>,
|
||||||
}
|
}
|
||||||
impl ::std::clone::Clone for PyModuleDef {
|
impl Clone for PyModuleDef {
|
||||||
fn clone(&self) -> PyModuleDef { *self }
|
fn clone(&self) -> PyModuleDef { *self }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::ptr;
|
use core::ptr;
|
||||||
use libc::{c_void, c_int, c_uint, c_ulong, c_char};
|
use libc::{c_void, c_int, c_uint, c_ulong, c_char};
|
||||||
use pyport::{Py_ssize_t, Py_hash_t};
|
use pyport::{Py_ssize_t, Py_hash_t};
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ mod bufferinfo {
|
||||||
#[inline] fn clone(&self) -> Self { *self }
|
#[inline] fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
impl Default for Py_buffer {
|
impl Default for Py_buffer {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type getbufferproc =
|
pub type getbufferproc =
|
||||||
|
@ -285,7 +285,7 @@ mod typeobject {
|
||||||
#[inline] fn clone(&self) -> Self { *self }
|
#[inline] fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
impl Default for PyNumberMethods {
|
impl Default for PyNumberMethods {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
|
@ -305,7 +305,7 @@ mod typeobject {
|
||||||
#[inline] fn clone(&self) -> Self { *self }
|
#[inline] fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
impl Default for PySequenceMethods {
|
impl Default for PySequenceMethods {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
|
@ -318,7 +318,7 @@ mod typeobject {
|
||||||
#[inline] fn clone(&self) -> Self { *self }
|
#[inline] fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
impl Default for PyMappingMethods {
|
impl Default for PyMappingMethods {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
|
@ -334,7 +334,7 @@ mod typeobject {
|
||||||
}
|
}
|
||||||
#[cfg(Py_3_5)]
|
#[cfg(Py_3_5)]
|
||||||
impl Default for PyAsyncMethods {
|
impl Default for PyAsyncMethods {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
|
@ -346,7 +346,7 @@ mod typeobject {
|
||||||
#[inline] fn clone(&self) -> Self { *self }
|
#[inline] fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
impl Default for PyBufferProcs {
|
impl Default for PyBufferProcs {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -419,7 +419,7 @@ mod typeobject {
|
||||||
#[inline] fn clone(&self) -> Self { *self }
|
#[inline] fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
impl Default for PyTypeObject {
|
impl Default for PyTypeObject {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -441,7 +441,7 @@ mod typeobject {
|
||||||
#[inline] fn clone(&self) -> Self { *self }
|
#[inline] fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
impl Default for PyHeapTypeObject {
|
impl Default for PyHeapTypeObject {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -463,8 +463,8 @@ pub struct PyType_Slot {
|
||||||
impl Clone for PyType_Slot {
|
impl Clone for PyType_Slot {
|
||||||
fn clone(&self) -> PyType_Slot { *self }
|
fn clone(&self) -> PyType_Slot { *self }
|
||||||
}
|
}
|
||||||
impl ::std::default::Default for PyType_Slot {
|
impl Default for PyType_Slot {
|
||||||
fn default() -> PyType_Slot { unsafe { ::std::mem::zeroed() } }
|
fn default() -> PyType_Slot { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -479,8 +479,8 @@ pub struct PyType_Spec {
|
||||||
impl Clone for PyType_Spec {
|
impl Clone for PyType_Spec {
|
||||||
fn clone(&self) -> PyType_Spec { *self }
|
fn clone(&self) -> PyType_Spec { *self }
|
||||||
}
|
}
|
||||||
impl ::std::default::Default for PyType_Spec {
|
impl Default for PyType_Spec {
|
||||||
fn default() -> PyType_Spec { unsafe { ::std::mem::zeroed() } }
|
fn default() -> PyType_Spec { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use libc::{c_void, c_char, c_int};
|
use libc::{c_void, c_char, c_int};
|
||||||
use pyport::Py_ssize_t;
|
use pyport::Py_ssize_t;
|
||||||
use std::ptr;
|
use core::ptr;
|
||||||
use object::*;
|
use object::*;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -41,7 +41,7 @@ impl Clone for PyObjectArenaAllocator {
|
||||||
}
|
}
|
||||||
#[cfg(all(not(Py_LIMITED_API), Py_3_4))]
|
#[cfg(all(not(Py_LIMITED_API), Py_3_4))]
|
||||||
impl Default for PyObjectArenaAllocator {
|
impl Default for PyObjectArenaAllocator {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
#[cfg(all(not(Py_LIMITED_API), Py_3_4))]
|
#[cfg(all(not(Py_LIMITED_API), Py_3_4))]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -15,7 +15,7 @@ impl Clone for PyHash_FuncDef {
|
||||||
#[inline] fn clone(&self) -> Self { *self }
|
#[inline] fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
impl Default for PyHash_FuncDef {
|
impl Default for PyHash_FuncDef {
|
||||||
#[inline] fn default() -> Self { unsafe { ::std::mem::zeroed() } }
|
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -6,6 +6,6 @@ pub type Py_ssize_t = ::libc::ssize_t;
|
||||||
pub type Py_hash_t = Py_ssize_t;
|
pub type Py_hash_t = Py_ssize_t;
|
||||||
pub type Py_uhash_t = ::libc::size_t;
|
pub type Py_uhash_t = ::libc::size_t;
|
||||||
|
|
||||||
pub const PY_SSIZE_T_MIN : Py_ssize_t = ::std::isize::MIN as Py_ssize_t;
|
pub const PY_SSIZE_T_MIN : Py_ssize_t = ::core::isize::MIN as Py_ssize_t;
|
||||||
pub const PY_SSIZE_T_MAX : Py_ssize_t = ::std::isize::MAX as Py_ssize_t;
|
pub const PY_SSIZE_T_MAX : Py_ssize_t = ::core::isize::MAX as Py_ssize_t;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use libc::{c_char, c_int, wchar_t, FILE};
|
use libc::{c_char, c_int, wchar_t, FILE};
|
||||||
use std::ptr;
|
use core::ptr;
|
||||||
use object::*;
|
use object::*;
|
||||||
use pystate::PyThreadState;
|
use pystate::PyThreadState;
|
||||||
#[cfg(not(Py_LIMITED_API))]
|
#[cfg(not(Py_LIMITED_API))]
|
||||||
|
@ -177,7 +177,7 @@ extern "C" {
|
||||||
arg3: *mut PyObject) -> ();
|
arg3: *mut PyObject) -> ();
|
||||||
|
|
||||||
// TODO: these moved to pylifecycle.h
|
// TODO: these moved to pylifecycle.h
|
||||||
pub fn Py_AtExit(func: ::std::option::Option<extern "C" fn() -> ()>)
|
pub fn Py_AtExit(func: Option<extern "C" fn() -> ()>)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
pub fn Py_Exit(arg1: c_int) -> ();
|
pub fn Py_Exit(arg1: c_int) -> ();
|
||||||
pub fn Py_Main(argc: c_int, argv: *mut *mut wchar_t)
|
pub fn Py_Main(argc: c_int, argv: *mut *mut wchar_t)
|
||||||
|
|
Loading…
Reference in New Issue