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