re PR fortran/47642 (real(kind=16) - libquadmath - segfault on amd64 FreeBSD)
PR fortran/47642
* libquadmath.texi (quadmath_snprintf): Document.
(quadmath_flt128tostr): Remove.
* Makefile.am (libquadmath_la_SOURCES): Add printf/*.c.
Remove quadmath_io.c, gdtoa/gdtoa.c, gdtoa/g__fmt.c,
gdtoa/g_Qfmt.c, gdtoa/dmisc.c and gdtoa/ulp.c.
* quadmath.h (quadmath_snprintf): New prototype.
(quadmath_flt128tostr): Remove.
* quadmath_weak.h (quadmath_snprintf): Add.
(quadmath_flt128tostr): Remove.
* configure.ac: New AC_CHECK_HEADERS headers: langinfo.h, wchar.h,
wctype.h, limits.h, ctype.h, printf.h, errno.h.
(AC_USE_SYSTEM_EXTENSIONS): Add.
(HAVE_HIDDEN_VISIBILITY, HAVE_PRINTF_HOOKS,
USE_LOCALE_SUPPORT, USE_I18N_NUMBER_H): New checks.
* quadmath.map (QUADMATH_1.0): Add quadmath_snprintf. Remove
quadmath_flt128tostr.
* printf/printf_fphex.c: New file.
* printf/_itowa.h: New file.
* printf/mul_n.c: New file.
* printf/quadmath-printf.h: New file.
* printf/submul_1.c: New file.
* printf/quadmath-printf.c: New file.
* printf/gmp-impl.h: New file.
* printf/lshift.c: New file.
* printf/fpioconst.h: New file.
* printf/add_n.c: New file.
* printf/cmp.c: New file.
* printf/sub_n.c: New file.
* printf/mul.c: New file.
* printf/divrem.c: New file.
* printf/addmul_1.c: New file.
* printf/printf_fp.c: New file.
* printf/_itoa.h: New file.
* printf/fpioconst.c: New file.
* printf/_i18n_number.h: New file.
* printf/flt1282mpn.c: New file.
* printf/rshift.c: New file.
* printf/mul_1.c: New file.
* quadmath_io.c: Removed.
* gdtoa/gdtoa.c: Removed.
* gdtoa/g__fmt.c: Removed.
* gdtoa/g_Qfmt.c: Removed.
* gdtoa/dmisc.c: Removed.
* gdtoa/ulp.c: Removed.
* config.h.in: Regenerated.
* configure: Regenerated.
* Makefile.in: Regenerated.
* io/write_float.def (DTOAQ): Use quadmath_snprintf instead of
quadmath_flt128tostr.
* io/transfer128.c (tmp2): Initialize to quadmath_snprintf instead
of quadmath_flt128tostr.
From-SVN: r170135
2011-02-14 16:34:44 +01:00
|
|
|
/* GCC Quad-Precision Math Library
|
2013-02-06 23:03:54 +01:00
|
|
|
Copyright (C) 2011 Free Software Foundation, Inc.
|
re PR fortran/47642 (real(kind=16) - libquadmath - segfault on amd64 FreeBSD)
PR fortran/47642
* libquadmath.texi (quadmath_snprintf): Document.
(quadmath_flt128tostr): Remove.
* Makefile.am (libquadmath_la_SOURCES): Add printf/*.c.
Remove quadmath_io.c, gdtoa/gdtoa.c, gdtoa/g__fmt.c,
gdtoa/g_Qfmt.c, gdtoa/dmisc.c and gdtoa/ulp.c.
* quadmath.h (quadmath_snprintf): New prototype.
(quadmath_flt128tostr): Remove.
* quadmath_weak.h (quadmath_snprintf): Add.
(quadmath_flt128tostr): Remove.
* configure.ac: New AC_CHECK_HEADERS headers: langinfo.h, wchar.h,
wctype.h, limits.h, ctype.h, printf.h, errno.h.
(AC_USE_SYSTEM_EXTENSIONS): Add.
(HAVE_HIDDEN_VISIBILITY, HAVE_PRINTF_HOOKS,
USE_LOCALE_SUPPORT, USE_I18N_NUMBER_H): New checks.
* quadmath.map (QUADMATH_1.0): Add quadmath_snprintf. Remove
quadmath_flt128tostr.
* printf/printf_fphex.c: New file.
* printf/_itowa.h: New file.
* printf/mul_n.c: New file.
* printf/quadmath-printf.h: New file.
* printf/submul_1.c: New file.
* printf/quadmath-printf.c: New file.
* printf/gmp-impl.h: New file.
* printf/lshift.c: New file.
* printf/fpioconst.h: New file.
* printf/add_n.c: New file.
* printf/cmp.c: New file.
* printf/sub_n.c: New file.
* printf/mul.c: New file.
* printf/divrem.c: New file.
* printf/addmul_1.c: New file.
* printf/printf_fp.c: New file.
* printf/_itoa.h: New file.
* printf/fpioconst.c: New file.
* printf/_i18n_number.h: New file.
* printf/flt1282mpn.c: New file.
* printf/rshift.c: New file.
* printf/mul_1.c: New file.
* quadmath_io.c: Removed.
* gdtoa/gdtoa.c: Removed.
* gdtoa/g__fmt.c: Removed.
* gdtoa/g_Qfmt.c: Removed.
* gdtoa/dmisc.c: Removed.
* gdtoa/ulp.c: Removed.
* config.h.in: Regenerated.
* configure: Regenerated.
* Makefile.in: Regenerated.
* io/write_float.def (DTOAQ): Use quadmath_snprintf instead of
quadmath_flt128tostr.
* io/transfer128.c (tmp2): Initialize to quadmath_snprintf instead
of quadmath_flt128tostr.
From-SVN: r170135
2011-02-14 16:34:44 +01:00
|
|
|
Written by Jakub Jelinek <jakub@redhat.com>
|
|
|
|
|
|
|
|
This file is part of the libquadmath library.
|
|
|
|
Libquadmath is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
Libquadmath is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with libquadmath; see the file COPYING.LIB. If
|
|
|
|
not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA. */
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#ifdef HAVE_LIMITS_H
|
|
|
|
#include <limits.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LANGINFO_H
|
|
|
|
#include <langinfo.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_CTYPE_H
|
|
|
|
#include <ctype.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_WCHAR_H
|
|
|
|
#include <wchar.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_WCTYPE_H
|
|
|
|
#include <wctype.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_PRINTF_HOOKS
|
|
|
|
#include <printf.h>
|
|
|
|
#endif
|
2011-02-16 14:54:30 +01:00
|
|
|
#ifdef HAVE_LOCALE_H
|
|
|
|
#include <locale.h>
|
|
|
|
#endif
|
re PR fortran/47642 (real(kind=16) - libquadmath - segfault on amd64 FreeBSD)
PR fortran/47642
* libquadmath.texi (quadmath_snprintf): Document.
(quadmath_flt128tostr): Remove.
* Makefile.am (libquadmath_la_SOURCES): Add printf/*.c.
Remove quadmath_io.c, gdtoa/gdtoa.c, gdtoa/g__fmt.c,
gdtoa/g_Qfmt.c, gdtoa/dmisc.c and gdtoa/ulp.c.
* quadmath.h (quadmath_snprintf): New prototype.
(quadmath_flt128tostr): Remove.
* quadmath_weak.h (quadmath_snprintf): Add.
(quadmath_flt128tostr): Remove.
* configure.ac: New AC_CHECK_HEADERS headers: langinfo.h, wchar.h,
wctype.h, limits.h, ctype.h, printf.h, errno.h.
(AC_USE_SYSTEM_EXTENSIONS): Add.
(HAVE_HIDDEN_VISIBILITY, HAVE_PRINTF_HOOKS,
USE_LOCALE_SUPPORT, USE_I18N_NUMBER_H): New checks.
* quadmath.map (QUADMATH_1.0): Add quadmath_snprintf. Remove
quadmath_flt128tostr.
* printf/printf_fphex.c: New file.
* printf/_itowa.h: New file.
* printf/mul_n.c: New file.
* printf/quadmath-printf.h: New file.
* printf/submul_1.c: New file.
* printf/quadmath-printf.c: New file.
* printf/gmp-impl.h: New file.
* printf/lshift.c: New file.
* printf/fpioconst.h: New file.
* printf/add_n.c: New file.
* printf/cmp.c: New file.
* printf/sub_n.c: New file.
* printf/mul.c: New file.
* printf/divrem.c: New file.
* printf/addmul_1.c: New file.
* printf/printf_fp.c: New file.
* printf/_itoa.h: New file.
* printf/fpioconst.c: New file.
* printf/_i18n_number.h: New file.
* printf/flt1282mpn.c: New file.
* printf/rshift.c: New file.
* printf/mul_1.c: New file.
* quadmath_io.c: Removed.
* gdtoa/gdtoa.c: Removed.
* gdtoa/g__fmt.c: Removed.
* gdtoa/g_Qfmt.c: Removed.
* gdtoa/dmisc.c: Removed.
* gdtoa/ulp.c: Removed.
* config.h.in: Regenerated.
* configure: Regenerated.
* Makefile.in: Regenerated.
* io/write_float.def (DTOAQ): Use quadmath_snprintf instead of
quadmath_flt128tostr.
* io/transfer128.c (tmp2): Initialize to quadmath_snprintf instead
of quadmath_flt128tostr.
From-SVN: r170135
2011-02-14 16:34:44 +01:00
|
|
|
#include "quadmath-imp.h"
|
|
|
|
#include "gmp-impl.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_WCHAR_H
|
|
|
|
#define L_(x) L##x
|
|
|
|
#else
|
|
|
|
#define L_(x) x
|
|
|
|
#undef wchar_t
|
|
|
|
#undef wint_t
|
|
|
|
#undef putwc
|
|
|
|
#undef WEOF
|
|
|
|
#define wchar_t char
|
|
|
|
#define wint_t int
|
|
|
|
#define putwc(c,f) putc(c,f)
|
|
|
|
#define WEOF EOF
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_CTYPE_H
|
|
|
|
/* Won't work for EBCDIC. */
|
|
|
|
#undef isupper
|
|
|
|
#undef isdigit
|
libquadmath.texi (FLT128_DIG, [...]): Document.
* libquadmath.texi (FLT128_DIG, FLT128_MIN_10_EXP,
FLT128_MAX_10_EXP): Document.
(strtoflt128): Remove obsolete comment.
* configure.ac (HAVE_STRTOULL): New check.
* printf/gmp-impl.h (mpn_construct_float128): New prototype,
define.
* printf/mul_n.c: Include <config.h>.
* printf/add_n.c: Likewise.
* printf/cmp.c: Likewise.
* printf/fpioconst.c: Likewise.
* printf/mul_1.c: Likewise.
* printf/rshift.c: Likewise.
* printf/lshift.c: Likewise.
* printf/submul_1.c: Likewise.
* printf/sub_n.c: Likewise.
* printf/divrem.c: Likewise.
* printf/addmul_1.c: Likewise.
* printf/mul.c: Likewise.
* printf/quadmath-printf.h (isupper, isdigit, tolower): Change
to avoid evaluating argument multiple times.
(isxdigit): Redefine.
* strtod/strtoflt128.c: New file.
* strtod/strtod_l.c: New file.
* strtod/mpn2flt128.c: New file.
* strtod/grouping.h: New file.
* strtod/tens_in_limb.c: New file.
* gdtoa/arith.h: Removed.
* gdtoa/gd_qnan.h: Removed.
* gdtoa/gdtoa_fltrnds.h: Removed.
* gdtoa/gdtoa.h: Removed.
* gdtoa/gdtoaimp.h: Removed.
* gdtoa/gethex.c: Removed.
* gdtoa/gmisc.c: Removed.
* gdtoa/hd_init.c: Removed.
* gdtoa/hexnan.c: Removed.
* gdtoa/makefile: Removed.
* gdtoa/misc.c: Removed.
* gdtoa/README.gdtoa: Removed.
* gdtoa/smisc.c: Removed.
* gdtoa/strtodg.c: Removed.
* gdtoa/strtopQ.c: Removed.
* gdtoa/sum.c: Removed.
* quadmath.h (FLT128_DIG, FLT128_MIN_10_EXP, FLT128_MAX_10_EXP):
Define.
* Makefile.am (libquadmath_la_SOURCES): Remove gdtoa/*, add
strtod/strtoflt128.c, strtod/mpn2flt128.c and strtod/tens_in_limb.c.
* config.h.in: Regenerated.
* configure: Regenerated.
* Makefile.in: Regenerated.
From-SVN: r170254
2011-02-17 20:57:18 +01:00
|
|
|
#undef isxdigit
|
re PR fortran/47642 (real(kind=16) - libquadmath - segfault on amd64 FreeBSD)
PR fortran/47642
* libquadmath.texi (quadmath_snprintf): Document.
(quadmath_flt128tostr): Remove.
* Makefile.am (libquadmath_la_SOURCES): Add printf/*.c.
Remove quadmath_io.c, gdtoa/gdtoa.c, gdtoa/g__fmt.c,
gdtoa/g_Qfmt.c, gdtoa/dmisc.c and gdtoa/ulp.c.
* quadmath.h (quadmath_snprintf): New prototype.
(quadmath_flt128tostr): Remove.
* quadmath_weak.h (quadmath_snprintf): Add.
(quadmath_flt128tostr): Remove.
* configure.ac: New AC_CHECK_HEADERS headers: langinfo.h, wchar.h,
wctype.h, limits.h, ctype.h, printf.h, errno.h.
(AC_USE_SYSTEM_EXTENSIONS): Add.
(HAVE_HIDDEN_VISIBILITY, HAVE_PRINTF_HOOKS,
USE_LOCALE_SUPPORT, USE_I18N_NUMBER_H): New checks.
* quadmath.map (QUADMATH_1.0): Add quadmath_snprintf. Remove
quadmath_flt128tostr.
* printf/printf_fphex.c: New file.
* printf/_itowa.h: New file.
* printf/mul_n.c: New file.
* printf/quadmath-printf.h: New file.
* printf/submul_1.c: New file.
* printf/quadmath-printf.c: New file.
* printf/gmp-impl.h: New file.
* printf/lshift.c: New file.
* printf/fpioconst.h: New file.
* printf/add_n.c: New file.
* printf/cmp.c: New file.
* printf/sub_n.c: New file.
* printf/mul.c: New file.
* printf/divrem.c: New file.
* printf/addmul_1.c: New file.
* printf/printf_fp.c: New file.
* printf/_itoa.h: New file.
* printf/fpioconst.c: New file.
* printf/_i18n_number.h: New file.
* printf/flt1282mpn.c: New file.
* printf/rshift.c: New file.
* printf/mul_1.c: New file.
* quadmath_io.c: Removed.
* gdtoa/gdtoa.c: Removed.
* gdtoa/g__fmt.c: Removed.
* gdtoa/g_Qfmt.c: Removed.
* gdtoa/dmisc.c: Removed.
* gdtoa/ulp.c: Removed.
* config.h.in: Regenerated.
* configure: Regenerated.
* Makefile.in: Regenerated.
* io/write_float.def (DTOAQ): Use quadmath_snprintf instead of
quadmath_flt128tostr.
* io/transfer128.c (tmp2): Initialize to quadmath_snprintf instead
of quadmath_flt128tostr.
From-SVN: r170135
2011-02-14 16:34:44 +01:00
|
|
|
#undef tolower
|
libquadmath.texi (FLT128_DIG, [...]): Document.
* libquadmath.texi (FLT128_DIG, FLT128_MIN_10_EXP,
FLT128_MAX_10_EXP): Document.
(strtoflt128): Remove obsolete comment.
* configure.ac (HAVE_STRTOULL): New check.
* printf/gmp-impl.h (mpn_construct_float128): New prototype,
define.
* printf/mul_n.c: Include <config.h>.
* printf/add_n.c: Likewise.
* printf/cmp.c: Likewise.
* printf/fpioconst.c: Likewise.
* printf/mul_1.c: Likewise.
* printf/rshift.c: Likewise.
* printf/lshift.c: Likewise.
* printf/submul_1.c: Likewise.
* printf/sub_n.c: Likewise.
* printf/divrem.c: Likewise.
* printf/addmul_1.c: Likewise.
* printf/mul.c: Likewise.
* printf/quadmath-printf.h (isupper, isdigit, tolower): Change
to avoid evaluating argument multiple times.
(isxdigit): Redefine.
* strtod/strtoflt128.c: New file.
* strtod/strtod_l.c: New file.
* strtod/mpn2flt128.c: New file.
* strtod/grouping.h: New file.
* strtod/tens_in_limb.c: New file.
* gdtoa/arith.h: Removed.
* gdtoa/gd_qnan.h: Removed.
* gdtoa/gdtoa_fltrnds.h: Removed.
* gdtoa/gdtoa.h: Removed.
* gdtoa/gdtoaimp.h: Removed.
* gdtoa/gethex.c: Removed.
* gdtoa/gmisc.c: Removed.
* gdtoa/hd_init.c: Removed.
* gdtoa/hexnan.c: Removed.
* gdtoa/makefile: Removed.
* gdtoa/misc.c: Removed.
* gdtoa/README.gdtoa: Removed.
* gdtoa/smisc.c: Removed.
* gdtoa/strtodg.c: Removed.
* gdtoa/strtopQ.c: Removed.
* gdtoa/sum.c: Removed.
* quadmath.h (FLT128_DIG, FLT128_MIN_10_EXP, FLT128_MAX_10_EXP):
Define.
* Makefile.am (libquadmath_la_SOURCES): Remove gdtoa/*, add
strtod/strtoflt128.c, strtod/mpn2flt128.c and strtod/tens_in_limb.c.
* config.h.in: Regenerated.
* configure: Regenerated.
* Makefile.in: Regenerated.
From-SVN: r170254
2011-02-17 20:57:18 +01:00
|
|
|
#define isupper(x) \
|
|
|
|
({__typeof(x) __is_x = (x); __is_x >= 'A' && __is_x <= 'Z'; })
|
|
|
|
#define isdigit(x) \
|
|
|
|
({__typeof(x) __is_x = (x); __is_x >= '0' && __is_x <= '9'; })
|
|
|
|
#define isxdigit(x) \
|
|
|
|
({__typeof(x) __is_x = (x); \
|
|
|
|
(__is_x >= '0' && __is_x <= '9') \
|
|
|
|
|| ((x) >= 'A' && (x) <= 'F') \
|
|
|
|
|| ((x) >= 'a' && (x) <= 'f'); })
|
|
|
|
#define tolower(x) \
|
|
|
|
({__typeof(x) __is_x = (x); \
|
|
|
|
(__is_x >= 'A' && __is_x <= 'Z') ? __is_x - 'A' + 'a' : __is_x; })
|
re PR fortran/47642 (real(kind=16) - libquadmath - segfault on amd64 FreeBSD)
PR fortran/47642
* libquadmath.texi (quadmath_snprintf): Document.
(quadmath_flt128tostr): Remove.
* Makefile.am (libquadmath_la_SOURCES): Add printf/*.c.
Remove quadmath_io.c, gdtoa/gdtoa.c, gdtoa/g__fmt.c,
gdtoa/g_Qfmt.c, gdtoa/dmisc.c and gdtoa/ulp.c.
* quadmath.h (quadmath_snprintf): New prototype.
(quadmath_flt128tostr): Remove.
* quadmath_weak.h (quadmath_snprintf): Add.
(quadmath_flt128tostr): Remove.
* configure.ac: New AC_CHECK_HEADERS headers: langinfo.h, wchar.h,
wctype.h, limits.h, ctype.h, printf.h, errno.h.
(AC_USE_SYSTEM_EXTENSIONS): Add.
(HAVE_HIDDEN_VISIBILITY, HAVE_PRINTF_HOOKS,
USE_LOCALE_SUPPORT, USE_I18N_NUMBER_H): New checks.
* quadmath.map (QUADMATH_1.0): Add quadmath_snprintf. Remove
quadmath_flt128tostr.
* printf/printf_fphex.c: New file.
* printf/_itowa.h: New file.
* printf/mul_n.c: New file.
* printf/quadmath-printf.h: New file.
* printf/submul_1.c: New file.
* printf/quadmath-printf.c: New file.
* printf/gmp-impl.h: New file.
* printf/lshift.c: New file.
* printf/fpioconst.h: New file.
* printf/add_n.c: New file.
* printf/cmp.c: New file.
* printf/sub_n.c: New file.
* printf/mul.c: New file.
* printf/divrem.c: New file.
* printf/addmul_1.c: New file.
* printf/printf_fp.c: New file.
* printf/_itoa.h: New file.
* printf/fpioconst.c: New file.
* printf/_i18n_number.h: New file.
* printf/flt1282mpn.c: New file.
* printf/rshift.c: New file.
* printf/mul_1.c: New file.
* quadmath_io.c: Removed.
* gdtoa/gdtoa.c: Removed.
* gdtoa/g__fmt.c: Removed.
* gdtoa/g_Qfmt.c: Removed.
* gdtoa/dmisc.c: Removed.
* gdtoa/ulp.c: Removed.
* config.h.in: Regenerated.
* configure: Regenerated.
* Makefile.in: Regenerated.
* io/write_float.def (DTOAQ): Use quadmath_snprintf instead of
quadmath_flt128tostr.
* io/transfer128.c (tmp2): Initialize to quadmath_snprintf instead
of quadmath_flt128tostr.
From-SVN: r170135
2011-02-14 16:34:44 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CHAR_MAX
|
|
|
|
#ifdef __CHAR_UNSIGNED__
|
|
|
|
#define CHAR_MAX (2 * __SCHAR_MAX__ + 1)
|
|
|
|
#else
|
|
|
|
#define CHAR_MAX __SCHAR_MAX__
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_PRINTF_HOOKS
|
|
|
|
#define printf_info __quadmath_printf_info
|
|
|
|
struct printf_info
|
|
|
|
{
|
|
|
|
int prec; /* Precision. */
|
|
|
|
int width; /* Width. */
|
|
|
|
wchar_t spec; /* Format letter. */
|
|
|
|
unsigned int is_long_double:1;/* L flag. */
|
|
|
|
unsigned int is_short:1; /* h flag. */
|
|
|
|
unsigned int is_long:1; /* l flag. */
|
|
|
|
unsigned int alt:1; /* # flag. */
|
|
|
|
unsigned int space:1; /* Space flag. */
|
|
|
|
unsigned int left:1; /* - flag. */
|
|
|
|
unsigned int showsign:1; /* + flag. */
|
|
|
|
unsigned int group:1; /* ' flag. */
|
|
|
|
unsigned int extra:1; /* For special use. */
|
|
|
|
unsigned int is_char:1; /* hh flag. */
|
|
|
|
unsigned int wide:1; /* Nonzero for wide character streams. */
|
|
|
|
unsigned int i18n:1; /* I flag. */
|
|
|
|
unsigned short int user; /* Bits for user-installed modifiers. */
|
|
|
|
wchar_t pad; /* Padding character. */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct __quadmath_printf_file
|
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
char *str;
|
|
|
|
size_t size;
|
|
|
|
size_t len;
|
|
|
|
int file_p;
|
|
|
|
};
|
|
|
|
|
|
|
|
int
|
|
|
|
__quadmath_printf_fp (struct __quadmath_printf_file *fp,
|
|
|
|
const struct printf_info *info,
|
|
|
|
const void *const *args) attribute_hidden;
|
|
|
|
int
|
|
|
|
__quadmath_printf_fphex (struct __quadmath_printf_file *fp,
|
|
|
|
const struct printf_info *info,
|
|
|
|
const void *const *args) attribute_hidden;
|
|
|
|
|
|
|
|
size_t __quadmath_do_pad (struct __quadmath_printf_file *fp, int wide,
|
|
|
|
int c, size_t n) attribute_hidden;
|
|
|
|
|
|
|
|
static inline __attribute__((__unused__)) size_t
|
|
|
|
__quadmath_do_put (struct __quadmath_printf_file *fp, int wide,
|
|
|
|
const char *s, size_t n)
|
|
|
|
{
|
|
|
|
size_t len;
|
|
|
|
if (fp->file_p)
|
|
|
|
{
|
|
|
|
if (wide)
|
|
|
|
{
|
|
|
|
size_t cnt;
|
|
|
|
const wchar_t *ls = (const wchar_t *) s;
|
|
|
|
for (cnt = 0; cnt < n; cnt++)
|
|
|
|
if (putwc (ls[cnt], fp->fp) == WEOF)
|
|
|
|
break;
|
|
|
|
return cnt;
|
|
|
|
}
|
|
|
|
return fwrite (s, 1, n, fp->fp);
|
|
|
|
}
|
|
|
|
len = MIN (fp->size, n);
|
|
|
|
memcpy (fp->str, s, len);
|
|
|
|
fp->str += len;
|
|
|
|
fp->size -= len;
|
|
|
|
fp->len += n;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline __attribute__((__unused__)) int
|
|
|
|
__quadmath_do_putc (struct __quadmath_printf_file *fp, int wide,
|
|
|
|
wchar_t c)
|
|
|
|
{
|
|
|
|
if (fp->file_p)
|
|
|
|
return wide ? (int) putwc (c, fp->fp) : putc (c, fp->fp);
|
|
|
|
if (fp->size)
|
|
|
|
{
|
|
|
|
*(fp->str++) = c;
|
|
|
|
fp->size--;
|
|
|
|
}
|
|
|
|
fp->len++;
|
|
|
|
return (unsigned char) c;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define PUT(f, s, n) __quadmath_do_put (f, wide, s, n)
|
|
|
|
#define PAD(f, c, n) __quadmath_do_pad (f, wide, c, n)
|
|
|
|
#define PUTC(c, f) __quadmath_do_putc (f, wide, c)
|
|
|
|
|
|
|
|
#define nl_langinfo_wc(x) \
|
|
|
|
({ union { const char *mb; wchar_t wc; } u; u.mb = nl_langinfo (x); u.wc; })
|
2011-02-14 17:40:38 +01:00
|
|
|
|
|
|
|
#undef _itoa
|
|
|
|
#define _itoa __quadmath_itoa
|
2011-02-20 22:59:28 +01:00
|
|
|
|
|
|
|
#undef NAN
|
|
|
|
#define NAN __builtin_nanf ("")
|