![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-549395192x1.png)
8
Procedure Calls: FORTRAN-Pascal
Here are examples of how a FORTRAN main program calls a Pascal procedure.
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.
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 (_).
procedure samp_(var i: integer; var r: real);
begin
i := 9; r := 9.9
end; { samp_ }
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
hostname% f77 Samp.o Sampmain.f
MAIN: hostname% a.out 9 9.9
Variable Parameters
Pascal passes all var parameters by reference, FORTRAN’s default.
Simple Types without theWith var parameters, simple types match.
168 | Pascal 4.0 User’s Guide |