I wrote:
>   7.32.2.2
>   iswctype            --             rarely used
>   wctype              --             rarely used

Well, 'fnmatch' and 'regex' uses iswctype and wctype. So, we need to have
counterparts of these functions in the char32_t world.

Since the ISO C names are idiosyncratic, let me choose more regular
identifiers:

  wchar_t             char32_t
  -------             --------

  iswctype            c32_apply_type_test
  wctype              c32_get_type_test


2023-07-12  Bruno Haible  <br...@clisp.org>

        doc: Mention c32_get_type_test, c32_apply_type_test.
        * doc/posix-functions/wctype.texi: Mention c32_get_type_test.
        * doc/posix-functions/iswctype.texi: Mention c32_apply_type_test.
        * doc/strings.texi (Comparison of character APIs): Mention both.

        c32_apply_type_test: Add tests.
        * tests/test-c32_apply_type_test.c: New file.
        * modules/c32_apply_type_test-tests: New file.

        c32_apply_type_test: New module.
        * lib/uchar.in.h (c32_apply_type_test): New declaration.
        * lib/c32_apply_type_test.c: New file.
        * m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
        GNULIB_C32_APPLY_TYPE_TEST.
        * modules/uchar (Makefile.am): Substitute GNULIB_C32_APPLY_TYPE_TEST.
        * modules/c32_apply_type_test: New file.

        c32_get_type_test: Add tests.
        * tests/test-c32_get_type_test.c: New file.
        * modules/c32_get_type_test-tests: New file.

        c32_get_type_test: New module.
        * lib/uchar.in.h (c32_type_test_t): New type.
        (c32_get_type_test): New declaration.
        * lib/c32_get_type_test.c: New file, based on lib/wctype-impl.h.
        * m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
        GNULIB_C32_GET_TYPE_TEST.
        * modules/uchar (Makefile.am): Substitute GNULIB_C32_GET_TYPE_TEST.
        * modules/c32_get_type_test: New file.

        iswctype: Relax license.
        * modules/iswctype (License): Change to LGPLv2+.
        * lib/iswctype.c: Update license notice.
        * lib/iswctype-impl.h: Likewise.

        wctype: Relax license.
        * modules/wctype (License): Change to LGPLv2+.
        * lib/wctype.c: Update license notice.
        * lib/wctype-impl.h: Likewise.

>From 9511ac66885c131c5b8a19d77f85cb87ef1ca3f1 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Wed, 12 Jul 2023 22:25:14 +0200
Subject: [PATCH 1/7] wctype: Relax license.

* modules/wctype (License): Change to LGPLv2+.
* lib/wctype.c: Update license notice.
* lib/wctype-impl.h: Likewise.
---
 ChangeLog         | 7 +++++++
 lib/wctype-impl.h | 2 +-
 lib/wctype.c      | 2 +-
 modules/wctype    | 2 +-
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e88f8572d8..78e1f5afa6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-07-12  Bruno Haible  <br...@clisp.org>
+
+	wctype: Relax license.
+	* modules/wctype (License): Change to LGPLv2+.
+	* lib/wctype.c: Update license notice.
+	* lib/wctype-impl.h: Likewise.
+
 2023-07-12  Bruno Haible  <br...@clisp.org>
 
 	mbiter, mbuiter: Small optimization.
diff --git a/lib/wctype-impl.h b/lib/wctype-impl.h
index 53d548e9a4..996af42a59 100644
--- a/lib/wctype-impl.h
+++ b/lib/wctype-impl.h
@@ -4,7 +4,7 @@
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
-   published by the Free Software Foundation, either version 3 of the
+   published by the Free Software Foundation; either version 2.1 of the
    License, or (at your option) any later version.
 
    This file is distributed in the hope that it will be useful,
diff --git a/lib/wctype.c b/lib/wctype.c
index 839bf062b9..af41b0554c 100644
--- a/lib/wctype.c
+++ b/lib/wctype.c
@@ -4,7 +4,7 @@
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
-   published by the Free Software Foundation, either version 3 of the
+   published by the Free Software Foundation; either version 2.1 of the
    License, or (at your option) any later version.
 
    This file is distributed in the hope that it will be useful,
diff --git a/modules/wctype b/modules/wctype
index 6a8d03b6ee..1ef8401d78 100644
--- a/modules/wctype
+++ b/modules/wctype
@@ -32,7 +32,7 @@ Include:
 <wctype.h>
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 all
-- 
2.34.1

