annotate gcc/ada/libgnat/i-fortra.ads @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
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 COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- I N T E R F A C E S . F O R T R A N --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- This specification is derived from the Ada Reference Manual for use with --
kono
parents:
diff changeset
10 -- GNAT. In accordance with the copyright of that document, you can freely --
kono
parents:
diff changeset
11 -- copy and modify this specification, provided that if you redistribute a --
kono
parents:
diff changeset
12 -- modified version, any changes that you have made are clearly indicated. --
kono
parents:
diff changeset
13 -- --
kono
parents:
diff changeset
14 ------------------------------------------------------------------------------
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 with Ada.Numerics.Generic_Complex_Types;
kono
parents:
diff changeset
17 pragma Elaborate_All (Ada.Numerics.Generic_Complex_Types);
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 package Interfaces.Fortran is
kono
parents:
diff changeset
20 pragma Pure;
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 type Fortran_Integer is new Integer;
kono
parents:
diff changeset
23 type Real is new Float;
kono
parents:
diff changeset
24 type Double_Precision is new Long_Float;
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 type Logical is new Boolean;
kono
parents:
diff changeset
27 for Logical'Size use Integer'Size;
kono
parents:
diff changeset
28 pragma Convention (Fortran, Logical);
kono
parents:
diff changeset
29 -- As required by Fortran standard, logical allocates same space as
kono
parents:
diff changeset
30 -- an integer. The convention is important, since in Fortran, Booleans
kono
parents:
diff changeset
31 -- are implemented with zero/non-zero semantics for False/True, and the
kono
parents:
diff changeset
32 -- pragma Convention (Fortran) activates the special handling required
kono
parents:
diff changeset
33 -- in this case.
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 package Single_Precision_Complex_Types is
kono
parents:
diff changeset
36 new Ada.Numerics.Generic_Complex_Types (Real);
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 package Double_Precision_Complex_Types is
kono
parents:
diff changeset
39 new Ada.Numerics.Generic_Complex_Types (Double_Precision);
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 type Complex is new Single_Precision_Complex_Types.Complex;
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 type Double_Complex is new Double_Precision_Complex_Types.Complex;
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 subtype Imaginary is Single_Precision_Complex_Types.Imaginary;
kono
parents:
diff changeset
46 i : Imaginary renames Single_Precision_Complex_Types.i;
kono
parents:
diff changeset
47 j : Imaginary renames Single_Precision_Complex_Types.j;
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 type Character_Set is new Character;
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 type Fortran_Character is array (Positive range <>) of Character_Set;
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 -- Additional declarations as permitted by Ada 2012, p.608, paragraph 21.
kono
parents:
diff changeset
54 -- Interoperability with Fortran 77's vendor extension using star
kono
parents:
diff changeset
55 -- notation and Fortran 90's intrinsic types with kind=n parameter.
kono
parents:
diff changeset
56 -- The following assumes that `n' matches the byte size, which
kono
parents:
diff changeset
57 -- most Fortran compiler, including GCC's follow.
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 type Integer_Star_1 is new Integer_8;
kono
parents:
diff changeset
60 type Integer_Kind_1 is new Integer_8;
kono
parents:
diff changeset
61 type Integer_Star_2 is new Integer_16;
kono
parents:
diff changeset
62 type Integer_Kind_2 is new Integer_16;
kono
parents:
diff changeset
63 type Integer_Star_4 is new Integer_32;
kono
parents:
diff changeset
64 type Integer_Kind_4 is new Integer_32;
kono
parents:
diff changeset
65 type Integer_Star_8 is new Integer_64;
kono
parents:
diff changeset
66 type Integer_Kind_8 is new Integer_64;
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 type Logical_Star_1 is new Boolean with Convention => Fortran, Size => 8;
kono
parents:
diff changeset
69 type Logical_Star_2 is new Boolean with Convention => Fortran, Size => 16;
kono
parents:
diff changeset
70 type Logical_Star_4 is new Boolean with Convention => Fortran, Size => 32;
kono
parents:
diff changeset
71 type Logical_Star_8 is new Boolean with Convention => Fortran, Size => 64;
kono
parents:
diff changeset
72 type Logical_Kind_1 is new Boolean with Convention => Fortran, Size => 8;
kono
parents:
diff changeset
73 type Logical_Kind_2 is new Boolean with Convention => Fortran, Size => 16;
kono
parents:
diff changeset
74 type Logical_Kind_4 is new Boolean with Convention => Fortran, Size => 32;
kono
parents:
diff changeset
75 type Logical_Kind_8 is new Boolean with Convention => Fortran, Size => 64;
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 type Real_Star_4 is new Float;
kono
parents:
diff changeset
78 type Real_Kind_4 is new Float;
kono
parents:
diff changeset
79 type Real_Star_8 is new Long_Float;
kono
parents:
diff changeset
80 type Real_Kind_8 is new Long_Float;
kono
parents:
diff changeset
81 -- In the kind syntax, n is the same as the associated real kind
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 type Complex_Star_8 is new Complex;
kono
parents:
diff changeset
84 type Complex_Kind_4 is new Complex;
kono
parents:
diff changeset
85 type Complex_Star_16 is new Double_Complex;
kono
parents:
diff changeset
86 type Complex_Kind_8 is new Double_Complex;
kono
parents:
diff changeset
87 -- In the star syntax, n is twice as large (real+imaginary size)
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 type Character_Kind_n is new Fortran_Character;
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 function To_Fortran (Item : Character) return Character_Set;
kono
parents:
diff changeset
92 function To_Ada (Item : Character_Set) return Character;
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 function To_Fortran (Item : String) return Fortran_Character;
kono
parents:
diff changeset
95 function To_Ada (Item : Fortran_Character) return String;
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 procedure To_Fortran
kono
parents:
diff changeset
98 (Item : String;
kono
parents:
diff changeset
99 Target : out Fortran_Character;
kono
parents:
diff changeset
100 Last : out Natural);
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 procedure To_Ada
kono
parents:
diff changeset
103 (Item : Fortran_Character;
kono
parents:
diff changeset
104 Target : out String;
kono
parents:
diff changeset
105 Last : out Natural);
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 end Interfaces.Fortran;