8
The Pascal procedure,
StrVar.p
The FORTRAN main program,
StrVarmain.f
170
Simple Types with the –xl Option
When you pass the -xl option, the Pascal data type real must be paired with
a FORTRAN data type real; the Pascal data type integer must be paired
with a FORTRAN data type, integer*2.
Strings of Characters
The FORTRAN counterpart to the Pascal alfa and string types is a
character string, and the FORTRAN counterpart to the Pascal varying is a
structure. By default, FORTRAN, passes all by reference:
type
varstr = varying [25] of char;
procedure strvar_(var a: alfa; var s: string;
begin
a := 'abcdefghij';
s := 'abcdefghijklmnopqrtstuvwxyz';
v := 'oyvay'
end; { strvar_ }
structure /VarLenStr/
integer
character a*25
end structure
record /VarLenStr/ vls
character s10*10, s80*80, s25*25
vls.nbytes = 0
Call StrVar( s10, s80, vls )
s25(1:5) = vls.a(1:vls.nbytes)
write (*, 1) s10, s80, s25
1
format("s10='", A, "'",
&
/ "s80='", A, "'",
&
/ "s25='", A, "'"
end
Pascal 4.0 User's Guide
var v: varstr);
nbytes
)
Need help?
Do you have a question about the SunSoft Pascal 4.0 and is the answer not in the manual?
Questions and answers