summaryrefslogtreecommitdiff
path: root/libc/stdio/_fpmaxtostr.h
blob: b4e7321c25c216d8dfbde2b564c581b066b4de2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* vi: set sw=4 ts=4: */
/*
 * Copyright (C) 2000,2001,2003,2004	Manuel Novoa III <mjn3@codepoet.org>
 *
 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 *
 * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
 */

#ifndef _FPMAXTOSTR_H
#define _FPMAXTOSTR_H 1

#include <features.h>
#ifdef __UCLIBC_HAS_FLOATS__

#define __need_size_t
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <printf.h>
#include <sys/types.h>
#include <float.h>
#include <bits/uClibc_fpmax.h>

/* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
/* With 32 bit ints, we can get 9 decimal digits per block. */
#define DIGITS_PER_BLOCK     9

#define NUM_DIGIT_BLOCKS   ((DECIMAL_DIG+DIGITS_PER_BLOCK-1)/DIGITS_PER_BLOCK)

/* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
/* extra space for '-', '.', 'e+###', and nul */
#define BUF_SIZE  ( 3 + NUM_DIGIT_BLOCKS * DIGITS_PER_BLOCK )

/* psm: why do these internals differ? */
#ifdef __USE_OLD_VFPRINTF__
typedef void (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);

extern size_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
			  __fp_outfunc_t fp_outfunc) attribute_hidden;
#else
typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);

extern ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
			   __fp_outfunc_t fp_outfunc) attribute_hidden;
#endif

#endif /* __UCLIBC_HAS_FLOATS__ */
#endif /* _FPMAXTOSTR_H */