File: AA-B-5.html

package info (click to toggle)
ada-reference-manual 20021112web-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 18,652 kB
  • ctags: 8,921
  • sloc: makefile: 52; sh: 20
file content (235 lines) | stat: -rw-r--r-- 20,650 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>AARM95 - Interfacing with Fortran</TITLE>
    <META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
    <META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
    <STYLE type="text/css">
    DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
    TT {font-family: "Courier New", monospace}
    DT {display: compact}
    DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
    DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Index {font-family: "Times New Roman", Times, serif}
    DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
    DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
    DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left:  10.0em; margin-bottom: 0.6em}
    DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
    DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left:  15.0em; margin-bottom: 0.6em}
    UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
    DD.Hanging {margin-left: 6.0em}
    DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.IndentedHanging {margin-left: 2.0em}
    DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.HangingInBulleted {margin-left: 4.0em}
    DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallHanging {margin-left: 7.5em}
    DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallIndentedHanging {margin-left: 2.0em}
    DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallHangingInBulleted {margin-left: 5.0em}
    DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.Enumerated {margin-left: 2.0em}
    DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallEnumerated {margin-left: 2.5em}
    DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    </STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-B-4.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-C.html">Next</A></P>
<HR>
<H1> B.5 Interfacing with Fortran</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I6582"></A><A NAME="I6583"></A>The facilities
relevant to interfacing with the Fortran language are the package Interfaces.Fortran
and support for the Import, Export and Convention pragmas with <I>convention</I>_<FONT FACE="Arial, Helvetica">identifier</FONT>
Fortran.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;The package Interfaces.Fortran defines Ada types
whose representations are identical to the default representations of
the Fortran intrinsic types Integer, Real, Double Precision, Complex,
Logical, and Character in a supported Fortran implementation. These Ada
types can therefore be used to pass objects between Ada and Fortran programs.
</DIV>

