User`s manual

348 digi.com
C.2.2.2 File Compression/Decompression API
The file compression API consists of 7 functions, 3 of which are of prime importance:
OpenInputCompressedFile()
- open a compressed file for reading or open an uncom-
pressed #ximport file for compression.
CloseInputCompressedFile() - close input file and deallocate memory buffers.
ReadCompressedFile() - perform on-the-fly decompression.
The remaining 4 functions are included for compression support for FS2 files:
OpenOutputCompressedFile()
- open FS2 file for use with CompressFile().
CloseOutputCompressedFile() - close file and deallocate memory buffers.
CompressFile() - compress an FS2 file, placing the result in a second FS2 file.
DecompressFile() - decompress an FS2 file, placing the result in a second FS2 file.
Complete descriptions are available for these functions in the Dynamic C Function Reference Manual and
also via the Function Lookup facility (Ctrl+H or Help menu).
There are several macros associated with the file compression utility:
ZIMPORT_MASK - Used to determine if the imported file is compressed (#zimport) or not
(#ximport).
OUTPUT_COMPRESSION_BUFFERS (default = 0) - Number of 24K buffers for compression (com-
pression also requires a 4K input buffer, which is allocated automatically for each output buffer that is
defined).
INPUT_COMPRESSION_BUFFERS (default = 1) Number of 4KB internal buffers (in RAM) used for
decompression.
Each compressed file has an associated file descriptor of type ZFILE. All fields in this structure are used
internally and must not be changed by an application program.
C.2.2.3 Replacing the File Compression Utility
Users can use their own compression utility, replacing the one provided. If the provided compression util-
ity is replaced, the following support libraries will also need to be replaced: zimport.lib, lzss.lib
and bitio.lib. They are located in lib\..\zimport\. The default compression utility,
Zcompress.exe, is located in Dynamic C’s root directory. The utility name is defined by a key in the
current project file:
[Compression Utility]
Zimport External Utility=Zcompress.exe
To replace Zcompress.exe as the utility used by Dynamic C for compression, open your project file
and edit the filename.