_fpmaxtostr.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2000,2001,2003,2004 Manuel Novoa III <mjn3@codepoet.org>
  3. *
  4. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  5. *
  6. * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
  7. */
  8. #ifndef _FPMAXTOSTR_H
  9. #define _FPMAXTOSTR_H 1
  10. #include <features.h>
  11. #define __need_size_t
  12. #include <stddef.h>
  13. #include <stdint.h>
  14. #include <stdio.h>
  15. #include <printf.h>
  16. #include <sys/types.h>
  17. #ifdef __UCLIBC_HAS_FLOATS__
  18. # include <float.h>
  19. # include <bits/uClibc_fpmax.h>
  20. /* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
  21. /* With 32 bit ints, we can get 9 decimal digits per block. */
  22. # define DIGITS_PER_BLOCK 9
  23. # define NUM_DIGIT_BLOCKS ((DECIMAL_DIG+DIGITS_PER_BLOCK-1)/DIGITS_PER_BLOCK)
  24. /* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
  25. /* extra space for '-', '.', 'e+###', and nul */
  26. # define BUF_SIZE ( 3 + NUM_DIGIT_BLOCKS * DIGITS_PER_BLOCK )
  27. /* psm: why do these internals differ? */
  28. # ifdef __USE_OLD_VFPRINTF__
  29. typedef void (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
  30. extern size_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
  31. __fp_outfunc_t fp_outfunc) attribute_hidden;
  32. # else
  33. typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
  34. extern ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
  35. __fp_outfunc_t fp_outfunc) attribute_hidden;
  36. # endif
  37. # endif /* __UCLIBC_HAS_FLOATS__ */
  38. #endif /* _FPMAXTOSTR_H */