python3_sys/
pystrtod.rs

1use libc::{c_char, c_double, c_int};
2
3use crate::object::PyObject;
4
5#[cfg_attr(windows, link(name = "pythonXY"))]
6extern "C" {
7    pub fn PyOS_string_to_double(
8        str: *const c_char,
9        endptr: *mut *mut c_char,
10        overflow_exception: *mut PyObject,
11    ) -> c_double;
12    pub fn 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/* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */
22pub const Py_DTSF_SIGN: c_int = 0x01; /* always add the sign */
23pub const Py_DTSF_ADD_DOT_0: c_int = 0x02; /* if the result is an integer add ".0" */
24pub const Py_DTSF_ALT: c_int = 0x04; /* "alternate" formatting. it's format_code specific */
25
26/* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */
27pub const Py_DTST_FINITE: c_int = 0;
28pub const Py_DTST_INFINITE: c_int = 1;
29pub const Py_DTST_NAN: c_int = 2;