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