>From 9ec9c96b131a57067ce09f7d4cd6a9fcf21cf25c Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Wed, 12 Jul 2023 22:25:52 +0200
Subject: [PATCH 2/7] iswctype: Relax license.

* modules/iswctype (License): Change to LGPLv2+.
* lib/iswctype.c: Update license notice.
* lib/iswctype-impl.h: Likewise.
---
 ChangeLog           | 5 +++++
 lib/iswctype-impl.h | 2 +-
 lib/iswctype.c      | 2 +-
 modules/iswctype    | 2 +-
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 78e1f5afa6..1d9466b86d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2023-07-12  Bruno Haible  <br...@clisp.org>
 
+	iswctype: Relax license.
+	* modules/iswctype (License): Change to LGPLv2+.
+	* lib/iswctype.c: Update license notice.
+	* lib/iswctype-impl.h: Likewise.
+
 	wctype: Relax license.
 	* modules/wctype (License): Change to LGPLv2+.
 	* lib/wctype.c: Update license notice.
diff --git a/lib/iswctype-impl.h b/lib/iswctype-impl.h
index e83b27f6ae..13dc6664c6 100644
--- a/lib/iswctype-impl.h
+++ b/lib/iswctype-impl.h
@@ -4,7 +4,7 @@
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
-   published by the Free Software Foundation, either version 3 of the
+   published by the Free Software Foundation; either version 2.1 of the
    License, or (at your option) any later version.
 
    This file is distributed in the hope that it will be useful,
diff --git a/lib/iswctype.c b/lib/iswctype.c
index d4f35ffc01..33b5ad49bf 100644
--- a/lib/iswctype.c
+++ b/lib/iswctype.c
@@ -4,7 +4,7 @@
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
-   published by the Free Software Foundation, either version 3 of the
+   published by the Free Software Foundation; either version 2.1 of the
    License, or (at your option) any later version.
 
    This file is distributed in the hope that it will be useful,
diff --git a/modules/iswctype b/modules/iswctype
index ea8755bc1a..eb8e68ee03 100644
--- a/modules/iswctype
+++ b/modules/iswctype
@@ -30,7 +30,7 @@ Include:
 <wctype.h>
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 all
-- 
2.34.1

>From 43dc3f65057b41b0f3e292996be562037622772e Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Wed, 12 Jul 2023 22:44:52 +0200
Subject: [PATCH 3/7] c32_get_type_test: New module.

* lib/uchar.in.h (c32_type_test_t): New type.
(c32_get_type_test): New declaration.
* lib/c32_get_type_test.c: New file, based on lib/wctype-impl.h.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32_GET_TYPE_TEST.
* modules/uchar (Makefile.am): Substitute GNULIB_C32_GET_TYPE_TEST.
* modules/c32_get_type_test: New file.
---
 ChangeLog                 |   9 +++
 lib/c32_get_type_test.c   | 113 ++++++++++++++++++++++++++++++++++++++
 lib/uchar.in.h            |  36 ++++++++++++
 m4/uchar_h.m4             |   3 +-
 modules/c32_get_type_test |  41 ++++++++++++++
 modules/uchar             |   1 +
 6 files changed, 202 insertions(+), 1 deletion(-)
 create mode 100644 lib/c32_get_type_test.c
 create mode 100644 modules/c32_get_type_test

diff --git a/ChangeLog b/ChangeLog
index 1d9466b86d..378392a900 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2023-07-12  Bruno Haible  <br...@clisp.org>
 
+	c32_get_type_test: New module.
+	* lib/uchar.in.h (c32_type_test_t): New type.
+	(c32_get_type_test): New declaration.
+	* lib/c32_get_type_test.c: New file, based on lib/wctype-impl.h.
+	* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
+	GNULIB_C32_GET_TYPE_TEST.
+	* modules/uchar (Makefile.am): Substitute GNULIB_C32_GET_TYPE_TEST.
+	* modules/c32_get_type_test: New file.
+
 	iswctype: Relax license.
 	* modules/iswctype (License): Change to LGPLv2+.
 	* lib/iswctype.c: Update license notice.
