43 |
7u83 |
1 |
/*
|
|
|
2 |
* Copyright (c) 1999 Citrus Project,
|
|
|
3 |
* All rights reserved.
|
|
|
4 |
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
|
|
5 |
* All rights reserved.
|
|
|
6 |
*
|
|
|
7 |
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
8 |
* by Julian Coleman.
|
|
|
9 |
*
|
|
|
10 |
* Copyright (c) 2019 The PLANIX Project,
|
|
|
11 |
* All rights reserved.
|
|
|
12 |
*
|
|
|
13 |
* Redistribution and use in source and binary forms, with or without
|
|
|
14 |
* modification, are permitted provided that the following conditions
|
|
|
15 |
* are met:
|
|
|
16 |
* 1. Redistributions of source code must retain the above copyright
|
|
|
17 |
* notice, this list of conditions and the following disclaimer.
|
|
|
18 |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
19 |
* notice, this list of conditions and the following disclaimer in the
|
|
|
20 |
* documentation and/or other materials provided with the distribution.
|
|
|
21 |
*
|
|
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
23 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
24 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
25 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
26 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
27 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
28 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
29 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
30 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
31 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
32 |
* SUCH DAMAGE.
|
|
|
33 |
*
|
|
|
34 |
*/
|
|
|
35 |
|
|
|
36 |
#ifndef _WCHAR_H_
|
|
|
37 |
#define _WCHAR_H_
|
|
|
38 |
|
48 |
7u83 |
39 |
#if defined (_POSIX_C_SOURCE)
|
|
|
40 |
#if (_POSIX_C_SOURCE < 200112L)
|
|
|
41 |
#error "This header file is not defined before POSIX IEEE Std 1003.1-2001"
|
|
|
42 |
#endif
|
|
|
43 |
#else
|
|
|
44 |
#if defined (_POSIX_SOURCE )
|
|
|
45 |
#error "This header file is not defined before POSIX IEEE Std 1003.1-2001"
|
|
|
46 |
#else
|
|
|
47 |
#error "This header file is not defined in pure ANSI C89"
|
|
|
48 |
#endif
|
|
|
49 |
#endif
|
|
|
50 |
|
|
|
51 |
/*
|
43 |
7u83 |
52 |
#include <sys/cdefs.h>
|
|
|
53 |
#include <sys/_null.h>
|
|
|
54 |
#include <sys/_types.h>
|
|
|
55 |
#include <machine/_limits.h>
|
|
|
56 |
#include <_ctype.h>
|
48 |
7u83 |
57 |
*/
|
43 |
7u83 |
58 |
|
|
|
59 |
#ifndef _MBSTATE_T_DECLARED
|
48 |
7u83 |
60 |
typedef long mbstate_t;
|
43 |
7u83 |
61 |
#define _MBSTATE_T_DECLARED
|
|
|
62 |
#endif
|
|
|
63 |
|
48 |
7u83 |
64 |
/*
|
43 |
7u83 |
65 |
#ifndef _SIZE_T_DECLARED
|
|
|
66 |
typedef __size_t size_t;
|
|
|
67 |
#define _SIZE_T_DECLARED
|
|
|
68 |
#endif
|
48 |
7u83 |
69 |
*/
|
43 |
7u83 |
70 |
|
48 |
7u83 |
71 |
|
|
|
72 |
/*
|
43 |
7u83 |
73 |
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
|
|
|
74 |
#ifndef _VA_LIST_DECLARED
|
|
|
75 |
typedef __va_list va_list;
|
|
|
76 |
#define _VA_LIST_DECLARED
|
|
|
77 |
#endif
|
|
|
78 |
#endif
|
48 |
7u83 |
79 |
*/
|
43 |
7u83 |
80 |
|
48 |
7u83 |
81 |
/*
|
43 |
7u83 |
82 |
#ifndef __cplusplus
|
|
|
83 |
#ifndef _WCHAR_T_DECLARED
|
|
|
84 |
typedef ___wchar_t wchar_t;
|
|
|
85 |
#define _WCHAR_T_DECLARED
|
|
|
86 |
#endif
|
|
|
87 |
#endif
|
48 |
7u83 |
88 |
*/
|
43 |
7u83 |
89 |
|
48 |
7u83 |
90 |
/*
|
43 |
7u83 |
91 |
#ifndef _WINT_T_DECLARED
|
|
|
92 |
typedef __wint_t wint_t;
|
|
|
93 |
#define _WINT_T_DECLARED
|
|
|
94 |
#endif
|
48 |
7u83 |
95 |
*/
|
43 |
7u83 |
96 |
|
|
|
97 |
#define WCHAR_MIN __WCHAR_MIN
|
|
|
98 |
#define WCHAR_MAX __WCHAR_MAX
|
|
|
99 |
|
|
|
100 |
#ifndef WEOF
|
|
|
101 |
#define WEOF ((wint_t)-1)
|
|
|
102 |
#endif
|
|
|
103 |
|
48 |
7u83 |
104 |
|
|
|
105 |
typedef long wint_t;
|
|
|
106 |
|
|
|
107 |
|
43 |
7u83 |
108 |
struct tm;
|
|
|
109 |
|
|
|
110 |
wint_t btowc(int);
|
|
|
111 |
wint_t fgetwc(FILE *);
|
|
|
112 |
wchar_t *
|
|
|
113 |
fgetws(wchar_t * __restrict, int, FILE * __restrict);
|
|
|
114 |
wint_t fputwc(wchar_t, FILE *);
|
|
|
115 |
int fputws(const wchar_t * __restrict, FILE * __restrict);
|
|
|
116 |
int fwide(FILE *, int);
|
|
|
117 |
int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
|
|
|
118 |
int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
|
|
|
119 |
wint_t getwc(FILE *);
|
|
|
120 |
wint_t getwchar(void);
|
|
|
121 |
size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
|
|
|
122 |
size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
|
|
|
123 |
mbstate_t * __restrict);
|
|
|
124 |
int mbsinit(const mbstate_t *);
|
|
|
125 |
size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
|
|
|
126 |
mbstate_t * __restrict);
|
|
|
127 |
wint_t putwc(wchar_t, FILE *);
|
|
|
128 |
wint_t putwchar(wchar_t);
|
|
|
129 |
int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
|
|
|
130 |
...);
|
|
|
131 |
int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
|
|
|
132 |
wint_t ungetwc(wint_t, FILE *);
|
48 |
7u83 |
133 |
|
|
|
134 |
/*
|
43 |
7u83 |
135 |
int vfwprintf(FILE * __restrict, const wchar_t * __restrict,
|
|
|
136 |
__va_list);
|
|
|
137 |
int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
|
|
|
138 |
__va_list);
|
|
|
139 |
int vwprintf(const wchar_t * __restrict, __va_list);
|
48 |
7u83 |
140 |
*/
|
|
|
141 |
|
43 |
7u83 |
142 |
size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
|
|
|
143 |
wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
|
48 |
7u83 |
144 |
|
|
|
145 |
wchar_t *wcschr(const wchar_t *, wchar_t) ;
|
|
|
146 |
|
|
|
147 |
int wcscmp(const wchar_t *, const wchar_t *) ;
|
43 |
7u83 |
148 |
int wcscoll(const wchar_t *, const wchar_t *);
|
|
|
149 |
wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
|
48 |
7u83 |
150 |
size_t wcscspn(const wchar_t *, const wchar_t *) ;
|
43 |
7u83 |
151 |
size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
|
|
|
152 |
const struct tm * __restrict);
|
48 |
7u83 |
153 |
size_t wcslen(const wchar_t *) ;
|
43 |
7u83 |
154 |
wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict,
|
|
|
155 |
size_t);
|
48 |
7u83 |
156 |
int wcsncmp(const wchar_t *, const wchar_t *, size_t) ;
|
43 |
7u83 |
157 |
wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
|
48 |
7u83 |
158 |
wchar_t *wcspbrk(const wchar_t *, const wchar_t *) ;
|
|
|
159 |
wchar_t *wcsrchr(const wchar_t *, wchar_t) ;
|
43 |
7u83 |
160 |
size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
|
|
|
161 |
mbstate_t * __restrict);
|
48 |
7u83 |
162 |
size_t wcsspn(const wchar_t *, const wchar_t *) ;
|
43 |
7u83 |
163 |
wchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict)
|
48 |
7u83 |
164 |
;
|
43 |
7u83 |
165 |
size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t);
|
|
|
166 |
int wctob(wint_t);
|
|
|
167 |
double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
|
|
|
168 |
wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict,
|
|
|
169 |
wchar_t ** __restrict);
|
|
|
170 |
long wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int);
|
|
|
171 |
unsigned long
|
|
|
172 |
wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int);
|
48 |
7u83 |
173 |
wchar_t *wmemchr(const wchar_t *, wchar_t, size_t) ;
|
|
|
174 |
int wmemcmp(const wchar_t *, const wchar_t *, size_t) ;
|
43 |
7u83 |
175 |
wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
|
|
|
176 |
wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
|
|
|
177 |
wchar_t *wmemset(wchar_t *, wchar_t, size_t);
|
|
|
178 |
int wprintf(const wchar_t * __restrict, ...);
|
|
|
179 |
int wscanf(const wchar_t * __restrict, ...);
|
|
|
180 |
|
|
|
181 |
#ifndef _STDSTREAM_DECLARED
|
|
|
182 |
extern FILE *__stdinp;
|
|
|
183 |
extern FILE *__stdoutp;
|
|
|
184 |
extern FILE *__stderrp;
|
|
|
185 |
#define _STDSTREAM_DECLARED
|
|
|
186 |
#endif
|
|
|
187 |
|
|
|
188 |
#define getwc(fp) fgetwc(fp)
|
|
|
189 |
#define getwchar() fgetwc(__stdinp)
|
|
|
190 |
#define putwc(wc, fp) fputwc(wc, fp)
|
|
|
191 |
#define putwchar(wc) fputwc(wc, __stdoutp)
|
|
|
192 |
|
|
|
193 |
#if __ISO_C_VISIBLE >= 1999
|
|
|
194 |
int vfwscanf(FILE * __restrict, const wchar_t * __restrict,
|
|
|
195 |
__va_list);
|
|
|
196 |
int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
|
|
|
197 |
__va_list);
|
|
|
198 |
int vwscanf(const wchar_t * __restrict, __va_list);
|
|
|
199 |
float wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
|
|
|
200 |
long double
|
|
|
201 |
wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
|
|
|
202 |
#ifdef __LONG_LONG_SUPPORTED
|
|
|
203 |
/* LONGLONG */
|
|
|
204 |
long long
|
|
|
205 |
wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int);
|
|
|
206 |
/* LONGLONG */
|
|
|
207 |
unsigned long long
|
|
|
208 |
wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int);
|
|
|
209 |
#endif
|
|
|
210 |
#endif /* __ISO_C_VISIBLE >= 1999 */
|
|
|
211 |
|
|
|
212 |
#if __XSI_VISIBLE
|
|
|
213 |
int wcswidth(const wchar_t *, size_t);
|
|
|
214 |
int wcwidth(wchar_t);
|
|
|
215 |
#define wcwidth(_c) __wcwidth(_c)
|
|
|
216 |
#endif
|
|
|
217 |
|
|
|
218 |
#if __POSIX_VISIBLE >= 200809
|
|
|
219 |
size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
|
|
|
220 |
size_t, mbstate_t * __restrict);
|
|
|
221 |
FILE *open_wmemstream(wchar_t **, size_t *);
|
|
|
222 |
wchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict);
|
|
|
223 |
wchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
|
|
|
224 |
wchar_t *wcsdup(const wchar_t *) __malloc_like;
|
|
|
225 |
int wcscasecmp(const wchar_t *, const wchar_t *);
|
|
|
226 |
int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n);
|
48 |
7u83 |
227 |
size_t wcsnlen(const wchar_t *, size_t) ;
|
43 |
7u83 |
228 |
size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
|
|
|
229 |
size_t, mbstate_t * __restrict);
|
|
|
230 |
#endif
|
|
|
231 |
|
|
|
232 |
#if __BSD_VISIBLE
|
|
|
233 |
wchar_t *fgetwln(FILE * __restrict, size_t * __restrict);
|
|
|
234 |
size_t wcslcat(wchar_t *, const wchar_t *, size_t);
|
|
|
235 |
size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
|
|
|
236 |
#endif
|
|
|
237 |
|
|
|
238 |
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
|
|
|
239 |
#include <xlocale/_wchar.h>
|
|
|
240 |
#endif
|
|
|
241 |
|
|
|
242 |
#endif /* !_WCHAR_H_ */
|