The MinGW.org Windows System Libraries
修訂 | a17223919ced1cd813381644d6b84e214c9a95a8 (tree) |
---|---|
時間 | 2020-03-11 00:25:38 |
作者 | Keith Marshall <keith@user...> |
Commiter | Keith Marshall |
Base MBCS converter function call redirection on _ISOC99_SOURCE.
@@ -1,3 +1,14 @@ | ||
1 | +2020-03-10 Keith Marshall <keith@users.osdn.me> | |
2 | + | |
3 | + Base MBCS converter function call redirection on _ISOC99_SOURCE. | |
4 | + | |
5 | + * include/wchar.h (__mingw_redirect): New temporary macro; use it... | |
6 | + (btowc, mbrlen, mbrtowc, mbsrtowcs, wctob, wcrtomb, wcsrtombs): ...in | |
7 | + each of these inline function definitions, to select between use of... | |
8 | + [defined _ISOC99_SOURCE]: ...direct call to MinGW function, or... | |
9 | + [! defined _ISOC99_SOURCE]: ...attempt to call MSVCRT.DLL function, | |
10 | + with fall back to MinGW, when no MSVCRT.DLL function available. | |
11 | + | |
1 | 12 | 2020-03-05 Keith Marshall <keith@users.osdn.me> |
2 | 13 | |
3 | 14 | Prepare and publish MinGW.org WSL-5.3 release. |
@@ -603,40 +603,58 @@ __cdecl __MINGW_NOTHROW size_t __mingw_wcsrtombs | ||
603 | 603 | (char *__restrict__, const wchar_t **__restrict__, size_t, mbstate_t *__restrict__); |
604 | 604 | |
605 | 605 | #if __MSVCRT_VERSION__ < __MSVCR80_DLL |
606 | -/* FIXME: Maybe consider these mappings, even for linking with the | |
607 | - * non-free MSVCR80.DLL, and its descendants. | |
608 | - * | |
609 | - * For linking with all versions of MSVCRT.DLL, and with non-free | |
606 | +/* For linking with all versions of MSVCRT.DLL, and with non-free | |
610 | 607 | * alternatives predating MSVCR80.DLL, we enforce inline mapping to |
611 | 608 | * the libmingwex.a implementations, (which will delegate the calls |
612 | - * to the Microsoft DLL implementations, when they are available). | |
609 | + * to the Microsoft DLL implementations, when they are available, | |
610 | + * but substitute the MinGW replacements as required). | |
611 | + */ | |
612 | +#undef __mingw_redirect | |
613 | +#if _ISOC99_SOURCE & 0x08 | |
614 | +/* The user has explicitly requested ISO-C99 compatibility; ensure | |
615 | + * that calls to the following functions are serviced by the MinGW | |
616 | + * implementations, regardless of availability of any alternative | |
617 | + * MSVCRT.DLL implementation. | |
618 | + */ | |
619 | +# define __mingw_redirect(NAME) __mingw_##NAME | |
620 | +#else | |
621 | +/* No explicit ISO-C99 compatibility has been requested; map calls | |
622 | + * to these functions to delegate to any MSVCRT.DLL implementations | |
623 | + * which may be available, or to fall back to the MinGW replacement | |
624 | + * implementations, when necessary. | |
625 | + */ | |
626 | +# define __mingw_redirect(NAME) __msvcrt_##NAME | |
627 | +#endif | |
628 | +/* FIXME: Maybe consider these mappings, even for linking with the | |
629 | + * non-free MSVCR80.DLL, and its descendants. | |
613 | 630 | */ |
614 | 631 | __CRT_ALIAS __cdecl __MINGW_NOTHROW wint_t btowc (int __c) |
615 | -{ return __msvcrt_btowc( __c ); } | |
632 | +{ return __mingw_redirect(btowc( __c )); } | |
616 | 633 | |
617 | 634 | __CRT_ALIAS __cdecl __MINGW_NOTHROW size_t mbrlen |
618 | 635 | (const char *__mbc, size_t __n, mbstate_t *__ps) |
619 | -{ return __msvcrt_mbrlen( __mbc, __n, __ps ); } | |
636 | +{ return __mingw_redirect(mbrlen( __mbc, __n, __ps )); } | |
620 | 637 | |
621 | 638 | __CRT_ALIAS __cdecl __MINGW_NOTHROW size_t mbrtowc |
622 | 639 | (wchar_t *__wc, const char *__mbc, size_t __n, mbstate_t *__ps) |
623 | -{ return __msvcrt_mbrtowc( __wc, __mbc, __n, __ps ); } | |
640 | +{ return __mingw_redirect(mbrtowc( __wc, __mbc, __n, __ps )); } | |
624 | 641 | |
625 | 642 | __CRT_ALIAS __cdecl __MINGW_NOTHROW size_t mbsrtowcs |
626 | 643 | (wchar_t *__wcs, const char **__mbs, size_t __n, mbstate_t *__ps) |
627 | -{ return __msvcrt_mbsrtowcs( __wcs, __mbs, __n, __ps ); } | |
644 | +{ return __mingw_redirect(mbsrtowcs( __wcs, __mbs, __n, __ps )); } | |
628 | 645 | |
629 | 646 | __CRT_ALIAS __cdecl __MINGW_NOTHROW int wctob (wint_t __wc) |
630 | -{ return __msvcrt_wctob( __wc ); } | |
647 | +{ return __mingw_redirect(wctob( __wc )); } | |
631 | 648 | |
632 | 649 | __CRT_ALIAS __cdecl __MINGW_NOTHROW size_t wcrtomb |
633 | 650 | (char * __mbc, wchar_t __wc, mbstate_t *__ps) |
634 | -{ return __msvcrt_wcrtomb(__mbc, __wc, __ps); } | |
651 | +{ return __mingw_redirect(wcrtomb(__mbc, __wc, __ps)); } | |
635 | 652 | |
636 | 653 | __CRT_ALIAS __cdecl __MINGW_NOTHROW size_t wcsrtombs |
637 | 654 | (char *__mbs, const wchar_t **__wcs, size_t __len, mbstate_t *__ps) |
638 | -{ return __msvcrt_wcsrtombs(__mbs, __wcs, __len, __ps); } | |
655 | +{ return __mingw_redirect(wcsrtombs(__mbs, __wcs, __len, __ps)); } | |
639 | 656 | |
657 | +#undef __mingw_redirect | |
640 | 658 | #endif /* ! MSVCR80.DLL or later */ |
641 | 659 | |
642 | 660 | #if defined _ISOC99_SOURCE || defined __cplusplus |