Prev | Up | Next | Back | Forward
TOC -- / --.-- / --.--.-- | Index | Search | Syntax | Help


F.3.2 Edited Output Generation

Dynamic Semantics
(1)
The contents of an edited output string are based on:
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
The combination of a True value for Blank_When_Zero and a '*' character in Pic_String is inconsistent; no edited output string is defined.
(10)
A layout error is identified in the rules below if leading non-zero digits of Item, character values of the Currency string, or a negative sign would be truncated; in such cases no edited output string is defined.
(11)
The edited output string has lower bound 1 and upper bound N where N = Pic_String'Length + Currency_Length_Adjustment - Radix_Adjustment, and
(12)
(13)
(14)
Let the magnitude of Item be expressed as a base-10 number I[p]***I[1].F[1]***F[q], called the displayed magnitude of Item, where:
(15)
(16)
(17)
If n < Num'Scale, then the above number is the result of rounding (away from 0 if exactly midway between values).
(18)
If Blank_When_Zero = True and the displayed magnitude of Item is zero, then the edited output string comprises all space character values. Otherwise, the picture String is treated as a sequence of instances of syntactic categories based on the rules in F.3.1, and the edited output string is the concatenation of string values derived from these categories according to the following mapping rules.
(19)
Table F-1 shows the mapping from a sign control symbol to a corresponding character or string in the edited output. In the columns showing the edited output, a lower-case 'b' represents the space character. If there is no sign control symbol but the value of Item is negative, a layout error occurs and no edited output string is produced.
         -----------------------------------------------------------------
         |                                                               |
         |       Table F-1: Edited Output for Sign Control Symbols       |
         |                                                               |
         |-------------------------------------------------------------- |
         |                     |                     |                   |
         |                     |  Edited Output for  | Edited Output for |
         | Sign Control Symbol | Non-Negative Number |  Negative Number  |
         |                     |                     |                   |
         |---------------------------------------------------------------|
         |                     |                     |                   |
         |         '+'         |         '+'         |        '-'        |
         |                     |                     |                   |
         |         '-'         |         'b'         |        '-'        |
         |                     |                     |                   |
         |         '<'         |         'b'         |        '('        |
         |                     |                     |                   |
         |         '>'         |         'b'         |        ')'        |
         |                     |                     |                   |
         |        "CR"         |        "bb"         |       "CR"        |
         |                     |                     |                   |
         |        "DB"         |        "bb"         |       "DB"        |
         |                     |                     |                   |
         -----------------------------------------------------------------
(20)
An instance of fixed_LHS_sign maps to a character as shown in Table F-1.
(21)
An instance of fixed_$_char maps to Currency.
(22)
An instance of direct_insertion maps to Separator if direct_insertion = '_', and to the direct_insertion Character otherwise.
(23)
An instance of number maps to a string integer_part & radix_part & fraction_part where:
(24)
(25)
(26)
(27)
(28)
(29)
(30)
(31)
(32)
(33)
(34)
An instance of zero_suppression maps to the string obtained as follows:
(35)
(36)
(37)
(38)
(39)
(40)
(41)
An instance of RHS_sign maps to a character or string as shown in Table F-1.
(42)
An instance of floating_LHS_sign maps to the string obtained as follows.
(43)
(44)
(45)
(46)
(47)
(48)
An instance of fixed_#_currency maps to the Currency string with n space character values concatenated on the left (if the instance does not follow a radix) or on the right (if the instance does follow a radix), where n is the difference between the length of the fixed_#_currency instance and Currency'Length. A layout error occurs if Currency'Length exceeds the length of the fixed_#_currency instance; no edited output string is produced.
(49)
An instance of floating_$_currency maps to the string obtained as follows:
(50)
(51)
(52)
(53)
(54)
(55)
An instance of floating_#_currency maps to the string obtained as follows:
(56)
(57)
(58)
(59)
(60)
(61)
An instance of all_zero_suppression_number maps to:
(62)
(63)
(64)
(65)
An instance of all_sign_number maps to:
(66)
(67)
(68)
An instance of all_currency_number maps to:
(69)
(70)
Examples
(71)
In the result string values shown below, 'b' represents the space character.
(72)
       Item:         Picture and Result Strings:
(73)
       123456.78     Picture:  "-###**_***_**9.99"
                               "bbb$***123,456.78"
                               "bbFF***123.456,78" (currency = "FF",
                                                    separator = '.',
                                                    radix mark = ',')
(74)
       123456.78     Picture:  "-$$$**_***_**9.99"
                     Result:   "bbb$***123,456.78"
                              "bbbFF***123.456,78" (currency = "FF",
                                                    separator = '.',
                                                    radix mark = ',')
(75)
       0.0          Picture: "-$$$$$$.$$"
                    Result:  "bbbbbbbbbb"
(76)
       0.20         Picture: "-$$$$$$.$$"
                    Result:  "bbbbbb$.20"
(77)
       -1234.565    Picture: "<<<<_<<<.<<###>"
                    Result:  "bb(1,234.57DMb)"  (currency = "DM")
(78)
       12345.67     Picture: "###_###_##9.99"
                    Result:  "bbCHF12,345.67"   (currency = "CHF")

Prev | Up | Next | Back | Forward
TOC -- / --.-- / --.--.-- | Index | Search | Syntax | Help

Ada WWW Home -- Email comments, additions, corrections, gripes, kudos, etc. to:

Magnus Kempe -- Magnus.Kempe@di.epfl.ch
Copyright statement
Page last generated: 95-03-12