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