Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / include / wchar.h
blob8b5c6bf12bdf64724affcbb6ed524382bab20ac2
1 /*
2 * wchar.h
3 * This file has no copyright assigned and is placed in the Public Domain.
4 * This file is a part of the mingw-runtime package.
5 * No warranty is given; refer to the file DISCLAIMER within the package.
7 * Defines of all functions for supporting wide characters. Actually it
8 * just includes all those headers, which is not a good thing to do from a
9 * processing time point of view, but it does mean that everything will be
10 * in sync.
14 #ifndef _WCHAR_H_
15 #define _WCHAR_H_
17 /* All the headers include this file. */
18 #include <_mingw.h>
20 #ifndef RC_INVOKED
22 #define __need_size_t
23 #define __need_wint_t
24 #define __need_wchar_t
25 #define __need_NULL
26 #include <stddef.h>
28 #ifndef __VALIST
29 #if defined __GNUC__ && __GNUC__ >= 3
30 #define __need___va_list
31 #include <stdarg.h>
32 #define __VALIST __builtin_va_list
33 #else
34 #define __VALIST char*
35 #endif
36 #endif
38 #endif /* Not RC_INVOKED */
41 * MSDN says that isw* char classifications are in wchar.h and wctype.h.
42 * Although the wctype names are ANSI, their exposure in this header is
43 * not.
45 #include <wctype.h>
47 #ifndef __STRICT_ANSI__
48 /* This is necessary to support the the non-ANSI wchar declarations
49 here. */
50 #include <sys/types.h>
51 #endif /* __STRICT_ANSI__ */
53 #define WCHAR_MIN 0
54 #define WCHAR_MAX 0xffff
56 #ifndef WEOF
57 #define WEOF (wchar_t)(0xFFFF)
58 #endif
60 #ifndef RC_INVOKED
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
66 #ifndef _FILE_DEFINED /* Also in stdio.h */
67 #define _FILE_DEFINED
68 typedef struct _iobuf
70 char* _ptr;
71 int _cnt;
72 char* _base;
73 int _flag;
74 int _file;
75 int _charbuf;
76 int _bufsiz;
77 char* _tmpfname;
78 } FILE;
79 #endif /* Not _FILE_DEFINED */
81 #ifndef _TIME_T_DEFINED /* Also in time.h */
82 typedef long time_t;
83 #define _TIME_T_DEFINED
84 #endif
86 #ifndef _TM_DEFINED /* Also in time.h */
87 struct tm {
88 int tm_sec; /* seconds after the minute - [0,59] */
89 int tm_min; /* minutes after the hour - [0,59] */
90 int tm_hour; /* hours since midnight - [0,23] */
91 int tm_mday; /* day of the month - [1,31] */
92 int tm_mon; /* months since January - [0,11] */
93 int tm_year; /* years since 1900 */
94 int tm_wday; /* days since Sunday - [0,6] */
95 int tm_yday; /* days since January 1 - [0,365] */
96 int tm_isdst; /* daylight savings time flag */
98 #define _TM_DEFINED
99 #endif
101 #ifndef _WSTDIO_DEFINED
102 /* Also in stdio.h - keep in sync */
103 _CRTIMP int __cdecl fwprintf (FILE*, const wchar_t*, ...);
104 _CRTIMP int __cdecl wprintf (const wchar_t*, ...);
105 _CRTIMP int __cdecl swprintf (wchar_t*, const wchar_t*, ...);
106 _CRTIMP int __cdecl _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
107 _CRTIMP int __cdecl vfwprintf (FILE*, const wchar_t*, __VALIST);
108 _CRTIMP int __cdecl vwprintf (const wchar_t*, __VALIST);
109 _CRTIMP int __cdecl vswprintf (wchar_t*, const wchar_t*, __VALIST);
110 _CRTIMP int __cdecl _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
111 _CRTIMP int __cdecl fwscanf (FILE*, const wchar_t*, ...);
112 _CRTIMP int __cdecl wscanf (const wchar_t*, ...);
113 _CRTIMP int __cdecl swscanf (const wchar_t*, const wchar_t*, ...);
114 _CRTIMP wint_t __cdecl fgetwc (FILE*);
115 _CRTIMP wint_t __cdecl fputwc (wchar_t, FILE*);
116 _CRTIMP wint_t __cdecl ungetwc (wchar_t, FILE*);
118 #ifdef __MSVCRT__
119 _CRTIMP wchar_t* __cdecl fgetws (wchar_t*, int, FILE*);
120 _CRTIMP int __cdecl fputws (const wchar_t*, FILE*);
121 _CRTIMP wint_t __cdecl getwc (FILE*);
122 _CRTIMP wint_t __cdecl getwchar (void);
123 _CRTIMP wint_t __cdecl putwc (wint_t, FILE*);
124 _CRTIMP wint_t __cdecl putwchar (wint_t);
125 #ifndef __STRICT_ANSI__
126 _CRTIMP wchar_t* __cdecl _getws (wchar_t*);
127 _CRTIMP int __cdecl _putws (const wchar_t*);
128 _CRTIMP FILE* __cdecl _wfdopen(int, wchar_t *);
129 _CRTIMP FILE* __cdecl _wfopen (const wchar_t*, const wchar_t*);
130 _CRTIMP FILE* __cdecl _wfreopen (const wchar_t*, const wchar_t*, FILE*);
131 _CRTIMP FILE* __cdecl _wfsopen (const wchar_t*, const wchar_t*, int);
132 _CRTIMP wchar_t* __cdecl _wtmpnam (wchar_t*);
133 _CRTIMP wchar_t* __cdecl _wtempnam (const wchar_t*, const wchar_t*);
134 _CRTIMP int __cdecl _wrename (const wchar_t*, const wchar_t*);
135 _CRTIMP int __cdecl _wremove (const wchar_t*);
136 _CRTIMP void __cdecl _wperror (const wchar_t*);
137 _CRTIMP FILE* __cdecl _wpopen (const wchar_t*, const wchar_t*);
138 #endif /* __STRICT_ANSI__ */
139 #endif /* __MSVCRT__ */
141 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
142 int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...);
143 __CRT_INLINE int __cdecl
144 vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
145 { return _vsnwprintf ( s, n, format, arg);}
146 int __cdecl vwscanf (const wchar_t * __restrict__, __VALIST);
147 int __cdecl vfwscanf (FILE * __restrict__,
148 const wchar_t * __restrict__, __VALIST);
149 int __cdecl vswscanf (const wchar_t * __restrict__,
150 const wchar_t * __restrict__, __VALIST);
151 #endif
153 #define _WSTDIO_DEFINED
154 #endif /* _WSTDIO_DEFINED */
156 #ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */
157 _CRTIMP long __cdecl wcstol (const wchar_t*, wchar_t**, int);
158 _CRTIMP unsigned long __cdecl wcstoul (const wchar_t*, wchar_t**, int);
159 _CRTIMP double __cdecl wcstod (const wchar_t*, wchar_t**);
160 #if !defined __NO_ISOCEXT /* in libmingwex.a */
161 float __cdecl wcstof (const wchar_t * __restrict__, wchar_t ** __restrict__);
162 long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
163 #endif /* __NO_ISOCEXT */
164 #define _WSTDLIB_DEFINED
165 #endif /* _WSTDLIB_DEFINED */
167 #ifndef _WTIME_DEFINED
168 #ifndef __STRICT_ANSI__
169 #ifdef __MSVCRT__
170 /* wide function prototypes, also declared in time.h */
171 _CRTIMP wchar_t* __cdecl _wasctime (const struct tm*);
172 _CRTIMP wchar_t* __cdecl _wctime (const time_t*);
173 _CRTIMP wchar_t* __cdecl _wstrdate (wchar_t*);
174 _CRTIMP wchar_t* __cdecl _wstrtime (wchar_t*);
175 #if __MSVCRT_VERSION__ >= 0x601
176 _CRTIMP wchar_t* __cdecl _wctime64 (const __time64_t*);
177 #endif
178 #endif /* __MSVCRT__ */
179 #endif /* __STRICT_ANSI__ */
180 _CRTIMP size_t __cdecl wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
181 #define _WTIME_DEFINED
182 #endif /* _WTIME_DEFINED */
185 #ifndef _WSTRING_DEFINED
187 * Unicode versions of the standard string calls.
188 * Also in string.h.
190 _CRTIMP wchar_t* __cdecl wcscat (wchar_t*, const wchar_t*);
191 _CRTIMP wchar_t* __cdecl wcschr (const wchar_t*, wchar_t);
192 _CRTIMP int __cdecl wcscmp (const wchar_t*, const wchar_t*);
193 _CRTIMP int __cdecl wcscoll (const wchar_t*, const wchar_t*);
194 _CRTIMP wchar_t* __cdecl wcscpy (wchar_t*, const wchar_t*);
195 _CRTIMP size_t __cdecl wcscspn (const wchar_t*, const wchar_t*);
196 /* Note: _wcserror requires __MSVCRT_VERSION__ >= 0x0700. */
197 _CRTIMP size_t __cdecl wcslen (const wchar_t*);
198 _CRTIMP wchar_t* __cdecl wcsncat (wchar_t*, const wchar_t*, size_t);
199 _CRTIMP int __cdecl wcsncmp(const wchar_t*, const wchar_t*, size_t);
200 _CRTIMP wchar_t* __cdecl wcsncpy(wchar_t*, const wchar_t*, size_t);
201 _CRTIMP wchar_t* __cdecl wcspbrk(const wchar_t*, const wchar_t*);
202 _CRTIMP wchar_t* __cdecl wcsrchr(const wchar_t*, wchar_t);
203 _CRTIMP size_t __cdecl wcsspn(const wchar_t*, const wchar_t*);
204 _CRTIMP wchar_t* __cdecl wcsstr(const wchar_t*, const wchar_t*);
205 _CRTIMP wchar_t* __cdecl wcstok(wchar_t*, const wchar_t*);
206 _CRTIMP size_t __cdecl wcsxfrm(wchar_t*, const wchar_t*, size_t);
208 #ifndef __STRICT_ANSI__
210 * Unicode versions of non-ANSI functions provided by CRTDLL.
213 /* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */
214 #define _wcscmpi _wcsicmp
216 _CRTIMP wchar_t* __cdecl _wcsdup (const wchar_t*);
217 _CRTIMP int __cdecl _wcsicmp (const wchar_t*, const wchar_t*);
218 _CRTIMP int __cdecl _wcsicoll (const wchar_t*, const wchar_t*);
219 _CRTIMP wchar_t* __cdecl _wcslwr (wchar_t*);
220 _CRTIMP int __cdecl _wcsnicmp (const wchar_t*, const wchar_t*, size_t);
221 _CRTIMP wchar_t* __cdecl _wcsnset (wchar_t*, wchar_t, size_t);
222 _CRTIMP wchar_t* __cdecl _wcsrev (wchar_t*);
223 _CRTIMP wchar_t* __cdecl _wcsset (wchar_t*, wchar_t);
224 _CRTIMP wchar_t* __cdecl _wcsupr (wchar_t*);
226 #ifdef __MSVCRT__
227 _CRTIMP int __cdecl _wcsncoll(const wchar_t*, const wchar_t*, size_t);
228 _CRTIMP int __cdecl _wcsnicoll(const wchar_t*, const wchar_t*, size_t);
229 #if __MSVCRT_VERSION__ >= 0x0700
230 _CRTIMP wchar_t* __cdecl _wcserror(int);
231 _CRTIMP wchar_t* __cdecl __wcserror(const wchar_t*);
232 #endif
233 #endif
235 #ifndef _NO_OLDNAMES
236 /* NOTE: There is no _wcscmpi, but this is for compatibility. */
237 __CRT_INLINE int __cdecl
238 wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2)
239 {return _wcsicmp (__ws1, __ws2);}
240 _CRTIMP wchar_t* __cdecl wcsdup (const wchar_t*);
241 _CRTIMP int __cdecl wcsicmp (const wchar_t*, const wchar_t*);
242 _CRTIMP int __cdecl wcsicoll (const wchar_t*, const wchar_t*);
243 _CRTIMP wchar_t* __cdecl wcslwr (wchar_t*);
244 _CRTIMP int __cdecl wcsnicmp (const wchar_t*, const wchar_t*, size_t);
245 _CRTIMP wchar_t* __cdecl wcsnset (wchar_t*, wchar_t, size_t);
246 _CRTIMP wchar_t* __cdecl wcsrev (wchar_t*);
247 _CRTIMP wchar_t* __cdecl wcsset (wchar_t*, wchar_t);
248 _CRTIMP wchar_t* __cdecl wcsupr (wchar_t*);
249 #endif /* Not _NO_OLDNAMES */
251 #endif /* Not strict ANSI */
253 #define _WSTRING_DEFINED
254 #endif /* _WSTRING_DEFINED */
256 /* These are resolved by -lmingwex. Alternatively, they can be resolved by
257 adding -lmsvcp60 to your command line, which will give you the VC++
258 versions of these functions. If you want the latter and don't have
259 msvcp60.dll in your windows system directory, you can easily obtain
260 it with a search from your favorite search engine. */
261 #ifndef __STRICT_ANSI__
262 typedef wchar_t _Wint_t;
263 #endif
265 typedef int mbstate_t;
267 wint_t __cdecl btowc(int);
268 size_t __cdecl mbrlen(const char * __restrict__, size_t,
269 mbstate_t * __restrict__);
270 size_t __cdecl mbrtowc(wchar_t * __restrict__, const char * __restrict__,
271 size_t, mbstate_t * __restrict__);
272 size_t __cdecl mbsrtowcs(wchar_t * __restrict__, const char ** __restrict__,
273 size_t, mbstate_t * __restrict__);
274 size_t __cdecl wcrtomb(char * __restrict__, wchar_t,
275 mbstate_t * __restrict__);
276 size_t __cdecl wcsrtombs(char * __restrict__, const wchar_t ** __restrict__,
277 size_t, mbstate_t * __restrict__);
278 int __cdecl wctob(wint_t);
280 #ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */
281 __CRT_INLINE int __cdecl fwide(FILE* __UNUSED_PARAM(stream),
282 int __UNUSED_PARAM(mode))
283 {return -1;} /* limited to byte orientation */
284 __CRT_INLINE int __cdecl mbsinit(const mbstate_t* __UNUSED_PARAM(ps))
285 {return 1;}
286 wchar_t* __cdecl wmemset(wchar_t *, wchar_t, size_t);
287 wchar_t* __cdecl wmemchr(const wchar_t*, wchar_t, size_t);
288 int wmemcmp(const wchar_t*, const wchar_t *, size_t);
289 wchar_t* __cdecl wmemcpy(wchar_t* __restrict__,
290 const wchar_t* __restrict__,
291 size_t);
292 wchar_t* __cdecl wmemmove(wchar_t* s1, const wchar_t *, size_t);
293 long long __cdecl wcstoll(const wchar_t * __restrict__,
294 wchar_t** __restrict__, int);
295 unsigned long long __cdecl wcstoull(const wchar_t * __restrict__,
296 wchar_t ** __restrict__, int);
297 #endif /* __NO_ISOCEXT */
299 #ifndef __STRICT_ANSI__
300 /* non-ANSI wide char functions from io.h, direct.h, sys/stat.h and locale.h. */
302 #ifndef _FSIZE_T_DEFINED
303 typedef unsigned long _fsize_t;
304 #define _FSIZE_T_DEFINED
305 #endif
307 #ifndef _WFINDDATA_T_DEFINED
308 struct _wfinddata_t {
309 unsigned attrib;
310 time_t time_create; /* -1 for FAT file systems */
311 time_t time_access; /* -1 for FAT file systems */
312 time_t time_write;
313 _fsize_t size;
314 wchar_t name[260]; /* may include spaces. */
316 struct _wfinddatai64_t {
317 unsigned attrib;
318 time_t time_create;
319 time_t time_access;
320 time_t time_write;
321 __int64 size;
322 wchar_t name[260];
324 struct __wfinddata64_t {
325 unsigned attrib;
326 __time64_t time_create;
327 __time64_t time_access;
328 __time64_t time_write;
329 _fsize_t size;
330 wchar_t name[260];
332 #define _WFINDDATA_T_DEFINED
333 #endif
335 /* Wide character versions. Also defined in io.h. */
336 /* CHECK: I believe these only exist in MSVCRT, and not in CRTDLL. Also
337 applies to other wide character versions? */
338 #if !defined (_WIO_DEFINED)
339 #if defined (__MSVCRT__)
340 #include <stdint.h> /* For intptr_t. */
341 _CRTIMP int __cdecl _waccess (const wchar_t*, int);
342 _CRTIMP int __cdecl _wchmod (const wchar_t*, int);
343 _CRTIMP int __cdecl _wcreat (const wchar_t*, int);
344 _CRTIMP long __cdecl _wfindfirst (const wchar_t*, struct _wfinddata_t *);
345 _CRTIMP int __cdecl _wfindnext (long, struct _wfinddata_t *);
346 _CRTIMP int __cdecl _wunlink (const wchar_t*);
347 _CRTIMP int __cdecl _wopen (const wchar_t*, int, ...);
348 _CRTIMP int __cdecl _wsopen (const wchar_t*, int, int, ...);
349 _CRTIMP wchar_t* __cdecl _wmktemp (wchar_t*);
350 _CRTIMP long __cdecl _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
351 _CRTIMP int __cdecl _wfindnexti64 (long, struct _wfinddatai64_t*);
352 #if __MSVCRT_VERSION__ >= 0x0601
353 _CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t*, struct __wfinddata64_t*);
354 _CRTIMP intptr_t __cdecl _wfindnext64(intptr_t, struct __wfinddata64_t*);
355 #endif /* __MSVCRT_VERSION__ >= 0x0601 */
356 #endif /* defined (__MSVCRT__) */
357 #define _WIO_DEFINED
358 #endif /* _WIO_DEFINED */
360 #ifndef _WDIRECT_DEFINED
361 /* Also in direct.h */
362 #ifdef __MSVCRT__
363 _CRTIMP int __cdecl _wchdir (const wchar_t*);
364 _CRTIMP wchar_t* __cdecl _wgetcwd (wchar_t*, int);
365 _CRTIMP wchar_t* __cdecl _wgetdcwd (int, wchar_t*, int);
366 _CRTIMP int __cdecl _wmkdir (const wchar_t*);
367 _CRTIMP int __cdecl _wrmdir (const wchar_t*);
368 #endif /* __MSVCRT__ */
369 #define _WDIRECT_DEFINED
370 #endif /* _WDIRECT_DEFINED */
372 #ifndef _STAT_DEFINED
374 * The structure manipulated and returned by stat and fstat.
376 * NOTE: If called on a directory the values in the time fields are not only
377 * invalid, they will cause localtime et. al. to return NULL. And calling
378 * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
380 struct _stat
382 _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
383 _ino_t st_ino; /* Always zero ? */
384 _mode_t st_mode; /* See above constants */
385 short st_nlink; /* Number of links. */
386 short st_uid; /* User: Maybe significant on NT ? */
387 short st_gid; /* Group: Ditto */
388 _dev_t st_rdev; /* Seems useless (not even filled in) */
389 _off_t st_size; /* File size in bytes */
390 time_t st_atime; /* Accessed date (always 00:00 hrs local
391 * on FAT) */
392 time_t st_mtime; /* Modified time */
393 time_t st_ctime; /* Creation time */
396 #ifndef _NO_OLDNAMES
397 /* NOTE: Must be the same as _stat above. */
398 struct stat
400 _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
401 _ino_t st_ino; /* Always zero ? */
402 _mode_t st_mode; /* See above constants */
403 short st_nlink; /* Number of links. */
404 short st_uid; /* User: Maybe significant on NT ? */
405 short st_gid; /* Group: Ditto */
406 _dev_t st_rdev; /* Seems useless (not even filled in) */
407 _off_t st_size; /* File size in bytes */
408 time_t st_atime; /* Accessed date (always 00:00 hrs local
409 * on FAT) */
410 time_t st_mtime; /* Modified time */
411 time_t st_ctime; /* Creation time */
413 #endif /* _NO_OLDNAMES */
415 #if defined (__MSVCRT__)
416 struct _stati64 {
417 _dev_t st_dev;
418 _ino_t st_ino;
419 unsigned short st_mode;
420 short st_nlink;
421 short st_uid;
422 short st_gid;
423 _dev_t st_rdev;
424 __int64 st_size;
425 time_t st_atime;
426 time_t st_mtime;
427 time_t st_ctime;
430 struct __stat64
432 _dev_t st_dev;
433 _ino_t st_ino;
434 _mode_t st_mode;
435 short st_nlink;
436 short st_uid;
437 short st_gid;
438 _dev_t st_rdev;
439 __int64 st_size;
440 __time64_t st_atime;
441 __time64_t st_mtime;
442 __time64_t st_ctime;
444 #endif /* __MSVCRT__ */
445 #define _STAT_DEFINED
446 #endif /* _STAT_DEFINED */
448 #if !defined ( _WSTAT_DEFINED)
449 /* also declared in sys/stat.h */
450 #if defined __MSVCRT__
451 _CRTIMP int __cdecl _wstat (const wchar_t*, struct _stat*);
452 _CRTIMP int __cdecl _wstati64 (const wchar_t*, struct _stati64*);
453 #if __MSVCRT_VERSION__ >= 0x0601
454 _CRTIMP int __cdecl _wstat64 (const wchar_t*, struct __stat64*);
455 #endif /* __MSVCRT_VERSION__ >= 0x0601 */
456 #endif /* __MSVCRT__ */
457 #define _WSTAT_DEFINED
458 #endif /* ! _WSTAT_DEFIND */
460 #ifndef _WLOCALE_DEFINED /* also declared in locale.h */
461 _CRTIMP wchar_t* __cdecl _wsetlocale (int, const wchar_t*);
462 #define _WLOCALE_DEFINED
463 #endif
465 #endif /* not __STRICT_ANSI__ */
467 #ifdef __cplusplus
468 } /* end of extern "C" */
469 #endif
471 #endif /* Not RC_INVOKED */
473 #endif /* not _WCHAR_H_ */