summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--doc/posix-functions/iswcntrl.texi7
-rw-r--r--lib/c32iscntrl.c25
-rw-r--r--modules/c32iscntrl33
4 files changed, 70 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0cedfbbfed..ac130a2920 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2020-01-25 Bruno Haible <bruno@clisp.org>
+ c32iscntrl: New module.
+ * lib/c32iscntrl.c: New file.
+ * modules/c32iscntrl: New file.
+ * doc/posix-functions/iswcntrl.texi: Mention the new module.
+
+2020-01-25 Bruno Haible <bruno@clisp.org>
+
c32isblank: Add tests.
* tests/test-c32isblank.c: New file.
* tests/test-c32isblank.sh: New file.
diff --git a/doc/posix-functions/iswcntrl.texi b/doc/posix-functions/iswcntrl.texi
index a71a419b18..77ee139094 100644
--- a/doc/posix-functions/iswcntrl.texi
+++ b/doc/posix-functions/iswcntrl.texi
@@ -20,8 +20,11 @@ OS X 10.8.
Portability problems not fixed by Gnulib:
@itemize
@item
-On Windows and 32-bit AIX platforms, @code{wchar_t} is a 16-bit type and therefore cannot
-accommodate all Unicode characters.
+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{c32iscntrl}, provided by Gnulib module
+@code{c32iscntrl}, operates on 32-bit wide characters and therefore does not
+have this limitation.
@item
This function returns 0 for U+2028 (LINE SEPARATOR) and
U+2029 (PARAGRAPH SEPARATOR) on some platforms:
diff --git a/lib/c32iscntrl.c b/lib/c32iscntrl.c
new file mode 100644
index 0000000000..cad20913a5
--- /dev/null
+++ b/lib/c32iscntrl.c
@@ -0,0 +1,25 @@
+/* Test 32-bit wide character for being a control character.
+ Copyright (C) 2020 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 2, 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/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <uchar.h>
+
+#define FUNC c32iscntrl
+#define WCHAR_FUNC iswcntrl
+#define UCS_FUNC uc_is_cntrl
+#include "c32is-impl.h"
diff --git a/modules/c32iscntrl b/modules/c32iscntrl
new file mode 100644
index 0000000000..4fb648463f
--- /dev/null
+++ b/modules/c32iscntrl
@@ -0,0 +1,33 @@
+Description:
+c32iscntrl() function: test 32-bit wide character for being a control character.
+
+Files:
+lib/c32iscntrl.c
+lib/c32is-impl.h
+m4/mbrtoc32.m4
+
+Depends-on:
+uchar
+wchar
+wctype-h
+localcharset [test $REPLACE_MBSTATE_T = 1]
+streq [test $REPLACE_MBSTATE_T = 1]
+unictype/ctype-cntrl
+verify
+
+configure.ac:
+AC_REQUIRE([gl_UCHAR_H])
+AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+gl_UCHAR_MODULE_INDICATOR([c32iscntrl])
+
+Makefile.am:
+lib_SOURCES += c32iscntrl.c
+
+Include:
+<uchar.h>
+
+License:
+LGPLv3+ or GPLv2
+
+Maintainer:
+Bruno Haible