xlocale.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. ////////////////////////////////////////////////////////////////////////////////
  9. // Minimal xlocale implementation for Solaris. This implements the subset of
  10. // the xlocale APIs that libc++ depends on.
  11. ////////////////////////////////////////////////////////////////////////////////
  12. #ifndef __XLOCALE_H_INCLUDED
  13. #define __XLOCALE_H_INCLUDED
  14. #include <stdlib.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
  19. int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
  20. int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
  21. int toupper_l(int __c, locale_t __l);
  22. int tolower_l(int __c, locale_t __l);
  23. struct lconv *localeconv(void);
  24. struct lconv *localeconv_l(locale_t __l);
  25. // FIXME: These are quick-and-dirty hacks to make things pretend to work
  26. inline _LIBCPP_HIDE_FROM_ABI long long
  27. strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) {
  28. return ::strtoll(__nptr, __endptr, __base);
  29. }
  30. inline _LIBCPP_HIDE_FROM_ABI long
  31. strtol_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) {
  32. return ::strtol(__nptr, __endptr, __base);
  33. }
  34. inline _LIBCPP_HIDE_FROM_ABI unsigned long long
  35. strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t __loc)
  36. return ::strtoull(__nptr, __endptr, __base);
  37. }
  38. inline _LIBCPP_HIDE_FROM_ABI unsigned long
  39. strtoul_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) {
  40. return ::strtoul(__nptr, __endptr, __base);
  41. }
  42. inline _LIBCPP_HIDE_FROM_ABI float
  43. strtof_l(const char *__nptr, char **__endptr, locale_t __loc) {
  44. return ::strtof(__nptr, __endptr);
  45. }
  46. inline _LIBCPP_HIDE_FROM_ABI double
  47. strtod_l(const char *__nptr, char **__endptr, locale_t __loc) {
  48. return ::strtod(__nptr, __endptr);
  49. }
  50. inline _LIBCPP_HIDE_FROM_ABI long double
  51. strtold_l(const char *__nptr, char **__endptr, locale_t __loc) {
  52. return ::strtold(__nptr, __endptr);
  53. }
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif