+2003-07-29 Matthias Clasen <maclas@gmx.de>
+
+ Replace trio printf() by gnulib vasnprintf(): (#101874)
+
+ * configure.in: Define HAVE_LONG_LONG_FORMAT if system printf understands %llu; rename enable_trio to
+ enable_included_printf; add misc. tests needed for gnulib vasnprintf(); define G_GINT{16,32,64}_MODIFIER
+ in glibconfig.h.
+
+ * acinclude.m4: Misc tests needed for gnulib vasnprintf(): AC_FUNC_SNPRINTF_C99, bh_C_SIGNED, jm_AC_TYPE_LONG_LONG,
+ gt_TYPE_LONGDOUBLE, gt_TYPE_WCHAR_T, gt_TYPE_WINT_T, gt_AC_TYPE_INTMAX_T, jm_AC_HEADER_STDINT_H,
+ jm_AC_HEADER_INTTYPES_H.
+
+ * glib/Makefile.am: Replace TRIO_SUBDIR by PRINTF_SUBDIR and trio_libtrio_la by printf_la.
+
+ * glib/gprintfint.h: Include gnulib/printf.h and use _g_gnulib_ functions instead of _g_trio_ functions.
+
+ * glib/trio/*: Removed
+
+ * glib/gnulib/*: vasnprintf() implementation from gnulib, patched to live in the _g_gnulib namespace, use
+ g_malloc instead of malloc, and support long long printing even if system printf doesn't. For more details,
+ see glib/gnulib/README.
+
+ * tests/printf-test.c: Add tests for 64 bit printing.
+
2003-07-28 Matthias Clasen <maclas@gmx.de>
* glib/gfileutils.h:
+2003-07-29 Matthias Clasen <maclas@gmx.de>
+
+ Replace trio printf() by gnulib vasnprintf(): (#101874)
+
+ * configure.in: Define HAVE_LONG_LONG_FORMAT if system printf understands %llu; rename enable_trio to
+ enable_included_printf; add misc. tests needed for gnulib vasnprintf(); define G_GINT{16,32,64}_MODIFIER
+ in glibconfig.h.
+
+ * acinclude.m4: Misc tests needed for gnulib vasnprintf(): AC_FUNC_SNPRINTF_C99, bh_C_SIGNED, jm_AC_TYPE_LONG_LONG,
+ gt_TYPE_LONGDOUBLE, gt_TYPE_WCHAR_T, gt_TYPE_WINT_T, gt_AC_TYPE_INTMAX_T, jm_AC_HEADER_STDINT_H,
+ jm_AC_HEADER_INTTYPES_H.
+
+ * glib/Makefile.am: Replace TRIO_SUBDIR by PRINTF_SUBDIR and trio_libtrio_la by printf_la.
+
+ * glib/gprintfint.h: Include gnulib/printf.h and use _g_gnulib_ functions instead of _g_trio_ functions.
+
+ * glib/trio/*: Removed
+
+ * glib/gnulib/*: vasnprintf() implementation from gnulib, patched to live in the _g_gnulib namespace, use
+ g_malloc instead of malloc, and support long long printing even if system printf doesn't. For more details,
+ see glib/gnulib/README.
+
+ * tests/printf-test.c: Add tests for 64 bit printing.
+
2003-07-28 Matthias Clasen <maclas@gmx.de>
* glib/gfileutils.h:
+2003-07-29 Matthias Clasen <maclas@gmx.de>
+
+ Replace trio printf() by gnulib vasnprintf(): (#101874)
+
+ * configure.in: Define HAVE_LONG_LONG_FORMAT if system printf understands %llu; rename enable_trio to
+ enable_included_printf; add misc. tests needed for gnulib vasnprintf(); define G_GINT{16,32,64}_MODIFIER
+ in glibconfig.h.
+
+ * acinclude.m4: Misc tests needed for gnulib vasnprintf(): AC_FUNC_SNPRINTF_C99, bh_C_SIGNED, jm_AC_TYPE_LONG_LONG,
+ gt_TYPE_LONGDOUBLE, gt_TYPE_WCHAR_T, gt_TYPE_WINT_T, gt_AC_TYPE_INTMAX_T, jm_AC_HEADER_STDINT_H,
+ jm_AC_HEADER_INTTYPES_H.
+
+ * glib/Makefile.am: Replace TRIO_SUBDIR by PRINTF_SUBDIR and trio_libtrio_la by printf_la.
+
+ * glib/gprintfint.h: Include gnulib/printf.h and use _g_gnulib_ functions instead of _g_trio_ functions.
+
+ * glib/trio/*: Removed
+
+ * glib/gnulib/*: vasnprintf() implementation from gnulib, patched to live in the _g_gnulib namespace, use
+ g_malloc instead of malloc, and support long long printing even if system printf doesn't. For more details,
+ see glib/gnulib/README.
+
+ * tests/printf-test.c: Add tests for 64 bit printing.
+
2003-07-28 Matthias Clasen <maclas@gmx.de>
* glib/gfileutils.h:
+2003-07-29 Matthias Clasen <maclas@gmx.de>
+
+ Replace trio printf() by gnulib vasnprintf(): (#101874)
+
+ * configure.in: Define HAVE_LONG_LONG_FORMAT if system printf understands %llu; rename enable_trio to
+ enable_included_printf; add misc. tests needed for gnulib vasnprintf(); define G_GINT{16,32,64}_MODIFIER
+ in glibconfig.h.
+
+ * acinclude.m4: Misc tests needed for gnulib vasnprintf(): AC_FUNC_SNPRINTF_C99, bh_C_SIGNED, jm_AC_TYPE_LONG_LONG,
+ gt_TYPE_LONGDOUBLE, gt_TYPE_WCHAR_T, gt_TYPE_WINT_T, gt_AC_TYPE_INTMAX_T, jm_AC_HEADER_STDINT_H,
+ jm_AC_HEADER_INTTYPES_H.
+
+ * glib/Makefile.am: Replace TRIO_SUBDIR by PRINTF_SUBDIR and trio_libtrio_la by printf_la.
+
+ * glib/gprintfint.h: Include gnulib/printf.h and use _g_gnulib_ functions instead of _g_trio_ functions.
+
+ * glib/trio/*: Removed
+
+ * glib/gnulib/*: vasnprintf() implementation from gnulib, patched to live in the _g_gnulib namespace, use
+ g_malloc instead of malloc, and support long long printing even if system printf doesn't. For more details,
+ see glib/gnulib/README.
+
+ * tests/printf-test.c: Add tests for 64 bit printing.
+
2003-07-28 Matthias Clasen <maclas@gmx.de>
* glib/gfileutils.h:
+2003-07-29 Matthias Clasen <maclas@gmx.de>
+
+ Replace trio printf() by gnulib vasnprintf(): (#101874)
+
+ * configure.in: Define HAVE_LONG_LONG_FORMAT if system printf understands %llu; rename enable_trio to
+ enable_included_printf; add misc. tests needed for gnulib vasnprintf(); define G_GINT{16,32,64}_MODIFIER
+ in glibconfig.h.
+
+ * acinclude.m4: Misc tests needed for gnulib vasnprintf(): AC_FUNC_SNPRINTF_C99, bh_C_SIGNED, jm_AC_TYPE_LONG_LONG,
+ gt_TYPE_LONGDOUBLE, gt_TYPE_WCHAR_T, gt_TYPE_WINT_T, gt_AC_TYPE_INTMAX_T, jm_AC_HEADER_STDINT_H,
+ jm_AC_HEADER_INTTYPES_H.
+
+ * glib/Makefile.am: Replace TRIO_SUBDIR by PRINTF_SUBDIR and trio_libtrio_la by printf_la.
+
+ * glib/gprintfint.h: Include gnulib/printf.h and use _g_gnulib_ functions instead of _g_trio_ functions.
+
+ * glib/trio/*: Removed
+
+ * glib/gnulib/*: vasnprintf() implementation from gnulib, patched to live in the _g_gnulib namespace, use
+ g_malloc instead of malloc, and support long long printing even if system printf doesn't. For more details,
+ see glib/gnulib/README.
+
+ * tests/printf-test.c: Add tests for 64 bit printing.
+
2003-07-28 Matthias Clasen <maclas@gmx.de>
* glib/gfileutils.h:
+2003-07-29 Matthias Clasen <maclas@gmx.de>
+
+ Replace trio printf() by gnulib vasnprintf(): (#101874)
+
+ * configure.in: Define HAVE_LONG_LONG_FORMAT if system printf understands %llu; rename enable_trio to
+ enable_included_printf; add misc. tests needed for gnulib vasnprintf(); define G_GINT{16,32,64}_MODIFIER
+ in glibconfig.h.
+
+ * acinclude.m4: Misc tests needed for gnulib vasnprintf(): AC_FUNC_SNPRINTF_C99, bh_C_SIGNED, jm_AC_TYPE_LONG_LONG,
+ gt_TYPE_LONGDOUBLE, gt_TYPE_WCHAR_T, gt_TYPE_WINT_T, gt_AC_TYPE_INTMAX_T, jm_AC_HEADER_STDINT_H,
+ jm_AC_HEADER_INTTYPES_H.
+
+ * glib/Makefile.am: Replace TRIO_SUBDIR by PRINTF_SUBDIR and trio_libtrio_la by printf_la.
+
+ * glib/gprintfint.h: Include gnulib/printf.h and use _g_gnulib_ functions instead of _g_trio_ functions.
+
+ * glib/trio/*: Removed
+
+ * glib/gnulib/*: vasnprintf() implementation from gnulib, patched to live in the _g_gnulib namespace, use
+ g_malloc instead of malloc, and support long long printing even if system printf doesn't. For more details,
+ see glib/gnulib/README.
+
+ * tests/printf-test.c: Add tests for 64 bit printing.
+
2003-07-28 Matthias Clasen <maclas@gmx.de>
* glib/gfileutils.h:
])# AC_FUNC_VSNPRINTF_C99
+dnl @synopsis AC_FUNC_SNPRINTF_C99
+dnl
+dnl Check whether there is a snprintf() function with C99 semantics installed.
+dnl
+AC_DEFUN([AC_FUNC_SNPRINTF_C99],
+[AC_CACHE_CHECK(for C99 snprintf,
+ ac_cv_func_snprintf_c99,
+[AC_TRY_RUN(
+[#include <stdio.h>
+#include <stdarg.h>
+
+int
+doit()
+{
+ char buffer[32];
+ va_list args;
+ int r;
+
+ r = snprintf(buffer, 5, "1234567");
+
+ if (r != 7)
+ exit(1);
+
+ exit(0);
+}
+
+int
+main(void)
+{
+ doit();
+ exit(1);
+}], ac_cv_func_snprintf_c99=yes, ac_cv_func_snprintf_c99=no, ac_cv_func_snprintf_c99=no)])
+dnl Note that the default is to be pessimistic in the case of cross compilation.
+dnl If you know that the target has a C99 snprintf(), you can get around this
+dnl by setting ac_func_snprintf_c99 to yes, as described in the Autoconf manual.
+if test $ac_cv_func_snprintf_c99 = yes; then
+ AC_DEFINE(HAVE_C99_SNPRINTF, 1,
+ [Define if you have a version of the snprintf function
+ with semantics as specified by the ISO C99 standard.])
+fi
+])# AC_FUNC_SNPRINTF_C99
+
+
dnl @synopsis AC_FUNC_PRINTF_UNIX98
dnl
dnl Check whether the printf() family supports Unix98 %n$ positional parameters
])
+# signed.m4 serial 1 (gettext-0.10.40)
+dnl Copyright (C) 2001-2002 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.
+
+AC_DEFUN([bh_C_SIGNED],
+[
+ AC_CACHE_CHECK([for signed], bh_cv_c_signed,
+ [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
+ if test $bh_cv_c_signed = no; then
+ AC_DEFINE(signed, ,
+ [Define to empty if the C compiler doesn't support this keyword.])
+ fi
+])
+
+
+# longlong.m4 serial 4
+dnl Copyright (C) 1999-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 Paul Eggert.
+
+# Define HAVE_LONG_LONG if 'long long' works.
+
+AC_DEFUN([jm_AC_TYPE_LONG_LONG],
+[
+ AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
+ [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
+ [long long llmax = (long long) -1;
+ return ll << i | ll >> i | llmax / ll | llmax % ll;],
+ ac_cv_type_long_long=yes,
+ ac_cv_type_long_long=no)])
+ if test $ac_cv_type_long_long = yes; then
+ AC_DEFINE(HAVE_LONG_LONG, 1,
+ [Define if you have the 'long long' type.])
+ fi
+])
+
+
+# longdouble.m4 serial 1 (gettext-0.11.6)
+dnl Copyright (C) 2002 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 the compiler supports the 'long double' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_LONGDOUBLE],
+[
+ AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
+ [if test "$GCC" = yes; then
+ gt_cv_c_long_double=yes
+ else
+ AC_TRY_COMPILE([
+ /* The Stardent Vistra knows sizeof(long double), but does not support it. */
+ long double foo = 0.0;
+ /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
+ int array [2*(sizeof(long double) >= sizeof(double)) - 1];
+ ], ,
+ gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
+ fi])
+ if test $gt_cv_c_long_double = yes; then
+ AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
+ fi
+])
+
+
+
+# wchar_t.m4 serial 1 (gettext-0.11.6)
+dnl Copyright (C) 2002 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 <stddef.h> has the 'wchar_t' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_WCHAR_T],
+[
+ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
+ [AC_TRY_COMPILE([#include <stddef.h>
+ wchar_t foo = (wchar_t)'\0';], ,
+ gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
+ if test $gt_cv_c_wchar_t = yes; then
+ AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
+ fi
+])
+
+
+# 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 <wchar.h> 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 <wchar.h>
+ 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
+])
+
+
+# intmax_t.m4 serial 1
+dnl Copyright (C) 1997-2002 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 Paul Eggert.
+
+AC_PREREQ(2.13)
+
+# Define intmax_t to 'long' or 'long long'
+# if it is not already defined in <stdint.h> or <inttypes.h>.
+
+AC_DEFUN([jm_AC_TYPE_INTMAX_T],
+[
+ dnl For simplicity, we assume that a header file defines 'intmax_t' if and
+ dnl only if it defines 'uintmax_t'.
+ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
+ AC_REQUIRE([jm_AC_HEADER_STDINT_H])
+ if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
+ AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
+ test $ac_cv_type_long_long = yes \
+ && ac_type='long long' \
+ || ac_type='long'
+ AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
+ [Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
+ else
+ AC_DEFINE(HAVE_INTMAX_T, 1,
+ [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
+ fi
+])
+
+dnl An alternative would be to explicitly test for 'intmax_t'.
+
+AC_DEFUN([gt_AC_TYPE_INTMAX_T],
+[
+ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
+ AC_REQUIRE([jm_AC_HEADER_STDINT_H])
+ AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
+ [AC_TRY_COMPILE([
+#include <stddef.h>
+#include <stdlib.h>
+#if HAVE_STDINT_H_WITH_UINTMAX
+#include <stdint.h>
+#endif
+#if HAVE_INTTYPES_H_WITH_UINTMAX
+#include <inttypes.h>
+#endif
+], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
+ if test $gt_cv_c_intmax_t = yes; then
+ AC_DEFINE(HAVE_INTMAX_T, 1,
+ [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
+ else
+ AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
+ test $ac_cv_type_long_long = yes \
+ && ac_type='long long' \
+ || ac_type='long'
+ AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
+ [Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
+ fi
+])
+
+
+# stdint_h.m4 serial 3 (gettext-0.11.6)
+dnl Copyright (C) 1997-2002 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 Paul Eggert.
+
+# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN([jm_AC_HEADER_STDINT_H],
+[
+ AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
+ [AC_TRY_COMPILE(
+ [#include <sys/types.h>
+#include <stdint.h>],
+ [uintmax_t i = (uintmax_t) -1;],
+ jm_ac_cv_header_stdint_h=yes,
+ jm_ac_cv_header_stdint_h=no)])
+ if test $jm_ac_cv_header_stdint_h = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
+ [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
+ and declares uintmax_t. ])
+ fi
+])
+
+
+# inttypes_h.m4 serial 5 (gettext-0.11.6)
+dnl Copyright (C) 1997-2002 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 Paul Eggert.
+
+# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
+[
+ AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
+ [AC_TRY_COMPILE(
+ [#include <sys/types.h>
+#include <inttypes.h>],
+ [uintmax_t i = (uintmax_t) -1;],
+ jm_ac_cv_header_inttypes_h=yes,
+ jm_ac_cv_header_inttypes_h=no)])
+ if test $jm_ac_cv_header_inttypes_h = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
+ [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
+ and declares uintmax_t. ])
+ fi
+])
+
done])
if test -n "$glib_cv_long_long_format"; then
AC_MSG_RESULT(%${glib_cv_long_long_format}u)
+ AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
else
AC_MSG_RESULT(none)
fi
# We know this is MSVC, and what the formats are
glib_cv_long_long_format=I64
AC_MSG_RESULT(%${glib_cv_long_long_format}u)
+ AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
fi
dnl long doubles were not used, and a portability problem
AC_FUNC_PRINTF_UNIX98
#
-# Check whether to use trio printf
+# Check whether to use an included printf
#
AC_ARG_ENABLE(included-printf,
[AC_HELP_STRING([--enable-included-printf],
[use included printf [default=auto]])],
- enable_trio="$enableval")
+ enable_included_printf="$enableval")
-need_trio=no
-if test "x$enable_trio" = "xyes" ; then
- need_trio=yes
+need_included_printf=no
+if test "x$enable_included_printf" = "xyes" ; then
+ need_included_printf=yes
fi
if test "$ac_cv_func_vsnprintf_c99" != "yes" ; then
- need_trio=yes
+ need_included_printf=yes
fi
if test "$ac_cv_func_printf_unix98" != "yes" ; then
- need_trio=yes
+ need_included_printf=yes
fi
if test "x$ac_cv_sizeof_long_long" = "x8" &&
test -z "$glib_cv_long_long_format" ; then
- need_trio=yes
+ need_included_printf=yes
fi
-if test "x$enable_trio" = "xno" &&
- test "x$need_trio" = "xyes" ; then
+if test "x$enable_included_printf" = "xno" &&
+ test "x$need_included_printf" = "xyes" ; then
AC_MSG_ERROR([
*** Your C library's printf doesn't appear to have the features that
*** GLib needs, but you specified --enable-included-printf=no.])
fi
-enable_trio=$need_trio
+enable_included_printf=$need_included_printf
-AM_CONDITIONAL(HAVE_GOOD_PRINTF, test "$enable_trio" != "yes")
-if test "$enable_trio" != "yes" ; then
+AM_CONDITIONAL(HAVE_GOOD_PRINTF, test "$enable_included_printf" != "yes")
+if test "$enable_included_printf" != "yes" ; then
AC_DEFINE(HAVE_GOOD_PRINTF,1,[define to use system printf])
else
glib_cv_long_long_format="ll"
AC_DEFINE(HAVE_VASPRINTF,1)
AC_DEFINE(HAVE_C99_VSNPRINTF,1)
+ AC_DEFINE(HAVE_C99_SNPRINTF,1)
AC_DEFINE(HAVE_UNIX98_PRINTF,1)
- if test "$glib_native_win32" != "yes" ; then
- TRIO_LIBS=-lm
- fi
fi
-AC_SUBST(TRIO_LIBS)
+
+# Checks needed for gnulib vasnprintf
+bh_C_SIGNED
+jm_AC_TYPE_LONG_LONG
+gt_TYPE_LONGDOUBLE
+gt_TYPE_WCHAR_T
+gt_TYPE_WINT_T
+AC_TYPE_SIZE_T
+AC_CHECK_TYPES(ptrdiff_t)
+jm_AC_TYPE_INTMAX_T
+AC_CHECK_FUNCS(snprintf)
+AC_FUNC_SNPRINTF_C99
# Check if bcopy can be used for overlapping copies, if memmove isn't found.
# The check is borrowed from the PERL Configure script.
cat >>$outfile <<_______EOF
typedef signed $gint16 gint16;
typedef unsigned $gint16 guint16;
+#define G_GINT16_MODIFIER $gint16_modifier
#define G_GINT16_FORMAT $gint16_format
#define G_GUINT16_FORMAT $guint16_format
_______EOF
cat >>$outfile <<_______EOF
typedef signed $gint32 gint32;
typedef unsigned $gint32 guint32;
+#define G_GINT32_MODIFIER $gint32_modifier
#define G_GINT32_FORMAT $gint32_format
#define G_GUINT32_FORMAT $guint32_format
_______EOF
if test x$gint64_format != x ; then
cat >>$outfile <<_______EOF
+#define G_GINT64_MODIFIER $gint64_modifier
#define G_GINT64_FORMAT $gint64_format
#define G_GUINT64_FORMAT $guint64_format
_______EOF
else
cat >>$outfile <<_______EOF
+#undef G_GINT64_MODIFIER
#undef G_GINT64_FORMAT
#undef G_GUINT64_FORMAT
_______EOF
case 2 in
$ac_cv_sizeof_short)
gint16=short
+ gint16_modifier='"h"'
gint16_format='"hi"'
guint16_format='"hu"'
;;
$ac_cv_sizeof_int)
gint16=int
+ gint16_modifier='""'
gint16_format='"i"'
guint16_format='"u"'
;;
case 4 in
$ac_cv_sizeof_short)
gint32=short
+ gint32_modifier='"h"'
gint32_format='"hi"'
guint32_format='"hu"'
;;
$ac_cv_sizeof_int)
gint32=int
+ gint32_modifier='""'
gint32_format='"i"'
guint32_format='"u"'
;;
$ac_cv_sizeof_long)
gint32=long
+ gint32_modifier='"l"'
gint32_format='"li"'
guint32_format='"lu"'
;;
case 8 in
$ac_cv_sizeof_int)
gint64=int
+ gint64_modifier='""'
gint64_format='"i"'
guint64_format='"u"'
glib_extension=
;;
$ac_cv_sizeof_long)
gint64=long
+ gint64_modifier='"l"'
gint64_format='"li"'
guint64_format='"lu"'
glib_extension=
$ac_cv_sizeof_long_long)
gint64='long long'
if test -n "$glib_cv_long_long_format"; then
+ gint64_modifier='"'$glib_cv_long_long_format'"'
gint64_format='"'$glib_cv_long_long_format'i"'
guint64_format='"'$glib_cv_long_long_format'u"'
fi
$ac_cv_sizeof___int64)
gint64='__int64'
if test -n "$glib_cv_long_long_format"; then
+ gint64_modifier='"'$glib_cv_long_long_format'"'
gint64_format='"'$glib_cv_long_long_format'i"'
guint64_format='"'$glib_cv_long_long_format'u"'
fi
build/win32/dirent/Makefile
glib/Makefile
glib/libcharset/Makefile
-glib/trio/Makefile
+glib/gnulib/Makefile
gmodule/Makefile
gmodule/gmoduleconf.h
gobject/Makefile
+2003-07-29 Matthias Clasen <maclas@gmx.de>
+
+ * glib/tmpl/macros_misc.sgml: Document G_GINT{16,32,64}_MODIFIER, add note about scanning.
+
+ * glib/glib-sections.txt: Add G_GINT{16,32,64}_MODIFIER.
+
2003-07-28 Matthias Clasen <maclas@gmx.de>
* glib/glib-sections.txt: Add g_setenv(), g_unsetenv() and g_read_link(). (#100763, #72545)
G_STRLOC
<SUBSECTION>
+G_GINT16_MODIFIER
G_GINT16_FORMAT
G_GUINT16_FORMAT
+G_GINT32_MODIFIER
G_GINT32_FORMAT
G_GUINT32_FORMAT
+G_GINT64_MODIFIER
G_GINT64_FORMAT
G_GUINT64_FORMAT
+<!-- ##### MACRO G_GINT16_MODIFIER ##### -->
+<para>
+The platform dependent length modifier for constructing printf() conversion
+specifiers for values of type #gint16. It is a string literal, but doesn't
+include the percent-sign, such that you can add precision and length
+modifiers between percent-sign and conversion specifier and append a
+conversion specifier.
+</para>
+
+<para>
+The following example prints "0x7b";
+<informalexample>
+<programlisting>
+gint16 value = 123;
+g_print ("%#" G_GINT16_MODIFIER "x", value);
+</programlisting>
+</informalexample>
+</para>
+
+@Since: 2.4
+
+
<!-- ##### MACRO G_GINT16_FORMAT ##### -->
<para>
This is the platform dependent conversion specifier for scanning and
+<!-- ##### MACRO G_GINT32_MODIFIER ##### -->
+<para>
+The platform dependent length modifier for constructing printf() conversion
+specifiers for values of type #gint32. See also #G_GINT16_MODIFIER.
+</para>
+
+@Since: 2.4
+
<!-- ##### MACRO G_GINT32_FORMAT ##### -->
<para>
This is the platform dependent conversion specifier for scanning and
+<!-- ##### MACRO G_GINT64_MODIFIER ##### -->
+<para>
+The platform dependent length modifier for constructing printf() conversion
+specifiers for values of type #gint32. See also #G_GINT16_MODIFIER.
+</para>
+
+<note>
+<para>
+Some platforms do not support printing 64 bit integers,
+even though the types are supported. On such platforms #G_GINT64_MODIFIER
+is not defined.
+</para>
+</note>
+
+@Since: 2.4
+
<!-- ##### MACRO G_GINT64_FORMAT ##### -->
<para>
This is the platform dependent conversion specifier for scanning and
<para>
Some platforms do not support scanning and printing 64 bit integers,
even though the types are supported. On such platforms #G_GINT64_FORMAT
-is not defined.
+is not defined. Note that scanf() may not support 64 bit integers, even
+if #G_GINT64_FORMAT is defined. Due to its weak error handling, scanf() is not
+recommended for parsing anyway; consider using g_strtoull() instead.
</para>
</note>
<para>
Some platforms do not support scanning and printing 64 bit integers,
even though the types are supported. On such platforms #G_GUINT64_FORMAT
-is not defined.
+is not defined. Note that scanf() may not support 64 bit integers, even
+if #G_GINT64_FORMAT is defined. Due to its weak error handling, scanf() is not
+recommended for parsing anyway; consider using g_strtoull() instead.
</para>
</note>
if HAVE_GOOD_PRINTF
else
-TRIO_SUBDIR = trio
-trio_libtrio_la = trio/libtrio.la
+PRINTF_SUBDIR = gnulib
+printf_la = gnulib/libgnulib.la
endif
-SUBDIRS = libcharset $(TRIO_SUBDIR)
+SUBDIRS = libcharset $(PRINTF_SUBDIR)
-DIST_SUBDIRS = libcharset trio
+DIST_SUBDIRS = libcharset gnulib
INCLUDES = -I$(top_srcdir) -DG_LOG_DOMAIN=\"GLib\" \
$(GLIB_DEBUG_FLAGS) -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION
uninstall-libtool-import-lib:
endif
-libglib_2_0_la_LIBADD = libcharset/libcharset.la $(trio_libtrio_la) $(GIO) $(GSPAWN) $(PLATFORMDEP) $(G_LIB_WIN32_RESOURCE) $(ICONV_LIBS) $(G_LIBS_EXTRA)
-libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(trio_libtrio_la) $(GIO) $(GSPAWN) $(PLATFORMDEP) $(G_LIB_WIN32_RESOURCE) $(GLIB_DEF)
+libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @G_LIB_WIN32_RESOURCE@ @ICONV_LIBS@ @G_LIBS_EXTRA@
+libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @G_LIB_WIN32_RESOURCE@ @GLIB_DEF@
libglib_2_0_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
#else
-#include "trio/glibtrio.h"
-#include "trio/trio.h"
+#include "gnulib/printf.h"
-#define _g_printf _g_trio_printf
-#define _g_fprintf _g_trio_fprintf
-#define _g_sprintf _g_trio_sprintf
-#define _g_snprintf _g_trio_snprintf
+#define _g_printf _g_gnulib_printf
+#define _g_fprintf _g_gnulib_fprintf
+#define _g_sprintf _g_gnulib_sprintf
+#define _g_snprintf _g_gnulib_snprintf
-#define _g_vprintf _g_trio_vprintf
-#define _g_vfprintf _g_trio_vfprintf
-#define _g_vsprintf _g_trio_vsprintf
-#define _g_vsnprintf _g_trio_vsnprintf
+#define _g_vprintf _g_gnulib_vprintf
+#define _g_vfprintf _g_gnulib_vfprintf
+#define _g_vsprintf _g_gnulib_vsprintf
+#define _g_vsnprintf _g_gnulib_vsnprintf
-#define _g_vasprintf _g_trio_vasprintf
+#define _g_vasprintf _g_gnulib_vasprintf
#endif
else \
g_print ("(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), message ? (gchar*)message : ""); \
fflush (stdout); \
- any_failed = TRUE; \
+ any_failed; \
} \
} G_STMT_END
char *argv[])
{
gchar buf[128];
- long l;
int i;
+ long l;
/* truncation and return value */
TEST (NULL, g_snprintf (buf, 0, "abc") == 3);
TEST (NULL, g_snprintf (buf, 128, "%1$*2$.*3$s", "abc", 5, 2) == 5 && !strcmp (buf, " ab"));
TEST (NULL, g_snprintf (buf, 128, "%1$s%1$s", "abc") == 6 && !strcmp (buf, "abcabc"));
+ /* 64 bit support */
+ TEST (NULL, g_snprintf (buf, 128, "%" G_GINT64_FORMAT, (gint64)123456) == 6 && !strcmp (buf, "123456"));
+ TEST (NULL, g_snprintf (buf, 128, "%" G_GINT64_FORMAT, (gint64)-123456) == 7 && !strcmp (buf, "-123456"));
+ TEST (NULL, g_snprintf (buf, 128, "%" G_GUINT64_FORMAT, (guint64)123456) == 6 && !strcmp (buf, "123456"));
+ TEST (NULL, g_snprintf (buf, 128, "%" G_GINT64_MODIFIER "o", (gint64)123456) == 6 && !strcmp (buf, "361100"));
+ TEST (NULL, g_snprintf (buf, 128, "%#" G_GINT64_MODIFIER "o", (gint64)123456) == 7 && !strcmp (buf, "0361100"));
+ TEST (NULL, g_snprintf (buf, 128, "%" G_GINT64_MODIFIER "x", (gint64)123456) == 5 && !strcmp (buf, "1e240"));
+ TEST (NULL, g_snprintf (buf, 128, "%#" G_GINT64_MODIFIER "x", (gint64)123456) == 7 && !strcmp (buf, "0x1e240"));
+ TEST (NULL, g_snprintf (buf, 128, "%" G_GINT64_MODIFIER "X", (gint64)123456) == 5 && !strcmp (buf, "1E240"));
+
return any_failed;
}