<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;The library package
Interfaces.Fortran has the following declaration: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Examples"><TT><B>with</B>&nbsp;Ada.Numerics.Generic_Complex_Types;&nbsp;&nbsp;<I>--&nbsp;see&nbsp;<A HREF="AA-G-1-1.html">G.1.1</A></I><BR>
<B>pragma</B>&nbsp;Elaborate_All(Ada.Numerics.Generic_Complex_Types);<BR>
<B>package</B>&nbsp;Interfaces.Fortran&nbsp;<B>is</B><A NAME="I6584"></A><A NAME="I6585"></A><A NAME="I6586"></A><BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Pure(Fortran);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6587"></A><A NAME="I6588"></A>Fortran_Integer&nbsp;<B>is</B>&nbsp;<B>range</B>&nbsp;<I>implementation-defined</I>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6589"></A><A NAME="I6590"></A>Real&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>is</B>&nbsp;<B>digits</B>&nbsp;<I>implementation-defined</I>;<BR>
&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6591"></A><A NAME="I6592"></A>Double_Precision&nbsp;<B>is</B>&nbsp;<B>digits</B>&nbsp;<I>implementation-defined</I>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6593"></A><A NAME="I6594"></A>Logical&nbsp;<B>is</B>&nbsp;<B>new</B>&nbsp;Boolean;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>package</B>&nbsp;<A NAME="I6595"></A>Single_Precision_Complex_Types&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>new</B>&nbsp;Ada.Numerics.Generic_Complex_Types&nbsp;(Real);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6596"></A><A NAME="I6597"></A>Complex&nbsp;<B>is</B>&nbsp;<B>new</B>&nbsp;Single_Precision_Complex_Types.Complex;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>subtype</B>&nbsp;<A NAME="I6598"></A>Imaginary&nbsp;<B>is</B>&nbsp;Single_Precision_Complex_Types.Imaginary;<BR>
&nbsp;&nbsp;&nbsp;<A NAME="I6599"></A>i&nbsp;:&nbsp;Imaginary&nbsp;<B>renames</B>&nbsp;Single_Precision_Complex_Types.i;<BR>
&nbsp;&nbsp;&nbsp;<A NAME="I6600"></A>j&nbsp;:&nbsp;Imaginary&nbsp;<B>renames</B>&nbsp;Single_Precision_Complex_Types.j;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6601"></A><A NAME="I6602"></A>Character_Set&nbsp;<B>is</B>&nbsp;<I>implementation-defined&nbsp;character&nbsp;type</I>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6603"></A><A NAME="I6604"></A>Fortran_Character&nbsp;<B>is</B>&nbsp;<B>array</B>&nbsp;(Positive&nbsp;<B>range</B>&nbsp;&lt;&gt;)&nbsp;<B>of</B>&nbsp;Character_Set;<BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Pack&nbsp;(Fortran_Character);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6605"></A><A NAME="I6606"></A>To_Fortran&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Character)&nbsp;<B>return</B>&nbsp;Character_Set;<BR>
&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6607"></A><A NAME="I6608"></A>To_Ada&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Character_Set)&nbsp;<B>return</B>&nbsp;Character;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6609"></A><A NAME="I6610"></A>To_Fortran&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;String)&nbsp;<B>return</B>&nbsp;Fortran_Character;<BR>
&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6611"></A><A NAME="I6612"></A>To_Ada&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Fortran_Character)&nbsp;<B>return</B>&nbsp;String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>procedure</B>&nbsp;<A NAME="I6613"></A><A NAME="I6614"></A>To_Fortran&nbsp;(Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;String;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>out</B>&nbsp;Fortran_Character;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>out</B>&nbsp;Natural);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>procedure</B>&nbsp;<A NAME="I6615"></A><A NAME="I6616"></A>To_Ada&nbsp;(Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Fortran_Character;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Target&nbsp;&nbsp;&nbsp;:&nbsp;<B>out</B>&nbsp;String;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>out</B>&nbsp;Natural);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="Examples"><TT><B>end</B>&nbsp;Interfaces.Fortran;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17.a.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B><U>The
types Fortran_Integer, Real, Double_Precision, and Character_Set in Interfaces.Fortran.</U></FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>The means
by which the Complex type is provided in Interfaces.Fortran creates a
dependence of Interfaces.Fortran on Numerics.Generic_Complex_Types (see
<A HREF="AA-G-1-1.html">G.1.1</A>). This dependence is intentional and
unavoidable, if the Fortran-compatible Complex type is to be useful in
Ada code without duplicating facilities defined elsewhere. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;The types Fortran_Integer, Real, Double_Precision,
Logical, Complex, and Fortran_Character are Fortran-compatible.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;The To_Fortran and To_Ada functions map between
the Ada type Character and the Fortran type Character_Set, and also between
the Ada type String and the Fortran type Fortran_Character. The To_Fortran
and To_Ada procedures have analogous effects to the string conversion
subprograms found in Interfaces.COBOL. </DIV>

<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;An implementation shall support <FONT FACE="Arial, Helvetica">pragma</FONT>
Convention with a Fortran <I>convention</I>_<FONT FACE="Arial, Helvetica">identifier</FONT>
for a Fortran-eligible type (see <A HREF="AA-B-1.html">B.1</A>). </DIV>

<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;An implementation may add additional declarations
to the Fortran interface packages. For example, the Fortran interface
package for an implementation of Fortran 77 (ANSI X3.9-1978) that defines
types like Integer*<I>n</I>, Real*<I>n</I>, Logical*<I>n</I>, and Complex*<I>n</I>
may contain the declarations of types named Integer_Star_<I>n</I>, Real_Star_<I>n</I>,
Logical_Star_<I>n</I>, and Complex_Star_<I>n</I>. (This convention should
not apply to Character*<I>n</I>, for which the Ada analog is the constrained
array subtype Fortran_Character (1..<I>n</I>).) Similarly, the Fortran
interface package for an implementation of Fortran 90 that provides multiple
<I>kinds</I> of intrinsic types, e.g. Integer (Kind=<I>n</I>), Real (Kind=<I>n</I>),
Logical (Kind=<I>n</I>), Complex (Kind=<I>n</I>), and Character (Kind=<I>n</I>),
may contain the declarations of types with the recommended names Integer_Kind_<I>n</I>,
Real_Kind_<I>n</I>, Logical_Kind_<I>n</I>, Complex_Kind_<I>n</I>, and
Character_Kind_<I>n</I>. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>Implementations
may add auxiliary declarations as needed to assist in the declarations
of additional Fortran-compatible types. For example, if a double precision
complex type is defined, then Numerics.Generic_Complex_Types may be instantiated
for the double precision type. Similarly, if a wide character type is
defined to match a Fortran 90 wide character type (accessible in Fortran
90 with the Kind modifier), then an auxiliary character set may be declared
to serve as its component type. </FONT></DIV>

