blob: 0a07ccd4f25111b5cee2fc4aabb03a775a320aed [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation. Sun designates this
7 * particular file as subject to the "Classpath" exception as provided
8 * by Sun in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
22 * have any questions.
23 */
24
25#ifndef _GIF_LIB_PRIVATE_H
26#define _GIF_LIB_PRIVATE_H
27
28#include "gif_lib.h"
29
30#define PROGRAM_NAME "LIBUNGIF"
31
32#ifdef SYSV
33#define VersionStr "Gif library module,\t\tEric S. Raymond\n\
34 (C) Copyright 1997 Eric S. Raymond\n"
35#else
36#define VersionStr PROGRAM_NAME " IBMPC " GIF_LIB_VERSION \
37 " Eric S. Raymond, " __DATE__ ", " \
38 __TIME__ "\n" "(C) Copyright 1997 Eric S. Raymond\n"
39#endif /* SYSV */
40
41#define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */
42#define LZ_BITS 12
43
44#define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */
45#define FIRST_CODE 4097 /* Impossible code, to signal first. */
46#define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */
47
48#define FILE_STATE_WRITE 0x01
49#define FILE_STATE_SCREEN 0x02
50#define FILE_STATE_IMAGE 0x04
51#define FILE_STATE_READ 0x08
52
53#define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ)
54#define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE)
55
56typedef struct GifFilePrivateType {
57 int FileState, FileHandle, /* Where all this data goes to! */
58 BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */
59 ClearCode, /* The CLEAR LZ code. */
60 EOFCode, /* The EOF LZ code. */
61 RunningCode, /* The next code algorithm can generate. */
62 RunningBits, /* The number of bits required to represent RunningCode. */
63 MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */
64 LastCode, /* The code before the current code. */
65 CrntCode, /* Current algorithm code. */
66 StackPtr, /* For character stack (see below). */
67 CrntShiftState; /* Number of bits in CrntShiftDWord. */
68 unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */
69 unsigned long PixelCount; /* Number of pixels in image. */
70 FILE *File; /* File as stream. */
71 InputFunc Read; /* function to read gif input (TVT) */
72 OutputFunc Write; /* function to write gif output (MRB) */
73 GifByteType Buf[256]; /* Compressed input is buffered here. */
74 GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */
75 GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */
76 unsigned int Prefix[LZ_MAX_CODE + 1];
77} GifFilePrivateType;
78
79extern int _GifError;
80
81#endif /* _GIF_LIB_PRIVATE_H */