]>
Commit | Line | Data |
---|---|---|
e35d0039 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wxchar.h | |
3 | // Purpose: Declarations common to wx char/wchar_t usage (wide chars) | |
4 | // Author: Joel Farley | |
5 | // Modified by: | |
6 | // Created: 1998/06/12 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) wxWindows copyright | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_WXCHAR_H_ | |
13 | #define _WX_WXCHAR_H_ | |
14 | ||
191ab39a VZ |
15 | #ifdef __GNUG__ |
16 | #pragma interface "wxchar.h" | |
17 | #endif | |
e35d0039 JS |
18 | |
19 | // only do SBCS or _UNICODE | |
20 | #if defined (_MBCS ) | |
b14391d1 JS |
21 | // It may be OK anyway. |
22 | // # error "MBCS is not supported by wxChar" | |
e35d0039 JS |
23 | #endif |
24 | ||
f6bcfd97 BP |
25 | // ---------------------------------------------------------------------------- |
26 | // first deal with Unicode setting | |
27 | // ---------------------------------------------------------------------------- | |
28 | ||
853d7d3d OK |
29 | // set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined |
30 | #if defined(_UNICODE) || defined(UNICODE) | |
1777b9bb DW |
31 | # undef wxUSE_UNICODE |
32 | # define wxUSE_UNICODE 1 | |
853d7d3d | 33 | #else |
1777b9bb DW |
34 | # ifndef wxUSE_UNICODE |
35 | # define wxUSE_UNICODE 0 | |
36 | # endif | |
f6bcfd97 | 37 | #endif // Unicode |
853d7d3d OK |
38 | |
39 | // and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1... | |
40 | #if wxUSE_UNICODE | |
1777b9bb DW |
41 | # ifndef _UNICODE |
42 | # define _UNICODE | |
43 | # endif | |
44 | # ifndef UNICODE | |
45 | # define UNICODE | |
46 | # endif | |
f6bcfd97 BP |
47 | #endif // Unicode |
48 | ||
49 | // Unicode support requires wchar_t | |
50 | #if wxUSE_UNICODE | |
51 | # undef wxUSE_WCHAR_T | |
52 | # define wxUSE_WCHAR_T 1 | |
53 | #endif // Unicode | |
853d7d3d | 54 | |
191ab39a VZ |
55 | // ---------------------------------------------------------------------------- |
56 | // define wxHAVE_TCHAR_FUNCTIONS for the compilers which support the | |
57 | // wide-character functions | |
58 | // ---------------------------------------------------------------------------- | |
59 | ||
60 | #ifdef __WIN32__ | |
61 | // VC++ and BC++ starting with 5.2 have TCHAR support | |
62 | #ifdef __VISUALC__ | |
63 | #define wxHAVE_TCHAR_FUNCTIONS | |
64 | #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520) | |
65 | #define wxHAVE_TCHAR_FUNCTIONS | |
a5940c66 | 66 | #elif defined(__GNUWIN32__) && wxCHECK_W32API_VERSION( 1, 0 ) |
161f4f73 VZ |
67 | #define wxHAVE_TCHAR_FUNCTIONS |
68 | #include <stddef.h> | |
69 | #include <string.h> | |
70 | #include <ctype.h> | |
191ab39a VZ |
71 | #endif |
72 | #elif defined(__VISAGECPP__) && (__IBMCPP__ >= 400) | |
73 | // VisualAge 4.0+ supports TCHAR | |
74 | #define wxHAVE_TCHAR_FUNCTIONS | |
75 | ||
76 | // but not stdio.h nor time nor conversion functions | |
77 | #define wxNO_TCHAR_STDIO | |
78 | #define wxNO_TCHAR_STDLIB | |
79 | #define wxNO_TCHAR_TIME | |
9dea36ef DW |
80 | #define wxNO_TCHAR_LOCALE |
81 | // | |
82 | // supplemental VA V4 defs so at least we know what these are | |
83 | // just define to standard defs | |
84 | // | |
85 | ||
86 | // for wcslen | |
87 | #include <wchar.h> | |
88 | ||
89 | // locale.h functons -- not defined in tchar.h | |
90 | #define wxSetlocale setlocale | |
91 | // some stdio functions are defined others are not | |
92 | // these are not | |
93 | #define wxFgetchar fgetchar | |
94 | #define wxFopen fopen | |
95 | #define wxFputchar fputchar | |
96 | #define wxFreopen freopen | |
97 | #define wxGets gets | |
98 | #define wxPerror perror | |
99 | #define wxPuts puts | |
100 | #define wxRemove remove | |
101 | #define wxRename rename | |
102 | #define wxTmpnam tmpnam | |
103 | #define wxUngetc ungetc | |
104 | #define wxVsscanf vsscanf | |
105 | // stdlib not defined in VA V4 | |
106 | #if !wxUSE_UNICODE | |
107 | # define wxAtof atof | |
108 | #endif | |
109 | #define wxAtoi atoi | |
110 | #define wxAtol atol | |
111 | #define wxGetenv getenv | |
112 | #define wxSystem system | |
113 | // time.h functions -- none defined in tchar.h | |
114 | #define wxAsctime asctime | |
115 | #define wxCtime ctime | |
f6bcfd97 | 116 | #endif // compilers with (good) TCHAR support |
e35d0039 | 117 | |
191ab39a | 118 | #ifdef wxHAVE_TCHAR_FUNCTIONS |
1777b9bb | 119 | # define HAVE_WCSLEN 1 |
a23fd0e1 | 120 | |
1777b9bb | 121 | # include <tchar.h> |
73974df1 | 122 | |
1777b9bb | 123 | # if wxUSE_UNICODE // temporary - preserve binary compatibility |
161f4f73 VZ |
124 | #if defined(__GNUWIN32__) |
125 | #define _TCHAR TCHAR | |
126 | #define _TSCHAR TCHAR | |
127 | #define _TUCHAR TCHAR | |
128 | #endif | |
129 | ||
e35d0039 | 130 | typedef _TCHAR wxChar; |
3f4a0c5b | 131 | typedef _TSCHAR wxSChar; |
e35d0039 | 132 | typedef _TUCHAR wxUChar; |
1777b9bb DW |
133 | # else |
134 | # define wxChar char | |
135 | # define wxSChar signed char | |
136 | # define wxUChar unsigned char | |
137 | # endif | |
f6bcfd97 BP |
138 | |
139 | // wchar_t is available | |
140 | #ifndef wxUSE_WCHAR_T | |
141 | #define wxUSE_WCHAR_T 1 | |
142 | #endif // !defined(wxUSE_WCHAR_T) | |
e35d0039 JS |
143 | |
144 | // ctype.h functions | |
191ab39a | 145 | #ifndef wxNO_TCHAR_CTYPE |
f3773655 OK |
146 | #ifdef __BORLANDC__ |
147 | # include <ctype.h> | |
148 | #endif | |
1777b9bb DW |
149 | # define wxIsalnum _istalnum |
150 | # define wxIsalpha _istalpha | |
151 | # define wxIsctrl _istctrl | |
152 | # define wxIsdigit _istdigit | |
153 | # define wxIsgraph _istgraph | |
154 | # define wxIslower _istlower | |
155 | # define wxIsprint _istprint | |
156 | # define wxIspunct _istpunct | |
157 | # define wxIsspace _istspace | |
158 | # define wxIsupper _istupper | |
159 | # define wxIsxdigit _istxdigit | |
160 | # define wxTolower _totlower | |
161 | # define wxToupper _totupper | |
191ab39a | 162 | #endif // wxNO_TCHAR_CTYPE |
e35d0039 JS |
163 | |
164 | // locale.h functons | |
191ab39a | 165 | #ifndef wxNO_TCHAR_LOCALE |
1777b9bb | 166 | # define wxSetlocale _tsetlocale |
191ab39a | 167 | #endif // wxNO_TCHAR_LOCALE |
e35d0039 JS |
168 | |
169 | // string.h functions | |
191ab39a | 170 | #ifndef wxNO_TCHAR_STRING |
1777b9bb DW |
171 | # define wxStrcat _tcscat |
172 | # define wxStrchr _tcschr | |
173 | # define wxStrcmp _tcscmp | |
174 | # define wxStrcoll _tcscoll | |
175 | # define wxStrcpy _tcscpy | |
176 | # define wxStrcspn _tcscspn | |
177 | # define wxStrftime _tcsftime | |
178 | # define wxStricmp _tcsicmp | |
1e6feb95 | 179 | # define wxStrnicmp _tcsnicmp |
1777b9bb DW |
180 | # define wxStrlen_ _tcslen // used in wxStrlen inline function |
181 | # define wxStrncat _tcsncat | |
182 | # define wxStrncmp _tcsncmp | |
183 | # define wxStrncpy _tcsncpy | |
184 | # define wxStrpbrk _tcspbrk | |
185 | # define wxStrrchr _tcsrchr | |
186 | # define wxStrspn _tcsspn | |
187 | # define wxStrstr _tcsstr | |
188 | # define wxStrtod _tcstod | |
1777b9bb DW |
189 | # define wxStrtol _tcstol |
190 | # define wxStrtoul _tcstoul | |
191 | # define wxStrxfrm _tcsxfrm | |
191ab39a | 192 | #endif // wxNO_TCHAR_STRING |
e35d0039 JS |
193 | |
194 | // stdio.h functions | |
191ab39a | 195 | #ifndef wxNO_TCHAR_STDIO |
1777b9bb DW |
196 | # define wxFgetc _fgettc |
197 | # define wxFgetchar _fgettchar | |
198 | # define wxFgets _fgetts | |
199 | # define wxFopen _tfopen | |
200 | # define wxFputc _fputtc | |
201 | # define wxFputchar _fputtchar | |
202 | # define wxFprintf _ftprintf | |
203 | # define wxFreopen _tfreopen | |
204 | # define wxFscanf _ftscanf | |
205 | # define wxGetc _gettc | |
206 | # define wxGetchar _gettchar | |
207 | # define wxGets _getts | |
208 | # define wxPerror _tperror | |
209 | # define wxPrintf _tprintf | |
210 | # define wxPutc _puttc | |
211 | # define wxPutchar _puttchar | |
212 | # define wxPuts _putts | |
213 | # define wxRemove _tremove | |
214 | # define wxRename _trename | |
215 | # define wxScanf _tscanf | |
216 | # define wxSprintf _stprintf | |
217 | # define wxSscanf _stscanf | |
218 | # define wxTmpnam _ttmpnam | |
219 | # define wxUngetc _tungetc | |
220 | # define wxVfprint _vftprintf | |
221 | # define wxVprintf _vtprintf | |
222 | # define wxVsscanf _vstscanf | |
223 | # define wxVsprintf _vstprintf | |
9dea36ef | 224 | #elif defined(__VISAGECPP__) && (__IBMCPP__ >= 400) |
191ab39a | 225 | // it has some stdio.h functions, apparently |
c7173739 | 226 | # define wxFgetc _fgettc |
c7173739 | 227 | # define wxFgets _fgetts |
c7173739 | 228 | # define wxFputc _fputtc |
c7173739 | 229 | # define wxFprintf _ftprintf |
c7173739 VZ |
230 | # define wxFscanf _ftscanf |
231 | # define wxGetc _gettc | |
232 | # define wxGetchar _gettchar | |
c7173739 VZ |
233 | # define wxPrintf _tprintf |
234 | # define wxPutc _puttc | |
235 | # define wxPutchar _puttchar | |
c7173739 VZ |
236 | # define wxScanf _tscanf |
237 | # define wxSprintf _stprintf | |
238 | # define wxSscanf _stscanf | |
c7173739 VZ |
239 | # define wxVfprint _vftprintf |
240 | # define wxVprintf _vtprintf | |
c7173739 | 241 | # define wxVsprintf _vstprintf |
191ab39a | 242 | #endif // wxNO_TCHAR_STDIO |
c7173739 VZ |
243 | |
244 | // stdlib.h functions | |
191ab39a VZ |
245 | #ifndef wxNO_TCHAR_STDLIB |
246 | # if !wxUSE_UNICODE | |
247 | # define wxAtof atof | |
248 | # endif | |
c7173739 VZ |
249 | # define wxAtoi _ttoi |
250 | # define wxAtol _ttol | |
251 | # define wxGetenv _tgetenv | |
252 | # define wxSystem _tsystem | |
191ab39a | 253 | #endif // wxNO_TCHAR_STDLIB |
c7173739 VZ |
254 | |
255 | // time.h functions | |
191ab39a | 256 | #ifndef wxNO_TCHAR_TIME |
c7173739 VZ |
257 | # define wxAsctime _tasctime |
258 | # define wxCtime _tctime | |
191ab39a | 259 | #endif // wxNO_TCHAR_TIME |
c7173739 | 260 | |
191ab39a | 261 | #else // !TCHAR-aware compilers |
34f9227c | 262 | |
81d425f6 | 263 | // check whether we should include wchar.h or equivalent |
f6bcfd97 | 264 | # if !defined(wxUSE_WCHAR_T) |
1777b9bb DW |
265 | # if defined(__VISUALC__) && (__VISUALC__ < 900) |
266 | # define wxUSE_WCHAR_T 0 // wchar_t is not available for MSVC++ 1.5 | |
267 | # elif defined(__UNIX__) | |
6e040042 | 268 | # if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) || (defined(__DARWIN__)) |
1777b9bb DW |
269 | # define wxUSE_WCHAR_T 1 |
270 | # else | |
271 | # define wxUSE_WCHAR_T 0 | |
272 | # endif | |
273 | # elif defined(__GNUWIN32__) && !defined(__MINGW32__) // Cygwin (not Mingw32) doesn't have wcslen.h, needed in buffer.h | |
274 | # define wxUSE_WCHAR_T 0 | |
275 | # elif defined(__BORLANDC__) // WIN16 BC++ | |
276 | # define wxUSE_WCHAR_T 0 | |
277 | # elif defined(__WATCOMC__) | |
278 | # define wxUSE_WCHAR_T 0 | |
9dea36ef DW |
279 | # elif defined(__VISAGECPP__) && (__IBMCPP__ >= 400) |
280 | # define wxUSE_WCHAR_T 1 | |
1777b9bb | 281 | # else |
a89ae1e4 | 282 | // add additional compiler checks if this fails |
1777b9bb DW |
283 | # define wxUSE_WCHAR_T 1 |
284 | # endif | |
f6bcfd97 | 285 | # endif // !defined(wxUSE_WCHAR_T) |
1777b9bb DW |
286 | |
287 | # if wxUSE_WCHAR_T | |
288 | # ifdef HAVE_WCSTR_H | |
289 | # include <wcstr.h> | |
290 | # else | |
6e040042 | 291 | # if defined(__FreeBSD__) || defined(__DARWIN__) |
1777b9bb DW |
292 | # include <stdlib.h> |
293 | # define wxNEED_WCSLEN | |
79af3d38 GD |
294 | # else |
295 | # include <wchar.h> | |
1777b9bb DW |
296 | # endif |
297 | # endif | |
298 | # endif | |
65d77246 | 299 | |
34f9227c | 300 | // check whether we are doing Unicode |
1777b9bb | 301 | # if wxUSE_UNICODE |
34f9227c | 302 | |
1777b9bb | 303 | # include <wctype.h> |
34f9227c OK |
304 | |
305 | // this is probably glibc-specific | |
1777b9bb | 306 | # if defined(__WCHAR_TYPE__) |
34f9227c OK |
307 | |
308 | typedef __WCHAR_TYPE__ wxChar; | |
309 | typedef signed __WCHAR_TYPE__ wxSChar; | |
310 | typedef unsigned __WCHAR_TYPE__ wxUChar; | |
311 | ||
cdb51680 | 312 | # define _T(x) L##x |
1777b9bb DW |
313 | |
314 | // ctype.h functions (wctype.h) | |
315 | # define wxIsalnum iswalnum | |
316 | # define wxIsalpha iswalpha | |
317 | # define wxIsctrl iswcntrl | |
318 | # define wxIsdigit iswdigit | |
319 | # define wxIsgraph iswgraph | |
320 | # define wxIslower iswlower | |
321 | # define wxIsprint iswprint | |
322 | # define wxIspunct iswpunct | |
323 | # define wxIsspace iswspace | |
324 | # define wxIsupper iswupper | |
325 | # define wxIsxdigit iswxdigit | |
326 | ||
327 | # if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) | |
328 | // /usr/include/wctype.h incorrectly declares translations tables which | |
329 | // provokes tons of compile-time warnings - try to correct this | |
330 | # define wxTolower(wc) towctrans((wc), (wctrans_t)__ctype_tolower) | |
331 | # define wxToupper(wc) towctrans((wc), (wctrans_t)__ctype_toupper) | |
332 | # else | |
333 | # define wxTolower towlower | |
334 | # define wxToupper towupper | |
335 | # endif // gcc/!gcc | |
336 | ||
337 | // string.h functions (wchar.h) | |
338 | # define wxStrcat wcscat | |
339 | # define wxStrchr wcschr | |
340 | # define wxStrcmp wcscmp | |
341 | # define wxStrcoll wcscoll | |
342 | # define wxStrcpy wcscpy | |
343 | # define wxStrcspn wcscspn | |
344 | # define wxStrlen_ wcslen // used in wxStrlen inline function | |
345 | # define wxStrncat wcsncat | |
346 | # define wxStrncmp wcsncmp | |
347 | # define wxStrncpy wcsncpy | |
348 | # define wxStrpbrk wcspbrk | |
349 | # define wxStrrchr wcsrchr | |
350 | # define wxStrspn wcsspn | |
351 | # define wxStrstr wcsstr | |
352 | # define wxStrtod wcstod | |
353 | # define wxStrtok wcstok | |
354 | # define wxStrtol wcstol | |
355 | # define wxStrtoul wcstoul | |
356 | # define wxStrxfrm wcsxfrm | |
e35d0039 | 357 | |
34f9227c | 358 | // glibc doesn't have wc equivalents of the other stuff |
1777b9bb DW |
359 | # define wxNEED_WX_STDIO_H |
360 | # define wxNEED_WX_STDLIB_H | |
361 | # define wxNEED_WX_TIME_H | |
34f9227c | 362 | |
1777b9bb DW |
363 | # else//!glibc |
364 | # error "Please define your compiler's Unicode conventions in wxChar.h" | |
365 | # endif | |
366 | # else//!Unicode | |
e35d0039 | 367 | |
1777b9bb DW |
368 | # include <ctype.h> |
369 | # include <string.h> | |
e97a90f0 | 370 | |
e90c1d2a VZ |
371 | # if 0 // temporary - preserve binary compatibilty |
372 | typedef char wxChar; | |
373 | typedef signed char wxSChar; | |
374 | typedef unsigned char wxUChar; | |
375 | # else | |
376 | # define wxChar char | |
377 | # define wxSChar signed char | |
378 | # define wxUChar unsigned char | |
379 | # endif | |
380 | ||
6e040042 | 381 | # if defined(__FreeBSD__) || defined(__DARWIN__) |
cdb51680 | 382 | # undef _T |
e90c1d2a | 383 | # endif |
b4fe5125 JS |
384 | |
385 | # if !defined(__MINGW32__) || !defined(_T) | |
386 | # define _T(x) x | |
387 | # endif | |
1777b9bb DW |
388 | |
389 | // ctype.h functions | |
e90c1d2a VZ |
390 | # define wxIsalnum isalnum |
391 | # define wxIsalpha isalpha | |
392 | # define wxIsctrl isctrl | |
393 | # define wxIsdigit isdigit | |
394 | # define wxIsgraph isgraph | |
395 | # define wxIslower islower | |
396 | # define wxIsprint isprint | |
397 | # define wxIspunct ispunct | |
398 | # define wxIsspace isspace | |
399 | # define wxIsupper isupper | |
400 | # define wxIsxdigit isxdigit | |
401 | # define wxTolower tolower | |
402 | # define wxToupper toupper | |
403 | ||
404 | // locale.h functons | |
405 | # define wxSetlocale setlocale | |
406 | ||
407 | // string.h functions | |
408 | // #define wxStricmp strcasecmp | |
409 | // wxStricmp is defined below!! | |
410 | ||
411 | #ifdef HAVE_STRTOK_R | |
412 | #define wxStrtok(str, sep, last) strtok_r(str, sep, last) | |
413 | #else | |
414 | #define wxStrtok(str, sep, last) strtok(str, sep) | |
415 | #endif | |
1777b9bb DW |
416 | |
417 | // leave the rest to defaults below | |
e90c1d2a VZ |
418 | # define wxNEED_WX_STRING_H |
419 | # define wxNEED_WX_STDIO_H | |
420 | # define wxNEED_WX_STDLIB_H | |
421 | # define wxNEED_WX_TIME_H | |
1777b9bb DW |
422 | |
423 | # endif//Unicode | |
853d7d3d OK |
424 | #endif//TCHAR-aware compilers |
425 | ||
426 | // define wxStricmp for various compilers without Unicode possibilities | |
427 | #if !defined(wxStricmp) && !wxUSE_UNICODE | |
fd9811b1 | 428 | # if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__SALFORDC__) || defined(__VISAGECPP__) || defined(__EMX__) |
1777b9bb | 429 | # define wxStricmp stricmp |
9199e66f | 430 | # define wxStrnicmp strnicmp |
585ae8cb | 431 | # elif defined(__SC__) || defined(__VISUALC__) || (defined(__MWERKS__) && defined(__INTEL__)) |
1777b9bb | 432 | # define wxStricmp _stricmp |
9199e66f | 433 | # define wxStrnicmp _strnicmp |
03e11df5 | 434 | # elif defined(__UNIX__) || defined(__GNUWIN32__) |
1777b9bb | 435 | # define wxStricmp strcasecmp |
9199e66f | 436 | # define wxStrnicmp strncasecmp |
1777b9bb DW |
437 | # elif defined(__MWERKS__) && !defined(__INTEL__) |
438 | // use wxWindows' implementation | |
439 | # else | |
440 | // if you leave wxStricmp undefined, wxWindows' implementation will be used | |
441 | # error "Please define string case-insensitive compare for your OS/compiler" | |
442 | # endif | |
853d7d3d OK |
443 | #endif |
444 | ||
445 | // if we need to define for standard headers, and we're not using Unicode, | |
446 | // just define to standard C library routines | |
447 | #if !wxUSE_UNICODE | |
1777b9bb DW |
448 | # ifdef wxNEED_WX_STRING_H |
449 | # define wxStrcat strcat | |
450 | # define wxStrchr strchr | |
451 | # define wxStrcmp strcmp | |
452 | # define wxStrcoll strcoll | |
453 | # define wxStrcpy strcpy | |
454 | # define wxStrcspn strcspn | |
455 | # define wxStrdup strdup | |
456 | # define wxStrlen_ strlen // used in wxStrlen inline function | |
457 | # define wxStrncat strncat | |
458 | # define wxStrncmp strncmp | |
459 | # define wxStrncpy strncpy | |
460 | # define wxStrpbrk strpbrk | |
461 | # define wxStrrchr strrchr | |
462 | # define wxStrspn strspn | |
463 | # define wxStrstr strstr | |
464 | # define wxStrtod strtod | |
465 | # define wxStrtol strtol | |
466 | # define wxStrtoul strtoul | |
467 | # define wxStrxfrm strxfrm | |
468 | # undef wxNEED_WX_STRING_H | |
469 | # endif | |
470 | ||
471 | # ifdef wxNEED_WX_STDIO_H | |
472 | # define wxFgetc fgetc | |
473 | # define wxFgetchar fgetchar | |
474 | # define wxFgets fgets | |
475 | # define wxFopen fopen | |
476 | # define wxFputc fputc | |
477 | # define wxFputchar fputchar | |
478 | # define wxFprintf fprintf | |
479 | # define wxFreopen freopen | |
480 | # define wxFscanf fscanf | |
481 | # define wxGetc getc | |
482 | # define wxGetchar getchar | |
483 | # define wxGets gets | |
484 | # define wxPerror perror | |
485 | # define wxPrintf printf | |
486 | # define wxPutc putc | |
487 | # define wxPutchar putchar | |
488 | # define wxPuts puts | |
489 | # define wxRemove remove | |
490 | # define wxRename rename | |
491 | # define wxScanf scanf | |
492 | # define wxSprintf sprintf | |
493 | # define wxSscanf sscanf | |
494 | # define wxTmpnam tmpnam | |
495 | # define wxUngetc ungetc | |
496 | # define wxVfprint vfprintf | |
497 | # define wxVprintf vprintf | |
498 | # define wxVsscanf vsscanf | |
499 | # define wxVsprintf vsprintf | |
500 | # undef wxNEED_WX_STDIO_H | |
501 | # endif | |
502 | ||
503 | # ifdef wxNEED_WX_STDLIB_H | |
504 | # define wxAtof atof | |
505 | # define wxAtoi atoi | |
506 | # define wxAtol atol | |
507 | # define wxGetenv getenv | |
508 | # define wxSystem system | |
509 | # undef wxNEED_WX_STDLIB_H | |
510 | # endif | |
511 | ||
512 | # ifdef wxNEED_WX_TIME_H | |
513 | # define wxAsctime asctime | |
514 | # define wxCtime ctime | |
515 | # define wxStrftime strftime | |
516 | # undef wxNEED_WX_TIME_H | |
517 | # endif | |
853d7d3d | 518 | #endif //!Unicode |
e35d0039 | 519 | |
853d7d3d | 520 | #if defined(wxNEED_WCSLEN) && wxUSE_UNICODE |
1777b9bb DW |
521 | # define wcslen wxStrlen |
522 | # undef wxNEED_WCSLEN | |
853d7d3d | 523 | #endif |
e35d0039 | 524 | |
191ab39a | 525 | // checks whether the passed in pointer is NULL and if the string is empty |
6d56eb5c | 526 | inline bool wxIsEmpty(const wxChar *p) { return !p || !*p; } |
e35d0039 | 527 | |
853d7d3d | 528 | #ifndef wxNEED_WX_STRING_H |
191ab39a | 529 | // safe version of strlen() (returns 0 if passed NULL pointer) |
6d56eb5c | 530 | inline size_t wxStrlen(const wxChar *psz) |
853d7d3d | 531 | { return psz ? wxStrlen_(psz) : 0; } |
34f9227c | 532 | #endif |
e35d0039 | 533 | |
81d425f6 | 534 | #if wxUSE_WCHAR_T |
e97a90f0 | 535 | // multibyte<->widechar conversion |
49828363 RD |
536 | WXDLLEXPORT size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n); |
537 | WXDLLEXPORT size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); | |
1777b9bb DW |
538 | # if wxUSE_UNICODE |
539 | # define wxMB2WX wxMB2WC | |
540 | # define wxWX2MB wxWC2MB | |
541 | # define wxWC2WX wxStrncpy | |
542 | # define wxWX2WC wxStrncpy | |
543 | # else | |
544 | # define wxMB2WX wxStrncpy | |
545 | # define wxWX2MB wxStrncpy | |
546 | # define wxWC2WX wxWC2MB | |
547 | # define wxWX2WC wxMB2WC | |
548 | # endif | |
0f3e3e0c JS |
549 | #else |
550 | // No wxUSE_WCHAR_T: we have to do something (JACS) | |
1777b9bb DW |
551 | # define wxMB2WC wxStrncpy |
552 | # define wxWC2MB wxStrncpy | |
553 | # define wxMB2WX wxStrncpy | |
554 | # define wxWX2MB wxStrncpy | |
555 | # define wxWC2WX wxWC2MB | |
556 | # define wxWX2WC wxMB2WC | |
81d425f6 | 557 | #endif |
0f3e3e0c | 558 | |
49828363 | 559 | WXDLLEXPORT bool wxOKlibc(); // for internal use |
e97a90f0 OK |
560 | |
561 | // if libc versions are not available, use replacements defined in wxchar.cpp | |
562 | #ifndef wxStrdup | |
49828363 | 563 | WXDLLEXPORT wxChar * wxStrdup(const wxChar *psz); |
e97a90f0 OK |
564 | #endif |
565 | ||
0841bffa | 566 | #ifndef wxStricmp |
49828363 | 567 | WXDLLEXPORT int wxStricmp(const wxChar *psz1, const wxChar *psz2); |
0841bffa OK |
568 | #endif |
569 | ||
e766c8a9 SC |
570 | #ifndef wxStrnicmp |
571 | WXDLLEXPORT int wxStrnicmp(const wxChar *psz1, const wxChar *psz2, size_t len); | |
572 | #endif | |
573 | ||
e97a90f0 | 574 | #ifndef wxStrtok |
49828363 | 575 | WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr); |
e97a90f0 OK |
576 | #endif |
577 | ||
578 | #ifndef wxSetlocale | |
f3773655 | 579 | class wxWCharBuffer; |
191ab39a | 580 | WXDLLEXPORT wxWCharBuffer wxSetlocale(int category, const wxChar *locale); |
e97a90f0 OK |
581 | #endif |
582 | ||
853d7d3d | 583 | #ifdef wxNEED_WCSLEN // for use in buffer.h |
49828363 | 584 | WXDLLEXPORT size_t wcslen(const wchar_t *s); |
853d7d3d OK |
585 | #endif |
586 | ||
57f6da0d | 587 | #ifdef wxNEED_WX_CTYPE_H |
49828363 RD |
588 | WXDLLEXPORT int wxIsalnum(wxChar ch); |
589 | WXDLLEXPORT int wxIsalpha(wxChar ch); | |
590 | WXDLLEXPORT int wxIsctrl(wxChar ch); | |
591 | WXDLLEXPORT int wxIsdigit(wxChar ch); | |
592 | WXDLLEXPORT int wxIsgraph(wxChar ch); | |
593 | WXDLLEXPORT int wxIslower(wxChar ch); | |
594 | WXDLLEXPORT int wxIsprint(wxChar ch); | |
595 | WXDLLEXPORT int wxIspunct(wxChar ch); | |
596 | WXDLLEXPORT int wxIsspace(wxChar ch); | |
597 | WXDLLEXPORT int wxIsupper(wxChar ch); | |
598 | WXDLLEXPORT int wxIsxdigit(wxChar ch); | |
599 | WXDLLEXPORT int wxTolower(wxChar ch); | |
600 | WXDLLEXPORT int wxToupper(wxChar ch); | |
57f6da0d OK |
601 | #endif |
602 | ||
853d7d3d | 603 | #ifdef wxNEED_WX_STRING_H |
49828363 RD |
604 | WXDLLEXPORT wxChar * wxStrcat(wxChar *dest, const wxChar *src); |
605 | WXDLLEXPORT wxChar * wxStrchr(const wxChar *s, wxChar c); | |
606 | WXDLLEXPORT int wxStrcmp(const wxChar *s1, const wxChar *s2); | |
607 | WXDLLEXPORT int wxStrcoll(const wxChar *s1, const wxChar *s2); | |
608 | WXDLLEXPORT wxChar * wxStrcpy(wxChar *dest, const wxChar *src); | |
609 | WXDLLEXPORT size_t wxStrcspn(const wxChar *s, const wxChar *reject); | |
610 | WXDLLEXPORT size_t wxStrlen(const wxChar *s); | |
611 | WXDLLEXPORT wxChar * wxStrncat(wxChar *dest, const wxChar *src, size_t n); | |
612 | WXDLLEXPORT int wxStrncmp(const wxChar *s1, const wxChar *s2, size_t n); | |
613 | WXDLLEXPORT wxChar * wxStrncpy(wxChar *dest, const wxChar *src, size_t n); | |
614 | WXDLLEXPORT wxChar * wxStrpbrk(const wxChar *s, const wxChar *accept); | |
615 | WXDLLEXPORT wxChar * wxStrrchr(const wxChar *s, wxChar c); | |
616 | WXDLLEXPORT size_t wxStrspn(const wxChar *s, const wxChar *accept); | |
617 | WXDLLEXPORT wxChar * wxStrstr(const wxChar *haystack, const wxChar *needle); | |
618 | WXDLLEXPORT double wxStrtod(const wxChar *nptr, wxChar **endptr); | |
619 | WXDLLEXPORT long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base); | |
620 | WXDLLEXPORT unsigned long int wxStrtoul(const wxChar *nptr, wxChar **endptr, int base); | |
621 | WXDLLEXPORT size_t wxStrxfrm(wxChar *dest, const wxChar *src, size_t n); | |
853d7d3d OK |
622 | #endif |
623 | ||
e97a90f0 | 624 | #ifdef wxNEED_WX_STDIO_H |
1777b9bb DW |
625 | # include <stdio.h> |
626 | # include <stdarg.h> | |
e385b3ff OK |
627 | WXDLLEXPORT FILE * wxFopen(const wxChar *path, const wxChar *mode); |
628 | WXDLLEXPORT FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *stream); | |
f6bcfd97 BP |
629 | WXDLLEXPORT int wxRemove(const wxChar *path); |
630 | WXDLLEXPORT int wxRename(const wxChar *oldpath, const wxChar *newpath); | |
49828363 RD |
631 | WXDLLEXPORT int wxPrintf(const wxChar *fmt, ...); |
632 | WXDLLEXPORT int wxVprintf(const wxChar *fmt, va_list argptr); | |
633 | WXDLLEXPORT int wxFprintf(FILE *stream, const wxChar *fmt, ...); | |
634 | WXDLLEXPORT int wxVfprintf(FILE *stream, const wxChar *fmt, va_list argptr); | |
635 | WXDLLEXPORT int wxSprintf(wxChar *buf, const wxChar *fmt, ...); | |
636 | WXDLLEXPORT int wxVsprintf(wxChar *buf, const wxChar *fmt, va_list argptr); | |
637 | WXDLLEXPORT int wxSscanf(const wxChar *buf, const wxChar *fmt, ...); | |
638 | WXDLLEXPORT int wxVsscanf(const wxChar *buf, const wxChar *fmt, va_list argptr); | |
e97a90f0 OK |
639 | #endif |
640 | ||
a982ddd2 | 641 | #ifndef wxAtof |
49828363 | 642 | WXDLLEXPORT double wxAtof(const wxChar *psz); |
a982ddd2 OK |
643 | #endif |
644 | ||
645 | #ifdef wxNEED_WX_STDLIB_H | |
49828363 RD |
646 | WXDLLEXPORT int wxAtoi(const wxChar *psz); |
647 | WXDLLEXPORT long wxAtol(const wxChar *psz); | |
648 | WXDLLEXPORT wxChar * wxGetenv(const wxChar *name); | |
649 | WXDLLEXPORT int wxSystem(const wxChar *psz); | |
639a9fb5 OK |
650 | #endif |
651 | ||
e385b3ff OK |
652 | #ifdef wxNEED_WX_TIME_H |
653 | WXDLLEXPORT size_t wxStrftime(wxChar *s, size_t max, const wxChar *fmt, const struct tm *tm); | |
654 | #endif | |
655 | ||
18c50997 VZ |
656 | // under VC++ 6.0 isspace() returns 1 for 8 bit chars which completely breaks |
657 | // the file parsing - this may be true for 5.0 as well, update #ifdef then | |
658 | #if defined(__VISUALC__) && (__VISUALC__ >= 1200) && !wxUSE_UNICODE | |
659 | #undef wxIsspace | |
660 | #define wxIsspace(c) ((((unsigned)c) < 128) && isspace(c)) | |
661 | #endif // VC++ | |
662 | ||
f6bcfd97 BP |
663 | // ---------------------------------------------------------------------------- |
664 | // common macros which are always defined | |
665 | // ---------------------------------------------------------------------------- | |
666 | ||
cdb51680 VZ |
667 | // although global macros with such names are really bad, we want to have |
668 | // another name for _T() which should be used to avoid confusion between _T() | |
669 | // and _() in wxWindows sources | |
223d09f6 | 670 | #define wxT(x) _T(x) |
cdb51680 | 671 | |
e90c1d2a VZ |
672 | // a Unicode-friendly __FILE__ analog |
673 | #ifndef __TFILE__ | |
223d09f6 | 674 | #define __XFILE__(x) wxT(x) |
e90c1d2a VZ |
675 | #define __TFILE__ __XFILE__(__FILE__) |
676 | #endif | |
677 | ||
e35d0039 JS |
678 | #endif |
679 | //_WX_WXCHAR_H_ | |
1777b9bb | 680 |