| 1 | /* Read decimal floating point numbers. | 
|---|
| 2 | This file is part of the GNU C Library. | 
|---|
| 3 | Copyright (C) 1995-2020 Free Software Foundation, Inc. | 
|---|
| 4 | Contributed by Ulrich Drepper <drepper@gnu.org>, 1995. | 
|---|
| 5 |  | 
|---|
| 6 | The GNU C Library is free software; you can redistribute it and/or | 
|---|
| 7 | modify it under the terms of the GNU Lesser General Public | 
|---|
| 8 | License as published by the Free Software Foundation; either | 
|---|
| 9 | version 2.1 of the License, or (at your option) any later version. | 
|---|
| 10 |  | 
|---|
| 11 | The GNU C Library is distributed in the hope that it will be useful, | 
|---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
|---|
| 14 | Lesser General Public License for more details. | 
|---|
| 15 |  | 
|---|
| 16 | You should have received a copy of the GNU Lesser General Public | 
|---|
| 17 | License along with the GNU C Library; if not, see | 
|---|
| 18 | <https://www.gnu.org/licenses/>.  */ | 
|---|
| 19 |  | 
|---|
| 20 | /* The actual implementation for all floating point sizes is in strtod.c. | 
|---|
| 21 | These macros tell it to produce the `float' version, `strtof'.  */ | 
|---|
| 22 |  | 
|---|
| 23 | #include <bits/floatn.h> | 
|---|
| 24 | #include <bits/long-double.h> | 
|---|
| 25 |  | 
|---|
| 26 | #if __HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128 | 
|---|
| 27 | # define strtof128 __hide_strtof128 | 
|---|
| 28 | # define wcstof128 __hide_wcstof128 | 
|---|
| 29 | #endif | 
|---|
| 30 | #if __HAVE_FLOAT64X_LONG_DOUBLE | 
|---|
| 31 | # define strtof64x __hide_strtof64x | 
|---|
| 32 | # define wcstof64x __hide_wcstof64x | 
|---|
| 33 | #endif | 
|---|
| 34 |  | 
|---|
| 35 | #ifdef __LONG_DOUBLE_MATH_OPTIONAL | 
|---|
| 36 | # include <wchar.h> | 
|---|
| 37 | # define NEW(x) NEW1(x) | 
|---|
| 38 | # define NEW1(x) __new_##x | 
|---|
| 39 | long double ____new_strtold_internal (const char *, char **, int); | 
|---|
| 40 | long double __new_strtold (const char *, char **); | 
|---|
| 41 | long double ____new_wcstold_internal (const wchar_t *, wchar_t **, int); | 
|---|
| 42 | long double __new_wcstold (const wchar_t *, wchar_t **); | 
|---|
| 43 | libc_hidden_proto (____new_strtold_internal) | 
|---|
| 44 | libc_hidden_proto (____new_wcstold_internal) | 
|---|
| 45 | libc_hidden_proto (__new_strtold) | 
|---|
| 46 | libc_hidden_proto (__new_wcstold) | 
|---|
| 47 | #else | 
|---|
| 48 | # define NEW(x) x | 
|---|
| 49 | #endif | 
|---|
| 50 |  | 
|---|
| 51 | #define	FLOAT		long double | 
|---|
| 52 | #define	FLT		LDBL | 
|---|
| 53 | #ifdef USE_WIDE_CHAR | 
|---|
| 54 | # define STRTOF		NEW (wcstold) | 
|---|
| 55 | # define STRTOF_L	__wcstold_l | 
|---|
| 56 | #else | 
|---|
| 57 | # define STRTOF		NEW (strtold) | 
|---|
| 58 | # define STRTOF_L	__strtold_l | 
|---|
| 59 | #endif | 
|---|
| 60 |  | 
|---|
| 61 | #include "strtod.c" | 
|---|
| 62 |  | 
|---|
| 63 | #ifdef __LONG_DOUBLE_MATH_OPTIONAL | 
|---|
| 64 | # include <math_ldbl_opt.h> | 
|---|
| 65 | # ifdef USE_WIDE_CHAR | 
|---|
| 66 | long_double_symbol (libc, __new_wcstold, wcstold); | 
|---|
| 67 | long_double_symbol (libc, ____new_wcstold_internal, __wcstold_internal); | 
|---|
| 68 | libc_hidden_ver (____new_wcstold_internal, __wcstold_internal) | 
|---|
| 69 | # else | 
|---|
| 70 | long_double_symbol (libc, __new_strtold, strtold); | 
|---|
| 71 | long_double_symbol (libc, ____new_strtold_internal, __strtold_internal); | 
|---|
| 72 | libc_hidden_ver (____new_strtold_internal, __strtold_internal) | 
|---|
| 73 | # endif | 
|---|
| 74 | #endif | 
|---|
| 75 |  | 
|---|
| 76 | #if __HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128 | 
|---|
| 77 | # undef strtof128 | 
|---|
| 78 | # undef wcstof128 | 
|---|
| 79 | # ifdef USE_WIDE_CHAR | 
|---|
| 80 | weak_alias (NEW (wcstold), wcstof128) | 
|---|
| 81 | # else | 
|---|
| 82 | weak_alias (NEW (strtold), strtof128) | 
|---|
| 83 | # endif | 
|---|
| 84 | #endif | 
|---|
| 85 |  | 
|---|
| 86 | #if __HAVE_FLOAT64X_LONG_DOUBLE | 
|---|
| 87 | # undef strtof64x | 
|---|
| 88 | # undef wcstof64x | 
|---|
| 89 | # ifdef USE_WIDE_CHAR | 
|---|
| 90 | weak_alias (NEW (wcstold), wcstof64x) | 
|---|
| 91 | # else | 
|---|
| 92 | weak_alias (NEW (strtold), strtof64x) | 
|---|
| 93 | # endif | 
|---|
| 94 | #endif | 
|---|
| 95 |  | 
|---|