blob: 9125eea73777f5fbf5e3b89dbc13f854ba8a980e [file] [log] [blame]
Marshall Clow354d39c2014-01-16 16:58:45 +00001//===----------------------------------------------------------------------===//
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 Chisnall06af2bb2012-02-29 13:17:28 +00009
10#ifdef __sun__
Eric Fiselierfbbfd092015-01-23 22:22:36 +000011
Eric Fiselier53deb602014-11-25 21:57:41 +000012#include "support/solaris/xlocale.h"
Eric Fiselierfbbfd092015-01-23 22:22:36 +000013#include <stdarg.h>
14#include <stdio.h>
15#include <sys/localedef.h>
David Chisnall06af2bb2012-02-29 13:17:28 +000016
David Chisnall06af2bb2012-02-29 13:17:28 +000017
Eric Fiselierfbbfd092015-01-23 22:22:36 +000018int isxdigit_l(int __c, locale_t __l) {
19 return isxdigit(__c);
David Chisnall06af2bb2012-02-29 13:17:28 +000020}
21
Eric Fiselierfbbfd092015-01-23 22:22:36 +000022int iswxdigit_l(wchar_t __c, locale_t __l) {
23 return isxdigit(__c);
David Chisnall06af2bb2012-02-29 13:17:28 +000024}
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 Chisnall06af2bb2012-02-29 13:17:28 +000030int 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
39int 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
48int 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 Fiselierfbbfd092015-01-23 22:22:36 +000057size_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 Chisnall06af2bb2012-02-29 13:17:28 +000060}
61
Eric Fiselierfbbfd092015-01-23 22:22:36 +000062struct lconv *localeconv_l(locale_t __l) {
63 return localeconv();
David Chisnall06af2bb2012-02-29 13:17:28 +000064}
65
Eric Fiselierfbbfd092015-01-23 22:22:36 +000066#endif // __sun__