Mercurial > hg > octave-lyh > gnulib-hg
changeset 14310:00537d144c48
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 06 Feb 2011 22:07:24 +0100 |
parents | 93b787ac4b80 |
children | fca8886d4520 |
files | ChangeLog NEWS doc/posix-functions/iswblank.texi lib/wctype.in.h m4/iswblank.m4 m4/wctype_h.m4 modules/iswblank modules/iswblank-tests modules/mbchar modules/wctype-h tests/test-iswblank.c tests/test-wctype-h-c++.cc tests/test-wctype-h.c |
diffstat | 13 files changed, 158 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2011-02-06 Bruno Haible <bruno@clisp.org> + + 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 <bruno@clisp.org> di-set tests: Refactor.
--- a/NEWS +++ b/NEWS @@ -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;
--- a/doc/posix-functions/iswblank.texi +++ b/doc/posix-functions/iswblank.texi @@ -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
--- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -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));
new file mode 100644 --- /dev/null +++ b/m4/iswblank.m4 @@ -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 <wctype.h>. + : + else + if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then + dnl Redefine only iswblank. + AC_LIBOBJ([iswblank]) + fi + fi + +])
--- a/m4/wctype_h.m4 +++ b/m4/wctype_h.m4 @@ -1,4 +1,4 @@ -# wctype_h.m4 serial 12 +# wctype_h.m4 serial 13 dnl A placeholder for ISO C99 <wctype.h>, 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 <wctype.h>. : - 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]) +])
new file mode 100644 --- /dev/null +++ b/modules/iswblank @@ -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: +<wctype.h> + +License: +LGPLv2+ + +Maintainer: +Bruno Haible
new file mode 100644 --- /dev/null +++ b/modules/iswblank-tests @@ -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
--- a/modules/mbchar +++ b/modules/mbchar @@ -11,6 +11,7 @@ stdbool wchar wctype-h +iswblank wcwidth memcmp
--- a/modules/wctype-h +++ b/modules/wctype-h @@ -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' \
new file mode 100644 --- /dev/null +++ b/tests/test-iswblank.c @@ -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 <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +#include <wctype.h> + +#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; +}
--- a/tests/test-wctype-h-c++.cc +++ b/tests/test-wctype-h-c++.cc @@ -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));
--- a/tests/test-wctype-h.c +++ b/tests/test-wctype-h.c @@ -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));