blob: 05131f0272ef10a00873f11b0bb1b00035f4530b [file] [log] [blame]
Marshall Clow354d39c2014-01-16 16:58:45 +00001//===----------------------------------------------------------------------===//
2//
Chandler Carruth57b08b02019-01-19 10:56:40 +00003// 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
Marshall Clow354d39c2014-01-16 16:58:45 +00006//
7//===----------------------------------------------------------------------===//
8
David Chisnall06af2bb2012-02-29 13:17:28 +00009////////////////////////////////////////////////////////////////////////////////
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
Eric Fiselier53deb602014-11-25 21:57:41 +000016#include <stdlib.h>
17
David Chisnall06af2bb2012-02-29 13:17:28 +000018#ifdef __cplusplus
19extern "C" {
20#endif
21
22
David Chisnall06af2bb2012-02-29 13:17:28 +000023int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
David Chisnall06af2bb2012-02-29 13:17:28 +000024int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
25
26int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
27
David Chisnall06af2bb2012-02-29 13:17:28 +000028int toupper_l(int __c, locale_t __l);
29int tolower_l(int __c, locale_t __l);
David Chisnall06af2bb2012-02-29 13:17:28 +000030
Eric Fiselierfbbfd092015-01-23 22:22:36 +000031struct lconv *localeconv(void);
32struct lconv *localeconv_l(locale_t __l);
David Chisnall06af2bb2012-02-29 13:17:28 +000033
34// FIXME: These are quick-and-dirty hacks to make things pretend to work
35static inline
36long long strtoll_l(const char *__nptr, char **__endptr,
37 int __base, locale_t __loc) {
38 return strtoll(__nptr, __endptr, __base);
39}
40static inline
41long strtol_l(const char *__nptr, char **__endptr,
42 int __base, locale_t __loc) {
43 return strtol(__nptr, __endptr, __base);
44}
45static inline
David Chisnall06af2bb2012-02-29 13:17:28 +000046unsigned long long strtoull_l(const char *__nptr, char **__endptr,
47 int __base, locale_t __loc) {
48 return strtoull(__nptr, __endptr, __base);
49}
50static inline
51unsigned long strtoul_l(const char *__nptr, char **__endptr,
52 int __base, locale_t __loc) {
53 return strtoul(__nptr, __endptr, __base);
54}
Eric Fiselierbe13be42016-06-19 06:58:22 +000055static inline
56float strtof_l(const char *__nptr, char **__endptr,
57 locale_t __loc) {
58 return strtof(__nptr, __endptr);
59}
60static inline
61double strtod_l(const char *__nptr, char **__endptr,
62 locale_t __loc) {
63 return strtod(__nptr, __endptr);
64}
65static inline
66long double strtold_l(const char *__nptr, char **__endptr,
67 locale_t __loc) {
68 return strtold(__nptr, __endptr);
69}
David Chisnall06af2bb2012-02-29 13:17:28 +000070
Eric Fiselierfbbfd092015-01-23 22:22:36 +000071
David Chisnall06af2bb2012-02-29 13:17:28 +000072#ifdef __cplusplus
73}
74#endif
75
76#endif