diff --git a/lib/c32_get_type_test.c b/lib/c32_get_type_test.c
new file mode 100644
index 0000000000..77d0a133e9
--- /dev/null
+++ b/lib/c32_get_type_test.c
@@ -0,0 +1,113 @@
+/* Get descriptor for a 32-bit wide character property.
+   Copyright (C) 2011-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#define IN_C32_GET_TYPE_TEST
+/* Specification.  */
+#include <uchar.h>
+
+#include <string.h>
+#include <wctype.h>
+
+#if _GL_WCHAR_T_IS_UCS4
+_GL_EXTERN_INLINE
+#endif
+c32_type_test_t
+c32_get_type_test (const char *name)
+{
+#if _GL_WCHAR_T_IS_UCS4
+  return wctype (name);
+#else
+  switch (name[0])
+    {
+    case 'a':
+      switch (name[1])
+        {
+        case 'l':
+          switch (name[2])
+            {
+            case 'n':
+              if (strcmp (name + 3, "um") == 0)
+                return c32isalnum;
+              break;
+            case 'p':
+              if (strcmp (name + 3, "ha") == 0)
+                return c32isalpha;
+              break;
+            default:
+              break;
+            }
+          break;
+        default:
+          break;
+        }
+      break;
+    case 'b':
+      if (strcmp (name + 1, "lank") == 0)
+        return c32isblank;
+      break;
+    case 'c':
+      if (strcmp (name + 1, "ntrl") == 0)
+        return c32iscntrl;
+      break;
+    case 'd':
+      if (strcmp (name + 1, "igit") == 0)
+        return c32isdigit;
+      break;
+    case 'g':
+      if (strcmp (name + 1, "raph") == 0)
+        return c32isgraph;
+      break;
+    case 'l':
+      if (strcmp (name + 1, "ower") == 0)
+        return c32islower;
+      break;
+    case 'p':
+      switch (name[1])
+        {
+        case 'r':
+          if (strcmp (name + 2, "int") == 0)
+            return c32isprint;
+          break;
+        case 'u':
+          if (strcmp (name + 2, "nct") == 0)
+            return c32ispunct;
+          break;
+        default:
+          break;
+        }
+      break;
+    case 's':
+      if (strcmp (name + 1, "pace") == 0)
+        return c32isspace;
+      break;
+    case 'u':
+      if (strcmp (name + 1, "pper") == 0)
+        return c32isupper;
+      break;
+    case 'x':
+      if (strcmp (name + 1, "digit") == 0)
+        return c32isxdigit;
+      break;
+    default:
+      break;
+    }
+  return (c32_type_test_t) 0;
+#endif
+}
diff --git a/lib/uchar.in.h b/lib/uchar.in.h
index 3ead6f5bce..72ec182308 100644
--- a/lib/uchar.in.h
+++ b/lib/uchar.in.h
@@ -669,6 +669,42 @@ _GL_CXXALIASWARN (mbstoc32s);
 #endif
 
 
+#if @GNULIB_C32_GET_TYPE_TEST@
+/* A scalar type.  Instances of this type, other than (c32_type_test_t) 0,
+   represent a character property, sometimes also viewed as a "character class".
+   It can be applied to 32-bit wide characters.  It is the counterpart of
+   type 'wctype_t' for wide characters.
+   To test whether a given character has a certain property, use the function
+   'c32_apply_type_test'.  */
+# if _GL_WCHAR_T_IS_UCS4
+typedef wctype_t c32_type_test_t;
+# else
+typedef /*bool*/int (*c32_type_test_t) (wint_t wc);
+# endif
+#endif
+
+/* Return a character property with the given name, or (c32_type_test_t) 0
+   if the designated property does not exist.
+   This function is the counterpart of function 'wctype' for wide characters.
+ */
+#if @GNULIB_C32_GET_TYPE_TEST@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_TYPE_TEST
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((1)) c32_type_test_t
+c32_get_type_test (const char *name)
+{
+  return wctype (name);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32_get_type_test, c32_type_test_t, (const char *name)
+                                                      _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (c32_get_type_test, c32_type_test_t, (const char *name));
+_GL_CXXALIASWARN (c32_get_type_test);
+#endif
+
+
 _GL_INLINE_HEADER_END
 
 #endif /* _@GUARD_PREFIX@_UCHAR_H */
diff --git a/m4/uchar_h.m4 b/m4/uchar_h.m4
index 1b784d2aef..0fdaf47dbc 100644
--- a/m4/uchar_h.m4
+++ b/m4/uchar_h.m4
@@ -1,4 +1,4 @@
-# uchar_h.m4 serial 27
+# uchar_h.m4 serial 28
 dnl Copyright (C) 2019-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -223,6 +223,7 @@ AC_DEFUN([gl_UCHAR_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32STOMBS])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SWIDTH])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOB])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_TYPE_TEST])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC16])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC32])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOC32S])
