1 /**************************************************************************** 2 3 gif_lib_private.h - internal giflib routines and structures 4 5 ****************************************************************************/ 6 7 #ifndef _GIF_LIB_PRIVATE_H 8 #define _GIF_LIB_PRIVATE_H 9 10 #include "gif_lib.h" 11 #include "gif_hash.h" 12 13 #define EXTENSION_INTRODUCER 0x21 14 #define DESCRIPTOR_INTRODUCER 0x2c 15 #define TERMINATOR_INTRODUCER 0x3b 16 17 #define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ 18 #define LZ_BITS 12 19 20 #define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */ 21 #define FIRST_CODE 4097 /* Impossible code, to signal first. */ 22 #define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */ 23 24 #define FILE_STATE_WRITE 0x01 25 #define FILE_STATE_SCREEN 0x02 26 #define FILE_STATE_IMAGE 0x04 27 #define FILE_STATE_READ 0x08 28 29 #define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ) 30 #define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE) 31 32 typedef struct GifFilePrivateType { 33 GifWord FileState, FileHandle, /* Where all this data goes to! */ 34 BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */ 35 ClearCode, /* The CLEAR LZ code. */ 36 EOFCode, /* The EOF LZ code. */ 37 RunningCode, /* The next code algorithm can generate. */ 38 RunningBits, /* The number of bits required to represent RunningCode. */ 39 MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */ 40 LastCode, /* The code before the current code. */ 41 CrntCode, /* Current algorithm code. */ 42 StackPtr, /* For character stack (see below). */ 43 CrntShiftState; /* Number of bits in CrntShiftDWord. */ 44 unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */ 45 unsigned long PixelCount; /* Number of pixels in image. */ 46 FILE *File; /* File as stream. */ 47 InputFunc Read; /* function to read gif input (TVT) */ 48 OutputFunc Write; /* function to write gif output (MRB) */ 49 GifByteType Buf[256]; /* Compressed input is buffered here. */ 50 GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */ 51 GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */ 52 GifPrefixType Prefix[LZ_MAX_CODE + 1]; 53 GifHashTableType *HashTable; 54 bool gif89; 55 } GifFilePrivateType; 56 57 #endif /* _GIF_LIB_PRIVATE_H */ 58 59 /* end */ 60