From: Bruno Haible Date: Tue, 14 Jan 2003 13:18:25 +0000 (+0000) Subject: Portability to FreeBSD: has wchar_t but no wint_t. X-Git-Tag: v0.12~1179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9ab2b194171676ae8d365f5ef93127fa91b4c1f;p=thirdparty%2Fgettext.git Portability to FreeBSD: has wchar_t but no wint_t. --- diff --git a/ChangeLog b/ChangeLog index d93af6bf7..383671d5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-01-12 Bruno Haible + + Portability to FreeBSD. + * configure.in: Invoke gt_TYPE_WINT_T. + * printf-args.h: Use HAVE_WINT_T, not HAVE_WCHAR_T, to check for + availability of wint_t. + * printf-argc.c: Likewise. + * printf-parse.c: Likewise. + * vasnprintf.c: Likewise. + 2002-12-16 Bruno Haible * configure.in: Add test for . Needed for mingw32. diff --git a/libasprintf/configure.in b/libasprintf/configure.in index a7759af96..e0595c3a3 100644 --- a/libasprintf/configure.in +++ b/libasprintf/configure.in @@ -32,6 +32,7 @@ AC_TYPE_SIZE_T gt_TYPE_LONGLONG gt_TYPE_LONGDOUBLE gt_TYPE_WCHAR_T +gt_TYPE_WINT_T AC_CHECK_TYPES(ptrdiff_t) gt_TYPE_INTMAX_T diff --git a/libasprintf/printf-args.c b/libasprintf/printf-args.c index 85731302c..f39197402 100644 --- a/libasprintf/printf-args.c +++ b/libasprintf/printf-args.c @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -78,7 +78,7 @@ printf_fetchargs (va_list args, arguments *a) case TYPE_CHAR: ap->a.a_char = va_arg (args, int); break; -#ifdef HAVE_WCHAR_T +#ifdef HAVE_WINT_T case TYPE_WIDE_CHAR: ap->a.a_wide_char = va_arg (args, wint_t); break; diff --git a/libasprintf/printf-args.h b/libasprintf/printf-args.h index 5fcbb2ced..35114a8fa 100644 --- a/libasprintf/printf-args.h +++ b/libasprintf/printf-args.h @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -19,8 +19,13 @@ #ifndef _PRINTF_ARGS_H #define _PRINTF_ARGS_H -/* Get wint_t. */ +/* Get wchar_t. */ #ifdef HAVE_WCHAR_T +# include +#endif + +/* Get wint_t. */ +#ifdef HAVE_WINT_T # include #endif @@ -49,7 +54,7 @@ typedef enum TYPE_LONGDOUBLE, #endif TYPE_CHAR, -#ifdef HAVE_WCHAR_T +#ifdef HAVE_WINT_T TYPE_WIDE_CHAR, #endif TYPE_STRING, @@ -90,7 +95,7 @@ typedef struct long double a_longdouble; #endif int a_char; -#ifdef HAVE_WCHAR_T +#ifdef HAVE_WINT_T wint_t a_wide_char; #endif const char* a_string; diff --git a/libasprintf/printf-parse.c b/libasprintf/printf-parse.c index 45ed1b60d..bdfe88fe8 100644 --- a/libasprintf/printf-parse.c +++ b/libasprintf/printf-parse.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -380,7 +380,7 @@ printf_parse (const char *format, char_directives *d, arguments *a) break; case 'c': if (flags >= 8) -#ifdef HAVE_WCHAR_T +#ifdef HAVE_WINT_T type = TYPE_WIDE_CHAR; #else goto error; @@ -388,7 +388,7 @@ printf_parse (const char *format, char_directives *d, arguments *a) else type = TYPE_CHAR; break; -#ifdef HAVE_WCHAR_T +#ifdef HAVE_WINT_T case 'C': type = TYPE_WIDE_CHAR; c = 'c'; diff --git a/libasprintf/vasnprintf.c b/libasprintf/vasnprintf.c index 806cc088d..e2c1b1a9c 100644 --- a/libasprintf/vasnprintf.c +++ b/libasprintf/vasnprintf.c @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -357,7 +357,7 @@ vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) break; case 'c': -# ifdef HAVE_WCHAR_T +# ifdef HAVE_WINT_T if (type == TYPE_WIDE_CHAR) tmp_length = MB_CUR_MAX; else @@ -452,8 +452,10 @@ vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) #endif case TYPE_LONGINT: case TYPE_ULONGINT: -#ifdef HAVE_WCHAR_T +#ifdef HAVE_WINT_T case TYPE_WIDE_CHAR: +#endif +#ifdef HAVE_WCHAR_T case TYPE_WIDE_STRING: #endif *p++ = 'l'; @@ -630,7 +632,7 @@ vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) SNPRINTF_BUF (arg); } break; -#ifdef HAVE_WCHAR_T +#ifdef HAVE_WINT_T case TYPE_WIDE_CHAR: { wint_t arg = a.arg[dp->arg_index].a.a_wide_char; diff --git a/m4/ChangeLog b/m4/ChangeLog index 6c602ecf1..884e489f4 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,8 @@ +2003-01-12 Bruno Haible + + * wint_t.m4: New file. + * Makefile.am (EXTRA_DIST): Add it. + 2003-01-08 Bruno Haible * gettext.m4 (AM_PO_SUBDIRS): Avoid warning when there are at least diff --git a/m4/Makefile.am b/m4/Makefile.am index baf0a2be6..b22a795fc 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -14,4 +14,4 @@ javaexec.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 libtool.m4 \ longdouble.m4 longlong.m4 mbrtowc.m4 mbstate_t.m4 mbswidth.m4 mkdtemp.m4 \ progtest.m4 setenv.m4 setlocale.m4 siginfo.m4 signalblocking.m4 signed.m4 \ ssize_t.m4 stdbool.m4 stdint_h.m4 tmpdir.m4 uintmax_t.m4 ulonglong.m4 \ -unionwait.m4 wchar_t.m4 +unionwait.m4 wchar_t.m4 wint_t.m4 diff --git a/m4/wint_t.m4 b/m4/wint_t.m4 new file mode 100644 index 000000000..9ed3c98a1 --- /dev/null +++ b/m4/wint_t.m4 @@ -0,0 +1,22 @@ +# wint_t.m4 serial 1 +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether has the 'wint_t' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WINT_T], +[ + AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, + [AC_TRY_COMPILE([#include + wint_t foo = (wchar_t)'\0';], , + gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) + if test $gt_cv_c_wint_t = yes; then + AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) + fi +])