Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

unzip-6.0/amiga/flate.a  view on Meta::CPAN

         DUMPBITS       d0
         move.b         h_e(t),e
         cmp.b          #32,e                   ; is it a literal?
         bne            nonlit                  ; no
          move.w        h_v_n(t),d0             ; yes
                IFGT SIZEOF_slide-4
          lea           redirslide(G),a0
                ELSE
          move.l        redirslide(G),a0
                ENDC
          move.b        d0,(a0,w.l)             ; stick in the decoded byte
          addq.l        #1,w
          cmp.l         #WSIZE,w
          blo           main_loop
           FLUSH        w
           ext.l        d0                      ; does a test as it casts long
           bne          return
           moveq        #0,w
           bra          main_loop               ; break (newtop loop)

nonlit:  cmp.b          #31,e                   ; is it a length?

unzip-6.0/explode.c  view on Meta::CPAN

         though I would prefer that if you modify it and
         redistribute it that you include comments to that effect
         with your name and the date.  Thank you."

   History:
   vers    date          who           what
   ----  ---------  --------------  ------------------------------------
    c1   30 Mar 92  M. Adler        explode that uses huft_build from inflate
                                    (this gives over a 70% speed improvement
                                    over the original unimplode.c, which
                                    decoded a bit at a time)
    c2    4 Apr 92  M. Adler        fixed bug for file sizes a multiple of 32k.
    c3   10 Apr 92  M. Adler        added a little memory tracking if DEBUG
    c4   11 Apr 92  M. Adler        added NOMEMCPY do kill use of memcpy()
    c5   21 Apr 92  M. Adler        added the WSIZE #define to allow reducing
                                    the 32K window size for specialized
                                    applications.
    c6   31 May 92  M. Adler        added typecasts to eliminate some warnings
    c7   27 Jun 92  G. Roelofs      added more typecasts.
    c8   17 Oct 92  G. Roelofs      changed ULONG/UWORD/byte to ulg/ush/uch.
    c9   19 Jul 93  J. Bush         added more typecasts (to return values);

unzip-6.0/explode.c  view on Meta::CPAN

   compressed form themselves.  What is sent are the lengths of the codes for
   each value, which is sufficient to construct the codes.  Each byte of the
   code representation is the code length (the low four bits representing
   1..16), and the number of values sequentially with that length (the high
   four bits also representing 1..16).  There are 256 literal code values (if
   literals are coded), 64 length code values, and 64 distance code values,
   in that order at the beginning of the compressed stream.  Each set of code
   values is preceded (redundantly) with a byte indicating how many bytes are
   in the code description that follows, in the range 1..256.

   The codes themselves are decoded using tables made by huft_build() from
   the bit lengths.  That routine and its comments are in the inflate.c
   module.
 */

#define __EXPLODE_C     /* identifies this source module */
#define UNZIP_INTERNAL
#include "unzip.h"      /* must supply slide[] (uch) array and NEXTBYTE macro */

#ifndef WSIZE
#  define WSIZE 0x8000  /* window size--must be a power of two, and */

unzip-6.0/explode.c  view on Meta::CPAN

    } while (--j);
  } while (--i);
  return k != n ? 4 : 0;                /* should have read n of them */
}



static int explode_lit(__G__ tb, tl, td, bb, bl, bd, bdl)
     __GDEF
struct huft *tb, *tl, *td;      /* literal, length, and distance tables */
unsigned bb, bl, bd;            /* number of bits decoded by those */
unsigned bdl;                   /* number of distance low bits */
/* Decompress the imploded data using coded literals and a sliding
   window (of size 2^(6+bdl) bytes). */
{
  zusz_t s;             /* bytes to decompress */
  register unsigned e;  /* table entry flag/number of extra bits */
  unsigned n, d;        /* length and index for copy */
  unsigned w;           /* current window position */
  struct huft *t;       /* pointer to table entry */
  unsigned mb, ml, md;  /* masks for bb, bl, and bd bits */

unzip-6.0/explode.c  view on Meta::CPAN

    return 5;
  }
  return 0;
}



static int explode_nolit(__G__ tl, td, bl, bd, bdl)
     __GDEF
