# HG changeset patch # User Bruno Haible # Date 1297033174 -3600 # Node ID 9a2d4c1b20346ec1b81257780c956e17b52debb0 # Parent aef6efcc4045718c8ba567d6ad4436adfbbc421d New module 'iswctype'. * modules/iswctype: New file. * lib/wctype.in.h (iswctype): New declaration. * lib/iswctype.c: New file. * lib/iswctype-impl.h: New file. * m4/iswctype.m4: New file. * m4/wctype_h.m4 (gl_WCTYPE_H): Test whether iswctype is declared. (gl_WCTYPE_H_DEFAULTS): Initialize GNULIB_ISWCTYPE. * modules/wctype-h (Makefile.am): Substitute GNULIB_ISWCTYPE. * tests/test-wctype-h-c++.cc: Test the declaration of iswctype. * doc/posix-functions/iswctype.texi: Mention the new module and the HP-UX 11.00 problem. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2011-02-06 Bruno Haible + + New module 'iswctype'. + * modules/iswctype: New file. + * lib/wctype.in.h (iswctype): New declaration. + * lib/iswctype.c: New file. + * lib/iswctype-impl.h: New file. + * m4/iswctype.m4: New file. + * m4/wctype_h.m4 (gl_WCTYPE_H): Test whether iswctype is declared. + (gl_WCTYPE_H_DEFAULTS): Initialize GNULIB_ISWCTYPE. + * modules/wctype-h (Makefile.am): Substitute GNULIB_ISWCTYPE. + * tests/test-wctype-h-c++.cc: Test the declaration of iswctype. + * doc/posix-functions/iswctype.texi: Mention the new module and the + HP-UX 11.00 problem. + 2011-02-06 Bruno Haible New module 'wctype'. diff --git a/doc/posix-functions/iswctype.texi b/doc/posix-functions/iswctype.texi --- a/doc/posix-functions/iswctype.texi +++ b/doc/posix-functions/iswctype.texi @@ -4,18 +4,22 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswctype.html} -Gnulib module: --- +Gnulib module: iswctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +IRIX 5.3, Solaris 2.5.1. +@item +This function is declared in @code{}, not in @code{}, on +some platforms: +HP-UX 11.00. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -IRIX 5.3, Solaris 2.5.1. -@item On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff --git a/lib/iswctype-impl.h b/lib/iswctype-impl.h new file mode 100644 --- /dev/null +++ b/lib/iswctype-impl.h @@ -0,0 +1,22 @@ +/* Test whether a wide character has a given property. + Copyright (C) 2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. + + 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 . */ + +int +iswctype (wint_t wc, wctype_t desc) +{ + return ((int (*) (wint_t)) desc) (wc); +} diff --git a/lib/iswctype.c b/lib/iswctype.c new file mode 100644 --- /dev/null +++ b/lib/iswctype.c @@ -0,0 +1,23 @@ +/* Test whether a wide character has a given property. + Copyright (C) 2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. + + 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 . */ + +#include + +/* Specification. */ +#include + +#include "iswctype-impl.h" diff --git a/lib/wctype.in.h b/lib/wctype.in.h --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -399,6 +399,23 @@ # endif #endif +/* Test whether a wide character has a given property. + The argument WC must be either a wchar_t value or WEOF. + The argument DESC must have been returned by the wctype() function. */ +#if @GNULIB_ISWCTYPE@ +# if !@HAVE_WCTYPE_T@ +_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); +# endif +_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); +_GL_CXXALIASWARN (iswctype); +#elif defined GNULIB_POSIXCHECK +# undef iswctype +# if HAVE_RAW_DECL_ISWCTYPE +_GL_WARN_ON_USE (iswctype, "iswctype is unportable - " + "use gnulib module iswctype for portability"); +# endif +#endif + #if @REPLACE_ISWCNTRL@ || defined __MINGW32__ _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc)); _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc)); diff --git a/m4/iswctype.m4 b/m4/iswctype.m4 new file mode 100644 --- /dev/null +++ b/m4/iswctype.m4 @@ -0,0 +1,14 @@ +# iswctype.m4 serial 1 +dnl Copyright (C) 2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_ISWCTYPE], +[ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H]) + if test $HAVE_WCTYPE_T = 0; then + AC_LIBOBJ([iswctype]) + fi +]) diff --git a/m4/wctype_h.m4 b/m4/wctype_h.m4 --- a/m4/wctype_h.m4 +++ b/m4/wctype_h.m4 @@ -146,7 +146,7 @@ #endif #include ]], - [wctype + [wctype iswctype ]) ]) @@ -163,6 +163,7 @@ [ GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK]) GNULIB_WCTYPE=0; AC_SUBST([GNULIB_WCTYPE]) + GNULIB_ISWCTYPE=0; AC_SUBST([GNULIB_ISWCTYPE]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T]) diff --git a/modules/iswctype b/modules/iswctype new file mode 100644 --- /dev/null +++ b/modules/iswctype @@ -0,0 +1,31 @@ +Description: +iswctype() function: test whether a wide character has a given property. + +Status: +obsolete + +Notice: +This module is obsolete. + +Files: +lib/iswctype.c +lib/iswctype-impl.h +m4/iswctype.m4 + +Depends-on: +wctype-h + +configure.ac: +gl_FUNC_ISWCTYPE +gl_WCTYPE_MODULE_INDICATOR([iswctype]) + +Makefile.am: + +Include: + + +License: +LGPL + +Maintainer: +Bruno Haible diff --git a/modules/wctype-h b/modules/wctype-h --- a/modules/wctype-h +++ b/modules/wctype-h @@ -29,6 +29,7 @@ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \ -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \ + -e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \ -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \ diff --git a/tests/test-wctype-h-c++.cc b/tests/test-wctype-h-c++.cc --- a/tests/test-wctype-h-c++.cc +++ b/tests/test-wctype-h-c++.cc @@ -43,6 +43,10 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::wctype, wctype_t, (const char *)); #endif +#if GNULIB_TEST_ISWCTYPE +SIGNATURE_CHECK (GNULIB_NAMESPACE::iswctype, int, (wint_t, wctype_t)); +#endif + SIGNATURE_CHECK (GNULIB_NAMESPACE::towlower, wint_t, (wint_t)); SIGNATURE_CHECK (GNULIB_NAMESPACE::towupper, wint_t, (wint_t));