Mercurial > hg > octave-lyh > gnulib-hg
changeset 14320:9a2d4c1b2034
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 06 Feb 2011 23:59:34 +0100 |
parents | aef6efcc4045 |
children | 3b388f38755d |
files | ChangeLog doc/posix-functions/iswctype.texi lib/iswctype-impl.h lib/iswctype.c lib/wctype.in.h m4/iswctype.m4 m4/wctype_h.m4 modules/iswctype modules/wctype-h tests/test-wctype-h-c++.cc |
diffstat | 10 files changed, 137 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2011-02-06 Bruno Haible <bruno@clisp.org> + + 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 <bruno@clisp.org> New module 'wctype'.
--- 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{<wchar.h>}, not in @code{<wctype.h>}, 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
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 <bruno@clisp.org>, 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 <http://www.gnu.org/licenses/>. */ + +int +iswctype (wint_t wc, wctype_t desc) +{ + return ((int (*) (wint_t)) desc) (wc); +}
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 <bruno@clisp.org>, 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 <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <wctype.h> + +#include "iswctype-impl.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));
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 +])
--- a/m4/wctype_h.m4 +++ b/m4/wctype_h.m4 @@ -146,7 +146,7 @@ #endif #include <wctype.h> ]], - [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])
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: +<wctype.h> + +License: +LGPL + +Maintainer: +Bruno Haible
--- 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' \
--- 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));