source: trunk/libs/newlib/src/newlib/libc/include/wchar.h @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 11.7 KB
Line 
1#ifndef _WCHAR_H_
2#define _WCHAR_H_
3
4#include <_ansi.h>
5
6#include <sys/reent.h>
7
8#define __need_size_t
9#define __need_wchar_t
10#define __need_wint_t
11#define __need_NULL
12#include <stddef.h>
13
14/* For _mbstate_t definition. */
15#include <sys/_types.h>
16#include <sys/cdefs.h>
17/* For __STDC_ISO_10646__ */
18#include <sys/features.h>
19
20/* typedef only __gnuc_va_list, used throughout the header */
21#define __need___va_list
22#include <stdarg.h>
23
24/* typedef va_list only when required */
25#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
26#ifdef __GNUC__
27#ifndef _VA_LIST_DEFINED
28typedef __gnuc_va_list va_list;
29#define _VA_LIST_DEFINED
30#endif
31#else /* !__GNUC__ */
32#include <stdarg.h>
33#endif
34#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
35
36#if __XSI_VISIBLE /* && __XSI_VISIBLE < 800 */ && !__GNU_VISIBLE
37#include <wctype.h>
38#endif
39
40#ifndef WEOF
41# define WEOF ((wint_t)-1)
42#endif
43
44/* This must match definition in <stdint.h> */
45#ifndef WCHAR_MIN
46#ifdef __WCHAR_MIN__
47#define WCHAR_MIN __WCHAR_MIN__
48#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
49#define WCHAR_MIN (0 + L'\0')
50#else
51#define WCHAR_MIN (-0x7fffffff - 1 + L'\0')
52#endif
53#endif
54
55/* This must match definition in <stdint.h> */
56#ifndef WCHAR_MAX
57#ifdef __WCHAR_MAX__
58#define WCHAR_MAX __WCHAR_MAX__
59#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
60#define WCHAR_MAX (0xffffffffu + L'\0')
61#else
62#define WCHAR_MAX (0x7fffffff + L'\0')
63#endif
64#endif
65
66#if __POSIX_VISIBLE >= 200809
67#include <xlocale.h>
68#endif
69
70_BEGIN_STD_C
71
72#if __POSIX_VISIBLE >= 200809 || _XSI_VISIBLE
73/* As in stdio.h, <sys/reent.h> defines __FILE. */
74#if !defined(__FILE_defined)
75typedef __FILE FILE;
76# define __FILE_defined
77#endif
78#endif
79
80/* As required by POSIX.1-2008, declare tm as incomplete type.
81   The actual definition is in time.h. */
82struct tm;
83
84#ifndef _MBSTATE_T
85#define _MBSTATE_T
86typedef _mbstate_t mbstate_t;
87#endif /* _MBSTATE_T */
88
89wint_t  btowc (int);
90int     wctob (wint_t);
91size_t  mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
92size_t  mbrtowc (wchar_t *__restrict, const char *__restrict, size_t,
93                                                mbstate_t *__restrict);
94size_t  _mbrtowc_r (struct _reent *, wchar_t * , const char * , 
95                        size_t, mbstate_t *);
96int     mbsinit (const mbstate_t *);
97#if __POSIX_VISIBLE >= 200809
98size_t  mbsnrtowcs (wchar_t *__restrict, const char **__restrict,
99                                size_t, size_t, mbstate_t *__restrict);
100#endif
101size_t  _mbsnrtowcs_r (struct _reent *, wchar_t * , const char ** ,
102                        size_t, size_t, mbstate_t *);
103size_t  mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t,
104                                mbstate_t *__restrict);
105size_t  _mbsrtowcs_r (struct _reent *, wchar_t * , const char ** , size_t, mbstate_t *);
106size_t  wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
107size_t  _wcrtomb_r (struct _reent *, char * , wchar_t, mbstate_t *);
108#if __POSIX_VISIBLE >= 200809
109size_t  wcsnrtombs (char *__restrict, const wchar_t **__restrict,
110                                size_t, size_t, mbstate_t *__restrict);
111#endif
112size_t  _wcsnrtombs_r (struct _reent *, char * , const wchar_t ** , 
113                        size_t, size_t, mbstate_t *);
114size_t  wcsrtombs (char *__restrict, const wchar_t **__restrict,
115                                size_t, mbstate_t *__restrict);
116size_t  _wcsrtombs_r (struct _reent *, char * , const wchar_t ** , 
117                        size_t, mbstate_t *);
118#if __POSIX_VISIBLE >= 200809
119int     wcscasecmp (const wchar_t *, const wchar_t *);
120#endif
121wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
122wchar_t *wcschr (const wchar_t *, wchar_t);
123int     wcscmp (const wchar_t *, const wchar_t *);
124int     wcscoll (const wchar_t *, const wchar_t *);
125wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
126#if __POSIX_VISIBLE >= 200809
127wchar_t *wcpcpy (wchar_t *__restrict,
128                                 const wchar_t *__restrict);
129wchar_t *wcsdup (const wchar_t *);
130#endif
131wchar_t *_wcsdup_r (struct _reent *, const wchar_t * );
132size_t  wcscspn (const wchar_t *, const wchar_t *);
133size_t  wcsftime (wchar_t *__restrict, size_t,
134                                const wchar_t *__restrict, const struct tm *__restrict);
135#if __GNU_VISIBLE
136size_t  wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict,
137                    const struct tm *__restrict, locale_t);
138#endif
139size_t  wcslcat (wchar_t *, const wchar_t *, size_t);
140size_t  wcslcpy (wchar_t *, const wchar_t *, size_t);
141size_t  wcslen (const wchar_t *);
142#if __POSIX_VISIBLE >= 200809
143int     wcsncasecmp (const wchar_t *, const wchar_t *, size_t);
144#endif
145wchar_t *wcsncat (wchar_t *__restrict,
146                                 const wchar_t *__restrict, size_t);
147int     wcsncmp (const wchar_t *, const wchar_t *, size_t);
148wchar_t *wcsncpy (wchar_t *__restrict,
149                                 const wchar_t *__restrict, size_t);
150#if __POSIX_VISIBLE >= 200809
151wchar_t *wcpncpy (wchar_t *__restrict,
152                                 const wchar_t *__restrict, size_t);
153size_t  wcsnlen (const wchar_t *, size_t);
154#endif
155wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
156wchar_t *wcsrchr (const wchar_t *, wchar_t);
157size_t  wcsspn (const wchar_t *, const wchar_t *);
158wchar_t *wcsstr (const wchar_t *__restrict,
159                                 const wchar_t *__restrict);
160wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict,
161                                 wchar_t **__restrict);
162double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
163double _wcstod_r (struct _reent *, const wchar_t *, wchar_t **);
164#if __ISO_C_VISIBLE >= 1999
165float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
166#endif
167float _wcstof_r (struct _reent *, const wchar_t *, wchar_t **);
168#if __XSI_VISIBLE
169int     wcswidth (const wchar_t *, size_t);
170#endif
171size_t  wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict,
172                                size_t);
173#if __POSIX_VISIBLE >= 200809
174extern int wcscasecmp_l (const wchar_t *, const wchar_t *, locale_t);
175extern int wcsncasecmp_l (const wchar_t *, const wchar_t *, size_t, locale_t);
176extern int wcscoll_l (const wchar_t *, const wchar_t *, locale_t);
177extern size_t wcsxfrm_l (wchar_t *__restrict, const wchar_t *__restrict, size_t,
178                         locale_t);
179#endif
180
181#if __XSI_VISIBLE
182int     wcwidth (const wchar_t);
183#endif
184wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
185int     wmemcmp (const wchar_t *, const wchar_t *, size_t);
186wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict,
187                                 size_t);
188wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
189#if __GNU_VISIBLE
190wchar_t *wmempcpy (wchar_t *__restrict, const wchar_t *__restrict,
191                                 size_t);
192#endif
193wchar_t *wmemset (wchar_t *, wchar_t, size_t);
194
195long    wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
196#if __ISO_C_VISIBLE >= 1999
197long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict,
198                                  int);
199#endif
200unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict,
201                                          int);
202#if __ISO_C_VISIBLE >= 1999
203unsigned long long wcstoull (const wchar_t *__restrict,
204                                                   wchar_t **__restrict, int);
205#endif
206long    _wcstol_r (struct _reent *, const wchar_t *, wchar_t **, int);
207long long _wcstoll_r (struct _reent *, const wchar_t *, wchar_t **, int);
208unsigned long _wcstoul_r (struct _reent *, const wchar_t *, wchar_t **, int);
209unsigned long long _wcstoull_r (struct _reent *, const wchar_t *, wchar_t **, int);
210#if __ISO_C_VISIBLE >= 1999
211long double wcstold (const wchar_t *, wchar_t **);
212#endif
213
214#if __GNU_VISIBLE
215long wcstol_l (const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
216long long wcstoll_l (const wchar_t *__restrict, wchar_t **__restrict, int,
217                     locale_t);
218unsigned long wcstoul_l (const wchar_t *__restrict, wchar_t **__restrict, int,
219                         locale_t);
220unsigned long long wcstoull_l (const wchar_t *__restrict, wchar_t **__restrict,
221                               int, locale_t);
222double wcstod_l (const wchar_t *, wchar_t **, locale_t);
223float wcstof_l (const wchar_t *, wchar_t **, locale_t);
224long double wcstold_l (const wchar_t *, wchar_t **, locale_t);
225#endif
226
227wint_t fgetwc (__FILE *);
228wchar_t *fgetws (wchar_t *__restrict, int, __FILE *__restrict);
229wint_t fputwc (wchar_t, __FILE *);
230int fputws (const wchar_t *__restrict, __FILE *__restrict);
231#if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500
232int fwide (__FILE *, int);
233#endif
234wint_t getwc (__FILE *);
235wint_t getwchar (void);
236wint_t putwc (wchar_t, __FILE *);
237wint_t putwchar (wchar_t);
238wint_t ungetwc (wint_t wc, __FILE *);
239
240wint_t _fgetwc_r (struct _reent *, __FILE *);
241wint_t _fgetwc_unlocked_r (struct _reent *, __FILE *);
242wchar_t *_fgetws_r (struct _reent *, wchar_t *, int, __FILE *);
243wchar_t *_fgetws_unlocked_r (struct _reent *, wchar_t *, int, __FILE *);
244wint_t _fputwc_r (struct _reent *, wchar_t, __FILE *);
245wint_t _fputwc_unlocked_r (struct _reent *, wchar_t, __FILE *);
246int _fputws_r (struct _reent *, const wchar_t *, __FILE *);
247int _fputws_unlocked_r (struct _reent *, const wchar_t *, __FILE *);
248int _fwide_r (struct _reent *, __FILE *, int);
249wint_t _getwc_r (struct _reent *, __FILE *);
250wint_t _getwc_unlocked_r (struct _reent *, __FILE *);
251wint_t _getwchar_r (struct _reent *ptr);
252wint_t _getwchar_unlocked_r (struct _reent *ptr);
253wint_t _putwc_r (struct _reent *, wchar_t, __FILE *);
254wint_t _putwc_unlocked_r (struct _reent *, wchar_t, __FILE *);
255wint_t _putwchar_r (struct _reent *, wchar_t);
256wint_t _putwchar_unlocked_r (struct _reent *, wchar_t);
257wint_t _ungetwc_r (struct _reent *, wint_t wc, __FILE *);
258
259#if __GNU_VISIBLE
260wint_t fgetwc_unlocked (__FILE *);
261wchar_t *fgetws_unlocked (wchar_t *__restrict, int, __FILE *__restrict);
262wint_t fputwc_unlocked (wchar_t, __FILE *);
263int fputws_unlocked (const wchar_t *__restrict, __FILE *__restrict);
264wint_t getwc_unlocked (__FILE *);
265wint_t getwchar_unlocked (void);
266wint_t putwc_unlocked (wchar_t, __FILE *);
267wint_t putwchar_unlocked (wchar_t);
268#endif
269
270#if __POSIX_VISIBLE >= 200809
271__FILE *open_wmemstream (wchar_t **, size_t *);
272#endif
273__FILE *_open_wmemstream_r (struct _reent *, wchar_t **, size_t *);
274
275#ifndef __VALIST
276#ifdef __GNUC__
277#define __VALIST __gnuc_va_list
278#else
279#define __VALIST char*
280#endif
281#endif
282
283#if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500
284int     fwprintf (__FILE *__restrict, const wchar_t *__restrict, ...);
285int     swprintf (wchar_t *__restrict, size_t,
286                        const wchar_t *__restrict, ...);
287int     vfwprintf (__FILE *__restrict, const wchar_t *__restrict,
288                        __VALIST);
289int     vswprintf (wchar_t *__restrict, size_t,
290                        const wchar_t *__restrict, __VALIST);
291int     vwprintf (const wchar_t *__restrict, __VALIST);
292int     wprintf (const wchar_t *__restrict, ...);
293#endif
294
295int     _fwprintf_r (struct _reent *, __FILE *, const wchar_t *, ...);
296int     _swprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, ...);
297int     _vfwprintf_r (struct _reent *, __FILE *, const wchar_t *, __VALIST);
298int     _vswprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, __VALIST);
299int     _vwprintf_r (struct _reent *, const wchar_t *, __VALIST);
300int     _wprintf_r (struct _reent *, const wchar_t *, ...);
301
302#if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500
303int     fwscanf (__FILE *__restrict, const wchar_t *__restrict, ...);
304int     swscanf (const wchar_t *__restrict,
305                        const wchar_t *__restrict, ...);
306int     vfwscanf (__FILE *__restrict, const wchar_t *__restrict,
307                        __VALIST);
308int     vswscanf (const wchar_t *__restrict, const wchar_t *__restrict,
309                        __VALIST);
310int     vwscanf (const wchar_t *__restrict, __VALIST);
311int     wscanf (const wchar_t *__restrict, ...);
312#endif
313
314int     _fwscanf_r (struct _reent *, __FILE *, const wchar_t *, ...);
315int     _swscanf_r (struct _reent *, const wchar_t *, const wchar_t *, ...);
316int     _vfwscanf_r (struct _reent *, __FILE *, const wchar_t *, __VALIST);
317int     _vswscanf_r (struct _reent *, const wchar_t *, const wchar_t *, __VALIST);
318int     _vwscanf_r (struct _reent *, const wchar_t *, __VALIST);
319int     _wscanf_r (struct _reent *, const wchar_t *, ...);
320
321#define getwc(fp)       fgetwc(fp)
322#define putwc(wc,fp)    fputwc((wc), (fp))
323#define getwchar()      fgetwc(_REENT->_stdin)
324#define putwchar(wc)    fputwc((wc), _REENT->_stdout)
325
326#if __GNU_VISIBLE
327#define getwc_unlocked(fp)      fgetwc_unlocked(fp)
328#define putwc_unlocked(wc,fp)   fputwc_unlocked((wc), (fp))
329#define getwchar_unlocked()     fgetwc_unlocked(_REENT->_stdin)
330#define putwchar_unlocked(wc)   fputwc_unlocked((wc), _REENT->_stdout)
331#endif
332
333_END_STD_C
334
335#if __SSP_FORTIFY_LEVEL > 0
336#include <ssp/wchar.h>
337#endif
338
339#endif /* _WCHAR_H_ */
Note: See TracBrowser for help on using the repository browser.