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