blob: 62b0d74a6d23f1aa91b5a10ec5d68b0647bf9c21 [file] [log] [blame]
Marshall Clow354d39c2014-01-16 16:58:45 +00001//===----------------------------------------------------------------------===//
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
David Chisnall06af2bb2012-02-29 13:17:28 +000010////////////////////////////////////////////////////////////////////////////////
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
Eric Fiselier53deb602014-11-25 21:57:41 +000017#include <stdlib.h>
18
David Chisnall06af2bb2012-02-29 13:17:28 +000019#ifdef __cplusplus
20extern "C" {
21#endif
22
23
David Chisnall06af2bb2012-02-29 13:17:28 +000024int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
David Chisnall06af2bb2012-02-29 13:17:28 +000025int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
26
27int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
28
David Chisnall06af2bb2012-02-29 13:17:28 +000029int toupper_l(int __c, locale_t __l);
30int tolower_l(int __c, locale_t __l);
David Chisnall06af2bb2012-02-29 13:17:28 +000031
Eric Fiselierfbbfd092015-01-23 22:22:36 +000032struct lconv *localeconv(void);
33struct lconv *localeconv_l(locale_t __l);
David Chisnall06af2bb2012-02-29 13:17:28 +000034
35// FIXME: These are quick-and-dirty hacks to make things pretend to work
36static inline
37long long strtoll_l(const char *__nptr, char **__endptr,
38 int __base, locale_t __loc) {
39 return strtoll(__nptr, __endptr, __base);
40}
41static inline
42long strtol_l(const char *__nptr, char **__endptr,
43 int __base, locale_t __loc) {
44 return strtol(__nptr, __endptr, __base);
45}
46static inline
47long double strtold_l(const char *__nptr, char **__endptr,
48 locale_t __loc) {
49 return strtold(__nptr, __endptr);
50}
51static inline
52unsigned long long strtoull_l(const char *__nptr, char **__endptr,
53 int __base, locale_t __loc) {
54 return strtoull(__nptr, __endptr, __base);
55}
56static inline
57unsigned long strtoul_l(const char *__nptr, char **__endptr,
58 int __base, locale_t __loc) {
59 return strtoul(__nptr, __endptr, __base);
60}
61
Eric Fiselierfbbfd092015-01-23 22:22:36 +000062
David Chisnall06af2bb2012-02-29 13:17:28 +000063#ifdef __cplusplus
64}
65#endif
66
67#endif