HP Pascal/iX Programmer's Guide (31502-90023)
9- 12
CHARACTER*(*) Str2
...
RETURN
END
An HP Pascal program that calls the FORTRAN 77 routine:
TYPE
Str40 = string[40] ;
Pac80 = PACKED ARRAY [1..80] OF char ;
FUNCTION F77_Func (VAR Str1 : Pac80 ;
VAR Str2 : Str40) : Str40 ;
EXTERNAL FTN77 ;
VAR
Vbl1, Vbl2 : Str40 ;
Pac1 : Pac80 ;
BEGIN { main program }
...
Vbl2 := strrtrim(F77_Func(Vbl1,Pac1)) ;
...
END ;
3. This is not correctly implemented in FORTRAN 77.
Example
The Pascal program
Pascal_Fort
calls the external FORTRAN 77 routine
FORTPRC
.
Pascal program:
PROGRAM Pascal_Fort (input,output);
TYPE
char_str = PACKED ARRAY [1..20] OF char;
VAR
a_str : char_str;
int1,
int2,
sum : integer;
PROCEDURE fortprc (VAR cstr : char_str;
VAR inta : integer;
VAR intb : integer;
VAR total : integer); EXTERNAL FTN77;
BEGIN
a_str := 'Add these 2 numbers:';
int1 := 25;
int2 := 15;
writeln(a_str,int1,int2);
fortprc(a_str,int1,int2,sum);
writeln(a_str,sum);
END.
FORTRAN 77 routine:
SUBROUTINE FORTPRC(CSTR,INT1,INT2,SUM)
INTEGER INT1, INT2, SUM
CHARACTER CSTR*20
SUM = INT1 + INT2
CSTR = "SUM OF TWO NUMBERS: "