1 #ifndef Py_INTERNAL_FLOATOBJECT_H
2 #define Py_INTERNAL_FLOATOBJECT_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6
7 #ifndef Py_BUILD_CORE
8 # error "this header requires Py_BUILD_CORE define"
9 #endif
10
11
12 /* runtime lifecycle */
13
14 extern void _PyFloat_InitState(PyInterpreterState *);
15 extern PyStatus _PyFloat_InitTypes(PyInterpreterState *);
16 extern void _PyFloat_Fini(PyInterpreterState *);
17 extern void _PyFloat_FiniType(PyInterpreterState *);
18
19
20 /* other API */
21
22 enum _py_float_format_type {
23 _py_float_format_unknown,
24 _py_float_format_ieee_big_endian,
25 _py_float_format_ieee_little_endian,
26 };
27
28 struct _Py_float_runtime_state {
29 enum _py_float_format_type float_format;
30 enum _py_float_format_type double_format;
31 };
32
33
34 #ifndef WITH_FREELISTS
35 // without freelists
36 # define PyFloat_MAXFREELIST 0
37 #endif
38
39 #ifndef PyFloat_MAXFREELIST
40 # define PyFloat_MAXFREELIST 100
41 #endif
42
43 struct _Py_float_state {
44 #if PyFloat_MAXFREELIST > 0
45 /* Special free list
46 free_list is a singly-linked list of available PyFloatObjects,
47 linked via abuse of their ob_type members. */
48 int numfree;
49 PyFloatObject *free_list;
50 #endif
51 };
52
53 void _PyFloat_ExactDealloc(PyObject *op);
54
55
56 PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out);
57
58
59 /* Format the object based on the format_spec, as defined in PEP 3101
60 (Advanced String Formatting). */
61 PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter(
62 _PyUnicodeWriter *writer,
63 PyObject *obj,
64 PyObject *format_spec,
65 Py_ssize_t start,
66 Py_ssize_t end);
67
68 #ifdef __cplusplus
69 }
70 #endif
71 #endif /* !Py_INTERNAL_FLOATOBJECT_H */