OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [ada/] [a-wtedit.ads] - Blame information for rev 313

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 281 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT RUN-TIME COMPONENTS                         --
4
--                                                                          --
5
--             A D A . W I D E _ T E X T _ I O . E D I T I N G              --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
10
--                                                                          --
11
-- This specification is derived from the Ada Reference Manual for use with --
12
-- GNAT. The copyright notice above, and the license provisions that follow --
13
-- apply solely to the  contents of the part following the private keyword. --
14
--                                                                          --
15
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
16
-- terms of the  GNU General Public License as published  by the Free Soft- --
17
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
18
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
19
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
20
-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
21
--                                                                          --
22
-- As a special exception under Section 7 of GPL version 3, you are granted --
23
-- additional permissions described in the GCC Runtime Library Exception,   --
24
-- version 3.1, as published by the Free Software Foundation.               --
25
--                                                                          --
26
-- You should have received a copy of the GNU General Public License and    --
27
-- a copy of the GCC Runtime Library Exception along with this program;     --
28
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
29
-- <http://www.gnu.org/licenses/>.                                          --
30
--                                                                          --
31
-- GNAT was originally developed  by the GNAT team at  New York University. --
32
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
33
--                                                                          --
34
------------------------------------------------------------------------------
35
 
36
package Ada.Wide_Text_IO.Editing is
37
 
38
   type Picture is private;
39
 
40
   function Valid
41
     (Pic_String      : String;
42
      Blank_When_Zero : Boolean := False) return Boolean;
43
 
44
   function To_Picture
45
     (Pic_String      : String;
46
      Blank_When_Zero : Boolean := False) return Picture;
47
 
48
   function Pic_String      (Pic : Picture) return String;
49
   function Blank_When_Zero (Pic : Picture) return Boolean;
50
 
51
   Max_Picture_Length : constant := 64;
52
 
53
   Picture_Error : exception;
54
 
55
   Default_Currency   : constant Wide_String    := "$";
56
   Default_Fill       : constant Wide_Character := ' ';
57
   Default_Separator  : constant Wide_Character := ',';
58
   Default_Radix_Mark : constant Wide_Character := '.';
59
 
60
   generic
61
      type Num is delta <> digits <>;
62
      Default_Currency   : Wide_String :=
63
                                Wide_Text_IO.Editing.Default_Currency;
64
      Default_Fill       : Wide_Character :=
65
                                Wide_Text_IO.Editing.Default_Fill;
66
      Default_Separator  : Wide_Character :=
67
                                Wide_Text_IO.Editing.Default_Separator;
68
      Default_Radix_Mark : Wide_Character :=
69
                                Wide_Text_IO.Editing.Default_Radix_Mark;
70
 
71
   package Decimal_Output is
72
 
73
      function Length
74
        (Pic      : Picture;
75
         Currency : Wide_String := Default_Currency) return Natural;
76
 
77
      function Valid
78
        (Item     : Num;
79
         Pic      : Picture;
80
         Currency : Wide_String := Default_Currency) return Boolean;
81
 
82
      function Image
83
        (Item       : Num;
84
         Pic        : Picture;
85
         Currency   : Wide_String    := Default_Currency;
86
         Fill       : Wide_Character := Default_Fill;
87
         Separator  : Wide_Character := Default_Separator;
88
         Radix_Mark : Wide_Character := Default_Radix_Mark) return Wide_String;
89
 
90
      procedure Put
91
        (File       : File_Type;
92
         Item       : Num;
93
         Pic        : Picture;
94
         Currency   : Wide_String    := Default_Currency;
95
         Fill       : Wide_Character := Default_Fill;
96
         Separator  : Wide_Character := Default_Separator;
97
         Radix_Mark : Wide_Character := Default_Radix_Mark);
98
 
99
      procedure Put
100
        (Item       : Num;
101
         Pic        : Picture;
102
         Currency   : Wide_String    := Default_Currency;
103
         Fill       : Wide_Character := Default_Fill;
104
         Separator  : Wide_Character := Default_Separator;
105
         Radix_Mark : Wide_Character := Default_Radix_Mark);
106
 
107
      procedure Put
108
        (To         : out Wide_String;
109
         Item       : Num;
110
         Pic        : Picture;
111
         Currency   : Wide_String    := Default_Currency;
112
         Fill       : Wide_Character := Default_Fill;
113
         Separator  : Wide_Character := Default_Separator;
114
         Radix_Mark : Wide_Character := Default_Radix_Mark);
115
 
116
   end Decimal_Output;
117
 
118
private
119
   MAX_PICSIZE      : constant := 50;
120
   MAX_MONEYSIZE    : constant := 10;
121
   Invalid_Position : constant := -1;
122
 
123
   subtype Pic_Index is Natural range 0 .. MAX_PICSIZE;
124
 
125
   type Picture_Record (Length : Pic_Index := 0) is record
126
      Expanded : String (1 .. Length);
127
   end record;
128
 
129
   type Format_Record is record
130
      Picture              : Picture_Record;
131
      --  Read only
132
 
133
      Blank_When_Zero      : Boolean;
134
      --  Read/write
135
 
136
      Original_BWZ         : Boolean;
137
 
138
      --  The following components get written
139
 
140
      Star_Fill            : Boolean := False;
141
 
142
      Radix_Position       : Integer := Invalid_Position;
143
 
144
      Sign_Position,
145
      Second_Sign          : Integer := Invalid_Position;
146
 
147
      Start_Float,
148
      End_Float            : Integer := Invalid_Position;
149
 
150
      Start_Currency,
151
      End_Currency         : Integer := Invalid_Position;
152
 
153
      Max_Leading_Digits   : Integer := 0;
154
 
155
      Max_Trailing_Digits  : Integer := 0;
156
 
157
      Max_Currency_Digits  : Integer := 0;
158
 
159
      Floater              : Wide_Character := '!';
160
      --  Initialized to illegal value
161
 
162
   end record;
163
 
164
   type Picture is record
165
      Contents : Format_Record;
166
   end record;
167
 
168
   type Number_Attributes is record
169
      Negative     : Boolean := False;
170
 
171
      Has_Fraction : Boolean := False;
172
 
173
      Start_Of_Int,
174
      End_Of_Int,
175
      Start_Of_Fraction,
176
      End_Of_Fraction : Integer := Invalid_Position;    -- invalid value
177
   end record;
178
 
179
   function Parse_Number_String (Str : String) return Number_Attributes;
180
   --  Assumed format is 'IMAGE or Fixed_IO.Put format (depends on no
181
   --  trailing blanks...)
182
 
183
   procedure Precalculate (Pic : in out Format_Record);
184
   --  Precalculates fields from the user supplied data
185
 
186
   function Format_Number
187
     (Pic                 : Format_Record;
188
      Number              : String;
189
      Currency_Symbol     : Wide_String;
190
      Fill_Character      : Wide_Character;
191
      Separator_Character : Wide_Character;
192
      Radix_Point         : Wide_Character) return Wide_String;
193
   --  Formats number according to Pic
194
 
195
   function Expand (Picture : String) return String;
196
 
197
end Ada.Wide_Text_IO.Editing;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.