+2010-03-19 Bruno Haible <bruno@clisp.org>
+
+ wctype: Provide iswblank function.
+ * lib/wctype.in.h (iswblank): Provide a replacement also when iswcntrl
+ exists and is fine.
+ * m4/wctype_h.m4 (gl_WCTYPE_H): Also check whether iswcntrl exists.
+ * modules/wctype (Makefile.am): Substitute HAVE_ISWBLANK.
+ * tests/test-wctype.c (main): Re-enable the iswblank tests.
+ * doc/posix-functions/iswblank.texi: Update.
+
2010-03-19 Bruno Haible <bruno@clisp.org>
Tests of module 'pty' in C++ mode.
Portability problems fixed by Gnulib:
@itemize
@item
+This function is missing on some platforms:
+AIX 4.3.2, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw.
+@item
This function returns 0 for all possible arguments on some platforms:
Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-AIX 4.3.2, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw.
-@item
On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
Linux libc5 has <wctype.h> and the functions but they are broken.
- Assume all 12 functions are implemented the same way, or not at all. */
+ Assume all 11 functions (all isw* except iswblank) are implemented the
+ same way, or not at all. */
#if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
/* IRIX 5.3 has macros but no functions, its isw* macros refer to an
return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
}
-#endif /* ! HAVE_ISWCNTRL || REPLACE_ISWCNTRL */
+#elif ! @HAVE_ISWBLANK@
+/* Only the iswblank function is missing. */
+
+static inline int
+iswblank (wint_t wc)
+{
+ return wc == ' ' || wc == '\t';
+}
+
+#endif
#if defined __MINGW32__
-# wctype_h.m4 serial 5
+# wctype_h.m4 serial 6
dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
HAVE_ISWCNTRL=0
fi
AC_SUBST([HAVE_ISWCNTRL])
+ AC_CHECK_FUNCS_ONCE([iswblank])
+ if test $ac_cv_func_iswblank = yes; then
+ HAVE_ISWBLANK=1
+ else
+ HAVE_ISWBLANK=0
+ fi
+ AC_SUBST([HAVE_ISWBLANK])
AC_CHECK_HEADERS_ONCE([wctype.h])
AC_REQUIRE([AC_C_INLINE])
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
+ -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \
-e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
-e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
-e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
/* Check that the isw* functions exist as functions or as macros. */
(void) iswalnum (0);
(void) iswalpha (0);
-#if 0 /* not portable: missing on mingw */
(void) iswblank (0);
-#endif
(void) iswcntrl (0);
(void) iswdigit (0);
(void) iswgraph (0);
/* Check that the isw* functions map WEOF to 0. */
ASSERT (!iswalnum (e));
ASSERT (!iswalpha (e));
-#if 0 /* not portable: missing on mingw */
ASSERT (!iswblank (e));
-#endif
ASSERT (!iswcntrl (e));
ASSERT (!iswdigit (e));
ASSERT (!iswgraph (e));