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