* lib/mbchar.h: Just include <wctype.h>; the wctype module
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 27 Dec 2006 19:54:25 +0000 (19:54 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 27 Dec 2006 19:54:25 +0000 (19:54 +0000)
handles its gotchas now.
* lib/mbswidth.c: Likewise.
* lib/wcwidth.h: Likewise.
* m4/mbchar.m4 (gl_MBCHAR): Don't bother checking for wctype.h
and iswcntrl; the wctype module does this stuff now.
* m4/mbswidth.m4 (gl_MBSWIDTH): Likewise.
* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Likewise.
* modules/mbchar (Depends-on): Add wctype.
* modules/mbswidth (Depends-on): Likewise.
* modules/wcwidth (Depends-on): Likewise.

ChangeLog
lib/mbchar.h
lib/mbswidth.c
lib/wcwidth.h
m4/mbchar.m4
m4/mbswidth.m4
m4/wcwidth.m4
modules/mbchar
modules/mbswidth
modules/wcwidth

index e2b29683e3ffdb930d8791fe61f5ca23c3bf992d..92ef51babb491ebe4ee04d39888c2e40aa47bc8f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-12-27  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lib/mbchar.h: Just include <wctype.h>; the wctype module
+       handles its gotchas now.
+       * lib/mbswidth.c: Likewise.
+       * lib/wcwidth.h: Likewise.
+       * m4/mbchar.m4 (gl_MBCHAR): Don't bother checking for wctype.h
+       and iswcntrl; the wctype module does this stuff now.
+       * m4/mbswidth.m4 (gl_MBSWIDTH): Likewise.
+       * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Likewise.
+       * modules/mbchar (Depends-on): Add wctype.
+       * modules/mbswidth (Depends-on): Likewise.
+       * modules/wcwidth (Depends-on): Likewise.
+
 2006-12-27  Eric Blake  <ebb9@byu.net>
 
        * lib/fnmatch.c: Reinstate inclusion of <wchar.h>, since this
index a0c2cdcb99fffec4fee358a21ab1b284ce388275..f3e28ef5cad45ec872e4eaa52120335cecc6e601 100644 (file)
 #include <stdio.h>
 #include <time.h>
 #include <wchar.h>
-
-/* BeOS 5 has the functions but no <wctype.h>.  */
-#if HAVE_WCTYPE_H
-# include <wctype.h>
-#endif
-/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
-   Assume all 12 functions are implemented the same way, or not at all.  */
-#if !defined iswalnum && !HAVE_ISWCNTRL
-static inline int
-iswalnum (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')
-         : 0);
-}
-# define iswalnum iswalnum
-#endif
-#if !defined iswalpha && !HAVE_ISWCNTRL
-static inline int
-iswalpha (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'
-         : 0);
-}
-# define iswalpha iswalpha
-#endif
-#if !defined iswblank && !HAVE_ISWCNTRL
-static inline int
-iswblank (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc == ' ' || wc == '\t'
-         : 0);
-}
-# define iswblank iswblank
-#endif
-#if !defined iswcntrl && !HAVE_ISWCNTRL
-static inline int
-iswcntrl (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? (wc & ~0x1f) == 0 || wc == 0x7f
-         : 0);
-}
-# define iswcntrl iswcntrl
-#endif
-#if !defined iswdigit && !HAVE_ISWCNTRL
-static inline int
-iswdigit (wint_t wc)
-{
-  return (wc >= '0' && wc <= '9');
-}
-# define iswdigit iswdigit
-#endif
-#if !defined iswgraph && !HAVE_ISWCNTRL
-static inline int
-iswgraph (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= '!' && wc <= '~'
-         : 1);
-}
-# define iswgraph iswgraph
-#endif
-#if !defined iswlower && !HAVE_ISWCNTRL
-static inline int
-iswlower (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= 'a' && wc <= 'z'
-         : 0);
-}
-# define iswlower iswlower
-#endif
-#if !defined iswprint && !HAVE_ISWCNTRL
-static inline int
-iswprint (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= ' ' && wc <= '~'
-         : 1);
-}
-# define iswprint iswprint
-#endif
-#if !defined iswpunct && !HAVE_ISWCNTRL
-static inline int
-iswpunct (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= '!' && wc <= '~'
-           && !((wc >= '0' && wc <= '9')
-                || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))
-         : 1);
-}
-# define iswpunct iswpunct
-#endif
-#if !defined iswspace && !HAVE_ISWCNTRL
-static inline int
-iswspace (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc == ' ' || wc == '\t'
-           || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'
-         : 0);
-}
-# define iswspace iswspace
-#endif
-#if !defined iswupper && !HAVE_ISWCNTRL
-static inline int
-iswupper (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= 'A' && wc <= 'Z'
-         : 0);
-}
-# define iswupper iswupper
-#endif
-#if !defined iswxdigit && !HAVE_ISWCNTRL
-static inline int
-iswxdigit (wint_t wc)
-{
-  return (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F');
-}
-# define iswxdigit iswxdigit
-#endif
+#include <wctype.h>
 
 #include "wcwidth.h"
 
index a207d0f6e36f6afb226695f650ac4b1604929eb6..1d282b60da863334f941eb4cb010a54548dfcb72 100644 (file)
 #include "wcwidth.h"
 
 /* Get iswcntrl().  */
-#if HAVE_WCTYPE_H
-# include <wctype.h>
-#endif
-#if !defined iswcntrl && !HAVE_ISWCNTRL
-# define iswcntrl(wc) (((wc) & ~0x1f) == 0 || (wc) == 0x7f)
-#endif
+#include <wctype.h>
 
 #ifndef mbsinit
 # if !HAVE_MBSINIT
index 83da8fb0fb71a9617df2934824c8e689a11817fb..389d810a88979505734942013f4afb990e9d1af0 100644 (file)
 # endif
 
 /* Get iswprint.  */
-# if HAVE_WCTYPE_H
-#  include <wctype.h>
-# endif
-# if !defined iswprint && !HAVE_ISWPRINT
-static inline int
-#  if HAVE_WINT_T
-iswprint (wint_t wc)
-#  else
-iswprint (int wc)
-#  endif
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= ' ' && wc <= '~'
-         : 1);
-}
-#  define iswprint iswprint
-# endif
+# include <wctype.h>
 
 # ifndef HAVE_DECL_WCWIDTH
 "this configure-time declaration test was not run"
