+2000-12-30 Bruno Haible <haible@clisp.cons.org>
+
+ * configure.in: Call jm_AC_TYPE_UNSIGNED_LONG_LONG and
+ jm_AC_TYPE_UINTMAX_T.
+
2000-11-09 Bruno Haible <haible@clisp.cons.org>
* configure.in (ALL_LINGUAS): Add tr.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.12)
-AC_REVISION($Revision: 1.4 $)
+AC_REVISION($Revision: 1.5 $)
AC_INIT(src/msgfmt.c)
AM_INIT_AUTOMAKE(gettext, 0.10.36)
AM_CONFIG_HEADER(config.h)
AC_C_CONST
AC_C_INLINE
AC_C_BACKSLASH_A
+jm_AC_TYPE_UNSIGNED_LONG_LONG
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AM_TYPE_PTRDIFF_T
+jm_AC_TYPE_UINTMAX_T
dnl Checks for library functions.
AC_FUNC_ALLOCA
+2000-12-30 Bruno Haible <haible@clisp.cons.org>
+
+ * printf.h (printf_info): New fields is_char, is_longlong.
+ (PA_FLAG_CHAR): New macro.
+ * printf-parse.h: Include inttypes.h.
+ (long_long_int): Define depending on HAVE_UNSIGNED_LONG_LONG.
+ (ptrdiff_t): Define depending on HAVE_PTRDIFF_T.
+ (parse_one_spec): Handle new ISO C99 length modifiers 'j', 't', 'z'.
+
2000-12-30 Bruno Haible <haible@clisp.cons.org>
* basename.c: Update from current fileutils version, keeping the
/* Internal header for parsing printf format strings.
- Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1998, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#if HAVE_STDDEF_H
# include <stddef.h>
#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
#if HAVE_STRING_H
# include <string.h>
#endif
#if __GNUC__ >= 2
-# define long_long_int long long int
# define long_double long double
#else
-# define long_long_int long
# define long_double double
#endif
+#if HAVE_UNSIGNED_LONG_LONG
+# define long_long_int long long int
+#else
+# define long_long_int long int
+#endif
+
+#if !HAVE_PTRDIFF_T
+# define ptrdiff_t long int
+#endif
+
#define NDEBUG 1
#include <assert.h>
}
/* Check for type modifiers. */
-#define is_longlong is_long_double
spec->info.is_long_double = 0;
spec->info.is_short = 0;
+ spec->info.is_char = 0;
spec->info.is_long = 0;
+ spec->info.is_longlong = 0;
while (*format == 'h' || *format == 'l' || *format == 'L' ||
*format == 'Z' || *format == 'q')
switch (*format++)
{
case 'h':
- /* int's are short int's. */
- spec->info.is_short = 1;
+ if (spec->info.is_short)
+ /* int's are char's. */
+ spec->info.is_char = 1;
+ else
+ /* int's are short int's. */
+ spec->info.is_short = 1;
break;
case 'l':
if (spec->info.is_long)
/* A double `l' is equivalent to an `L'. */
- spec->info.is_longlong = 1;
+ spec->info.is_longlong = spec->info.is_long_double = 1;
else
/* int's are long int's. */
spec->info.is_long = 1;
break;
case 'L':
/* double's are long double's, and int's are long long int's. */
- spec->info.is_long_double = 1;
+ spec->info.is_long_double = spec->info.is_longlong = 1;
+ break;
+ case 'j':
+ /* int's are intmax_t's. */
+ assert (sizeof(uintmax_t) <= sizeof(unsigned long_long_int));
+ spec->info.is_longlong = sizeof(uintmax_t) > sizeof(unsigned long int);
+ spec->info.is_long = sizeof(uintmax_t) > sizeof(unsigned int);
+ break;
+ case 't':
+ /* int's are ptrdiff_t's. */
+ assert (sizeof(ptrdiff_t) <= sizeof(unsigned long_long_int));
+ spec->info.is_longlong = sizeof(ptrdiff_t) > sizeof(unsigned long int);
+ spec->info.is_long = sizeof(ptrdiff_t) > sizeof(unsigned int);
break;
+ case 'z':
case 'Z':
/* int's are size_t's. */
assert (sizeof(size_t) <= sizeof(unsigned long_long_int));
spec->data_arg_type = PA_INT|PA_FLAG_LONG_LONG;
else if (spec->info.is_long)
spec->data_arg_type = PA_INT|PA_FLAG_LONG;
+ else if (spec->info.is_char)
+ spec->data_arg_type = PA_INT|PA_FLAG_CHAR;
else if (spec->info.is_short)
spec->data_arg_type = PA_INT|PA_FLAG_SHORT;
else
char spec; /* Format letter. */
unsigned is_long_double:1; /* L flag. */
unsigned is_short:1; /* h flag. */
+ unsigned is_char:1; /* hh flag. */
unsigned is_long:1; /* l flag. */
+ unsigned is_longlong:1; /* ll flag. */
unsigned alt:1; /* # flag. */
unsigned space:1; /* Space flag. */
unsigned left:1; /* - flag. */
#define PA_FLAG_LONG (1 << 9)
#define PA_FLAG_SHORT (1 << 10)
#define PA_FLAG_PTR (1 << 11)
+#define PA_FLAG_CHAR (1 << 12)
#endif /* printf.h */
+2000-12-30 Bruno Haible <haible@clisp.cons.org>
+
+ * ulonglong.m4: New file, from fileutils-4.0.32.
+ * inttypes_h.m4: Likewise.
+ * uintmax_t.m4: Likewise.
+ * Makefile.am (EXTRA_DIST): Add them.
+
2000-09-14 Bruno Haible <haible@clisp.cons.org>
* gettext.m4 (AM_WITH_NLS): Make the tests for gettext in libc and
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
EXTRA_DIST = README \
-c-bs-a.m4 codeset.m4 gettext.m4 iconv.m4 isc-posix.m4 lcmessage.m4 \
-progtest.m4
+c-bs-a.m4 codeset.m4 gettext.m4 iconv.m4 inttypes_h.m4 isc-posix.m4 \
+lcmessage.m4 progtest.m4 uintmax_t.m4 ulonglong.m4
--- /dev/null
+#serial 3
+
+dnl From Paul Eggert.
+
+# Define HAVE_INTTYPES_H 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, 1,
+[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
+ and declares uintmax_t. ])
+ fi
+])
--- /dev/null
+#serial 5
+
+dnl From Paul Eggert.
+
+AC_PREREQ(2.13)
+
+# Define uintmax_t to `unsigned long' or `unsigned long long'
+# if <inttypes.h> does not exist.
+
+AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
+[
+ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
+ if test $jm_ac_cv_header_inttypes_h = no; then
+ AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
+ test $ac_cv_type_unsigned_long_long = yes \
+ && ac_type='unsigned long long' \
+ || ac_type='unsigned long'
+ AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
+ [Define to unsigned long or unsigned long long
+ if <inttypes.h> doesn't define.])
+ fi
+])
--- /dev/null
+#serial 2
+
+dnl From Paul Eggert.
+
+AC_DEFUN(jm_AC_TYPE_UNSIGNED_LONG_LONG,
+[
+ AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
+ [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
+ [unsigned long long ullmax = (unsigned long long) -1;
+ return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
+ ac_cv_type_unsigned_long_long=yes,
+ ac_cv_type_unsigned_long_long=no)])
+ if test $ac_cv_type_unsigned_long_long = yes; then
+ AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
+ [Define if you have the unsigned long long type.])
+ fi
+])