1 | /*
|
---|
2 | * Copyright (C) 1998 Francois Gouget
|
---|
3 | *
|
---|
4 | * This library is free software; you can redistribute it and/or
|
---|
5 | * modify it under the terms of the GNU Lesser General Public
|
---|
6 | * License as published by the Free Software Foundation; either
|
---|
7 | * version 2.1 of the License, or (at your option) any later version.
|
---|
8 | *
|
---|
9 | * This library is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
12 | * Lesser General Public License for more details.
|
---|
13 | *
|
---|
14 | * You should have received a copy of the GNU Lesser General Public
|
---|
15 | * License along with this library; if not, write to the Free Software
|
---|
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | /*
|
---|
20 | * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
21 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
22 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
23 | * a choice of LGPL license versions is made available with the language indicating
|
---|
24 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
25 | * of the LGPL is applied is otherwise unspecified.
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef __WINE_TCHAR_H
|
---|
29 | #define __WINE_TCHAR_H
|
---|
30 |
|
---|
31 | #ifdef __WINESRC__
|
---|
32 | #error Wine should not include tchar.h internally
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | #if defined(_UNICODE) || defined(_MBCS)
|
---|
36 | #error You must use msvcrt when building in Unicode/MBCS mode
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | #ifdef __cplusplus
|
---|
40 | extern "C" {
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | /*****************************************************************************
|
---|
44 | * tchar routines
|
---|
45 | */
|
---|
46 | #define _strdec(start,current) ((start)<(current) ? ((char*)(current))-1 : NULL)
|
---|
47 | #define _strinc(current) (((char*)(current))+1)
|
---|
48 | #define _strncnt(str,max) (strlen(str)>(max) ? (max) : strlen(str))
|
---|
49 | #define _strnextc(str) ((unsigned int)*(str))
|
---|
50 | #define _strninc(str,n) (((char*)(str))+(n))
|
---|
51 | #define _strspnp(s1,s2) (*((s1)+=strspn((s1),(s2))) ? (s1) : NULL)
|
---|
52 |
|
---|
53 |
|
---|
54 | /*****************************************************************************
|
---|
55 | * tchar mappings
|
---|
56 | */
|
---|
57 | #ifndef _UNICODE
|
---|
58 | # ifndef _MBCS
|
---|
59 | # include <string.h>
|
---|
60 | # define WINE_tchar_routine(std,mbcs,unicode) std
|
---|
61 | # else
|
---|
62 | # include <mbstring.h>
|
---|
63 | # define WINE_tchar_routine(std,mbcs,unicode) mbcs
|
---|
64 | # endif
|
---|
65 | #else /* _UNICODE */
|
---|
66 | # include <wchar.h>
|
---|
67 | # define WINE_tchar_routine(std,mbcs,unicode) unicode
|
---|
68 | #endif
|
---|
69 |
|
---|
70 | #define WINE_tchar_true(a) (1)
|
---|
71 | #define WINE_tchar_false(a) (0)
|
---|
72 | #define WINE_tchar_tclen(a) (1)
|
---|
73 | #define WINE_tchar_tccpy(a,b) do { *(a)=*(b); } while (0)
|
---|
74 |
|
---|
75 | #define __targv WINE_tchar_routine(__argv, __argv, __wargv)
|
---|
76 | #define _fgettc WINE_tchar_routine(fgetc, fgetc, fgetwc)
|
---|
77 | #define _fgettchar WINE_tchar_routine(fgetchar, fgetchar, _fgetwchar)
|
---|
78 | #define _fgetts WINE_tchar_routine(fgets, fgets, fgetws)
|
---|
79 | #define _fputtc WINE_tchar_routine(fputc, fputc, fputwc)
|
---|
80 | #define _fputtchar WINE_tchar_routine(fputchar, fputchar, _fputwchar)
|
---|
81 | #define _fputts WINE_tchar_routine(fputs, fputs, fputws)
|
---|
82 | #define _ftprintf WINE_tchar_routine(fprintf, fprintf, fwprintf)
|
---|
83 | #define _ftscanf WINE_tchar_routine(fscanf, fscanf, fwscanf)
|
---|
84 | #define _gettc WINE_tchar_routine(getc, getc, getwc)
|
---|
85 | #define _gettchar WINE_tchar_routine(getchar, getchar, getwchar)
|
---|
86 | #define _getts WINE_tchar_routine(gets, gets, getws)
|
---|
87 | #define _isalnum WINE_tchar_routine(isalnum, _ismbcalnum, iswalnum)
|
---|
88 | #define _istalpha WINE_tchar_routine(isalpha, _ismbcalpha, iswalpha)
|
---|
89 | #define _istascii WINE_tchar_routine(isascii, __isascii, iswascii)
|
---|
90 | #define _istcntrl WINE_tchar_routine(iscntrl, iscntrl, iswcntrl)
|
---|
91 | #define _istdigit WINE_tchar_routine(isdigit, _ismbcdigit, iswdigit)
|
---|
92 | #define _istgraph WINE_tchar_routine(isgraph, _ismbcgraph, iswgraph)
|
---|
93 | #define _istlead WINE_tchar_routine(WINE_tchar_false,_ismbblead, WINE_tchar_false)
|
---|
94 | #define _istleadbyte WINE_tchar_routine(WINE_tchar_false,isleadbyte, WINE_tchar_false)
|
---|
95 | #define _istlegal WINE_tchar_routine(WINE_tchar_true, _ismbclegal, WINE_tchar_true)
|
---|
96 | #define _istlower WINE_tchar_routine(islower, _ismbcslower,iswlower)
|
---|
97 | #define _istprint WINE_tchar_routine(isprint, _ismbcprint, iswprint)
|
---|
98 | #define _istpunct WINE_tchar_routine(ispunct, _ismbcpunct, iswpunct)
|
---|
99 | #define _istspace WINE_tchar_routine(isspace, _ismbcspace, iswspace)
|
---|
100 | #define _istupper WINE_tchar_routine(isupper, _ismbcupper, iswupper)
|
---|
101 | #define _istxdigit WINE_tchar_routine(isxdigit, isxdigit, iswxdigit)
|
---|
102 | #define _itot WINE_tchar_routine(_itoa, _itoa, _itow)
|
---|
103 | #define _ltot WINE_tchar_routine(_ltoa, _ltoa, _ltow)
|
---|
104 | #define _puttc WINE_tchar_routine(putc, putc, putwc)
|
---|
105 | #define _puttchar WINE_tchar_routine(putchar, putchar, putwchar)
|
---|
106 | #define _putts WINE_tchar_routine(puts, puts, putws)
|
---|
107 | #define _sntprintf WINE_tchar_routine(snprintf, snprintf, snwprintf)
|
---|
108 | #define _stprintf WINE_tchar_routine(sprintf, sprintf, swprintf)
|
---|
109 | #define _stscanf WINE_tchar_routine(sscanf, sscanf, swscanf)
|
---|
110 | #define _taccess WINE_tchar_routine(access, _access, _waccess)
|
---|
111 | #define _tasctime WINE_tchar_routine(asctime, asctime, _wasctime)
|
---|
112 | #define _tccpy WINE_tchar_routine(WINE_tchar_tccpy,_mbccpy, WINE_tchar_tccpy)
|
---|
113 | #define _tchdir WINE_tchar_routine(chdir, _chdir, _wchdir)
|
---|
114 | #define _tclen WINE_tchar_routine(WINE_tchar_tclen,_mbclen, WINE_tchar_tclen)
|
---|
115 | #define _tchmod WINE_tchar_routine(chmod, _chmod, _wchmod)
|
---|
116 | #define _tcreat WINE_tchar_routine(creat, _creat, _wcreat)
|
---|
117 | #define _tcscat WINE_tchar_routine(strcat, _mbscat, wcscat)
|
---|
118 | #define _tcschr WINE_tchar_routine(strchr, _mbschr, wcschr)
|
---|
119 | #define _tcsclen WINE_tchar_routine(strlen, _mbslen, wcslen)
|
---|
120 | #define _tcscmp WINE_tchar_routine(strcmp, _mbscmp, wcscmp)
|
---|
121 | #define _tcscoll WINE_tchar_routine(strcoll, _mbscoll, wcscoll)
|
---|
122 | #define _tcscpy WINE_tchar_routine(strcpy, _mbscpy, wcscpy)
|
---|
123 | #define _tcscspn WINE_tchar_routine(strcspn, _mbscspn, wcscspn)
|
---|
124 | #define _tcsdec WINE_tchar_routine(_strdec, _mbsdec, _wcsdec)
|
---|
125 | #define _tcsdup WINE_tchar_routine(strdup, _mbsdup, _wcsdup)
|
---|
126 | #define _tcsftime WINE_tchar_routine(strftime, strftime, wcsftime)
|
---|
127 | #define _tcsicmp WINE_tchar_routine(strcasecmp, _mbsicmp, _wcsicmp)
|
---|
128 | #define _tcsicoll WINE_tchar_routine(_stricoll, _stricoll, _wcsicoll)
|
---|
129 | #define _tcsinc WINE_tchar_routine(_strinc, _mbsinc, _wcsinc)
|
---|
130 | #define _tcslen WINE_tchar_routine(strlen, strlen, wcslen)
|
---|
131 | #define _tcslwr WINE_tchar_routine(_strlwr, _mbslwr, _wcslwr)
|
---|
132 | #define _tcsnbcnt WINE_tchar_routine(_strncnt, _mbsnbcnt, _wcnscnt)
|
---|
133 | #define _tcsncat WINE_tchar_routine(strncat, _mbsnbcat, wcsncat)
|
---|
134 | #define _tcsnccat WINE_tchar_routine(strncat, _mbsncat, wcsncat)
|
---|
135 | #define _tcsncmp WINE_tchar_routine(strncmp, _mbsnbcmp, wcsncmp)
|
---|
136 | #define _tcsnccmp WINE_tchar_routine(strncmp, _mbsncmp, wcsncmp)
|
---|
137 | #define _tcsnccnt WINE_tchar_routine(_strncnt, _mbsnccnt, _wcsncnt)
|
---|
138 | #define _tcsnccpy WINE_tchar_routine(strncpy, _mbsncpy, wcsncpy)
|
---|
139 | #define _tcsncicmp WINE_tchar_routine(_strnicmp, _mbsnicmp, _wcsnicmp)
|
---|
140 | #define _tcsncpy WINE_tchar_routine(strncpy, _mbsnbcpy, wcsncpy)
|
---|
141 | #define _tcsncset WINE_tchar_routine(_strnset, _mbsnset, _wcsnset)
|
---|
142 | #define _tcsnextc WINE_tchar_routine(_strnextc, _mbsnextc, _wcsnextc)
|
---|
143 | #define _tcsnicmp WINE_tchar_routine(_strnicmp, _mbsnicmp, _wcsnicmp)
|
---|
144 | #define _tcsnicoll WINE_tchar_routine(_strnicoll, _strnicoll _wcsnicoll)
|
---|
145 | #define _tcsninc WINE_tchar_routine(_strninc, _mbsninc, _wcsninc)
|
---|
146 | #define _tcsnccnt WINE_tchar_routine(_strncnt, _mbsnccnt, _wcsncnt)
|
---|
147 | #define _tcsnset WINE_tchar_routine(_strnset, _mbsnbset, _wcsnset)
|
---|
148 | #define _tcspbrk WINE_tchar_routine(strpbrk, _mbspbrk, wcspbrk)
|
---|
149 | #define _tcsspnp WINE_tchar_routine(_strspnp, _mbsspnp, _wcsspnp)
|
---|
150 | #define _tcsrchr WINE_tchar_routine(strrchr, _mbsrchr, wcsrchr)
|
---|
151 | #define _tcsrev WINE_tchar_routine(_strrev, _mbsrev, _wcsrev)
|
---|
152 | #define _tcsset WINE_tchar_routine(_strset, _mbsset, _wcsset)
|
---|
153 | #define _tcsspn WINE_tchar_routine(strspn, _mbsspn, wcsspn)
|
---|
154 | #define _tcsstr WINE_tchar_routine(strstr, _mbsstr, wcsstr)
|
---|
155 | #define _tcstod WINE_tchar_routine(strtod, strtod, wcstod)
|
---|
156 | #define _tcstok WINE_tchar_routine(strtok, _mbstok, wcstok)
|
---|
157 | #define _tcstol WINE_tchar_routine(strtol, strtol, wcstol)
|
---|
158 | #define _tcstoul WINE_tchar_routine(strtoul, strtoul, wcstoul)
|
---|
159 | #define _tcsupr WINE_tchar_routine(_strupr, _mbsupr, _wcsupr)
|
---|
160 | #define _tcsxfrm WINE_tchar_routine(strxfrm, strxfrm, wcsxfrm)
|
---|
161 | #define _tctime WINE_tchar_routine(ctime, ctime, _wctime)
|
---|
162 | #define _tenviron WINE_tchar_routine(_environ, _environ, _wenviron)
|
---|
163 | #define _texecl WINE_tchar_routine(execl, _execl, _wexecl)
|
---|
164 | #define _texecle WINE_tchar_routine(execle, _execle, _wexecle)
|
---|
165 | #define _texeclp WINE_tchar_routine(execlp, _execlp, _wexeclp)
|
---|
166 | #define _texeclpe WINE_tchar_routine(execlpe, _execlpe, _wexeclpe)
|
---|
167 | #define _texecv WINE_tchar_routine(execv, _execv, _wexecv)
|
---|
168 | #define _texecve WINE_tchar_routine(execve, _execve, _wexecve)
|
---|
169 | #define _texecvp WINE_tchar_routine(execvp, _execvp, _wexecvp)
|
---|
170 | #define _texecvpe WINE_tchar_routine(execvpe, _execvpe, _wexecvpe)
|
---|
171 | #define _tfdopen WINE_tchar_routine(fdopen, _fdopen, _wfdopen)
|
---|
172 | #define _tfinddata_t WINE_tchar_routine(_finddata_t, _finddata_t, _wfinddata_t)
|
---|
173 | #define _tfinddatai64_t WINE_tchar_routine(_finddatai64_t,_finddatai64_t,_wfinddatai64_t)
|
---|
174 | #define _tfindfirst WINE_tchar_routine(_findfirst, _findfirst, _wfindfirst)
|
---|
175 | #define _tfindnext WINE_tchar_routine(_findnext, _findnext, _wfindnext)
|
---|
176 | #define _tfopen WINE_tchar_routine(fopen, fopen, _wfopen)
|
---|
177 | #define _tfreopen WINE_tchar_routine(freopen, freopen, _wfreopen)
|
---|
178 | #define _tfsopen WINE_tchar_routine(_fsopen, _fsopen, _wfsopen)
|
---|
179 | #define _tfullpath WINE_tchar_routine(_fullpath, _fullpath, _wfullpath)
|
---|
180 | #define _tgetcwd WINE_tchar_routine(getcwd, _getcwd, _wgetcwd)
|
---|
181 | #define _tgetenv WINE_tchar_routine(getenv, getenv, _wgetenv)
|
---|
182 | #define _tmain WINE_tchar_routine(main, main, wmain)
|
---|
183 | #define _tmakepath WINE_tchar_routine(_makepath, _makepath, _wmakepath)
|
---|
184 | #define _tmkdir WINE_tchar_routine(mkdir, _mkdir, _wmkdir)
|
---|
185 | #define _tmktemp WINE_tchar_routine(mktemp, _mktemp, _wmktemp)
|
---|
186 | #define _tperror WINE_tchar_routine(perror, perror, _wperror)
|
---|
187 | #define _topen WINE_tchar_routine(open, _open, _wopen)
|
---|
188 | #define _totlower WINE_tchar_routine(tolower, _mbctolower, towlower)
|
---|
189 | #define _totupper WINE_tchar_routine(toupper, _mbctoupper, towupper)
|
---|
190 | #define _tpopen WINE_tchar_routine(popen, _popen, _wpopen)
|
---|
191 | #define _tprintf WINE_tchar_routine(printf, printf, wprintf)
|
---|
192 | #define _tremove WINE_tchar_routine(remove, remove, _wremove)
|
---|
193 | #define _trename WINE_tchar_routine(rename, rename, _wrename)
|
---|
194 | #define _trmdir WINE_tchar_routine(rmdir, _rmdir, _wrmdir)
|
---|
195 | #define _tsearchenv WINE_tchar_routine(_searchenv, _searchenv, _wsearchenv)
|
---|
196 | #define _tscanf WINE_tchar_routine(scanf, scanf, wscanf)
|
---|
197 | #define _tsetlocale WINE_tchar_routine(setlocale, setlocale, _wsetlocale)
|
---|
198 | #define _tsopen WINE_tchar_routine(_sopen, _sopen, _wsopen)
|
---|
199 | #define _tspawnl WINE_tchar_routine(_spawnl, _spawnl, _wspawnl)
|
---|
200 | #define _tspawnle WINE_tchar_routine(_spawnle, _spawnle, _wspawnle)
|
---|
201 | #define _tspawnlp WINE_tchar_routine(_spawnlp, _spawnlp, _wspawnlp)
|
---|
202 | #define _tspawnlpe WINE_tchar_routine(_spawnlpe, _spawnlpe, _wspawnlpe)
|
---|
203 | #define _tspawnv WINE_tchar_routine(_spawnv, _spawnv, _wspawnv)
|
---|
204 | #define _tspawnve WINE_tchar_routine(_spawnve, _spawnve, _wspawnve)
|
---|
205 | #define _tspawnvp WINE_tchar_routine(_spawnvp, _spawnvp, _tspawnvp)
|
---|
206 | #define _tspawnvpe WINE_tchar_routine(_spawnvpe, _spawnvpe, _tspawnvpe)
|
---|
207 | #define _tsplitpath WINE_tchar_routine(_splitpath, _splitpath, _wsplitpath)
|
---|
208 | #define _tstat WINE_tchar_routine(_stat, _stat, _wstat)
|
---|
209 | #define _tstrdate WINE_tchar_routine(_strdate, _strdate, _wstrdate)
|
---|
210 | #define _tstrtime WINE_tchar_routine(_strtime, _strtime, _wstrtime)
|
---|
211 | #define _tsystem WINE_tchar_routine(system, system, _wsystem)
|
---|
212 | #define _ttempnam WINE_tchar_routine(tempnam, _tempnam, _wtempnam)
|
---|
213 | #define _ttmpnam WINE_tchar_routine(tmpnam, tmpnam, _wtmpnam)
|
---|
214 | #define _ttoi WINE_tchar_routine(atoi, atoi, _wtoi)
|
---|
215 | #define _ttol WINE_tchar_routine(atol, atol, _wtol)
|
---|
216 | #define _tutime WINE_tchar_routine(utime, _utime, _wutime)
|
---|
217 | #define _tWinMain WINE_tchar_routine(WinMain, WinMain, wWinMain)
|
---|
218 | #define _ultot WINE_tchar_routine(_ultoa, _ultoa, _ultow)
|
---|
219 | #define _ungettc WINE_tchar_routine(ungetc, ungetc, ungetwc)
|
---|
220 | #define _vftprintf WINE_tchar_routine(vfprintf, vfprintf, vfwprintf)
|
---|
221 | #define _vsntprintf WINE_tchar_routine(vsnprintf, _vsnprintf, _vsnwprintf)
|
---|
222 | #define _vstprintf WINE_tchar_routine(vsprintf, vsprintf, vswprintf)
|
---|
223 | #define _vtprintf WINE_tchar_routine(vprintf, vprintf, vwprintf)
|
---|
224 | #define _TEOF WINE_tchar_routine(EOF, EOF, WEOF)
|
---|
225 |
|
---|
226 | #define __T(x) __TEXT(x)
|
---|
227 | #define _T(x) __T(x)
|
---|
228 | #define _TEXT(x) __T(x)
|
---|
229 |
|
---|
230 | #ifdef _UNICODE
|
---|
231 | #if !defined(_WINT_T_DEFINED) && !defined(__WINT_TYPE__)
|
---|
232 | typedef unsigned short wint_t;
|
---|
233 | #endif
|
---|
234 |
|
---|
235 | #ifndef _WCTYPE_T_DEFINED
|
---|
236 | typedef unsigned short wctype_t;
|
---|
237 | #define _WCTYPE_T_DEFINED
|
---|
238 | #endif
|
---|
239 |
|
---|
240 | #ifndef __TCHAR_DEFINED
|
---|
241 | #ifdef WINE_UNICODE_NATIVE
|
---|
242 | typedef wchar_t _TCHAR;
|
---|
243 | #else
|
---|
244 | typedef unsigned short _TCHAR;
|
---|
245 | #endif
|
---|
246 | typedef _TCHAR _TUCHAR;
|
---|
247 | typedef _TCHAR _TSCHAR;
|
---|
248 | typedef _TCHAR _TXCHAR;
|
---|
249 | typedef _TCHAR _TINT;
|
---|
250 | #define __TCHAR_DEFINED
|
---|
251 | #endif
|
---|
252 |
|
---|
253 | #else /* _UNICODE */
|
---|
254 | #ifndef __TCHAR_DEFINED
|
---|
255 | typedef char _TCHAR;
|
---|
256 | typedef unsigned char _TUCHAR;
|
---|
257 | typedef signed char _TSCHAR;
|
---|
258 | #ifndef _MBCS
|
---|
259 | typedef unsigned char _TXCHAR;
|
---|
260 | typedef int _TINT;
|
---|
261 | #else
|
---|
262 | typedef char _TXCHAR;
|
---|
263 | typedef unsigned int _TINT;
|
---|
264 | #endif
|
---|
265 | #endif
|
---|
266 | #endif
|
---|
267 |
|
---|
268 | #ifndef _TCHAR_DEFINED
|
---|
269 | typedef _TCHAR TCHAR, *PTCHAR;
|
---|
270 | #define _TCHAR_DEFINED
|
---|
271 | #endif
|
---|
272 |
|
---|
273 | #ifdef __cplusplus
|
---|
274 | } /* extern "C" */
|
---|
275 | #endif
|
---|
276 |
|
---|
277 | #endif /* __WINE_TCHAR_H */
|
---|