struct huft *tl, *td;   /* length and distance decoder tables */
unsigned bl, bd;        /* number of bits decoded by tl[] and td[] */
unsigned bdl;           /* number of distance low bits */
/* Decompress the imploded data using uncoded literals and a sliding
   window (of size 2^(6+bdl) bytes). */
{
  zusz_t s;             /* bytes to decompress */
  register unsigned e;  /* table entry flag/number of extra bits */
  unsigned n, d;        /* length and index for copy */
  unsigned w;           /* current window position */
  struct huft *t;       /* pointer to table entry */
  unsigned ml, md;      /* masks for bl and bd bits */

unzip-6.0/explode.c  view on Meta::CPAN



int explode(__G)
     __GDEF
/* Explode an imploded compressed stream.  Based on the general purpose
   bit flag, decide on coded or uncoded literals, and an 8K or 4K sliding
   window.  Construct the literal (if any), length, and distance codes and
   the tables needed to decode them (using huft_build() from inflate.c),
   and call the appropriate routine for the type of data in the remainder
   of the stream.  The four routines are nearly identical, differing only
   in whether the literal is decoded or simply read in, and in how many
   bits are read in, uncoded, for the low distance bits. */
{
  unsigned r;           /* return codes */
  struct huft *tb;      /* literal code table */
  struct huft *tl;      /* length code table */
  struct huft *td;      /* distance code table */
  unsigned bb;          /* bits for tb */
  unsigned bl;          /* bits for tl */
  unsigned bd;          /* bits for td */
  unsigned bdl;         /* number of uncoded lower distance bits */

unzip-6.0/human68k/flate.s  view on Meta::CPAN

         DUMPBITS       d0
         move.b         h_e(t),e
         cmp.b          #32,e                   ; is it a literal?
         bne            nonlit                  ; no
          move.w        h_v_n(t),d0             ; yes
                IFGT SIZEOF_slide-4
          lea           redirslide-X(G),a0
                ELSE
          move.l        redirslide-X(G),a0
                ENDC
          move.b        d0,(a0,w.l)             ; stick in the decoded byte
          addq.l        #1,w
          cmp.l         #WSIZE,w
          blo           main_loop
           FLUSH        w
           ext.l        d0                      ; does a test as it casts long
           bne          return
           moveq        #0,w
           bra          main_loop               ; break (newtop loop)

nonlit:  cmp.b          #31,e                   ; is it a length?

unzip-6.0/inflate.c  view on Meta::CPAN

   length of 258) in the previous 32K bytes.  If it doesn't find any
   matches (of at least length 3), it codes the next byte.  Otherwise, it
   codes the length of the matched string and its distance backwards from
   the current position.  There is a single Huffman code that codes both
   single bytes (called "literals") and match lengths.  A second Huffman
   code codes the distance information, which follows a length code.  Each
   length or distance code actually represents a base value and a number
   of "extra" (sometimes zero) bits to get to add to the base value.  At
   the end of each deflated block is a special end-of-block (EOB) literal/
   length code.  The decoding process is basically: get a literal/length
   code; if EOB then done; if a literal, emit the decoded byte; if a
   length then get the distance and emit the referred-to bytes from the
   sliding window of previously emitted data.

   There are (currently) three kinds of inflate blocks: stored, fixed, and
   dynamic.  The compressor outputs a chunk of data at a time and decides
   which method to use on a chunk-by-chunk basis.  A chunk might typically
   be 32K to 64K, uncompressed.  If the chunk is uncompressible, then the
   "stored" method is used.  In this case, the bytes are simply stored as
   is, eight bits per byte, with none of the above coding.  The bytes are
   preceded by a count, since there is no longer an EOB code.

unzip-6.0/inflate.c  view on Meta::CPAN

   an encoding of the literal/length and distance Huffman codes that are
   to be used to decode this block.  The representation is itself Huffman
   coded, and so is preceded by a description of that code.  These code
   descriptions take up a little space, and so for small blocks, there is
   a predefined set of codes, called the fixed codes.  The fixed method is
   used if the block ends up smaller that way (usually for quite small
   chunks); otherwise the dynamic method is used.  In the latter case, the
   codes are customized to the probabilities in the current block and so
   can code it much better than the pre-determined fixed codes can.

   The Huffman codes themselves are decoded using a multi-level table
   lookup, in order to maximize the speed of decoding plus the speed of
   building the decoding tables.  See the comments below that precede the
   lbits and dbits tuning parameters.

   GRR:  return values(?)
           0  OK
           1  incomplete table
           2  bad input
           3  not enough memory
         the following return codes are passed through from FLUSH() errors

unzip-6.0/inflate.c  view on Meta::CPAN

# endif
#endif

#define DUMPBITS(n) {b>>=(n);k-=(n);}


/*
   Huffman code decoding is performed using a multi-level table lookup.
   The fastest way to decode is to simply build a lookup table whose
   size is determined by the longest code.  However, the time it takes
   to build this table can also be a factor if the data being decoded
   are not very long.  The most common codes are necessarily the
   shortest codes, so those codes dominate the decoding time, and hence
   the speed.  The idea is you can have a shorter table that decodes the
   shorter, more probable codes, and then point to subsidiary tables for
   the longer codes.  The time it costs to decode the longer codes is
   then traded against the time it takes to make longer tables.

   This results of this trade are in the variables lbits and dbits
   below.  lbits is the number of bits the first level table for literal/
   length codes can decode in one step, and dbits is the same thing for

unzip-6.0/inflate.c  view on Meta::CPAN

static ZCONST unsigned lbits = 9;
/* bits in base distance lookup table */
static ZCONST unsigned dbits = 6;


#ifndef ASM_INFLATECODES

int inflate_codes(__G__ tl, td, bl, bd)
     __GDEF
struct huft *tl, *td;   /* literal/length and distance decoder tables */
unsigned bl, bd;        /* number of bits decoded by tl[] and td[] */
/* inflate (decompress) the codes in a deflated (compressed) block.
   Return an error code or zero if it all goes ok. */
{
  register unsigned e;  /* table entry flag/number of extra bits */
  unsigned d;           /* index for copy */
  UINT_D64 n;           /* length for copy (deflate64: might be 64k+2) */
  UINT_D64 w;           /* current window position (deflate64: up to 64k) */
  struct huft *t;       /* pointer to table entry */
  unsigned ml, md;      /* masks for bl and bd bits */
  register ulg b;       /* bit buffer */

unzip-6.0/inflate.c  view on Meta::CPAN

  ZCONST uch *e;        /* list of extra bits for non-simple codes */
  struct huft **t;      /* result: starting table */
  unsigned *m;          /* maximum lookup bits, returns actual */
/* Given a list of code lengths and a maximum table size, make a set of
   tables to decode that set of codes.  Return zero on success, one if
   the given code set is incomplete (the tables are still built in this
   case), two if the input is invalid (all zero length codes or an
   oversubscribed set of lengths), and three if not enough memory.
   The code with value 256 is special, and the tables are constructed
   so that no bits beyond that code are fetched when that code is
   decoded. */
{
  unsigned a;                   /* counter for codes of length k */
  unsigned c[BMAX+1];           /* bit length count table */
  unsigned el;                  /* length of EOB code (value 256) */
  unsigned f;                   /* i repeats in table every f entries */
  int g;                        /* maximum code length */
  int h;                        /* table level */
  register unsigned i;          /* counter, current code */
  register unsigned j;          /* counter */
  register int k;               /* number of bits in current code */

unzip-6.0/inflate.c  view on Meta::CPAN

    if ((j = *p++) != 0)
      v[x[j]++] = i;
  } while (++i < n);
  n = x[g];                     /* set n to length of v */


  /* Generate the Huffman codes and for each, make the table entries */
  x[0] = i = 0;                 /* first Huffman code is zero */
  p = v;                        /* grab values in bit order */
  h = -1;                       /* no tables yet--level -1 */
  w = l[-1] = 0;                /* no bits decoded yet */
  u[0] = (struct huft *)NULL;   /* just to keep compilers happy */
  q = (struct huft *)NULL;      /* ditto */
  z = 0;                        /* ditto */

  /* go through the bit lengths (k already is bits in shortest code) */
  for (; k <= g; k++)
  {
    a = c[k];
    while (a--)
    {
      /* here i is the Huffman code of length k bits for value *p */
      /* make tables up to required level */
      while (k > w + l[h])
      {
        w += l[h++];            /* add bits already decoded */

        /* compute minimum size table less than or equal to *m bits */
        z = (z = g - w) > *m ? *m : z;                  /* upper limit */
        if ((f = 1 << (j = k - w)) > a + 1)     /* try a k-w bit table */
        {                       /* too few codes for k-w bit table */
          f -= a + 1;           /* deduct codes from patterns left */
          xp = c + k;
          while (++j < z)       /* try smaller tables up to z bits */
          {
            if ((f <<= 1) <= *++xp)

unzip-6.0/macos/HISTORY.TXT  view on Meta::CPAN

4) CHG: {Unzip} changed the method to move extra-field data to
        the internal extra-structure.
        Old method was just BlockMove of the ef_structptr to ef_memptr.
        This method was dangerous because not all members of the
        structure seamless aligned. There are may be some fill
        bytes in the structure depending on the compiler setting.

5) ADD: {Unzip} added a warning if unzipping a ZipIt/PKZip archive.
        ZipIt/PKZip archives are usually additionally coded somehow.
        InfoZip's Unzip will *not* decode the files. So extracted
        files are may be not decoded. (see also 6. and 7.)

6) ADD: ZipIt (the Shareware Tool) has now a new extra-field signature:
        0x2705. Found in "ZipIt 1.3.8". I added a new macro: EF_ZIPIT2

7) ADD: Added PKWare's extra-field signature: 0xCF77.
        Found in "PKZIP v2.03". I added a new macro: EF_PKMAC

8) ADD: {console} It's now possible to save all screen outputs
        to the disk.



( run in 0.280 second using v1.01-cache-2.11-cpan-26ccb49234f )