1 | use crate::object::*; |
2 | use std::os::raw::{c_double, c_int}; |
3 | use std::ptr::addr_of_mut; |
4 | |
5 | #[cfg (Py_LIMITED_API)] |
6 | // TODO: remove (see https://github.com/PyO3/pyo3/pull/1341#issuecomment-751515985) |
7 | opaque_struct!(PyFloatObject); |
8 | |
9 | #[cfg_attr (windows, link(name = "pythonXY" ))] |
10 | extern "C" { |
11 | #[cfg_attr (PyPy, link_name = "PyPyFloat_Type" )] |
12 | pub static mut PyFloat_Type: PyTypeObject; |
13 | } |
14 | |
15 | #[inline ] |
16 | pub unsafe fn PyFloat_Check(op: *mut PyObject) -> c_int { |
17 | PyObject_TypeCheck(ob:op, tp:addr_of_mut!(PyFloat_Type)) |
18 | } |
19 | |
20 | #[inline ] |
21 | pub unsafe fn PyFloat_CheckExact(op: *mut PyObject) -> c_int { |
22 | (Py_TYPE(ob:op) == addr_of_mut!(PyFloat_Type)) as c_int |
23 | } |
24 | |
25 | // skipped Py_RETURN_NAN |
26 | // skipped Py_RETURN_INF |
27 | |
28 | extern "C" { |
29 | pub fn PyFloat_GetMax() -> c_double; |
30 | pub fn PyFloat_GetMin() -> c_double; |
31 | pub fn PyFloat_GetInfo() -> *mut PyObject; |
32 | #[cfg_attr (PyPy, link_name = "PyPyFloat_FromString" )] |
33 | pub fn PyFloat_FromString(arg1: *mut PyObject) -> *mut PyObject; |
34 | #[cfg_attr (PyPy, link_name = "PyPyFloat_FromDouble" )] |
35 | pub fn PyFloat_FromDouble(arg1: c_double) -> *mut PyObject; |
36 | #[cfg_attr (PyPy, link_name = "PyPyFloat_AsDouble" )] |
37 | pub fn PyFloat_AsDouble(arg1: *mut PyObject) -> c_double; |
38 | } |
39 | |
40 | // skipped non-limited _PyFloat_Pack2 |
41 | // skipped non-limited _PyFloat_Pack4 |
42 | // skipped non-limited _PyFloat_Pack8 |
43 | // skipped non-limited _PyFloat_Unpack2 |
44 | // skipped non-limited _PyFloat_Unpack4 |
45 | // skipped non-limited _PyFloat_Unpack8 |
46 | // skipped non-limited _PyFloat_DebugMallocStats |
47 | // skipped non-limited _PyFloat_FormatAdvancedWriter |
48 | |