home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
turbopas
/
tpfort12.arc
/
FORTLINK.DOC
< prev
next >
Wrap
Text File
|
1989-11-21
|
2KB
|
64 lines
unit FortLink;
{ TPFORT unit to link in fortran routines. See TPFORT.DOC for instructions. }
{ This file contains the interface section only. }
interface
uses Dos;
type
Extval = longint;
Double_Ptr = ^double;
RealArray = array[1..65520 div sizeof(double)] of double;
const
MaxProcs = 32; { Recompile this as large as necessary.
Overhead is 4*maxprocs }
Extra_Space : word = 1024; { Extra space for the Fortran loader's heap.
Increase if loadfort fails with Exec error 8
or Fortran complains }
LinkedProcs : word = 0; { The number of procedures linked so far. Use
for automatic procedure numbering in unit
initializations }
var
FortLoaded : boolean; { True indicates Fortran routines are in memory }
FortSafe : boolean; { True indicates you're in Fortran mode }
function LoadFort(Prog:string;TPentry:pointer):boolean;
{ The procedure to load the fortran routines. Returns true on success. }
procedure CallFort(ProcNum:word);
{ The procedure to call the Fortran routine number procnum }
{ Works for SUBROUTINES and FUNCTIONS with values up to 4 bytes (except REAL*4)}
procedure FSingle(procnum:word);
{ Simulates a Fortran REAL*4 Function call }
procedure FDouble(procnum:word);
{ Simulates a Fortran Double Precision Function call }
procedure FPointer(procnum:word);
{ Simulates a Fortran Function call with a value up to 8 bytes long, by
returning a pointer to it. Can reserve space for longer return values by
passing multiple copies of the function to CALLTP, and only using the
first.
}
function Fort_External(ProcNum:word):Extval;
{ Returns value to be passed as an external reference }
function Pas_External(Proc:pointer):Extval;
{ Returns value to be passed as an external reference for
a Pascal procedure or specially constructed function
}
procedure Clean_External;
{ Routine to clean up stack after Fort_External or Pas_External }
procedure Enter_Pascal;
{ Set up Pascal context. Always pair with Leave_Pascal! }
procedure Leave_Pascal;
{ Restore Fortran context. Always pair with Enter_Pascal! }