pycore_floatobject.h 1.5 KB

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