From 4339b7cf8c91e97aef4ba942fbb9e07f7f88d953 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 10 Dec 2008 03:50:40 +0000 Subject: [PATCH] fixed the printing issue of a long double value for MINGW32 --- ase/lib/awk/extio.c | 3 ++- ase/lib/awk/run.c | 11 ++++++++--- ase/lib/awk/tree.c | 4 ++-- ase/lib/awk/val.c | 7 ++++++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ase/lib/awk/extio.c b/ase/lib/awk/extio.c index d40aaac3..30cff01e 100644 --- a/ase/lib/awk/extio.c +++ b/ase/lib/awk/extio.c @@ -1,5 +1,5 @@ /* - * $Id: extio.c 372 2008-09-23 09:51:24Z baconevi $ + * $Id: extio.c 466 2008-12-09 09:50:40Z baconevi $ * * {License} */ @@ -394,6 +394,7 @@ int ase_awk_readextio ( return ret; } +#include int ase_awk_writeextio_val ( ase_awk_run_t* run, int out_type, const ase_char_t* name, ase_awk_val_t* v) diff --git a/ase/lib/awk/run.c b/ase/lib/awk/run.c index dd7738f1..955a547b 100644 --- a/ase/lib/awk/run.c +++ b/ase/lib/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c 391 2008-09-27 09:51:23Z baconevi $ + * $Id: run.c 466 2008-12-09 09:50:40Z baconevi $ * * {License} */ @@ -6954,7 +6954,7 @@ ase_char_t* ase_awk_format ( ase_real_t r; ase_char_t* p; int n; - + FMT_CHAR (ASE_T('L')); FMT_CHAR (fmt[i]); @@ -6999,7 +6999,12 @@ ase_char_t* ase_awk_format ( run->format.tmp.ptr, run->format.tmp.len, ASE_STR_PTR(fbu), - (long double)r); + #if defined(__MINGW32__) + (double)r + #else + (long double)r + #endif + ); if (n == -1) { diff --git a/ase/lib/awk/tree.c b/ase/lib/awk/tree.c index 12448616..0f8470f6 100644 --- a/ase/lib/awk/tree.c +++ b/ase/lib/awk/tree.c @@ -1,5 +1,5 @@ /* - * $Id: tree.c 381 2008-09-24 11:07:24Z baconevi $ + * $Id: tree.c 466 2008-12-09 09:50:40Z baconevi $ * * {License} */ @@ -264,7 +264,7 @@ static int print_expression (ase_awk_t* awk, ase_awk_nde_t* nde) { if (((ase_awk_nde_real_t*)nde)->str == ASE_NULL) { - #if (ASE_SIZEOF_LONG_DOUBLE != 0) + #if (ASE_SIZEOF_LONG_DOUBLE != 0) && !defined(__MINGW32__) awk->prmfns->sprintf ( awk->prmfns->data, awk->tmp.fmt, ASE_COUNTOF(awk->tmp.fmt), ASE_T("%Lf"), diff --git a/ase/lib/awk/val.c b/ase/lib/awk/val.c index 47c2b210..4f60ded5 100644 --- a/ase/lib/awk/val.c +++ b/ase/lib/awk/val.c @@ -1,5 +1,5 @@ /* - * $Id: val.c 389 2008-09-26 08:01:24Z baconevi $ + * $Id: val.c 466 2008-12-09 09:50:40Z baconevi $ * * {License} */ @@ -1178,8 +1178,13 @@ void ase_awk_dprintval (ase_awk_run_t* run, ase_awk_val_t* val) break; case ASE_AWK_VAL_REAL: + #if defined(__MINGW32__) + DPRINTF (DCUSTOM, ASE_T("%Lf"), + (double)((ase_awk_val_real_t*)val)->val); + #else DPRINTF (DCUSTOM, ASE_T("%Lf"), (long double)((ase_awk_val_real_t*)val)->val); + #endif break; case ASE_AWK_VAL_STR: