_str{dec,inc}: Cast the parameters to the proper type first
[wine] / include / tchar.h
1 #ifndef __WINE_TCHAR_H
2 #define __WINE_TCHAR_H
3
4 #include "windef.h"
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 /* FIXME: this should be in direct.h but since it's a standard C library include (on some systems)... */
11 #define _chdir chdir
12 #define _rmdir rmdir
13
14 /* FIXME: this should be in io.h but I believe it's a standard include on some systems... */
15 /* would need unistd.h */
16 #define _access access
17 /* would need sys/stat.h */
18 #define _chmod chmod
19 /* would need fcntl.h */
20 #define _creat creat
21 #define _open open
22 /* FIXME: we need _S_IWRITE, _O_CREAT ... */
23 /* FIXME: _fsopen is not implemented */
24 #define sopen _sopen
25 /* FIXME: _sopen is not implemented */
26
27 /* FIXME: this should be in stdio.h but since it's a standard C library include... */
28 #define fgetchar getchar
29 #define fputchar putchar
30 #define _popen popen
31 #define _tempnam tempnam
32 #define _vsnprintf vsnprintf
33
34 /* FIXME: this should be in stdlib.h but since it's a standard C library include... */
35 /* FIXME: itoa and ltoa are missing */
36 /* FIXME: _makepath is not implemented */
37 /* FIXME: _searchenv is not implemented */
38 /* FIXME: _splitpath is not implemented */
39
40 /* FIXME: this should be in string.h but since it's a standard C library include... */
41 #define _stricmp strcasecmp
42 #define _strcmpi strcasecmp
43 #define strcmpi strcasecmp
44 #define _strnicmp strncasecmp
45 #define strnicmp strncasecmp
46 #define _strdup strdup
47 /* FIXME: stricoll is not implemented but strcasecmp is probably close enough in most cases */
48 #define _stricoll strcasecmp
49 #define stricoll _stricoll
50 #define strlwr _strlwr
51 #define strnset _strnset
52 /* FIXME: _strnset is not implemented */
53 #define strrev CRTDLL__strrev
54 char *CRTDLL__strrev(char *string);
55 #define strset _strset
56 /* FIXME: _strset is not implemented */
57 #define strupr _strupr
58 #define ultoa _ultoa
59 /* FIXME: _ultoa is not implemented */
60
61 /* FIXME: this should be in sys/stat.h but since it's a standard C library include... */
62 #define _stat stat
63
64 /* FIXME: this should be in time.h but since it's a standard C library include... */
65 /* FIXME: _strdate is not implemented */
66 /* FIXME: _strtime is not implemented */
67
68 /* FIXME: this should be in utime.h but since it's a standard C library include... */
69 #define _utime utime
70
71
72 /*****************************************************************************
73  * tchar routines
74  */
75 #define _strdec(start,current)  (start<current?((char*)current)-1:NULL)
76 #define _strinc(current) (((char*)current)+1)
77 /* FIXME: _strncnt and strncnt are missing */
78 /* FIXME: _strspnp is not implemented */
79
80
81 /*****************************************************************************
82  * tchar mappings
83  */
84 #ifndef _UNICODE
85 #include <string.h>
86 #ifndef _MBCS
87 #define WINE_tchar_routine(std,mbcs,unicode) std
88 #else /* _MBCS defined */
89 #define WINE_tchar_routine(std,mbcs,unicode) mbcs
90 #endif
91 #else /* _UNICODE defined */
92 #define WINE_tchar_routine(std,mbcs,unicode) unicode
93 #endif
94
95 #define WINE_tchar_true(a) (1)
96 #define WINE_tchar_false(a) (0)
97 #define WINE_tchar_tclen(a) (1)
98 #define WINE_tchar_tccpy(a,b) do { *(a)=*(b); } while (0)
99
100 #define _fgettc       WINE_tchar_routine(fgetc,           fgetc,       fgetwc)
101 #define _fgettchar    WINE_tchar_routine(fgetchar,        fgetchar,    _fgetwchar)
102 #define _fgetts       WINE_tchar_routine(fgets,           fgets,       fgetws)
103 #define _fputtc       WINE_tchar_routine(fputc,           fputc,       fputwc)
104 #define _fputtchar    WINE_tchar_routine(fputchar,        fputchar,    _fputwchar)
105 #define _fputts       WINE_tchar_routine(fputs,           fputs,       fputws)
106 #define _ftprintf     WINE_tchar_routine(fprintf,         fprintf,     fwprintf)
107 #define _ftscanf      WINE_tchar_routine(fscanf,          fscanf,      fwscanf)
108 #define _gettc        WINE_tchar_routine(getc,            getc,        getwc)
109 #define _gettchar     WINE_tchar_routine(getchar,         getchar,     getwchar)
110 #define _getts        WINE_tchar_routine(gets,            gets,        getws)
111 #define _isalnum      WINE_tchar_routine(isalnum,         _ismbcalnum, iswalnum)
112 #define _istalpha     WINE_tchar_routine(isalpha,         _ismbcalpha, iswalpha)
113 #define _istascii     WINE_tchar_routine(__isascii,       __isascii,   iswascii)
114 #define _istcntrl     WINE_tchar_routine(iscntrl,         iscntrl,     iswcntrl)
115 #define _istdigit     WINE_tchar_routine(isdigit,         _ismbcdigit, iswdigit)
116 #define _istgraph     WINE_tchar_routine(isgraph,         _ismbcgraph, iswgraph)
117 #define _istlead      WINE_tchar_routine(WINE_tchar_false,_ismbblead,  WINE_tchar_false)
118 #define _istleadbyte  WINE_tchar_routine(WINE_tchar_false,isleadbyte,  WINE_tchar_false)
119 #define _istlegal     WINE_tchar_routine(WINE_tchar_true, _ismbclegal, WINE_tchar_true)
120 #define _istlower     WINE_tchar_routine(islower,         _ismbcslower,iswlower)
121 #define _istprint     WINE_tchar_routine(isprint,         _ismbcprint, iswprint)
122 #define _istpunct     WINE_tchar_routine(ispunct,         _ismbcpunct, iswpunct)
123 #define _istspace     WINE_tchar_routine(isspace,         _ismbcspace, iswspace)
124 #define _istupper     WINE_tchar_routine(isupper,         _ismbcupper, iswupper)
125 #define _istxdigit    WINE_tchar_routine(isxdigit,        isxdigit,    iswxdigit)
126 #define _itot         WINE_tchar_routine(_itoa,           _itoa,       _itow)
127 #define _ltot         WINE_tchar_routine(_ltoa,           _ltoa,       _ltow)
128 #define _puttc        WINE_tchar_routine(putc,            putc,        putwc)
129 #define _puttchar     WINE_tchar_routine(putchar,         putchar,     putwchar)
130 #define _putts        WINE_tchar_routine(puts,            puts,        putws)
131 #define _tmain        WINE_tchar_routine(main,            main,        wmain)
132 #define _sntprintf    WINE_tchar_routine(sprintf,         sprintf,     swprintf)
133 #define _stprintf     WINE_tchar_routine(sprintf,         sprintf,     swprintf)
134 #define _stscanf      WINE_tchar_routine(sscanf,          sscanf,      swscanf)
135 #define _taccess      WINE_tchar_routine(_access,         _access,     _waccess)
136 #define _tasctime     WINE_tchar_routine(asctime,         asctime,     _wasctime)
137 #define _tccpy        WINE_tchar_routine(WINE_tchar_tccpy,_mbccpy,     WINE_tchar_tccpy)
138 #define _tchdir       WINE_tchar_routine(_chdir,          _chdir,      _wchdir)
139 #define _tclen        WINE_tchar_routine(WINE_tchar_tclen,_mbclen,     WINE_tchar_tclen)
140 #define _tchmod       WINE_tchar_routine(_chmod,          _chmod,      _wchmod)
141 #define _tcreat       WINE_tchar_routine(_creat,          _creat,      _wcreat)
142 #define _tcscat       WINE_tchar_routine(strcat,          _mbscat,     wcscat)
143 #define _tcschr       WINE_tchar_routine(strchr,          _mbschr,     wcschr)
144 #define _tcsclen      WINE_tchar_routine(strlen,          _mbslen,     wcslen)
145 #define _tcscmp       WINE_tchar_routine(strcmp,          _mbscmp,     wcscmp)
146 #define _tcscoll      WINE_tchar_routine(strcoll,         _mbscoll,    wcscoll)
147 #define _tcscpy       WINE_tchar_routine(strcpy,          _mbscpy,     wcscpy)
148 #define _tcscspn      WINE_tchar_routine(strcspn,         _mbscspn,    wcscspn)
149 #define _tcsdec       WINE_tchar_routine(_strdec,         _mbsdec,     _wcsdec)
150 #define _tcsdup       WINE_tchar_routine(_strdup,         _mbsdup,     _wcsdup)
151 #define _tcsftime     WINE_tchar_routine(strftime,        strftime,    wcsftime)
152 #define _tcsicmp      WINE_tchar_routine(_stricmp,        _mbsicmp,    _wcsicmp)
153 #define _tcsicoll     WINE_tchar_routine(_stricoll,       _stricoll,   _wcsicoll)
154 #define _tcsinc       WINE_tchar_routine(_strinc,         _mbsinc,     _wcsinc)
155 #define _tcslen       WINE_tchar_routine(strlen,          strlen,      wcslen)
156 #define _tcslwr       WINE_tchar_routine(_strlwr,         _mbslwr,     _wcslwr)
157 #define _tcsnbcnt     WINE_tchar_routine(_strncnt,        _mbsnbcnt,   _wcnscnt)
158 #define _tcsncat      WINE_tchar_routine(strncat,         _mbsnbcat,   wcsncat)
159 #define _tcsnccat     WINE_tchar_routine(strncat,         _mbsncat,    wcsncat)
160 #define _tcsncmp      WINE_tchar_routine(strncmp,         _mbsnbcmp,   wcsncmp)
161 #define _tcsnccmp     WINE_tchar_routine(strncmp,         _mbsncmp,    wcsncmp)
162 #define _tcsnccnt     WINE_tchar_routine(_strncnt,        _mbsnccnt,   _wcsncnt)
163 #define _tcsnccpy     WINE_tchar_routine(strncpy,         _mbsncpy,    wcsncpy)
164 #define _tcsncicmp    WINE_tchar_routine(_strnicmp,       _mbsnicmp,   _wcsnicmp)
165 #define _tcsncpy      WINE_tchar_routine(strncpy,         _mbsnbcpy,   wcsncpy)
166 #define _tcsncset     WINE_tchar_routine(_strnset,        _mbsnset,    _wcsnset)
167 #define _tcsnextc     WINE_tchar_routine(_strnextc,       _mbsnextc,   _wcsnextc)
168 #define _tcsnicmp     WINE_tchar_routine(_strnicmp,       _mbsnicmp,   _wcsnicmp)
169 #define _tcsnicoll    WINE_tchar_routine(_strnicoll,      _strnicoll   _wcsnicoll)
170 #define _tcsninc      WINE_tchar_routine(_strninc,        _mbsninc,    _wcsninc)
171 #define _tcsnccnt     WINE_tchar_routine(_strncnt,        _mbsnccnt,   _wcsncnt)
172 #define _tcsnset      WINE_tchar_routine(_strnset,        _mbsnbset,   _wcsnset)
173 #define _tcspbrk      WINE_tchar_routine(strpbrk,         _mbspbrk,    wcspbrk)
174 #define _tcsspnp      WINE_tchar_routine(_strspnp,        _mbsspnp,    _wcsspnp)
175 #define _tcsrchr      WINE_tchar_routine(strrchr,         _mbsrchr,    wcsrchr)
176 #define _tcsrev       WINE_tchar_routine(_strrev,         _mbsrev,     _wcsrev)
177 #define _tcsset       WINE_tchar_routine(_strset,         _mbsset,     _wcsset)
178 #define _tcsspn       WINE_tchar_routine(strspn,          _mbsspn,     wcsspn)
179 #define _tcsstr       WINE_tchar_routine(strstr,          _mbsstr,     wcsstr)
180 #define _tcstod       WINE_tchar_routine(strtod,          strtod,      wcstod)
181 #define _tcstok       WINE_tchar_routine(strtok,          _mbstok,     wcstok)
182 #define _tcstol       WINE_tchar_routine(strtol,          strtol,      wcstol)
183 #define _tcstoul      WINE_tchar_routine(strtoul,         strtoul,     wcstoul)
184 #define _tcsupr       WINE_tchar_routine(_strupr,         _mbsupr,     _wcsupr)
185 #define _tcsxfrm      WINE_tchar_routine(strxfrm,         strxfrm,     wcsxfrm)
186 #define _tctime       WINE_tchar_routine(ctime,           ctime,       _wctime)
187 #define _texecl       WINE_tchar_routine(_execl,          _execl,      _wexecl)
188 #define _texecle      WINE_tchar_routine(_execle,         _execle,     _wexecle)
189 #define _texeclp      WINE_tchar_routine(_execlp,         _execlp,     _wexeclp)
190 #define _texeclpe     WINE_tchar_routine(_execlpe,        _execlpe,    _wexeclpe)
191 #define _texecv       WINE_tchar_routine(_execv,          _execv,      _wexecv)
192 #define _texecve      WINE_tchar_routine(_execve,         _execve,     _wexecve)
193 #define _texecvp      WINE_tchar_routine(_execvp,         _execvp,     _wexecvp)
194 #define _texecvpe     WINE_tchar_routine(_execvpe,        _execvpe,    _wexecvpe)
195 #define _tfdopen      WINE_tchar_routine(_fdopen,         _fdopen,     _wfdopen)
196 #define _tfinddata_t  WINE_tchar_routine(_finddata_t,     _finddata_t, _wfinddata_t)
197 #define _tfinddatai64_t WINE_tchar_routine(_finddatai64_t,_finddatai64_t,_wfinddatai64_t)
198 #define _tfindfirst   WINE_tchar_routine(_findfirst,      _findfirst,  _wfindfirst)
199 #define _tfindnext    WINE_tchar_routine(_findnext,       _findnext,   _wfindnext)
200 #define _tfopen       WINE_tchar_routine(fopen,           fopen,       _wfopen)
201 #define _tfreopen     WINE_tchar_routine(freopen,         freopen,     _wfreopen)
202 #define _tfsopen      WINE_tchar_routine(_fsopen,         _fsopen,     _wfsopen)
203 #define _tfullpath    WINE_tchar_routine(_fullpath,       _fullpath,   _wfullpath)
204 #define _tgetcwd      WINE_tchar_routine(_getcwd,         _getcwd,     _wgetcwd)
205 #define _tgetenv      WINE_tchar_routine(getenv,          getenv,      _wgetenv)
206 #define _tmain        WINE_tchar_routine(main,            main,        wmain)
207 #define _tmakepath    WINE_tchar_routine(_makepath,       _makepath,   _wmakepath)
208 #define _tmkdir       WINE_tchar_routine(_mkdir,          _mkdir,      _wmkdir)
209 #define _tmktemp      WINE_tchar_routine(_mktemp,         _mktemp,     _wmktemp)
210 #define _tperror      WINE_tchar_routine(perror,          perror,      _wperror)
211 #define _topen        WINE_tchar_routine(_open,           _open,       _wopen)
212 #define _totlower     WINE_tchar_routine(tolower,         _mbctolower, towlower)
213 #define _totupper     WINE_tchar_routine(toupper,         _mbctoupper, towupper)
214 #define _tpopen       WINE_tchar_routine(_popen,          _popen,      _wpopen)
215 #define _tprintf      WINE_tchar_routine(printf,          printf,      wprintf)
216 #define _tremove      WINE_tchar_routine(remove,          remove,      _wremove)
217 #define _trename      WINE_tchar_routine(rename,          rename,      _wrename)
218 #define _trmdir       WINE_tchar_routine(_rmdir,          _rmdir,      _wrmdir)
219 #define _tsearchenv   WINE_tchar_routine(_searchenv,      _searchenv,  _wsearchenv)
220 #define _tscanf       WINE_tchar_routine(scanf,           scanf,       wscanf)
221 #define _tsetlocale   WINE_tchar_routine(setlocale,       setlocale,   _wsetlocale)
222 #define _tsopen       WINE_tchar_routine(_sopen,          _sopen,      _wsopen)
223 #define _tspawnl      WINE_tchar_routine(_spawnl,         _spawnl,     _wspawnl)
224 #define _tspawnle     WINE_tchar_routine(_spawnle,        _spawnle,    _wspawnle)
225 #define _tspawnlp     WINE_tchar_routine(_spawnlp,        _spawnlp,    _wspawnlp)
226 #define _tspawnlpe    WINE_tchar_routine(_spawnlpe,       _spawnlpe,   _wspawnlpe)
227 #define _tspawnv      WINE_tchar_routine(_spawnv,         _spawnv,     _wspawnv)
228 #define _tspawnve     WINE_tchar_routine(_spawnve,        _spawnve,    _wspawnve)
229 #define _tspawnvp     WINE_tchar_routine(_spawnvp,        _spawnvp,    _tspawnvp)
230 #define _tspawnvpe    WINE_tchar_routine(_spawnvpe,       _spawnvpe,   _tspawnvpe)
231 #define _tsplitpath   WINE_tchar_routine(_splitpath,      _splitpath,  _wsplitpath)
232 #define _tstat        WINE_tchar_routine(_stat,           _stat,       _wstat)
233 #define _tstrdate     WINE_tchar_routine(_strdate,        _strdate,    _wstrdate)
234 #define _tstrtime     WINE_tchar_routine(_strtime,        _strtime,    _wstrtime)
235 #define _tsystem      WINE_tchar_routine(system,          system,      _wsystem)
236 #define _ttempnam     WINE_tchar_routine(_tempnam,        _tempnam,    _wtempnam)
237 #define _ttmpnam      WINE_tchar_routine(tmpnam,          tmpnam,      _wtmpnam)
238 #define _ttoi         WINE_tchar_routine(atoi,            atoi,        _wtoi)
239 #define _ttol         WINE_tchar_routine(atol,            atol,        _wtol)
240 #define _tutime       WINE_tchar_routine(_utime,          _utime,      _wutime)
241 #define _tWinMain     WINE_tchar_routine(WinMain,         WinMain,     wWinMain)
242 #define _ultot        WINE_tchar_routine(_ultoa,          _ultoa,      _ultow)
243 #define _ungettc      WINE_tchar_routine(ungetc,          ungetc,      ungetwc)
244 #define _vftprintf    WINE_tchar_routine(vfprintf,        vfprintf,    vfwprintf)
245 #define _vsntprintf   WINE_tchar_routine(_vsnprintf,      _vsnprintf,  _vsnwprintf)
246 #define _vstprintf    WINE_tchar_routine(vsprintf,        vsprintf,    vswprintf)
247 #define _vtprintf     WINE_tchar_routine(vprintf,         vprintf,     vwprintf)
248
249 #define _T(x) __T(x)
250 #define _TEXT(x) __T(x)
251 #define __T(x) x
252
253 typedef CHAR  _TCHARA;
254 typedef WCHAR _TCHARW;
255 DECL_WINELIB_TYPE_AW(_TCHAR)
256 typedef UCHAR  _TUCHARA;
257 typedef WCHAR _TUCHARW;
258 DECL_WINELIB_TYPE_AW(_TUCHAR)
259          
260 #ifdef __cplusplus
261 } /* extern "C" */
262 #endif
263                                  
264 #endif /* __WINE_TCHAR_H */