aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/s-dimmks.ads
blob: fa0c6e0356dac4311c12dbd0892ec891ed8446aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
------------------------------------------------------------------------------
--                                                                          --
--                         GNAT RUN-TIME COMPONENTS                         --
--                                                                          --
--                        S Y S T E M . D I M . M K S                       --
--                                                                          --
--                                  S p e c                                 --
--                                                                          --
--          Copyright (C) 2011-2012, Free Software Foundation, Inc.         --
--                                                                          --
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
--                                                                          --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception,   --
-- version 3.1, as published by the Free Software Foundation.               --
--                                                                          --
-- You should have received a copy of the GNU General Public License and    --
-- a copy of the GCC Runtime Library Exception along with this program;     --
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-- <http://www.gnu.org/licenses/>.                                          --
--                                                                          --
-- GNAT was originally developed  by the GNAT team at  New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
--                                                                          --
------------------------------------------------------------------------------

--  Defines the MKS dimension system which is the SI system of units

--  Some other prefixes of this system are defined in a child package (see
--  System.Dim_Mks.Other_Prefixes) in order to avoid too many constant
--  declarations in this package.

--  The dimension terminology is defined in System.Dim_IO package

with Ada.Numerics;

package System.Dim.Mks is

   e  : constant := Ada.Numerics.e;
   Pi : constant := Ada.Numerics.Pi;

   --  Dimensioned type Mks_Type

   type Mks_Type is new Long_Long_Float
     with
      Dimension_System => (
        (Unit_Name => Meter,    Unit_Symbol => 'm',   Dim_Symbol => 'L'),
        (Unit_Name => Kilogram, Unit_Symbol => "kg",  Dim_Symbol => 'M'),
        (Unit_Name => Second,   Unit_Symbol => 's',   Dim_Symbol => 'T'),
        (Unit_Name => Ampere,   Unit_Symbol => 'A',   Dim_Symbol => 'I'),
        (Unit_Name => Kelvin,   Unit_Symbol => 'K',   Dim_Symbol => "Θ"),
        (Unit_Name => Mole,     Unit_Symbol => "mol", Dim_Symbol => 'N'),
        (Unit_Name => Candela,  Unit_Symbol => "cd",  Dim_Symbol => 'J'));

   --  SI Base dimensioned subtype

   subtype Length is Mks_Type
     with
      Dimension => (Symbol => 'm',
        Meter  => 1,
        others => 0);

   subtype Mass is Mks_Type
     with
      Dimension => (Symbol => "kg",
        Kilogram => 1,
        others =>   0);

   subtype Time is Mks_Type
     with
      Dimension => (Symbol => 's',
        Second => 1,
        others => 0);

   subtype Electric_Current is Mks_Type
     with
      Dimension => (Symbol => 'A',
        Ampere => 1,
        others => 0);

   subtype Thermodynamic_Temperature is Mks_Type
     with
      Dimension => (Symbol => 'K',
        Kelvin => 1,
        others => 0);

   subtype Amount_Of_Substance is Mks_Type
     with
      Dimension => (Symbol => "mol",
        Mole =>   1,
        others => 0);

   subtype Luminous_Intensity is Mks_Type
     with
      Dimension => (Symbol => "cd",
        Candela => 1,
        others =>  0);

   --  SI Base units

   pragma Warnings (Off);
   --  Turn off the all the dimension warnings

   m   : constant Length                    := 1.0;
   kg  : constant Mass                      := 1.0;
   s   : constant Time                      := 1.0;
   A   : constant Electric_Current          := 1.0;
   K   : constant Thermodynamic_Temperature := 1.0;
   mol : constant Amount_Of_Substance       := 1.0;
   cd  : constant Luminous_Intensity        := 1.0;

   pragma Warnings (On);

   --  SI Derived dimensioned subtypes

   subtype Absorbed_Dose is Mks_Type
     with
      Dimension => (Symbol => "Gy",
        Meter =>  2,
        Second => -2,
        others => 0);

   subtype Angle is Mks_Type
     with
      Dimension => (Symbol => "rad",
        others => 0);

   subtype Area is Mks_Type
     with
      Dimension => (
        Meter =>  2,
        others => 0);

   subtype Catalytic_Activity is Mks_Type
     with
      Dimension => (Symbol => "kat",
        Second => -1,
        Mole =>   1,
        others => 0);

   subtype Celsius_Temperature is Mks_Type
     with
      Dimension => (Symbol => "°C",
        Kelvin => 1,
        others => 0);

   subtype Electric_Capacitance is Mks_Type
     with
      Dimension => (Symbol => 'F',
        Meter =>    -2,
        Kilogram => -1,
        Second =>   4,
        Ampere =>   2,
        others =>   0);

   subtype Electric_Charge is Mks_Type
     with
      Dimension => (Symbol => 'C',
        Second => 1,
        Ampere => 1,
        others => 0);

   subtype Electric_Conductance is Mks_Type
     with
      Dimension => (Symbol => 'S',
        Meter =>    -2,
        Kilogram => -1,
        Second =>   3,
        Ampere =>   2,
        others =>   0);

   subtype Electric_Potential_Difference is Mks_Type
     with
      Dimension => (Symbol => 'V',
        Meter =>    2,
        Kilogram => 1,
        Second =>   -3,
        Ampere =>   -1,
        others =>   0);

   subtype Electric_Resistance is Mks_Type
     with
      Dimension => (Symbol => "Ω",
        Meter =>    2,
        Kilogram => 1,
        Second =>   -3,
        Ampere =>   -2,
        others =>   0);

   subtype Energy is Mks_Type
     with
      Dimension => (Symbol => 'J',
        Meter =>    2,
        Kilogram => 1,
        Second =>   -2,
        others =>   0);

   subtype Equivalent_Dose is Mks_Type
     with
      Dimension => (Symbol => "Sv",
        Meter =>  2,
        Second => -2,
        others => 0);

   subtype Force is Mks_Type
     with
      Dimension => (Symbol => 'N',
        Meter =>    1,
        Kilogram => 1,
        Second =>  -2,
        others =>   0);

   subtype Frequency is Mks_Type
     with
      Dimension => (Symbol => "Hz",
        Second => -1,
        others => 0);

   subtype Illuminance is Mks_Type
     with
      Dimension => (Symbol => "lx",
        Meter =>   -2,
        Candela => 1,
        others =>  0);

   subtype Inductance is Mks_Type
     with
      Dimension => (Symbol => 'H',
        Meter =>    2,
        Kilogram => 1,
        Second =>   -2,
        Ampere =>   -2,
        others =>   0);

   subtype Luminous_Flux is Mks_Type
     with
      Dimension => (Symbol => "lm",
        Candela => 1,
        others =>  0);

   subtype Magnetic_Flux is Mks_Type
     with
      Dimension => (Symbol => "Wb",
        Meter =>    2,
        Kilogram => 1,
        Second =>   -2,
        Ampere =>   -1,
        others =>   0);

   subtype Magnetic_Flux_Density is Mks_Type
     with
      Dimension => (Symbol => 'T',
        Kilogram => 1,
        Second =>   -2,
        Ampere =>   -1,
        others =>   0);

   subtype Power is Mks_Type
     with
      Dimension => (Symbol => 'W',
        Meter =>    2,
        Kilogram => 1,
        Second =>   -3,
        others =>   0);

   subtype Pressure is Mks_Type
     with
      Dimension => (Symbol => "Pa",
        Meter =>    -1,
        Kilogram => 1,
        Second =>   -2,
        others =>   0);

   subtype Radioactivity is Mks_Type
     with
      Dimension => (Symbol => "Bq",
        Second => -1,
        others => 0);

   subtype Solid_Angle is Mks_Type
     with
      Dimension => (Symbol => "sr",
        others => 0);

   subtype Speed is Mks_Type
     with
      Dimension => (
        Meter =>  1,
        Second => -1,
        others => 0);

   subtype Volume is Mks_Type
     with
      Dimension => (
        Meter =>  3,
        others => 0);

   pragma Warnings (Off);
   --  Turn off the all the dimension warnings

   rad : constant Angle                         := 1.0;
   sr  : constant Solid_Angle                   := 1.0;
   Hz  : constant Frequency                     := 1.0;
   N   : constant Force                         := 1.0;
   Pa  : constant Pressure                      := 1.0;
   J   : constant Energy                        := 1.0;
   W   : constant Power                         := 1.0;
   C   : constant Electric_Charge               := 1.0;
   V   : constant Electric_Potential_Difference := 1.0;
   F   : constant Electric_Capacitance          := 1.0;
   Ohm : constant Electric_Resistance           := 1.0;
   Si  : constant Electric_Conductance          := 1.0;
   Wb  : constant Magnetic_Flux                 := 1.0;
   T   : constant Magnetic_Flux_Density         := 1.0;
   H   : constant Inductance                    := 1.0;
   dC  : constant Celsius_Temperature           := 273.15;
   lm  : constant Luminous_Flux                 := 1.0;
   lx  : constant Illuminance                   := 1.0;
   Bq  : constant Radioactivity                 := 1.0;
   Gy  : constant Absorbed_Dose                 := 1.0;
   Sv  : constant Equivalent_Dose               := 1.0;
   kat : constant Catalytic_Activity            := 1.0;

   --  SI prefixes for Meter

   um  : constant Length := 1.0E-06;  -- micro (u)
   mm  : constant Length := 1.0E-03;  -- milli
   cm  : constant Length := 1.0E-02;  -- centi
   dm  : constant Length := 1.0E-01;  -- deci
   dam : constant Length := 1.0E+01;  -- deka
   hm  : constant Length := 1.0E+02;  -- hecto
   km  : constant Length := 1.0E+03;  -- kilo
   Mem : constant Length := 1.0E+06;  -- mega

   --  SI prefixes for Kilogram

   ug  : constant Mass := 1.0E-09;  -- micro (u)
   mg  : constant Mass := 1.0E-06;  -- milli
   cg  : constant Mass := 1.0E-05;  -- centi
   dg  : constant Mass := 1.0E-04;  -- deci
   g   : constant Mass := 1.0E-03;  -- gram
   dag : constant Mass := 1.0E-02;  -- deka
   hg  : constant Mass := 1.0E-01;  -- hecto
   Meg : constant Mass := 1.0E+03;  -- mega

   --  SI prefixes for Second

   us  : constant Time := 1.0E-06;  -- micro (u)
   ms  : constant Time := 1.0E-03;  -- milli
   cs  : constant Time := 1.0E-02;  -- centi
   ds  : constant Time := 1.0E-01;  -- deci
   das : constant Time := 1.0E+01;  -- deka
   hs  : constant Time := 1.0E+02;  -- hecto
   ks  : constant Time := 1.0E+03;  -- kilo
   Mes : constant Time := 1.0E+06;  -- mega

   --  Other constants for Second

   min  : constant Time := 60.0 * s;
   hour : constant Time := 60.0 * min;
   day  : constant Time := 24.0 * hour;
   year : constant Time := 365.25 * day;

   --  SI prefixes for Ampere

   mA  : constant Electric_Current := 1.0E-03;  -- milli
   cA  : constant Electric_Current := 1.0E-02;  -- centi
   dA  : constant Electric_Current := 1.0E-01;  -- deci
   daA : constant Electric_Current := 1.0E+01;  -- deka
   hA  : constant Electric_Current := 1.0E+02;  -- hecto
   kA  : constant Electric_Current := 1.0E+03;  -- kilo
   MeA : constant Electric_Current := 1.0E+06;  -- mega

   pragma Warnings (On);
end System.Dim.Mks;