diff --git a/modules/c32_get_type_test b/modules/c32_get_type_test
new file mode 100644
index 0000000000..4b54660714
--- /dev/null
+++ b/modules/c32_get_type_test
@@ -0,0 +1,41 @@
+Description:
+c32_get_type_test() function: get descriptor for a 32-bit wide character
+property.
+
+Files:
+lib/c32_get_type_test.c
+
+Depends-on:
+uchar
+wctype
+c32isalnum
+c32isalpha
+c32isblank
+c32iscntrl
+c32isdigit
+c32isgraph
+c32islower
+c32isprint
+c32ispunct
+c32isspace
+c32isupper
+c32isxdigit
+
+configure.ac:
+gl_UCHAR_MODULE_INDICATOR([c32_get_type_test])
+
+Makefile.am:
+lib_SOURCES += c32_get_type_test.c
+
+Include:
+<uchar.h>
+
+Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
diff --git a/modules/uchar b/modules/uchar
index f5539abbb3..6c52c7d3f3 100644
--- a/modules/uchar
+++ b/modules/uchar
@@ -60,6 +60,7 @@ uchar.h: uchar.in.h $(top_builddir)/config.status $(CXXDEFS_H)
 	      -e 's/@''GNULIB_C32STOMBS''@/$(GNULIB_C32STOMBS)/g' \
 	      -e 's/@''GNULIB_C32SWIDTH''@/$(GNULIB_C32SWIDTH)/g' \
 	      -e 's/@''GNULIB_C32TOB''@/$(GNULIB_C32TOB)/g' \
+	      -e 's/@''GNULIB_C32_GET_TYPE_TEST''@/$(GNULIB_C32_GET_TYPE_TEST)/g' \
 	      -e 's/@''GNULIB_MBRTOC16''@/$(GNULIB_MBRTOC16)/g' \
 	      -e 's/@''GNULIB_MBRTOC32''@/$(GNULIB_MBRTOC32)/g' \
 	      -e 's/@''GNULIB_MBSNRTOC32S''@/$(GNULIB_MBSNRTOC32S)/g' \
-- 
2.34.1

>From 4bd4eb70a938385fada1404f64599df4be62043f Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Thu, 13 Jul 2023 00:11:20 +0200
Subject: [PATCH 4/7] c32_get_type_test: Add tests.

* tests/test-c32_get_type_test.c: New file.
* modules/c32_get_type_test-tests: New file.
---
 ChangeLog                       |  4 ++
 modules/c32_get_type_test-tests | 13 ++++++
 tests/test-c32_get_type_test.c  | 73 +++++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+)
 create mode 100644 modules/c32_get_type_test-tests
 create mode 100644 tests/test-c32_get_type_test.c

diff --git a/ChangeLog b/ChangeLog
index 378392a900..8327925de9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2023-07-12  Bruno Haible  <br...@clisp.org>
 
+	c32_get_type_test: Add tests.
+	* tests/test-c32_get_type_test.c: New file.
+	* modules/c32_get_type_test-tests: New file.
+
 	c32_get_type_test: New module.
 	* lib/uchar.in.h (c32_type_test_t): New type.
 	(c32_get_type_test): New declaration.
