1. Create the new header corecrt_wctype.h and move common parts into it.
2. Implement `_isblank_l()` and `_iswblank_l()` for MSVCR80-120 and MSVCRT.
3. Test for TAB before calling `_is_ctype()` to avoid an unnecessary call.


--
Best regards,
LIU Hao

From cbe56c34c0f492e2d5df748e2744dbdf86fb31dc Mon Sep 17 00:00:00 2001
From: LIU Hao <lh_mo...@126.com>
Date: Mon, 24 Feb 2025 23:11:38 +0800
Subject: [PATCH 01/11] headers/ctype: Declare `__iswcsym()` and `__iswcsymf()`
 only for MSVCR80+

They are never exported from MSVCRT.

Signed-off-by: LIU Hao <lh_mo...@126.com>
---
 mingw-w64-headers/crt/ctype.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h
index 922dab67a..555bb3be5 100644
--- a/mingw-w64-headers/crt/ctype.h
+++ b/mingw-w64-headers/crt/ctype.h
@@ -158,11 +158,11 @@ 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 __iswcsymf(wint_t _C);
-  _CRTIMP int __cdecl __iswcsym(wint_t _C);
 #endif
 #if __MSVCRT_VERSION__ >= 0x800
   /* These are only available since msvcr80.dll, never in msvcrt.dll. */
+  _CRTIMP int __cdecl __iswcsymf(wint_t _C);
+  _CRTIMP int __cdecl __iswcsym(wint_t _C);
   _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale);
   _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale);
 #endif
-- 
2.48.1

From 821ebb62c06edd087c010214f8acdc4538c2b705 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 02/11] crt: Implement `is{,w}blank_l()` for
 MSVCR{T,80,90,100,110}

Signed-off-by: LIU Hao <lh_mo...@126.com>
---
 mingw-w64-crt/Makefile.am        | 12 +++++++++++-
 mingw-w64-crt/misc/_isblank_l.c  |  7 +++++++
 mingw-w64-crt/misc/_iswblank_l.c |  7 +++++++
 3 files changed, 25 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 98bd5a164..f5e3bddb4 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -328,6 +328,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 \
@@ -809,6 +811,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
@@ -885,19 +891,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..0df924c4b
--- /dev/null
+++ b/mingw-w64-crt/misc/_isblank_l.c
@@ -0,0 +1,7 @@
+#define __NO_CTYPE_LINES
+#include <ctype.h>
+
+int __cdecl _isblank_l(int _C, _locale_t _Locale)
+{
+  return (_isctype_l(_C, _BLANK, _Locale) || _C == '\t');
+}
diff --git a/mingw-w64-crt/misc/_iswblank_l.c b/mingw-w64-crt/misc/_iswblank_l.c
new file mode 100644
index 000000000..bd185cdf0
--- /dev/null
+++ b/mingw-w64-crt/misc/_iswblank_l.c
@@ -0,0 +1,7 @@
+#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');
+}
-- 
2.48.1

From ec9c1c4b2ada9e9bf887fc786114393b1c846c3d 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/11] headers/ctype: Declare `isblank`-family functions

These functions are exported from MSVCR120+ and UCRT DLLs.

Otherwise, we have custom implementations of `isblank()` and `iswblank()` for 
all
MSVCR* DLLs. In addition, `_isblank_l()` may be implemented if `_isctype_l()` is
available, and `_iswblank_l()` may be implemented if `_iswctype_l()` is 
available;
both require MSVCR80 or a recent MSVCRT.

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 | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h
index 555bb3be5..94fbbd851 100644
--- a/mingw-w64-headers/crt/ctype.h
+++ b/mingw-w64-headers/crt/ctype.h
@@ -111,10 +111,15 @@ 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
+#if __MSVCRT_VERSION__ >= 0xC00
+  _CRTIMP int __cdecl isblank(int _C);
+  _CRTIMP int __cdecl _isblank_l(int _C,_locale_t _Locale);
+#else
+  int __cdecl isblank(int _C);
+# if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && 
_WIN32_WINNT >= 0x0600)
+  int __cdecl _isblank_l(int _C,_locale_t _Locale);
+# endif
+#endif  /* msvcr120 */
 #endif
 
 #ifndef _WCTYPE_DEFINED
