The FORTRAN–Pascal Interface
171
8
Fixed Arrays
For a fixed array parameter, pass the same type and size by reference, as
shown in the following example:
The commands to compile and
execute
StrVar.p
and
StrVarmain.f
hostname% pc -c StrVar.p
hostname% f77 StrVar.o StrVarmain.f -lpfc -lpc
StrVarmain.f:
MAIN:
hostname% a.out
s10='abcdefghij'
s80='abcdefghijklmnopqrtstuvwxyz
s25='oyvay'
The Pascal procedure,
FixVec.p
type
VecTyp = array [0..8] of integer;
procedure fixvec_(var V: VecTyp; var Total: integer);
var
i: integer;
begin
Total := 0;
for i := 0 to 8 do
Total := Total + V[i]
end; { fixvec_ }
The FORTRAN main program,
FixVecmain.f
integer Sum
integer a(9)
data a / 1,2,3,4,5,6,7,8,9 /
call FixVec ( a, Sum )
write( *, "( I3 )") Sum
stop
end
Summary of Contents for SunSoft Pascal 4.0
Page 14: ...xiv Pascal 4 0 User s Guide ...
Page 16: ...xvi Pascal 4 0 User s Guide ...
Page 30: ...6 Pascal 4 0 User s Guide 1 ...
Page 160: ...136 Pascal 4 0 User s Guide 6 ...
Page 268: ...244 Pascal 4 0 User s Guide 11 ...
Page 320: ...296 Pascal 4 0 User s Guide B ...
Page 331: ...Index 307 ...
Page 333: ......