xlocale.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. static inline
  27. long long strtoll_l(const char *__nptr, char **__endptr,
  28. int __base, locale_t __loc) {
  29. return strtoll(__nptr, __endptr, __base);
  30. }
  31. static inline
  32. long strtol_l(const char *__nptr, char **__endptr,
  33. int __base, locale_t __loc) {
  34. return strtol(__nptr, __endptr, __base);
  35. }
  36. static inline
  37. unsigned long long strtoull_l(const char *__nptr, char **__endptr,
  38. int __base, locale_t __loc) {
  39. return strtoull(__nptr, __endptr, __base);
  40. }
  41. static inline
  42. unsigned long strtoul_l(const char *__nptr, char **__endptr,
  43. int __base, locale_t __loc) {
  44. return strtoul(__nptr, __endptr, __base);
  45. }
  46. static inline
  47. float strtof_l(const char *__nptr, char **__endptr,
  48. locale_t __loc) {
  49. return strtof(__nptr, __endptr);
  50. }
  51. static inline
  52. double strtod_l(const char *__nptr, char **__endptr,
  53. locale_t __loc) {
  54. return strtod(__nptr, __endptr);
  55. }
  56. static inline
  57. long double strtold_l(const char *__nptr, char **__endptr,
  58. locale_t __loc) {
  59. return strtold(__nptr, __endptr);
  60. }
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif