Marshall Clow | 98760c1 | 2014-01-16 16:58:45 +0000 | [diff] [blame] | 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 | //===----------------------------------------------------------------------===// |
David Chisnall | ea27419 | 2012-02-29 13:17:28 +0000 | [diff] [blame] | 9 | |
| 10 | #ifdef __sun__ |
Eric Fiselier | f51d676 | 2015-01-23 22:22:36 +0000 | [diff] [blame] | 11 | |
Eric Fiselier | 6cb69ff | 2014-11-25 21:57:41 +0000 | [diff] [blame] | 12 | #include "support/solaris/xlocale.h" |
Eric Fiselier | f51d676 | 2015-01-23 22:22:36 +0000 | [diff] [blame] | 13 | #include <stdarg.h> |
| 14 | #include <stdio.h> |
| 15 | #include <sys/localedef.h> |
David Chisnall | ea27419 | 2012-02-29 13:17:28 +0000 | [diff] [blame] | 16 | |
Michal Gorny | 7c2afba | 2016-10-18 16:54:59 +0000 | [diff] [blame] | 17 | extern "C" { |
David Chisnall | ea27419 | 2012-02-29 13:17:28 +0000 | [diff] [blame] | 18 | |
Eric Fiselier | f51d676 | 2015-01-23 22:22:36 +0000 | [diff] [blame] | 19 | int isxdigit_l(int __c, locale_t __l) { |
| 20 | return isxdigit(__c); |
David Chisnall | ea27419 | 2012-02-29 13:17:28 +0000 | [diff] [blame] | 21 | } |
| 22 | |
Michal Gorny | bf9e11c | 2016-10-18 16:54:54 +0000 | [diff] [blame] | 23 | int iswxdigit_l(wint_t __c, locale_t __l) { |
Eric Fiselier | f51d676 | 2015-01-23 22:22:36 +0000 | [diff] [blame] | 24 | return isxdigit(__c); |
David Chisnall | ea27419 | 2012-02-29 13:17:28 +0000 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | // FIXME: This disregards the locale, which is Very Wrong |
| 28 | #define vsnprintf_l(__s, __n, __l, __format, __va) \ |
| 29 | vsnprintf(__s, __n, __format, __va) |
| 30 | |
David Chisnall | ea27419 | 2012-02-29 13:17:28 +0000 | [diff] [blame] | 31 | int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) |
| 32 | { |
| 33 | va_list __va; |
| 34 | va_start(__va, __format); |
| 35 | int __res = vsnprintf_l(__s, __n , __l, __format, __va); |
| 36 | va_end(__va); |
| 37 | return __res; |
| 38 | } |
| 39 | |
| 40 | int asprintf_l(char **__s, locale_t __l, const char *__format, ...) { |
| 41 | va_list __va; |
| 42 | va_start(__va, __format); |
| 43 | // FIXME: |
| 44 | int __res = vasprintf(__s, __format, __va); |
| 45 | va_end(__va); |
| 46 | return __res; |
| 47 | } |
| 48 | |
| 49 | int sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { |
| 50 | va_list __va; |
| 51 | va_start(__va, __format); |
| 52 | // FIXME: |
| 53 | int __res = vsscanf(__s, __format, __va); |
| 54 | va_end(__va); |
| 55 | return __res; |
| 56 | } |
| 57 | |
Eric Fiselier | f51d676 | 2015-01-23 22:22:36 +0000 | [diff] [blame] | 58 | size_t mbrtowc_l(wchar_t *__pwc, const char *__pmb, |
| 59 | size_t __max, mbstate_t *__ps, locale_t __loc) { |
| 60 | return mbrtowc(__pwc, __pmb, __max, __ps); |
David Chisnall | ea27419 | 2012-02-29 13:17:28 +0000 | [diff] [blame] | 61 | } |
| 62 | |
Eric Fiselier | f51d676 | 2015-01-23 22:22:36 +0000 | [diff] [blame] | 63 | struct lconv *localeconv_l(locale_t __l) { |
| 64 | return localeconv(); |
David Chisnall | ea27419 | 2012-02-29 13:17:28 +0000 | [diff] [blame] | 65 | } |
| 66 | |
Michal Gorny | 7c2afba | 2016-10-18 16:54:59 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
Eric Fiselier | f51d676 | 2015-01-23 22:22:36 +0000 | [diff] [blame] | 69 | #endif // __sun__ |