diff --git a/documentation/library-reference/source/io/format.rst b/documentation/library-reference/source/io/format.rst index b91712ec6..4115c8fbf 100644 --- a/documentation/library-reference/source/io/format.rst +++ b/documentation/library-reference/source/io/format.rst @@ -10,11 +10,11 @@ Introduction This chapter describes the Format module. The Format module is exported from the IO library. This module extends the functionality of the format -strings described in Dylan's condition system and provides two new -functions for processing the extended format strings. The Format module -is a small module, but it uses the printing modules and some of the -Streams module. :doc:`print` and :doc:`streams` give full details of -the Print and Streams libraries. +strings described in :drm:`Dylan's condition system ` +and provides two new functions for processing the extended format strings. +The Format module is a small module, but it uses the printing modules and +some of the Streams module. :doc:`print` and :doc:`streams` give full +details of the Print and Streams libraries. The ``format`` module exports all the identifiers described in this chapter. @@ -23,8 +23,9 @@ Control strings =============== The Format module's format strings, or control strings, offer the same -directives as Dylan's format strings offer, but Format provides a few -more directives, and permits a single argument to all format directives. +directives as :drm:`Dylan's format strings ` offer, +but Format provides a few more directives, and permits a single argument +to all format directives. The argument is an integer that must appear contiguously between the dispatch character, ``%``, and the format directive. The argument @@ -37,35 +38,35 @@ specification. The following are examples of valid format directives: :: - %S %s - %15D + %S + %15d %-10= The directives are: -- ``%S`` Prints the next format argument as a message by calling the +- ``%s`` Prints the next format argument as a message by calling the function :gf:`print-message` on the format argument and the stream. - This directive is the same as Dylan's ``%S`` format-string directive - except for two features: (i) this module's ``%S`` directive outputs - character objects, and (ii) you can extend the ``%S`` functionality by + This directive is the same as Dylan's ``%s`` format-string directive + except for two features: (i) this module's ``%s`` directive outputs + character objects, and (ii) you can extend the ``%s`` functionality by adding methods to :gf:`print-message`. - ``%=`` Prints the next format argument by calling the :gf:`print` function from the Print module on the format argument and the stream. You can extend the ``%=`` functionality by adding methods to the :gf:`print-object` function from the Print module. -- ``%C`` Print the next format argument, which must be a character, - according to Dylan's ``%S`` format-string directive. This module's - ``%C`` directive is the same as this module's ``%S`` directive. -- ``%D`` Prints a decimal representation of the next format argument, +- ``%c`` Print the next format argument, which must be a character, + according to Dylan's ``%s`` format-string directive. This module's + ``%c`` directive is the same as this module's ``%s`` directive. +- ``%d`` Prints a decimal representation of the next format argument, which must be an integer. -- ``%B`` Prints a binary representation of the next format argument, +- ``%b`` Prints a binary representation of the next format argument, which must be an integer. -- ``%O`` Prints an octal representation of the next format argument, +- ``%o`` Prints an octal representation of the next format argument, which must be an integer. -- ``%X`` Prints a hexadecimal representation of the next format +- ``%x`` Prints a hexadecimal representation of the next format argument, which must be an integer. -- ``%M`` Invokes the next format argument, which must be a function, on +- ``%m`` Invokes the next format argument, which must be a function, on the stream passed to :gf:`format`. - ``%%`` Outputs a single ``%`` character. @@ -165,8 +166,8 @@ Format module. See the individual methods for the details of how this function prints various objects. This function exists to define the behavior - of the ``%S`` format directive and to allow users the ability to - extend the ``%S`` directive. Users should have little need to call + of the ``%s`` format directive and to allow users the ability to + extend the ``%s`` directive. Users should have little need to call this function directly. .. method:: print-message @@ -181,7 +182,7 @@ Format module. :description: Prints ``condition`` as an error message, as described for the - Dylan ``%S`` format directive. You should not specialize the + Dylan ``%s`` format directive. You should not specialize the :gf:`print-message` protocol for subclasses of :drm:``, but instead extend the :gf:`print-message` protocol to new condition objects by specializing methods on :gf:`report-condition`.