annotate gcc/ada/libgnat/a-ztflio.adb @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- A D A . W I D E _ W I D E _ T E X T _ I O . F L O A T _ I O --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- B o d y --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 with Ada.Wide_Wide_Text_IO.Float_Aux;
kono
parents:
diff changeset
33 with System.WCh_Con; use System.WCh_Con;
kono
parents:
diff changeset
34 with System.WCh_WtS; use System.WCh_WtS;
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 package body Ada.Wide_Wide_Text_IO.Float_IO is
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 subtype TFT is Ada.Wide_Wide_Text_IO.File_Type;
kono
parents:
diff changeset
39 -- File type required for calls to routines in Aux
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 package Aux renames Ada.Wide_Wide_Text_IO.Float_Aux;
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 ---------
kono
parents:
diff changeset
44 -- Get --
kono
parents:
diff changeset
45 ---------
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 procedure Get
kono
parents:
diff changeset
48 (File : File_Type;
kono
parents:
diff changeset
49 Item : out Num;
kono
parents:
diff changeset
50 Width : Field := 0)
kono
parents:
diff changeset
51 is
kono
parents:
diff changeset
52 begin
kono
parents:
diff changeset
53 Aux.Get (TFT (File), Long_Long_Float (Item), Width);
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 exception
kono
parents:
diff changeset
56 when Constraint_Error => raise Data_Error;
kono
parents:
diff changeset
57 end Get;
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 procedure Get
kono
parents:
diff changeset
60 (Item : out Num;
kono
parents:
diff changeset
61 Width : Field := 0)
kono
parents:
diff changeset
62 is
kono
parents:
diff changeset
63 begin
kono
parents:
diff changeset
64 Get (Current_Input, Item, Width);
kono
parents:
diff changeset
65 end Get;
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 procedure Get
kono
parents:
diff changeset
68 (From : Wide_Wide_String;
kono
parents:
diff changeset
69 Item : out Num;
kono
parents:
diff changeset
70 Last : out Positive)
kono
parents:
diff changeset
71 is
kono
parents:
diff changeset
72 S : constant String := Wide_Wide_String_To_String (From, WCEM_Upper);
kono
parents:
diff changeset
73 -- String on which we do the actual conversion. Note that the method
kono
parents:
diff changeset
74 -- used for wide character encoding is irrelevant, since if there is
kono
parents:
diff changeset
75 -- a character outside the Standard.Character range then the call to
kono
parents:
diff changeset
76 -- Aux.Gets will raise Data_Error in any case.
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 begin
kono
parents:
diff changeset
79 Aux.Gets (S, Long_Long_Float (Item), Last);
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 exception
kono
parents:
diff changeset
82 when Constraint_Error => raise Data_Error;
kono
parents:
diff changeset
83 end Get;
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 ---------
kono
parents:
diff changeset
86 -- Put --
kono
parents:
diff changeset
87 ---------
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 procedure Put
kono
parents:
diff changeset
90 (File : File_Type;
kono
parents:
diff changeset
91 Item : Num;
kono
parents:
diff changeset
92 Fore : Field := Default_Fore;
kono
parents:
diff changeset
93 Aft : Field := Default_Aft;
kono
parents:
diff changeset
94 Exp : Field := Default_Exp)
kono
parents:
diff changeset
95 is
kono
parents:
diff changeset
96 begin
kono
parents:
diff changeset
97 Aux.Put (TFT (File), Long_Long_Float (Item), Fore, Aft, Exp);
kono
parents:
diff changeset
98 end Put;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 procedure Put
kono
parents:
diff changeset
101 (Item : Num;
kono
parents:
diff changeset
102 Fore : Field := Default_Fore;
kono
parents:
diff changeset
103 Aft : Field := Default_Aft;
kono
parents:
diff changeset
104 Exp : Field := Default_Exp)
kono
parents:
diff changeset
105 is
kono
parents:
diff changeset
106 begin
kono
parents:
diff changeset
107 Put (Current_Output, Item, Fore, Aft, Exp);
kono
parents:
diff changeset
108 end Put;
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 procedure Put
kono
parents:
diff changeset
111 (To : out Wide_Wide_String;
kono
parents:
diff changeset
112 Item : Num;
kono
parents:
diff changeset
113 Aft : Field := Default_Aft;
kono
parents:
diff changeset
114 Exp : Field := Default_Exp)
kono
parents:
diff changeset
115 is
kono
parents:
diff changeset
116 S : String (To'First .. To'Last);
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 begin
kono
parents:
diff changeset
119 Aux.Puts (S, Long_Long_Float (Item), Aft, Exp);
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 for J in S'Range loop
kono
parents:
diff changeset
122 To (J) := Wide_Wide_Character'Val (Character'Pos (S (J)));
kono
parents:
diff changeset
123 end loop;
kono
parents:
diff changeset
124 end Put;
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 end Ada.Wide_Wide_Text_IO.Float_IO;