Home | History | Annotate | Download | only in solaris
      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 #ifdef __sun__
     11 
     12 #include "support/solaris/xlocale.h"
     13 #include <stdarg.h>
     14 #include <stdio.h>
     15 #include <sys/localedef.h>
     16 
     17 
     18 int isxdigit_l(int __c, locale_t __l) {
     19     return isxdigit(__c);
     20 }
     21 
     22 int iswxdigit_l(wchar_t __c, locale_t __l) {
     23     return isxdigit(__c);
     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 
     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 
     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);
     60 }
     61 
     62 struct lconv *localeconv_l(locale_t __l) {
     63   return localeconv();
     64 }
     65 
     66 #endif // __sun__
     67