summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-01-25 23:59:18 +0100
committerBruno Haible <bruno@clisp.org>2020-01-26 00:17:34 +0100
commitd9e2a748e4d07c110613e67f985c1111abf85ad8 (patch)
tree6575d1568ef88bf9c36195b35a64b02658daea99
parent3f6ef2164b6c35a643a7a3d2e0eac0eaade44009 (diff)
downloadgnulib-d9e2a748e4d07c110613e67f985c1111abf85ad8.tar.gz
c32ispunct: New module.
* lib/c32ispunct.c: New file. * modules/c32ispunct: New file. * doc/posix-functions/iswpunct.texi: Mention the new module.
-rw-r--r--ChangeLog7
-rw-r--r--doc/posix-functions/iswpunct.texi7
-rw-r--r--lib/c32ispunct.c25
-rw-r--r--modules/c32ispunct34
4 files changed, 71 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 14bfeec075..a3d03e5a86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2020-01-25 Bruno Haible <bruno@clisp.org>
+ c32ispunct: New module.
+ * lib/c32ispunct.c: New file.
+ * modules/c32ispunct: New file.
+ * doc/posix-functions/iswpunct.texi: Mention the new module.
+
+2020-01-25 Bruno Haible <bruno@clisp.org>
+
c32isprint: Add tests.
* tests/test-c32isprint.c: New file.
* tests/test-c32isprint.sh: New file.
diff --git a/doc/posix-functions/iswpunct.texi b/doc/posix-functions/iswpunct.texi
index 24810ce13f..bc0e65ac93 100644
--- a/doc/posix-functions/iswpunct.texi
+++ b/doc/posix-functions/iswpunct.texi
@@ -20,6 +20,9 @@ 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{c32ispunct}, provided by Gnulib module
+@code{c32ispunct}, operates on 32-bit wide characters and therefore does not
+have this limitation.
@end itemize
diff --git a/lib/c32ispunct.c b/lib/c32ispunct.c
new file mode 100644
index 0000000000..d0e6f4ee5e
--- /dev/null
+++ b/lib/c32ispunct.c
@@ -0,0 +1,25 @@
+/* Test 32-bit wide character for being a punctuation or symbol 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 c32ispunct
+#define WCHAR_FUNC iswpunct
+#define UCS_FUNC uc_is_punct
+#include "c32is-impl.h"
diff --git a/modules/c32ispunct b/modules/c32ispunct
new file mode 100644
index 0000000000..2f5e0e48d6
--- /dev/null
+++ b/modules/c32ispunct
@@ -0,0 +1,34 @@
+Description:
+c32ispunct() function: test 32-bit wide character for being a punctuation or
+symbol character.
+
+Files:
+lib/c32ispunct.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-punct
+verify
+
+configure.ac:
+AC_REQUIRE([gl_UCHAR_H])
+AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+gl_UCHAR_MODULE_INDICATOR([c32ispunct])
+
+Makefile.am:
+lib_SOURCES += c32ispunct.c
+
+Include:
+<uchar.h>
+
+License:
+LGPLv3+ or GPLv2
+
+Maintainer:
+Bruno Haible