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