+2006-12-23 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix bug reported by Bruno Haible in
+ <http://lists.gnu.org/archive/html/bug-gnulib/2006-12/msg00228.html>
+ where quotearg.c didn't compile on Mac OS X 10.2 because it
+ lacks <wchar.h> and wint_t.
+ * lib/wctype_.h (__wctype_wint_t): New type.
+ Include <stdio.h>, <time.h>, <wchar.h> only if HAVE_WINT_T.
+ (iswalnum, iswalpha, iswblank, iswcntrl, iswdigit, iswgraph):
+ (iswlower, iswprint, iswpunct, iswspace, iswupper, ixwxdigit):
+ Arg is now of type __wctype_wint_t, not wint_t.
+ * m4/wctype.m4 (gl_WCTYPE_H): Require gt_TYPE_WINT_T, and
+ substitute HAVE_WINT_T.
+ * modules/wctype (Files): Add m4/wint_t.m4.
+ (wctype.h): Substitute HAVE_WINT_T.
+
2006-12-23 Bruno Haible <bruno@clisp.org>
* lib/safe-read.h [C++]: Wrap declarations in extern "C".
#ifndef _GL_WCTYPE_H
#define _GL_WCTYPE_H
+#if @HAVE_WINT_T@ - 0
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
<wchar.h>. */
-#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
+# include <stdio.h>
+# include <time.h>
+# include <wchar.h>
+typedef wint_t __wctype_wint_t;
+#else
+typedef int __wctype_wint_t;
+#endif
/* Include the original <wctype.h> if it exists.
BeOS 5 has the functions but no <wctype.h>. */
#if !defined iswalnum && !HAVE_ISWCNTRL
static inline int
-iswalnum (wint_t wc)
+iswalnum (__wctype_wint_t wc)
{
return ((wc >= '0' && wc <= '9')
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
#if !defined iswalpha && !HAVE_ISWCNTRL
static inline int
-iswalpha (wint_t wc)
+iswalpha (__wctype_wint_t wc)
{
return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
}
#if !defined iswblank && !HAVE_ISWCNTRL
static inline int
-iswblank (wint_t wc)
+iswblank (__wctype_wint_t wc)
{
return wc == ' ' || wc == '\t';
}
#if !defined iswcntrl && !HAVE_ISWCNTRL
static inline int
-iswcntrl (wint_t wc)
+iswcntrl (__wctype_wint_t wc)
{
return (wc & ~0x1f) == 0 || wc == 0x7f;
}
#if !defined iswdigit && !HAVE_ISWCNTRL
static inline int
-iswdigit (wint_t wc)
+iswdigit (__wctype_wint_t wc)
{
return wc >= '0' && wc <= '9';
}
#if !defined iswgraph && !HAVE_ISWCNTRL
static inline int
-iswgraph (wint_t wc)
+iswgraph (__wctype_wint_t wc)
{
return wc >= '!' && wc <= '~';
}
#if !defined iswlower && !HAVE_ISWCNTRL
static inline int
-iswlower (wint_t wc)
+iswlower (__wctype_wint_t wc)
{
return wc >= 'a' && wc <= 'z';
}
#if !defined iswprint && !HAVE_ISWCNTRL
static inline int
-iswprint (wint_t wc)
+iswprint (__wctype_wint_t wc)
{
return wc >= ' ' && wc <= '~';
}
#if !defined iswpunct && !HAVE_ISWCNTRL
static inline int
-iswpunct (wint_t wc)
+iswpunct (__wctype_wint_t wc)
{
return (wc >= '!' && wc <= '~'
&& !((wc >= '0' && wc <= '9')
#if !defined iswspace && !HAVE_ISWCNTRL
static inline int
-iswspace (wint_t wc)
+iswspace (__wctype_wint_t wc)
{
return (wc == ' ' || wc == '\t'
|| wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
#if !defined iswupper && !HAVE_ISWCNTRL
static inline int
-iswupper (wint_t wc)
+iswupper (__wctype_wint_t wc)
{
return wc >= 'A' && wc <= 'Z';
}
#if !defined iswxdigit && !HAVE_ISWCNTRL
static inline int
-iswxdigit (wint_t wc)
+iswxdigit (__wctype_wint_t wc)
{
return ((wc >= '0' && wc <= '9')
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));