Changes to all definitions involving wchar_t. The unsigned short type caused g++...
[reactos.git] / reactos / include / tchar.h
1 /*
2 * tchar.h
3 *
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.
10 *
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
15 * names).
16 *
17 * This file is part of the Mingw32 package.
18 *
19 * Contributors:
20 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
21 *
22 * THIS SOFTWARE IS NOT COPYRIGHTED
23 *
24 * This source code is offered for use in the public domain. You may
25 * use, modify or distribute it freely.
26 *
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.
31 *
32 * $Revision: 1.5 $
33 * $Author: robd $
34 * $Date: 2003/01/01 06:19:37 $
35 *
36 */
37
38 #ifndef _TCHAR_H_
39 #define _TCHAR_H_
40
41 /*
42 * NOTE: This tests _UNICODE, which is different from the UNICODE define
43 * used to differentiate Win32 API calls.
44 */
45 #ifdef _UNICODE
46
47
48 /*
49 * Use TCHAR instead of char or wchar_t. It will be appropriately translated
50 * if _UNICODE is correctly defined (or not).
51 */
52 #ifndef _TCHAR_DEFINED
53 #ifndef RC_INVOKED
54 typedef wchar_t TCHAR;
55 #endif /* Not RC_INVOKED */
56 #define _TCHAR_DEFINED
57 #endif
58
59
60 /*
61 * Enclose constant strings and literal characters in the _TEXT and _T macro to make
62 * them unicode constant strings when _UNICODE is defined.
63 */
64 #ifndef _TEXT
65 #define _TEXT(x) L ## x
66 #endif
67 #ifndef _T
68 #define _T(x) L ## x
69 #endif
70
71 /*
72 * Unicode functions
73 */
74
75 #define _tprintf wprintf
76 #define _ftprintf fwprintf
77 #define _stprintf swprintf
78 #define _sntprintf _snwprintf
79 #define _vtprintf vwprintf
80 #define _vftprintf vfwprintf
81 #define _vstprintf vswprintf
82 #define _vsntprintf _vsnwprintf
83 #define _tscanf wscanf
84 #define _ftscanf fwscanf
85 #define _stscanf swscanf
86 #define _fgettc fgetwc
87 #define _fgettchar _fgetwchar
88 #define _fgetts fgetws
89 #define _fputtc fputwc
90 #define _fputtchar _fputwchar
91 #define _fputts fputws
92 #define _gettc getwc
93 #define _getts getws
94 #define _puttc putwc
95 #define _putts putws
96 #define _ungettc ungetwc
97 #define _tcstod wcstod
98 #define _tcstol wcstol
99 #define _tcstoul wcstoul
100 #define _tcscat wcscat
101 #define _tcschr wcschr
102 #define _tcscmp wcscmp
103 #define _tcscpy wcscpy
104 #define _tcscspn wcscspn
105 #define _tcslen wcslen
106 #define _tcsncat wcsncat
107 #define _tcsncmp wcsncmp
108 #define _tcsncpy wcsncpy
109 #define _tcspbrk wcspbrk
110 #define _tcsrchr wcsrchr
111 #define _tcsspn wcsspn
112 #define _tcsstr wcsstr
113 #define _tcstok wcstok
114 #define _tcsdup _wcsdup
115 #define _tcsicmp _wcsicmp
116 #define _tcsnicmp _wcsnicmp
117 #define _tcsnset _wcsnset
118 #define _tcsrev _wcsrev
119 #define _tcsset _wcsset
120 #define _tcslwr _wcslwr
121 #define _tcsupr _wcsupr
122 #define _tcsxfrm wcsxfrm
123 #define _tcscoll wcscoll
124 #define _tcsicoll _wcsicoll
125 #define _istalpha iswalpha
126 #define _istupper iswupper
127 #define _istlower iswlower
128 #define _istdigit iswdigit
129 #define _istxdigit iswxdigit
130 #define _istspace iswspace
131 #define _istpunct iswpunct
132 #define _istalnum iswalnum
133 #define _istprint iswprint
134 #define _istgraph iswgraph
135 #define _istcntrl iswcntrl
136 #define _istascii iswascii
137 #define _totupper towupper
138 #define _totlower towlower
139 #define _ttoi _wtoi
140 #define _tcsftime wcsftime
141
142 #else /* Not _UNICODE */
143
144 /*
145 * TCHAR, the type you should use instead of char.
146 */
147 #ifndef _TCHAR_DEFINED
148 #ifndef RC_INVOKED
149 typedef char TCHAR;
150 #endif
151 #define _TCHAR_DEFINED
152 #endif
153
154 /*
155 * Enclose constant strings and characters in the _TEXT and _T macro.
156 */
157 #define _TEXT(x) x
158 #define _T(x) x
159
160
161 /*
162 * Non-unicode (standard) functions
163 */
164
165 #define _tprintf printf
166 #define _ftprintf fprintf
167 #define _stprintf sprintf
168 #define _sntprintf _snprintf
169 #define _vtprintf vprintf
170 #define _vftprintf vfprintf
171 #define _vstprintf vsprintf
172 #define _vsntprintf _vsnprintf
173 #define _tscanf scanf
174 #define _ftscanf fscanf
175 #define _stscanf sscanf
176 #define _fgettc fgetc
177 #define _fgettchar _fgetchar
178 #define _fgetts fgets
179 #define _fputtc fputc
180 #define _fputtchar _fputchar
181 #define _fputts fputs
182 #define _gettc getc
183 #define _getts gets
184 #define _puttc putc
185 #define _putts puts
186 #define _ungettc ungetc
187 #define _tcstod strtod
188 #define _tcstol strtol
189 #define _tcstoul strtoul
190 #define _tcscat strcat
191 #define _tcschr strchr
192 #define _tcscmp strcmp
193 #define _tcscpy strcpy
194 #define _tcscspn strcspn
195 #define _tcslen strlen
196 #define _tcsncat strncat
197 #define _tcsncmp strncmp
198 #define _tcsncpy strncpy
199 #define _tcspbrk strpbrk
200 #define _tcsrchr strrchr
201 #define _tcsspn strspn
202 #define _tcsstr strstr
203 #define _tcstok strtok
204 #define _tcsdup _strdup
205 #define _tcsicmp _stricmp
206 #define _tcsnicmp _strnicmp
207 #define _tcsnset _strnset
208 #define _tcsrev _strrev
209 #define _tcsset _strset
210 #define _tcslwr _strlwr
211 #define _tcsupr _strupr
212 #define _tcsxfrm strxfrm
213 #define _tcscoll strcoll
214 #define _tcsicoll _stricoll
215 #define _istalpha isalpha
216 #define _istupper isupper
217 #define _istlower islower
218 #define _istdigit isdigit
219 #define _istxdigit isxdigit
220 #define _istspace isspace
221 #define _istpunct ispunct
222 #define _istalnum isalnum
223 #define _istprint isprint
224 #define _istgraph isgraph
225 #define _istcntrl iscntrl
226 #define _istascii isascii
227 #define _totupper toupper
228 #define _totlower tolower
229 #define _ttoi atoi
230 #define _tcsftime strftime
231
232 #endif /* Not _UNICODE */
233
234 #endif /* Not _TCHAR_H_ */
235