blob: e86f94debe99ea5b8f85178a81728de42c5fce0a [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/*
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 */
Elliott Hughesff26a162017-08-17 22:34:21 +000028
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080029#ifndef _WCHAR_H_
30#define _WCHAR_H_
31
32#include <sys/cdefs.h>
33#include <stdio.h>
34
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080035#include <stdarg.h>
Elliott Hughes0cc0d252012-10-01 15:12:40 -070036#include <stddef.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080037#include <time.h>
Elliott Hughesb20c2442014-11-06 15:04:08 -080038#include <xlocale.h>
Elliott Hughes83c07b52014-04-21 18:09:46 -070039
Dan Alberta9e914d2023-07-21 21:41:55 +000040#include <bits/bionic_multibyte_result.h>
Elliott Hughes0fe88852016-07-27 10:45:05 -070041#include <bits/mbstate_t.h>
Elliott Hughes5704c422016-01-25 18:06:24 -080042#include <bits/wchar_limits.h>
Elliott Hughes7ba106c2016-04-28 18:22:06 -070043#include <bits/wctype.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080044
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080045__BEGIN_DECLS
46
Elliott Hughesff26a162017-08-17 22:34:21 +000047wint_t btowc(int __ch);
zijunzhao7ce2f952023-04-03 23:13:57 +000048int fwprintf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, ...);
49int fwscanf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, ...);
50wint_t fgetwc(FILE* _Nonnull __fp);
51wchar_t* _Nullable fgetws(wchar_t* _Nonnull __buf, int __size, FILE* _Nonnull __fp);
52wint_t fputwc(wchar_t __wc, FILE* _Nonnull __fp);
53int fputws(const wchar_t* _Nonnull __s, FILE* _Nonnull __fp);
54int fwide(FILE* _Nonnull __fp, int __mode);
55wint_t getwc(FILE* _Nonnull __fp);
Elliott Hughesff26a162017-08-17 22:34:21 +000056wint_t getwchar(void);
zijunzhao7ce2f952023-04-03 23:13:57 +000057int mbsinit(const mbstate_t* _Nullable __ps);
58size_t mbrlen(const char* _Nullable __s, size_t __n, mbstate_t* _Nullable __ps);
59size_t mbrtowc(wchar_t* _Nullable __buf, const char* _Nullable __s, size_t __n, mbstate_t* _Nullable __ps);
60size_t mbsrtowcs(wchar_t* _Nullable __dst, const char* _Nullable * _Nonnull __src, size_t __dst_n, mbstate_t* _Nullable __ps);
Elliott Hughes07677842024-08-23 13:56:35 +000061size_t mbsrtowcs_l(wchar_t* _Nullable __dst, const char* _Nullable * _Nonnull __src, size_t __dst_n, mbstate_t* _Nullable __ps, locale_t _Nonnull __l) __RENAME(mbsrtowcs);
Elliott Hughes655e4302023-06-16 12:39:33 -070062size_t mbsnrtowcs(wchar_t* _Nullable __dst, const char* _Nullable * _Nullable __src, size_t __src_n, size_t __dst_n, mbstate_t* _Nullable __ps);
zijunzhao7ce2f952023-04-03 23:13:57 +000063wint_t putwc(wchar_t __wc, FILE* _Nonnull __fp);
Elliott Hughesff26a162017-08-17 22:34:21 +000064wint_t putwchar(wchar_t __wc);
zijunzhao7ce2f952023-04-03 23:13:57 +000065int swprintf(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nonnull __fmt, ...);
66int swscanf(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __fmt, ...);
67wint_t ungetwc(wint_t __wc, FILE* _Nonnull __fp);
68int vfwprintf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, va_list __args);
Elliott Hughes655e4302023-06-16 12:39:33 -070069int vfwscanf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, va_list __args);
zijunzhao7ce2f952023-04-03 23:13:57 +000070int vswprintf(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nonnull __fmt, va_list __args);
Elliott Hughes655e4302023-06-16 12:39:33 -070071int vswscanf(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __fmt, va_list __args);
zijunzhao7ce2f952023-04-03 23:13:57 +000072int vwprintf(const wchar_t* _Nonnull __fmt, va_list __args);
Elliott Hughes655e4302023-06-16 12:39:33 -070073int vwscanf(const wchar_t* _Nonnull __fmt, va_list __args);
zijunzhao7ce2f952023-04-03 23:13:57 +000074wchar_t* _Nonnull wcpcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src);
75wchar_t* _Nonnull wcpncpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
76size_t wcrtomb(char* _Nullable __buf, wchar_t __wc, mbstate_t* _Nullable __ps);
77int wcscasecmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs);
78int wcscasecmp_l(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, locale_t _Nonnull __l) __INTRODUCED_IN(23);
79wchar_t* _Nonnull wcscat(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src);
80wchar_t* _Nullable wcschr(const wchar_t * _Nonnull __s, wchar_t __wc);
81int wcscmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs);
82int wcscoll(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs);
83wchar_t* _Nonnull wcscpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src);
84size_t wcscspn(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __accept);
85size_t wcsftime(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nullable __fmt, const struct tm* _Nonnull __tm);
86size_t wcsftime_l(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nullable __fmt, const struct tm* _Nonnull __tm, locale_t _Nonnull __l) __INTRODUCED_IN(28);
87size_t wcslen(const wchar_t* _Nonnull __s);
88int wcsncasecmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, size_t __n);
89int wcsncasecmp_l(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, size_t __n, locale_t _Nonnull __l) __INTRODUCED_IN(23);
90wchar_t* _Nonnull wcsncat(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
91int wcsncmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, size_t __n);
92wchar_t* _Nonnull wcsncpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
Elliott Hughes655e4302023-06-16 12:39:33 -070093size_t wcsnrtombs(char* _Nullable __dst, const wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __src, size_t __src_n, size_t __dst_n, mbstate_t* _Nullable __ps);
zijunzhao7ce2f952023-04-03 23:13:57 +000094wchar_t* _Nullable wcspbrk(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __accept);
95wchar_t* _Nullable wcsrchr(const wchar_t* _Nonnull __s, wchar_t __wc);
96size_t wcsrtombs(char* _Nullable __dst, const wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __src, size_t __dst_n, mbstate_t* _Nullable __ps);
Elliott Hughes07677842024-08-23 13:56:35 +000097size_t wcsrtombs_l(char* _Nullable __dst, const wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __src, size_t __dst_n, mbstate_t* _Nullable __ps, locale_t _Nonnull __l) __RENAME(wcsrtombs);
zijunzhao7ce2f952023-04-03 23:13:57 +000098size_t wcsspn(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __accept);
99wchar_t* _Nullable wcsstr(const wchar_t* _Nonnull __haystack, const wchar_t* _Nonnull __needle);
100double wcstod(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr);
Elliott Hughes07677842024-08-23 13:56:35 +0000101double wcstod_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, locale_t _Nonnull __l) __RENAME(wcstod);
Elliott Hughes655e4302023-06-16 12:39:33 -0700102float wcstof(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr);
Elliott Hughes07677842024-08-23 13:56:35 +0000103float wcstof_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, locale_t _Nonnull __l) __RENAME(wcstof);
zijunzhao7ce2f952023-04-03 23:13:57 +0000104wchar_t* _Nullable wcstok(wchar_t* _Nullable __s, const wchar_t* _Nonnull __delimiter, wchar_t* _Nonnull * _Nonnull __ptr);
105long wcstol(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base);
Elliott Hughes07677842024-08-23 13:56:35 +0000106long wcstol_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) __RENAME(wcstol);
Elliott Hughes655e4302023-06-16 12:39:33 -0700107long long wcstoll(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base);
108long double wcstold(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr);
zijunzhao7ce2f952023-04-03 23:13:57 +0000109unsigned long wcstoul(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base);
Elliott Hughes07677842024-08-23 13:56:35 +0000110unsigned long wcstoul_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) __RENAME(wcstoul);
Elliott Hughes655e4302023-06-16 12:39:33 -0700111unsigned long long wcstoull(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base);
zijunzhao7ce2f952023-04-03 23:13:57 +0000112int wcswidth(const wchar_t* _Nonnull __s, size_t __n);
113size_t wcsxfrm(wchar_t* __BIONIC_COMPLICATED_NULLNESS __dst, const wchar_t* _Nonnull __src, size_t __n);
Elliott Hughesff26a162017-08-17 22:34:21 +0000114int wctob(wint_t __wc);
115int wcwidth(wchar_t __wc);
zijunzhao7ce2f952023-04-03 23:13:57 +0000116wchar_t* _Nullable wmemchr(const wchar_t* _Nonnull __src, wchar_t __wc, size_t __n);
117int wmemcmp(const wchar_t* _Nullable __lhs, const wchar_t* _Nullable __rhs, size_t __n);
118wchar_t* _Nonnull wmemcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
Elliott Hughes3cfb52a2015-02-18 21:29:13 -0800119#if defined(__USE_GNU)
zijunzhao7ce2f952023-04-03 23:13:57 +0000120wchar_t* _Nonnull wmempcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n) __INTRODUCED_IN(23);
Elliott Hughes3cfb52a2015-02-18 21:29:13 -0800121#endif
zijunzhao7ce2f952023-04-03 23:13:57 +0000122wchar_t* _Nonnull wmemmove(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
123wchar_t* _Nonnull wmemset(wchar_t* _Nonnull __dst, wchar_t __wc, size_t __n);
124int wprintf(const wchar_t* _Nonnull __fmt, ...);
125int wscanf(const wchar_t* _Nonnull __fmt, ...);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800126
Elliott Hughes655e4302023-06-16 12:39:33 -0700127long long wcstoll_l(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l);
128unsigned long long wcstoull_l(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l);
129long double wcstold_l(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l);
Dan Albertdfb5ce42014-07-09 22:51:34 +0000130
Elliott Hughes655e4302023-06-16 12:39:33 -0700131int wcscoll_l(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, locale_t _Nonnull __l) __attribute_pure__;
132size_t wcsxfrm_l(wchar_t* __BIONIC_COMPLICATED_NULLNESS __dst, const wchar_t* _Nonnull __src, size_t __n, locale_t _Nonnull __l);
zijunzhao7ce2f952023-04-03 23:13:57 +0000133size_t wcslcat(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
134size_t wcslcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
Dan Albertdfb5ce42014-07-09 22:51:34 +0000135
zijunzhao7ce2f952023-04-03 23:13:57 +0000136FILE* _Nullable open_wmemstream(wchar_t* _Nonnull * _Nonnull __ptr, size_t* _Nonnull __size_ptr) __INTRODUCED_IN(23);
137wchar_t* _Nullable wcsdup(const wchar_t* _Nonnull __s);
138size_t wcsnlen(const wchar_t* _Nonnull __s, size_t __n);
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800139
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800140__END_DECLS
141
Elliott Hughesff26a162017-08-17 22:34:21 +0000142#endif