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