1/*
2 * Copyright (C) 2008 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *  * Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 *  * Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in
12 *    the documentation and/or other materials provided with the
13 *    distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#ifndef _WCHAR_H_
30#define _WCHAR_H_
31
32#include <sys/cdefs.h>
33#include <stdio.h>
34
35#include <stdarg.h>
36#include <stddef.h>
37#include <time.h>
38#include <xlocale.h>
39
40#include <bits/mbstate_t.h>
41#include <bits/wchar_limits.h>
42#include <bits/wctype.h>
43
44__BEGIN_DECLS
45
46wint_t btowc(int __ch);
47int fwprintf(FILE* __fp, const wchar_t* __fmt, ...);
48int fwscanf(FILE* __fp, const wchar_t* __fmt, ...);
49wint_t fgetwc(FILE* __fp);
50wchar_t* fgetws(wchar_t* __buf, int __size, FILE* __fp);
51wint_t fputwc(wchar_t __wc, FILE* __fp);
52int fputws(const wchar_t* __s, FILE* __fp);
53int fwide(FILE* __fp, int __mode);
54wint_t getwc(FILE* __fp);
55wint_t getwchar(void);
56int mbsinit(const mbstate_t* __ps);
57size_t mbrlen(const char* __s, size_t __n, mbstate_t* __ps);
58size_t mbrtowc(wchar_t* __buf, const char* __s, size_t __n, mbstate_t* __ps);
59size_t mbsrtowcs(wchar_t* __dst, const char** __src, size_t __dst_n, mbstate_t* __ps);
60size_t mbsnrtowcs(wchar_t* __dst, const char** __src, size_t __src_n, size_t __dst_n, mbstate_t* __ps) __INTRODUCED_IN(21);
61wint_t putwc(wchar_t __wc, FILE* __fp);
62wint_t putwchar(wchar_t __wc);
63int swprintf(wchar_t* __buf, size_t __n, const wchar_t* __fmt, ...);
64int swscanf(const wchar_t* __s, const wchar_t* __fmt, ...);
65wint_t ungetwc(wint_t __wc, FILE* __fp);
66int vfwprintf(FILE* __fp, const wchar_t* __fmt, va_list __args);
67int vfwscanf(FILE* __fp, const wchar_t* __fmt, va_list __args) __INTRODUCED_IN(21);
68int vswprintf(wchar_t* __buf, size_t __n, const wchar_t* __fmt, va_list __args);
69int vswscanf(const wchar_t* __s, const wchar_t* __fmt, va_list __args) __INTRODUCED_IN(21);
70int vwprintf(const wchar_t* __fmt, va_list __args);
71int vwscanf(const wchar_t* __fmt, va_list __args) __INTRODUCED_IN(21);
72wchar_t* wcpcpy(wchar_t* __dst, const wchar_t* __src);
73wchar_t* wcpncpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
74size_t wcrtomb(char* __buf, wchar_t __wc, mbstate_t* __ps);
75int wcscasecmp(const wchar_t* __lhs, const wchar_t* __rhs);
76int wcscasecmp_l(const wchar_t* __lhs, const wchar_t* __rhs, locale_t __l) __INTRODUCED_IN(23);
77wchar_t* wcscat(wchar_t* __dst, const wchar_t* __src);
78wchar_t* wcschr(const wchar_t* __s, wchar_t __wc);
79int wcscmp(const wchar_t* __lhs, const wchar_t* __rhs);
80int wcscoll(const wchar_t* __lhs, const wchar_t* __rhs);
81wchar_t* wcscpy(wchar_t* __dst, const wchar_t* __src);
82size_t wcscspn(const wchar_t* __s, const wchar_t* __accept);
83size_t wcsftime(wchar_t* __buf, size_t __n, const wchar_t* __fmt, const struct tm* __tm);
84size_t wcsftime_l(wchar_t* __buf, size_t __n, const wchar_t* __fmt, const struct tm* __tm, locale_t __l) __INTRODUCED_IN(28);
85size_t wcslen(const wchar_t* __s);
86int wcsncasecmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
87int wcsncasecmp_l(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n, locale_t __l) __INTRODUCED_IN(23);
88wchar_t* wcsncat(wchar_t* __dst, const wchar_t* __src, size_t __n);
89int wcsncmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
90wchar_t* wcsncpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
91size_t wcsnrtombs(char* __dst, const wchar_t** __src, size_t __src_n, size_t __dst_n, mbstate_t* __ps) __INTRODUCED_IN(21);
92wchar_t* wcspbrk(const wchar_t* __s, const wchar_t* __accept);
93wchar_t* wcsrchr(const wchar_t* __s, wchar_t __wc);
94size_t wcsrtombs(char* __dst, const wchar_t** __src, size_t __dst_n, mbstate_t* __ps);
95size_t wcsspn(const wchar_t* __s, const wchar_t* __accept);
96wchar_t* wcsstr(const wchar_t* __haystack, const wchar_t* __needle);
97double wcstod(const wchar_t* __s, wchar_t** __end_ptr);
98double wcstod_l(const wchar_t* __s, wchar_t** __end_ptr, locale_t __l) __INTRODUCED_IN(28);
99float wcstof(const wchar_t* __s, wchar_t** __end_ptr) __INTRODUCED_IN(21);
100float wcstof_l(const wchar_t* __s, wchar_t** __end_ptr, locale_t __l) __INTRODUCED_IN(28);
101wchar_t* wcstok(wchar_t* __s, const wchar_t* __delimiter, wchar_t** __ptr);
102long wcstol(const wchar_t* __s, wchar_t** __end_ptr, int __base);
103long wcstol_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(28);
104long long wcstoll(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
105long double wcstold(const wchar_t* __s, wchar_t** __end_ptr) __RENAME_LDBL(wcstod, 3, 21);
106unsigned long wcstoul(const wchar_t* __s, wchar_t** __end_ptr, int __base);
107unsigned long wcstoul_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(28);
108unsigned long long wcstoull(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
109int wcswidth(const wchar_t* __s, size_t __n);
110size_t wcsxfrm(wchar_t* __dst, const wchar_t* __src, size_t __n);
111int wctob(wint_t __wc);
112int wcwidth(wchar_t __wc);
113wchar_t* wmemchr(const wchar_t* __src, wchar_t __wc, size_t __n);
114int wmemcmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
115wchar_t* wmemcpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
116#if defined(__USE_GNU)
117wchar_t* wmempcpy(wchar_t* __dst, const wchar_t* __src, size_t __n) __INTRODUCED_IN(23);
118#endif
119wchar_t* wmemmove(wchar_t* __dst, const wchar_t* __src, size_t __n);
120wchar_t* wmemset(wchar_t* __dst, wchar_t __wc, size_t __n);
121int wprintf(const wchar_t* __fmt, ...);
122int wscanf(const wchar_t* __fmt, ...);
123
124#if __ANDROID_API__ >= __ANDROID_API_L__
125long long wcstoll_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
126unsigned long long wcstoull_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
127long double wcstold_l(const wchar_t* __s, wchar_t** __end_ptr, locale_t __l) __INTRODUCED_IN(21);
128
129int wcscoll_l(const wchar_t* __lhs, const wchar_t* __rhs, locale_t __l) __attribute_pure__
130    __INTRODUCED_IN(21);
131size_t wcsxfrm_l(wchar_t* __dst, const wchar_t* __src, size_t __n, locale_t __l) __INTRODUCED_IN(21);
132#else
133// Implemented as static inlines before 21.
134#endif
135
136size_t wcslcat(wchar_t* __dst, const wchar_t* __src, size_t __n);
137size_t wcslcpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
138
139FILE* open_wmemstream(wchar_t** __ptr, size_t* __size_ptr) __INTRODUCED_IN(23);
140wchar_t* wcsdup(const wchar_t* __s);
141size_t wcsnlen(const wchar_t* __s, size_t __n);
142
143__END_DECLS
144
145#endif
146