FATS - Fast Access Tree System
Table of Contents
Programming Interfaces
Borland Delphi for Windows 95/NT

Borland Delphi for Windows 95/NT


 
Windows Libraries FATS_W32.DLL / FATSXW32.DLL

The diskette "FATS for Windows 95/NT" contains the dynamic link libraries FATS_W32.DLL (basis version) resp. FATSXW32.DLL (extended version), that must be copied into the system directory of Windows:

COPY FATS?W32.DLL \WINDOWS\SYSTEM

The libraries are exporting the following functions:

function FATSLibInit(nSize: integer; nSign: integer): Pointer; stdcall;external 'fats_w32.dll';

function FATSLibExit(lpFatsdata: Pointer): Pointer; stdcall;external 'fats_w32.dll';

function FATSLibCall(var szCmnd: string; var nErrorcode: integer; var szFatsKey: fatskeystr; lpFatsdata: Pointer): longint;stdcall; external 'fats_w32.dll' name 'FATSLibCallA';

Before you can use the FATS commands in your Delphi program, you must assign a data area to FATS:

begin
{ -------> init fats datasegment }

{$IFOPT H+}
lpFatsdata:=FATSLibInit(0, 4);
{$ELSE}
lpFatsdata:=FATSLibInit(0, 1);
{$ENDIF}

The first parameter determines the size of the FATS data area. If you indicate a zero here, then the minimum needed storage space is reserved (approx. 18-20 KB). The second parameter intends the assigned programming language, for 32-Bit-Delphi this value must equal to 4 (LONGSTR) or 1 (SHORTSTR). The address of the data area is returned in the variable lpFatsdata.

Before terminating the application program you should release the storage area allocated by FATSLibInit. You can do this by calling the function FATSLibExit:

lpFatsdata:=FATSLibExit(lpFatsdata);

Although the storage area would be released automatically by the operating system, this instruction is useful, since it closes all FATS files that are still opened.

 
Calling FATS

FATS commands are executed with the function FATSLibCall:

dwRecno :=FATSLibCall(szCmnd, nErrorcode, szFatsKey, lpFatsdata);

Parameter Usage:

szCmndCommand string (input)
nErrorcodeErrorcode (output)
szFatsKeyKey value (output)
lpFatsdataAddress of FATS data area (input)
Return Value:Record Number

 
Testprograms

The FATS distribution disk for Windows 95/NT contains some test programs in the directory WIN_32I\PASCAL\DELPHI that illustrate how you can use the FATS commands in your programs:

 tst1_eng.dprTest program for Delphi for Windows 95/NT
 rebuild.dprRe-Indexing a Data File (commands 'BK', 'DL')

The extended version of FATS contains the following additional test programs:

 tst2_eng.dprIntroduction to the Matchcode Functions
 mcsort.dprUse of the key-flag with command 'MC'
 reindex.dprFast Re-Indexing with the command 'XB'


 

© 2008  GCS Software, Udo Gertz