[AArch64] Remove simd_type
[official-gcc.git] / gcc / ada / s-diflio.ads
blobf866f4aad84d3bd8203d73ac382f1c8cb842a560
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . D I M . F L O A T _ I O --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2011-2012, 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 ------------------------------------------------------------------------------
32 -- This package provides output routines for float dimensioned types. All Put
33 -- routines are modelled after those in package Ada.Text_IO.Float_IO with the
34 -- addition of an extra default parameter. All Put_Dim_Of routines
35 -- output the dimension of Item in a symbolic manner.
37 -- Parameter Symbol may be used in the following manner (all the examples are
38 -- based on the MKS system of units defined in package System.Dim.Mks):
40 -- type Mks_Type is new Long_Long_Float
41 -- with
42 -- Dimension_System => (
43 -- (Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'),
44 -- (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'),
45 -- (Unit_Name => Second, Unit_Symbol => 's', Dim_Symbol => 'T'),
46 -- (Unit_Name => Ampere, Unit_Symbol => 'A', Dim_Symbol => 'I'),
47 -- (Unit_Name => Kelvin, Unit_Symbol => 'K', Dim_Symbol => "Θ"),
48 -- (Unit_Name => Mole, Unit_Symbol => "mol", Dim_Symbol => 'N'),
49 -- (Unit_Name => Candela, Unit_Symbol => "cd", Dim_Symbol => 'J'));
51 -- Case 1. A value is supplied for Symbol
53 -- * Put : The string appears as a suffix of Item
55 -- * Put_Dim_Of : The string appears alone
57 -- Obj : Mks_Type := 2.6;
58 -- Put (Obj, 1, 1, 0, " dimensionless");
59 -- Put_Dim_Of (Obj, "dimensionless");
61 -- The corresponding outputs are:
62 -- $2.6 dimensionless
63 -- $dimensionless
65 -- Case 2. No value is supplied for Symbol and Item is dimensionless
67 -- * Put : Item appears without a suffix
69 -- * Put_Dim_Of : the output is []
71 -- Obj : Mks_Type := 2.6;
72 -- Put (Obj, 1, 1, 0);
73 -- Put_Dim_Of (Obj);
75 -- The corresponding outputs are:
76 -- $2.6
77 -- $[]
79 -- Case 3. No value is supplied for Symbol and Item has a dimension
81 -- * Put : If the type of Item is a dimensioned subtype whose
82 -- symbol is not empty, then the symbol appears as a suffix.
83 -- Otherwise, a new string is created and appears as a
84 -- suffix of Item. This string results in the successive
85 -- concatenations between each unit symbol raised by its
86 -- corresponding dimension power from the dimensions of Item.
88 -- * Put_Dim_Of : The output is a new string resulting in the successive
89 -- concatenations between each dimension symbol raised by its
90 -- corresponding dimension power from the dimensions of Item.
92 -- subtype Length is Mks_Type
93 -- with
94 -- Dimension => ('m',
95 -- Meter => 1,
96 -- others => 0);
98 -- Obj : Length := 2.3 * dm;
99 -- Put (Obj, 1, 2, 0);
100 -- Put_Dim_Of (Obj);
102 -- The corresponding outputs are:
103 -- $0.23 m
104 -- $[L]
106 -- subtype Random is Mks_Type
107 -- with
108 -- Dimension => (
109 -- Meter => 3,
110 -- Candela => -1,
111 -- others => 0);
113 -- Obj : Random := 5.0;
114 -- Put (Obj);
115 -- Put_Dim_Of (Obj);
117 -- The corresponding outputs are:
118 -- $5.0 m**3.cd**(-1)
119 -- $[l**3.J**(-1)]
121 -- Put (3.3 * km * dm * min, 5, 1, 0);
122 -- Put_Dim_Of (3.3 * km * dm * min);
124 -- The corresponding outputs are:
125 -- $19800.0 m**2.s
126 -- $[L**2.T]
128 with Ada.Text_IO; use Ada.Text_IO;
130 generic
131 type Num_Dim_Float is digits <>;
133 package System.Dim.Float_IO is
135 Default_Fore : Field := 2;
136 Default_Aft : Field := Num_Dim_Float'Digits - 1;
137 Default_Exp : Field := 3;
139 procedure Put
140 (File : File_Type;
141 Item : Num_Dim_Float;
142 Fore : Field := Default_Fore;
143 Aft : Field := Default_Aft;
144 Exp : Field := Default_Exp;
145 Symbol : String := "");
147 procedure Put
148 (Item : Num_Dim_Float;
149 Fore : Field := Default_Fore;
150 Aft : Field := Default_Aft;
151 Exp : Field := Default_Exp;
152 Symbol : String := "");
154 procedure Put
155 (To : out String;
156 Item : Num_Dim_Float;
157 Aft : Field := Default_Aft;
158 Exp : Field := Default_Exp;
159 Symbol : String := "");
161 procedure Put_Dim_Of
162 (File : File_Type;
163 Item : Num_Dim_Float;
164 Symbol : String := "");
166 procedure Put_Dim_Of
167 (Item : Num_Dim_Float;
168 Symbol : String := "");
170 procedure Put_Dim_Of
171 (To : out String;
172 Item : Num_Dim_Float;
173 Symbol : String := "");
175 pragma Inline (Put);
176 pragma Inline (Put_Dim_Of);
178 end System.Dim.Float_IO;