Will Osborn | 01c46f3 | 2020-04-21 09:13:26 +0100 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | //////////////////////////////////////////////////////////////////////////////// |
| 10 | // Minimal xlocale implementation for Solaris. This implements the subset of |
| 11 | // the xlocale APIs that libc++ depends on. |
| 12 | //////////////////////////////////////////////////////////////////////////////// |
| 13 | #ifndef __XLOCALE_H_INCLUDED |
| 14 | #define __XLOCALE_H_INCLUDED |
| 15 | |
| 16 | #include <stdlib.h> |
| 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
| 22 | |
| 23 | int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...); |
| 24 | int asprintf_l(char **__s, locale_t __l, const char *__format, ...); |
| 25 | |
| 26 | int sscanf_l(const char *__s, locale_t __l, const char *__format, ...); |
| 27 | |
| 28 | int toupper_l(int __c, locale_t __l); |
| 29 | int tolower_l(int __c, locale_t __l); |
| 30 | |
| 31 | struct lconv *localeconv(void); |
| 32 | struct lconv *localeconv_l(locale_t __l); |
| 33 | |
| 34 | // FIXME: These are quick-and-dirty hacks to make things pretend to work |
| 35 | static inline |
| 36 | long long strtoll_l(const char *__nptr, char **__endptr, |
| 37 | int __base, locale_t __loc) { |
| 38 | return strtoll(__nptr, __endptr, __base); |
| 39 | } |
| 40 | static inline |
| 41 | long strtol_l(const char *__nptr, char **__endptr, |
| 42 | int __base, locale_t __loc) { |
| 43 | return strtol(__nptr, __endptr, __base); |
| 44 | } |
| 45 | static inline |
| 46 | unsigned long long strtoull_l(const char *__nptr, char **__endptr, |
| 47 | int __base, locale_t __loc) { |
| 48 | return strtoull(__nptr, __endptr, __base); |
| 49 | } |
| 50 | static inline |
| 51 | unsigned long strtoul_l(const char *__nptr, char **__endptr, |
| 52 | int __base, locale_t __loc) { |
| 53 | return strtoul(__nptr, __endptr, __base); |
| 54 | } |
| 55 | static inline |
| 56 | float strtof_l(const char *__nptr, char **__endptr, |
| 57 | locale_t __loc) { |
| 58 | return strtof(__nptr, __endptr); |
| 59 | } |
| 60 | static inline |
| 61 | double strtod_l(const char *__nptr, char **__endptr, |
| 62 | locale_t __loc) { |
| 63 | return strtod(__nptr, __endptr); |
| 64 | } |
| 65 | static inline |
| 66 | long double strtold_l(const char *__nptr, char **__endptr, |
| 67 | locale_t __loc) { |
| 68 | return strtold(__nptr, __endptr); |
| 69 | } |
| 70 | |
| 71 | |
| 72 | #ifdef __cplusplus |
| 73 | } |
| 74 | #endif |
| 75 | |
| 76 | #endif |