The deflate Reference Manual

This is the deflate Reference Manual, version 1.0.4, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed May 15 05:04:36 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 deflate

Deflate Decompression Library

Maintainer

Pierre R. Mai <>

Author

Pierre R. Mai <>

License

MIT

Version

1.0.4

Source

deflate.asd.

Child Component

deflate.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 deflate/deflate.asd

Source

deflate.asd.

Parent Component

deflate (system).

ASDF Systems

deflate.


3.1.2 deflate/deflate.lisp

Source

deflate.asd.

Parent Component

deflate (system).

Packages

deflate.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 deflate

Source

deflate.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: inflate-gzip-stream (input-stream output-stream &key check-checksum)

Inflate the RFC 1952 gzip data from the given input stream into the given output stream, which are required to have an element-type of (unsigned-byte 8). This returns the CRC-32 checksum of the file as its first return value, with any filename, modification time, and comment fields as further return values or nil if not present. Note that it is the responsibility of the caller to check whether the expanded data matches the CRC-32 checksum, unless the check-checksum keyword argument is set to true, in which case the checksum is checked internally and a gzip-decompression-error is signalled if they don’t match.

Package

deflate.

Source

deflate.lisp.

Function: inflate-stream (input-stream output-stream &key checksum)

Inflate the RFC 1951 data from the given input stream into the given output stream, which are required to have an element-type of (unsigned-byte 8). If checksum is given, it indicates the checksumming algorithm to employ in calculating a checksum of the expanded content, which is then returned from this function. Valid values are :adler-32 for Adler-32 checksum (see RFC 1950), or :crc-32 for CRC-32 as per ISO 3309 (see RFC 1952, ZIP).

Package

deflate.

Source

deflate.lisp.

Function: inflate-zlib-stream (input-stream output-stream &key check-checksum)

Inflate the RFC 1950 zlib data from the given input stream into the given output stream, which are required to have an element-type of (unsigned-byte 8). This returns the Adler-32 checksum of the file as its first return value, with the compression level as its second return value. Note that it is the responsibility of the caller to check whether the expanded data matches the Adler-32 checksum, unless the check-checksum keyword argument is set to true, in which case the checksum is checked internally and a zlib-decompression-error is signalled if they don’t match.

Package

deflate.

Source

deflate.lisp.

Function: parse-gzip-footer (input-stream)

Parse the GZIP-style footer as per RFC 1952 from the input-stream and return the CRC-32 checksum and ISIZE fields contained in the footer as its return values.

Package

deflate.

Source

deflate.lisp.

Function: parse-gzip-header (input-stream)

Parse a GZIP-style header as per RFC 1952 from the input-stream and return the compression-method, text-flag, modification time, XFLAGS, OS, FEXTRA flags, filename, comment and CRC16 fields of the header as return values (or nil if any given field is not present). Checks the header for magic values and correct flags settings and signals a gzip-decompression-error in case of incorrect or unsupported magic values or flags.

Package

deflate.

Source

deflate.lisp.

Function: parse-zlib-footer (input-stream)

Parse the ZLIB-style footer as per RFC 1950 from the input-stream and return the Adler-32 checksum contained in the footer as its return value.

Package

deflate.

Source

deflate.lisp.

Function: parse-zlib-header (input-stream)

Parse a ZLIB-style header as per RFC 1950 from the input-stream and return the compression-method, compression-level dictionary-id and flags fields of the header as return values. Checks the header for corruption and signals a zlib-decompression-error in case of corruption.

Package

deflate.

Source

deflate.lisp.


5.1.2 Conditions

Condition: decompression-error
Package

deflate.

Source

deflate.lisp.

Direct superclasses

simple-error.

Direct subclasses
Condition: deflate-decompression-error
Package

deflate.

Source

deflate.lisp.

Direct superclasses

decompression-error.

Condition: gzip-decompression-error
Package

deflate.

Source

deflate.lisp.

Direct superclasses

decompression-error.

Condition: zlib-decompression-error
Package

