8

The FORTRAN subroutine, StruChr.f

Records and Structures

Records and structures pass as follows:

subroutine StruChr ( vls ) structure /VarLenStr/

integer nbytes character a*25

end structure

record /VarLenStr/ vls vls.a(1:5) = 'oyvay' vls.nbytes = 5 return

end

The Pascal main program, StruChrmain.p

program StruChrmain;

type

lenstr = record

nbytes: integer;

chrstr: array [0..25] of char

end;

var

v: lenstr;

procedure struchr(var v: lenstr); external fortran;

begin struchr(v);

writeln('v.chrstr = "', v.chrstr, '"'); writeln('v.nbytes =', v.nbytes: 2)

end. { StruChrmain }

194

Pascal 4.0 User’s Guide

Page 218
Image 218
HP SunSoft Pascal 4.0 manual Fortran subroutine, StruChr.f, 194