README

hustcer/fbr/common does not have a README file

#
FbrError

pub(all) suberror FbrError {
FbrError(code~ : FbrErrorCode, message~ : String)
}

Error raised by Brotli decoding, decompression, and encoding APIs.

code is stable enough for branching in callers. message may include additional context such as the failed format check.

#
BrotliCommandInfo

pub(all) struct BrotliCommandInfo {
insert_len_extra_bits : Int
copy_len_extra_bits : Int
distance_code : Int
distance_context : Int
insert_len_offset : Int
copy_len_offset : Int
}

#
BrotliDistanceRing

pub(all) struct BrotliDistanceRing {
distances : FixedArray[Int]
index : Int
last_distance_context : Int
}

#
BrotliDistanceRing::clone

Return an independent copy of the ring, including its backing slots, so the copy can be mutated without affecting the original. Used by the streaming decoder to speculatively decode a meta-block and roll back on short input.

#
BrotliDistanceRing::compensate_dictionary_copy

fn BrotliDistanceRing::compensate_dictionary_copy(self : BrotliDistanceRing) -> Unit

#
BrotliDistanceRing::new

#
BrotliDistanceRing::record

fn BrotliDistanceRing::record(self : BrotliDistanceRing, distance : Int) -> Unit raise FbrError

#
BrotliDistanceRing::take_short_code

fn BrotliDistanceRing::take_short_code(self : BrotliDistanceRing, code : Int) -> Int raise FbrError

#
FbrErrorCode

pub(all) enum FbrErrorCode {
UnexpectedEOF
InvalidUTF8
InvalidZipData
BrotliInvalidWindowBits
BrotliInvalidMetablock
BrotliInvalidHuffman
BrotliInvalidContextMap
BrotliInvalidDistance
BrotliInvalidTransform
BrotliDictionaryNotSupported
BrotliLargeWindowNotSupported
BrotliReserved
BrotliInvalidPadding
} derive(Eq,
Debug
)

Error categories reported by Brotli operations.

The public decode/encode APIs raise FbrError with one of these codes. The code is intended for programmatic handling while the message gives a human-readable explanation.

#
FbrStreamHandler

pub(all) struct FbrStreamHandler((FixedArray[Byte], Bool) -> Unit)

Callback wrapper used by stream-style APIs.

The wrapped function receives (data, is_final). data is the produced output chunk and is_final is true for the final callback of a stream.

#
brotli_ascii_upper

fn brotli_ascii_upper(byte : Byte) -> Byte

#
brotli_block_length_bases

let brotli_block_length_bases : FixedArray[Int]

Base values for Brotli block-length prefix-code symbols.

#
brotli_block_length_extra_bits

let brotli_block_length_extra_bits : FixedArray[Int]

Extra-bit counts for Brotli block-length prefix-code symbols.

#
brotli_block_size_cap

let brotli_block_size_cap : Int

Sentinel block length used when a stream has a single block type.

#
brotli_build_command_info

fn brotli_build_command_info(symbol : Int) -> BrotliCommandInfo

#
brotli_build_huffman_table

fn brotli_build_huffman_table(code_lengths : FixedArray[Byte], alphabet_size : Int, root_bits : Int) -> FixedArray[Int] raise FbrError

#
brotli_build_simple_huffman_table

fn brotli_build_simple_huffman_table(symbols : FixedArray[Int], num_symbols_code : Int, root_bits : Int) -> FixedArray[Int] raise FbrError

#
brotli_code_length_code_order

let brotli_code_length_code_order : FixedArray[Int]

Order in which Brotli code-length-code lengths are transmitted.

#
brotli_code_length_prefix_length

let brotli_code_length_prefix_length : FixedArray[Int]

Static prefix-code lengths for complex Huffman code-length-code lengths.

#
brotli_code_length_prefix_value

let brotli_code_length_prefix_value : FixedArray[Int]

Static prefix-code values for complex Huffman code-length-code lengths.

#
brotli_command_cell_pos

let brotli_command_cell_pos : FixedArray[Int]

#
brotli_command_info

fn brotli_command_info(symbol : Int) -> BrotliCommandInfo raise FbrError

#
brotli_command_info_table

let brotli_command_info_table : FixedArray[BrotliCommandInfo]

#
brotli_copy_length_extra_bits

let brotli_copy_length_extra_bits : FixedArray[Int]

#
brotli_dictionary_data

let brotli_dictionary_data : FixedArray[Byte]

#
brotli_dictionary_max_word_length

let brotli_dictionary_max_word_length : Int

#
brotli_dictionary_min_word_length