deflate.

Source

deflate.lisp.

Direct superclasses

decompression-error.


5.2 Internals


5.2.1 Constants

Constant: +adler-32-base+

Base value for Adler-32 checksums as per RFC 1950.

Package

deflate.

Source

deflate.lisp.

Constant: +adler-32-start-value+

Start value for Adler-32 checksums as per RFC 1950.

Package

deflate.

Source

deflate.lisp.

Constant: +crc-32-polynomial+

CRC-32 Polynomial as per RFC 1952.

Package

deflate.

Source

deflate.lisp.

Constant: +crc-32-start-value+

Start value for CRC-32 checksums as per RFC 1952.

Package

deflate.

Source

deflate.lisp.

Constant: +gzip-header-id1+

GZIP Header Magic Value ID1 as per RFC 1952.

Package

deflate.

Source

deflate.lisp.

Constant: +gzip-header-id2+

GZIP Header Magic Value ID2 as per RFC 1952.

Package

deflate.

Source

deflate.lisp.

Constant: +sliding-window-size+

Size of sliding window for RFC 1951 Deflate compression scheme.

Package

deflate.

Source

deflate.lisp.


5.2.2 Special variables

Special Variable: *code-length-entry-order*

Order of Code Length Tree Code Lengths.

Package

deflate.

Source

deflate.lisp.

Special Variable: *std-dist-decode-tree*
Package

deflate.

Source

deflate.lisp.

Special Variable: *std-lit-decode-tree*
Package

deflate.

Source

deflate.lisp.


5.2.3 Ordinary functions

