Main Page | Class List | Directories | File List | Class Members | File Members

lzw.h

Go to the documentation of this file.
00001 /* lzw.h -- define the lzw functions.
00002 
00003    Copyright (C) 1992-1993 Jean-loup Gailly.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2, or (at your option)
00008    any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software Foundation,
00017    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
00018 
00019 #if !defined(OF) && defined(lint)
00020 #  include "gzip.h"
00021 #endif
00022 
00023 #ifndef BITS
00024 #  define BITS 16
00025 #endif
00026 #define INIT_BITS 9              /* Initial number of bits per code */
00027 
00028 #define LZW_MAGIC  "\037\235"   /* Magic header for lzw files, 1F 9D */
00029 
00030 #define BIT_MASK    0x1f /* Mask for 'number of compression bits' */
00031 /* Mask 0x20 is reserved to mean a fourth header byte, and 0x40 is free.
00032  * It's a pity that old uncompress does not check bit 0x20. That makes
00033  * extension of the format actually undesirable because old compress
00034  * would just crash on the new format instead of giving a meaningful
00035  * error message. It does check the number of bits, but it's more
00036  * helpful to say "unsupported format, get a new version" than
00037  * "can only handle 16 bits".
00038  */
00039 
00040 #define BLOCK_MODE  0x80
00041 /* Block compression: if table is full and compression rate is dropping,
00042  * clear the dictionary.
00043  */
00044 
00045 #define LZW_RESERVED 0x60 /* reserved bits */
00046 
00047 #define CLEAR  256       /* flush the dictionary */
00048 #define FIRST  (CLEAR+1) /* first free entry */
00049 
00050 extern int maxbits;      /* max bits per code for LZW */
00051 extern int block_mode;   /* block compress mode -C compatible with 2.0 */
00052 
00053 extern int lzw    OF((int in, int out));
00054 extern int unlzw  OF((int in, int out));

© sourcejam.com 2005-2008