The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/lib/libz/infutil.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /* $NetBSD: infutil.h,v 1.6 2003/03/25 22:48:44 mycroft Exp $ */
    2 
    3 /* infutil.h -- types and macros common to blocks and codes
    4  * Copyright (C) 1995-2002 Mark Adler
    5  * For conditions of distribution and use, see copyright notice in zlib.h 
    6  */
    7 
    8 /* WARNING: this file should *not* be used by applications. It is
    9    part of the implementation of the compression library and is
   10    subject to change. Applications should only use zlib.h.
   11  */
   12 
   13 #ifndef _INFUTIL_H
   14 #define _INFUTIL_H
   15 
   16 typedef enum {
   17       TYPE,     /* get type bits (3, including end bit) */
   18       LENS,     /* get lengths for stored */
   19       STORED,   /* processing stored block */
   20       TABLE,    /* get table lengths */
   21       BTREE,    /* get bit lengths tree for a dynamic block */
   22       DTREE,    /* get length, distance trees for a dynamic block */
   23       CODES,    /* processing fixed or dynamic block */
   24       DRY,      /* output remaining window bytes */
   25       DONE,     /* finished last block, done */
   26       BAD}      /* got a data error--stuck here */
   27 inflate_block_mode;
   28 
   29 /* inflate blocks semi-private state */
   30 struct inflate_blocks_state {
   31 
   32   /* mode */
   33   inflate_block_mode  mode;     /* current inflate_block mode */
   34 
   35   /* mode dependent information */
   36   union {
   37     uInt left;          /* if STORED, bytes left to copy */
   38     struct {
   39       uInt table;               /* table lengths (14 bits) */
   40       uInt index;               /* index into blens (or border) */
   41       uIntf *blens;             /* bit lengths of codes */
   42       uInt bb;                  /* bit length tree depth */
   43       inflate_huft *tb;         /* bit length decoding tree */
   44     } trees;            /* if DTREE, decoding info for trees */
   45     struct {
   46       inflate_codes_statef 
   47          *codes;
   48     } decode;           /* if CODES, current state */
   49   } sub;                /* submode */
   50   uInt last;            /* true if this block is the last block */
   51 
   52   /* mode independent information */
   53   uInt bitk;            /* bits in bit buffer */
   54   uLong bitb;           /* bit buffer */
   55   inflate_huft *hufts;  /* single malloc for tree space */
   56   Bytef *window;        /* sliding window */
   57   Bytef *end;           /* one byte after sliding window */
   58   Bytef *read;          /* window read pointer */
   59   Bytef *write;         /* window write pointer */
   60 
   61 };
   62 
   63 
   64 /* defines for inflate input/output */
   65 /*   update pointers and return */
   66 #define UPDBITS {s->bitb=b;s->bitk=k;}
   67 #define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
   68 #define UPDOUT {s->write=q;}
   69 #define UPDATE {UPDBITS UPDIN UPDOUT}
   70 #define LEAVE {UPDATE return inflate_flush(s,z,r);}
   71 /*   get bytes and bits */
   72 #define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
   73 #define NEEDBYTE {if(n)r=Z_OK;else LEAVE}
   74 #define NEXTBYTE (n--,*p++)
   75 #define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}
   76 #define DUMPBITS(j) {b>>=(j);k-=(j);}
   77 /*   output bytes */
   78 #define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
   79 #define LOADOUT {q=s->write;m=(uInt)WAVAIL;}
   80 #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
   81 #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
   82 #define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
   83 #define OUTBYTE(a) {*q++=(Byte)(a);m--;}
   84 /*   load local pointers */
   85 #define LOAD {LOADIN LOADOUT}
   86 
   87 /* masks for lower bits (size given to avoid silly warnings with Visual C++) */
   88 extern const uInt inflate_mask[17];
   89 
   90 /* copy as much as possible from the sliding window to the output area */
   91 extern int inflate_flush __P((
   92     inflate_blocks_statef *,
   93     z_streamp ,
   94     int));
   95 
   96 struct internal_state      {int dummy;}; /* for buggy compilers */
   97 
   98 #endif

Cache object: 2c32faa0be09068ab583ad9e8d581e49


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.