Reader: bit-stream-bit-count (instance)
Writer: (setf bit-stream-bit-count) (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

bit-count.

Reader: bit-stream-bits (instance)
Writer: (setf bit-stream-bits) (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

bits.

Function: bit-stream-copy-block (stream out-stream)

Copy a given block of bytes directly from the underlying stream.

Package

deflate.

Source

deflate.lisp.

Function: bit-stream-get-byte (stream)

Read another byte from the underlying stream.

Package

deflate.

Source

deflate.lisp.

Reader: bit-stream-next-byte (instance)
Writer: (setf bit-stream-next-byte) (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

next-byte.

Function: bit-stream-p (object)
Package

deflate.

Source

deflate.lisp.

Function: bit-stream-read-bits (stream bits)

Read single or multiple bits from the given bit-stream.

Package

deflate.

Source

deflate.lisp.

Reader: bit-stream-stream (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

stream.

Function: copy-bit-stream (instance)
Package

deflate.

Source

deflate.lisp.

Function: copy-decode-tree (instance)
Package

deflate.

Source

deflate.lisp.

Function: copy-sliding-window-stream (instance)
Package

deflate.

Source

deflate.lisp.

Function: decode-block (bit-stream window-stream)

Decompress a block read from bit-stream into window-stream.

Package

deflate.

Source

deflate.lisp.

Function: decode-code-length-entries (bit-stream count decode-tree)

Decode the given number of code length entries from the bit-stream using the given decode-tree, and return a corresponding array of code lengths for further processing.

Package

deflate.

Source

deflate.lisp.

Function: decode-distance-entry (symbol bit-stream)

Decode the given distance symbol into a proper distance specification.

Package

deflate.

Source

deflate.lisp.

Function: decode-huffman-block (bit-stream window-stream lit-decode-tree dist-decode-tree)

Decode the huffman code block using the huffman codes given by lit-decode-tree and dist-decode-tree.

Package

deflate.

Source

deflate.lisp.

Function: decode-huffman-tables (bit-stream)

Decode the stored huffman tables from the given bit-stream, returning the corresponding decode-trees for literals/length and distance codes.

Package

deflate.

Source

deflate.lisp.

Function: decode-length-entry (symbol bit-stream)

Decode the given length symbol into a proper length specification.

Package

deflate.

Source

deflate.lisp.

Reader: decode-tree-code-symbols (instance)
Writer: (setf decode-tree-code-symbols) (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

code-symbols.

Reader: decode-tree-length-count (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

length-count.

Function: decode-tree-p (object)
Package

deflate.

Source

deflate.lisp.

Function: generate-crc32-table ()
Package

deflate.

Source

deflate.lisp.

Function: make-bit-stream (&key stream next-byte bits bit-count)
Package

deflate.

Source

deflate.lisp.

Function: make-decode-tree (&key length-count code-symbols)
Package

deflate.

Source

deflate.lisp.

Function: make-huffman-decode-tree (code-lengths)

Construct a huffman decode-tree for the canonical huffman code with the code lengths of each symbol given in the input array.

Package

deflate.

Source

deflate.lisp.

Function: make-sliding-window-stream (&key stream buffer buffer-end checksum checksum-value)
Package

deflate.

Source

deflate.lisp.

Function: parse-zlib-checksum (input-stream)
Package

deflate.

Source

deflate.lisp.

Function: read-huffman-code (bit-stream decode-tree)

Read the next huffman code word from the given bit-stream and return its decoded symbol, for the huffman code given by decode-tree.

Package

deflate.

Source

deflate.lisp.

Reader: sliding-window-stream-buffer (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

buffer.

Reader: sliding-window-stream-buffer-end (instance)
Writer: (setf sliding-window-stream-buffer-end) (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

buffer-end.

Reader: sliding-window-stream-checksum (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

checksum.

Reader: sliding-window-stream-checksum-value (instance)
Writer: (setf sliding-window-stream-checksum-value) (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

checksum-value.

Function: sliding-window-stream-copy-bytes (stream distance length)

Copy a number of bytes from the current sliding window.

Package

deflate.

Source

deflate.lisp.

Function: sliding-window-stream-flush (stream)

Flush any remaining buffered bytes from the stream.

Package

deflate.

Source

deflate.lisp.

Function: sliding-window-stream-p (object)
Package

deflate.

Source

deflate.lisp.

Reader: sliding-window-stream-stream (instance)
Package

deflate.

Source

deflate.lisp.

Target Slot

stream.

Function: sliding-window-stream-write-byte (stream byte)

Write a single byte to the sliding-window-stream.

Package

deflate.

Source

deflate.lisp.

Function: update-adler32-checksum (crc buffer end)
Package

deflate.

Source

deflate.lisp.

Function: update-crc32-checksum (crc buffer end)
Package

deflate.

Source

deflate.lisp.


5.2.4 Structures

Structure: bit-stream
Package

deflate.

Source

deflate.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: stream
Package

common-lisp.

Type

stream

Readers

bit-stream-stream.

Writers

This slot is read-only.

Slot: next-byte
Type

fixnum

Initform

0

Readers

bit-stream-next-byte.

Writers

(setf bit-stream-next-byte).

Slot: bits
Type

(unsigned-byte 29)

Initform

0

Readers

bit-stream-bits.

Writers

(setf bit-stream-bits).

Slot: bit-count
Type

(unsigned-byte 8)

Initform

0

Readers

bit-stream-bit-count.

Writers

(setf bit-stream-bit-count).

Structure: decode-tree
Package

deflate.

Source

deflate.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: length-count
Type

(simple-array fixnum (*))

Initform

(make-array 16 :element-type (quote fixnum) :initial-element 0)

Readers

decode-tree-length-count.

Writers

This slot is read-only.

Slot: code-symbols
Type

(simple-array fixnum (*))

Initform

(make-array 16 :element-type (quote fixnum) :initial-element 0)

Readers

decode-tree-code-symbols.

Writers

(setf decode-tree-code-symbols).

Structure: sliding-window-stream
Package

deflate.

Source

deflate.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: stream
Package

common-lisp.

Type

stream

Readers

sliding-window-stream-stream.

Writers

This slot is read-only.

Slot: buffer
Type

(simple-array (unsigned-byte 8) (32768))

Initform

(make-array deflate::+sliding-window-size+ :element-type (quote (unsigned-byte 8)) :initial-element 0)

Readers

sliding-window-stream-buffer.

Writers

This slot is read-only.

Slot: buffer-end
Type

fixnum

Initform

0

Readers

sliding-window-stream-buffer-end.

Writers

(setf sliding-window-stream-buffer-end).

Slot: checksum
Type

symbol

Readers

sliding-window-stream-checksum.

Writers

This slot is read-only.

Slot: checksum-value
Type

(unsigned-byte 32)

Initform

0

Readers

sliding-window-stream-checksum-value.

Writers

(setf sliding-window-stream-checksum-value).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
B   C   D   F   G   I   M   P   R   S   U  
Index Entry  Section

(
(setf bit-stream-bit-count): Private ordinary functions
(setf bit-stream-bits): Private ordinary functions
(setf bit-stream-next-byte): Private ordinary functions
(setf decode-tree-code-symbols): Private ordinary functions
(setf sliding-window-stream-buffer-end): Private ordinary functions
(setf sliding-window-stream-checksum-value): Private ordinary functions

B
bit-stream-bit-count: Private ordinary functions
bit-stream-bits: Private ordinary functions
bit-stream-copy-block: Private ordinary functions
bit-stream-get-byte: Private ordinary functions
bit-stream-next-byte: Private ordinary functions
bit-stream-p: Private ordinary functions
bit-stream-read-bits: Private ordinary functions
bit-stream-stream: Private ordinary functions

C
copy-bit-stream: Private ordinary functions
copy-decode-tree: Private ordinary functions
copy-sliding-window-stream: Private ordinary functions

D
decode-block: Private ordinary functions
decode-code-length-entries: Private ordinary functions
decode-distance-entry: Private ordinary functions
decode-huffman-block: Private ordinary functions
decode-huffman-tables: Private ordinary functions
decode-length-entry: Private ordinary functions
decode-tree-code-symbols: Private ordinary functions
decode-tree-length-count: Private ordinary functions
decode-tree-p: Private ordinary functions

F
Function, (setf bit-stream-bit-count): Private ordinary functions
Function, (setf bit-stream-bits): Private ordinary functions
Function, (setf bit-stream-next-byte): Private ordinary functions
Function, (setf decode-tree-code-symbols): Private ordinary functions
Function, (setf sliding-window-stream-buffer-end): Private ordinary functions
Function, (setf sliding-window-stream-checksum-value): Private ordinary functions
Function, bit-stream-bit-count: Private ordinary functions
Function, bit-stream-bits: Private ordinary functions
Function, bit-stream-copy-block: Private ordinary functions
Function, bit-stream-get-byte: Private ordinary functions
Function, bit-stream-next-byte: Private ordinary functions
Function, bit-stream-p: Private ordinary functions
Function, bit-stream-read-bits: Private ordinary functions
Function, bit-stream-stream: Private ordinary functions
Function, copy-bit-stream: Private ordinary functions
Function, copy-decode-tree: Private ordinary functions
Function, copy-sliding-window-stream: Private ordinary functions
Function, decode-block: Private ordinary functions
Function, decode-code-length-entries: Private ordinary functions
Function, decode-distance-entry: Private ordinary functions
Function, decode-huffman-block: Private ordinary functions
Function, decode-huffman-tables: Private ordinary functions
Function, decode-length-entry: Private ordinary functions
Function, decode-tree-code-symbols: Private ordinary functions
Function, decode-tree-length-count: Private ordinary functions
Function, decode-tree-p: Private ordinary functions
Function, generate-crc32-table: Private ordinary functions
Function, inflate-gzip-stream: Public ordinary functions
Function, inflate-stream: Public ordinary functions
Function, inflate-zlib-stream: Public ordinary functions
Function, make-bit-stream: Private ordinary functions
Function, make-decode-tree: Private ordinary functions
Function, make-huffman-decode-tree: Private ordinary functions
Function, make-sliding-window-stream: Private ordinary functions
Function, parse-gzip-footer: Public ordinary functions
Function, parse-gzip-header: Public ordinary functions
Function, parse-zlib-checksum: Private ordinary functions
Function, parse-zlib-footer: Public ordinary functions
Function, parse-zlib-header: Public ordinary functions
Function, read-huffman-code: Private ordinary functions
Function, sliding-window-stream-buffer: Private ordinary functions
Function, sliding-window-stream-buffer-end: Private ordinary functions
Function, sliding-window-stream-checksum: Private ordinary functions
Function, sliding-window-stream-checksum-value: Private ordinary functions
Function, sliding-window-stream-copy-bytes: Private ordinary functions
Function, sliding-window-stream-flush: Private ordinary functions
Function, sliding-window-stream-p: Private ordinary functions
Function, sliding-window-stream-stream: Private ordinary functions
Function, sliding-window-stream-write-byte: Private ordinary functions
Function, update-adler32-checksum: Private ordinary functions
Function, update-crc32-checksum: Private ordinary functions

G
generate-crc32-table: Private ordinary functions

I
inflate-gzip-stream: Public ordinary functions
inflate-stream: Public ordinary functions
inflate-zlib-stream: Public ordinary functions

M
make-bit-stream: Private ordinary functions
make-decode-tree: Private ordinary functions
make-huffman-decode-tree: Private ordinary functions
make-sliding-window-stream: Private ordinary functions

P
parse-gzip-footer: Public ordinary functions
parse-gzip-header: Public ordinary functions
parse-zlib-checksum: Private ordinary functions
parse-zlib-footer: Public ordinary functions
parse-zlib-header: Public ordinary functions

R
read-huffman-code: Private ordinary functions

S
sliding-window-stream-buffer: Private ordinary functions
sliding-window-stream-buffer-end: Private ordinary functions
sliding-window-stream-checksum: Private ordinary functions
sliding-window-stream-checksum-value: Private ordinary functions
sliding-window-stream-copy-bytes: Private ordinary functions
sliding-window-stream-flush: Private ordinary functions
sliding-window-stream-p: Private ordinary functions
sliding-window-stream-stream: Private ordinary functions
sliding-window-stream-write-byte: Private ordinary functions

U
update-adler32-checksum: Private ordinary functions
update-crc32-checksum: Private ordinary functions


A.3 Variables

Jump to:   *   +  
B   C   L   N   S  
Index Entry  Section

*
*code-length-entry-order*: Private special variables
*std-dist-decode-tree*: Private special variables
*std-lit-decode-tree*: Private special variables

+
+adler-32-base+: Private constants
+adler-32-start-value+: Private constants
+crc-32-polynomial+: Private constants
+crc-32-start-value+: Private constants
+gzip-header-id1+: Private constants
+gzip-header-id2+: Private constants
+sliding-window-size+: Private constants

B
bit-count: Private structures
bits: Private structures
buffer: Private structures
buffer-end: Private structures

C
checksum: Private structures
checksum-value: Private structures
code-symbols: Private structures
Constant, +adler-32-base+: Private constants
Constant, +adler-32-start-value+: Private constants
Constant, +crc-32-polynomial+: Private constants
Constant, +crc-32-start-value+: Private constants
Constant, +gzip-header-id1+: Private constants
Constant, +gzip-header-id2+: Private constants
Constant, +sliding-window-size+: Private constants

L
length-count: Private structures

N
next-byte: Private structures

S
Slot, bit-count: Private structures
Slot, bits: Private structures
Slot, buffer: Private structures
Slot, buffer-end: Private structures
Slot, checksum: Private structures
Slot, checksum-value: Private structures
Slot, code-symbols: Private structures
Slot, length-count: Private structures
Slot, next-byte: Private structures
Slot, stream: Private structures
Slot, stream: Private structures
Special Variable, *code-length-entry-order*: Private special variables
Special Variable, *std-dist-decode-tree*: Private special variables
Special Variable, *std-lit-decode-tree*: Private special variables
stream: Private structures
stream: Private structures