| 1 | use crate::object::PyObject; |
| 2 | use std::os::raw::{c_char, c_double, c_int}; |
| 3 | |
| 4 | unsafeextern "C" { |
| 5 | #[cfg_attr (PyPy, link_name = "PyPyOS_string_to_double" )] |
| 6 | pub unsafefn PyOS_string_to_double( |
| 7 | str: *const c_char, |
| 8 | endptr: *mut *mut c_char, |
| 9 | overflow_exception: *mut PyObject, |
| 10 | ) -> c_double; |
| 11 | #[cfg_attr (PyPy, link_name = "PyPyOS_double_to_string" )] |
| 12 | pub unsafefn PyOS_double_to_string( |
| 13 | val: c_double, |
| 14 | format_code: c_char, |
| 15 | precision: c_int, |
| 16 | flags: c_int, |
| 17 | _type: *mut c_int, |
| 18 | ) -> *mut c_char; |
| 19 | } |
| 20 | |
| 21 | // skipped non-limited _Py_string_to_number_with_underscores |
| 22 | // skipped non-limited _Py_parse_inf_or_nan |
| 23 | |
| 24 | /* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */ |
| 25 | pub const Py_DTSF_SIGN: c_int = 0x01; /* always add the sign */ |
| 26 | pub const Py_DTSF_ADD_DOT_0: c_int = 0x02; /* if the result is an integer add ".0" */ |
| 27 | pub const Py_DTSF_ALT: c_int = 0x04; /* "alternate" formatting. it's format_code specific */ |
| 28 | |
| 29 | /* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */ |
| 30 | pub const Py_DTST_FINITE: c_int = 0; |
| 31 | pub const Py_DTST_INFINITE: c_int = 1; |
| 32 | pub const Py_DTST_NAN: c_int = 2; |
| 33 | |