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