1 /* 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. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 /**************************************************************************** 26 27 gif_lib_private.h - internal giflib routines and structures 28 29 ****************************************************************************/ 30 31 #ifndef _GIF_LIB_PRIVATE_H 32 #define _GIF_LIB_PRIVATE_H 33 34 #include "gif_lib.h" 35 #include "gif_hash.h" 36 37 #define EXTENSION_INTRODUCER 0x21 38 #define DESCRIPTOR_INTRODUCER 0x2c 39 #define TERMINATOR_INTRODUCER 0x3b 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 56 typedef struct GifFilePrivateType { 57 GifWord 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 GifPrefixType Prefix[LZ_MAX_CODE + 1]; 77 GifHashTableType *HashTable; 78 bool gif89; 79 } GifFilePrivateType; 80 81 #endif /* _GIF_LIB_PRIVATE_H */ 82 83 /* end */