@@ 2,6 2,7 @@ const std = @import("std");
const frequencies = @import("frequencies.zig");
const tree = @import("tree.zig");
const canonical = @import("canonical.zig");
+const xcoding = @import("xcoding.zig");
const Allocator = std.mem.Allocator;
const File = std.fs.File;
@@ 19,6 20,8 @@ pub const Codebook = canonical.Codebook;
pub const getFrequencies = frequencies.getFrequencies;
pub const getLengthCount = canonical.getLengthCount;
+pub const compress = xcoding.compress;
+pub const decompress = xcoding.decompress;
/// Struct containing a character and its absolute frequency within a
/// read file.
@@ 1,7 1,6 @@
const std = @import("std");
const meno = @import("meno");
const huffman = @import("huffman.zig");
-const xcoding = @import("xcoding.zig");
const Allocator = std.mem.Allocator;
const Reader = std.fs.File.Reader;
@@ 95,7 94,7 @@ fn compress(from_path: []const u8, to_path: []const u8, allocator: Allocator) !v
const writer = result.writer();
try file.seekTo(0);
- try xcoding.compress(reader, writer, frequencies, allocator);
+ try huffman.compress(reader, writer, frequencies, allocator);
return;
}
@@ 111,7 110,7 @@ fn decompress(from_path: []const u8, to_path: []const u8, allocator: Allocator)
var bw = std.io.bufferedWriter(decoded_file.writer());
const writer = bw.writer();
- try xcoding.decompress(reader, writer, allocator);
+ try huffman.decompress(reader, writer, allocator);
try bw.flush();