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 ////////////////////////////////////////////////////////////////////////////////
     11 // Minimal xlocale implementation for Solaris.  This implements the subset of
     12 // the xlocale APIs that libc++ depends on.
     13 ////////////////////////////////////////////////////////////////////////////////
     14 #ifndef __XLOCALE_H_INCLUDED
     15 #define __XLOCALE_H_INCLUDED
     16 
     17 #include <stdlib.h>
     18 
     19 #ifdef __cplusplus
     20 extern "C" {
     21 #endif
     22 
     23 
     24 int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
     25 int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
     26 
     27 int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
     28 
     29 int toupper_l(int __c, locale_t __l);
     30 int tolower_l(int __c, locale_t __l);
     31 
     32 struct lconv *localeconv(void);
     33 struct lconv *localeconv_l(locale_t __l);
     34 
     35 // FIXME: These are quick-and-dirty hacks to make things pretend to work
     36 static inline
     37 long long strtoll_l(const char *__nptr, char **__endptr,
     38     int __base, locale_t __loc) {
     39   return strtoll(__nptr, __endptr, __base);
     40 }
     41 static inline
     42 long strtol_l(const char *__nptr, char **__endptr,
     43     int __base, locale_t __loc) {
     44   return strtol(__nptr, __endptr, __base);
     45 }
     46 static inline
     47 unsigned long long strtoull_l(const char *__nptr, char **__endptr,
     48     int __base, locale_t __loc) {
     49   return strtoull(__nptr, __endptr, __base);
     50 }
     51 static inline
     52 unsigned long strtoul_l(const char *__nptr, char **__endptr,
     53     int __base, locale_t __loc) {
     54   return strtoul(__nptr, __endptr, __base);
     55 }
     56 static inline
     57 float strtof_l(const char *__nptr, char **__endptr,
     58     locale_t __loc) {
     59   return strtof(__nptr, __endptr);
     60 }
     61 static inline
     62 double strtod_l(const char *__nptr, char **__endptr,
     63     locale_t __loc) {
     64   return strtod(__nptr, __endptr);
     65 }
     66 static inline
     67 long double strtold_l(const char *__nptr, char **__endptr,
     68     locale_t __loc) {
     69   return strtold(__nptr, __endptr);
     70 }
     71 
     72 
     73 #ifdef __cplusplus
     74 }
     75 #endif
     76 
     77 #endif
     78