Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / include / tchar.h
bloba07d75f4586edcf4c650a7681c1e9aee8ad739e8
1 /*
2 * tchar.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 * Unicode mapping layer for the standard C library. By including this
8 * file and using the 't' names for string functions
9 * (eg. _tprintf) you can make code which can be easily adapted to both
10 * Unicode and non-unicode environments. In a unicode enabled compile define
11 * _UNICODE before including tchar.h, otherwise the standard non-unicode
12 * library functions will be used.
14 * Note that you still need to include string.h or stdlib.h etc. to define
15 * the appropriate functions. Also note that there are several defines
16 * included for non-ANSI functions which are commonly available (but using
17 * the convention of prepending an underscore to non-ANSI library function
18 * names).
22 #ifndef _TCHAR_H_
23 #define _TCHAR_H_
25 /* All the headers include this file. */
26 #include <_mingw.h>
29 * NOTE: This tests _UNICODE, which is different from the UNICODE define
30 * used to differentiate Win32 API calls.
32 #ifdef _UNICODE
35 * Include <wchar.h> for wchar_t and WEOF if _UNICODE.
37 #include <wchar.h>
40 * Use TCHAR instead of char or wchar_t. It will be appropriately translated
41 * if _UNICODE is correctly defined (or not).
43 #ifndef _TCHAR_DEFINED
44 #ifndef RC_INVOKED
45 typedef wchar_t TCHAR;
46 typedef wchar_t _TCHAR;
47 #endif /* Not RC_INVOKED */
48 #define _TCHAR_DEFINED
49 #endif
52 * Use _TEOF instead of EOF or WEOF. It will be appropriately translated if
53 * _UNICODE is correctly defined (or not).
55 #define _TEOF WEOF
58 * __TEXT is a private macro whose specific use is to force the expansion of a
59 * macro passed as an argument to the macros _T or _TEXT. DO NOT use this
60 * macro within your programs. It's name and function could change without
61 * notice.
63 #define __TEXT(q) L##q
65 /* for porting from other Windows compilers */
66 #if 0 /* no wide startup module */
67 #define _tmain wmain
68 #define _tWinMain wWinMain
69 #define _tenviron _wenviron
70 #define __targv __wargv
71 #endif
74 * Unicode functions
76 #define _tprintf wprintf
77 #define _ftprintf fwprintf
78 #define _stprintf swprintf
79 #define _sntprintf _snwprintf
80 #define _vtprintf vwprintf
81 #define _vftprintf vfwprintf
82 #define _vstprintf vswprintf
83 #define _vsntprintf _vsnwprintf
84 #define _tscanf wscanf
85 #define _ftscanf fwscanf
86 #define _stscanf swscanf
87 #define _fgettc fgetwc
88 #define _fgettchar _fgetwchar
89 #define _fgetts fgetws
90 #define _fputtc fputwc
91 #define _fputtchar _fputwchar
92 #define _fputts fputws
93 #define _gettc getwc
94 #define _getts _getws
95 #define _puttc putwc
96 #define _puttchar putwchar
97 #define _putts _putws
98 #define _ungettc ungetwc
99 #define _tcstod wcstod
100 #define _tcstol wcstol
101 #define _tcstoul wcstoul
102 #define _itot _itow
103 #define _ltot _ltow
104 #define _ultot _ultow
105 #define _ttoi _wtoi
106 #define _ttol _wtol
107 #define _tcscat wcscat
108 #define _tcschr wcschr
109 #define _tcscmp wcscmp
110 #define _tcscpy wcscpy
111 #define _tcscspn wcscspn
112 #define _tcslen wcslen
113 #define _tcsncat wcsncat
114 #define _tcsncmp wcsncmp
115 #define _tcsncpy wcsncpy
116 #define _tcspbrk wcspbrk
117 #define _tcsrchr wcsrchr
118 #define _tcsspn wcsspn
119 #define _tcsstr wcsstr
120 #define _tcstok wcstok
121 #define _tcsdup _wcsdup
122 #define _tcsicmp _wcsicmp
123 #define _tcsnicmp _wcsnicmp
124 #define _tcsnset _wcsnset
125 #define _tcsrev _wcsrev
126 #define _tcsset _wcsset
127 #define _tcslwr _wcslwr
128 #define _tcsupr _wcsupr
129 #define _tcsxfrm wcsxfrm
130 #define _tcscoll wcscoll
131 #define _tcsicoll _wcsicoll
132 #define _istalpha iswalpha
133 #define _istupper iswupper
134 #define _istlower iswlower
135 #define _istdigit iswdigit
136 #define _istxdigit iswxdigit
137 #define _istspace iswspace
138 #define _istpunct iswpunct
139 #define _istalnum iswalnum
140 #define _istprint iswprint
141 #define _istgraph iswgraph
142 #define _istcntrl iswcntrl
143 #define _istascii iswascii
144 #define _totupper towupper
145 #define _totlower towlower
146 #define _tcsftime wcsftime
147 /* Macro functions */
148 #define _tcsdec _wcsdec
149 #define _tcsinc _wcsinc
150 #define _tcsnbcnt _wcsncnt
151 #define _tcsnccnt _wcsncnt
152 #define _tcsnextc _wcsnextc
153 #define _tcsninc _wcsninc
154 #define _tcsspnp _wcsspnp
155 #define _wcsdec(_wcs1, _wcs2) ((_wcs1)>=(_wcs2) ? NULL : (_wcs2)-1)
156 #define _wcsinc(_wcs) ((_wcs)+1)
157 #define _wcsnextc(_wcs) ((unsigned int) *(_wcs))
158 #define _wcsninc(_wcs, _inc) (((_wcs)+(_inc)))
159 #define _wcsncnt(_wcs, _cnt) ((wcslen(_wcs)>_cnt) ? _count : wcslen(_wcs))
160 #define _wcsspnp(_wcs1, _wcs2) ((*((_wcs1)+wcsspn(_wcs1,_wcs2))) ? ((_wcs1)+wcsspn(_wcs1,_wcs2)) : NULL)
162 #if 1 /* defined __MSVCRT__ */
164 * These wide functions not in crtdll.dll.
165 * Define macros anyway so that _wfoo rather than _tfoo is undefined
167 #define _ttoi64 _wtoi64
168 #define _i64tot _i64tow
169 #define _ui64tot _ui64tow
170 #define _tasctime _wasctime
171 #define _tctime _wctime
172 #define _tstrdate _wstrdate
173 #define _tstrtime _wstrtime
174 #define _tutime _wutime
175 #define _tcsnccoll _wcsncoll
176 #define _tcsncoll _wcsncoll
177 #define _tcsncicoll _wcsnicoll
178 #define _tcsnicoll _wcsnicoll
179 #define _taccess _waccess
180 #define _tchmod _wchmod
181 #define _tcreat _wcreat
182 #define _tfindfirst _wfindfirst
183 #define _tfindnext _wfindnext
184 #define _tfdopen _wfdopen
185 #define _tfopen _wfopen
186 #define _tfreopen _wfreopen
187 #define _tfsopen _wfsopen
188 #define _tgetenv _wgetenv
189 #define _tputenv _wputenv
190 #define _tsearchenv _wsearchenv
191 #define _tmakepath _wmakepath
192 #define _tsplitpath _wsplitpath
193 #define _tfullpath _wfullpath
194 #define _tmktemp _wmktemp
195 #define _topen _wopen
196 #define _tremove _wremove
197 #define _trename _wrename
198 #define _tsopen _wsopen
199 #define _tsetlocale _wsetlocale
200 #define _tunlink _wunlink
201 #define _tfinddata_t _wfinddata_t
202 #define _tfindfirsti64 _wfindfirsti64
203 #define _tfindnexti64 _wfindnexti64
204 #define _tfinddatai64_t _wfinddatai64_t
205 #define _tchdir _wchdir
206 #define _tgetcwd _wgetcwd
207 #define _tgetdcwd _wgetdcwd
208 #define _tmkdir _wmkdir
209 #define _trmdir _wrmdir
210 #define _tstat _wstat
211 #define _tstati64 _wstati64
212 #define _tstat64 _wstat64
213 #endif /* __MSVCRT__ */
215 /* dirent structures and functions */
216 #define _tdirent _wdirent
217 #define _TDIR _WDIR
218 #define _topendir _wopendir
219 #define _tclosedir _wclosedir
220 #define _treaddir _wreaddir
221 #define _trewinddir _wrewinddir
222 #define _ttelldir _wtelldir
223 #define _tseekdir _wseekdir
225 #else /* Not _UNICODE */
228 * TCHAR, the type you should use instead of char.
230 #ifndef _TCHAR_DEFINED
231 #ifndef RC_INVOKED
232 typedef char TCHAR;
233 typedef char _TCHAR;
234 #endif
235 #define _TCHAR_DEFINED
236 #endif
239 * _TEOF, the constant you should use instead of EOF.
241 #define _TEOF EOF
244 * __TEXT is a private macro whose specific use is to force the expansion of a
245 * macro passed as an argument to the macros _T or _TEXT. DO NOT use this
246 * macro within your programs. It's name and function could change without
247 * notice.
249 #define __TEXT(q) q
251 /* for porting from other Windows compilers */
252 #define _tmain main
253 #define _tWinMain WinMain
254 #define _tenviron _environ
255 #define __targv __argv
258 * Non-unicode (standard) functions
261 #define _tprintf printf
262 #define _ftprintf fprintf
263 #define _stprintf sprintf
264 #define _sntprintf _snprintf
265 #define _vtprintf vprintf
266 #define _vftprintf vfprintf
267 #define _vstprintf vsprintf
268 #define _vsntprintf _vsnprintf
269 #define _tscanf scanf
270 #define _ftscanf fscanf
271 #define _stscanf sscanf
272 #define _fgettc fgetc
273 #define _fgettchar _fgetchar
274 #define _fgetts fgets
275 #define _fputtc fputc
276 #define _fputtchar _fputchar
277 #define _fputts fputs
278 #define _tfdopen _fdopen
279 #define _tfopen fopen
280 #define _tfreopen freopen
281 #define _tfsopen _fsopen
282 #define _tgetenv getenv
283 #define _tputenv _putenv
284 #define _tsearchenv _searchenv
285 #define _tmakepath _makepath
286 #define _tsplitpath _splitpath
287 #define _tfullpath _fullpath
288 #define _gettc getc
289 #define _getts gets
290 #define _puttc putc
291 #define _puttchar putchar
292 #define _putts puts
293 #define _ungettc ungetc
294 #define _tcstod strtod
295 #define _tcstol strtol
296 #define _tcstoul strtoul
297 #define _itot _itoa
298 #define _ltot _ltoa
299 #define _ultot _ultoa
300 #define _ttoi atoi
301 #define _ttol atol
302 #define _tcscat strcat
303 #define _tcschr strchr
304 #define _tcscmp strcmp
305 #define _tcscpy strcpy
306 #define _tcscspn strcspn
307 #define _tcslen strlen
308 #define _tcsncat strncat
309 #define _tcsncmp strncmp
310 #define _tcsncpy strncpy
311 #define _tcspbrk strpbrk
312 #define _tcsrchr strrchr
313 #define _tcsspn strspn
314 #define _tcsstr strstr
315 #define _tcstok strtok
316 #define _tcsdup _strdup
317 #define _tcsicmp _stricmp
318 #define _tcsnicmp _strnicmp
319 #define _tcsnset _strnset
320 #define _tcsrev _strrev
321 #define _tcsset _strset
322 #define _tcslwr _strlwr
323 #define _tcsupr _strupr
324 #define _tcsxfrm strxfrm
325 #define _tcscoll strcoll
326 #define _tcsicoll _stricoll
327 #define _istalpha isalpha
328 #define _istupper isupper
329 #define _istlower islower
330 #define _istdigit isdigit
331 #define _istxdigit isxdigit
332 #define _istspace isspace
333 #define _istpunct ispunct
334 #define _istalnum isalnum
335 #define _istprint isprint
336 #define _istgraph isgraph
337 #define _istcntrl iscntrl
338 #define _istascii isascii
339 #define _totupper toupper
340 #define _totlower tolower
341 #define _tasctime asctime
342 #define _tctime ctime
343 #define _tstrdate _strdate
344 #define _tstrtime _strtime
345 #define _tutime _utime
346 #define _tcsftime strftime
347 /* Macro functions */
348 #define _tcsdec _strdec
349 #define _tcsinc _strinc
350 #define _tcsnbcnt _strncnt
351 #define _tcsnccnt _strncnt
352 #define _tcsnextc _strnextc
353 #define _tcsninc _strninc
354 #define _tcsspnp _strspnp
355 #define _strdec(_str1, _str2) ((_str1)>=(_str2) ? NULL : (_str2)-1)
356 #define _strinc(_str) ((_str)+1)
357 #define _strnextc(_str) ((unsigned int) *(_str))
358 #define _strninc(_str, _inc) (((_str)+(_inc)))
359 #define _strncnt(_str, _cnt) ((strlen(_str)>_cnt) ? _count : strlen(_str))
360 #define _strspnp(_str1, _str2) ((*((_str1)+strspn(_str1,_str2))) ? ((_str1)+strspn(_str1,_str2)) : NULL)
362 #define _tchmod _chmod
363 #define _tcreat _creat
364 #define _tfindfirst _findfirst
365 #define _tfindnext _findnext
366 #define _tmktemp _mktemp
367 #define _topen _open
368 #define _taccess _access
369 #define _tremove remove
370 #define _trename rename
371 #define _tsopen _sopen
372 #define _tsetlocale setlocale
373 #define _tunlink _unlink
374 #define _tfinddata_t _finddata_t
375 #define _tchdir _chdir
376 #define _tgetcwd _getcwd
377 #define _tgetdcwd _getdcwd
378 #define _tmkdir _mkdir
379 #define _trmdir _rmdir
380 #define _tstat _stat
382 #if 1 /* defined __MSVCRT__ */
383 /* Not in crtdll.dll. Define macros anyway? */
384 #define _ttoi64 _atoi64
385 #define _i64tot _i64toa
386 #define _ui64tot _ui64toa
387 #define _tcsnccoll _strncoll
388 #define _tcsncoll _strncoll
389 #define _tcsncicoll _strnicoll
390 #define _tcsnicoll _strnicoll
391 #define _tfindfirsti64 _findfirsti64
392 #define _tfindnexti64 _findnexti64
393 #define _tfinddatai64_t _finddatai64_t
394 #define _tstati64 _stati64
395 #define _tstat64 _stat64
396 #endif /* __MSVCRT__ */
398 /* dirent structures and functions */
399 #define _tdirent dirent
400 #define _TDIR DIR
401 #define _topendir opendir
402 #define _tclosedir closedir
403 #define _treaddir readdir
404 #define _trewinddir rewinddir
405 #define _ttelldir telldir
406 #define _tseekdir seekdir
408 #endif /* Not _UNICODE */
411 * UNICODE a constant string when _UNICODE is defined else returns the string
412 * unmodified. Also defined in w32api/winnt.h.
414 #define _TEXT(x) __TEXT(x)
415 #define _T(x) __TEXT(x)
417 #endif /* Not _TCHAR_H_ */