1 | use crate::object::*; |
2 | use std::os::raw::{c_double, c_int}; |
3 | use std::ptr::addr_of_mut; |
4 | |
5 | #[cfg_attr (windows, link(name = "pythonXY" ))] |
6 | unsafeextern "C" { |
7 | #[cfg_attr (PyPy, link_name = "PyPyComplex_Type" )] |
8 | pub unsafestatic mut PyComplex_Type: PyTypeObject; |
9 | } |
10 | |
11 | #[inline ] |
12 | pub unsafe fn PyComplex_Check(op: *mut PyObject) -> c_int { |
13 | PyObject_TypeCheck(ob:op, tp:addr_of_mut!(PyComplex_Type)) |
14 | } |
15 | |
16 | #[inline ] |
17 | pub unsafe fn PyComplex_CheckExact(op: *mut PyObject) -> c_int { |
18 | Py_IS_TYPE(ob:op, tp:addr_of_mut!(PyComplex_Type)) |
19 | } |
20 | |
21 | unsafeextern "C" { |
22 | // skipped non-limited PyComplex_FromCComplex |
23 | #[cfg_attr (PyPy, link_name = "PyPyComplex_FromDoubles" )] |
24 | pub unsafefn PyComplex_FromDoubles(real: c_double, imag: c_double) -> *mut PyObject; |
25 | |
26 | #[cfg_attr (PyPy, link_name = "PyPyComplex_RealAsDouble" )] |
27 | pub unsafefn PyComplex_RealAsDouble(op: *mut PyObject) -> c_double; |
28 | #[cfg_attr (PyPy, link_name = "PyPyComplex_ImagAsDouble" )] |
29 | pub unsafefn PyComplex_ImagAsDouble(op: *mut PyObject) -> c_double; |
30 | } |
31 | |