diff --git a/modules/c32_get_type_test-tests b/modules/c32_get_type_test-tests
new file mode 100644
index 0000000000..873d4514dd
--- /dev/null
+++ b/modules/c32_get_type_test-tests
@@ -0,0 +1,13 @@
+Files:
+tests/test-c32_get_type_test.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-c32_get_type_test
+check_PROGRAMS += test-c32_get_type_test
+test_c32_get_type_test_LDADD = $(LDADD) $(LIBUNISTRING) $(LIBC32CONV)
diff --git a/tests/test-c32_get_type_test.c b/tests/test-c32_get_type_test.c
new file mode 100644
index 0000000000..af5056fb28
--- /dev/null
+++ b/tests/test-c32_get_type_test.c
@@ -0,0 +1,73 @@
+/* Test of getting descriptor for a 32-bit wide character property.
+   Copyright (C) 2023 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32_get_type_test, c32_type_test_t, (const char *));
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  c32_type_test_t desc;
+
+  desc = c32_get_type_test ("any");
+  ASSERT (desc == (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("blank");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("space");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("punct");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("lower");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("upper");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("alpha");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("digit");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("xdigit");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("alnum");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("cntrl");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("graph");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("print");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  return 0;
+}
-- 
2.34.1

>From 2b7a3bbc9fbc0811154d5282be056fe5d2531c43 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Thu, 13 Jul 2023 00:50:29 +0200
Subject: [PATCH 5/7] c32_apply_type_test: New module.

* lib/uchar.in.h (c32_apply_type_test): New declaration.
* lib/c32_apply_type_test.c: New file.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32_APPLY_TYPE_TEST.
* modules/uchar (Makefile.am): Substitute GNULIB_C32_APPLY_TYPE_TEST.
* modules/c32_apply_type_test: New file.
---
 ChangeLog                   |  8 ++++++++
 lib/c32_apply_type_test.c   | 39 +++++++++++++++++++++++++++++++++++++
 lib/uchar.in.h              | 26 ++++++++++++++++++++++++-
 m4/uchar_h.m4               |  3 ++-
 modules/c32_apply_type_test | 25 ++++++++++++++++++++++++
 modules/uchar               |  1 +
 6 files changed, 100 insertions(+), 2 deletions(-)
 create mode 100644 lib/c32_apply_type_test.c
 create mode 100644 modules/c32_apply_type_test

diff --git a/ChangeLog b/ChangeLog
index 8327925de9..2c3feef5ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2023-07-12  Bruno Haible  <br...@clisp.org>
 
+	c32_apply_type_test: New module.
+	* lib/uchar.in.h (c32_apply_type_test): New declaration.
+	* lib/c32_apply_type_test.c: New file.
+	* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
+	GNULIB_C32_APPLY_TYPE_TEST.
+	* modules/uchar (Makefile.am): Substitute GNULIB_C32_APPLY_TYPE_TEST.
+	* modules/c32_apply_type_test: New file.
+
 	c32_get_type_test: Add tests.
 	* tests/test-c32_get_type_test.c: New file.
 	* modules/c32_get_type_test-tests: New file.
diff --git a/lib/c32_apply_type_test.c b/lib/c32_apply_type_test.c
new file mode 100644
index 0000000000..f5a844eb02
--- /dev/null
+++ b/lib/c32_apply_type_test.c
@@ -0,0 +1,39 @@
+/* Apply a 32-bit wide character property test.
+   Copyright (C) 2011-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#define IN_C32_APPLY_TYPE_TEST
+/* Specification.  */
+#include <uchar.h>
+
+#include <string.h>
+#include <wctype.h>
+
+#if _GL_WCHAR_T_IS_UCS4
+_GL_EXTERN_INLINE
+#endif
+int
+c32_apply_type_test (wint_t wc, c32_type_test_t property)
+{
+#if _GL_WCHAR_T_IS_UCS4
+  return iswctype (wc, property);
+#else
+  return property (wc);
+#endif
+}
diff --git a/lib/uchar.in.h b/lib/uchar.in.h
index 72ec182308..edb6a751fd 100644
--- a/lib/uchar.in.h
+++ b/lib/uchar.in.h
@@ -669,7 +669,7 @@ _GL_CXXALIASWARN (mbstoc32s);
 #endif
 
 
-#if @GNULIB_C32_GET_TYPE_TEST@
+#if @GNULIB_C32_GET_TYPE_TEST@ || @GNULIB_C32_APPLY_TYPE_TEST@
 /* A scalar type.  Instances of this type, other than (c32_type_test_t) 0,
    represent a character property, sometimes also viewed as a "character class".
    It can be applied to 32-bit wide characters.  It is the counterpart of
@@ -704,6 +704,30 @@ _GL_CXXALIAS_SYS (c32_get_type_test, c32_type_test_t, (const char *name));
 _GL_CXXALIASWARN (c32_get_type_test);
 #endif
 
+/* Test whether a given 32-bit wide character has the specified character
+   property.
+   Return non-zero if true, zero if false or if the argument is WEOF.
+   This function is the counterpart of function 'iswctype' for wide characters.
+ */
+#if @GNULIB_C32_APPLY_TYPE_TEST@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_APPLY_TYPE_TEST
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((2)) int
+c32_apply_type_test (wint_t wc, c32_type_test_t property)
+{
+  return iswctype (wc, property);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32_apply_type_test, int,
+                  (wint_t wc, c32_type_test_t property)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (c32_apply_type_test, int,
+                  (wint_t wc, c32_type_test_t property));
+_GL_CXXALIASWARN (c32_apply_type_test);
+#endif
+
 
 _GL_INLINE_HEADER_END
 
diff --git a/m4/uchar_h.m4 b/m4/uchar_h.m4
index 0fdaf47dbc..2bc52480d1 100644
--- a/m4/uchar_h.m4
+++ b/m4/uchar_h.m4
@@ -1,4 +1,4 @@
-# uchar_h.m4 serial 28
+# uchar_h.m4 serial 29
 dnl Copyright (C) 2019-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -223,6 +223,7 @@ AC_DEFUN([gl_UCHAR_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32STOMBS])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SWIDTH])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOB])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_TYPE_TEST])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_TYPE_TEST])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC16])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC32])
