ZIP File System aDr.SlumpProduction1998-9
Official documentation v1.0 (10-May-1999)
English version by Iván Montes Velencoso a.k.a Dr.Slump/Fearminds
Current ZFS version : 2.1b
1 - INTRODUCTION
1.1 - What is Zip File System?
1.2 - The "why" of Zip File System
1.3 - Why the Zip format
1.4 - About ZFS2 - POLICY OF USE
3.1 - General explanation
3.2 - Funcions and procedures of ZFS
3.3 - Hints and tricks4.1 - The Zip format
4.2 - The random access to compressed files (seek)5 - BUGS
5.1 - Known Bugs
5.2 - Incompatibilities6 - LAST WORDS
6.1 - Where is going ZFS?
6.2 - Contact with the author
6.3 - Credits and greetings
First of all, sorry for my terrible english. I'm always improving it, but slowly ;)
1.- INTRODUCTION ^
1.1.- What is Zip File System? ^
The Zip File System, or ZFS, is a Free Pascal library that allow access to compressed files in Zip format. This isn't something new, the really interesting of ZFS is that access to compressed or packed files of a Zip archive like it will do with a typical file. The programmer that uses ZFS, doesn't have to know when he/she is using a zipped file and when is using a normally stored file in a directory.
Although ZFS is very easy to use, it's powerful also. The programmer not will be limited by the library, because it replaces the standard Pascal file handle routines by its own routines. So you can compile your old sources to use ZFS with a pair of changes.
1.2.- The "why" of Zip File System ^All started when I installed Doom II in my 386DX with 212Mb of hard disk, its 17Mb seemed to me a waste of space. I had to erase some programs to could install the game. In short time I bought a P133 with a 1.2Gb drive, and the Doom's 17 Mb were a joke. I installed Quake, which fills about 40Mb of HD, and I returned to think that it was too much for a game, but I didn't mind. Short after, I bought Quake II and its 250Mb of data were a nighmare for my poor hard disk. Was then when I had the idea of compress the data of a game, and I started to work on ZFS.
I took as reference Quake 2, its Pack format is so good to keep all the files in one archive. The unique that didn't have was the possibility to compress the data.
And it's how started ZFS, as a stupid try to change the grown of Mb of the lastest games.
1.3.- Why the Zip format ^When I started to work on ZFS, I used Pack format of ID Software. I added a new flag to format to allow LZW compressed files. The uncompression routines were already programmed, and I started to work on a creator/editor of Pack archives, specific for ZFS new features. When I finished the command line version, I tried to do a GUI for the compressor. Was then when I found the source code to uncompress zip archives. Then I though that if I used the zip format, I could use the large list of good, fast and free tools for the zip format (pkzip, Info-zip, Winzip ...). Without thinking it twice I rewrote the whole code and I made a new version to use the zip format instead of the pack format.
Now I'm very happy of that decession. Mainly because Zip File System sounds better than Pack File System ;)
1.4.- About ZFS ^Zip File System was born on the spring of 1998 and since then it hasn't stopped to grown.
The web page of ZFS is http://webs.demasiado.com/freakpascal/zfs.htm
2.- POLICY OF USE ^
The author doesn't take any responsability for any hurt that this software could cause.
This library is distributed under the GNU's LGPL license.
Only two more things:
If you make something with this library you have to put my name on the credits and tell me where I can get the program.
If you make a commercial program using ZFS you have to send me a free copy of that program.
3.- GUIDE OF THE PROGRAMMER ^
3.1.- General explanation ^
3.2.- Function and procedures of ZFS ^
3.3.- Hints and tricks ^· When using ZFS you must declare ZFS in the uses section of your program. If you have also included the DOS unit here you have to put ZFS after it, otherways the routines wll not work.
4.- TECHNICAL ISSUES OF ZFS ^
4.1.- The Zip format ^
Since some years ago, Zip format has become in a standard for general data compression.This is because of its high compression ratio, the quality of the tools available and its platform-independent design.
Here I will only explain briefly the PkZip 2.0's zip format, more acurately the method 8 or Deflated.
The first 4 bytes of a zip file match with the values 80, 75, 3 and 4. Looking at this bytes we can now if the file is a zip.
Deflate compressed files use a combination of LZ77 and Huffman encoding. First the compressor reduce the input data using the LZ77 algorithm. After some huffman trees are generated to compress the reduced data.
The LZ77 algorithm uses a window-sliding dictionary which stores a defined amount of already processed data, then the compressor gets track of where this data is. The huffman encoding is used to store some data which is not encoded by the LZ77 algorithm. When uncompressing data the uncompressor generates output from the huffman trees and then the LZ77 encoded info gives the repeated runs of data.
The deflated files are stored in blocks. Each block length of output data is the size of the sliding dictionary, less the last block that can be any length below the dictionary's size. Those blocks can be stored (the data is copied without any compression), fixed (uses fixed huffman's trees) and dinamic (self generate huffman's trees).
If someone has a better explanation of how the deflated method works, please tell me about it.
4.2.- The random access to compressed files ^
5.- BUGS
^
5.1.- Known Bugs ^
As long as I know, there isn't any bug in ZFS. Although I have not tested it heavily. I would like to test ZFS on a network drive but I don't have one, so I can't.
5.2.- Incompatibilities ^
There are some incompatibilities, so be carefuly when using ZFS.· Reset function for typed files doesn't work like the RTL (run time library) one. It needs a second parameter with the size of the file type. I mean that if we have a f : file of LongInt; we have to use reset(f, sizeof(longint)); instead of the pascal original reset(f);
If you, accidentaly, use reset(f); the library will return the IO result ERR_RESETBUG, and the file will not be oppened.
6.- LAST WORDS
^
6.1.- Where is going ZFS? ^
Is far away the time when ZFS reached my objectives. So it will not be continued, but a follow up to this libary is being made. It's called Pack File System and can be found on my programming web page.
6.2.- Contact with the author ^If you want to tell me something about ZFS or about anything else, don't be shy and write me.
e-mail : senbei@teleline.es
I would like to have a postcard from your city also. It's my hobby
Edison st., 48th
Roquetes, Barcelona
postal code : 08812
Catalonia, Spain
Europe
For more information about my programming projects you can point your browser to my programming web page Freak Pascal
If you want to know a bit about me and you understand spanish you can take a look at my personal web page
6.3.- Credits and greetings ^ZFS uses a modificated version of the Info-Zip's Unzip library. I thanks to Christian Ghisler, Mark Adler, Dr Abimbola Olowofoyeku and Peter Vreman the pascal port of such library.
I also thanks Harald Thunem for his HTScreen library, which has been used in ZFS Seeking Optimizer.
Greetings fly to : Toxic Avenger, Marco Van de Voort, Cristian Ramírez, Adrian Bladè, Iván Milanes, Joan Blanquer, Ernesto Morcillo, Jose David Lozar, Tony Arrufat, Miguel Martín, Mireia González, the group of 'EL VORAMAR' and Yolanda Serrano.
Finally, thanks to everyone which use ZFS, I hope to receive hundreds of e-mails talking about your experiencies and impressions using ZFS.
* Doom II, Quake, Quake II and ID Software are registered trademarks of ID Software
* PkZip is a registered trademark of PkWare
* FPC, Free Pascal Compiler is copyright Florian Klaempf
Any other registered name contained in this document is property of its respective owner.
This document is Copyright 1999 of Iván Montes Velencoso