The FORTRAN–Pascal Interface
197
8
Value Parameters
With
external fortran
on the
procedure
statement, Pascal passes value
parameters as FORTRAN expects them.
The Pascal main program,
VarRecmain.p
program VarRecmain;
type
vr =
record
case tag: char of
'a': ( ch1, ch2: char );
'b': ( flag: boolean );
'K': ( ALIGN: integer )
end;
var
Rec: vr;
procedure varrec(var d: vr); external fortran;
begin
Rec.tag := 'a';
Rec.ch1 := 'a';
Rec.ch2 := 'b';
varrec(Rec);
writeln(Rec.ch2)
end. { VarRecmain }
The commands to compile and
execute
VarRec.f
and
VarRecmain.p
without
–xl
hostname% f77 -c VarRec.f
VarRec.f:
varrec:
hostname% pc VarRec.o VarRecmain.p -lpfc -lF77
hostname% a.out
b
Содержание SunSoft Pascal 4.0
Страница 14: ...xiv Pascal 4 0 User s Guide ...
Страница 16: ...xvi Pascal 4 0 User s Guide ...
Страница 30: ...6 Pascal 4 0 User s Guide 1 ...
Страница 160: ...136 Pascal 4 0 User s Guide 6 ...
Страница 268: ...244 Pascal 4 0 User s Guide 11 ...
Страница 320: ...296 Pascal 4 0 User s Guide B ...
Страница 331: ...Index 307 ...
Страница 333: ......