]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/Utils/common/wcharunix.h
Initial revision
[karo-tx-redboot.git] / tools / src / tools / Utils / common / wcharunix.h
1 //####COPYRIGHTBEGIN####
2 //                                                                          
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
8 // This program is free software; you can redistribute it and/or modify it 
9 // under the terms of the GNU General Public License as published by the Free 
10 // Software Foundation; either version 2 of the License, or (at your option) 
11 // any later version.
12 // 
13 // This program is distributed in the hope that it will be useful, but WITHOUT 
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
15 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
16 // more details.
17 // 
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc., 
20 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 //
22 // ----------------------------------------------------------------------------
23 //                                                                          
24 //####COPYRIGHTEND####
25
26 // ----------------------------------------------------------------------------
27 // This file defines the generic-text routine mappings found in TCHAR.H on windows
28 // ----------------------------------------------------------------------------
29
30 #define _TEOF       EOF
31
32 #define __T(x)      x
33
34
35 /* Program */
36
37 #define _tmain      main
38 #define _tWinMain   WinMain
39 #define _tenviron   environ
40 #define __targv     _argv
41
42
43 /* Formatted i/o */
44
45 #define _tprintf    printf
46 #define _ftprintf   fprintf
47 #define _stprintf   sprintf
48 #define _sntprintf  snprintf
49 #define _vtprintf   vprintf
50 #define _vftprintf  vfprintf
51 #define _vstprintf  vsprintf
52 #define _vsntprintf vsnprintf
53 #define _tscanf     scanf
54 #define _ftscanf    fscanf
55 #define _stscanf    sscanf
56
57
58 /* Unformatted i/o */
59
60 #define _fgettc     fgetc
61 #define _fgettchar  fgetchar
62 #define _fgetts     fgets
63 #define _fputtc     fputc
64 #define _fputtchar  fputchar
65 #define _fputts     fputs
66 #define _gettc      getc
67 #define _gettchar   getchar
68 #define _getts      gets
69 #define _puttc      putc
70 #define _puttchar   putchar
71 #define _putts      puts
72 #define _ungettc    ungetc
73
74
75 /* String conversion functions */
76
77 #define _tcstod     strtod
78 #define _tcstol     strtol
79 #define _tcstoul    strtoul
80
81 #define _itot       itoa
82 #define _ltot       ltoa
83 #define _ultot      ultoa
84 #define _ttoi       atoi
85 #define _ttol       atol
86
87 #define _ttoi64     atoi64
88 #define _i64tot     i64toa
89 #define _ui64tot    ui64toa
90
91 /* String functions */
92
93 /* Note that _mbscat, _mbscpy and _mbsdup are functionally equivalent to 
94    strcat, strcpy and strdup, respectively. */
95
96 #define _tcscat     strcat
97 #define _tcscpy     strcpy
98 #define _tcsdup     strdup
99
100 #define _tcslen     strlen
101 #define _tcsxfrm    strxfrm
102
103
104 /* Execute functions */
105
106 #define _texecl     execl
107 #define _texecle    execle
108 #define _texeclp    execlp
109 #define _texeclpe   execlpe
110 #define _texecv     execv
111 #define _texecve    execve
112 #define _texecvp    execvp
113 #define _texecvpe   execvpe
114
115 #define _tspawnl    spawnl
116 #define _tspawnle   spawnle
117 #define _tspawnlp   spawnlp
118 #define _tspawnlpe  spawnlpe
119 #define _tspawnv    spawnv
120 #define _tspawnve   spawnve
121 #define _tspawnvp   spawnvp
122 #define _tspawnvpe  spawnvpe
123
124 #define _tsystem    system
125
126
127 /* Time functions */
128
129 #define _tasctime   asctime
130 #define _tctime     ctime
131 #define _tstrdate   strdate
132 #define _tstrtime   strtime
133 #define _tutime     utime
134 #define _tcsftime   strftime
135
136
137 /* Directory functions */
138
139 #define _tchdir     chdir
140 #define _tgetcwd    getcwd
141 #define _tgetdcwd   getdcwd
142 #define _tmkdir(x)  mkdir(x,00700)
143 #define _trmdir     rmdir
144
145
146 /* Environment/Path functions */
147
148 #define _tfullpath  fullpath
149 #define _tgetenv    getenv
150 #define _tmakepath  makepath
151 // Yuck - /usr/include/stdlib.h defines it as char*, not const char*
152 #define _tputenv(s) putenv((char*)(s.c_str()))
153 #define _tsearchenv searchenv
154 #define _tsplitpath splitpath
155
156
157 /* Stdio functions */
158
159 #define _tfdopen    fdopen
160 #define _tfsopen    fsopen
161 #define _tfopen     fopen
162 #define _tfreopen   freopen
163 #define _tperror    perror
164 #define _tpopen     popen
165 #define _ttempnam   tempnam
166 #define _ttmpnam    tmpnam
167
168
169 /* Io functions */
170
171 #define _tchmod     chmod
172 #define _tcreat     creat
173 #define _tfindfirst findfirst
174 #define _tfindfirsti64  findfirsti64
175 #define _tfindnext  findnext
176 #define _tfindnexti64   findnexti64
177 #define _tmktemp    mktemp
178
179 #define _topen      open
180 #define _taccess    access
181
182 #define _tremove    remove
183 #define _trename    rename
184 #define _tsopen     sopen
185 #define _tunlink    unlink
186
187 #define _tfinddata_t    finddata_t
188 #define _tfinddatai64_t finddatai64_t
189
190
191 /* ctype functions */
192
193 #define _istascii   isascii
194 #define _istcntrl   iscntrl
195 #define _istxdigit  isxdigit
196
197
198 /* Stat functions */
199
200 #define _tstat      stat
201 #define _tstati64   stati64
202
203
204
205 /* ++++++++++++++++++++ SBCS ++++++++++++++++++++ */
206
207
208 typedef char            _TCHAR;
209 typedef signed char     _TSCHAR;
210 typedef unsigned char   _TUCHAR;
211 typedef char            _TXCHAR;
212 typedef int             _TINT;
213
214 /* String functions */
215
216 #define _tcschr     strchr
217 #define _tcscspn    strcspn
218 #define _tcsncat    strncat
219 #define _tcsncpy    strncpy
220 #define _tcspbrk    strpbrk
221 #define _tcsrchr    strrchr
222 #define _tcsspn     strspn
223 #define _tcsstr     strstr
224 #define _tcstok     strtok
225
226 #define _tcsnset    strnset
227 #define _tcsrev     strrev
228 #define _tcsset     strset
229
230 #define _tcscmp     strcmp
231 #define _tcsicmp    strcasecmp
232 #define _tcsnccmp   strncmp
233 #define _tcsncmp    strncmp
234 #define _tcsncicmp  strnicmp
235 #define _tcsnicmp   strncasecmp
236
237 #define _tcscoll    strcoll
238 #define _tcsicoll   stricoll
239 #define _tcsnccoll  strncoll
240 #define _tcsncoll   strncoll
241 #define _tcsncicoll strnicoll
242 #define _tcsnicoll  strnicoll
243
244
245 /* "logical-character" mappings */
246
247 #define _tcsclen    strlen
248 #define _tcsnccat   strncat
249 #define _tcsnccpy   strncpy
250 #define _tcsncset   strnset
251
252
253 /* MBCS-specific functions */
254
255 #define _tcsdec     strdec
256 #define _tcsinc     strinc
257 #define _tcsnbcnt   strncnt
258 #define _tcsnccnt   strncnt
259 #define _tcsnextc   strnextc
260 #define _tcsninc    strninc
261 #define _tcsspnp    strspnp
262
263 #define _tcslwr     strlwr
264 #define _tcsupr     strupr
265 #define _tcsxfrm    strxfrm
266
267 #define _istlead(_c)    (0)
268 #define _istleadbyte(_c)    (0)
269
270 /* ctype-functions */
271
272 #define _istalnum   isalnum
273 #define _istalpha   isalpha
274 #define _istdigit   isdigit
275 #define _istgraph   isgraph
276 #define _istlower   islower
277 #define _istprint   isprint
278 #define _istpunct   ispunct
279 #define _istspace   isspace
280 #define _istupper   isupper
281
282 #define _totupper   toupper
283 #define _totlower   tolower
284
285 #define _istlegal(_c)   (1)
286
287 typedef char *LPTSTR;
288 typedef const char *LPCTSTR;
289 typedef char TCHAR;
290
291 #define _TCHAR(x) x
292 #define _T(x) x
293