home *** CD-ROM | disk | FTP | other *** search
- unit FortLink;
-
- { TPFORT unit to link in fortran routines. See TPFORT.DOC for instructions. }
- { This file contains the interface section only. }
- { Version 1.7 - added FortErrorFlag }
- { Version 1.5 - added Ext_Pointer function }
- { Version 1.4 - added Size_Table types and variable for CHARACTER support }
- { Version 1.3 - fixed bug in loader, and changes type of extra_space to
- longint }
-
- interface
- uses Dos;
-
- type
- Extval = longint;
- Double_Ptr = ^double;
- RealArray = array[1..65520 div sizeof(double)] of double;
- Size_Table_Array = array[0..65519 div sizeof(word)] of word;
- { Array of CHARACTER variable sizes. Note that entry
- 0 seems to be unused. }
- Size_Table_Ptr = ^Size_Table_Array;
-
- const
- MaxProcs = 32; { Recompile this as large as necessary.
- Overhead is 4*maxprocs }
- Extra_Space : longint = 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 }
- Size_Table : ^Size_Table_Ptr; { Points to __fcclenv; see docs. }
-
-
- 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
- }
-
- function Ext_Pointer(Ext:Extval):pointer;
- { Returns a pointer to the entry point of a routine passed as an Extval }
-
- 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! }
-
-