migrate substitution keywords to SVN
[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.14 $
33 * $Author$
34 * $Date$
35 *
36 */
37
38 #ifndef _ROS_TCHAR_H_
39 #define _ROS_TCHAR_H_
40
41 #include <msvcrt/string.h>
42
43 /*
44 * NOTE: This tests _UNICODE, which is different from the UNICODE define
45 * used to differentiate Win32 API calls.
46 */
47 #ifdef _UNICODE
48
49
50 /*
51 * Use TCHAR instead of char or wchar_t. It will be appropriately translated
52 * if _UNICODE is correctly defined (or not).
53 */
54 #ifndef _TCHAR_DEFINED
55 #ifndef RC_INVOKED
56 typedef wchar_t _TCHAR;
57 typedef wchar_t _TSCHAR;
58 typedef wchar_t _TUCHAR;
59 typedef wchar_t _TXCHAR;
60 /* #if !__STDC__ */
61 typedef wchar_t TCHAR;
62 /* #endif */
63 #endif /* Not RC_INVOKED */
64 #define _TCHAR_DEFINED
65 #endif
66
67
68 /*
69 * Enclose constant strings and literal characters in the _TEXT and _T macro to make
70 * them unicode constant strings when _UNICODE is defined.
71 */
72 #ifndef _TEXT
73 #define _TEXT(x) L ## x
74 #endif
75 #ifndef _T
76 #define _T(x) L ## x
77 #endif
78
79 /*
80 * Unicode functions
81 */
82
83 #define _tmain _wmain
84
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
102 #define _gettc getwc
103 #define _getts getws
104 #define _puttc putwc
105 #define _putts putws
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
150 #define _ttoi _wtoi
151 #define _tcsftime wcsftime
152 #define _tsplitpath _wsplitpath
153 #define _tmakepath _wmakepath
154 #define _tfopen _wfopen
155
156 #else /* Not _UNICODE */
157
158 /*
159 * TCHAR, the type you should use instead of char.
160 */
161 #ifndef _TCHAR_DEFINED
162 #ifndef RC_INVOKED
163 typedef char _TCHAR;
164 typedef signed char _TSCHAR;
165 typedef unsigned char _TUCHAR;
166 typedef char _TXCHAR;
167
168 /*#if !__STDC__*/
169 typedef char TCHAR;
170 /*#endif*/
171
172 #endif
173 #define _TCHAR_DEFINED
174 #endif
175
176 /*
177 * Enclose constant strings and characters in the _TEXT and _T macro.
178 */
179 #ifndef _TEXT
180 #define _TEXT(x) x
181 #endif
182 #ifndef _T
183 #define _T(x) x
184 #endif
185
186
187 /*
188 * Non-unicode (standard) functions
189 */
190
191 #define _tmain main
192
193 #define _tprintf printf
194 #define _ftprintf fprintf
195 #define _stprintf sprintf
196 #define _sntprintf _snprintf
197 #define _vtprintf vprintf
198 #define _vftprintf vfprintf
199 #define _vstprintf vsprintf
200 #define _vsntprintf _vsnprintf
201 #define _tscanf scanf
202 #define _ftscanf fscanf
203 #define _stscanf sscanf
204 #define _fgettc fgetc
205 #define _fgettchar _fgetchar
206 #define _fgetts fgets
207 #define _fputtc fputc
208 #define _fputtchar _fputchar
209 #define _fputts fputs
210 #define _gettc getc
211 #define _getts gets
212 #define _puttc putc
213 #define _putts puts
214 #define _ungettc ungetc
215 #define _tcstod strtod
216 #define _tcstol strtol
217 #define _tcstoul strtoul
218 #define _tcscat strcat
219 #define _tcschr strchr
220 #define _tcscmp strcmp
221 #define _tcscpy strcpy
222 #define _tcscspn strcspn
223 #define _tcslen strlen
224 #define _tcsncat strncat
225 #define _tcsncmp strncmp
226 #define _tcsncpy strncpy
227 #define _tcsnlen strnlen
228 #define _tcspbrk strpbrk
229 #define _tcsrchr strrchr
230 #define _tcsspn strspn
231 #define _tcsstr strstr
232 #define _tcstok strtok
233 #define _tcsdup _strdup
234 #define _tcsicmp _stricmp
235 #define _tcsnicmp _strnicmp
236 #define _tcsnset _strnset
237 #define _tcsrev _strrev
238 #define _tcsset _strset
239 #define _tcslwr _strlwr
240 #define _tcsupr _strupr
241 #define _tcsxfrm strxfrm
242 #define _tcscoll strcoll
243 #define _tcsicoll _stricoll
244 #define _istalpha isalpha
245 #define _istupper isupper
246 #define _istlower islower
247 #define _istdigit isdigit
248 #define _istxdigit isxdigit
249 #define _istspace isspace
250 #define _istpunct ispunct
251 #define _istalnum isalnum
252 #define _istprint isprint
253 #define _istgraph isgraph
254 #define _istcntrl iscntrl
255 #define _istascii isascii
256 #define _totupper toupper
257 #define _totlower tolower
258 #define _ttoi atoi
259 #define _tcsftime strftime
260 #define _tsplitpath _splitpath
261 #define _tmakepath _makepath
262 #define _tfopen fopen
263
264 #endif /* Not _UNICODE */
265
266 #endif /* Not _TCHAR_H_ */