diff --git a/modules/c32_apply_type_test b/modules/c32_apply_type_test
new file mode 100644
index 0000000000..3477413f86
--- /dev/null
+++ b/modules/c32_apply_type_test
@@ -0,0 +1,25 @@
+Description:
+c32_apply_type_test() function: test whether a 32-bit wide character has
+a given property.
+
+Files:
+lib/c32_apply_type_test.c
+
+Depends-on:
+uchar
+iswctype
+
+configure.ac:
+gl_UCHAR_MODULE_INDICATOR([c32_apply_type_test])
+
+Makefile.am:
+lib_SOURCES += c32_apply_type_test.c
+
+Include:
+<uchar.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/uchar b/modules/uchar
index 6c52c7d3f3..1f42c6a08c 100644
--- a/modules/uchar
+++ b/modules/uchar
@@ -60,6 +60,7 @@ uchar.h: uchar.in.h $(top_builddir)/config.status $(CXXDEFS_H)
 	      -e 's/@''GNULIB_C32STOMBS''@/$(GNULIB_C32STOMBS)/g' \
 	      -e 's/@''GNULIB_C32SWIDTH''@/$(GNULIB_C32SWIDTH)/g' \
 	      -e 's/@''GNULIB_C32TOB''@/$(GNULIB_C32TOB)/g' \
+	      -e 's/@''GNULIB_C32_APPLY_TYPE_TEST''@/$(GNULIB_C32_APPLY_TYPE_TEST)/g' \
 	      -e 's/@''GNULIB_C32_GET_TYPE_TEST''@/$(GNULIB_C32_GET_TYPE_TEST)/g' \
 	      -e 's/@''GNULIB_MBRTOC16''@/$(GNULIB_MBRTOC16)/g' \
 	      -e 's/@''GNULIB_MBRTOC32''@/$(GNULIB_MBRTOC32)/g' \
-- 
2.34.1

>From 1646478e3add26a7dc22a512de0691d5ee7bdf6c Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Thu, 13 Jul 2023 00:52:19 +0200
Subject: [PATCH 6/7] c32_apply_type_test: Add tests.

* tests/test-c32_apply_type_test.c: New file.
* modules/c32_apply_type_test-tests: New file.
---
 ChangeLog                         |   4 +
 modules/c32_apply_type_test-tests |  14 +++
 tests/test-c32_apply_type_test.c  | 168 ++++++++++++++++++++++++++++++
 3 files changed, 186 insertions(+)
 create mode 100644 modules/c32_apply_type_test-tests
 create mode 100644 tests/test-c32_apply_type_test.c

diff --git a/ChangeLog b/ChangeLog
index 2c3feef5ee..ab0dfc82b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2023-07-12  Bruno Haible  <br...@clisp.org>
 
+	c32_apply_type_test: Add tests.
+	* tests/test-c32_apply_type_test.c: New file.
+	* modules/c32_apply_type_test-tests: New file.
+
 	c32_apply_type_test: New module.
 	* lib/uchar.in.h (c32_apply_type_test): New declaration.
 	* lib/c32_apply_type_test.c: New file.
