summaryrefslogtreecommitdiff
path: root/libyasm/floatnum.c
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2001-11-21 08:25:09 +0000
committerPeter Johnson <peter@tortall.net>2001-11-21 08:25:09 +0000
commit825eaa582324bcdb40b3515d22d1b96eb3b39051 (patch)
treed7c201311d55ee19ac6d87669cdaf1c8761b0b3c /libyasm/floatnum.c
parentb930d117d3929c0b5a199660f8c17c30cf24bba3 (diff)
downloadyasm-825eaa582324bcdb40b3515d22d1b96eb3b39051.tar.gz
Massive cleanup of debugging output (via _print() functions). All now take
FILE *'s to print to somewhere other than stdout, and the formatting is improved through the use of a global indent_level. Changes to main() include the ability to specify an output file. svn path=/trunk/yasm/; revision=357
Diffstat (limited to 'libyasm/floatnum.c')
-rw-r--r--libyasm/floatnum.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libyasm/floatnum.c b/libyasm/floatnum.c
index e0c739e7..0f8e870b 100644
--- a/libyasm/floatnum.c
+++ b/libyasm/floatnum.c
@@ -660,7 +660,7 @@ floatnum_check_size(/*@unused@*/ const floatnum *flt, size_t size)
}
void
-floatnum_print(const floatnum *flt)
+floatnum_print(FILE *f, const floatnum *flt)
{
unsigned char out[10];
unsigned char *str;
@@ -668,24 +668,25 @@ floatnum_print(const floatnum *flt)
/* Internal format */
str = BitVector_to_Hex(flt->mantissa);
- printf("%c %s *2^%04x\n", flt->sign?'-':'+', (char *)str, flt->exponent);
+ fprintf(f, "%c %s *2^%04x\n", flt->sign?'-':'+', (char *)str,
+ flt->exponent);
xfree(str);
/* 32-bit (single precision) format */
- printf("32-bit: %d: ", floatnum_get_sized(flt, out, 4));
+ fprintf(f, "32-bit: %d: ", floatnum_get_sized(flt, out, 4));
for (i=0; i<4; i++)
- printf("%02x ", out[i]);
- printf("\n");
+ fprintf(f, "%02x ", out[i]);
+ fprintf(f, "\n");
/* 64-bit (double precision) format */
- printf("64-bit: %d: ", floatnum_get_sized(flt, out, 8));
+ fprintf(f, "64-bit: %d: ", floatnum_get_sized(flt, out, 8));
for (i=0; i<8; i++)
- printf("%02x ", out[i]);
- printf("\n");
+ fprintf(f, "%02x ", out[i]);
+ fprintf(f, "\n");
/* 80-bit (extended precision) format */
- printf("80-bit: %d: ", floatnum_get_sized(flt, out, 10));
+ fprintf(f, "80-bit: %d: ", floatnum_get_sized(flt, out, 10));
for (i=0; i<10; i++)
- printf("%02x ", out[i]);
- printf("\n");
+ fprintf(f, "%02x ", out[i]);
+ fprintf(f, "\n");
}