User`s manual

Dynamic C Users Manual digi.com 347
C.2.1.2 File Extension
Encrypted files will be saved with the same pathname but with the extension supplied. Dynamic C will use
encrypted and non-encrypted files seamlessly, so the choice of extension is for one’s own file manage-
ment.
C.2.1.3 Optional Text Area
The upper window is a text window of up to 4k bytes in length. Any text entered will appear in all files in
the list appearing in the lower window. If two files are to be given unique headers, they should be
encrypted separately.
This area can be used for copyright information, instructions, disclaimers, warnings, or anything else rele-
vant to viewers of the file.
C.2.2 File Compression Utility
Dynamic C has a compression utility feature. The default utility implements an LZSS style compression
algorithm. Support libraries to decompress files achieve a throughput of 10 KB/s to 20 KB/s (number of
bytes in uncompressed file/time to decompress entire file using ReadCompressedFile()) depending
upon file size and compression ratio.
The #zimport() compiler directive performs a standard #ximport, but compresses the file by invok-
ing the compression utility before emitting the file to the target. Support libraries allow the compressed file
to be decompressed on-the-fly. Compression ratios of 50% or more for text files can be achieved, thus
freeing up valuable xmem space. The compression library is thread safe.
For details on compression ratios, memory usage and performance, please see Technical Note 234, “File
Compression (Using #zimport)” available on our website, at www.digi.com/support/.
C.2.2.1 Using the File Compression Utility
The utility is invoked by Dynamic C during compile time when #zimport is used. The keyword
#zimport will compress any file. Of course some files are already in a compressed format, for example
jpeg files, so trying to compress them further is not useful and may even cause the resulting compressed
file to be larger than the original file. (The original file is not modified by the compression utility nor by
the support libraries.) The compression of FS2 files is a special case. Instead of using #zimport,
#ximport is used along with the function CompressFile().
Compressed files are decompressed on-the-fly using ReadCompressedFile(). Compressed FS2 files
may also be decompressed on-the-fly by using ReadCompressedFile(). In addition, an FS2 file may
be decompressed into a new FS2 file by using DecompressFile().
There are 3 sample programs to illustrate the use of file compression
Samples/zimport/zimport.c: demonstrates #zimport
Samples/zimport/zimport_fs2.c: demonstrates file compression in combination with the
file system
Samples/tcpip/http/zimport.c: demonstrates file compression support using the http server