168
Pascal 4.0 User’s Guide
8
Procedure Calls: FORTRAN-Pascal
Here are examples of how a FORTRAN main program calls a Pascal procedure.
Variable Parameters
Pascal passes all
var
parameters by reference, FORTRAN’s default.
Simple Types without the
–xl
Option
With
var
parameters, simple types match.
The Pascal procedure,
Samp.p
.
Note the procedure definition.
The procedure name in the
procedure statement is in
lowercase with a trailing
underscore (_). This format is
required to match the conventions
of the FORTRAN compiler.
var
parameters are used to match
FORTRAN defaults.
procedure samp_(var i: integer; var r: real);
begin
i := 9;
r := 9.9
end; { samp_ }
The FORTRAN main program,
Sampmain.f
. Note the
procedure declaration and call.
FORTRAN converts to lowercase
by default; you do not explicitly
give the underscore (_).
integer i
double precision d
call Samp ( i, d )
write( *, '(I2, F4.1)') i, d
stop
end
The commands to compile and
execute
Samp.p
and
Sampmain.f
hostname% pc -c Samp.p
hostname% f77 Samp.o Sampmain.f -lpfc -lpc
Sampmain.f:
MAIN:
hostname% a.out
9 9.9
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: ......