diff options
author | Kevin Ryde <user42@zip.com.au> | 2002-11-20 00:20:10 +0100 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2002-11-20 00:20:10 +0100 |
commit | 256c62b53e89a69e374784c281c2a13e19cca722 (patch) | |
tree | 7ee94bb3c266b777066c8f6d5624aa61e52c1015 /cxx | |
parent | 7f71479b4d70d25b6443a3ab5402b2b658bf9d7e (diff) | |
download | gmp-256c62b53e89a69e374784c281c2a13e19cca722.tar.gz |
* printf/doprntf.c: Add decimal point parameter, remove localeconv use.
* cxx/osmpf.cc: Use this with ostream locale decimal_point facet.
Diffstat (limited to 'cxx')
-rw-r--r-- | cxx/osmpf.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cxx/osmpf.cc b/cxx/osmpf.cc index c3dc68782..767f0907d 100644 --- a/cxx/osmpf.cc +++ b/cxx/osmpf.cc @@ -1,6 +1,6 @@ /* operator<< -- mpf formatted output to an ostream. -Copyright 2001 Free Software Foundation, Inc. +Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -19,6 +19,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <clocale> #include <iostream> #include <stdarg.h> /* for va_list and hence doprnt_funs_t */ #include <string.h> @@ -43,8 +44,16 @@ operator<< (ostream &o, mpf_srcptr f) __gmp_doprnt_params_from_ios (¶m, o); +#if HAVE_STD__LOCALE + char point[2]; + point[0] = use_facet< numpunct<char> >(o.getloc()).decimal_point(); + point[1] = '\0'; +#else + const char *point = localeconv()->decimal_point; +#endif + GMP_ASPRINTF_T_INIT (d, &result); - ret = __gmp_doprnt_mpf (&__gmp_asprintf_funs_noformat, &d, ¶m, f); + ret = __gmp_doprnt_mpf (&__gmp_asprintf_funs_noformat, &d, ¶m, point, f); ASSERT (ret != -1); __gmp_asprintf_final (&d); |