maint: update bootstrap and m4/.gitignore to latest Gnulib
[gzip.git] / lzw.h
blobf2bf8f4468c543ca8bd7d70d28e150a03dd575b3
1 /* lzw.h -- define the lzw functions.
3 Copyright (C) 1994-2024 Free Software Foundation, Inc.
4 Copyright (C) 1992-1993 Jean-loup Gailly.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 #ifndef BITS
21 # define BITS 16
22 #endif
23 #define INIT_BITS 9 /* Initial number of bits per code */
25 #define LZW_MAGIC "\037\235" /* Magic header for lzw files, 1F 9D */
27 #define BIT_MASK 0x1f /* Mask for 'number of compression bits' */
28 /* Mask 0x20 is reserved to mean a fourth header byte, and 0x40 is free.
29 * It's a pity that old uncompress does not check bit 0x20. That makes
30 * extension of the format actually undesirable because old compress
31 * would just crash on the new format instead of giving a meaningful
32 * error message. It does check the number of bits, but it's more
33 * helpful to say "unsupported format, get a new version" than
34 * "can only handle 16 bits".
37 #define BLOCK_MODE 0x80
38 /* Block compression: if table is full and compression rate is dropping,
39 * clear the dictionary.
42 #define LZW_RESERVED 0x60 /* reserved bits */
44 #define CLEAR 256 /* flush the dictionary */
45 #define FIRST (CLEAR+1) /* first free entry */
47 extern int maxbits; /* max bits per code for LZW */
49 extern int unlzw (int in, int out);