index f95e9267c32af80f3106c8d1e29340036dd05012..017c56ad447e96271059b31440780a9597ea1411 100644 (file)
@@ -16,8 +16,5 @@ AC_DEFUN([gl_MBCHAR],
   dnl Compile mbchar.c only if HAVE_WCHAR_H.
   if test $ac_cv_header_wchar_h = yes; then
     AC_LIBOBJ([mbchar])
-    dnl Prerequisites of mbchar.h and mbchar.c.
-    AC_CHECK_HEADERS_ONCE([wctype.h])
-    AC_CHECK_FUNCS([iswcntrl])
   fi
 ])
index 5aff74eb5078bf905dc49c3527af2ba915368b7b..462eb0b6ad53f74ac4ef20784c55fb2d5e2b9069 100644 (file)
@@ -9,9 +9,8 @@ dnl From Bruno Haible.
 
 AC_DEFUN([gl_MBSWIDTH],
 [
-  AC_CHECK_HEADERS_ONCE([wchar.h wctype.h])
+  AC_CHECK_HEADERS_ONCE([wchar.h])
   AC_CHECK_FUNCS_ONCE([isascii mbsinit])
-  AC_CHECK_FUNCS([iswcntrl])
   gl_FUNC_MBRTOWC
 
   dnl UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth()
index e8a37f2e4f78563f196245bcbd13fce29ce89d98..7f23e5fed4b9a5da2796d32d09a950dd2f6e0863 100644 (file)
@@ -13,8 +13,8 @@ AC_DEFUN([gl_FUNC_WCWIDTH],
   AC_REQUIRE([gt_TYPE_WCHAR_T])
   AC_REQUIRE([gt_TYPE_WINT_T])
 
-  AC_CHECK_HEADERS_ONCE([wchar.h wctype.h])
-  AC_CHECK_FUNCS_ONCE([iswprint wcwidth])
+  AC_CHECK_HEADERS_ONCE([wchar.h])
+  AC_CHECK_FUNCS_ONCE([wcwidth])
 
   AC_CHECK_DECLS([wcwidth], [], [], [
 /* AIX 3.2.5 declares wcwidth in <string.h>. */
index 9b4b9414edf1f4a3286c75b73a57639e12797b50..1d85ef7697b9e5fa0d87ea23b18aadccf33105a5 100644 (file)
@@ -8,6 +8,7 @@ m4/mbchar.m4
 
 Depends-on:
 stdbool
+wctype
 wcwidth
 
 configure.ac:
@@ -25,4 +26,3 @@ LGPL
 
 Maintainer:
 Bruno Haible
-
index f4b8f7920bb4aadb31e48842d569012c936abd60..6b0e0b2ba5dbd4f97a01c860bb77ccb42b5fd4ec 100644 (file)
@@ -9,6 +9,7 @@ m4/mbrtowc.m4
 m4/mbswidth.m4
 
 Depends-on:
+wctype
 wcwidth
 
 configure.ac:
@@ -25,4 +26,3 @@ GPL
 
 Maintainer:
 Bruno Haible
-
index d236a4866292962e4ecf97f7b5a10389af060720..d10209f1901156c7d1a9eb168ae44b1d7c2cf216 100644 (file)
@@ -8,6 +8,7 @@ m4/wchar_t.m4
 m4/wint_t.m4
 
 Depends-on:
+wctype
 
 configure.ac:
 gl_FUNC_WCWIDTH