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 #ifdef SYSV 10 #define VersionStr "Gif library module,\t\tEric S. Raymond\n\ 11 (C) Copyright 1997 Eric S. Raymond\n" 12 #else 13 #define VersionStr PROGRAM_NAME " IBMPC " GIF_LIB_VERSION \ 14 " Eric S. Raymond, " __DATE__ ", " \ 15 __TIME__ "\n" "(C) Copyright 1997 Eric S. Raymond\n" 16 #endif /* SYSV */ 17 18 #define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ 19 #define LZ_BITS 12 20 21 #define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */ 22 #define FIRST_CODE 4097 /* Impossible code, to signal first. */ 23 #define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */ 24 25 #define FILE_STATE_WRITE 0x01 26 #define FILE_STATE_SCREEN 0x02 27 #define FILE_STATE_IMAGE 0x04 28 #define FILE_STATE_READ 0x08 29 30 #define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ) 31 /* TODO: Spelling. Fix upstream and deprecate. */ 32 #define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE) 33 34 typedef struct GifFilePrivateType { 35 GifWord FileState, FileHandle, /* Where all this data goes to! */ 36 BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */ 37 ClearCode, /* The CLEAR LZ code. */ 38 EOFCode, /* The EOF LZ code. */ 39 RunningCode, /* The next code algorithm can generate. */ 40 RunningBits, /* The number of bits required to represent RunningCode. */ 41 MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */ 42 LastCode, /* The code before the current code. */ 43 CrntCode, /* Current algorithm code. */ 44 StackPtr, /* For character stack (see below). */ 45 CrntShiftState; /* Number of bits in CrntShiftDWord. */ 46 unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */ 47 unsigned long PixelCount; /* Number of pixels in image. */ 48 FILE *File; /* File as stream. */ 49 InputFunc Read; /* function to read gif input (TVT) */ 50 OutputFunc Write; /* function to write gif output (MRB) */ 51 GifByteType Buf[256]; /* Compressed input is buffered here. */ 52 GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */ 53 GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */ 54 GifPrefixType Prefix[LZ_MAX_CODE + 1]; 55 GifHashTableType *HashTable; 56 } GifFilePrivateType; 57 58 extern int _GifError; 59 60 #endif /* GIF_LIB_PRIVATE_H */ 61