<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;An Ada implementation
should support the following interface correspondences between Ada and
Fortran: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An Ada procedure corresponds to a Fortran subroutine.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An Ada function corresponds to a Fortran function.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An Ada parameter of an elementary, array, or record type
T is passed as a T<SUB><FONT SIZE=+1><FONT SIZE=-2>F</FONT></FONT></SUB>
argument to a Fortran procedure, where T<SUB><FONT SIZE=+1><FONT SIZE=-2>F</FONT></FONT></SUB>
is the Fortran type corresponding to the Ada type T, and where the INTENT
attribute of the corresponding dummy argument matches the Ada formal
parameter mode; the Fortran implementation's parameter passing conventions
are used. For elementary types, a local copy is used if necessary to
ensure by-copy semantics.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An Ada parameter of an access-to-subprogram type is passed
as a reference to a Fortran procedure whose interface corresponds to
the designated subprogram's specification. </LI></UL>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>17&nbsp;&nbsp;An object of a Fortran-compatible
record type, declared in a library package or subprogram, can correspond
to a Fortran common block; the type also corresponds to a Fortran ``derived
type''. </FONT></DIV>

<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<I>Example of Interfaces.Fortran:</I>
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="Examples"><TT><B>with</B>&nbsp;Interfaces.Fortran;<BR>
<B>use</B>&nbsp;Interfaces.Fortran;<BR>
<B>procedure</B>&nbsp;Ada_Application&nbsp;<B>is</B></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;Fortran_Matrix&nbsp;<B>is</B>&nbsp;<B>array</B>&nbsp;(Integer&nbsp;<B>range</B>&nbsp;&lt;&gt;,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Integer&nbsp;<B>range</B>&nbsp;&lt;&gt;)&nbsp;<B>of</B>&nbsp;Double_Precision;<BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Convention&nbsp;(Fortran,&nbsp;Fortran_Matrix);&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;stored&nbsp;in&nbsp;Fortran's</I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;column-major&nbsp;order</I><BR>
&nbsp;&nbsp;&nbsp;<B>procedure</B>&nbsp;Invert&nbsp;(Rank&nbsp;:&nbsp;<B>in</B>&nbsp;Fortran_Integer;&nbsp;X&nbsp;:&nbsp;<B>in</B>&nbsp;<B>out</B>&nbsp;Fortran_Matrix);<BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Import&nbsp;(Fortran,&nbsp;Invert);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;a&nbsp;Fortran&nbsp;subroutine</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;Rank&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;Fortran_Integer&nbsp;:=&nbsp;100;<BR>
&nbsp;&nbsp;&nbsp;My_Matrix&nbsp;:&nbsp;Fortran_Matrix&nbsp;(1&nbsp;..&nbsp;Rank,&nbsp;1&nbsp;..&nbsp;Rank);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<DIV Class="Examples"><TT><B>begin</B></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;...<BR>
&nbsp;&nbsp;&nbsp;My_Matrix&nbsp;:=&nbsp;...;<BR>
&nbsp;&nbsp;&nbsp;...<BR>
&nbsp;&nbsp;&nbsp;Invert&nbsp;(Rank,&nbsp;My_Matrix);<BR>
&nbsp;&nbsp;&nbsp;...</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DIV Class="Examples"><TT><B>end</B>&nbsp;Ada_Application;</TT></DIV>

<HR>
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-B-4.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-C.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>