kusano fc6ab3
/* inflate9.h -- internal inflate state definition
kusano fc6ab3
 * Copyright (C) 1995-2003 Mark Adler
kusano fc6ab3
 * For conditions of distribution and use, see copyright notice in zlib.h
kusano fc6ab3
 */
kusano fc6ab3
kusano fc6ab3
/* WARNING: this file should *not* be used by applications. It is
kusano fc6ab3
   part of the implementation of the compression library and is
kusano fc6ab3
   subject to change. Applications should only use zlib.h.
kusano fc6ab3
 */
kusano fc6ab3
kusano fc6ab3
/* Possible inflate modes between inflate() calls */
kusano fc6ab3
typedef enum {
kusano fc6ab3
        TYPE,       /* i: waiting for type bits, including last-flag bit */
kusano fc6ab3
        STORED,     /* i: waiting for stored size (length and complement) */
kusano fc6ab3
        TABLE,      /* i: waiting for dynamic block table lengths */
kusano fc6ab3
            LEN,        /* i: waiting for length/lit code */
kusano fc6ab3
    DONE,       /* finished check, done -- remain here until reset */
kusano fc6ab3
    BAD         /* got a data error -- remain here until reset */
kusano fc6ab3
} inflate_mode;
kusano fc6ab3
kusano fc6ab3
/*
kusano fc6ab3
    State transitions between above modes -
kusano fc6ab3
kusano fc6ab3
    (most modes can go to the BAD mode -- not shown for clarity)
kusano fc6ab3
kusano fc6ab3
    Read deflate blocks:
kusano fc6ab3
            TYPE -> STORED or TABLE or LEN or DONE
kusano fc6ab3
            STORED -> TYPE
kusano fc6ab3
            TABLE -> LENLENS -> CODELENS -> LEN
kusano fc6ab3
    Read deflate codes:
kusano fc6ab3
                LEN -> LEN or TYPE
kusano fc6ab3
 */
kusano fc6ab3
kusano fc6ab3
/* state maintained between inflate() calls.  Approximately 7K bytes. */
kusano fc6ab3
struct inflate_state {
kusano fc6ab3
        /* sliding window */
kusano fc6ab3
    unsigned char FAR *window;  /* allocated sliding window, if needed */
kusano fc6ab3
        /* dynamic table building */
kusano fc6ab3
    unsigned ncode;             /* number of code length code lengths */
kusano fc6ab3
    unsigned nlen;              /* number of length code lengths */
kusano fc6ab3
    unsigned ndist;             /* number of distance code lengths */
kusano fc6ab3
    unsigned have;              /* number of code lengths in lens[] */
kusano fc6ab3
    code FAR *next;             /* next available space in codes[] */
kusano fc6ab3
    unsigned short lens[320];   /* temporary storage for code lengths */
kusano fc6ab3
    unsigned short work[288];   /* work area for code table building */
kusano fc6ab3
    code codes[ENOUGH];         /* space for code tables */
kusano fc6ab3
};