8

Simple Types with the –xlOption

When you pass the -xloption, 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:

The Pascal procedure, StrVar.p

type

varstr = varying [25] of char;

procedure strvar_(var a: alfa; var s: string; var v: varstr);

begin

a := 'abcdefghij';

s := 'abcdefghijklmnopqrtstuvwxyz'; v := 'oyvay'

end; { strvar_ }

The FORTRAN main program, StrVarmain.f

structure /VarLenStr/ integer nbytes 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

1format("s10='", A, "'",

&/ "s80='", A, "'",

&/ "s25='", A, "'" )

end

170

Pascal 4.0 User’s Guide