1. Rebase on master. 2. Declare `isblank*` etc. as dllimport unconditionally. Do not check for `__MSVCRT_VERSION__` any more. 3. Reorder commits so simple ones come first. 4. Delete duplicates of `_UPPER`, `_LOWER` etc. from ctype.h.
-- Best regards, LIU Hao
From 459cbe6de45d7acb69eb8498359adaf966356aff Mon Sep 17 00:00:00 2001 From: LIU Hao <lh_mo...@126.com> Date: Mon, 24 Feb 2025 23:30:16 +0800 Subject: [PATCH 01/10] crt: Implement `is{,w}blank_l()` for MSVCR{T,80,90,100,110} For consistency with MSVCR120, all these functions are marked as dllimport. Signed-off-by: LIU Hao <lh_mo...@126.com> --- mingw-w64-crt/Makefile.am | 12 +++++++++++- mingw-w64-crt/misc/_isblank_l.c | 8 ++++++++ mingw-w64-crt/misc/_iswblank_l.c | 8 ++++++++ mingw-w64-crt/misc/isblank.c | 1 + mingw-w64-crt/misc/iswblank.c | 1 + 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_isblank_l.c create mode 100644 mingw-w64-crt/misc/_iswblank_l.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 12a1c8cfd..ad30daf53 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -330,6 +330,8 @@ src_msvcrt=\ misc/invalid_parameter_handler.c \ misc/isblank.c \ misc/iswblank.c \ + misc/_isblank_l.c \ + misc/_iswblank_l.c \ misc/wctrans.c \ misc/wctype.c \ secapi/_vscprintf_p.c \ @@ -813,6 +815,10 @@ src_pre_msvcr120=\ misc/wctrans.c \ misc/wctype.c +src_pre_msvcr120_post_msvcr71=\ + misc/_isblank_l.c \ + misc/_iswblank_l.c + src_post_msvcr80=\ misc/__p__osplatform_emul.c \ misc/__p__osver_emul.c @@ -889,19 +895,23 @@ src_msvcr71=\ src_msvcr80=\ $(src_pre_msvcr100) \ - $(src_pre_msvcr120) + $(src_pre_msvcr120) \ + $(src_pre_msvcr120_post_msvcr71) src_msvcr90=\ $(src_pre_msvcr100) \ $(src_pre_msvcr120) \ + $(src_pre_msvcr120_post_msvcr71) \ $(src_post_msvcr80) src_msvcr100=\ $(src_pre_msvcr120) \ + $(src_pre_msvcr120_post_msvcr71) \ $(src_post_msvcr80) src_msvcr110=\ $(src_pre_msvcr120) \ + $(src_pre_msvcr120_post_msvcr71) \ $(src_post_msvcr80) src_msvcr120=\ diff --git a/mingw-w64-crt/misc/_isblank_l.c b/mingw-w64-crt/misc/_isblank_l.c new file mode 100644 index 000000000..91e20447a --- /dev/null +++ b/mingw-w64-crt/misc/_isblank_l.c @@ -0,0 +1,8 @@ +#define __NO_CTYPE_LINES +#include <ctype.h> + +int __cdecl _isblank_l(int _C, _locale_t _Locale) +{ + return (_isctype_l(_C, _BLANK, _Locale) || _C == '\t'); +} +int (__cdecl *__MINGW_IMP_SYMBOL(_isblank_l))(int, _locale_t) = _isblank_l; diff --git a/mingw-w64-crt/misc/_iswblank_l.c b/mingw-w64-crt/misc/_iswblank_l.c new file mode 100644 index 000000000..541613b91 --- /dev/null +++ b/mingw-w64-crt/misc/_iswblank_l.c @@ -0,0 +1,8 @@ +#define _CRT_WCTYPE_NOINLINE +#include <ctype.h> + +int __cdecl _iswblank_l(wint_t _C, _locale_t _Locale) +{ + return (_iswctype_l(_C, _BLANK, _Locale) || _C == '\t'); +} +int (__cdecl *__MINGW_IMP_SYMBOL(_iswblank_l))(wint_t, _locale_t) = _iswblank_l; diff --git a/mingw-w64-crt/misc/isblank.c b/mingw-w64-crt/misc/isblank.c index ce6247c1c..0ef09a110 100644 --- a/mingw-w64-crt/misc/isblank.c +++ b/mingw-w64-crt/misc/isblank.c @@ -5,3 +5,4 @@ int __cdecl isblank (int _C) { return (_isctype(_C, _BLANK) || _C == '\t'); } +int (__cdecl *__MINGW_IMP_SYMBOL(isblank))(int) = isblank; diff --git a/mingw-w64-crt/misc/iswblank.c b/mingw-w64-crt/misc/iswblank.c index bdf73e564..a93b6662d 100644 --- a/mingw-w64-crt/misc/iswblank.c +++ b/mingw-w64-crt/misc/iswblank.c @@ -5,3 +5,4 @@ int __cdecl iswblank (wint_t _C) { return (iswctype(_C, _BLANK) || _C == '\t'); } +int (__cdecl *__MINGW_IMP_SYMBOL(iswblank))(wint_t) = iswblank; -- 2.48.1
From 1e7397ce1a2649d0f178af54d661d4b677efabb3 Mon Sep 17 00:00:00 2001 From: LIU Hao <lh_mo...@126.com> Date: Tue, 25 Feb 2025 00:26:06 +0800 Subject: [PATCH 02/10] crt/{is{,w}blank,_is{,w}blank_l}: Define correct macros, and include correct headers Signed-off-by: LIU Hao <lh_mo...@126.com> --- mingw-w64-crt/misc/_isblank_l.c | 2 +- mingw-w64-crt/misc/_iswblank_l.c | 4 ++-- mingw-w64-crt/misc/isblank.c | 2 +- mingw-w64-crt/misc/iswblank.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mingw-w64-crt/misc/_isblank_l.c b/mingw-w64-crt/misc/_isblank_l.c index 91e20447a..855aafc1b 100644 --- a/mingw-w64-crt/misc/_isblank_l.c +++ b/mingw-w64-crt/misc/_isblank_l.c @@ -1,4 +1,4 @@ -#define __NO_CTYPE_LINES +#define _CTYPE_DISABLE_MACROS #include <ctype.h> int __cdecl _isblank_l(int _C, _locale_t _Locale) diff --git a/mingw-w64-crt/misc/_iswblank_l.c b/mingw-w64-crt/misc/_iswblank_l.c index 541613b91..3abfdfd9c 100644 --- a/mingw-w64-crt/misc/_iswblank_l.c +++ b/mingw-w64-crt/misc/_iswblank_l.c @@ -1,5 +1,5 @@ -#define _CRT_WCTYPE_NOINLINE -#include <ctype.h> +#define _WCTYPE_INLINE_DEFINED +#include <wctype.h> int __cdecl _iswblank_l(wint_t _C, _locale_t _Locale) { diff --git a/mingw-w64-crt/misc/isblank.c b/mingw-w64-crt/misc/isblank.c index 0ef09a110..010805af9 100644 --- a/mingw-w64-crt/misc/isblank.c +++ b/mingw-w64-crt/misc/isblank.c @@ -1,4 +1,4 @@ -#define __NO_CTYPE_LINES +#define _CTYPE_DISABLE_MACROS #include <ctype.h> int __cdecl isblank (int _C) diff --git a/mingw-w64-crt/misc/iswblank.c b/mingw-w64-crt/misc/iswblank.c index a93b6662d..0d05e1c11 100644 --- a/mingw-w64-crt/misc/iswblank.c +++ b/mingw-w64-crt/misc/iswblank.c @@ -1,5 +1,5 @@ -#define _CRT_WCTYPE_NOINLINE -#include <ctype.h> +#define _WCTYPE_INLINE_DEFINED +#include <wctype.h> int __cdecl iswblank (wint_t _C) { -- 2.48.1
From 87971a7dd4904245348b9ab1e5986bb54758b54a Mon Sep 17 00:00:00 2001 From: LIU Hao <lh_mo...@126.com> Date: Mon, 24 Feb 2025 23:52:23 +0800 Subject: [PATCH 03/10] headers/ctype: Declare `isblank`-family functions Previously, these were only declared for C99 or C++. To avoid complication in tchar.h, they are now declared unconditionally. Signed-off-by: LIU Hao <lh_mo...@126.com> --- mingw-w64-headers/crt/ctype.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h index 08fc02b75..fd460168d 100644 --- a/mingw-w64-headers/crt/ctype.h +++ b/mingw-w64-headers/crt/ctype.h @@ -111,10 +111,8 @@ extern "C" { _CRTIMP int __cdecl __toascii(int _C); _CRTIMP int __cdecl __iscsymf(int _C); _CRTIMP int __cdecl __iscsym(int _C); - -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) || defined (__cplusplus) -int __cdecl isblank(int _C); -#endif + _CRTIMP int __cdecl isblank(int _C); + _CRTIMP int __cdecl _isblank_l(int _C,_locale_t _Locale); #endif #ifndef _WCTYPE_DEFINED @@ -140,6 +138,7 @@ int __cdecl isblank(int _C); _CRTIMP int __cdecl iswctype(wint_t _C,wctype_t _Type); _CRTIMP int __cdecl __iswcsymf(wint_t _C); _CRTIMP int __cdecl __iswcsym(wint_t _C); + _CRTIMP int __cdecl iswblank(wint_t _C); #if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) /* These are available since msvcr80.dll (__MSVCRT_VERSION__ >= 0x800), and in * msvcrt.dll (__MSVCRT_VERSION__ == 0x600) since Vista (_WIN32_WINNT >= 0x0600). */ @@ -160,6 +159,7 @@ int __cdecl isblank(int _C); _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); # endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); + _CRTIMP int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale); #endif #if __MSVCRT_VERSION__ >= 0x800 /* These are only available since msvcr80.dll, never in msvcrt.dll. */ @@ -169,10 +169,6 @@ int __cdecl isblank(int _C); #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP _CRTIMP int __cdecl is_wctype(wint_t _C,wctype_t _Type); #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ - -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) || defined (__cplusplus) -int __cdecl iswblank(wint_t _C); -#endif #endif #ifndef _CTYPE_DISABLE_MACROS @@ -204,6 +200,7 @@ _CRTIMP int __cdecl ___mb_cur_max_func(void); #define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale) #define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale) #define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale) +#define _isblank_l(_Char,_Locale) (((_Char) == '\t') || _ischartype_l(_Char,_BLANK,_Locale)) #define _tolower(_Char) ((_Char)-'A'+'a') #define _toupper(_Char) ((_Char)-'a'+'A') #define __isascii(_Char) ((unsigned)(_Char) < 0x80) @@ -226,6 +223,7 @@ _CRTIMP int __cdecl ___mb_cur_max_func(void); #define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) #define iswcntrl(_c) (iswctype(_c,_CONTROL)) #define iswascii(_c) ((unsigned)(_c) < 0x80) +#define iswblank(_c) (((_c) == '\t') || iswctype(_c,_BLANK)) #if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) # define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) # define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) @@ -238,6 +236,7 @@ _CRTIMP int __cdecl ___mb_cur_max_func(void); # define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) # define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) # define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) +# define _iswblank_l(_c,_p) (((_c) == '\t') || _iswctype_l(_c,_BLANK,_p)) #endif /* __MSVCRT_VERSION__ >= 0x800 */ #endif #endif -- 2.48.1
From d8bd8e33f3670e84ecf8d3d2a35d07c6b13800c4 Mon Sep 17 00:00:00 2001 From: LIU Hao <lh_mo...@126.com> Date: Tue, 25 Feb 2025 00:19:44 +0800 Subject: [PATCH 04/10] headers/ctype: Reorder function declarations The changes can be examined with `git show --color-moved`. Signed-off-by: LIU Hao <lh_mo...@126.com> --- mingw-w64-headers/crt/ctype.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h index fd460168d..6a9866742 100644 --- a/mingw-w64-headers/crt/ctype.h +++ b/mingw-w64-headers/crt/ctype.h @@ -77,42 +77,42 @@ extern "C" { #ifndef _CTYPE_DEFINED #define _CTYPE_DEFINED - _CRTIMP int __cdecl _isctype(int _C,int _Type); - _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); _CRTIMP int __cdecl isalpha(int _C); - _CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl isupper(int _C); - _CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl islower(int _C); - _CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl isdigit(int _C); - _CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl isxdigit(int _C); - _CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl isspace(int _C); - _CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl ispunct(int _C); - _CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl isalnum(int _C); - _CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl isprint(int _C); - _CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl isgraph(int _C); - _CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl iscntrl(int _C); - _CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl toupper(int _C); + _CRTIMP int __cdecl _toupper(int _C); _CRTIMP int __cdecl tolower(int _C); _CRTIMP int __cdecl _tolower(int _C); _CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl _toupper(int _C); + _CRTIMP int __cdecl _isctype(int _C,int _Type); + _CRTIMP int __cdecl isblank(int _C); + _CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); + _CRTIMP int __cdecl _isblank_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl __isascii(int _C); _CRTIMP int __cdecl __toascii(int _C); _CRTIMP int __cdecl __iscsymf(int _C); _CRTIMP int __cdecl __iscsym(int _C); - _CRTIMP int __cdecl isblank(int _C); - _CRTIMP int __cdecl _isblank_l(int _C,_locale_t _Locale); #endif #ifndef _WCTYPE_DEFINED -- 2.48.1
From e4a6b9f609eb571349be0afee2c7d6593457010d Mon Sep 17 00:00:00 2001 From: LIU Hao <lh_mo...@126.com> Date: Tue, 25 Feb 2025 00:23:25 +0800 Subject: [PATCH 05/10] headers/ctype: Hide `is*_l()` for MSVCRT on XP This is same with corecrt_wctype.h. Signed-off-by: LIU Hao <lh_mo...@126.com> --- mingw-w64-headers/crt/ctype.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h index 6a9866742..4d82d33ec 100644 --- a/mingw-w64-headers/crt/ctype.h +++ b/mingw-w64-headers/crt/ctype.h @@ -95,6 +95,9 @@ extern "C" { _CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl _isctype(int _C,int _Type); _CRTIMP int __cdecl isblank(int _C); +#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) + /* These are available since msvcr80.dll (__MSVCRT_VERSION__ >= 0x800), and in + * msvcrt.dll (__MSVCRT_VERSION__ == 0x600) since Vista (_WIN32_WINNT >= 0x0600). */ _CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale); @@ -109,6 +112,7 @@ extern "C" { _CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale); _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); _CRTIMP int __cdecl _isblank_l(int _C,_locale_t _Locale); +#endif _CRTIMP int __cdecl __isascii(int _C); _CRTIMP int __cdecl __toascii(int _C); _CRTIMP int __cdecl __iscsymf(int _C); -- 2.48.1
From 326893bb92ea0f3197eed18d98b180eaf432b125 Mon Sep 17 00:00:00 2001 From: LIU Hao <lh_mo...@126.com> Date: Mon, 24 Feb 2025 17:57:41 +0800 Subject: [PATCH 06/10] headers/tchar: Add `_istblank` and `_istblank_l` Signed-off-by: LIU Hao <lh_mo...@126.com> --- mingw-w64-headers/crt/tchar.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mingw-w64-headers/crt/tchar.h b/mingw-w64-headers/crt/tchar.h index aabf37787..356d8ee52 100644 --- a/mingw-w64-headers/crt/tchar.h +++ b/mingw-w64-headers/crt/tchar.h @@ -472,6 +472,8 @@ extern "C" { #define _istupper_l _iswupper_l #define _istxdigit iswxdigit #define _istxdigit_l _iswxdigit_l +#define _istblank iswblank +#define _istblank_l _iswblank_l #define _totupper towupper #define _totupper_l _towupper_l @@ -1000,6 +1002,8 @@ extern "C" { #define _istspace_l _ismbcspace_l #define _istupper _ismbcupper #define _istupper_l _ismbcupper_l +#define _istblank _ismbcblank +#define _istblank_l _ismbcblank_l #define _totupper _mbctoupper #define _totupper_l _mbctoupper_l @@ -1137,6 +1141,8 @@ extern "C" { #define _istspace_l _isspace_l #define _istupper isupper #define _istupper_l _isupper_l +#define _istblank isblank +#define _istblank_l _isblank_l #define _totupper toupper #define _totupper_l _toupper_l -- 2.48.1
From 621d0607a1085d21b61259c69234843929776482 Mon Sep 17 00:00:00 2001 From: LIU Hao <lh_mo...@126.com> Date: Tue, 25 Feb 2025 00:02:18 +0800 Subject: [PATCH 07/10] headers/wctype: Copy two blocks from ctype.h Inline functions are deleted, as in UCRT headers. Signed-off-by: LIU Hao <lh_mo...@126.com> --- mingw-w64-headers/crt/wctype.h | 109 +++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 40 deletions(-) diff --git a/mingw-w64-headers/crt/wctype.h b/mingw-w64-headers/crt/wctype.h index 669b70c28..1d6918ab1 100644 --- a/mingw-w64-headers/crt/wctype.h +++ b/mingw-w64-headers/crt/wctype.h @@ -86,32 +86,63 @@ extern "C" { #ifndef _WCTYPE_DEFINED #define _WCTYPE_DEFINED - int __cdecl iswalpha(wint_t); - int __cdecl iswupper(wint_t); - int __cdecl iswlower(wint_t); - int __cdecl iswdigit(wint_t); - int __cdecl iswxdigit(wint_t); - int __cdecl iswspace(wint_t); - int __cdecl iswpunct(wint_t); - int __cdecl iswalnum(wint_t); - int __cdecl iswprint(wint_t); - int __cdecl iswgraph(wint_t); - int __cdecl iswcntrl(wint_t); - int __cdecl iswascii(wint_t); - int __cdecl isleadbyte(int); - wint_t __cdecl towupper(wint_t); - wint_t __cdecl towlower(wint_t); - int __cdecl iswctype(wint_t,wctype_t); - _CRTIMP int __cdecl __iswcsymf(wint_t); - _CRTIMP int __cdecl __iswcsym(wint_t); - int __cdecl is_wctype(wint_t,wctype_t); -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) || defined (__cplusplus) -int __cdecl iswblank(wint_t _C); -#endif + _CRTIMP int __cdecl iswalpha(wint_t _C); + _CRTIMP int __cdecl iswupper(wint_t _C); + _CRTIMP int __cdecl iswlower(wint_t _C); + _CRTIMP int __cdecl iswdigit(wint_t _C); + _CRTIMP int __cdecl iswxdigit(wint_t _C); + _CRTIMP int __cdecl iswspace(wint_t _C); + _CRTIMP int __cdecl iswpunct(wint_t _C); + _CRTIMP int __cdecl iswalnum(wint_t _C); + _CRTIMP int __cdecl iswprint(wint_t _C); + _CRTIMP int __cdecl iswgraph(wint_t _C); + _CRTIMP int __cdecl iswcntrl(wint_t _C); + _CRTIMP int __cdecl iswascii(wint_t _C); +#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP + _CRTIMP int __cdecl isleadbyte(int _C); +#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ + _CRTIMP wint_t __cdecl towupper(wint_t _C); + _CRTIMP wint_t __cdecl towlower(wint_t _C); + _CRTIMP int __cdecl iswctype(wint_t _C,wctype_t _Type); + _CRTIMP int __cdecl __iswcsymf(wint_t _C); + _CRTIMP int __cdecl __iswcsym(wint_t _C); + _CRTIMP int __cdecl iswblank(wint_t _C); +#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) + /* These are available since msvcr80.dll (__MSVCRT_VERSION__ >= 0x800), and in + * msvcrt.dll (__MSVCRT_VERSION__ == 0x600) since Vista (_WIN32_WINNT >= 0x0600). */ + _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); + _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); + _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); +# ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP + _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); +# endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ + _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); + _CRTIMP int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale); +#endif +#if __MSVCRT_VERSION__ >= 0x800 + /* These are only available since msvcr80.dll, never in msvcrt.dll. */ + _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); +#endif +#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP + _CRTIMP int __cdecl is_wctype(wint_t _C,wctype_t _Type); +#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ #endif #ifndef _WCTYPE_INLINE_DEFINED #define _WCTYPE_INLINE_DEFINED + +#undef _CRT_WCTYPE_NOINLINE #ifndef __cplusplus #define iswalpha(_c) (iswctype(_c,_ALPHA)) #define iswupper(_c) (iswctype(_c,_UPPER)) @@ -125,24 +156,22 @@ int __cdecl iswblank(wint_t _C); #define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) #define iswcntrl(_c) (iswctype(_c,_CONTROL)) #define iswascii(_c) ((unsigned)(_c) < 0x80) -#define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE) -#else -#ifndef __CRT__NO_INLINE - __CRT_INLINE int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); } - __CRT_INLINE int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); } - __CRT_INLINE int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); } - __CRT_INLINE int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); } - __CRT_INLINE int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); } - __CRT_INLINE int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); } - __CRT_INLINE int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); } - __CRT_INLINE int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); } - __CRT_INLINE int __cdecl iswprint(wint_t _C) {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); } - __CRT_INLINE int __cdecl iswgraph(wint_t _C) {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); } - __CRT_INLINE int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); } - __CRT_INLINE int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); } - __CRT_INLINE int __cdecl isleadbyte(int _C) {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); } -#endif /* !__CRT__NO_INLINE */ -#endif /* __cplusplus */ +#define iswblank(_c) (((_c) == '\t') || iswctype(_c,_BLANK)) +#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) +# define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) +# define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) +# define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) +# define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) +# define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) +# define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) +# define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) +# define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) +# define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) +# define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) +# define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) +# define _iswblank_l(_c,_p) (((_c) == '\t') || _iswctype_l(_c,_BLANK,_p)) +#endif /* __MSVCRT_VERSION__ >= 0x800 */ +#endif #endif typedef wchar_t wctrans_t; -- 2.48.1
From 28a3f7b421b54e39e2d3576522617aff50f2f30b Mon Sep 17 00:00:00 2001 From: LIU Hao <lh_mo...@126.com> Date: Tue, 25 Feb 2025 00:06:47 +0800 Subject: [PATCH 08/10] headers/{corecrt_wctype,wctype}: Split wctype.h The changes can be examined with `git show --color-moved`. Signed-off-by: LIU Hao <lh_mo...@126.com> --- mingw-w64-headers/crt/corecrt_wctype.h | 182 +++++++++++++++++++++++++ mingw-w64-headers/crt/wctype.h | 165 +--------------------- 2 files changed, 183 insertions(+), 164 deletions(-) create mode 100644 mingw-w64-headers/crt/corecrt_wctype.h diff --git a/mingw-w64-headers/crt/corecrt_wctype.h b/mingw-w64-headers/crt/corecrt_wctype.h new file mode 100644 index 000000000..86e06b1dd --- /dev/null +++ b/mingw-w64-headers/crt/corecrt_wctype.h @@ -0,0 +1,182 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#ifndef _INC_CORECRT_WCTYPE +#define _INC_CORECRT_WCTYPE + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#include <crtdefs.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#ifndef _WCHAR_T_DEFINED +#define _WCHAR_T_DEFINED +#ifndef __cplusplus + typedef unsigned short wchar_t; +#endif /* C++ */ +#endif /* _WCHAR_T_DEFINED */ + +#ifndef _WCTYPE_T_DEFINED +#define _WCTYPE_T_DEFINED + typedef unsigned short wint_t; + typedef unsigned short wctype_t; +#endif /* _WCTYPE_T_DEFINED */ + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifndef _CRT_CTYPEDATA_DEFINED +#define _CRT_CTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS + +#ifndef __PCTYPE_FUNC +#define __PCTYPE_FUNC __pctype_func() + _CRTIMP const unsigned short* __pctype_func(void); +#endif + +#ifndef _pctype +#define _pctype (__pctype_func()) +#endif + +#endif +#endif + +#ifndef _CRT_WCTYPEDATA_DEFINED +#define _CRT_WCTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS +#if !defined(_wctype) && defined(_CRT_USE_WINAPI_FAMILY_DESKTOP_APP) + extern const unsigned short ** __MINGW_IMP_SYMBOL(_wctype); +#define _wctype (* __MINGW_IMP_SYMBOL(_wctype)) +#endif + + _CRTIMP const wctype_t * __cdecl __pwctype_func(void); +#ifndef _pwctype +#define _pwctype (__pwctype_func()) +#endif +#endif +#endif + +#define _UPPER 0x1 +#define _LOWER 0x2 +#define _DIGIT 0x4 +#define _SPACE 0x8 + +#define _PUNCT 0x10 +#define _CONTROL 0x20 +#define _BLANK 0x40 +#define _HEX 0x80 + +#define _LEADBYTE 0x8000 +#define _ALPHA (0x0100|_UPPER|_LOWER) + +#ifndef _WCTYPE_DEFINED +#define _WCTYPE_DEFINED + + _CRTIMP int __cdecl iswalpha(wint_t _C); + _CRTIMP int __cdecl iswupper(wint_t _C); + _CRTIMP int __cdecl iswlower(wint_t _C); + _CRTIMP int __cdecl iswdigit(wint_t _C); + _CRTIMP int __cdecl iswxdigit(wint_t _C); + _CRTIMP int __cdecl iswspace(wint_t _C); + _CRTIMP int __cdecl iswpunct(wint_t _C); + _CRTIMP int __cdecl iswalnum(wint_t _C); + _CRTIMP int __cdecl iswprint(wint_t _C); + _CRTIMP int __cdecl iswgraph(wint_t _C); + _CRTIMP int __cdecl iswcntrl(wint_t _C); + _CRTIMP int __cdecl iswascii(wint_t _C); +#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP + _CRTIMP int __cdecl isleadbyte(int _C); +#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ + _CRTIMP wint_t __cdecl towupper(wint_t _C); + _CRTIMP wint_t __cdecl towlower(wint_t _C); + _CRTIMP int __cdecl iswctype(wint_t _C,wctype_t _Type); + _CRTIMP int __cdecl __iswcsymf(wint_t _C); + _CRTIMP int __cdecl __iswcsym(wint_t _C); + _CRTIMP int __cdecl iswblank(wint_t _C); +#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) + /* These are available since msvcr80.dll (__MSVCRT_VERSION__ >= 0x800), and in + * msvcrt.dll (__MSVCRT_VERSION__ == 0x600) since Vista (_WIN32_WINNT >= 0x0600). */ + _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); + _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); + _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); +# ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP + _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); +# endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ + _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); + _CRTIMP int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale); +#endif +#if __MSVCRT_VERSION__ >= 0x800 + /* These are only available since msvcr80.dll, never in msvcrt.dll. */ + _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); +#endif +#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP + _CRTIMP int __cdecl is_wctype(wint_t _C,wctype_t _Type); +#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ +#endif + +#ifndef _WCTYPE_INLINE_DEFINED +#define _WCTYPE_INLINE_DEFINED + +#undef _CRT_WCTYPE_NOINLINE +#ifndef __cplusplus +#define iswalpha(_c) (iswctype(_c,_ALPHA)) +#define iswupper(_c) (iswctype(_c,_UPPER)) +#define iswlower(_c) (iswctype(_c,_LOWER)) +#define iswdigit(_c) (iswctype(_c,_DIGIT)) +#define iswxdigit(_c) (iswctype(_c,_HEX)) +#define iswspace(_c) (iswctype(_c,_SPACE)) +#define iswpunct(_c) (iswctype(_c,_PUNCT)) +#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) +#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) +#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) +#define iswcntrl(_c) (iswctype(_c,_CONTROL)) +#define iswascii(_c) ((unsigned)(_c) < 0x80) +#define iswblank(_c) (((_c) == '\t') || iswctype(_c,_BLANK)) +#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) +# define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) +# define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) +# define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) +# define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) +# define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) +# define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) +# define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) +# define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) +# define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) +# define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) +# define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) +# define _iswblank_l(_c,_p) (((_c) == '\t') || _iswctype_l(_c,_BLANK,_p)) +#endif /* __MSVCRT_VERSION__ >= 0x800 */ +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/mingw-w64-headers/crt/wctype.h b/mingw-w64-headers/crt/wctype.h index 1d6918ab1..418d75e9e 100644 --- a/mingw-w64-headers/crt/wctype.h +++ b/mingw-w64-headers/crt/wctype.h @@ -6,172 +6,10 @@ #ifndef _INC_WCTYPE #define _INC_WCTYPE -#ifndef _WIN32 -#error Only Win32 target is supported! -#endif - -#include <crtdefs.h> - -#pragma pack(push,_CRT_PACKING) +#include <corecrt_wctype.h> #ifdef __cplusplus extern "C" { -#endif - -#ifndef _CRTIMP -#define _CRTIMP __declspec(dllimport) -#endif - -#ifndef _WCHAR_T_DEFINED -#define _WCHAR_T_DEFINED -#ifndef __cplusplus - typedef unsigned short wchar_t; -#endif /* C++ */ -#endif /* _WCHAR_T_DEFINED */ - -#ifndef _WCTYPE_T_DEFINED -#define _WCTYPE_T_DEFINED - typedef unsigned short wint_t; - typedef unsigned short wctype_t; -#endif /* _WCTYPE_T_DEFINED */ - -#ifndef WEOF -#define WEOF (wint_t)(0xFFFF) -#endif - -#ifndef _CRT_CTYPEDATA_DEFINED -#define _CRT_CTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS - -#ifndef __PCTYPE_FUNC -#define __PCTYPE_FUNC __pctype_func() - _CRTIMP const unsigned short* __pctype_func(void); -#endif - -#ifndef _pctype -#define _pctype (__pctype_func()) -#endif - -#endif -#endif - -#ifndef _CRT_WCTYPEDATA_DEFINED -#define _CRT_WCTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS -#if !defined(_wctype) && defined(_CRT_USE_WINAPI_FAMILY_DESKTOP_APP) - extern const unsigned short ** __MINGW_IMP_SYMBOL(_wctype); -#define _wctype (* __MINGW_IMP_SYMBOL(_wctype)) -#endif - - _CRTIMP const wctype_t * __cdecl __pwctype_func(void); -#ifndef _pwctype -#define _pwctype (__pwctype_func()) -#endif -#endif -#endif - -#define _UPPER 0x1 -#define _LOWER 0x2 -#define _DIGIT 0x4 -#define _SPACE 0x8 - -#define _PUNCT 0x10 -#define _CONTROL 0x20 -#define _BLANK 0x40 -#define _HEX 0x80 - -#define _LEADBYTE 0x8000 -#define _ALPHA (0x0100|_UPPER|_LOWER) - -#ifndef _WCTYPE_DEFINED -#define _WCTYPE_DEFINED - - _CRTIMP int __cdecl iswalpha(wint_t _C); - _CRTIMP int __cdecl iswupper(wint_t _C); - _CRTIMP int __cdecl iswlower(wint_t _C); - _CRTIMP int __cdecl iswdigit(wint_t _C); - _CRTIMP int __cdecl iswxdigit(wint_t _C); - _CRTIMP int __cdecl iswspace(wint_t _C); - _CRTIMP int __cdecl iswpunct(wint_t _C); - _CRTIMP int __cdecl iswalnum(wint_t _C); - _CRTIMP int __cdecl iswprint(wint_t _C); - _CRTIMP int __cdecl iswgraph(wint_t _C); - _CRTIMP int __cdecl iswcntrl(wint_t _C); - _CRTIMP int __cdecl iswascii(wint_t _C); -#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP - _CRTIMP int __cdecl isleadbyte(int _C); -#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ - _CRTIMP wint_t __cdecl towupper(wint_t _C); - _CRTIMP wint_t __cdecl towlower(wint_t _C); - _CRTIMP int __cdecl iswctype(wint_t _C,wctype_t _Type); - _CRTIMP int __cdecl __iswcsymf(wint_t _C); - _CRTIMP int __cdecl __iswcsym(wint_t _C); - _CRTIMP int __cdecl iswblank(wint_t _C); -#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) - /* These are available since msvcr80.dll (__MSVCRT_VERSION__ >= 0x800), and in - * msvcrt.dll (__MSVCRT_VERSION__ == 0x600) since Vista (_WIN32_WINNT >= 0x0600). */ - _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); - _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); - _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); -# ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP - _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); -# endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ - _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); - _CRTIMP int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale); -#endif -#if __MSVCRT_VERSION__ >= 0x800 - /* These are only available since msvcr80.dll, never in msvcrt.dll. */ - _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); -#endif -#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP - _CRTIMP int __cdecl is_wctype(wint_t _C,wctype_t _Type); -#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ -#endif - -#ifndef _WCTYPE_INLINE_DEFINED -#define _WCTYPE_INLINE_DEFINED - -#undef _CRT_WCTYPE_NOINLINE -#ifndef __cplusplus -#define iswalpha(_c) (iswctype(_c,_ALPHA)) -#define iswupper(_c) (iswctype(_c,_UPPER)) -#define iswlower(_c) (iswctype(_c,_LOWER)) -#define iswdigit(_c) (iswctype(_c,_DIGIT)) -#define iswxdigit(_c) (iswctype(_c,_HEX)) -#define iswspace(_c) (iswctype(_c,_SPACE)) -#define iswpunct(_c) (iswctype(_c,_PUNCT)) -#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) -#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) -#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) -#define iswcntrl(_c) (iswctype(_c,_CONTROL)) -#define iswascii(_c) ((unsigned)(_c) < 0x80) -#define iswblank(_c) (((_c) == '\t') || iswctype(_c,_BLANK)) -#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) -# define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) -# define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) -# define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) -# define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) -# define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) -# define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) -# define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) -# define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) -# define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) -# define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) -# define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) -# define _iswblank_l(_c,_p) (((_c) == '\t') || _iswctype_l(_c,_BLANK,_p)) -#endif /* __MSVCRT_VERSION__ >= 0x800 */ -#endif #endif typedef wchar_t wctrans_t; @@ -183,5 +21,4 @@ extern "C" { } #endif -#pragma pack(pop) #endif -- 2.48.1
From 33ccb09de9511a0dd23c1578c91ecdf0bd25d79b Mon Sep 17 00:00:00 2001 From: LIU Hao <lh_mo...@126.com> Date: Tue, 25 Feb 2025 00:09:12 +0800 Subject: [PATCH 09/10] headers/ctype: Include corecrt_wctype.h and deduplicate code Signed-off-by: LIU Hao <lh_mo...@126.com> --- mingw-w64-headers/crt/ctype.h | 136 +--------------------------------- 1 file changed, 1 insertion(+), 135 deletions(-) diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h index 4d82d33ec..98557fd6d 100644 --- a/mingw-w64-headers/crt/ctype.h +++ b/mingw-w64-headers/crt/ctype.h @@ -7,6 +7,7 @@ #define _INC_CTYPE #include <crtdefs.h> +#include <corecrt_wctype.h> #ifdef __cplusplus extern "C" { @@ -14,37 +15,6 @@ extern "C" { #ifndef WEOF #define WEOF (wint_t)(0xFFFF) -#endif - -#ifndef _CRT_CTYPEDATA_DEFINED -#define _CRT_CTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS - -#ifndef __PCTYPE_FUNC -#define __PCTYPE_FUNC __pctype_func() - _CRTIMP const unsigned short* __pctype_func(void); -#endif - -#ifndef _pctype -#define _pctype (__pctype_func()) -#endif - -#endif -#endif - -#ifndef _CRT_WCTYPEDATA_DEFINED -#define _CRT_WCTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS -#if !defined(_wctype) && defined(_CRT_USE_WINAPI_FAMILY_DESKTOP_APP) - extern const unsigned short ** __MINGW_IMP_SYMBOL(_wctype); -#define _wctype (* __MINGW_IMP_SYMBOL(_wctype)) -#endif - - _CRTIMP const wctype_t * __cdecl __pwctype_func(void); -#ifndef _pwctype -#define _pwctype (__pwctype_func()) -#endif -#endif #endif /* CRT stuff */ @@ -61,19 +31,6 @@ extern "C" { pthreadmbcinfo __cdecl __updatetmbcinfo(void); #endif -#define _UPPER 0x1 -#define _LOWER 0x2 -#define _DIGIT 0x4 -#define _SPACE 0x8 - -#define _PUNCT 0x10 -#define _CONTROL 0x20 -#define _BLANK 0x40 -#define _HEX 0x80 - -#define _LEADBYTE 0x8000 -#define _ALPHA (0x0100|_UPPER|_LOWER) - #ifndef _CTYPE_DEFINED #define _CTYPE_DEFINED @@ -119,62 +76,6 @@ extern "C" { _CRTIMP int __cdecl __iscsym(int _C); #endif -#ifndef _WCTYPE_DEFINED -#define _WCTYPE_DEFINED - - _CRTIMP int __cdecl iswalpha(wint_t _C); - _CRTIMP int __cdecl iswupper(wint_t _C); - _CRTIMP int __cdecl iswlower(wint_t _C); - _CRTIMP int __cdecl iswdigit(wint_t _C); - _CRTIMP int __cdecl iswxdigit(wint_t _C); - _CRTIMP int __cdecl iswspace(wint_t _C); - _CRTIMP int __cdecl iswpunct(wint_t _C); - _CRTIMP int __cdecl iswalnum(wint_t _C); - _CRTIMP int __cdecl iswprint(wint_t _C); - _CRTIMP int __cdecl iswgraph(wint_t _C); - _CRTIMP int __cdecl iswcntrl(wint_t _C); - _CRTIMP int __cdecl iswascii(wint_t _C); -#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP - _CRTIMP int __cdecl isleadbyte(int _C); -#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ - _CRTIMP wint_t __cdecl towupper(wint_t _C); - _CRTIMP wint_t __cdecl towlower(wint_t _C); - _CRTIMP int __cdecl iswctype(wint_t _C,wctype_t _Type); - _CRTIMP int __cdecl __iswcsymf(wint_t _C); - _CRTIMP int __cdecl __iswcsym(wint_t _C); - _CRTIMP int __cdecl iswblank(wint_t _C); -#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) - /* These are available since msvcr80.dll (__MSVCRT_VERSION__ >= 0x800), and in - * msvcrt.dll (__MSVCRT_VERSION__ == 0x600) since Vista (_WIN32_WINNT >= 0x0600). */ - _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); - _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); - _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); -# ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP - _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); -# endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ - _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); - _CRTIMP int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale); -#endif -#if __MSVCRT_VERSION__ >= 0x800 - /* These are only available since msvcr80.dll, never in msvcrt.dll. */ - _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); -#endif -#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP - _CRTIMP int __cdecl is_wctype(wint_t _C,wctype_t _Type); -#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ -#endif - #ifndef _CTYPE_DISABLE_MACROS #ifndef MB_CUR_MAX @@ -210,41 +111,6 @@ _CRTIMP int __cdecl ___mb_cur_max_func(void); #define __isascii(_Char) ((unsigned)(_Char) < 0x80) #define __toascii(_Char) ((_Char) & 0x7f) -#ifndef _WCTYPE_INLINE_DEFINED -#define _WCTYPE_INLINE_DEFINED - -#undef _CRT_WCTYPE_NOINLINE -#ifndef __cplusplus -#define iswalpha(_c) (iswctype(_c,_ALPHA)) -#define iswupper(_c) (iswctype(_c,_UPPER)) -#define iswlower(_c) (iswctype(_c,_LOWER)) -#define iswdigit(_c) (iswctype(_c,_DIGIT)) -#define iswxdigit(_c) (iswctype(_c,_HEX)) -#define iswspace(_c) (iswctype(_c,_SPACE)) -#define iswpunct(_c) (iswctype(_c,_PUNCT)) -#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) -#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) -#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) -#define iswcntrl(_c) (iswctype(_c,_CONTROL)) -#define iswascii(_c) ((unsigned)(_c) < 0x80) -#define iswblank(_c) (((_c) == '\t') || iswctype(_c,_BLANK)) -#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) -# define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) -# define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) -# define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) -# define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) -# define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) -# define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) -# define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) -# define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) -# define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) -# define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) -# define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) -# define _iswblank_l(_c,_p) (((_c) == '\t') || _iswctype_l(_c,_BLANK,_p)) -#endif /* __MSVCRT_VERSION__ >= 0x800 */ -#endif -#endif - #define __iscsymf(_c) (isalpha(_c) || ((_c)=='_')) #define __iscsym(_c) (isalnum(_c) || ((_c)=='_')) #define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_')) -- 2.48.1
From fe03cc586586e48c57af38a8eb72bc21a3485376 Mon Sep 17 00:00:00 2001 From: LIU Hao <lh_mo...@126.com> Date: Tue, 25 Feb 2025 00:13:30 +0800 Subject: [PATCH 10/10] headers/wchar: Include corecrt_wctype.h and deduplicate code Signed-off-by: LIU Hao <lh_mo...@126.com> --- mingw-w64-headers/crt/wchar.h | 139 +--------------------------------- 1 file changed, 1 insertion(+), 138 deletions(-) diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h index 7cc047fe6..a5821e4bd 100644 --- a/mingw-w64-headers/crt/wchar.h +++ b/mingw-w64-headers/crt/wchar.h @@ -9,6 +9,7 @@ #include <corecrt.h> #include <corecrt_stdio_config.h> #include <corecrt_wstdlib.h> +#include <corecrt_wctype.h> #if __USE_MINGW_ANSI_STDIO && !defined (__USE_MINGW_STRTOX) && !defined(_CRTBLD) #define __USE_MINGW_STRTOX 1 @@ -148,109 +149,6 @@ _CRTIMP FILE *__cdecl __acrt_iob_func(unsigned index); #define _WConst_return _CONST_RETURN -#ifndef _CRT_CTYPEDATA_DEFINED -#define _CRT_CTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS - -#ifndef __PCTYPE_FUNC -#define __PCTYPE_FUNC __pctype_func() - _CRTIMP const unsigned short* __pctype_func(void); -#endif - -#ifndef _pctype -#define _pctype (__pctype_func()) -#endif -#endif -#endif - -#ifndef _CRT_WCTYPEDATA_DEFINED -#define _CRT_WCTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS -#if !defined(_wctype) && defined(_CRT_USE_WINAPI_FAMILY_DESKTOP_APP) - extern const unsigned short ** __MINGW_IMP_SYMBOL(_wctype); -#define _wctype (* __MINGW_IMP_SYMBOL(_wctype)) -#endif - - _CRTIMP const wctype_t * __cdecl __pwctype_func(void); -#ifndef _pwctype -#define _pwctype (__pwctype_func()) -#endif - -#endif -#endif - -#define _UPPER 0x1 -#define _LOWER 0x2 -#define _DIGIT 0x4 -#define _SPACE 0x8 - -#define _PUNCT 0x10 -#define _CONTROL 0x20 -#define _BLANK 0x40 -#define _HEX 0x80 - -#define _LEADBYTE 0x8000 -#define _ALPHA (0x0100|_UPPER|_LOWER) - -#ifndef _WCTYPE_DEFINED -#define _WCTYPE_DEFINED - - int __cdecl iswalpha(wint_t _C); - int __cdecl iswupper(wint_t _C); - int __cdecl iswlower(wint_t _C); - int __cdecl iswdigit(wint_t _C); - int __cdecl iswxdigit(wint_t _C); - int __cdecl iswspace(wint_t _C); - int __cdecl iswpunct(wint_t _C); - int __cdecl iswalnum(wint_t _C); - int __cdecl iswprint(wint_t _C); - int __cdecl iswgraph(wint_t _C); - int __cdecl iswcntrl(wint_t _C); - int __cdecl iswascii(wint_t _C); -#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP - int __cdecl isleadbyte(int _C); -#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ - wint_t __cdecl towupper(wint_t _C); - wint_t __cdecl towlower(wint_t _C); - int __cdecl iswctype(wint_t _C,wctype_t _Type); - _CRTIMP int __cdecl __iswcsymf(wint_t _C); - _CRTIMP int __cdecl __iswcsym(wint_t _C); -#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) - /* These are available since msvcr80.dll (__MSVCRT_VERSION__ >= 0x800), and in - * msvcrt.dll (__MSVCRT_VERSION__ == 0x600) since Vista (_WIN32_WINNT >= 0x0600). */ - _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); -# ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP - _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); -# endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ - _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); - _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); -#endif -#if __MSVCRT_VERSION__ >= 0x800 - /* These are only available since msvcr80.dll, never in msvcrt.dll. */ - _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); -#endif -#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP - int __cdecl is_wctype(wint_t _C,wctype_t _Type); -#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ - -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) || defined (__cplusplus) - int __cdecl iswblank(wint_t _C); -#endif - -#endif - #ifndef _WDIRECT_DEFINED #define _WDIRECT_DEFINED @@ -335,41 +233,6 @@ _CRTIMP FILE *__cdecl __acrt_iob_func(unsigned index); #endif #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ -#ifndef _WCTYPE_INLINE_DEFINED -#undef _CRT_WCTYPE_NOINLINE -#if !defined(__cplusplus) || defined(_CRT_WCTYPE_NOINLINE) -#define iswalpha(_c) (iswctype(_c,_ALPHA)) -#define iswupper(_c) (iswctype(_c,_UPPER)) -#define iswlower(_c) (iswctype(_c,_LOWER)) -#define iswdigit(_c) (iswctype(_c,_DIGIT)) -#define iswxdigit(_c) (iswctype(_c,_HEX)) -#define iswspace(_c) (iswctype(_c,_SPACE)) -#define iswpunct(_c) (iswctype(_c,_PUNCT)) -#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) -#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) -#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) -#define iswcntrl(_c) (iswctype(_c,_CONTROL)) -#define iswascii(_c) ((unsigned)(_c) < 0x80) -#if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600) -# define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) -# define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) -# define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) -# define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) -# define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) -# define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) -# define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) -# define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) -# define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) -# define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) -# define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) -#endif /* __MSVCRT_VERSION__ >= 0x800 */ -#if !defined(_CTYPE_DISABLE_MACROS) && defined(_CRT_USE_WINAPI_FAMILY_DESKTOP_APP) -#define isleadbyte(_c) (__PCTYPE_FUNC[(unsigned char)(_c)] & _LEADBYTE) -#endif -#endif -#define _WCTYPE_INLINE_DEFINED -#endif - #if !defined(_POSIX_) || defined(__GNUC__) #ifndef _INO_T_DEFINED #define _INO_T_DEFINED -- 2.48.1
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public