The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 | */ |
Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 28 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | #ifndef _WCHAR_H_ |
| 30 | #define _WCHAR_H_ |
| 31 | |
| 32 | #include <sys/cdefs.h> |
| 33 | #include <stdio.h> |
| 34 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 35 | #include <stdarg.h> |
Elliott Hughes | 0cc0d25 | 2012-10-01 15:12:40 -0700 | [diff] [blame] | 36 | #include <stddef.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 37 | #include <time.h> |
Elliott Hughes | b20c244 | 2014-11-06 15:04:08 -0800 | [diff] [blame] | 38 | #include <xlocale.h> |
Elliott Hughes | 83c07b5 | 2014-04-21 18:09:46 -0700 | [diff] [blame] | 39 | |
Dan Albert | a9e914d | 2023-07-21 21:41:55 +0000 | [diff] [blame] | 40 | #include <bits/bionic_multibyte_result.h> |
Elliott Hughes | 0fe8885 | 2016-07-27 10:45:05 -0700 | [diff] [blame] | 41 | #include <bits/mbstate_t.h> |
Elliott Hughes | 5704c42 | 2016-01-25 18:06:24 -0800 | [diff] [blame] | 42 | #include <bits/wchar_limits.h> |
Elliott Hughes | 7ba106c | 2016-04-28 18:22:06 -0700 | [diff] [blame] | 43 | #include <bits/wctype.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 44 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 45 | __BEGIN_DECLS |
| 46 | |
Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 47 | wint_t btowc(int __ch); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 48 | int fwprintf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, ...); |
| 49 | int fwscanf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, ...); |
| 50 | wint_t fgetwc(FILE* _Nonnull __fp); |
| 51 | wchar_t* _Nullable fgetws(wchar_t* _Nonnull __buf, int __size, FILE* _Nonnull __fp); |
| 52 | wint_t fputwc(wchar_t __wc, FILE* _Nonnull __fp); |
| 53 | int fputws(const wchar_t* _Nonnull __s, FILE* _Nonnull __fp); |
| 54 | int fwide(FILE* _Nonnull __fp, int __mode); |
| 55 | wint_t getwc(FILE* _Nonnull __fp); |
Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 56 | wint_t getwchar(void); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 57 | int mbsinit(const mbstate_t* _Nullable __ps); |
| 58 | size_t mbrlen(const char* _Nullable __s, size_t __n, mbstate_t* _Nullable __ps); |
| 59 | size_t mbrtowc(wchar_t* _Nullable __buf, const char* _Nullable __s, size_t __n, mbstate_t* _Nullable __ps); |
| 60 | size_t mbsrtowcs(wchar_t* _Nullable __dst, const char* _Nullable * _Nonnull __src, size_t __dst_n, mbstate_t* _Nullable __ps); |
Elliott Hughes | 0767784 | 2024-08-23 13:56:35 +0000 | [diff] [blame] | 61 | size_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 Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 62 | size_t mbsnrtowcs(wchar_t* _Nullable __dst, const char* _Nullable * _Nullable __src, size_t __src_n, size_t __dst_n, mbstate_t* _Nullable __ps); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 63 | wint_t putwc(wchar_t __wc, FILE* _Nonnull __fp); |
Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 64 | wint_t putwchar(wchar_t __wc); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 65 | int swprintf(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nonnull __fmt, ...); |
| 66 | int swscanf(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __fmt, ...); |
| 67 | wint_t ungetwc(wint_t __wc, FILE* _Nonnull __fp); |
| 68 | int vfwprintf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, va_list __args); |
Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 69 | int vfwscanf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, va_list __args); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 70 | int vswprintf(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nonnull __fmt, va_list __args); |
Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 71 | int vswscanf(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __fmt, va_list __args); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 72 | int vwprintf(const wchar_t* _Nonnull __fmt, va_list __args); |
Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 73 | int vwscanf(const wchar_t* _Nonnull __fmt, va_list __args); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 74 | wchar_t* _Nonnull wcpcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src); |
| 75 | wchar_t* _Nonnull wcpncpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n); |
| 76 | size_t wcrtomb(char* _Nullable __buf, wchar_t __wc, mbstate_t* _Nullable __ps); |
| 77 | int wcscasecmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs); |
Dan Albert | 02ce401 | 2024-10-25 19:13:49 +0000 | [diff] [blame^] | 78 | |
| 79 | #if __BIONIC_AVAILABILITY_GUARD(23) |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 80 | int wcscasecmp_l(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, locale_t _Nonnull __l) __INTRODUCED_IN(23); |
Dan Albert | 02ce401 | 2024-10-25 19:13:49 +0000 | [diff] [blame^] | 81 | #endif /* __BIONIC_AVAILABILITY_GUARD(23) */ |
| 82 | |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 83 | wchar_t* _Nonnull wcscat(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src); |
| 84 | wchar_t* _Nullable wcschr(const wchar_t * _Nonnull __s, wchar_t __wc); |
| 85 | int wcscmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs); |
| 86 | int wcscoll(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs); |
| 87 | wchar_t* _Nonnull wcscpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src); |
| 88 | size_t wcscspn(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __accept); |
| 89 | size_t wcsftime(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nullable __fmt, const struct tm* _Nonnull __tm); |
Dan Albert | 02ce401 | 2024-10-25 19:13:49 +0000 | [diff] [blame^] | 90 | |
| 91 | #if __BIONIC_AVAILABILITY_GUARD(28) |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 92 | size_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); |
Dan Albert | 02ce401 | 2024-10-25 19:13:49 +0000 | [diff] [blame^] | 93 | #endif /* __BIONIC_AVAILABILITY_GUARD(28) */ |
| 94 | |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 95 | size_t wcslen(const wchar_t* _Nonnull __s); |
| 96 | int wcsncasecmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, size_t __n); |
Dan Albert | 02ce401 | 2024-10-25 19:13:49 +0000 | [diff] [blame^] | 97 | |
| 98 | #if __BIONIC_AVAILABILITY_GUARD(23) |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 99 | int wcsncasecmp_l(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, size_t __n, locale_t _Nonnull __l) __INTRODUCED_IN(23); |
Dan Albert | 02ce401 | 2024-10-25 19:13:49 +0000 | [diff] [blame^] | 100 | #endif /* __BIONIC_AVAILABILITY_GUARD(23) */ |
| 101 | |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 102 | wchar_t* _Nonnull wcsncat(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n); |
| 103 | int wcsncmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, size_t __n); |
| 104 | wchar_t* _Nonnull wcsncpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n); |
Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 105 | size_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); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 106 | wchar_t* _Nullable wcspbrk(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __accept); |
| 107 | wchar_t* _Nullable wcsrchr(const wchar_t* _Nonnull __s, wchar_t __wc); |
| 108 | size_t wcsrtombs(char* _Nullable __dst, const wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __src, size_t __dst_n, mbstate_t* _Nullable __ps); |
Elliott Hughes | 0767784 | 2024-08-23 13:56:35 +0000 | [diff] [blame] | 109 | size_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); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 110 | size_t wcsspn(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __accept); |
| 111 | wchar_t* _Nullable wcsstr(const wchar_t* _Nonnull __haystack, const wchar_t* _Nonnull __needle); |
| 112 | double wcstod(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr); |
Elliott Hughes | 0767784 | 2024-08-23 13:56:35 +0000 | [diff] [blame] | 113 | double wcstod_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, locale_t _Nonnull __l) __RENAME(wcstod); |
Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 114 | float wcstof(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr); |
Elliott Hughes | 0767784 | 2024-08-23 13:56:35 +0000 | [diff] [blame] | 115 | float wcstof_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, locale_t _Nonnull __l) __RENAME(wcstof); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 116 | wchar_t* _Nullable wcstok(wchar_t* _Nullable __s, const wchar_t* _Nonnull __delimiter, wchar_t* _Nonnull * _Nonnull __ptr); |
| 117 | long wcstol(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base); |
Elliott Hughes | 0767784 | 2024-08-23 13:56:35 +0000 | [diff] [blame] | 118 | long wcstol_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) __RENAME(wcstol); |
Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 119 | long long wcstoll(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base); |
| 120 | long double wcstold(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 121 | unsigned long wcstoul(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base); |
Elliott Hughes | 0767784 | 2024-08-23 13:56:35 +0000 | [diff] [blame] | 122 | unsigned 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 Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 123 | unsigned long long wcstoull(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 124 | int wcswidth(const wchar_t* _Nonnull __s, size_t __n); |
| 125 | size_t wcsxfrm(wchar_t* __BIONIC_COMPLICATED_NULLNESS __dst, const wchar_t* _Nonnull __src, size_t __n); |
Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 126 | int wctob(wint_t __wc); |
| 127 | int wcwidth(wchar_t __wc); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 128 | wchar_t* _Nullable wmemchr(const wchar_t* _Nonnull __src, wchar_t __wc, size_t __n); |
| 129 | int wmemcmp(const wchar_t* _Nullable __lhs, const wchar_t* _Nullable __rhs, size_t __n); |
| 130 | wchar_t* _Nonnull wmemcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n); |
Elliott Hughes | 3cfb52a | 2015-02-18 21:29:13 -0800 | [diff] [blame] | 131 | #if defined(__USE_GNU) |
Dan Albert | 02ce401 | 2024-10-25 19:13:49 +0000 | [diff] [blame^] | 132 | |
| 133 | #if __BIONIC_AVAILABILITY_GUARD(23) |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 134 | wchar_t* _Nonnull wmempcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n) __INTRODUCED_IN(23); |
Dan Albert | 02ce401 | 2024-10-25 19:13:49 +0000 | [diff] [blame^] | 135 | #endif /* __BIONIC_AVAILABILITY_GUARD(23) */ |
| 136 | |
Elliott Hughes | 3cfb52a | 2015-02-18 21:29:13 -0800 | [diff] [blame] | 137 | #endif |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 138 | wchar_t* _Nonnull wmemmove(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n); |
| 139 | wchar_t* _Nonnull wmemset(wchar_t* _Nonnull __dst, wchar_t __wc, size_t __n); |
| 140 | int wprintf(const wchar_t* _Nonnull __fmt, ...); |
| 141 | int wscanf(const wchar_t* _Nonnull __fmt, ...); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 142 | |
Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 143 | long long wcstoll_l(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l); |
| 144 | unsigned long long wcstoull_l(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l); |
| 145 | long double wcstold_l(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l); |
Dan Albert | dfb5ce4 | 2014-07-09 22:51:34 +0000 | [diff] [blame] | 146 | |
Elliott Hughes | 655e430 | 2023-06-16 12:39:33 -0700 | [diff] [blame] | 147 | int wcscoll_l(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, locale_t _Nonnull __l) __attribute_pure__; |
| 148 | size_t wcsxfrm_l(wchar_t* __BIONIC_COMPLICATED_NULLNESS __dst, const wchar_t* _Nonnull __src, size_t __n, locale_t _Nonnull __l); |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 149 | size_t wcslcat(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n); |
| 150 | size_t wcslcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n); |
Dan Albert | dfb5ce4 | 2014-07-09 22:51:34 +0000 | [diff] [blame] | 151 | |
Dan Albert | 02ce401 | 2024-10-25 19:13:49 +0000 | [diff] [blame^] | 152 | |
| 153 | #if __BIONIC_AVAILABILITY_GUARD(23) |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 154 | FILE* _Nullable open_wmemstream(wchar_t* _Nonnull * _Nonnull __ptr, size_t* _Nonnull __size_ptr) __INTRODUCED_IN(23); |
Dan Albert | 02ce401 | 2024-10-25 19:13:49 +0000 | [diff] [blame^] | 155 | #endif /* __BIONIC_AVAILABILITY_GUARD(23) */ |
| 156 | |
zijunzhao | 7ce2f95 | 2023-04-03 23:13:57 +0000 | [diff] [blame] | 157 | wchar_t* _Nullable wcsdup(const wchar_t* _Nonnull __s); |
| 158 | size_t wcsnlen(const wchar_t* _Nonnull __s, size_t __n); |
Elliott Hughes | eb93ebf | 2013-03-01 18:35:56 -0800 | [diff] [blame] | 159 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 160 | __END_DECLS |
| 161 | |
Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 162 | #endif |