gif_lib_private.h 2.4 KB

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