• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Winner Microelectronics Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef _WCHAR_H
17 #define _WCHAR_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include <features.h>
24 #include <stddef.h>
25 #include <stdio.h>
26 
27 #define __NEED___isoc_va_list
28 #define __NEED_size_t
29 #define __NEED_wint_t
30 #define __NEED_mbstate_t
31 
32 #if __STDC_VERSION__ < 201112L
33 #define __NEED_struct__IO_FILE
34 #endif
35 
36 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
37  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
38 #define __NEED_locale_t
39 #define __NEED_va_list
40 #endif
41 
42 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
43 #define __NEED_wctype_t
44 #endif
45 
46 #include <bits/alltypes.h>
47 
48 #if L'\0'-1 > 0
49 #define WCHAR_MAX (0xffffffffu+L'\0')
50 #define WCHAR_MIN (0+L'\0')
51 #else
52 #define WCHAR_MAX (0x7fffffff+L'\0')
53 #define WCHAR_MIN (-1-0x7fffffff+L'\0')
54 #endif
55 
56 #undef MB_CUR_MAX
57 #define MB_CUR_MAX  1
58 
59 #undef WEOF
60 #define WEOF 0xffffffffU
61 
62 wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
63 wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
64 
65 wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
66 wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
67 
68 int wcscmp (const wchar_t *, const wchar_t *);
69 int wcsncmp (const wchar_t *, const wchar_t *, size_t);
70 
71 int wcscoll(const wchar_t *, const wchar_t *);
72 size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t);
73 
74 wchar_t *wcschr (const wchar_t *, wchar_t);
75 wchar_t *wcsrchr (const wchar_t *, wchar_t);
76 
77 size_t wcscspn (const wchar_t *, const wchar_t *);
78 size_t wcsspn (const wchar_t *, const wchar_t *);
79 wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
80 
81 wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
82 
83 size_t wcslen (const wchar_t *);
84 
85 wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
86 wchar_t *wcswcs (const wchar_t *, const wchar_t *);
87 
88 wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
89 int wmemcmp (const wchar_t *, const wchar_t *, size_t);
90 wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
91 wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
92 wchar_t *wmemset (wchar_t *, wchar_t, size_t);
93 
94 wint_t btowc (int);
95 int wctob (wint_t);
96 
97 int mbsinit (const mbstate_t *);
98 size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
99 size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
100 
101 size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
102 
103 size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
104 size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
105 
106 float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
107 double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
108 long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
109 
110 long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
111 unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
112 
113 long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
114 unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
115 
116 int fwide (FILE *, int);
117 
118 int wprintf (const wchar_t *__restrict, ...);
119 int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
120 int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
121 
122 int vwprintf (const wchar_t *__restrict, __isoc_va_list);
123 int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
124 int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list);
125 
126 int wscanf (const wchar_t *__restrict, ...);
127 int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
128 int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
129 
130 int vwscanf (const wchar_t *__restrict, __isoc_va_list);
131 int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
132 int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list);
133 
134 wint_t fgetwc (FILE *);
135 wint_t getwc (FILE *);
136 wint_t getwchar (void);
137 
138 wint_t fputwc (wchar_t, FILE *);
139 wint_t putwc (wchar_t, FILE *);
140 wint_t putwchar (wchar_t);
141 
142 wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
143 int fputws (const wchar_t *__restrict, FILE *__restrict);
144 
145 wint_t ungetwc (wint_t, FILE *);
146 
147 struct tm;
148 size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
149 
150 #undef iswdigit
151 
152 #if defined(_GNU_SOURCE)
153 wint_t fgetwc_unlocked (FILE *);
154 wint_t getwc_unlocked (FILE *);
155 wint_t getwchar_unlocked (void);
156 wint_t fputwc_unlocked (wchar_t, FILE *);
157 wint_t putwc_unlocked (wchar_t, FILE *);
158 wint_t putwchar_unlocked (wchar_t);
159 wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict);
160 int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict);
161 #endif
162 
163 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
164 size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t);
165 #endif
166 
167 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
168  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)  || defined(_BSD_SOURCE)
169 FILE *open_wmemstream(wchar_t **, size_t *);
170 size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
171 size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
172 wchar_t *wcsdup(const wchar_t *);
173 size_t wcsnlen (const wchar_t *, size_t);
174 wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
175 wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
176 int wcscasecmp(const wchar_t *, const wchar_t *);
177 int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
178 int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
179 int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
180 int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
181 size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t);
182 #endif
183 
184 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
185 int wcwidth (wchar_t);
186 int wcswidth (const wchar_t *, size_t);
187 int       iswalnum(wint_t);
188 int       iswalpha(wint_t);
189 int       iswblank(wint_t);
190 int       iswcntrl(wint_t);
191 int       iswdigit(wint_t);
192 int       iswgraph(wint_t);
193 int       iswlower(wint_t);
194 int       iswprint(wint_t);
195 int       iswpunct(wint_t);
196 int       iswspace(wint_t);
197 int       iswupper(wint_t);
198 int       iswxdigit(wint_t);
199 int       iswctype(wint_t, wctype_t);
200 wint_t    towlower(wint_t);
201 wint_t    towupper(wint_t);
202 wctype_t  wctype(const char *);
203 
204 #ifndef __cplusplus
205 #undef iswdigit
206 #define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
207 #endif
208 #endif
209 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif
215