How daniakhan337-star/zip-c-huffman works
Zip-C is a command-line Huffman file compressor and decompressor. Its main workflow reads an input file, counts byte frequencies, builds a Huffman tree and codes, then writes a .huff header and bit-packed payload; decompression rebuilds the tree from the header and decodes the payload. The CLI also offers round-trip verification and compression metrics. Source excerpts show the driver’s calls into the tree and bit-I/O layers; the shared header documents the format and interfaces. No README is present.
Main entry points: main.c Compress/decompress · tree.c Huffman tree · heap.c Frequency counter · bitio.c Bit writer
Components 13
CLI and drivers
- Compress/decompress
main.c - Round-trip verification
main.c - Compression metrics
main.c
Huffman coding
- Frequency counter
heap.c - Min-heap
heap.c - Huffman tree
tree.c - Code generation
tree.c
Bitstream I/O
- Bit writer
bitio.c - Bit reader
bitio.c
Other components
- CLI user
- Input file
- .huff archive
- Decoded output
Connections 15
- CLI user → Compress/decompress: runs command
main.c - Compress/decompress → Input file: reads
main.c - Compress/decompress → Frequency counter: counts bytes
main.c - Compress/decompress → Huffman tree: builds tree
main.c - Huffman tree → Min-heap: uses
tree.c - Compress/decompress → Code generation: generates codes
main.c - Compress/decompress → Bit writer: writes payload
main.c - Compress/decompress → .huff archive: writes archive
main.c - Compress/decompress → .huff archive: reads archive
main.c - Compress/decompress → Huffman tree: rebuilds tree
main.c - Compress/decompress → Bit reader: reads payload
main.c - Compress/decompress → Decoded output: writes decoded bytes
main.c - Compress/decompress → Round-trip verification: optionally verifies
main.c - Round-trip verification → Compression metrics
main.c - Compress/decompress → Compression metrics: prints metrics
main.c