Common Lisp Package: ZLIB

README:

FUNCTION

Public

COMPRESS (BUFFER BTYPE)

Compresses BUFFER using deflate algorithm of type BTYPE. Recognized types are :NO-COMPRESSION, :FIXED and :DYNAMIC.

UNCOMPRESS (BUFFER &KEY (UNCOMPRESSED-SIZE NIL))

Uncompresses BUFFER. Returns a vector of bytes containing the uncompressed data, and the length of the uncompressed data.

Private

ADD-HASH-VALUE (HASH-TABLE HASH-VALUE INDEX)

Remove oldest hash-value index from HASH-TABLE (if necessary) and push INDEX into HASH-TABLE

ADLER-32 (BUFFER)

Compute Adler-32 checksum of BUFFER. Based on the sample code in appendix C of RFC 1950. update-adler-32 does all the work

BIT-LIST-FROM-VALUE (VALUE LENGTH)

Return a list with a bit representation of VALUE. The list has LENGTH elements

BIT-STREAM-BYTES (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

BIT-STREAM-PAD-TO-BYTE-BOUNDARY (BIT-STREAM)

If necessary, pads the current byte in BIT-STREAM with zeroes

BIT-STREAM-POSITION (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

BIT-STREAM-READ-BIT (BIT-STREAM)

Return the next bit from BIT-STREAM

BIT-STREAM-READ-BITS (BIT-STREAM N)

Read N bits from BIT-STREAM

BIT-STREAM-READ-BYTE (BIT-STREAM)

Read the next byte (8 bits) from BIT-STREAM

BIT-STREAM-READ-LENGTH-AND-DISTANCE (BIT-STREAM CODE &OPTIONAL (DISTANCE-HUFFMAN-TREE NIL))

Find the length and distance for CODE from BIT-STREAM and return them

BIT-STREAM-READ-N-BYTES (BIT-STREAM N)

Read N bytes from BIT-STREAM

BIT-STREAM-READ-SYMBOL (BIT-STREAM HUFFMAN-TREE)

Read bits from BIT-STREAM and find the corresponding symbol in HUFFMAN-TREE

BIT-STREAM-WRITE-BIT (BIT-STREAM BIT)

Write BIT to BIT-STREAM

BIT-STREAM-WRITE-BITS (BIT-STREAM BIT-LIST)

Write bits from BIT-LIST to BIT-STREAM

BIT-STREAM-WRITE-BYTE (BIT-STREAM BYTE)

Write BYTE to BIT-STREAM

DECODE-DYNAMIC-HUFFMAN-BLOCK (BIT-STREAM RESULT)

Decode one block in BIT-STREAM with dynamic Huffman coding and store the result in RESULT

DECODE-FIXED-HUFFMAN-BLOCK (BIT-STREAM RESULT)

Decode one block in BIT-STREAM with fixed Huffman coding and store the result in RESULT.

DECODE-NON-COMPRESSED-BLOCK (BIT-STREAM RESULT)

Decode one non-compressed block in BIT-STREAM and store the result in RESULT

DISTANCE-CODE (DISTANCE)

Return the distance-code for a given DISTANCE

DISTANCE-CODE-BITS (CODE)

Return a list with 5 elements that are the binary representation of CODE.

ENCODE-FIXED-HUFFMAN-BLOCK (BIT-STREAM BUFFER HASH-TABLE START END)

Encode a DEFLATE block using the fixed Huffman code method

ENCODE-NON-COMPRESSED-BLOCK (BIT-STREAM BUFFER START END)

Encode a DEFLATE block using the non-compressing method

EXTRA-DISTANCE-BITS (DISTANCE)

The number of extra distance bits that are needed for a given DISTANCE.

EXTRA-LENGTH-BITS (LENGTH)

The number of extra length bits that are needed for a given DISTANCE.

FIND-BEST-MATCH (BUFFER MATCH INDEX)

Searches all elements in MATCH to find the one with the lowest position. INDEX is the index to the current position in BUFFER

FIXED-HUFFMAN-CODE (SYMBOL)

Return the code for the given SYMBOL.

HUFFMAN-INSERT-ELEMENT (TREE LENGTH CODE SYMBOL)

Insert SYMBOL into TREE

LENGTH-CODE (LENGTH)

Return the length-code for a given LENGTH

MAKE-HUFFMAN-TREE (HUFFMAN-CODE-LENGTHS)

Create a Huffman tree from HUFFMAN-CODE-LENGTHS

NUMBER-OF-BLOCKS (BUFFER BTYPE)

Return the number of blocks that should be used to encode the BUFFER.

READ-32-BITS-FROM-ARRAY (ARRAY)

Read a 32-bit word from ARRAY, MSB first

Undocumented

SETFBIT-STREAM-BYTES (NEW-VALUE INSTANCE)

BIT-STREAM-P (OBJECT)

SETFBIT-STREAM-POSITION (NEW-VALUE INSTANCE)

BIT-STREAM-READ-REVERSED-BIT (BIT-STREAM)

BIT-STREAM-READ-REVERSED-BITS (BIT-STREAM N)

BIT-STREAM-WRITE-BITS2 (BIT-STREAM BIT-VECTOR)

BIT-VECTOR-FROM-VALUE (VALUE LENGTH)

COPY-BIT-STREAM (INSTANCE)

DISTANCE-CODE-BITS2 (CODE)

ENCODE-DYNAMIC-HUFFMAN-BLOCK (BIT-STREAM BUFFER)

FIXED-HUFFMAN-CODE2 (SYMBOL)

INFIX-TO-TREE (SEQUENCE)

MAKE-BIT-STREAM (&KEY ((BYTES DUM72) NIL) ((POSITION DUM73) 0))

MAP-TREE-POSTFIX (FUN TREE)

READ-HUFFMAN-CODE-LENGTHS (BIT-STREAM HUFFMAN-TREE ITEMS)

UPDATE-ADLER-32 (ADLER BUFFER)

MACRO

Private

DECISION-TREE (EXPRESSION &REST CLAUSES)

CLAUSES: Each clause is of the forms: (less|:less . <body>) ; must be the first clause if present. (<real> . <body>) DO: Evaluate the expression, which must be a real, and generate a binary decision tree to select the <body> of the clause whose limit is <= the expression and the next clause limit is > the expression.

Undocumented

DEBUG-FORMAT-1 (&BODY BODY)

DEBUG-FORMAT-2 (&BODY BODY)

VARIABLE

Private

+DISTANCE-ENCODING+

Gives the relationship between a code, and extra bits and distance

+FIXED-HUFFMAN-CODE-LENGTHS+

The number of bits used to represent a code length

+LENGTH-ENCODING+

Gives the relationship between a code, and extra bits and length

Undocumented

*DEBUG-LEVEL*

*DEBUG-STREAM*

+DYNAMIC-HUFFMAN-CODE-LENGTHS-ORDER+

+FIXED-HUFFMAN-CODE-BITLIST+

+FIXED-HUFFMAN-CODES+

CLASS

Private

Undocumented

BIT-STREAM

CONSTANT

Private

Undocumented

+ADLER-BASE+

+DEFLATE-MAX-HASH-TABLE-CONTENTS-LENGTH+

+HUFFMAN-END-OF-BLOCK-SYMBOL+

+MAX-DISTANCE+

+MAX-LENGTH+

+MAX-NON-COMPRESSED-BLOCK-SIZE+

+MIN-DISTANCE+

+MIN-LENGTH+

+ZLIB-MAJOR-VERSION+

+ZLIB-MINOR-VERSION+