blob: 6eaf317c768a30900a20fb8cd73dcca350f7f4e4 [file] [log] [blame]
Marshall Clow98760c12014-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 Chisnallea274192012-02-29 13:17:28 +00009
10#ifdef __sun__
Eric Fiselierf51d6762015-01-23 22:22:36 +000011
Eric Fiselier6cb69ff2014-11-25 21:57:41 +000012#include "support/solaris/xlocale.h"
Eric Fiselierf51d6762015-01-23 22:22:36 +000013#include <stdarg.h>
14#include <stdio.h>
15#include <sys/localedef.h>
David Chisnallea274192012-02-29 13:17:28 +000016
Michal Gorny7c2afba2016-10-18 16:54:59 +000017extern "C" {
David Chisnallea274192012-02-29 13:17:28 +000018
Eric Fiselierf51d6762015-01-23 22:22:36 +000019int isxdigit_l(int __c, locale_t __l) {
20 return isxdigit(__c);
David Chisnallea274192012-02-29 13:17:28 +000021}
22
Michal Gornybf9e11c2016-10-18 16:54:54 +000023int iswxdigit_l(wint_t __c, locale_t __l) {
Eric Fiselierf51d6762015-01-23 22:22:36 +000024 return isxdigit(__c);
David Chisnallea274192012-02-29 13:17:28 +000025}
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 Chisnallea274192012-02-29 13:17:28 +000031int 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
40int 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
49int 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 Fiselierf51d6762015-01-23 22:22:36 +000058size_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 Chisnallea274192012-02-29 13:17:28 +000061}
62
Eric Fiselierf51d6762015-01-23 22:22:36 +000063struct lconv *localeconv_l(locale_t __l) {
64 return localeconv();
David Chisnallea274192012-02-29 13:17:28 +000065}
66
Michal Gorny7c2afba2016-10-18 16:54:59 +000067};
68
Eric Fiselierf51d6762015-01-23 22:22:36 +000069#endif // __sun__