4 * Unicode mapping layer for the standard C library. By including this
5 * file and using the 't' names for string functions
6 * (eg. _tprintf) you can make code which can be easily adapted to both
7 * Unicode and non-unicode environments. In a unicode enabled compile define
8 * _UNICODE before including tchar.h, otherwise the standard non-unicode
9 * library functions will be used.
11 * Note that you still need to include string.h or stdlib.h etc. to define
12 * the appropriate functions. Also note that there are several defines
13 * included for non-ANSI functions which are commonly available (but using
14 * the convention of prepending an underscore to non-ANSI library function
17 * This file is part of the Mingw32 package.
20 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
22 * THIS SOFTWARE IS NOT COPYRIGHTED
24 * This source code is offered for use in the public domain. You may
25 * use, modify or distribute it freely.
27 * This code is distributed in the hope that it will be useful but
28 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
29 * DISCLAIMED. This includes but is not limited to warranties of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
41 #include <msvcrt/string.h>
44 * NOTE: This tests _UNICODE, which is different from the UNICODE define
45 * used to differentiate Win32 API calls.
51 * Use TCHAR instead of char or wchar_t. It will be appropriately translated
52 * if _UNICODE is correctly defined (or not).
54 #ifndef _TCHAR_DEFINED
56 typedef wchar_t _TCHAR;
57 typedef wchar_t _TSCHAR;
58 typedef wchar_t _TUCHAR;
59 typedef wchar_t _TXCHAR;
61 typedef wchar_t TCHAR;
63 #endif /* Not RC_INVOKED */
64 #define _TCHAR_DEFINED
69 * Enclose constant strings and literal characters in the _TEXT and _T macro to make
70 * them unicode constant strings when _UNICODE is defined.
73 #define _TEXT(x) L ## x
85 #define _tprintf wprintf
86 #define _ftprintf fwprintf
87 #define _stprintf swprintf
88 #define _sntprintf _snwprintf
89 #define _vtprintf vwprintf
90 #define _vftprintf vfwprintf
91 #define _vstprintf vswprintf
92 #define _vsntprintf _vsnwprintf
93 #define _tscanf wscanf
94 #define _ftscanf fwscanf
95 #define _stscanf swscanf
96 #define _fgettc fgetwc
97 #define _fgettchar _fgetwchar
98 #define _fgetts fgetws
99 #define _fputtc fputwc
100 #define _fputtchar _fputwchar
101 #define _fputts fputws
106 #define _ungettc ungetwc
107 #define _tcstod wcstod
108 #define _tcstol wcstol
109 #define _tcstoul wcstoul
110 #define _tcscat wcscat
111 #define _tcschr wcschr
112 #define _tcscmp wcscmp
113 #define _tcscpy wcscpy
114 #define _tcscspn wcscspn
115 #define _tcslen wcslen
116 #define _tcsncat wcsncat
117 #define _tcsncmp wcsncmp
118 #define _tcsncpy wcsncpy
119 #define _tcsnlen wcsnlen
120 #define _tcspbrk wcspbrk
121 #define _tcsrchr wcsrchr
122 #define _tcsspn wcsspn
123 #define _tcsstr wcsstr
124 #define _tcstok wcstok
125 #define _tcsdup _wcsdup
126 #define _tcsicmp _wcsicmp
127 #define _tcsnicmp _wcsnicmp
128 #define _tcsnset _wcsnset
129 #define _tcsrev _wcsrev
130 #define _tcsset _wcsset
131 #define _tcslwr _wcslwr
132 #define _tcsupr _wcsupr
133 #define _tcsxfrm wcsxfrm
134 #define _tcscoll wcscoll
135 #define _tcsicoll _wcsicoll
136 #define _istalpha iswalpha
137 #define _istupper iswupper
138 #define _istlower iswlower
139 #define _istdigit iswdigit
140 #define _istxdigit iswxdigit
141 #define _istspace iswspace
142 #define _istpunct iswpunct
143 #define _istalnum iswalnum
144 #define _istprint iswprint
145 #define _istgraph iswgraph
146 #define _istcntrl iswcntrl
147 #define _istascii iswascii
148 #define _totupper towupper
149 #define _totlower towlower
151 #define _tcsftime wcsftime
153 #else /* Not _UNICODE */
156 * TCHAR, the type you should use instead of char.
158 #ifndef _TCHAR_DEFINED
161 typedef signed char _TSCHAR;
162 typedef unsigned char _TUCHAR;
163 typedef char _TXCHAR;
170 #define _TCHAR_DEFINED
174 * Enclose constant strings and characters in the _TEXT and _T macro.
185 * Non-unicode (standard) functions
190 #define _tprintf printf
191 #define _ftprintf fprintf
192 #define _stprintf sprintf
193 #define _sntprintf _snprintf
194 #define _vtprintf vprintf
195 #define _vftprintf vfprintf
196 #define _vstprintf vsprintf
197 #define _vsntprintf _vsnprintf
198 #define _tscanf scanf
199 #define _ftscanf fscanf
200 #define _stscanf sscanf
201 #define _fgettc fgetc
202 #define _fgettchar _fgetchar
203 #define _fgetts fgets
204 #define _fputtc fputc
205 #define _fputtchar _fputchar
206 #define _fputts fputs
211 #define _ungettc ungetc
212 #define _tcstod strtod
213 #define _tcstol strtol
214 #define _tcstoul strtoul
215 #define _tcscat strcat
216 #define _tcschr strchr
217 #define _tcscmp strcmp
218 #define _tcscpy strcpy
219 #define _tcscspn strcspn
220 #define _tcslen strlen
221 #define _tcsncat strncat
222 #define _tcsncmp strncmp
223 #define _tcsncpy strncpy
224 #define _tcsnlen strnlen
225 #define _tcspbrk strpbrk
226 #define _tcsrchr strrchr
227 #define _tcsspn strspn
228 #define _tcsstr strstr
229 #define _tcstok strtok
230 #define _tcsdup _strdup
231 #define _tcsicmp _stricmp
232 #define _tcsnicmp _strnicmp
233 #define _tcsnset _strnset
234 #define _tcsrev _strrev
235 #define _tcsset _strset
236 #define _tcslwr _strlwr
237 #define _tcsupr _strupr
238 #define _tcsxfrm strxfrm
239 #define _tcscoll strcoll
240 #define _tcsicoll _stricoll
241 #define _istalpha isalpha
242 #define _istupper isupper
243 #define _istlower islower
244 #define _istdigit isdigit
245 #define _istxdigit isxdigit
246 #define _istspace isspace
247 #define _istpunct ispunct
248 #define _istalnum isalnum
249 #define _istprint isprint
250 #define _istgraph isgraph
251 #define _istcntrl iscntrl
252 #define _istascii isascii
253 #define _totupper toupper
254 #define _totlower tolower
256 #define _tcsftime strftime
258 #endif /* Not _UNICODE */
260 #endif /* Not _TCHAR_H_ */