Home | History | Annotate | Download | only in xlocale
      1 // -*- C++ -*-
      2 //===-------------- support/xlocale/__strtonum_fallback.h -----------------===//
      3 //
      4 //                     The LLVM Compiler Infrastructure
      5 //
      6 // This file is dual licensed under the MIT and the University of Illinois Open
      7 // Source Licenses. See LICENSE.TXT for details.
      8 //
      9 //===----------------------------------------------------------------------===//
     10 // These are reimplementations of some extended locale functions ( *_l ) that
     11 // aren't part of POSIX.  They are widely available though (GLIBC, BSD, maybe
     12 // others).  The unifying aspect in this case is that all of these functions
     13 // convert strings to some numeric type.
     14 //===----------------------------------------------------------------------===//
     15 
     16 #ifndef _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
     17 #define _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
     18 
     19 #ifdef __cplusplus
     20 extern "C" {
     21 #endif
     22 
     23 inline _LIBCPP_ALWAYS_INLINE float strtof_l(const char *nptr,
     24                                             char **endptr, locale_t) {
     25   return ::strtof(nptr, endptr);
     26 }
     27 
     28 inline _LIBCPP_ALWAYS_INLINE double strtod_l(const char *nptr,
     29                                                    char **endptr, locale_t) {
     30   return ::strtod(nptr, endptr);
     31 }
     32 
     33 inline _LIBCPP_ALWAYS_INLINE long double strtold_l(const char *nptr,
     34                                                    char **endptr, locale_t) {
     35   return ::strtold(nptr, endptr);
     36 }
     37 
     38 inline _LIBCPP_ALWAYS_INLINE long long
     39 strtoll_l(const char *nptr, char **endptr, int base, locale_t) {
     40   return ::strtoll(nptr, endptr, base);
     41 }
     42 
     43 inline _LIBCPP_ALWAYS_INLINE unsigned long long
     44 strtoull_l(const char *nptr, char **endptr, int base, locale_t) {
     45   return ::strtoull(nptr, endptr, base);
     46 }
     47 
     48 inline _LIBCPP_ALWAYS_INLINE long long
     49 wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
     50   return ::wcstoll(nptr, endptr, base);
     51 }
     52 
     53 inline _LIBCPP_ALWAYS_INLINE unsigned long long
     54 wcstoull_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
     55   return ::wcstoull(nptr, endptr, base);
     56 }
     57 
     58 inline _LIBCPP_ALWAYS_INLINE long double wcstold_l(const wchar_t *nptr,
     59                                                    wchar_t **endptr, locale_t) {
     60   return ::wcstold(nptr, endptr);
     61 }
     62 
     63 #ifdef __cplusplus
     64 }
     65 #endif
     66 
     67 #endif // _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
     68