:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / include / crtdll / 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  *  DISCLAMED. This includes but is not limited to warranties of
30  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
31  *
32  * $Revision$
33  * $Author$
34  * $Date$
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 #define _TEXT(x)        L ## x
65 #define _T(x)           L ## x
66
67 /*
68  * Unicode functions
69  */
70
71 #define _tprintf                wprintf
72 #define _ftprintf               fwprintf
73 #define _stprintf               swprintf
74 #define _sntprintf      _snwprintf
75 #define _vtprintf               vwprintf
76 #define _vftprintf      vfwprintf
77 #define _vstprintf      vswprintf
78 #define _vsntprintf     _vsnwprintf
79 #define _tscanf         wscanf
80 #define _ftscanf                fwscanf
81 #define _stscanf                swscanf
82 #define _fgettc         fgetwc
83 #define _fgettchar      _fgetwchar
84 #define _fgetts         fgetws
85 #define _fputtc         fputwc
86 #define _fputtchar      _fputwchar
87 #define _fputts         fputws
88 #define _gettc          getwc
89 #define _getts          getws
90 #define _puttc          putwc
91 #define _putts          putws
92 #define _ungettc        ungetwc
93 #define _tcstod         wcstod
94 #define _tcstol         wcstol
95 #define _tcstoul                wcstoul
96 #define _tcscat         wcscat
97 #define _tcschr         wcschr
98 #define _tcscmp         wcscmp
99 #define _tcscpy         wcscpy
100 #define _tcscspn        wcscspn
101 #define _tcslen         wcslen
102 #define _tcsncat                wcsncat
103 #define _tcsncmp        wcsncmp
104 #define _tcsncpy        wcsncpy
105 #define _tcspbrk                wcspbrk
106 #define _tcsrchr                wcsrchr
107 #define _tcsspn         wcsspn
108 #define _tcsstr         wcsstr
109 #define _tcstok         wcstok
110 #define _tcsdup         _wcsdup
111 #define _tcsicmp        _wcsicmp
112 #define _tcsnicmp       _wcsnicmp
113 #define _tcsnset                _wcsnset
114 #define _tcsrev         _wcsrev
115 #define _tcsset         _wcsset
116 #define _tcslwr         _wcslwr
117 #define _tcsupr         _wcsupr
118 #define _tcsxfrm                wcsxfrm
119 #define _tcscoll                wcscoll
120 #define _tcsicoll               _wcsicoll
121 #define _istalpha       iswalpha
122 #define _istupper       iswupper
123 #define _istlower       iswlower
124 #define _istdigit               iswdigit
125 #define _istxdigit      iswxdigit
126 #define _istspace       iswspace
127 #define _istpunct       iswpunct
128 #define _istalnum       iswalnum
129 #define _istprint               iswprint
130 #define _istgraph       iswgraph
131 #define _istcntrl               iswcntrl
132 #define _istascii               iswascii
133 #define _totupper       towupper
134 #define _totlower       towlower
135 #define _ttoi           _wtoi
136 #define _tcsftime       wcsftime
137
138 #else   /* Not _UNICODE */
139
140 /*
141  * TCHAR, the type you should use instead of char.
142  */
143 #ifndef _TCHAR_DEFINED
144 #ifndef RC_INVOKED
145 typedef char    TCHAR;
146 #endif
147 #define _TCHAR_DEFINED
148 #endif
149
150 /*
151  * Enclose constant strings and characters in the _TEXT and _T macro.
152  */
153 #define _TEXT(x)        x
154 #define _T(x)           x
155
156
157 /*
158  * Non-unicode (standard) functions
159  */
160
161 #define _tprintf        printf
162 #define _ftprintf       fprintf
163 #define _stprintf       sprintf
164 #define _sntprintf      _snprintf
165 #define _vtprintf       vprintf
166 #define _vftprintf      vfprintf
167 #define _vstprintf      vsprintf
168 #define _vsntprintf     _vsnprintf
169 #define _tscanf         scanf
170 #define _ftscanf        fscanf
171 #define _stscanf        sscanf
172 #define _fgettc         fgetc
173 #define _fgettchar      _fgetchar
174 #define _fgetts         fgets
175 #define _fputtc         fputc
176 #define _fputtchar      _fputchar
177 #define _fputts         fputs
178 #define _gettc          getc
179 #define _getts          gets
180 #define _puttc          putc
181 #define _putts          puts
182 #define _ungettc        ungetc
183 #define _tcstod         strtod
184 #define _tcstol         strtol
185 #define _tcstoul        strtoul
186 #define _tcscat         strcat
187 #define _tcschr         strchr
188 #define _tcscmp         strcmp
189 #define _tcscpy         strcpy
190 #define _tcscspn        strcspn
191 #define _tcslen         strlen
192 #define _tcsncat        strncat
193 #define _tcsncmp        strncmp
194 #define _tcsncpy        strncpy
195 #define _tcspbrk        strpbrk
196 #define _tcsrchr        strrchr
197 #define _tcsspn         strspn
198 #define _tcsstr         strstr
199 #define _tcstok         strtok
200 #define _tcsdup         _strdup
201 #define _tcsicmp        _stricmp
202 #define _tcsnicmp       _strnicmp
203 #define _tcsnset        _strnset
204 #define _tcsrev         _strrev
205 #define _tcsset         _strset
206 #define _tcslwr         _strlwr
207 #define _tcsupr         _strupr
208 #define _tcsxfrm        strxfrm
209 #define _tcscoll        strcoll
210 #define _tcsicoll       _stricoll
211 #define _istalpha       isalpha
212 #define _istupper       isupper
213 #define _istlower       islower
214 #define _istdigit       isdigit
215 #define _istxdigit      isxdigit
216 #define _istspace       isspace
217 #define _istpunct       ispunct
218 #define _istalnum       isalnum
219 #define _istprint       isprint
220 #define _istgraph       isgraph
221 #define _istcntrl       iscntrl
222 #define _istascii       isascii
223 #define _totupper       toupper
224 #define _totlower       tolower
225 #define _ttoi           atoi
226 #define _tcsftime       strftime
227
228 #endif  /* Not _UNICODE */
229
230 #endif  /* Not _TCHAR_H_ */
231