diff --git a/modules/c32_apply_type_test-tests b/modules/c32_apply_type_test-tests
new file mode 100644
index 0000000000..ea2e68b212
--- /dev/null
+++ b/modules/c32_apply_type_test-tests
@@ -0,0 +1,14 @@
+Files:
+tests/test-c32_apply_type_test.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+c32_get_type_test
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-c32_apply_type_test
+check_PROGRAMS += test-c32_apply_type_test
+test_c32_apply_type_test_LDADD = $(LDADD) $(LIBUNISTRING) $(LIBC32CONV)
diff --git a/tests/test-c32_apply_type_test.c b/tests/test-c32_apply_type_test.c
new file mode 100644
index 0000000000..7f7cccb786
--- /dev/null
+++ b/tests/test-c32_apply_type_test.c
@@ -0,0 +1,168 @@
+/* Test of 32-bit wide character properties.
+   Copyright (C) 2023 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32_apply_type_test, int, (wint_t, c32_type_test_t));
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  c32_type_test_t desc;
+
+  desc = c32_get_type_test ("any");
+  ASSERT (desc == (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("blank");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '\t', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\n', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '_', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("space");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '\t', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '\n', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '_', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("punct");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) '$', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '.', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '<', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '>', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '1', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("lower");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '1', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '_', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("upper");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '1', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '_', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("alpha");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '1', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '$', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("digit");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) '0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '9', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'f', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'F', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("xdigit");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) '0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '9', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'f', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'F', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'g', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'G', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("alnum");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '9', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '_', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("cntrl");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) '\0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '\n', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '\t', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\\', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("graph");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '9', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '$', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\0', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\t', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("print");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '9', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '$', desc));
+  ASSERT (c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\0', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\t', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  return 0;
+}
-- 
2.34.1

>From 53a8c2c5faabcb4bdb55a768f13293f3c0b9b082 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Thu, 13 Jul 2023 00:58:13 +0200
Subject: [PATCH 7/7] doc: Mention c32_get_type_test, c32_apply_type_test.

* doc/posix-functions/wctype.texi: Mention c32_get_type_test.
* doc/posix-functions/iswctype.texi: Mention c32_apply_type_test.
* doc/strings.texi (Comparison of character APIs): Mention both.
---
 ChangeLog                         | 5 +++++
 doc/posix-functions/iswctype.texi | 3 +++
 doc/posix-functions/wctype.texi   | 3 +++
 doc/strings.texi                  | 8 +++++++-
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ab0dfc82b4..764fc15ea1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2023-07-12  Bruno Haible  <br...@clisp.org>
 
+	doc: Mention c32_get_type_test, c32_apply_type_test.
+	* doc/posix-functions/wctype.texi: Mention c32_get_type_test.
+	* doc/posix-functions/iswctype.texi: Mention c32_apply_type_test.
+	* doc/strings.texi (Comparison of character APIs): Mention both.
+
 	c32_apply_type_test: Add tests.
 	* tests/test-c32_apply_type_test.c: New file.
 	* modules/c32_apply_type_test-tests: New file.
diff --git a/doc/posix-functions/iswctype.texi b/doc/posix-functions/iswctype.texi
index 16e5a3a132..a58cfc3162 100644
--- a/doc/posix-functions/iswctype.texi
+++ b/doc/posix-functions/iswctype.texi
@@ -26,4 +26,7 @@
 @item
 On Windows and 32-bit AIX platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
+However, the Gnulib function @code{c32_apply_type_test}, provided by Gnulib
+module @code{c32_apply_type_test}, operates on 32-bit wide characters and
+therefore does not have this limitation.
 @end itemize
diff --git a/doc/posix-functions/wctype.texi b/doc/posix-functions/wctype.texi
index 33c3fad883..4d1deeb904 100644
--- a/doc/posix-functions/wctype.texi
+++ b/doc/posix-functions/wctype.texi
@@ -22,4 +22,7 @@
 @item
 On Windows and 32-bit AIX platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
+However, the Gnulib function @code{c32_get_type_test}, provided by Gnulib
+module @code{c32_get_type_test}, operates on 32-bit wide characters and
+therefore does not have this limitation.
 @end itemize
diff --git a/doc/strings.texi b/doc/strings.texi
index ecf92f3da4..9ea9c8a5b8 100644
--- a/doc/strings.texi
+++ b/doc/strings.texi
@@ -834,8 +834,14 @@
 
 @item --
 @tab --
-@tab @code{iswctype}
+@tab @code{wctype}
+@tab @code{c32_get_type_test}
 @tab --
+
+@item --
+@tab --
+@tab @code{iswctype}
+@tab @code{c32_apply_type_test}
 @tab --
 
 @item @code{tolower}
-- 
2.34.1

Reply via email to