__strtonum_fallback.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #ifndef _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
  16. #define _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. inline _LIBCPP_ALWAYS_INLINE float strtof_l(const char *nptr,
  21. char **endptr, locale_t) {
  22. return ::strtof(nptr, endptr);
  23. }
  24. inline _LIBCPP_ALWAYS_INLINE double strtod_l(const char *nptr,
  25. char **endptr, locale_t) {
  26. return ::strtod(nptr, endptr);
  27. }
  28. inline _LIBCPP_ALWAYS_INLINE long double strtold_l(const char *nptr,
  29. char **endptr, locale_t) {
  30. return ::strtold(nptr, endptr);
  31. }
  32. inline _LIBCPP_ALWAYS_INLINE long long
  33. strtoll_l(const char *nptr, char **endptr, int base, locale_t) {
  34. return ::strtoll(nptr, endptr, base);
  35. }
  36. inline _LIBCPP_ALWAYS_INLINE unsigned long long
  37. strtoull_l(const char *nptr, char **endptr, int base, locale_t) {
  38. return ::strtoull(nptr, endptr, base);
  39. }
  40. inline _LIBCPP_ALWAYS_INLINE long long
  41. wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
  42. return ::wcstoll(nptr, endptr, base);
  43. }
  44. inline _LIBCPP_ALWAYS_INLINE unsigned long long
  45. wcstoull_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
  46. return ::wcstoull(nptr, endptr, base);
  47. }
  48. inline _LIBCPP_ALWAYS_INLINE long double wcstold_l(const wchar_t *nptr,
  49. wchar_t **endptr, locale_t) {
  50. return ::wcstold(nptr, endptr);
  51. }
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif // _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H