]> git.saurik.com Git - wxWidgets.git/blob - include/wx/wxcrt.h
fixed compilation if wxUSE_STL=1
[wxWidgets.git] / include / wx / wxcrt.h
1 /*
2 * Name: wx/wxcrt.h
3 * Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
4 * CRT functions
5 * Author: Joel Farley, Ove Kåven
6 * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
7 * Created: 1998/06/12
8 * RCS-ID: $Id$
9 * Copyright: (c) 1998-2006 wxWidgets dev team
10 * Licence: wxWindows licence
11 */
12
13 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
14
15 #ifndef _WX_WXCRT_H_
16 #define _WX_WXCRT_H_
17
18 #include "wx/chartype.h"
19
20 #ifdef __cplusplus
21 #include "wx/strvararg.h"
22 #else
23 /* make the file compile without doing anything in C code: */
24 #define WX_DEFINE_VARARG_FUNC(rettype, name, impl)
25 #endif
26
27 #include <stdio.h> /* we use FILE below */
28
29 #if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS
30 char *strtok_r(char *, const char *, char **);
31 #endif
32
33
34 /*
35 Standard headers we need here.
36
37 NB: don't include any wxWidgets headers here because almost all of them include
38 this one!
39 */
40
41 /* Required for wxPrintf() etc */
42 #include <stdarg.h>
43
44 /* Almost all compiler have strdup(), but not quite all: CodeWarrior under Mac */
45 /* and VC++ for Windows CE don't provide it */
46 #if defined(__VISUALC__) && __VISUALC__ >= 1400
47 #define wxStrdupA _strdup
48 #elif !(defined(__MWERKS__) && defined(__WXMAC__)) && !defined(__WXWINCE__)
49 /* use #define, not inline wrapper, as it is tested with #ifndef below */
50 #define wxStrdupA strdup
51 #endif
52
53 #if defined(__MWERKS__)
54 /* Metrowerks only has wide char support for OS X >= 10.3 */
55 #if !defined(__DARWIN__) || \
56 (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
57 #define wxHAVE_MWERKS_UNICODE
58 #endif
59
60 #ifdef wxHAVE_MWERKS_UNICODE
61 #define HAVE_WPRINTF 1
62 #define HAVE_WCSRTOMBS 1
63 #define HAVE_VSWPRINTF 1
64 #endif
65 #endif /* __MWERKS__ */
66
67 #ifdef wxHAVE_TCHAR_SUPPORT
68 /* we surely have wchar_t if we have TCHAR have wcslen() */
69 #ifndef HAVE_WCSLEN
70 #define HAVE_WCSLEN
71 #endif
72 #endif /* wxHAVE_TCHAR_SUPPORT */
73
74 /*
75 define wxFoo() function for each standard foo() function whose signature
76 (exceptionally including the return type) includes any mention of char:
77 wxFoo() is going to be a Unicode-friendly version of foo(), i.e. will have
78 the same signature but with char replaced by wxChar which allows us to
79 use it in Unicode build as well
80 */
81
82 #ifdef wxHAVE_TCHAR_SUPPORT
83 #include <ctype.h>
84
85 #if defined(__WATCOMC__) && defined(UNICODE)
86 #define WXWCHAR_T_CAST(c) (wint_t)(c)
87 #else
88 #define WXWCHAR_T_CAST(c) c
89 #endif
90
91 /* ctype.h functions */
92 #define wxIsalnum(c) _istalnum(WXWCHAR_T_CAST(c))
93 #define wxIsalpha(c) _istalpha(WXWCHAR_T_CAST(c))
94 #define wxIscntrl(c) _istcntrl(WXWCHAR_T_CAST(c))
95 #define wxIsdigit(c) _istdigit(WXWCHAR_T_CAST(c))
96 #define wxIsgraph(c) _istgraph(WXWCHAR_T_CAST(c))
97 #define wxIslower(c) _istlower(WXWCHAR_T_CAST(c))
98 #define wxIsprint(c) _istprint(WXWCHAR_T_CAST(c))
99 #define wxIspunct(c) _istpunct(WXWCHAR_T_CAST(c))
100 #define wxIsspace(c) _istspace(WXWCHAR_T_CAST(c))
101 #define wxIsupper(c) _istupper(WXWCHAR_T_CAST(c))
102 #define wxIsxdigit(c) _istxdigit(WXWCHAR_T_CAST(c))
103
104 /*
105 There is a bug in VC6 C RTL: toxxx() functions dosn't do anything with
106 signed chars < 0, so "fix" it here.
107 */
108 #define wxTolower(c) _totlower((wxUChar)(wxChar)(c))
109 #define wxToupper(c) _totupper((wxUChar)(wxChar)(c))
110
111 /* locale.h functons */
112 #define wxSetlocale _tsetlocale
113
114 /* string.h functions */
115 #define wxStrcat _tcscat
116 #define wxStrchr _tcschr
117 #define wxStrcmp _tcscmp
118 #define wxStrcoll _tcscoll
119 #define wxStrcpy _tcscpy
120 #define wxStrcspn _tcscspn
121 #define wxStrdupW _wcsdup /* notice the 'W'! */
122 #define wxStrftime _tcsftime
123 #define wxStricmp _tcsicmp
124 #define wxStrnicmp _tcsnicmp
125 #define wxStrlen_ _tcslen /* used in wxStrlen inline function */
126 #define wxStrncat _tcsncat
127 #define wxStrncmp _tcsncmp
128 #define wxStrncpy _tcsncpy
129 #define wxStrpbrk _tcspbrk
130 #define wxStrrchr _tcsrchr
131 #define wxStrspn _tcsspn
132 #define wxStrstr _tcsstr
133 #define wxStrtod _tcstod
134 #define wxStrtol _tcstol
135 #define wxStrtoul _tcstoul
136 #ifdef __VISUALC__
137 #if __VISUALC__ >= 1300 && !defined(__WXWINCE__)
138 #define wxStrtoll _tcstoi64
139 #define wxStrtoull _tcstoui64
140 #endif /* VC++ 7+ */
141 #endif
142 #define wxStrxfrm _tcsxfrm
143
144 /* stdio.h functions */
145 #define wxFgetc _fgettc
146 #define wxFgetchar _fgettchar
147 #define wxFgets _fgetts
148 #if wxUSE_UNICODE_MSLU
149 WXDLLIMPEXP_BASE FILE * wxMSLU__tfopen(const wxChar *name, const wxChar *mode);
150
151 #define wxFopen wxMSLU__tfopen
152 #else
153 #define wxFopen _tfopen
154 #endif
155 #define wxFputc _fputtc
156 #define wxFputchar _fputtchar
157 WX_DEFINE_VARARG_FUNC(int, wxFprintf, _ftprintf)
158 #define wxFputs _fputts
159 #define wxFreopen _tfreopen
160 #define wxFscanf _ftscanf
161 #define wxGetc _gettc
162 #define wxGetchar _gettchar
163 #define wxGets _getts
164 #define wxPerror _tperror
165 WX_DEFINE_VARARG_FUNC(int, wxPrintf, _tprintf)
166 #define wxPutc(c,f) _puttc(WXWCHAR_T_CAST(c),f)
167 #define wxPutchar _puttchar
168 #define wxPuts _putts
169 #define wxScanf _tscanf
170 #if defined(__DMC__)
171 #if wxUSE_UNICODE
172 /* Digital Mars adds count to _stprintf (C99) so prototype conversion see wxchar.cpp */
173 int wxDoSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... ) ;
174 WX_DEFINE_VARARG_FUNC(int, wxSprintf, wxDoSprintf)
175 #else
176 /* and there is a bug in D Mars tchar.h prior to 8.39.4n, so define as sprintf */
177 WX_DEFINE_VARARG_FUNC(int, wxSprintf, sprintf)
178 #endif
179 #else
180 WX_DEFINE_VARARG_FUNC(int, wxSprintf, _stprintf)
181 #endif
182
183 #define wxSscanf _stscanf
184 #define wxTmpnam _ttmpnam
185 #define wxUngetc _tungetc
186 #define wxVfprintf _vftprintf
187 #define wxVprintf _vtprintf
188 #define wxVsscanf _vstscanf
189 #define wxVsprintf _vstprintf
190
191 /* special case: these functions are missing under Win9x with Unicows so we */
192 /* have to implement them ourselves */
193 #if wxUSE_UNICODE_MSLU
194 WXDLLIMPEXP_BASE int wxMSLU__trename(const wxChar *oldname, const wxChar *newname);
195 WXDLLIMPEXP_BASE int wxMSLU__tremove(const wxChar *name);
196
197 #define wxRemove wxMSLU__tremove
198 #define wxRename wxMSLU__trename
199 #else
200 #ifdef __WXWINCE__
201 /* carefully: wxRemove() must return 0 on success while DeleteFile()
202 returns 0 on error, so don't just define one as the other */
203 int wxRemove(const wxChar *path);
204 #else
205 #define wxRemove _tremove
206 #define wxRename _trename
207 #endif
208 #endif
209
210 /* stdlib.h functions */
211 #define wxAtoi _ttoi
212 #define wxAtol _ttol
213 /* #define wxAtof _tttof -- notice that there is no such thing (why?) */
214 /* there are no env vars at all under CE, so no _tgetenv neither */
215 #ifdef __WXWINCE__
216 /* can't define as inline function as this is a C file... */
217 #define wxGetenv(name) ((wxChar *)NULL)
218 #else
219 #define wxGetenv _tgetenv
220 #endif
221 #define wxSystem _tsystem
222
223 /* time.h functions */
224 #define wxAsctime _tasctime
225 #define wxCtime _tctime
226
227 #define wxMbstowcs mbstowcs
228 #define wxWcstombs wcstombs
229 #else /* !TCHAR-aware compilers */
230 /*
231 There are 2 unrelated problems with these functions under Mac:
232 a) Metrowerks MSL CRT implements them strictly in C99 sense and
233 doesn't support (very common) extension of allowing to call
234 mbstowcs(NULL, ...) which makes it pretty useless as you can't
235 know the size of the needed buffer
236 b) OS X <= 10.2 declares and even defined these functions but
237 doesn't really implement them -- they always return an error
238
239 So use our own replacements in both cases.
240 */
241 #if defined(__MWERKS__) && defined(__MSL__)
242 #define wxNEED_WX_MBSTOWCS
243 #endif
244
245 #ifdef __DARWIN__
246 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2
247 #define wxNEED_WX_MBSTOWCS
248 #endif
249 #endif
250
251 #ifdef wxNEED_WX_MBSTOWCS
252 /* even though they are defined and "implemented", they are bad and just
253 stubs so we need our own - we need these even in ANSI builds!! */
254 WXDLLIMPEXP_BASE size_t wxMbstowcs (wchar_t *, const char *, size_t);
255 WXDLLIMPEXP_BASE size_t wxWcstombs (char *, const wchar_t *, size_t);
256 #else
257 #define wxMbstowcs mbstowcs
258 #define wxWcstombs wcstombs
259 #endif
260
261 /*
262 The system C library on Mac OS X 10.2 and below does not support
263 unicode: in other words all wide-character functions such as towupper et
264 al. do simply not exist so we need to provide our own in that context,
265 except for the wchar_t definition/typedef itself.
266
267 We need to do this for both project builder and CodeWarrior as
268 the latter uses the system C library in Mach builds for wide character
269 support, which as mentioned does not exist on 10.2 and below.
270 */
271 #if wxUSE_UNICODE && \
272 defined(__DARWIN__) && \
273 ( MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 )
274 /* we need everything! */
275 #define wxNEED_WX_STRING_H
276 #define wxNEED_WX_CTYPE_H
277
278 #define wxFgetchar(c) wxFgetc(c, stdin)
279 #define wxFputc wxPutc
280 #define wxFputchar(c) wxPutc(c, stdout)
281 #define wxGetc wxFgetc
282 #define wxGetchar(c) wxFgetc(c, stdin)
283
284 #include <stdio.h>
285
286 #define wxNEED_FGETC
287 #define wxNEED_FGETS
288 #define wxNEED_GETS
289 #define wxNEED_UNGETC
290
291 #define wxNEED_FPUTS
292 #define wxNEED_PUTS
293 #define wxNEED_PUTC
294
295 int wxFputs(const wxChar *ch, FILE *stream);
296 int wxPuts(const wxChar *ws);
297 int wxPutc(wxChar ch, FILE *stream);
298
299 #ifdef __cplusplus
300 extern "C" {
301 #endif
302 WXDLLIMPEXP_BASE size_t wxStrlen_(const wxChar *s);
303 #ifdef __cplusplus
304 }
305 #endif
306
307 #define wxPutchar(wch) wxPutc(wch, stdout)
308
309 #define wxNEED_PRINTF_CONVERSION
310 #define wxNEED_WX_STDIO_H
311 #define wxNEED_WX_STDLIB_H
312 #define wxNEED_WX_TIME_H
313
314 #elif wxUSE_UNICODE
315 #include <wctype.h>
316
317 /* this is probably glibc-specific */
318 #if defined(__WCHAR_TYPE__) && !defined(__MWERKS__)
319 /* ctype.h functions (wctype.h) */
320 #define wxIsalnum iswalnum
321 #define wxIsalpha iswalpha
322 #define wxIscntrl iswcntrl
323 #define wxIsdigit iswdigit
324 #define wxIsgraph iswgraph
325 #define wxIslower iswlower
326 #define wxIsprint iswprint
327 #define wxIspunct iswpunct
328 #define wxIsspace iswspace
329 #define wxIsupper iswupper
330 #define wxIsxdigit iswxdigit
331
332 #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
333 /* /usr/include/wctype.h incorrectly declares translations */
334 /* tables which provokes tons of compile-time warnings -- try */
335 /* to correct this */
336 #define wxTolower(wc) towctrans((wc), (wctrans_t)__ctype_tolower)
337 #define wxToupper(wc) towctrans((wc), (wctrans_t)__ctype_toupper)
338 #else /* !glibc 2.0 */
339 #define wxTolower towlower
340 #define wxToupper towupper
341 #endif /* gcc/!gcc */
342
343 /* string.h functions (wchar.h) */
344 #define wxStrcat wcscat
345 #define wxStrchr wcschr
346 #define wxStrcmp wcscmp
347 #define wxStrcoll wcscoll
348 #define wxStrcpy wcscpy
349 #define wxStrcspn wcscspn
350 #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */
351 #define wxStrncat wcsncat
352 #define wxStrncmp wcsncmp
353 #define wxStrncpy wcsncpy
354 #define wxStrpbrk wcspbrk
355 #define wxStrrchr wcsrchr
356 #define wxStrspn wcsspn
357 #define wxStrstr wcsstr
358 #define wxStrtod wcstod
359 #define wxStrtol wcstol
360 #define wxStrtoul wcstoul
361 #ifdef HAVE_WCSTOULL
362 /* assume that we have wcstoull(), which is also C99, too */
363 #define wxStrtoll wcstoll
364 #define wxStrtoull wcstoull
365 #endif /* HAVE_WCSTOULL */
366 #define wxStrxfrm wcsxfrm
367
368 #define wxFgetc fgetwc
369 #define wxFgetchar fgetwchar
370 #define wxFgets fgetws
371 #define wxFputc fputwc
372 #define wxFputchar fputwchar
373 #define wxGetc getwc
374 #define wxGetchar getwchar
375 #define wxGets getws
376 #define wxUngetc ungetwc
377
378 #ifdef HAVE_FPUTWS
379 #define wxFputs fputws
380 #else
381 #define wxNEED_FPUTS
382 #include <stdio.h>
383 int wxFputs(const wxChar *ch, FILE *stream);
384 #endif
385
386 #ifdef HAVE_WPUTC
387 #define wxPutc wputc
388 #else
389 #define wxNEED_PUTC
390 #include <stdio.h>
391 int wxPutc(wxChar ch, FILE *stream);
392 #endif
393
394 #ifdef HAVE_WPUTCHAR
395 #define wxPutchar wputchar
396 #else
397 #define wxPutchar(wch) wxPutc(wch, stdout)
398 #endif
399
400 #ifdef HAVE_PUTWS
401 #define wxPuts putws
402 #else
403 #define wxNEED_PUTS
404 int wxPuts(const wxChar *ws);
405 #endif
406
407 /* we need %s to %ls conversion for printf and scanf etc */
408 #define wxNEED_PRINTF_CONVERSION
409
410 /* glibc doesn't have wide char equivalents of the other stuff so */
411 /* use our own versions */
412 #define wxNEED_WX_STDIO_H
413 #define wxNEED_WX_STDLIB_H
414 #define wxNEED_WX_TIME_H
415 #elif defined(__MWERKS__) && ( defined(__MSL__) || defined(__MACH__) )
416 /* ctype.h functions (wctype.h) */
417 #define wxIsalnum iswalnum
418 #define wxIsalpha iswalpha
419 #define wxIscntrl iswcntrl
420 #define wxIsdigit iswdigit
421 #define wxIsgraph iswgraph
422 #define wxIslower iswlower
423 #define wxIsprint iswprint
424 #define wxIspunct iswpunct
425 #define wxIsspace iswspace
426 #define wxIsupper iswupper
427 #define wxIsxdigit iswxdigit
428 #define wxTolower towlower
429 #define wxToupper towupper
430
431 /* string.h functions (wchar.h) */
432 #define wxStrcat wcscat
433 #define wxStrchr wcschr
434 #define wxStrcmp wcscmp
435 #define wxStrcoll wcscoll
436 #define wxStrcpy wcscpy
437 #define wxStrcspn wcscspn
438 #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */
439 #define wxStrncat wcsncat
440 #define wxStrncmp wcsncmp
441 #define wxStrncpy wcsncpy
442 #define wxStrpbrk wcspbrk
443 #define wxStrrchr wcsrchr
444 #define wxStrspn wcsspn
445 #define wxStrstr wcsstr
446 #define wxStrtod wcstod
447 #define wxStrtol wcstol
448 #define wxStrtoul wcstoul
449 #define wxStrxfrm wcsxfrm
450
451 #define wxFgetc fgetwc
452 #define wxFgetchar fgetwchar
453 #define wxFgets fgetws
454 #define wxFputc fputwc
455 #define wxFputchar fputwchar
456 #define wxGetc getwc
457 #define wxGetchar getwchar
458 #define wxGets getws
459 #define wxUngetc ungetwc
460
461 #define wxNEED_PRINTF_CONVERSION
462
463 #define wxPutc putwc
464 #define wxPutchar putwchar
465 #define wxFputs fputws
466
467 /* stdio.h functions */
468
469 #define wxNEED_WX_STDIO_H
470
471 /* stdlib.h functions */
472 #ifdef __MACH__
473 #define wxNEED_WX_STDLIB_H
474 #else
475 #define wxAtof watof
476 #define wxAtoi watoi
477 #define wxAtol watol
478 #define wxGetenv(a) ((wxChar*)NULL)
479 #define wxSystem(a) ((int)NULL)
480 #endif
481 /* time.h functions */
482 #define wxAsctime wasciitime
483 #define wxCtime wctime
484 /* #define wxStrftime wcsftime */
485
486 #define wxNEED_WX_TIME_H
487 #else /* !metrowerks for apple */
488 #error "Please define wide character functions for your environment"
489 #endif
490 #else /* ASCII */
491 #include <ctype.h>
492 #include <string.h>
493
494 /* ctype.h functions */
495 #define wxIsalnum isalnum
496 #define wxIsalpha isalpha
497 #define wxIscntrl iscntrl
498 #define wxIsdigit isdigit
499 #define wxIsgraph isgraph
500 #define wxIslower islower
501 #define wxIsprint isprint
502 #define wxIspunct ispunct
503 #define wxIsspace isspace
504 #define wxIsupper isupper
505 #define wxIsxdigit isxdigit
506 #define wxTolower tolower
507 #define wxToupper toupper
508
509 /* locale.h functons */
510 #define wxSetlocale setlocale
511
512 /* string.h functions */
513 #define wxStrcat strcat
514 #define wxStrchr strchr
515 #define wxStrcmp strcmp
516 #define wxStrcoll strcoll
517 #define wxStrcpy strcpy
518 #define wxStrcspn strcspn
519
520 /* wxStricmp and wxStrnicmp are defined below */
521 #define wxStrlen_ strlen /* used in wxStrlen inline function */
522 #define wxStrncat strncat
523 #define wxStrncmp strncmp
524 #define wxStrncpy strncpy
525 #define wxStrpbrk strpbrk
526 #define wxStrrchr strrchr
527 #define wxStrspn strspn
528 #define wxStrstr strstr
529 #define wxStrtod strtod
530 #ifdef HAVE_STRTOK_R
531 #define wxStrtok(str, sep, last) strtok_r(str, sep, last)
532 #endif
533 #define wxStrtol strtol
534 #define wxStrtoul strtoul
535 #ifdef HAVE_STRTOULL
536 /* assume that we have wcstoull(), which is also C99, too */
537 #define wxStrtoll strtoll
538 #define wxStrtoull strtoull
539 #endif /* HAVE_WCSTOULL */
540 #define wxStrxfrm strxfrm
541
542 /* stdio.h functions */
543 #define wxFopen fopen
544 #define wxFreopen freopen
545 #define wxRemove remove
546 #define wxRename rename
547
548 #define wxPerror perror
549 #define wxTmpnam tmpnam
550
551 #define wxFgetc fgetc
552 #define wxFgetchar fgetchar
553 #define wxFgets fgets
554 #define wxFputc fputc
555 #define wxFputs fputs
556 #define wxFputchar fputchar
557 WX_DEFINE_VARARG_FUNC(int, wxFprintf, fprintf)
558 #define wxFscanf fscanf
559 #define wxGetc getc
560 #define wxGetchar getchar
561 #define wxGets gets
562 WX_DEFINE_VARARG_FUNC(int, wxPrintf, printf)
563 #define wxPutc putc
564 #define wxPutchar putchar
565 #define wxPuts puts
566 #define wxScanf scanf
567 WX_DEFINE_VARARG_FUNC(int, wxSprintf, sprintf)
568 #define wxSscanf sscanf
569 #define wxUngetc ungetc
570 #define wxVfprintf vfprintf
571 #define wxVprintf vprintf
572 #define wxVsscanf vsscanf
573 #define wxVsprintf vsprintf
574
575 /* stdlib.h functions */
576 #define wxAtof atof
577 #define wxAtoi atoi
578 #define wxAtol atol
579 #define wxGetenv getenv
580 #define wxSystem system
581
582 /* time.h functions */
583 #define wxAsctime asctime
584 #define wxCtime ctime
585 #define wxStrftime strftime
586 #endif /* Unicode/ASCII */
587 #endif /* TCHAR-aware compilers/the others */
588
589 #ifdef wxStrtoll
590 #define wxHAS_STRTOLL
591 #endif
592
593 /*
594 various special cases
595 */
596
597 /* define wxStricmp and wxStrnicmp for various compilers */
598
599 /* note that in Unicode mode we definitely are going to need our own version */
600 #if !defined(wxStricmp) && !wxUSE_UNICODE
601 #if defined(__BORLANDC__) || defined(__WATCOMC__) || \
602 defined(__SALFORDC__) || defined(__VISAGECPP__) || \
603 defined(__EMX__) || defined(__DJGPP__)
604 #define wxStricmp stricmp
605 #define wxStrnicmp strnicmp
606 #elif defined(__WXPALMOS__)
607 /* FIXME: There is no equivalent to strnicmp in the Palm OS API. This
608 * quick hack should do until one can be written.
609 */
610 #define wxStricmp StrCaselessCompare
611 #define wxStrnicmp strnicmp
612 #elif defined(__SYMANTEC__) || defined(__VISUALC__) || \
613 (defined(__MWERKS__) && defined(__INTEL__))
614 #define wxStricmp _stricmp
615 #define wxStrnicmp _strnicmp
616 #elif defined(__UNIX__) || defined(__GNUWIN32__)
617 #define wxStricmp strcasecmp
618 #define wxStrnicmp strncasecmp
619 /* #else -- use wxWidgets implementation */
620 #endif
621 #endif /* !defined(wxStricmp) */
622
623 /* define wxWcslen() which should be always available if wxUSE_WCHAR_T == 1 (as */
624 /* it's used in wx/buffer.h -- and also might be used just below by wxStrlen() */
625 /* when wxStrlen_() is #define'd as wxWcslen so do it before defining wxStrlen) */
626 #if wxUSE_WCHAR_T
627 #ifdef HAVE_WCSLEN
628 #define wxWcslen wcslen
629 #else
630 WXDLLIMPEXP_BASE size_t wxWcslen(const wchar_t *s);
631 #endif
632 #endif /* wxUSE_WCHAR_T */
633
634 #ifdef __cplusplus
635 /* checks whether the passed in pointer is NULL and if the string is empty */
636 inline bool wxIsEmpty(const wxChar *p) { return !p || !*p; }
637
638 /* safe version of strlen() (returns 0 if passed NULL pointer) */
639 inline size_t wxStrlen(const wxChar *psz) { return psz ? wxStrlen_(psz) : 0; }
640 #endif
641
642 /*
643 each of strdup() and wcsdup() may or may not be available but we need both
644 of them anyhow for wx/buffer.h so we define the missing one(s) in
645 wxchar.cpp and so we should always have both wxStrdupA and wxStrdupW
646 defined -- if this is somehow not the case in some situations, please
647 correct that and not the lines here
648 */
649 #if wxUSE_UNICODE
650 #define wxStrdup wxStrdupW
651 #else
652 #define wxStrdup wxStrdupA
653 #endif
654
655 #ifdef __cplusplus
656 WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
657 #endif
658
659 /* printf() family saga */
660
661 /*
662 For some systems [v]snprintf() exists in the system libraries but not in the
663 headers, so we need to declare it ourselves to be able to use it.
664 */
665 #if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL)
666 #ifdef __cplusplus
667 extern "C"
668 #else
669 extern
670 #endif
671 int vsnprintf(char *str, size_t size, const char *format, va_list ap);
672 #endif /* !HAVE_VSNPRINTF_DECL */
673
674 #if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL)
675 #ifdef __cplusplus
676 extern "C"
677 #else
678 extern
679 #endif
680 WXDLLIMPEXP_BASE int snprintf(char *str, size_t size, const char *format, ...);
681 #endif /* !HAVE_SNPRINTF_DECL */
682
683 /* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the
684 * same isn't done for snprintf below, the builtin wxSnprintf_ is used
685 * instead since it's already a simple wrapper */
686 #if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL
687 inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap)
688 {
689 return vsnprintf(str, size, (char*)format, ap);
690 }
691 #endif
692
693 /*
694 MinGW MSVCRT has non-standard vswprintf() (for MSVC compatibility
695 presumably) and normally _vsnwprintf() is used instead
696 */
697 #if defined(HAVE_VSWPRINTF) && defined(__MINGW32__)
698 #undef HAVE_VSWPRINTF
699 #endif
700
701 #if wxUSE_PRINTF_POS_PARAMS
702 /*
703 The systems where vsnprintf() supports positional parameters should
704 define the HAVE_UNIX98_PRINTF symbol.
705
706 On systems which don't (e.g. Windows) we are forced to use
707 our wxVsnprintf() implementation.
708 */
709 #if defined(HAVE_UNIX98_PRINTF)
710 #if wxUSE_UNICODE
711 #ifdef HAVE_VSWPRINTF
712 #define wxVsnprintf_ vswprintf
713 #endif
714 #else /* ASCII */
715 #ifdef HAVE_BROKEN_VSNPRINTF_DECL
716 #define wxVsnprintf_ wx_fixed_vsnprintf
717 #else
718 #define wxVsnprintf_ vsnprintf
719 #endif
720 #endif
721 #else /* !HAVE_UNIX98_PRINTF */
722 /*
723 The only compiler with positional parameters support under Windows
724 is VC++ 8.0 which provides a new xxprintf_p() functions family.
725 The 2003 PSDK includes a slightly earlier version of VC8 than the
726 main release and does not have the printf_p functions.
727 */
728 #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__
729 #if wxUSE_UNICODE
730 #define wxVsnprintf_ _vswprintf_p
731 #else
732 #define wxVsnprintf_ _vsprintf_p
733 #endif
734 #endif
735 #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */
736 #else /* !wxUSE_PRINTF_POS_PARAMS */
737 /*
738 We always want to define safe snprintf() function to be used instead of
739 sprintf(). Some compilers already have it (or rather vsnprintf() which
740 we really need...), otherwise we implement it using our own printf()
741 code.
742
743 We define function with a trailing underscore here because the real one
744 is a wrapper around it as explained below
745 */
746
747 /* first deal with TCHAR-aware compilers which have _vsntprintf */
748 #ifndef wxVsnprintf_
749 #if defined(__VISUALC__) || \
750 (defined(__BORLANDC__) && __BORLANDC__ >= 0x540)
751 #define wxVsnprintf_ _vsntprintf
752 WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, _sntprintf)
753 #endif
754 #endif
755
756 /* if this didn't work, define it separately for Unicode and ANSI builds */
757 #ifndef wxVsnprintf_
758 #if wxUSE_UNICODE
759 #if defined(HAVE__VSNWPRINTF)
760 #define wxVsnprintf_ _vsnwprintf
761 #elif defined(HAVE_VSWPRINTF)
762 #define wxVsnprintf_ vswprintf
763 #elif defined(__WATCOMC__)
764 #define wxVsnprintf_ _vsnwprintf
765 WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, _snwprintf)
766 #endif
767 #else /* ASCII */
768 /*
769 All versions of CodeWarrior supported by wxWidgets apparently
770 have both snprintf() and vsnprintf()
771 */
772 #if defined(HAVE_SNPRINTF) \
773 || defined(__MWERKS__) || defined(__WATCOMC__)
774 #ifndef HAVE_BROKEN_SNPRINTF_DECL
775 WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, snprintf)
776 #endif
777 #endif
778 #if defined(HAVE_VSNPRINTF) \
779 || defined(__MWERKS__) || defined(__WATCOMC__)
780 #ifdef HAVE_BROKEN_VSNPRINTF_DECL
781 #define wxVsnprintf_ wx_fixed_vsnprintf
782 #else
783 #define wxVsnprintf_ vsnprintf
784 #endif
785 #endif
786 #endif /* Unicode/ASCII */
787 #endif /* wxVsnprintf_ */
788 #endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */
789
790 #ifndef wxSnprintf_
791 /* no snprintf(), cook our own */
792 WXDLLIMPEXP_BASE int
793 wxDoSnprintf_(wxChar *buf, size_t len,
794 const wxChar *format, ...) ATTRIBUTE_PRINTF_3;
795 WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, wxDoSnprintf_)
796 #endif
797 #ifndef wxVsnprintf_
798 /* no (suitable) vsnprintf(), cook our own */
799 WXDLLIMPEXP_BASE int
800 wxVsnprintf_(wxChar *buf, size_t len,
801 const wxChar *format, va_list argptr);
802
803 #define wxUSE_WXVSNPRINTF 1
804 #else
805 #define wxUSE_WXVSNPRINTF 0
806 #endif
807
808 /*
809 In Unicode mode we need to have all standard functions such as wprintf() and
810 so on but not all systems have them so use our own implementations in this
811 case.
812 */
813 #if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF)
814 #define wxNEED_WPRINTF
815 #endif
816
817 /*
818 More Unicode complications: although both ANSI C and C++ define a number of
819 wide character functions such as wprintf(), not all environments have them.
820 Worse, those which do have different behaviours: under Windows, %s format
821 specifier changes its meaning in Unicode build and expects a Unicode string
822 while under Unix/POSIX it still means an ASCII string even for wprintf() and
823 %ls has to be used for wide strings.
824
825 We choose to always emulate Windows behaviour as more useful for us so even
826 if we have wprintf() we still must wrap it in a non trivial wxPrintf().
827
828 */
829
830 #if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF)
831 /*
832 we need to implement all wide character printf and scanf functions
833 either because we don't have them at all or because they don't have the
834 semantics we need
835 */
836 WX_DEFINE_VARARG_FUNC(int, wxScanf, wxDoScanf)
837 int wxDoScanf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1;
838
839 WX_DEFINE_VARARG_FUNC(int, wxSscanf, wxDoSscanf)
840 int wxDoSscanf( const wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
841
842 WX_DEFINE_VARARG_FUNC(int, wxFscanf, wxDoFscanf)
843 int wxDoFscanf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
844
845 WX_DEFINE_VARARG_FUNC(int, wxPrintf, wxDoPrintf)
846 int wxDoPrintf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1;
847
848 WX_DEFINE_VARARG_FUNC(int, wxSprintf, wxDoSprintf)
849 int wxDoSprintf( wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
850
851 WX_DEFINE_VARARG_FUNC(int, wxFprintf, wxDoFprintf)
852 int wxDoFprintf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
853
854 int wxVsscanf( const wxChar *str, const wxChar *format, va_list ap );
855 int wxVfprintf( FILE *stream, const wxChar *format, va_list ap );
856 int wxVprintf( const wxChar *format, va_list ap );
857 int wxVsprintf( wxChar *str, const wxChar *format, va_list ap );
858 #endif /* wxNEED_PRINTF_CONVERSION */
859
860 /* these 2 can be simply mapped to the versions with underscore at the end */
861 /* if we don't have to do the conversion */
862 /*
863 However, if we don't have any vswprintf() at all we don't need to redefine
864 anything as our own wxVsnprintf_() already behaves as needed.
865 */
866 #if defined(wxNEED_PRINTF_CONVERSION) && defined(wxVsnprintf_)
867 WX_DEFINE_VARARG_FUNC(int, wxSnprintf, wxDoSnprintf)
868 int wxDoSnprintf( wxChar *str, size_t size, const wxChar *format, ... ) ATTRIBUTE_PRINTF_3;
869 int wxVsnprintf( wxChar *str, size_t size, const wxChar *format, va_list ap );
870 #else
871 #define wxSnprintf wxSnprintf_
872 #define wxVsnprintf wxVsnprintf_
873 #endif
874
875 /*
876 various functions which might not be available in libc and for which we
877 provide our own replacements in wxchar.cpp
878 */
879
880 /* ctype.h functions */
881
882 /* RN: Used only under OSX <= 10.2 currently */
883 #ifdef wxNEED_WX_CTYPE_H
884 WXDLLIMPEXP_BASE int wxIsalnum(wxChar ch);
885 WXDLLIMPEXP_BASE int wxIsalpha(wxChar ch);
886 WXDLLIMPEXP_BASE int wxIscntrl(wxChar ch);
887 WXDLLIMPEXP_BASE int wxIsdigit(wxChar ch);
888 WXDLLIMPEXP_BASE int wxIsgraph(wxChar ch);
889 WXDLLIMPEXP_BASE int wxIslower(wxChar ch);
890 WXDLLIMPEXP_BASE int wxIsprint(wxChar ch);
891 WXDLLIMPEXP_BASE int wxIspunct(wxChar ch);
892 WXDLLIMPEXP_BASE int wxIsspace(wxChar ch);
893 WXDLLIMPEXP_BASE int wxIsupper(wxChar ch);
894 WXDLLIMPEXP_BASE int wxIsxdigit(wxChar ch);
895 WXDLLIMPEXP_BASE int wxTolower(wxChar ch);
896 WXDLLIMPEXP_BASE int wxToupper(wxChar ch);
897 #endif /* wxNEED_WX_CTYPE_H */
898
899 /* under VC++ 6.0 isspace() returns 1 for 8 bit chars which completely breaks */
900 /* the file parsing -- this may be true for 5.0 as well, update #ifdef then */
901 #if defined(__VISUALC__) && (__VISUALC__ >= 1200) && !wxUSE_UNICODE
902 #undef wxIsspace
903 #define wxIsspace(c) ((((unsigned)(wxChar)c) < 128) && isspace(c))
904 #endif /* VC++ */
905
906 /*
907 a few compilers don't have the (non standard but common) isascii function,
908 define it ourselves for them
909 */
910 #ifndef isascii
911 #if defined(__MWERKS__)
912 #define wxNEED_ISASCII
913 #elif defined(_WIN32_WCE)
914 #if _WIN32_WCE <= 211
915 #define wxNEED_ISASCII
916 #endif
917 #endif
918 #endif /* isascii */
919
920 #ifdef wxNEED_ISASCII
921 inline int isascii(int c) { return (unsigned)c < 0x80; }
922 #endif
923
924 #ifdef _WIN32_WCE
925 #if _WIN32_WCE <= 211
926 #define isspace(c) ((c) == _T(' ') || (c) == _T('\t'))
927 #endif
928 #endif /* _WIN32_WCE */
929
930 /*
931 we had goofed and defined wxIsctrl() instead of (correct) wxIscntrl() in the
932 initial versions of this header -- now it is too late to remove it so
933 although we fixed the function/macro name above, still provide the
934 backwards-compatible synonym.
935 */
936 #define wxIsctrl wxIscntrl
937
938 /* string.h functions */
939 #ifndef strdup
940 #if defined(__MWERKS__) && !defined(__MACH__) && (__MSL__ < 0x00008000)
941 #define wxNEED_STRDUP
942 #elif defined(__WXWINCE__)
943 #if _WIN32_WCE <= 211
944 #define wxNEED_STRDUP
945 #endif
946 #endif
947 #endif /* strdup */
948
949 #ifdef wxNEED_STRDUP
950 WXDLLIMPEXP_BASE char *strdup(const char* s);
951 #endif
952
953 /* RN: Used only under OSX <= 10.2 currently
954 The __cplusplus ifdefs are messy, but they are required to build
955 the regex library, since c does not support function overloading
956 */
957 #ifdef wxNEED_WX_STRING_H
958 # ifdef __cplusplus
959 extern "C" {
960 # endif
961 WXDLLIMPEXP_BASE wxChar * wxStrcat(wxChar *dest, const wxChar *src);
962 WXDLLIMPEXP_BASE const wxChar * wxStrchr(const wxChar *s, wxChar c);
963 WXDLLIMPEXP_BASE int wxStrcmp(const wxChar *s1, const wxChar *s2);
964 WXDLLIMPEXP_BASE int wxStrcoll(const wxChar *s1, const wxChar *s2);
965 WXDLLIMPEXP_BASE wxChar * wxStrcpy(wxChar *dest, const wxChar *src);
966 WXDLLIMPEXP_BASE size_t wxStrcspn(const wxChar *s, const wxChar *reject);
967 WXDLLIMPEXP_BASE wxChar * wxStrncat(wxChar *dest, const wxChar *src, size_t n);
968 WXDLLIMPEXP_BASE int wxStrncmp(const wxChar *s1, const wxChar *s2, size_t n);
969 WXDLLIMPEXP_BASE wxChar * wxStrncpy(wxChar *dest, const wxChar *src, size_t n);
970 WXDLLIMPEXP_BASE const wxChar * wxStrpbrk(const wxChar *s, const wxChar *accept);
971 WXDLLIMPEXP_BASE const wxChar * wxStrrchr(const wxChar *s, wxChar c);
972 WXDLLIMPEXP_BASE size_t wxStrspn(const wxChar *s, const wxChar *accept);
973 WXDLLIMPEXP_BASE const wxChar * wxStrstr(const wxChar *haystack, const wxChar *needle);
974 # ifdef __cplusplus
975 }
976 # endif
977
978 /* These functions use C++, so we can't c extern them */
979 WXDLLIMPEXP_BASE double wxStrtod(const wxChar *nptr, wxChar **endptr);
980 WXDLLIMPEXP_BASE long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base);
981 WXDLLIMPEXP_BASE unsigned long int wxStrtoul(const wxChar *nptr, wxChar **endptr, int base);
982 WXDLLIMPEXP_BASE size_t wxStrxfrm(wxChar *dest, const wxChar *src, size_t n);
983
984 /* inlined versions */
985 #ifdef __cplusplus
986 inline wxChar * wxStrchr(wxChar *s, wxChar c)
987 { return (wxChar *)wxStrchr((const wxChar *)s, c); }
988 inline wxChar * wxStrpbrk(wxChar *s, const wxChar *accept)
989 { return (wxChar *)wxStrpbrk((const wxChar *)s, accept); }
990 inline wxChar * wxStrrchr(wxChar *s, wxChar c)
991 { return (wxChar *)wxStrrchr((const wxChar *)s, c); }
992 inline wxChar *wxStrstr(wxChar *haystack, const wxChar *needle)
993 { return (wxChar *)wxStrstr((const wxChar *)haystack, needle); }
994 #endif
995
996 #endif /* wxNEED_WX_STRING_H */
997
998 #ifndef wxStrdupA
999 WXDLLIMPEXP_BASE char *wxStrdupA(const char *psz);
1000 #endif
1001
1002 #ifndef wxStrdupW
1003 WXDLLIMPEXP_BASE wchar_t *wxStrdupW(const wchar_t *pwz);
1004 #endif
1005
1006 #ifndef wxStricmp
1007 WXDLLIMPEXP_BASE int wxStricmp(const wxChar *psz1, const wxChar *psz2);
1008 #endif
1009
1010 #ifndef wxStrnicmp
1011 WXDLLIMPEXP_BASE int wxStrnicmp(const wxChar *psz1, const wxChar *psz2, size_t len);
1012 #endif
1013
1014 #ifndef wxStrtok
1015 WXDLLIMPEXP_BASE wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr);
1016 #endif
1017
1018 #ifdef __cplusplus
1019 #ifndef wxSetlocale
1020 class WXDLLIMPEXP_BASE wxWCharBuffer;
1021 WXDLLIMPEXP_BASE wxWCharBuffer wxSetlocale(int category, const wxChar *locale);
1022 #endif
1023 #endif
1024
1025 /* stdio.h functions */
1026 #ifdef wxNEED_WX_STDIO_H
1027 #include <stdio.h>
1028 WXDLLIMPEXP_BASE FILE * wxFopen(const wxChar *path, const wxChar *mode);
1029 WXDLLIMPEXP_BASE FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *stream);
1030 WXDLLIMPEXP_BASE int wxRemove(const wxChar *path);
1031 WXDLLIMPEXP_BASE int wxRename(const wxChar *oldpath, const wxChar *newpath);
1032
1033 /* *printf() family is handled separately */
1034 #endif /* wxNEED_WX_STDIO_H */
1035
1036
1037 /* stdlib.h functions */
1038 #ifndef wxAtof
1039 WXDLLIMPEXP_BASE double wxAtof(const wxChar *psz);
1040 #endif
1041
1042 #ifdef wxNEED_WX_STDLIB_H
1043 WXDLLIMPEXP_BASE int wxAtoi(const wxChar *psz);
1044 WXDLLIMPEXP_BASE long wxAtol(const wxChar *psz);
1045 WXDLLIMPEXP_BASE wxChar * wxGetenv(const wxChar *name);
1046 WXDLLIMPEXP_BASE int wxSystem(const wxChar *psz);
1047 #endif
1048
1049
1050 /* time.h functions */
1051 #ifdef wxNEED_WX_TIME_H
1052 #if defined(__MWERKS__) && defined(macintosh)
1053 #include <time.h>
1054 #endif
1055 /*silent gabby compilers*/
1056 struct tm;
1057 WXDLLIMPEXP_BASE size_t wxStrftime(wxChar *s, size_t max,
1058 const wxChar *fmt,
1059 const struct tm *tm);
1060 #endif /* wxNEED_WX_TIME_H */
1061
1062 #ifndef wxCtime
1063 #include <time.h>
1064 WXDLLIMPEXP_BASE wxChar *wxCtime(const time_t *timep);
1065 #endif
1066
1067
1068 /* missing functions in some WinCE versions */
1069 #ifdef _WIN32_WCE
1070 #if (_WIN32_WCE < 300)
1071 WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size );
1072 #endif
1073 #endif /* _WIN32_WCE */
1074
1075 /* multibyte to wide char conversion functions and macros */
1076
1077 #if wxUSE_WCHAR_T
1078 /* multibyte<->widechar conversion */
1079 WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n);
1080 WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n);
1081
1082 #if wxUSE_UNICODE
1083 #define wxMB2WX wxMB2WC
1084 #define wxWX2MB wxWC2MB
1085 #define wxWC2WX wxStrncpy
1086 #define wxWX2WC wxStrncpy
1087 #else
1088 #define wxMB2WX wxStrncpy
1089 #define wxWX2MB wxStrncpy
1090 #define wxWC2WX wxWC2MB
1091 #define wxWX2WC wxMB2WC
1092 #endif
1093 #else /* !wxUSE_UNICODE */
1094 /* Why is this here?
1095 #error ha */
1096 /* No wxUSE_WCHAR_T: we have to do something (JACS) */
1097 #define wxMB2WC wxStrncpy
1098 #define wxWC2MB wxStrncpy
1099 #define wxMB2WX wxStrncpy
1100 #define wxWX2MB wxStrncpy
1101 #define wxWC2WX wxWC2MB
1102 #define wxWX2WC wxMB2WC
1103 #endif
1104
1105 /*
1106 RN: The following are not normal versions of memcpy et al., rather
1107 these are either char or widechar versions depending on
1108 if unicode is used or not.
1109 */
1110
1111 #ifdef __cplusplus
1112
1113 //
1114 // RN: We could do the usual tricky compiler detection here,
1115 // and use their variant (such as wmemchr, etc.). The problem
1116 // is that these functions are quite rare, even though they are
1117 // part of the current POSIX standard. In addition, most compilers
1118 // (including even MSC) inline them just like we do right in their
1119 // headers.
1120 //
1121 #if wxUSE_UNICODE
1122 #include <string.h> //for mem funcs
1123
1124 //implement our own wmem variants
1125 inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l)
1126 {
1127 for(;l && *s != c;--l, ++s) {}
1128
1129 if(l)
1130 return (wxChar*)s;
1131 return NULL;
1132 }
1133
1134 inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len)
1135 {
1136 for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {}
1137
1138 if(len)
1139 return *sz1 < *sz2 ? -1 : *sz1 > *sz2;
1140 else
1141 return 0;
1142 }
1143
1144 inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len)
1145 {
1146 return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar));
1147 }
1148
1149 inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len)
1150 {
1151 return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar));
1152 }
1153
1154 inline wxChar* wxTmemset(wxChar* szOut, const wxChar cIn, size_t len)
1155 {
1156 wxChar* szRet = szOut;
1157
1158 while (len--)
1159 *szOut++ = cIn;
1160
1161 return szRet;
1162 }
1163
1164 #else /* !wxUSE_UNICODE */
1165 # define wxTmemchr memchr
1166 # define wxTmemcmp memcmp
1167 # define wxTmemcpy memcpy
1168 # define wxTmemmove memmove
1169 # define wxTmemset memset
1170 #endif /* wxUSE_UNICODE/!wxUSE_UNICODE */
1171
1172 #endif /*__cplusplus*/
1173
1174 #endif /* _WX_WXCRT_H_ */