let brotli_dictionary_min_word_length : Int

#
brotli_dictionary_offsets_by_length

let brotli_dictionary_offsets_by_length : FixedArray[Int]

#
brotli_dictionary_size_bits_by_length

let brotli_dictionary_size_bits_by_length : FixedArray[Int]

#
brotli_distance_alphabet_size

fn brotli_distance_alphabet_size(npostfix : Int, ndirect : Int, max_distance_bits : Int) -> Int

#
brotli_distance_context_bits

let brotli_distance_context_bits : Int

Distance context ID bit count per distance block type.

#
brotli_distance_extra_bits

fn brotli_distance_extra_bits(code : Int, npostfix : Int, ndirect : Int) -> Int raise FbrError

#
brotli_distance_offset

fn brotli_distance_offset(code : Int, npostfix : Int, ndirect : Int) -> Int raise FbrError

#
brotli_distance_ring_slot

fn brotli_distance_ring_slot(index : Int) -> Int

#
brotli_huffman_code

fn brotli_huffman_code(bits : Int, value : Int) -> Int

A decoded Brotli Huffman table entry, packed into a single Int.

Tables are stored as FixedArray[Int] rather than FixedArray of a boxed struct so each lookup is one contiguous load instead of a pointer dereference plus two field loads. The low 16 bits hold the code length as a signed value (-1 marks an unfilled entry); the high 16 bits hold the symbol or sub-table offset. Code lengths fit in a few bits and values stay well under 2^15, so the layout is lossless for every table Brotli builds.

#
brotli_huffman_code_bits

fn brotli_huffman_code_bits(code : Int) -> Int

Extract the code length from a packed Huffman entry (sign-extended).

#
brotli_huffman_code_empty

let brotli_huffman_code_empty : Int

Packed value for an unfilled Huffman table entry (bits = -1).

#
brotli_huffman_code_value

fn brotli_huffman_code_value(code : Int) -> Int

Extract the symbol / sub-table offset from a packed Huffman entry.

#
brotli_huffman_max_code_length

let brotli_huffman_max_code_length : Int

Maximum code length in bits for any Brotli Huffman alphabet.

#
brotli_huffman_max_code_length_code_length

let brotli_huffman_max_code_length_code_length : Int

Maximum bit length for the code-length-code alphabet.

#
brotli_huffman_max_table_size

let brotli_huffman_max_table_size : Int

Maximum per-tree table size from the reference implementation.

#
brotli_huffman_table_bits

let brotli_huffman_table_bits : Int

Root table width for Brotli Huffman lookup tables.

#
brotli_initial_repeated_code_length

let brotli_initial_repeated_code_length : Int

Initial previous length used by repeat-previous code-length symbols.

#
brotli_insert_length_extra_bits

let brotli_insert_length_extra_bits : FixedArray[Int]

#
brotli_literal_context_bits

let brotli_literal_context_bits : Int

Literal context ID bit count per literal block type.

#
brotli_literal_context_id

fn brotli_literal_context_id(mode : Int, previous_byte_1 : Int, previous_byte_2 : Int) -> Int raise FbrError

#
brotli_log2_floor_plus_one

fn brotli_log2_floor_plus_one(x : Int) -> Int

#
brotli_max_distance_bits

let brotli_max_distance_bits : Int

Maximum standard distance extra-bit count.

#
brotli_max_metablock_bytes

let brotli_max_metablock_bytes : Int

Operational cap on uncompressed bytes per Brotli meta-block. Matches the C reference MAX_METABLOCK_SIZE.

#
brotli_max_window_bits

let brotli_max_window_bits : Int

Maximum standard Brotli window size in bits. fzip intentionally rejects the large-window extension above this limit.

#
brotli_min_window_bits

let brotli_min_window_bits : Int

Minimum standard Brotli window size in bits.

#
brotli_num_block_length_symbols

let brotli_num_block_length_symbols : Int

Number of block-length prefix-code symbols.

#
brotli_num_code_length_codes

let brotli_num_code_length_codes : Int

Number of symbols in the code-length-code alphabet.

#
brotli_num_command_symbols

let brotli_num_command_symbols : Int

Number of insert-and-copy command symbols.

#
brotli_num_distance_short_codes

let brotli_num_distance_short_codes : Int

Number of distance short codes backed by the recent-distance ring.

#
brotli_num_literal_symbols

let brotli_num_literal_symbols : Int

Number of literal symbols in Brotli literal Huffman trees.

#
brotli_prefix_offset

fn brotli_prefix_offset(extra_bits : FixedArray[Int], code : Int, initial : Int) -> Int

