Back to index

glibc  2.9
strtold_l.c
Go to the documentation of this file.
00001 /* Copyright (C) 1999, 2006, 2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #include <math.h>
00020 #include <stdlib.h>
00021 #include <wchar.h>
00022 #include <xlocale.h>
00023 
00024 /* The actual implementation for all floating point sizes is in strtod.c.
00025    These macros tell it to produce the `long double' version, `strtold'.  */
00026 
00027 #define FLOAT        long double
00028 #define FLT          LDBL
00029 #ifdef USE_WIDE_CHAR
00030 extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
00031 # define STRTOF             __new_wcstold_l
00032 # define __STRTOF    ____new_wcstold_l
00033 # define ____STRTOF_INTERNAL ____wcstold_l_internal
00034 #else
00035 extern long double ____new_strtold_l (const char *, char **, __locale_t);
00036 # define STRTOF             __new_strtold_l
00037 # define __STRTOF    ____new_strtold_l
00038 # define ____STRTOF_INTERNAL ____strtold_l_internal
00039 #endif
00040 extern __typeof (__STRTOF) STRTOF;
00041 libc_hidden_proto (__STRTOF)
00042 libc_hidden_proto (STRTOF)
00043 #define MPN2FLOAT    __mpn_construct_long_double
00044 #define FLOAT_HUGE_VAL      HUGE_VALL
00045 #define SET_MANTISSA(flt, mant) \
00046   do { union ieee854_long_double u;                                         \
00047        u.d = (flt);                                                  \
00048        u.ieee.mantissa0 = 0x8000;                                    \
00049        u.ieee.mantissa1 = 0;                                                \
00050        u.ieee.mantissa2 = ((mant) >> 32);                            \
00051        u.ieee.mantissa3 = (mant) & 0xffffffff;                              \
00052        (flt) = u.d;                                                  \
00053   } while (0)
00054 
00055 #include <strtod_l.c>
00056 
00057 #ifdef __LONG_DOUBLE_MATH_OPTIONAL
00058 # include <math_ldbl_opt.h>
00059 # ifdef USE_WIDE_CHAR
00060 weak_alias (____new_wcstold_l, ___new_wcstold_l);
00061 long_double_symbol (libc, ___new_wcstold_l, wcstold_l);
00062 long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
00063 # else
00064 weak_alias (____new_strtold_l, ___new_strtold_l);
00065 long_double_symbol (libc, ___new_strtold_l, strtold_l);
00066 long_double_symbol (libc, ____new_strtold_l, __strtold_l);
00067 # endif
00068 #endif