home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / proglc / appnote.txt < prev    next >
Text File  |  1988-08-01  |  4KB  |  98 lines

  1. The general format for an archive file is:
  2.  
  3. [[archive-mark + header_version + file header + file data]...] + 
  4. archive-mark + end-of-arc-mark
  5.  
  6. The archive-mark is 1 byte and is the value 1A hex.  The file header
  7. can be defined by the following 'C' structure, and is 27 bytes in size.
  8. Note that this is a "packed" structure with fields aligned on odd-address
  9. boundries.
  10.  
  11. typedef struct archive_file_header
  12.   { char name[13];        /* file name */
  13.     unsigned long size;        /* size of compressed file */
  14.     unsigned short date;    /* file date */
  15.     unsigned short time;    /* file time */
  16.     unsigned short crc;        /* cyclic redundancy check */
  17.     unsigned long length;    /* size of uncompressed file */
  18.   };
  19.  
  20. The name field is the null terminated file name.
  21.  
  22. The size is the number of bytes in the file data area following the
  23. header.
  24.  
  25. The date and time are stored in the same packed format as a DOS
  26. directory entry.
  27.  
  28. The CRC is a 16-bit CRC on the file data area based on a CRC polynomial
  29. from the article by David Schwaderer in the April 1985 issue of PC
  30. Technical Journal.
  31.  
  32. The length is the actual uncompressed size of the file.
  33.  
  34. The header versions are defined as follows:
  35.  
  36. Value    Method        Notes
  37. -----    --------    -----------------------------------------------------
  38.   0      -        This is used to indicate the end of the archive.
  39.   1    Stored        (obsolete) (note 1)
  40.   2    Stored        The file is stored (no compression)
  41.   3    Packed        The file is packed with non-repeat packing.
  42.   4    Squeezed    The file is squeezed with standard Huffman squeezing.
  43.   5    crunched    The file was compressed with 12-bit static Ziv-Lempel-
  44.             Welch compression without non-repeat packing.
  45.   6    crunched    The file was compressed with 12-bit static Ziv-Lempel-
  46.             Welch compression with non-repeat packing.
  47.   7    crunched    (internal to SEA) same as above but with different
  48.             hashing formula.
  49.   8    Crunched    The file was compressed with Dynamic Ziv-Lempel-Welch
  50.             compression with non-repeat packing.  The initial
  51.             ZLW code size is 9-bits with a maximum code size
  52.             of 12-bits (note 2).  An adaptive reset is used
  53.             on the ZLW table when it becomes full.
  54.   9    Squashed    The file was compressed with Dynamic Ziv-Lempel-Welch
  55.             compression without non-repeat packing.  The initial
  56.             ZLW code size is 9-bits with a maximum code size
  57.             of 13-bits (note 3).  An adaptive reset is used
  58.             on the ZLW table when it becomes full.
  59.  
  60. Note 1:
  61.   For type 1 stored files, the file header is only 23 bytes in size,
  62.   with the length field not present.  In this case, the file length
  63.   is the same as the size field since the file is stored without
  64.   compression.
  65.  
  66. Note 2:
  67.   The first byte of the data area following the header is used to
  68.   indicate the maximum code size, however only a value of 12 (decimal)
  69.   is currently used or accepted by existing archive programs.
  70.  
  71. Note 3:
  72.   The algorithm used is identical to type 8 crunched files with the
  73.   exception that the maximum code size is 13 bits - i.e. an 8K entry
  74.   ZLW table.  However, unlike type 8 files, the first byte following
  75.   the file header is actual data, no maximum code size is stored.
  76.  
  77.  
  78.  
  79.  
  80. References
  81. ----------
  82.  
  83. Source code for general Ziv-Lempel-Welch routines by Kent Williams.
  84.  
  85. Source code and documentation from the Unix COMPRESS utilities.
  86.  
  87. Terry A. Welch, "A Technique for High Performance Data Compression."
  88. IEEE Computer, vol. 17, no. 6 (June 84)
  89.  
  90. Ziv, J. and Lempel, A., "Compression of individual sequences via
  91. variable-rate coding." IEEE Trans. Inform. Theory IT-24, 5 (Sept. 1978),
  92. 530-536.
  93.  
  94. PC Technical Journal, April 1985.
  95.  
  96. The IBM DOS Technical Reference Manual, part number 6024125.
  97.  
  98.