@@ -169,10 +174,15 @@ 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
+#if __MSVCRT_VERSION__ >= 0xC00
+  _CRTIMP int __cdecl iswblank(wint_t _C);
+  _CRTIMP int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale);
+#else
+  int __cdecl iswblank(wint_t _C);
+# if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && 
_WIN32_WINNT >= 0x0600)
+  int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale);
+# endif
+#endif  /* msvcr120 */
 #endif
 
 #ifndef _CTYPE_DISABLE_MACROS
@@ -204,6 +214,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 +237,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 +250,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 e9c4ef97499d5d0ca6d5797428154104b7c5add9 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 04/11] 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 | 116 +++++++++++++++++++++------------
 1 file changed, 75 insertions(+), 41 deletions(-)

diff --git a/mingw-w64-headers/crt/wctype.h b/mingw-w64-headers/crt/wctype.h
index b45ba26c9..3505e4cd7 100644
--- a/mingw-w64-headers/crt/wctype.h
+++ b/mingw-w64-headers/crt/wctype.h
@@ -86,34 +86,70 @@ 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);
-#if __MSVCRT_VERSION__ >= 0x800
-  _CRTIMP int __cdecl __iswcsymf(wint_t);
-  _CRTIMP int __cdecl __iswcsym(wint_t);
-#endif
-  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);
+  _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);
+#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);
 #endif
+#if __MSVCRT_VERSION__ >= 0x800
+  /* These are only available since msvcr80.dll, never in msvcrt.dll. */
+  _CRTIMP int __cdecl __iswcsymf(wint_t _C);
+  _CRTIMP int __cdecl __iswcsym(wint_t _C);
+  _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 */
+#if __MSVCRT_VERSION__ >= 0xC00
+  _CRTIMP int __cdecl iswblank(wint_t _C);
+  _CRTIMP int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale);
+#else
+  int __cdecl iswblank(wint_t _C);
+# if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && 
_WIN32_WINNT >= 0x0600)
+  int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale);
+# endif
+#endif  /* msvcr120 */
 #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))
@@ -127,24 +163,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 2a495fb4b4a5be34f767baafd219dfa5ed696b44 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 05/11] headers/{corecrt_wctype,wctype}: Split wctype.h

Signed-off-by: LIU Hao <lh_mo...@126.com>
---
 mingw-w64-headers/crt/corecrt_wctype.h | 189 +++++++++++++++++++++++++
 mingw-w64-headers/crt/wctype.h         | 172 +---------------------
 2 files changed, 190 insertions(+), 171 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..31f56f4f3
--- /dev/null
+++ b/mingw-w64-headers/crt/corecrt_wctype.h
@@ -0,0 +1,189 @@
+/**
+ * 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);
+#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);
+#endif
+#if __MSVCRT_VERSION__ >= 0x800
+  /* These are only available since msvcr80.dll, never in msvcrt.dll. */
+  _CRTIMP int __cdecl __iswcsymf(wint_t _C);
+  _CRTIMP int __cdecl __iswcsym(wint_t _C);
+  _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 */
+#if __MSVCRT_VERSION__ >= 0xC00
+  _CRTIMP int __cdecl iswblank(wint_t _C);
+  _CRTIMP int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale);
+#else
+  int __cdecl iswblank(wint_t _C);
+# if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && 
_WIN32_WINNT >= 0x0600)
+  int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale);
+# endif
+#endif  /* msvcr120 */
+#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 3505e4cd7..418d75e9e 100644
--- a/mingw-w64-headers/crt/wctype.h
+++ b/mingw-w64-headers/crt/wctype.h
@@ -6,179 +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);
-#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);
-#endif
-#if __MSVCRT_VERSION__ >= 0x800
-  /* These are only available since msvcr80.dll, never in msvcrt.dll. */
-  _CRTIMP int __cdecl __iswcsymf(wint_t _C);
-  _CRTIMP int __cdecl __iswcsym(wint_t _C);
-  _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 */
-#if __MSVCRT_VERSION__ >= 0xC00
-  _CRTIMP int __cdecl iswblank(wint_t _C);
-  _CRTIMP int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale);
-#else
-  int __cdecl iswblank(wint_t _C);
-# if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && 
_WIN32_WINNT >= 0x0600)
-  int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale);
-# endif
-#endif  /* msvcr120 */
-#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;
@@ -190,5 +21,4 @@ extern "C" {
 }
 #endif
 
