about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--stdio-common/printf_fp.c45
-rw-r--r--stdio-common/vfprintf.c1
3 files changed, 34 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index b4c20251d2..2f58df4b15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-12-18  Ulrich Drepper  <drepper@redhat.com>
+
+	* stdio-common/printf_fp.c: Add support to use alternative decimal
+	digits.
+	* stdio-common/vfprintf.c (vfprintf): Pass use_outdigits flags to
+	__printf_fp.  Patch by Hamed Malek <hamed@bamdad.org>.
+
 2003-12-18  Carlos O'Donell  <carlos@baldric.uwo.ca>
 
 	* sysdeps/unix/sysv/linux/hppa/clone.S (__clone) [PIC]: Save PIC,
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 0f0c68eb88..62867e75f2 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -1,5 +1,5 @@
 /* Floating point output for `printf'.
-   Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999,2000,2001,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
@@ -21,11 +21,7 @@
 /* The gmp headers need some configuration frobs.  */
 #define HAVE_ALLOCA 1
 
-#ifdef USE_IN_LIBIO
-#  include <libioP.h>
-#else
-#  include <stdio.h>
-#endif
+#include <libioP.h>
 #include <alloca.h>
 #include <ctype.h>
 #include <float.h>
@@ -43,6 +39,14 @@
 #include <stdlib.h>
 #include <wchar.h>
 
+#ifdef COMPILE_WPRINTF
+# define CHAR_T        wchar_t
+#else
+# define CHAR_T        char
+#endif
+
+#include "_i18n_number.h"
+
 #ifndef NDEBUG
 # define NDEBUG			/* Undefine this for debugging assertions.  */
 #endif
@@ -50,21 +54,15 @@
 
 /* This defines make it possible to use the same code for GNU C library and
    the GNU I/O library.	 */
-#ifdef USE_IN_LIBIO
-# define PUT(f, s, n) _IO_sputn (f, s, n)
-# define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : INTUSE(_IO_padn) (f, c, n))
+#define PUT(f, s, n) _IO_sputn (f, s, n)
+#define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : INTUSE(_IO_padn) (f, c, n))
 /* We use this file GNU C library and GNU I/O library.	So make
    names equal.	 */
-# undef putc
-# define putc(c, f) (wide \
-		      ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
-# define size_t     _IO_size_t
-# define FILE	     _IO_FILE
-#else	/* ! USE_IN_LIBIO */
-# define PUT(f, s, n) fwrite (s, 1, n, f)
-# define PAD(f, c, n) __printf_pad (f, c, n)
-ssize_t __printf_pad __P ((FILE *, char pad, int n)); /* In vfprintf.c.  */
-#endif	/* USE_IN_LIBIO */
+#undef putc
+#define putc(c, f) (wide \
+		    ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
+#define size_t     _IO_size_t
+#define FILE	     _IO_FILE
 
 /* Macros for doing the actual output.  */
 
@@ -1129,6 +1127,15 @@ __printf_fp (FILE *fp,
 	}
 
       tmpptr = buffer;
+      if (__builtin_expect (info->i18n, 0))
+        {
+#ifdef COMPILE_WPRINTF
+	  wstartp = _i18n_number_rewrite (wstartp, wcp);
+#else
+	  tmpptr = _i18n_number_rewrite (tmpptr, cp);
+#endif
+        }
+
       PRINT (tmpptr, wstartp, wide ? wcp - wstartp : cp - tmpptr);
 
       /* Free the memory if necessary.  */
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 94fd37e5e4..b84107ab6f 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -817,6 +817,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 					.group = group,			      \
 					.pad = pad,			      \
 					.extra = 0,			      \
+					.i18n = use_outdigits,		      \
 					.wide = sizeof (CHAR_T) != 1 };	      \
 									      \
 	    if (is_long_double)						      \