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