Home | History | Annotate | Download | only in giflib
      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 #define IS_WRITEABLE(Private)   (Private->FileState & FILE_STATE_WRITE)
     32 
     33 typedef struct GifFilePrivateType {
     34     GifWord FileState, FileHandle,  /* Where all this data goes to! */
     35       BitsPerPixel,     /* Bits per pixel (Codes uses at least this + 1). */
     36       ClearCode,   /* The CLEAR LZ code. */
     37       EOFCode,     /* The EOF LZ code. */
     38       RunningCode, /* The next code algorithm can generate. */
     39       RunningBits, /* The number of bits required to represent RunningCode. */
     40       MaxCode1,    /* 1 bigger than max. possible code, in RunningBits bits. */
     41       LastCode,    /* The code before the current code. */
     42       CrntCode,    /* Current algorithm code. */
     43       StackPtr,    /* For character stack (see below). */
     44       CrntShiftState;    /* Number of bits in CrntShiftDWord. */
     45     unsigned long CrntShiftDWord;   /* For bytes decomposition into codes. */
     46     unsigned long PixelCount;   /* Number of pixels in image. */
     47     FILE *File;    /* File as stream. */
     48     InputFunc Read;     /* function to read gif input (TVT) */
     49     OutputFunc Write;   /* function to write gif output (MRB) */
     50     GifByteType Buf[256];   /* Compressed input is buffered here. */
     51     GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */
     52     GifByteType Suffix[LZ_MAX_CODE + 1];    /* So we can trace the codes. */
     53     GifPrefixType Prefix[LZ_MAX_CODE + 1];
     54     GifHashTableType *HashTable;
     55 } GifFilePrivateType;
     56 
     57 extern int _GifError;
     58 
     59 #endif /* _GIF_LIB_PRIVATE_H */
     60