# HG changeset patch # User Bruno Haible # Date 1297026444 -3600 # Node ID 00537d144c488c11d1bd7a635e8dac1ff406ba06 # Parent 93b787ac4b80b8f177af37006c7e8bd2997e6a38 New module 'iswblank'. * lib/wctype.in.h (iswblank): Don't declare if GNULIB_ISWBLANK is 0. * modules/iswblank: New file. * modules/wctype-h (Files): Remove lib/iswblank.c. (Makefile.am): Substitute GNULIB_ISWBLANK. * m4/iswblank.m4: New file, partially extracted from m4/wctype_h.m4. * m4/wctype_h.m4 (gl_WCTYPE_MODULE_INDICATOR): New macro. (gl_WCTYPE_H_DEFAULTS): New macro. (gl_WCTYPE_H): Require it. Remove iswblank related code. * modules/iswblank-tests: New file. * tests/test-iswblank.c: New file, extraced from tests/test-wctype-h.c. * tests/test-wctype-h.c (main): Remove iswblank tests. * tests/test-wctype-h-c++.cc: Guard the signature test of iswblank. * doc/posix-functions/iswblank.texi: Mention module 'iswblank' instead of 'wctype-h'. * NEWS: Mention the change. * modules/mbchar (Depends-on): Add iswblank. diff -r 93b787ac4b80 -r 00537d144c48 ChangeLog --- a/ChangeLog Tue Feb 08 11:20:08 2011 +0100 +++ b/ChangeLog Sun Feb 06 22:07:24 2011 +0100 @@ -1,3 +1,23 @@ +2011-02-06 Bruno Haible + + New module 'iswblank'. + * lib/wctype.in.h (iswblank): Don't declare if GNULIB_ISWBLANK is 0. + * modules/iswblank: New file. + * modules/wctype-h (Files): Remove lib/iswblank.c. + (Makefile.am): Substitute GNULIB_ISWBLANK. + * m4/iswblank.m4: New file, partially extracted from m4/wctype_h.m4. + * m4/wctype_h.m4 (gl_WCTYPE_MODULE_INDICATOR): New macro. + (gl_WCTYPE_H_DEFAULTS): New macro. + (gl_WCTYPE_H): Require it. Remove iswblank related code. + * modules/iswblank-tests: New file. + * tests/test-iswblank.c: New file, extraced from tests/test-wctype-h.c. + * tests/test-wctype-h.c (main): Remove iswblank tests. + * tests/test-wctype-h-c++.cc: Guard the signature test of iswblank. + * doc/posix-functions/iswblank.texi: Mention module 'iswblank' instead + of 'wctype-h'. + * NEWS: Mention the change. + * modules/mbchar (Depends-on): Add iswblank. + 2011-02-08 Bruno Haible di-set tests: Refactor. diff -r 93b787ac4b80 -r 00537d144c48 NEWS --- a/NEWS Tue Feb 08 11:20:08 2011 +0100 +++ b/NEWS Sun Feb 06 22:07:24 2011 +0100 @@ -12,6 +12,10 @@ Date Modules Changes +2011-02-08 wctype-h This module no longer provides the iswblank() + function. If you need this function, you now need + to request the 'iswblank' module. + 2011-02-07 wctype This module is renamed to wctype-h. 2011-01-18 multiarch This no longer #defines AA_APPLE_UNIVERSAL_BUILD; diff -r 93b787ac4b80 -r 00537d144c48 doc/posix-functions/iswblank.texi --- a/doc/posix-functions/iswblank.texi Tue Feb 08 11:20:08 2011 +0100 +++ b/doc/posix-functions/iswblank.texi Sun Feb 06 22:07:24 2011 +0100 @@ -4,7 +4,7 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswblank.html} -Gnulib module: wctype-h +Gnulib module: iswblank Portability problems fixed by Gnulib: @itemize diff -r 93b787ac4b80 -r 00537d144c48 lib/wctype.in.h --- a/lib/wctype.in.h Tue Feb 08 11:20:08 2011 +0100 +++ b/lib/wctype.in.h Sun Feb 06 22:07:24 2011 +0100 @@ -279,7 +279,7 @@ return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc); } -# elif ! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@ +# elif @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@) /* Only the iswblank function is missing. */ # if @REPLACE_ISWBLANK@ @@ -334,7 +334,6 @@ #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc)); _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc)); -_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc)); _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc)); _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc)); @@ -347,11 +346,6 @@ #else _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc)); _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc)); -# if @REPLACE_ISWBLANK@ -_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); -# else -_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); -# endif _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc)); _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc)); _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc)); @@ -364,7 +358,6 @@ #endif _GL_CXXALIASWARN (iswalnum); _GL_CXXALIASWARN (iswalpha); -_GL_CXXALIASWARN (iswblank); _GL_CXXALIASWARN (iswcntrl); _GL_CXXALIASWARN (iswdigit); _GL_CXXALIASWARN (iswgraph); @@ -375,6 +368,15 @@ _GL_CXXALIASWARN (iswupper); _GL_CXXALIASWARN (iswxdigit); +#if @GNULIB_ISWBLANK@ +# if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@ +_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); +# else +_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); +# endif +_GL_CXXALIASWARN (iswblank); +#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 -r 93b787ac4b80 -r 00537d144c48 m4/iswblank.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m4/iswblank.m4 Sun Feb 06 22:07:24 2011 +0100 @@ -0,0 +1,29 @@ +# iswblank.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_ISWBLANK], +[ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H]) + AC_CHECK_FUNCS_ONCE([iswblank]) + AC_CHECK_DECLS_ONCE([iswblank]) + if test $ac_cv_func_iswblank = no; then + HAVE_ISWBLANK=0 + if test $ac_cv_have_decl_iswblank = yes; then + REPLACE_ISWBLANK=1 + fi + fi + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + dnl Redefine all of iswcntrl, ..., towupper in . + : + else + if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then + dnl Redefine only iswblank. + AC_LIBOBJ([iswblank]) + fi + fi + +]) diff -r 93b787ac4b80 -r 00537d144c48 m4/wctype_h.m4 --- a/m4/wctype_h.m4 Tue Feb 08 11:20:08 2011 +0100 +++ b/m4/wctype_h.m4 Sun Feb 06 22:07:24 2011 +0100 @@ -1,4 +1,4 @@ -# wctype_h.m4 serial 12 +# wctype_h.m4 serial 13 dnl A placeholder for ISO C99 , for platforms that lack it. @@ -11,6 +11,7 @@ AC_DEFUN([gl_WCTYPE_H], [ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([iswcntrl]) @@ -20,21 +21,6 @@ HAVE_ISWCNTRL=0 fi AC_SUBST([HAVE_ISWCNTRL]) - AC_CHECK_FUNCS_ONCE([iswblank]) - AC_CHECK_DECLS_ONCE([iswblank]) - if test $ac_cv_func_iswblank = yes; then - HAVE_ISWBLANK=1 - REPLACE_ISWBLANK=0 - else - HAVE_ISWBLANK=0 - if test $ac_cv_have_decl_iswblank = yes; then - REPLACE_ISWBLANK=1 - else - REPLACE_ISWBLANK=0 - fi - fi - AC_SUBST([HAVE_ISWBLANK]) - AC_SUBST([REPLACE_ISWBLANK]) AC_REQUIRE([AC_C_INLINE]) @@ -91,10 +77,22 @@ if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then dnl Redefine all of iswcntrl, ..., towupper in . : - else - if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then - dnl Redefine only iswblank. - AC_LIBOBJ([iswblank]) - fi fi ]) + +AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_WCTYPE_H_DEFAULTS], +[ + GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) + REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) +]) diff -r 93b787ac4b80 -r 00537d144c48 modules/iswblank --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/iswblank Sun Feb 06 22:07:24 2011 +0100 @@ -0,0 +1,24 @@ +Description: +iswblank() function: test wide character for being blank. + +Files: +lib/iswblank.c +m4/iswblank.m4 + +Depends-on: +wctype-h + +configure.ac: +gl_FUNC_ISWBLANK +gl_WCTYPE_MODULE_INDICATOR([iswblank]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Bruno Haible diff -r 93b787ac4b80 -r 00537d144c48 modules/iswblank-tests --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/iswblank-tests Sun Feb 06 22:07:24 2011 +0100 @@ -0,0 +1,12 @@ +Files: +tests/test-iswblank.c +tests/macros.h + +Depends-on: +wctype-h-c++-tests + +configure.ac: + +Makefile.am: +TESTS += test-iswblank +check_PROGRAMS += test-iswblank diff -r 93b787ac4b80 -r 00537d144c48 modules/mbchar --- a/modules/mbchar Tue Feb 08 11:20:08 2011 +0100 +++ b/modules/mbchar Sun Feb 06 22:07:24 2011 +0100 @@ -11,6 +11,7 @@ stdbool wchar wctype-h +iswblank wcwidth memcmp diff -r 93b787ac4b80 -r 00537d144c48 modules/wctype-h --- a/modules/wctype-h Tue Feb 08 11:20:08 2011 +0100 +++ b/modules/wctype-h Sun Feb 06 22:07:24 2011 +0100 @@ -3,7 +3,6 @@ Files: lib/wctype.in.h -lib/iswblank.c m4/wctype_h.m4 m4/wint_t.m4 @@ -28,6 +27,7 @@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \ -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ diff -r 93b787ac4b80 -r 00537d144c48 tests/test-iswblank.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-iswblank.c Sun Feb 06 22:07:24 2011 +0100 @@ -0,0 +1,35 @@ +/* Test of iswblank() function. + Copyright (C) 2007-2011 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 . */ + +#include + +#include + +#include "macros.h" + +/* Check that WEOF is defined. */ +wint_t e = WEOF; + +int +main (void) +{ + /* Check that the function exist as a function or as a macro. */ + (void) iswblank (0); + /* Check that the isw* functions map WEOF to 0. */ + ASSERT (!iswblank (e)); + + return 0; +} diff -r 93b787ac4b80 -r 00537d144c48 tests/test-wctype-h-c++.cc --- a/tests/test-wctype-h-c++.cc Tue Feb 08 11:20:08 2011 +0100 +++ b/tests/test-wctype-h-c++.cc Sun Feb 06 22:07:24 2011 +0100 @@ -26,7 +26,9 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::iswalnum, int, (wint_t)); SIGNATURE_CHECK (GNULIB_NAMESPACE::iswalpha, int, (wint_t)); +#if GNULIB_TEST_ISWBLANK SIGNATURE_CHECK (GNULIB_NAMESPACE::iswblank, int, (wint_t)); +#endif SIGNATURE_CHECK (GNULIB_NAMESPACE::iswcntrl, int, (wint_t)); SIGNATURE_CHECK (GNULIB_NAMESPACE::iswdigit, int, (wint_t)); SIGNATURE_CHECK (GNULIB_NAMESPACE::iswgraph, int, (wint_t)); diff -r 93b787ac4b80 -r 00537d144c48 tests/test-wctype-h.c --- a/tests/test-wctype-h.c Tue Feb 08 11:20:08 2011 +0100 +++ b/tests/test-wctype-h.c Sun Feb 06 22:07:24 2011 +0100 @@ -33,7 +33,6 @@ /* Check that the isw* functions exist as functions or as macros. */ (void) iswalnum (0); (void) iswalpha (0); - (void) iswblank (0); (void) iswcntrl (0); (void) iswdigit (0); (void) iswgraph (0); @@ -47,7 +46,6 @@ /* Check that the isw* functions map WEOF to 0. */ ASSERT (!iswalnum (e)); ASSERT (!iswalpha (e)); - ASSERT (!iswblank (e)); ASSERT (!iswcntrl (e)); ASSERT (!iswdigit (e)); ASSERT (!iswgraph (e));