home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / archiver / sqshinfo.doc < prev    next >
Text File  |  1994-03-07  |  4KB  |  107 lines

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