xlocale.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. ////////////////////////////////////////////////////////////////////////////////
  10. // Minimal xlocale implementation for Solaris. This implements the subset of
  11. // the xlocale APIs that libc++ depends on.
  12. ////////////////////////////////////////////////////////////////////////////////
  13. #ifndef __XLOCALE_H_INCLUDED
  14. #define __XLOCALE_H_INCLUDED
  15. #include <stdlib.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
  20. int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
  21. int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
  22. int toupper_l(int __c, locale_t __l);
  23. int tolower_l(int __c, locale_t __l);
  24. struct lconv *localeconv(void);
  25. struct lconv *localeconv_l(locale_t __l);
  26. // FIXME: These are quick-and-dirty hacks to make things pretend to work
  27. static inline
  28. long long strtoll_l(const char *__nptr, char **__endptr,
  29. int __base, locale_t __loc) {
  30. return strtoll(__nptr, __endptr, __base);
  31. }
  32. static inline
  33. long strtol_l(const char *__nptr, char **__endptr,
  34. int __base, locale_t __loc) {
  35. return strtol(__nptr, __endptr, __base);
  36. }
  37. static inline
  38. unsigned long long strtoull_l(const char *__nptr, char **__endptr,
  39. int __base, locale_t __loc) {
  40. return strtoull(__nptr, __endptr, __base);
  41. }
  42. static inline
  43. unsigned long strtoul_l(const char *__nptr, char **__endptr,
  44. int __base, locale_t __loc) {
  45. return strtoul(__nptr, __endptr, __base);
  46. }
  47. static inline
  48. float strtof_l(const char *__nptr, char **__endptr,
  49. locale_t __loc) {
  50. return strtof(__nptr, __endptr);
  51. }
  52. static inline
  53. double strtod_l(const char *__nptr, char **__endptr,
  54. locale_t __loc) {
  55. return strtod(__nptr, __endptr);
  56. }
  57. static inline
  58. long double strtold_l(const char *__nptr, char **__endptr,
  59. locale_t __loc) {
  60. return strtold(__nptr, __endptr);
  61. }
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif