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

source code of glibc/stdlib/strtold.c