172
Pascal 4.0 User’s Guide
8
The
univ
Arrays
You can pass any size array to a Pascal procedure expecting a
univ
array, but
there is no advantage in doing so, since there is no type or size checking for
separate compilations. However, if you want to use an existing Pascal
procedure that has a
univ
array, you can do so. All
univ
arrays that are
in
,
out
,
in out,
or
var
parameters pass by reference.
The commands to compile and
execute
FixVec.p
and
FixVecmain.f
hostname% pc -c FixVec.p
hostname% f77 FixVec.o FixVecmain.f -lpfc -lpc
hostname% a.out
FixVecmain.f:
MAIN:
45
The Pascal procedure,
UniVec.p
, which defines a 10-
element array
type
VecTyp = array [0..9] of integer;
procedure univec_(in V:univ VecTyp; var Last: integer;
var Total: integer);
var
i: integer;
begin
Total := 0;
for i := 0 to Last do
Total := Total + V[i]
end; { univec_ }
The FORTRAN main program,
UniVecmain.f
, which passes
a 3-element array to the Pascal
procedure written to do a 10-
element array
integer Sum
integer a(0:2)
data a / 7, 8, 9 /
call UniVec ( a, 2, Sum )
write( *, "( I3 )") Sum
stop
end
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: ......