HP SunSoft Pascal 4.0 Manuale Utente Pagina 192

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 333
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la 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
Vedere la pagina 191
1 2 ... 187 188 189 190 191 192 193 194 195 196 197 ... 332 333

Commenti su questo manuale

Nessun commento