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 
9 #ifndef _FPMAXTOSTR_H
10 #define _FPMAXTOSTR_H 1
11 
12 #include <features.h>
13 #define __need_size_t
14 #include <stddef.h>
15 #include <stdint.h>
16 #include <stdio.h>
17 #include <printf.h>
18 #include <sys/types.h>
19 
20 #ifdef __UCLIBC_HAS_FLOATS__
21 # include <float.h>
22 # include <bits/uClibc_fpmax.h>
23 
24 /* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
25 /* With 32 bit ints, we can get 9 decimal digits per block. */
26 # define DIGITS_PER_BLOCK     9
27 
28 # define NUM_DIGIT_BLOCKS   ((DECIMAL_DIG+DIGITS_PER_BLOCK-1)/DIGITS_PER_BLOCK)
29 
30 /* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
31 /* extra space for '-', '.', 'e+###', and nul */
32 # define BUF_SIZE  ( 3 + NUM_DIGIT_BLOCKS * DIGITS_PER_BLOCK )
33 
34 /* psm: why do these internals differ? */
35 #  ifdef __USE_OLD_VFPRINTF__
36 typedef void (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
37 
38 extern size_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
39 			  __fp_outfunc_t fp_outfunc) attribute_hidden;
40 #  else
41 typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
42 
43 extern ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
44 			   __fp_outfunc_t fp_outfunc) attribute_hidden;
45 #  endif
46 
47 # endif /* __UCLIBC_HAS_FLOATS__ */
48 #endif /* _FPMAXTOSTR_H */
49