diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-12-28 20:55:53 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-12-28 20:55:53 -0800 |
commit | ffada96ffdf3dae7c1932deebd6f512ede5f2aa5 (patch) | |
tree | 08b9fa969e686e01d1456a7e1bdb7407cf9094b5 /lib.c | |
parent | d6eca506a08d569d4c821c724242fc556638342c (diff) | |
download | txr-ffada96ffdf3dae7c1932deebd6f512ede5f2aa5.tar.gz txr-ffada96ffdf3dae7c1932deebd6f512ede5f2aa5.tar.bz2 txr-ffada96ffdf3dae7c1932deebd6f512ede5f2aa5.zip |
New variables for floating-point printing control.
* lib.c (obj_print_impl): Instead of hard-coded "~s", obtain
the format string for floats from the *print-flo-format*
special variable, whose default value is "~s".
* stream.c (print_flo_digits_s, print_flo_format_s): New symbol
variables.
(formatv): Use *print-flo-digits* value for default precision
for ~f and ~e, rather than hard-coded 3.
(stream_init): Initialize print_flo_digits_s and print_flo_format_s, and
register special variables under those symbols.
* stream.h (print_flo_digits_s, print_flo_format_s): Declared.
* txr.1: Documented new specials.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -8406,7 +8406,10 @@ finish: case NUM: case BGNUM: case FLNUM: - format(out, lit("~s"), obj, nao); + { + val fmt = cdr(lookup_var(nil, print_flo_format_s)); + format(out, fmt, obj, nao); + } break; case SYM: if (!pretty) { |