-#pragma pack(pop)
 #endif
-- 
2.48.1

From ced65dc081f987df6c7541a8e3f196d5f64aa78c 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 06/11] headers/ctype: Include corecrt_wctype.h and deduplicate
 code

Signed-off-by: LIU Hao <lh_mo...@126.com>
---
 mingw-w64-headers/crt/ctype.h | 130 +---------------------------------
 1 file changed, 1 insertion(+), 129 deletions(-)

diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h
index 94fbbd851..8a2a712b2 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 */
@@ -122,69 +92,6 @@ extern "C" {
 #endif  /* msvcr120 */
 #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);
-#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);
-#endif
-#if __MSVCRT_VERSION__ >= 0x800
-  /* These are only available since msvcr80.dll, never in msvcrt.dll. */
-  _CRTIMP int __cdecl __iswcsymf(wint_t _C);
-  _CRTIMP int __cdecl __iswcsym(wint_t _C);
-  _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 */
-#if __MSVCRT_VERSION__ >= 0xC00
-  _CRTIMP int __cdecl iswblank(wint_t _C);
-  _CRTIMP int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale);
-#else
-  int __cdecl iswblank(wint_t _C);
-# if __MSVCRT_VERSION__ >= 0x800 || (__MSVCRT_VERSION__ == 0x600 && 
_WIN32_WINNT >= 0x0600)
-  int __cdecl _iswblank_l(wint_t _C,_locale_t _Locale);
-# endif
-#endif  /* msvcr120 */
-#endif
-
 #ifndef _CTYPE_DISABLE_MACROS
 
 #ifndef MB_CUR_MAX
@@ -220,41 +127,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 43197332b5db6e2d2035ce27dfb96cbc907d3f99 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 07/11] 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 ca2c1fc70..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);
-#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);
-  _CRTIMP int __cdecl __iswcsymf(wint_t _C);
-  _CRTIMP int __cdecl __iswcsym(wint_t _C);
-#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

From 54324c3dd31660e2032e978ee4dcc02ec74075a2 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 08/11] 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 | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h
index 8a2a712b2..4aaf30b03 100644
--- a/mingw-w64-headers/crt/ctype.h
+++ b/mingw-w64-headers/crt/ctype.h
@@ -47,36 +47,36 @@ 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 _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 __isascii(int _C);
   _CRTIMP int __cdecl __toascii(int _C);
   _CRTIMP int __cdecl __iscsymf(int _C);
-- 
2.48.1

From fbe37fb61d4ace6bf7e3e6ebc280d7ff27179620 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 09/11] 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 4aaf30b03..44d09b364 100644
--- a/mingw-w64-headers/crt/ctype.h
+++ b/mingw-w64-headers/crt/ctype.h
@@ -64,6 +64,9 @@ extern "C" {
   _CRTIMP int __cdecl _tolower(int _C);
   _CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale);
   _CRTIMP int __cdecl _isctype(int _C,int _Type);
+#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);
@@ -77,6 +80,7 @@ extern "C" {
   _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);
+#endif
   _CRTIMP int __cdecl __isascii(int _C);
   _CRTIMP int __cdecl __toascii(int _C);
   _CRTIMP int __cdecl __iscsymf(int _C);
-- 
2.48.1

From 08f65081fda8c7f8db113b7eb2348e541111a21d 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 10/11] 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 0df924c4b..49d3ce4d5 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 bd185cdf0..f81efdaf2 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 ce6247c1c..b49fc6423 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 bdf73e564..6a556b189 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 4f125a4f67691e882c9dbd00db7ad2daceb3fa08 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 11/11] 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

Attachment: 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

Reply via email to