![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-549395207x1.png)
8
Pascal procedure, ChrCAx.p | procedure chrca_ ( a: array [lb..ub:integer] of char) ; |
begin
a[0] := 'T' ;
a[13] := 'o' ;
end; { chrca_ }
The FORTRAN main program, ChrCAmain.f
character s*16
data s / "this is a string" / call ChrCA( s, %VAL(0), %VAL(15) ) write( *, "(A)" ) s
stop end
The commands to compile and execute ChrCAx.p and
ChrCAmain.f
hostname% pc
hostname% f77 ChrCAx.o ChrCAmain.f
MAIN: hostname% a.out This is a string
Pointers are easy to pass, as shown in the following example:
The Pascal procedure, PassPtr.p. In the Pascal procedure statement, the name must be all in lowercase, with a trailing underscore (_).
type
PtrInt = ^integer ; PtrReal = ^real ;
procedure passptr_ ( var iPtr: PtrInt ; var dPtr: PtrReal ) ;
begin
iPtr^ := 9 ; dPtr^ := 9.9 ;
end ;
The | 183 |