#
brotli_repeat_previous_code_length

let brotli_repeat_previous_code_length : Int

Brotli code-length repeat symbol for the previous nonzero code length.

#
brotli_repeat_zero_code_length

let brotli_repeat_zero_code_length : Int

Brotli code-length repeat symbol for zero code lengths.

#
brotli_reverse_bits

fn brotli_reverse_bits(code : Int, len : Int) -> Int

#
brotli_signed_lut1

let brotli_signed_lut1 : FixedArray[Int]

Signed literal context first-byte LUT (RFC 7932 §7.1).

#
brotli_signed_lut2

let brotli_signed_lut2 : FixedArray[Int]

Signed literal context second-byte LUT (RFC 7932 §7.1).

#
brotli_transform_count

fn brotli_transform_count() -> Int

#
brotli_transform_identity

let brotli_transform_identity : Int

#
brotli_transform_omit_first_1

let brotli_transform_omit_first_1 : Int

#
brotli_transform_omit_first_9

let brotli_transform_omit_first_9 : Int

#
brotli_transform_omit_last_9

let brotli_transform_omit_last_9 : Int

#
brotli_transform_prefix_suffix

let brotli_transform_prefix_suffix : FixedArray[Byte]

#
brotli_transform_prefix_suffix_map

let brotli_transform_prefix_suffix_map : FixedArray[Int]

#
brotli_transform_shift_all

let brotli_transform_shift_all : Int

#
brotli_transform_shift_first

let brotli_transform_shift_first : Int

#
brotli_transform_string_length

fn brotli_transform_string_length(id : Int) -> Int raise FbrError

#
brotli_transform_string_offset

fn brotli_transform_string_offset(id : Int) -> Int raise FbrError

#
brotli_transform_triplets

let brotli_transform_triplets : FixedArray[Int]

#
brotli_transform_uppercase_all

let brotli_transform_uppercase_all : Int

#
brotli_transform_uppercase_first

let brotli_transform_uppercase_first : Int

#
brotli_uppercase_all

fn brotli_uppercase_all(buf : FixedArray[Byte], offset : Int, length : Int) -> Unit

#
brotli_uppercase_first

fn brotli_uppercase_first(buf : FixedArray[Byte], offset : Int, length : Int) -> Unit

#
brotli_utf8_lut1

let brotli_utf8_lut1 : FixedArray[Int]

UTF-8 literal context first-byte LUT (RFC 7932 §7.1).

#
brotli_utf8_lut2

let brotli_utf8_lut2 : FixedArray[Int]

UTF-8 literal context second-byte LUT (RFC 7932 §7.1).

#
brotli_validate_huffman_lengths

fn brotli_validate_huffman_lengths(count : FixedArray[Int], nonzero : Int) -> Unit raise FbrError

#
brotli_validate_window_bits

fn brotli_validate_window_bits(window_bits : Int) -> Unit raise FbrError

#
brotli_window_gap

let brotli_window_gap : Int

Bytes reserved by RFC 7932 section 9.1 when deriving the maximum backward-reference distance from the advertised window size.

#
call_handler

fn call_handler(h : FbrStreamHandler, data : FixedArray[Byte], final_ : Bool) -> Unit

#
concat_chunks

fn concat_chunks(chunks : Array[FixedArray[Byte]]) -> FixedArray[Byte]

#
default_max_input_size

let default_max_input_size : Int

Default maximum compressed input size for defensive decompression.

Used as the default value in decompression option structs.

#
default_max_output_size

let default_max_output_size : Int

Default maximum uncompressed output size for defensive decompression.

Used as the default value in decompression option structs.

#
error_messages

let error_messages : Array[String]

#
fbr_err

fn fbr_err(code : FbrErrorCode, msg? : String) -> FbrError

#
fbr_error_code_to_int

fn fbr_error_code_to_int(code : FbrErrorCode) -> Int

#
max_int_val

fn max_int_val() -> Int

Largest positive Int value, used to clamp capacity math before allocation

#
rev

let rev : FixedArray[Int]

15-bit reversal table (32768 entries).

Shared canonical-Huffman support used by brotli_reverse_bits to map a forward code to its reversed bit order.

#
shft

fn shft(p : Int) -> Int

Get end of byte boundary

#
slc

fn slc(v : FixedArray[Byte], s : Int, e? : Int) -> FixedArray[Byte]

Slice a FixedArray (copy)

#
trim_buf

fn trim_buf(buf : FixedArray[Byte], len : Int) -> FixedArray[Byte]

Trim buffer to actual length (avoid copy if already exact size)