home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / utils / djtar / lzw.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-16  |  1.5 KB  |  41 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. /* lzw.h -- define the lzw functions.
  3.  * Copyright (C) 1992-1993 Jean-loup Gailly.
  4.  * This is free software; you can redistribute it and/or modify it under the
  5.  * terms of the GNU General Public License, see the file COPYING.
  6.  */
  7.  
  8. #include "zread.h"
  9.  
  10. #ifndef BITS
  11. #  define BITS 16
  12. #endif
  13. #define INIT_BITS 9              /* Initial number of bits per code */
  14.  
  15. #define    LZW_MAGIC  "\037\235"   /* Magic header for lzw files, 1F 9D */
  16.  
  17. #define BIT_MASK    0x1f /* Mask for 'number of compression bits' */
  18. /* Mask 0x20 is reserved to mean a fourth header byte, and 0x40 is free.
  19.  * It's a pity that old uncompress does not check bit 0x20. That makes
  20.  * extension of the format actually undesirable because old compress
  21.  * would just crash on the new format instead of giving a meaningful
  22.  * error message. It does check the number of bits, but it's more
  23.  * helpful to say "unsupported format, get a new version" than
  24.  * "can only handle 16 bits".
  25.  */
  26.  
  27. #define BLOCK_MODE  0x80
  28. /* Block compression: if table is full and compression rate is dropping,
  29.  * clear the dictionary.
  30.  */
  31.  
  32. #define LZW_RESERVED 0x60 /* reserved bits */
  33.  
  34. #define    CLEAR  256       /* flush the dictionary */
  35. #define FIRST  (CLEAR+1) /* first free entry */
  36.  
  37. extern int maxbits;      /* max bits per code for LZW */
  38. extern int block_mode;   /* block compress mode -C compatible with 2.0 */
  39.  
  40. extern int unlzw  (void *in);
  41.