3 * Purpose: Declarations common to wx char/wchar_t usage (wide chars)
4 * Author: Joel Farley, Ove Kåven
5 * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
8 * Copyright: (c) 1998-2006 wxWidgets dev team
9 * Licence: wxWindows licence
12 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
17 /* defs.h indirectly includes this file, so don't include it here */
18 #include "wx/platform.h"
19 #include "wx/dlimpexp.h"
21 #if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS
22 char *strtok_r(char *, const char *, char **);
25 /* check whether we have wchar_t and which size it is if we do */
26 #if !defined(wxUSE_WCHAR_T)
28 #if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) || defined(__DARWIN__)
29 #define wxUSE_WCHAR_T 1
31 #define wxUSE_WCHAR_T 0
33 #elif defined(__GNUWIN32__) && !defined(__MINGW32__)
34 #define wxUSE_WCHAR_T 0
35 #elif defined(__WATCOMC__)
36 #define wxUSE_WCHAR_T 0
37 #elif defined(__VISAGECPP__) && (__IBMCPP__ < 400)
38 #define wxUSE_WCHAR_T 0
40 /* add additional compiler checks if this fails */
41 #define wxUSE_WCHAR_T 1
43 #endif /* !defined(wxUSE_WCHAR_T) */
45 /* Unicode support requires wchar_t */
46 #if wxUSE_UNICODE && !wxUSE_WCHAR_T
47 #error "wchar_t must be available in Unicode build"
51 Standard headers we need here.
53 NB: don't include any wxWidgets headers here because almost all of them include
57 /* Required for wxPrintf() etc */
60 /* Almost all compiler have strdup(), but not quite all: CodeWarrior under Mac */
61 /* and VC++ for Windows CE don't provide it */
62 #if defined(__VISUALC__) && __VISUALC__ >= 1400
63 #define wxStrdupA _strdup
64 #elif !(defined(__MWERKS__) && defined(__WXMAC__)) && !defined(__WXWINCE__)
65 /* use #define, not inline wrapper, as it is tested with #ifndef below */
66 #define wxStrdupA strdup
70 non Unix compilers which do have wchar.h (but not tchar.h which is included
71 below and which includes wchar.h anyhow).
73 Actually MinGW has tchar.h, but it does not include wchar.h
75 #if defined(__MWERKS__) || defined(__VISAGECPP__) || defined(__MINGW32__) || defined(__WATCOMC__)
80 #if defined(__MWERKS__) && !defined(__MACH__)
88 /* the current (as of Nov 2002) version of cygwin has a bug in its */
89 /* wchar.h -- there is no extern "C" around the declarations in it and */
90 /* this results in linking errors later; also, at least on some */
91 /* Cygwin versions, wchar.h requires sys/types.h */
93 #include <sys/types.h>
101 #if defined(__CYGWIN__) && defined(__cplusplus)
103 #endif /* Cygwin and C++ */
105 #elif defined(HAVE_WCSTR_H)
106 /* old compilers have relevant declarations here */
108 #elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__)
109 /* include stdlib.h for wchar_t */
111 #endif /* HAVE_WCHAR_H */
116 #endif /* wxUSE_WCHAR_T */
118 /* ---------------------------------------------------------------------------- */
119 /* define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type */
120 /* mapped to either char or wchar_t depending on the ASCII/Unicode mode and have */
121 /* the function mapping _tfoo() -> foo() or wfoo() */
122 /* ---------------------------------------------------------------------------- */
124 /* VC++ and BC++ starting with 5.2 have TCHAR support */
126 #define wxHAVE_TCHAR_SUPPORT
127 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)
128 #define wxHAVE_TCHAR_SUPPORT
130 #elif defined(__WATCOMC__)
131 #define wxHAVE_TCHAR_SUPPORT
132 #elif defined(__DMC__)
133 #define wxHAVE_TCHAR_SUPPORT
134 #elif defined(__WXPALMOS__)
136 #elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 )
137 #define wxHAVE_TCHAR_SUPPORT
141 #elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
142 /* VZ: the old VisualAge definitions were completely wrong and had no */
143 /* chance at all to work in Unicode build anyhow so let's pretend that */
144 /* VisualAge does _not_ support TCHAR for the moment (as indicated by */
145 /* "0 &&" above) until someone really has time to delve into Unicode */
146 /* issues under OS/2 */
148 /* VisualAge 4.0+ supports TCHAR */
149 #define wxHAVE_TCHAR_SUPPORT
150 #endif /* compilers with (good) TCHAR support */
152 #if defined(__MWERKS__)
153 /* Metrowerks only has wide char support for OS X >= 10.3 */
154 #if !defined(__DARWIN__) || \
155 (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
156 #define wxHAVE_MWERKS_UNICODE
159 #ifdef wxHAVE_MWERKS_UNICODE
160 #define HAVE_WPRINTF 1
161 #define HAVE_WCSRTOMBS 1
162 #define HAVE_VSWPRINTF 1
164 #endif /* __MWERKS__ */
166 #ifdef wxHAVE_TCHAR_SUPPORT
167 /* get TCHAR definition if we've got it */
170 /* we surely do have wchar_t if we have TCHAR */
171 #ifndef wxUSE_WCHAR_T
172 #define wxUSE_WCHAR_T 1
173 #endif /* !defined(wxUSE_WCHAR_T) */
175 /* and we also do have wcslen() */
179 #endif /* wxHAVE_TCHAR_SUPPORT */
181 /* ---------------------------------------------------------------------------- */
182 /* define wxChar type */
183 /* ---------------------------------------------------------------------------- */
185 /* TODO: define wxCharInt to be equal to either int or wint_t? */
189 typedef signed char wxSChar
;
190 typedef unsigned char wxUChar
;
192 /* VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as */
193 /* signed/unsigned version of it which (a) makes sense to me (unlike */
194 /* char wchar_t is always unsigned) and (b) was how the previous */
195 /* definitions worked so keep it like this */
197 /* Sun's SunPro compiler supports the wchar_t type and wide character */
198 /* functions, but does not define __WCHAR_TYPE__. Define it here to */
199 /* allow unicode enabled builds. */
200 #if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
201 #define __WCHAR_TYPE__ wxchar_t
204 /* GNU libc has __WCHAR_TYPE__ which requires special treatment, see */
206 #if !defined(__WCHAR_TYPE__) || \
207 (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96))
209 typedef wchar_t wxChar
;
210 typedef wchar_t wxSChar
;
211 typedef wchar_t wxUChar
;
212 #else /* __WCHAR_TYPE__ and gcc < 2.96 */
213 /* VS: wxWidgets used to define wxChar as __WCHAR_TYPE__ here. However, */
214 /* this doesn't work with new GCC 3.x compilers because wchar_t is */
215 /* C++'s builtin type in the new standard. OTOH, old compilers (GCC */
216 /* 2.x) won't accept new definition of wx{S,U}Char, therefore we */
217 /* have to define wxChar conditionally depending on detected */
218 /* compiler & compiler version. */
219 /* with old definition of wxChar. */
220 typedef __WCHAR_TYPE__ wxChar
;
221 typedef __WCHAR_TYPE__ wxSChar
;
222 typedef __WCHAR_TYPE__ wxUChar
;
223 #endif /* __WCHAR_TYPE__ */
224 #endif /* ASCII/Unicode */
226 /* ---------------------------------------------------------------------------- */
227 /* define _T() and related macros */
228 /* ---------------------------------------------------------------------------- */
230 /* BSD systems define _T() to be something different in ctype.h, override it */
231 #if defined(__FreeBSD__) || defined(__DARWIN__)
236 /* could already be defined by tchar.h (it's quasi standard) */
241 /* use wxCONCAT_HELPER so that x could be expanded if it's a macro */
242 #define _T(x) wxCONCAT_HELPER(L, x)
243 #endif /* ASCII/Unicode */
244 #endif /* !defined(_T) */
246 /* although global macros with such names are normally bad, we want to have */
247 /* another name for _T() which should be used to avoid confusion between _T() */
248 /* and _() in wxWidgets sources */
251 /* a helper macro allowing to make another macro Unicode-friendly, see below */
252 #define wxAPPLY_T(x) _T(x)
254 /* Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs */
256 #define __TFILE__ wxAPPLY_T(__FILE__)
260 #define __TDATE__ wxAPPLY_T(__DATE__)
264 #define __TTIME__ wxAPPLY_T(__TIME__)
268 define wxFoo() function for each standard foo() function whose signature
269 (exceptionally including the return type) includes any mention of char:
270 wxFoo() is going to be a Unicode-friendly version of foo(), i.e. will have
271 the same signature but with char replaced by wxChar which allows us to use
272 it in Unicode build as well
275 #ifdef wxHAVE_TCHAR_SUPPORT
278 #if defined(__WATCOMC__) && defined(UNICODE)
279 #define WXWCHAR_T_CAST(c) (wint_t)(c)
281 #define WXWCHAR_T_CAST(c) c
284 /* ctype.h functions */
285 #define wxIsalnum(c) _istalnum(WXWCHAR_T_CAST(c))
286 #define wxIsalpha(c) _istalpha(WXWCHAR_T_CAST(c))
287 #define wxIscntrl(c) _istcntrl(WXWCHAR_T_CAST(c))
288 #define wxIsdigit(c) _istdigit(WXWCHAR_T_CAST(c))
289 #define wxIsgraph(c) _istgraph(WXWCHAR_T_CAST(c))
290 #define wxIslower(c) _istlower(WXWCHAR_T_CAST(c))
291 #define wxIsprint(c) _istprint(WXWCHAR_T_CAST(c))
292 #define wxIspunct(c) _istpunct(WXWCHAR_T_CAST(c))
293 #define wxIsspace(c) _istspace(WXWCHAR_T_CAST(c))
294 #define wxIsupper(c) _istupper(WXWCHAR_T_CAST(c))
295 #define wxIsxdigit(c) _istxdigit(WXWCHAR_T_CAST(c))
298 There is a bug in VC6 C RTL: toxxx() functions dosn't do anything with
299 signed chars < 0, so "fix" it here.
301 #define wxTolower(c) _totlower((wxUChar)(c))
302 #define wxToupper(c) _totupper((wxUChar)(c))
304 /* locale.h functons */
305 #define wxSetlocale _tsetlocale
307 /* string.h functions */
308 #define wxStrcat _tcscat
309 #define wxStrchr _tcschr
310 #define wxStrcmp _tcscmp
311 #define wxStrcoll _tcscoll
312 #define wxStrcpy _tcscpy
313 #define wxStrcspn _tcscspn
314 #define wxStrdupW _wcsdup /* notice the 'W'! */
315 #define wxStrftime _tcsftime
316 #define wxStricmp _tcsicmp
317 #define wxStrnicmp _tcsnicmp
318 #define wxStrlen_ _tcslen /* used in wxStrlen inline function */
319 #define wxStrncat _tcsncat
320 #define wxStrncmp _tcsncmp
321 #define wxStrncpy _tcsncpy
322 #define wxStrpbrk _tcspbrk
323 #define wxStrrchr _tcsrchr
324 #define wxStrspn _tcsspn
325 #define wxStrstr _tcsstr
326 #define wxStrtod _tcstod
327 #define wxStrtol _tcstol
328 #define wxStrtoul _tcstoul
330 #if __VISUALC__ >= 1300 && !defined(__WXWINCE__)
331 #define wxStrtoll _tcstoi64
332 #define wxStrtoull _tcstoui64
335 #define wxStrxfrm _tcsxfrm
337 /* stdio.h functions */
338 #define wxFgetc _fgettc
339 #define wxFgetchar _fgettchar
340 #define wxFgets _fgetts
341 #if wxUSE_UNICODE_MSLU
342 WXDLLIMPEXP_BASE
FILE * wxMSLU__tfopen(const wxChar
*name
, const wxChar
*mode
);
344 #define wxFopen wxMSLU__tfopen
346 #define wxFopen _tfopen
348 #define wxFputc _fputtc
349 #define wxFputchar _fputtchar
350 #define wxFprintf _ftprintf
351 #define wxFputs _fputts
352 #define wxFreopen _tfreopen
353 #define wxFscanf _ftscanf
354 #define wxGetc _gettc
355 #define wxGetchar _gettchar
356 #define wxGets _getts
357 #define wxPerror _tperror
358 #define wxPrintf _tprintf
359 #define wxPutc(c,f) _puttc(WXWCHAR_T_CAST(c),f)
360 #define wxPutchar _puttchar
361 #define wxPuts _putts
362 #define wxScanf _tscanf
365 /* Digital Mars adds count to _stprintf (C99) so prototype conversion see wxchar.cpp */
366 int wxSprintf (wchar_t * __RESTRICT s
, const wchar_t * __RESTRICT format
, ... ) ;
368 /* and there is a bug in D Mars tchar.h prior to 8.39.4n, so define as sprintf */
369 #define wxSprintf sprintf
372 #define wxSprintf _stprintf
375 #define wxSscanf _stscanf
376 #define wxTmpnam _ttmpnam
377 #define wxUngetc _tungetc
378 #define wxVfprintf _vftprintf
379 #define wxVprintf _vtprintf
380 #define wxVsscanf _vstscanf
381 #define wxVsprintf _vstprintf
383 /* special case: these functions are missing under Win9x with Unicows so we */
384 /* have to implement them ourselves */
385 #if wxUSE_UNICODE_MSLU
386 WXDLLIMPEXP_BASE
int wxMSLU__trename(const wxChar
*oldname
, const wxChar
*newname
);
387 WXDLLIMPEXP_BASE
int wxMSLU__tremove(const wxChar
*name
);
389 #define wxRemove wxMSLU__tremove
390 #define wxRename wxMSLU__trename
393 /* carefully: wxRemove() must return 0 on success while DeleteFile()
394 returns 0 on error, so don't just define one as the other */
395 int wxRemove(const wxChar
*path
);
397 #define wxRemove _tremove
398 #define wxRename _trename
402 /* stdlib.h functions */
405 /* #define wxAtof _tttof -- notice that there is no such thing (why?) */
406 /* there are no env vars at all under CE, so no _tgetenv neither */
408 /* can't define as inline function as this is a C file... */
409 #define wxGetenv(name) ((wxChar *)NULL)
411 #define wxGetenv _tgetenv
413 #define wxSystem _tsystem
415 /* time.h functions */
416 #define wxAsctime _tasctime
417 #define wxCtime _tctime
419 #define wxMbstowcs mbstowcs
420 #define wxWcstombs wcstombs
421 #else /* !TCHAR-aware compilers */
423 There are 2 unrelated problems with these functions under Mac:
424 a) Metrowerks MSL CRT implements them strictly in C99 sense and
425 doesn't support (very common) extension of allowing to call
426 mbstowcs(NULL, ...) which makes it pretty useless as you can't
427 know the size of the needed buffer
428 b) OS X <= 10.2 declares and even defined these functions but
429 doesn't really implement them -- they always return an error
431 So use our own replacements in both cases.
433 #if defined(__MWERKS__) && defined(__MSL__)
434 #define wxNEED_WX_MBSTOWCS
438 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2
439 #define wxNEED_WX_MBSTOWCS
443 #ifdef wxNEED_WX_MBSTOWCS
444 /* even though they are defined and "implemented", they are bad and just
445 stubs so we need our own - we need these even in ANSI builds!! */
446 WXDLLIMPEXP_BASE
size_t wxMbstowcs (wchar_t *, const char *, size_t);
447 WXDLLIMPEXP_BASE
size_t wxWcstombs (char *, const wchar_t *, size_t);
449 #define wxMbstowcs mbstowcs
450 #define wxWcstombs wcstombs
454 The system C library on Mac OS X 10.2 and below does not support
455 unicode: in other words all wide-character functions such as towupper et
456 al. do simply not exist so we need to provide our own in that context,
457 except for the wchar_t definition/typedef itself.
459 We need to do this for both project builder and CodeWarrior as
460 the latter uses the system C library in Mach builds for wide character
461 support, which as mentioned does not exist on 10.2 and below.
463 #if wxUSE_UNICODE && \
464 defined(__DARWIN__) && \
465 ( MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 )
466 /* we need everything! */
467 #define wxNEED_WX_STRING_H
468 #define wxNEED_WX_CTYPE_H
470 #define wxFgetchar(c) wxFgetc(c, stdin)
471 #define wxFputc wxPutc
472 #define wxFputchar(c) wxPutc(c, stdout)
473 #define wxGetc wxFgetc
474 #define wxGetchar(c) wxFgetc(c, stdin)
481 #define wxNEED_UNGETC
487 int wxFputs(const wxChar
*ch
, FILE *stream
);
488 int wxPuts(const wxChar
*ws
);
489 int wxPutc(wxChar ch
, FILE *stream
);
494 WXDLLIMPEXP_BASE
size_t wxStrlen_(const wxChar
*s
);
499 #define wxPutchar(wch) wxPutc(wch, stdout)
501 #define wxNEED_PRINTF_CONVERSION
502 #define wxNEED_WX_STDIO_H
503 #define wxNEED_WX_STDLIB_H
504 #define wxNEED_WX_TIME_H
509 /* this is probably glibc-specific */
510 #if defined(__WCHAR_TYPE__) && !defined(__MWERKS__)
511 /* ctype.h functions (wctype.h) */
512 #define wxIsalnum iswalnum
513 #define wxIsalpha iswalpha
514 #define wxIscntrl iswcntrl
515 #define wxIsdigit iswdigit
516 #define wxIsgraph iswgraph
517 #define wxIslower iswlower
518 #define wxIsprint iswprint
519 #define wxIspunct iswpunct
520 #define wxIsspace iswspace
521 #define wxIsupper iswupper
522 #define wxIsxdigit iswxdigit
524 #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
525 /* /usr/include/wctype.h incorrectly declares translations */
526 /* tables which provokes tons of compile-time warnings -- try */
527 /* to correct this */
528 #define wxTolower(wc) towctrans((wc), (wctrans_t)__ctype_tolower)
529 #define wxToupper(wc) towctrans((wc), (wctrans_t)__ctype_toupper)
530 #else /* !glibc 2.0 */
531 #define wxTolower towlower
532 #define wxToupper towupper
533 #endif /* gcc/!gcc */
535 /* string.h functions (wchar.h) */
536 #define wxStrcat wcscat
537 #define wxStrchr wcschr
538 #define wxStrcmp wcscmp
539 #define wxStrcoll wcscoll
540 #define wxStrcpy wcscpy
541 #define wxStrcspn wcscspn
542 #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */
543 #define wxStrncat wcsncat
544 #define wxStrncmp wcsncmp
545 #define wxStrncpy wcsncpy
546 #define wxStrpbrk wcspbrk
547 #define wxStrrchr wcsrchr
548 #define wxStrspn wcsspn
549 #define wxStrstr wcsstr
550 #define wxStrtod wcstod
551 #define wxStrtol wcstol
552 #define wxStrtoul wcstoul
554 /* assume that we have wcstoull(), which is also C99, too */
555 #define wxStrtoll wcstoll
556 #define wxStrtoull wcstoull
557 #endif /* HAVE_WCSTOULL */
558 #define wxStrxfrm wcsxfrm
560 #define wxFgetc fgetwc
561 #define wxFgetchar fgetwchar
562 #define wxFgets fgetws
563 #define wxFputc fputwc
564 #define wxFputchar fputwchar
566 #define wxGetchar getwchar
568 #define wxUngetc ungetwc
571 #define wxFputs fputws
575 int wxFputs(const wxChar
*ch
, FILE *stream
);
583 int wxPutc(wxChar ch
, FILE *stream
);
587 #define wxPutchar wputchar
589 #define wxPutchar(wch) wxPutc(wch, stdout)
596 int wxPuts(const wxChar
*ws
);
599 /* we need %s to %ls conversion for printf and scanf etc */
600 #define wxNEED_PRINTF_CONVERSION
602 /* glibc doesn't have wide char equivalents of the other stuff so */
603 /* use our own versions */
604 #define wxNEED_WX_STDIO_H
605 #define wxNEED_WX_STDLIB_H
606 #define wxNEED_WX_TIME_H
607 #elif defined(__MWERKS__) && ( defined(__MSL__) || defined(__MACH__) )
608 /* ctype.h functions (wctype.h) */
609 #define wxIsalnum iswalnum
610 #define wxIsalpha iswalpha
611 #define wxIscntrl iswcntrl
612 #define wxIsdigit iswdigit
613 #define wxIsgraph iswgraph
614 #define wxIslower iswlower
615 #define wxIsprint iswprint
616 #define wxIspunct iswpunct
617 #define wxIsspace iswspace
618 #define wxIsupper iswupper
619 #define wxIsxdigit iswxdigit
620 #define wxTolower towlower
621 #define wxToupper towupper
623 /* string.h functions (wchar.h) */
624 #define wxStrcat wcscat
625 #define wxStrchr wcschr
626 #define wxStrcmp wcscmp
627 #define wxStrcoll wcscoll
628 #define wxStrcpy wcscpy
629 #define wxStrcspn wcscspn
630 #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */
631 #define wxStrncat wcsncat
632 #define wxStrncmp wcsncmp
633 #define wxStrncpy wcsncpy
634 #define wxStrpbrk wcspbrk
635 #define wxStrrchr wcsrchr
636 #define wxStrspn wcsspn
637 #define wxStrstr wcsstr
638 #define wxStrtod wcstod
639 #define wxStrtol wcstol
640 #define wxStrtoul wcstoul
641 #define wxStrxfrm wcsxfrm
643 #define wxFgetc fgetwc
644 #define wxFgetchar fgetwchar
645 #define wxFgets fgetws
646 #define wxFputc fputwc
647 #define wxFputchar fputwchar
649 #define wxGetchar getwchar
651 #define wxUngetc ungetwc
653 #define wxNEED_PRINTF_CONVERSION
656 #define wxPutchar putwchar
657 #define wxFputs fputws
659 /* stdio.h functions */
661 #define wxNEED_WX_STDIO_H
663 /* stdlib.h functions */
665 #define wxNEED_WX_STDLIB_H
670 #define wxGetenv(a) ((wxChar*)NULL)
671 #define wxSystem(a) ((int)NULL)
673 /* time.h functions */
674 #define wxAsctime wasciitime
675 #define wxCtime wctime
676 /* #define wxStrftime wcsftime */
678 #define wxNEED_WX_TIME_H
679 #else /* !metrowerks for apple */
680 #error "Please define wide character functions for your environment"
686 /* ctype.h functions */
687 #define wxIsalnum isalnum
688 #define wxIsalpha isalpha
689 #define wxIscntrl iscntrl
690 #define wxIsdigit isdigit
691 #define wxIsgraph isgraph
692 #define wxIslower islower
693 #define wxIsprint isprint
694 #define wxIspunct ispunct
695 #define wxIsspace isspace
696 #define wxIsupper isupper
697 #define wxIsxdigit isxdigit
698 #define wxTolower tolower
699 #define wxToupper toupper
701 /* locale.h functons */
702 #define wxSetlocale setlocale
704 /* string.h functions */
705 #define wxStrcat strcat
706 #define wxStrchr strchr
707 #define wxStrcmp strcmp
708 #define wxStrcoll strcoll
709 #define wxStrcpy strcpy
710 #define wxStrcspn strcspn
712 /* wxStricmp and wxStrnicmp are defined below */
713 #define wxStrlen_ strlen /* used in wxStrlen inline function */
714 #define wxStrncat strncat
715 #define wxStrncmp strncmp
716 #define wxStrncpy strncpy
717 #define wxStrpbrk strpbrk
718 #define wxStrrchr strrchr
719 #define wxStrspn strspn
720 #define wxStrstr strstr
721 #define wxStrtod strtod
723 #define wxStrtok(str, sep, last) strtok_r(str, sep, last)
725 #define wxStrtol strtol
726 #define wxStrtoul strtoul
728 /* assume that we have wcstoull(), which is also C99, too */
729 #define wxStrtoll strtoll
730 #define wxStrtoull strtoull
731 #endif /* HAVE_WCSTOULL */
732 #define wxStrxfrm strxfrm
734 /* stdio.h functions */
735 #define wxFopen fopen
736 #define wxFreopen freopen
737 #define wxRemove remove
738 #define wxRename rename
740 #define wxPerror perror
741 #define wxTmpnam tmpnam
743 #define wxFgetc fgetc
744 #define wxFgetchar fgetchar
745 #define wxFgets fgets
746 #define wxFputc fputc
747 #define wxFputs fputs
748 #define wxFputchar fputchar
749 #define wxFprintf fprintf
750 #define wxFscanf fscanf
752 #define wxGetchar getchar
754 #define wxPrintf printf
756 #define wxPutchar putchar
758 #define wxScanf scanf
759 #define wxSprintf sprintf
760 #define wxSscanf sscanf
761 #define wxUngetc ungetc
762 #define wxVfprintf vfprintf
763 #define wxVprintf vprintf
764 #define wxVsscanf vsscanf
765 #define wxVsprintf vsprintf
767 /* stdlib.h functions */
771 #define wxGetenv getenv
772 #define wxSystem system
774 /* time.h functions */
775 #define wxAsctime asctime
776 #define wxCtime ctime
777 #define wxStrftime strftime
778 #endif /* Unicode/ASCII */
779 #endif /* TCHAR-aware compilers/the others */
782 #define wxHAS_STRTOLL
786 various special cases
789 /* define wxStricmp and wxStrnicmp for various compilers */
791 /* note that in Unicode mode we definitely are going to need our own version */
792 #if !defined(wxStricmp) && !wxUSE_UNICODE
793 #if defined(__BORLANDC__) || defined(__WATCOMC__) || \
794 defined(__SALFORDC__) || defined(__VISAGECPP__) || \
795 defined(__EMX__) || defined(__DJGPP__)
796 #define wxStricmp stricmp
797 #define wxStrnicmp strnicmp
798 #elif defined(__WXPALMOS__)
799 /* FIXME: There is no equivalent to strnicmp in the Palm OS API. This
800 * quick hack should do until one can be written.
802 #define wxStricmp StrCaselessCompare
803 #define wxStrnicmp strnicmp
804 #elif defined(__SYMANTEC__) || defined(__VISUALC__) || \
805 (defined(__MWERKS__) && defined(__INTEL__))
806 #define wxStricmp _stricmp
807 #define wxStrnicmp _strnicmp
808 #elif defined(__UNIX__) || defined(__GNUWIN32__)
809 #define wxStricmp strcasecmp
810 #define wxStrnicmp strncasecmp
811 /* #else -- use wxWidgets implementation */
813 #endif /* !defined(wxStricmp) */
815 /* define wxWcslen() which should be always available if wxUSE_WCHAR_T == 1 (as */
816 /* it's used in wx/buffer.h -- and also might be used just below by wxStrlen() */
817 /* when wxStrlen_() is #define'd as wxWcslen so do it before defining wxStrlen) */
820 #define wxWcslen wcslen
822 WXDLLIMPEXP_BASE
size_t wxWcslen(const wchar_t *s
);
824 #endif /* wxUSE_WCHAR_T */
827 /* checks whether the passed in pointer is NULL and if the string is empty */
828 inline bool wxIsEmpty(const wxChar
*p
) { return !p
|| !*p
; }
830 /* safe version of strlen() (returns 0 if passed NULL pointer) */
831 inline size_t wxStrlen(const wxChar
*psz
) { return psz
? wxStrlen_(psz
) : 0; }
835 each of strdup() and wcsdup() may or may not be available but we need both
836 of them anyhow for wx/buffer.h so we define the missing one(s) in
837 wxchar.cpp and so we should always have both wxStrdupA and wxStrdupW
838 defined -- if this is somehow not the case in some situations, please
839 correct that and not the lines here
842 #define wxStrdup wxStrdupW
844 #define wxStrdup wxStrdupA
848 WXDLLIMPEXP_BASE
bool wxOKlibc(); /* for internal use */
851 /* printf() family saga */
854 For some systems [v]snprintf() exists in the system libraries but not in the
855 headers, so we need to declare it ourselves to be able to use it.
857 #if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL)
863 int vsnprintf(char *str
, size_t size
, const char *format
, va_list ap
);
864 #endif /* !HAVE_VSNPRINTF_DECL */
866 #if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL)
872 WXDLLIMPEXP_BASE
int snprintf(char *str
, size_t size
, const char *format
, ...);
873 #endif /* !HAVE_SNPRINTF_DECL */
875 /* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the
876 * same isn't done for snprintf below, the builtin wxSnprintf_ is used
877 * instead since it's already a simple wrapper */
878 #if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL
879 inline int wx_fixed_vsnprintf(char *str
, size_t size
, const char *format
, va_list ap
)
881 return vsnprintf(str
, size
, (char*)format
, ap
);
886 MinGW MSVCRT has non-standard vswprintf() (for MSVC compatibility
887 presumably) and normally _vsnwprintf() is used instead
889 #if defined(HAVE_VSWPRINTF) && defined(__MINGW32__)
890 #undef HAVE_VSWPRINTF
893 #if wxUSE_PRINTF_POS_PARAMS
895 The systems where vsnprintf() supports positional parameters should
896 define the HAVE_UNIX98_PRINTF symbol.
898 On systems which don't (e.g. Windows) we are forced to use
899 our wxVsnprintf() implementation.
901 #if defined(HAVE_UNIX98_PRINTF)
903 #ifdef HAVE_VSWPRINTF
904 #define wxVsnprintf_ vswprintf
907 #ifdef HAVE_BROKEN_VSNPRINTF_DECL
908 #define wxVsnprintf_ wx_fixed_vsnprintf
910 #define wxVsnprintf_ vsnprintf
913 #else /* !HAVE_UNIX98_PRINTF */
915 The only compiler with positional parameters support under Windows
916 is VC++ 8.0 which provides a new xxprintf_p() functions family
918 #if defined(__VISUALC__) && __VISUALC__ >= 1400 && !defined(__WXWINCE__)
920 #define wxVsnprintf_ _vswprintf_p
922 #define wxVsnprintf_ _vsprintf_p
925 #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */
926 #else /* !wxUSE_PRINTF_POS_PARAMS */
928 We always want to define safe snprintf() function to be used instead of
929 sprintf(). Some compilers already have it (or rather vsnprintf() which
930 we really need...), otherwise we implement it using our own printf()
933 We define function with a trailing underscore here because the real one
934 is a wrapper around it as explained below
937 /* first deal with TCHAR-aware compilers which have _vsntprintf */
939 #if defined(__VISUALC__) || \
940 (defined(__BORLANDC__) && __BORLANDC__ >= 0x540)
941 #define wxVsnprintf_ _vsntprintf
942 #define wxSnprintf_ _sntprintf
946 /* if this didn't work, define it separately for Unicode and ANSI builds */
949 #if defined(HAVE__VSNWPRINTF)
950 #define wxVsnprintf_ _vsnwprintf
951 #elif defined(HAVE_VSWPRINTF)
952 #define wxVsnprintf_ vswprintf
953 #elif defined(__WATCOMC__)
954 #define wxVsnprintf_ _vsnwprintf
955 #define wxSnprintf_ _snwprintf
959 All versions of CodeWarrior supported by wxWidgets apparently
960 have both snprintf() and vsnprintf()
962 #if defined(HAVE_SNPRINTF) \
963 || defined(__MWERKS__) || defined(__WATCOMC__)
964 #ifndef HAVE_BROKEN_SNPRINTF_DECL
965 #define wxSnprintf_ snprintf
968 #if defined(HAVE_VSNPRINTF) \
969 || defined(__MWERKS__) || defined(__WATCOMC__)
970 #ifdef HAVE_BROKEN_VSNPRINTF_DECL
971 #define wxVsnprintf_ wx_fixed_vsnprintf
973 #define wxVsnprintf_ vsnprintf
976 #endif /* Unicode/ASCII */
977 #endif /* wxVsnprintf_ */
978 #endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */
981 /* no [v]snprintf(), cook our own */
983 wxSnprintf_(wxChar
*buf
, size_t len
, const wxChar
*format
, ...) ATTRIBUTE_PRINTF_3
;
987 wxVsnprintf_(wxChar
*buf
, size_t len
, const wxChar
*format
, va_list argptr
);
991 In Unicode mode we need to have all standard functions such as wprintf() and
992 so on but not all systems have them so use our own implementations in this
995 #if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF)
996 #define wxNEED_WPRINTF
1000 More Unicode complications: although both ANSI C and C++ define a number of
1001 wide character functions such as wprintf(), not all environments have them.
1002 Worse, those which do have different behaviours: under Windows, %s format
1003 specifier changes its meaning in Unicode build and expects a Unicode string
1004 while under Unix/POSIX it still means an ASCII string even for wprintf() and
1005 %ls has to be used for wide strings.
1007 We choose to always emulate Windows behaviour as more useful for us so even
1008 if we have wprintf() we still must wrap it in a non trivial wxPrintf().
1012 #if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF)
1014 we need to implement all wide character printf and scanf functions
1015 either because we don't have them at all or because they don't have the
1019 #include <stdio.h> /* for FILE */
1021 int wxScanf( const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_1
;
1022 int wxSscanf( const wxChar
*str
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
1023 int wxFscanf( FILE *stream
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
1024 int wxVsscanf( const wxChar
*str
, const wxChar
*format
, va_list ap
);
1025 int wxPrintf( const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_1
;
1026 int wxSprintf( wxChar
*str
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
1027 int wxFprintf( FILE *stream
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
1028 int wxVfprintf( FILE *stream
, const wxChar
*format
, va_list ap
);
1029 int wxVprintf( const wxChar
*format
, va_list ap
);
1030 int wxVsprintf( wxChar
*str
, const wxChar
*format
, va_list ap
);
1031 #endif /* wxNEED_PRINTF_CONVERSION */
1033 /* these 2 can be simply mapped to the versions with underscore at the end */
1034 /* if we don't have to do the conversion */
1036 However, if we don't have any vswprintf() at all we don't need to redefine
1037 anything as our own wxVsnprintf_() already behaves as needed.
1039 #if defined(wxNEED_PRINTF_CONVERSION) && defined(wxVsnprintf_)
1040 int wxSnprintf( wxChar
*str
, size_t size
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_3
;
1041 int wxVsnprintf( wxChar
*str
, size_t size
, const wxChar
*format
, va_list ap
);
1043 #define wxSnprintf wxSnprintf_
1044 #define wxVsnprintf wxVsnprintf_
1048 various functions which might not be available in libc and for which we
1049 provide our own replacements in wxchar.cpp
1052 /* ctype.h functions */
1054 /* RN: Used only under OSX <= 10.2 currently */
1055 #ifdef wxNEED_WX_CTYPE_H
1056 WXDLLIMPEXP_BASE
int wxIsalnum(wxChar ch
);
1057 WXDLLIMPEXP_BASE
int wxIsalpha(wxChar ch
);
1058 WXDLLIMPEXP_BASE
int wxIscntrl(wxChar ch
);
1059 WXDLLIMPEXP_BASE
int wxIsdigit(wxChar ch
);
1060 WXDLLIMPEXP_BASE
int wxIsgraph(wxChar ch
);
1061 WXDLLIMPEXP_BASE
int wxIslower(wxChar ch
);
1062 WXDLLIMPEXP_BASE
int wxIsprint(wxChar ch
);
1063 WXDLLIMPEXP_BASE
int wxIspunct(wxChar ch
);
1064 WXDLLIMPEXP_BASE
int wxIsspace(wxChar ch
);
1065 WXDLLIMPEXP_BASE
int wxIsupper(wxChar ch
);
1066 WXDLLIMPEXP_BASE
int wxIsxdigit(wxChar ch
);
1067 WXDLLIMPEXP_BASE
int wxTolower(wxChar ch
);
1068 WXDLLIMPEXP_BASE
int wxToupper(wxChar ch
);
1069 #endif /* wxNEED_WX_CTYPE_H */
1071 /* under VC++ 6.0 isspace() returns 1 for 8 bit chars which completely breaks */
1072 /* the file parsing -- this may be true for 5.0 as well, update #ifdef then */
1073 #if defined(__VISUALC__) && (__VISUALC__ >= 1200) && !wxUSE_UNICODE
1075 #define wxIsspace(c) ((((unsigned)c) < 128) && isspace(c))
1079 a few compilers don't have the (non standard but common) isascii function,
1080 define it ourselves for them
1083 #if defined(__MWERKS__)
1084 #define wxNEED_ISASCII
1085 #elif defined(_WIN32_WCE)
1086 #if _WIN32_WCE <= 211
1087 #define wxNEED_ISASCII
1090 #endif /* isascii */
1092 #ifdef wxNEED_ISASCII
1093 inline int isascii(int c
) { return (unsigned)c
< 0x80; }
1097 #if _WIN32_WCE <= 211
1098 #define isspace(c) ((c) == _T(' ') || (c) == _T('\t'))
1100 #endif /* _WIN32_WCE */
1103 we had goofed and defined wxIsctrl() instead of (correct) wxIscntrl() in the
1104 initial versions of this header -- now it is too late to remove it so
1105 although we fixed the function/macro name above, still provide the
1106 backwards-compatible synonym.
1108 #define wxIsctrl wxIscntrl
1110 /* string.h functions */
1112 #if defined(__MWERKS__) && !defined(__MACH__) && (__MSL__ < 0x00008000)
1113 #define wxNEED_STRDUP
1114 #elif defined(__WXWINCE__)
1115 #if _WIN32_WCE <= 211
1116 #define wxNEED_STRDUP
1121 #ifdef wxNEED_STRDUP
1122 WXDLLIMPEXP_BASE
char *strdup(const char* s
);
1125 /* RN: Used only under OSX <= 10.2 currently
1126 The __cplusplus ifdefs are messy, but they are required to build
1127 the regex library, since c does not support function overloading
1129 #ifdef wxNEED_WX_STRING_H
1133 WXDLLIMPEXP_BASE wxChar
* wxStrcat(wxChar
*dest
, const wxChar
*src
);
1134 WXDLLIMPEXP_BASE
const wxChar
* wxStrchr(const wxChar
*s
, wxChar c
);
1135 WXDLLIMPEXP_BASE
int wxStrcmp(const wxChar
*s1
, const wxChar
*s2
);
1136 WXDLLIMPEXP_BASE
int wxStrcoll(const wxChar
*s1
, const wxChar
*s2
);
1137 WXDLLIMPEXP_BASE wxChar
* wxStrcpy(wxChar
*dest
, const wxChar
*src
);
1138 WXDLLIMPEXP_BASE
size_t wxStrcspn(const wxChar
*s
, const wxChar
*reject
);
1139 WXDLLIMPEXP_BASE wxChar
* wxStrncat(wxChar
*dest
, const wxChar
*src
, size_t n
);
1140 WXDLLIMPEXP_BASE
int wxStrncmp(const wxChar
*s1
, const wxChar
*s2
, size_t n
);
1141 WXDLLIMPEXP_BASE wxChar
* wxStrncpy(wxChar
*dest
, const wxChar
*src
, size_t n
);
1142 WXDLLIMPEXP_BASE
const wxChar
* wxStrpbrk(const wxChar
*s
, const wxChar
*accept
);
1143 WXDLLIMPEXP_BASE
const wxChar
* wxStrrchr(const wxChar
*s
, wxChar c
);
1144 WXDLLIMPEXP_BASE
size_t wxStrspn(const wxChar
*s
, const wxChar
*accept
);
1145 WXDLLIMPEXP_BASE
const wxChar
* wxStrstr(const wxChar
*haystack
, const wxChar
*needle
);
1150 /* These functions use C++, so we can't c extern them */
1151 WXDLLIMPEXP_BASE
double wxStrtod(const wxChar
*nptr
, wxChar
**endptr
);
1152 WXDLLIMPEXP_BASE
long int wxStrtol(const wxChar
*nptr
, wxChar
**endptr
, int base
);
1153 WXDLLIMPEXP_BASE
unsigned long int wxStrtoul(const wxChar
*nptr
, wxChar
**endptr
, int base
);
1154 WXDLLIMPEXP_BASE
size_t wxStrxfrm(wxChar
*dest
, const wxChar
*src
, size_t n
);
1156 /* inlined versions */
1158 inline wxChar
* wxStrchr(wxChar
*s
, wxChar c
)
1159 { return (wxChar
*)wxStrchr((const wxChar
*)s
, c
); }
1160 inline wxChar
* wxStrpbrk(wxChar
*s
, const wxChar
*accept
)
1161 { return (wxChar
*)wxStrpbrk((const wxChar
*)s
, accept
); }
1162 inline wxChar
* wxStrrchr(wxChar
*s
, wxChar c
)
1163 { return (wxChar
*)wxStrrchr((const wxChar
*)s
, c
); }
1164 inline wxChar
*wxStrstr(wxChar
*haystack
, const wxChar
*needle
)
1165 { return (wxChar
*)wxStrstr((const wxChar
*)haystack
, needle
); }
1168 #endif /* wxNEED_WX_STRING_H */
1171 WXDLLIMPEXP_BASE
char *wxStrdupA(const char *psz
);
1175 WXDLLIMPEXP_BASE
wchar_t *wxStrdupW(const wchar_t *pwz
);
1179 WXDLLIMPEXP_BASE
int wxStricmp(const wxChar
*psz1
, const wxChar
*psz2
);
1183 WXDLLIMPEXP_BASE
int wxStrnicmp(const wxChar
*psz1
, const wxChar
*psz2
, size_t len
);
1187 WXDLLIMPEXP_BASE wxChar
* wxStrtok(wxChar
*psz
, const wxChar
*delim
, wxChar
**save_ptr
);
1192 class WXDLLIMPEXP_BASE wxWCharBuffer
;
1193 WXDLLIMPEXP_BASE wxWCharBuffer
wxSetlocale(int category
, const wxChar
*locale
);
1197 /* stdio.h functions */
1198 #ifdef wxNEED_WX_STDIO_H
1200 WXDLLIMPEXP_BASE
FILE * wxFopen(const wxChar
*path
, const wxChar
*mode
);
1201 WXDLLIMPEXP_BASE
FILE * wxFreopen(const wxChar
*path
, const wxChar
*mode
, FILE *stream
);
1202 WXDLLIMPEXP_BASE
int wxRemove(const wxChar
*path
);
1203 WXDLLIMPEXP_BASE
int wxRename(const wxChar
*oldpath
, const wxChar
*newpath
);
1205 /* *printf() family is handled separately */
1206 #endif /* wxNEED_WX_STDIO_H */
1209 /* stdlib.h functions */
1211 WXDLLIMPEXP_BASE
double wxAtof(const wxChar
*psz
);
1214 #ifdef wxNEED_WX_STDLIB_H
1215 WXDLLIMPEXP_BASE
int wxAtoi(const wxChar
*psz
);
1216 WXDLLIMPEXP_BASE
long wxAtol(const wxChar
*psz
);
1217 WXDLLIMPEXP_BASE wxChar
* wxGetenv(const wxChar
*name
);
1218 WXDLLIMPEXP_BASE
int wxSystem(const wxChar
*psz
);
1222 /* time.h functions */
1223 #ifdef wxNEED_WX_TIME_H
1224 #if defined(__MWERKS__) && defined(macintosh)
1227 /*silent gabby compilers*/
1229 WXDLLIMPEXP_BASE
size_t wxStrftime(wxChar
*s
, size_t max
,
1230 const wxChar
*fmt
, const struct tm
*tm
);
1231 #endif /* wxNEED_WX_TIME_H */
1235 WXDLLIMPEXP_BASE wxChar
*wxCtime(const time_t *timep
);
1239 /* missing functions in some WinCE versions */
1241 #if (_WIN32_WCE < 300)
1242 WXDLLIMPEXP_BASE
void *calloc( size_t num
, size_t size
);
1244 #endif /* _WIN32_WCE */
1246 /* multibyte to wide char conversion functions and macros */
1249 /* multibyte<->widechar conversion */
1250 WXDLLIMPEXP_BASE
size_t wxMB2WC(wchar_t *buf
, const char *psz
, size_t n
);
1251 WXDLLIMPEXP_BASE
size_t wxWC2MB(char *buf
, const wchar_t *psz
, size_t n
);
1254 #define wxMB2WX wxMB2WC
1255 #define wxWX2MB wxWC2MB
1256 #define wxWC2WX wxStrncpy
1257 #define wxWX2WC wxStrncpy
1259 #define wxMB2WX wxStrncpy
1260 #define wxWX2MB wxStrncpy
1261 #define wxWC2WX wxWC2MB
1262 #define wxWX2WC wxMB2WC
1264 #else /* !wxUSE_UNICODE */
1265 /* Why is this here?
1267 /* No wxUSE_WCHAR_T: we have to do something (JACS) */
1268 #define wxMB2WC wxStrncpy
1269 #define wxWC2MB wxStrncpy
1270 #define wxMB2WX wxStrncpy
1271 #define wxWX2MB wxStrncpy
1272 #define wxWC2WX wxWC2MB
1273 #define wxWX2WC wxMB2WC
1277 RN: The following are not normal versions of memcpy et al., rather
1278 these are either char or widechar versions depending on
1279 if unicode is used or not.
1285 // RN: We could do the usual tricky compiler detection here,
1286 // and use their variant (such as wmemchr, etc.). The problem
1287 // is that these functions are quite rare, even though they are
1288 // part of the current POSIX standard. In addition, most compilers
1289 // (including even MSC) inline them just like we do right in their
1293 #include <string.h> //for mem funcs
1295 //implement our own wmem variants
1296 inline wxChar
* wxTmemchr(const wxChar
* s
, wxChar c
, size_t l
)
1298 for(;l
&& *s
!= c
;--l
, ++s
) {}
1305 inline int wxTmemcmp(const wxChar
* sz1
, const wxChar
* sz2
, size_t len
)
1307 for(; *sz1
== *sz2
&& len
; --len
, ++sz1
, ++sz2
) {}
1310 return *sz1
< *sz2
? -1 : *sz1
> *sz2
;
1315 inline wxChar
* wxTmemcpy(wxChar
* szOut
, const wxChar
* szIn
, size_t len
)
1317 return (wxChar
*) memcpy(szOut
, szIn
, len
* sizeof(wxChar
));
1320 inline wxChar
* wxTmemmove(wxChar
* szOut
, const wxChar
* szIn
, size_t len
)
1322 return (wxChar
*) memmove(szOut
, szIn
, len
* sizeof(wxChar
));
1325 inline wxChar
* wxTmemset(wxChar
* szOut
, const wxChar cIn
, size_t len
)
1327 wxChar
* szRet
= szOut
;
1335 #else /* !wxUSE_UNICODE */
1336 # define wxTmemchr memchr
1337 # define wxTmemcmp memcmp
1338 # define wxTmemcpy memcpy
1339 # define wxTmemmove memmove
1340 # define wxTmemset memset
1341 #endif /* wxUSE_UNICODE/!wxUSE_UNICODE */
1343 #endif /*__cplusplus*/
1346 #endif /* _WX_WXCHAR_H_ */