1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . W I D E _ T E X T _ I O . E D I T I N G --
11 -- Copyright (C) 1992-1997 Free Software Foundation, Inc. --
13 -- This specification is derived from the Ada Reference Manual for use with --
14 -- GNAT. The copyright notice above, and the license provisions that follow --
15 -- apply solely to the contents of the part following the private keyword. --
17 -- GNAT is free software; you can redistribute it and/or modify it under --
18 -- terms of the GNU General Public License as published by the Free Soft- --
19 -- ware Foundation; either version 2, or (at your option) any later ver- --
20 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
21 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
22 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
23 -- for more details. You should have received a copy of the GNU General --
24 -- Public License distributed with GNAT; see file COPYING. If not, write --
25 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
26 -- MA 02111-1307, USA. --
28 -- As a special exception, if other files instantiate generics from this --
29 -- unit, or you link this unit with other files to produce an executable, --
30 -- this unit does not by itself cause the resulting executable to be --
31 -- covered by the GNU General Public License. This exception does not --
32 -- however invalidate any other reasons why the executable file might be --
33 -- covered by the GNU Public License. --
35 -- GNAT was originally developed by the GNAT team at New York University. --
36 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
38 ------------------------------------------------------------------------------
40 package Ada.Wide_Text_IO.Editing is
42 type Picture is private;
45 (Pic_String : in String;
46 Blank_When_Zero : in Boolean := False)
50 (Pic_String : in String;
51 Blank_When_Zero : in Boolean := False)
54 function Pic_String (Pic : in Picture) return String;
55 function Blank_When_Zero (Pic : in Picture) return Boolean;
57 Max_Picture_Length : constant := 64;
59 Picture_Error : exception;
61 Default_Currency : constant Wide_String := "$";
62 Default_Fill : constant Wide_Character := ' ';
63 Default_Separator : constant Wide_Character := ',';
64 Default_Radix_Mark : constant Wide_Character := '.';
67 type Num is delta <> digits <>;
68 Default_Currency : in Wide_String :=
69 Wide_Text_IO.Editing.Default_Currency;
70 Default_Fill : in Wide_Character :=
71 Wide_Text_IO.Editing.Default_Fill;
72 Default_Separator : in Wide_Character :=
73 Wide_Text_IO.Editing.Default_Separator;
74 Default_Radix_Mark : in Wide_Character :=
75 Wide_Text_IO.Editing.Default_Radix_Mark;
77 package Decimal_Output is
81 Currency : in Wide_String := Default_Currency)
87 Currency : in Wide_String := Default_Currency)
93 Currency : in Wide_String := Default_Currency;
94 Fill : in Wide_Character := Default_Fill;
95 Separator : in Wide_Character := Default_Separator;
96 Radix_Mark : in Wide_Character := Default_Radix_Mark)
100 (File : in File_Type;
103 Currency : in Wide_String := Default_Currency;
104 Fill : in Wide_Character := Default_Fill;
105 Separator : in Wide_Character := Default_Separator;
106 Radix_Mark : in Wide_Character := Default_Radix_Mark);
111 Currency : in Wide_String := Default_Currency;
112 Fill : in Wide_Character := Default_Fill;
113 Separator : in Wide_Character := Default_Separator;
114 Radix_Mark : in Wide_Character := Default_Radix_Mark);
117 (To : out Wide_String;
120 Currency : in Wide_String := Default_Currency;
121 Fill : in Wide_Character := Default_Fill;
122 Separator : in Wide_Character := Default_Separator;
123 Radix_Mark : in Wide_Character := Default_Radix_Mark);
128 MAX_PICSIZE : constant := 50;
129 MAX_MONEYSIZE : constant := 10;
130 Invalid_Position : constant := -1;
132 subtype Pic_Index is Natural range 0 .. MAX_PICSIZE;
134 type Picture_Record (Length : Pic_Index := 0) is record
135 Expanded : String (1 .. Length);
138 type Format_Record is record
139 Picture : Picture_Record;
142 Blank_When_Zero : Boolean;
145 Original_BWZ : Boolean;
147 -- The following components get written
149 Star_Fill : Boolean := False;
151 Radix_Position : Integer := Invalid_Position;
154 Second_Sign : Integer := Invalid_Position;
157 End_Float : Integer := Invalid_Position;
160 End_Currency : Integer := Invalid_Position;
162 Max_Leading_Digits : Integer := 0;
164 Max_Trailing_Digits : Integer := 0;
166 Max_Currency_Digits : Integer := 0;
168 Floater : Wide_Character := '!';
169 -- Initialized to illegal value
173 type Picture is record
174 Contents : Format_Record;
177 type Number_Attributes is record
178 Negative : Boolean := False;
180 Has_Fraction : Boolean := False;
185 End_Of_Fraction : Integer := Invalid_Position; -- invalid value
188 function Parse_Number_String (Str : String) return Number_Attributes;
189 -- Assumed format is 'IMAGE or Fixed_IO.Put format (depends on no
190 -- trailing blanks...)
192 procedure Precalculate (Pic : in out Format_Record);
193 -- Precalculates fields from the user supplied data
195 function Format_Number
196 (Pic : Format_Record;
198 Currency_Symbol : Wide_String;
199 Fill_Character : Wide_Character;
200 Separator_Character : Wide_Character;
201 Radix_Point : Wide_Character)
203 -- Formats number according to Pic
205 function Expand (Picture : in String) return String;
207 end Ada.Wide_Text_IO.Editing;