8

The commands to compile and execute UniVec.p and UniVecmain.f

hostname% pc -c UniVec.p

hostname% f77 UniVec.o UniVecmain.f -lpfc -lpc

UniVecmain.f:

MAIN: hostname% a.out 24

Conformant Arrays

For conformant arrays, with single-dimension array, pass upper and lower bounds, placed after the declared parameter list, as in:

function ip(var x:array[lb..ub:integer] of real):real;

...

double precision v1(10) double precision z

z = ip ( v1, %VAL(0), %VAL(9) )

...

Pascal passes the bounds by value, so FORTRAN must pass them by value, too.

One bounds pair may apply to several arrays if they are declared in the same parameter group:

function ip(var x,y:array[lb..ub:integer] of real):real;

...

double precision v1(10), v2(10) double precision z

z = ip ( v1, v2, %VAL(0), %VAL(9) )

...

Examples of single-dimension array and array of character conformant arrays follow. Conformant arrays are included here only because they are a relatively standard feature; there are usually more efficient and simpler ways to do that.

The FORTRAN–Pascal Interface

173