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