1 // -*- C++ -*-
2 //===-----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 // These are reimplementations of some extended locale functions ( *_l ) that
10 // aren't part of POSIX.  They are widely available though (GLIBC, BSD, maybe
11 // others).  The unifying aspect in this case is that all of these functions
12 // convert strings to some numeric type.
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
16 #define _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
17 
18 #include <__config>
19 #include <stdlib.h>
20 
21 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
22 #  include <wchar.h>
23 #endif
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
strtof_l(const char * __nptr,char ** __endptr,locale_t)29 inline _LIBCPP_HIDE_FROM_ABI_C float strtof_l(const char* __nptr, char** __endptr, locale_t) {
30   return ::strtof(__nptr, __endptr);
31 }
32 
strtod_l(const char * __nptr,char ** __endptr,locale_t)33 inline _LIBCPP_HIDE_FROM_ABI_C double strtod_l(const char* __nptr, char** __endptr, locale_t) {
34   return ::strtod(__nptr, __endptr);
35 }
36 
strtold_l(const char * __nptr,char ** __endptr,locale_t)37 inline _LIBCPP_HIDE_FROM_ABI_C long double strtold_l(const char* __nptr, char** __endptr, locale_t) {
38   return ::strtold(__nptr, __endptr);
39 }
40 
strtoll_l(const char * __nptr,char ** __endptr,int __base,locale_t)41 inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
42   return ::strtoll(__nptr, __endptr, __base);
43 }
44 
45 inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
strtoull_l(const char * __nptr,char ** __endptr,int __base,locale_t)46 strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
47   return ::strtoull(__nptr, __endptr, __base);
48 }
49 
50 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
wcstoll_l(const wchar_t * __nptr,wchar_t ** __endptr,int __base,locale_t)51 inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
52   return ::wcstoll(__nptr, __endptr, __base);
53 }
54 
55 inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
wcstoull_l(const wchar_t * __nptr,wchar_t ** __endptr,int __base,locale_t)56 wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
57   return ::wcstoull(__nptr, __endptr, __base);
58 }
59 
wcstold_l(const wchar_t * __nptr,wchar_t ** __endptr,locale_t)60 inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
61   return ::wcstold(__nptr, __endptr);
62 }
63 #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif // _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
70