1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

20 commits

Author SHA1 Message Date
Ludovic Courtès
afd08fdf87 format: Add specifier ~h for localized number output.
* doc/ref/misc-modules.texi (Formatted Output): Document ~h.  Recommend
  use of ~h instead of ~:d.

* module/ice-9/format.scm (format): Add support for ~h.

* test-suite/tests/format.test ("~h localized number"): New test prefix.

* test-suite/tests/i18n.test (%american-english-locale-name,
  %american-english-locale): New variables.
  (under-american-english-locale-or-unresolved): New procedure.
  ("format ~h"): New test prefix.
2012-02-03 16:35:06 +01:00
Ludovic Courtès
1497e87a4f Make `(format #f ...)' always Unicode-capable.
* module/ice-9/format.scm (format): When DESTINATION is #f, use a
  Unicode-capable output string port.

* test-suite/tests/format.test ("format basic output")["default to
  Unicode-capable port"]: New test.
2011-02-08 23:14:00 +01:00
Mark H Weaver
6a07a06118 Do not apply inf?' or nan?' to strings
* module/ice-9/format.scm (format): Test to make sure an argument is a
  number before applying `inf?' and `nan?' to it.  Formerly, format
  would call `inf?' and `nan?' on arguments that might be either a
  number or a string, although those predicates should ideally throw an
  exception when applied to non-number objects.
2011-01-28 12:16:59 +01:00
Andy Wingo
b90b4b2bf2 format handles ~@c better
* module/ice-9/format.scm (format): Fix ascii-ism in ~@c. Pull
  flush-output? into the let*.
2010-12-18 13:13:16 +01:00
Andy Wingo
79f124ac87 more format tweaks
* module/ice-9/format.scm (format): Strip format: prefix from port and
  output-col.
2010-12-18 13:02:07 +01:00
Andy Wingo
8390dac023 more format tweaks
* module/ice-9/format.scm (format): Move the port and output-col to let*
  vars, again removing a set!. We will probably move more state vars to
  the let*, to let the procedures exist in a more fixed-point style.
2010-12-18 12:57:29 +01:00
Andy Wingo
0e9306801a take advantage of letrec* in format
* module/ice-9/format.scm (format): Take advantage of letrec* internal
  expansion, and so have fewer set! invocations.
2010-12-18 12:50:00 +01:00
Andy Wingo
d55066ddc3 inline format:out into format
* module/ice-9/format.scm (format): Inline format:out into the body.
2010-12-18 12:42:50 +01:00
Andy Wingo
098e6fc63f more format cleanups
* module/ice-9/format.scm (format): Remove the need to save a copy of
  the incoming arguments, because they are available as local
  variables.  Do the check early for the format-string actually being a
  string.
2010-12-18 12:32:14 +01:00
Andy Wingo
f02f8a6174 format's first arg is "destination"
* module/ice-9/format.scm: The argument to format is "destination", not
  "port". Fix this newly reintroduced buglet.
2010-12-18 12:20:26 +01:00
Andy Wingo
3d56118c50 inline format:format into format
* module/ice-9/format.scm (format): Inline format:format body.
2010-12-18 12:17:46 +01:00
Andy Wingo
2ce77e6cf6 deprecate omission of port to ice-9 format
* module/ice-9/format.scm (format): Add port and format-string as formal
  arguments. Seems also to have triggered a reindent.  Formally
  deprecate omitting the port, as it's usually an error.

* test-suite/tests/format.test ("format basic output")
  ("format basic output", "~{ iteration"): Fix up tests that omitted the
  destination port.
2010-12-18 12:06:53 +01:00
Andy Wingo
29d096c8e6 letrec -> internal definitions in format.scm
* module/ice-9/format.scm (format): Change from letrec to internal
  definitions, and use the define (foo ...) .. shorthand. No semantic
  change.
2010-12-18 11:44:57 +01:00
Andy Wingo
9ebf1af3c1 format.scm cleanups
* module/ice-9/format.scm (format:symbol-case-conv)
  (format:iobj-case-conv): Remove these exports, they were not used.
  (format:expch): Remove this one, though it was used.
  (format:floats, format:complex-numbers, format:radix-pref): Inline
  these "configuration variables" into the format body.
2010-12-18 11:27:19 +01:00
Andy Wingo
e3e3394374 ice-9 format license update
* module/ice-9/format.scm: A more standard copyright header, with
  LGPLv3+ instead of public domain. Update define-module block.
2010-12-18 11:21:29 +01:00
Andy Wingo
c89920a71f deprecate passing a number as the destination to `format'
* module/ice-9/format.scm (format): Deprecate having a number as the
  destination.
* doc/ref/misc-modules.texi (Formatted Output): Update docs.
2010-08-28 13:44:00 -07:00
Andy Wingo
625b43acc7 fix `format' with %f and exact rationals
* module/ice-9/format.scm (format:parse-float): Accept a number, and
  when stringifying the number, first convert to inexact.

* test-suite/tests/format.test ("~f fixed-point"): Add exact rational
  test.
2010-06-06 13:46:53 +02:00
Andy Wingo
9274c3dd40 ~:@y allows for truncation to an absolute maximum width
* module/ice-9/format.scm (format): Allow ~:@y to interpret the width as
  the maximum width, inclusive of whatever else has already been output.
* doc/ref/misc-modules.texi (Formatted Output): Document this.
2009-12-29 21:15:08 +01:00
Andy Wingo
b8596c08ac add ~@y truncated printing directive to format
* doc/ref/misc-modules.texi (Formatted Output): Add documentation for
  the new ~@y format directive.
  (Pretty Printing): Add documentation for truncated-write.

* module/ice-9/format.scm (format): Add ~@y, for doing a truncated
  print. Also, allow both ~y variants to take a width parameter.
2009-12-29 13:29:02 +01:00
Andy Wingo
00d0489205 move ice-9/ and oop/ under module/
Moved ice-9/ and oop/ under module/, with the idea being that we have
only scheme under module/. Adjusted configure.in and Makefile.am
appropriately. Put oop/ at the end of the compilation order.
2008-11-01 12:44:21 +01:00
Renamed from ice-9/format.scm (Browse further)