HP SunSoft Pascal 4.0 Manual de usuario Pagina 192

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 333
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 191
168 Pascal 4.0 Users 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
Vista de pagina 191
1 2 ... 187 188 189 190 191 192 193 194 195 196 197 ... 332 333

Comentarios a estos manuales

Sin comentarios