diff options
Diffstat (limited to 'src/main.nim')
-rw-r--r-- | src/main.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.nim b/src/main.nim index 8f0536c..4fc137f 100644 --- a/src/main.nim +++ b/src/main.nim | |||
@@ -17,20 +17,20 @@ | |||
17 | import os, streams, sugar | 17 | import os, streams, sugar |
18 | import bitreader, bitwriter, streamblock | 18 | import bitreader, bitwriter, streamblock |
19 | 19 | ||
20 | proc transform(operation: (BitReader, BitWriter) -> void, input, output: string) = | 20 | proc transform*(operation: (BitReader, BitWriter) -> void, input, output: string) = |
21 | let inputStream = openFileStream(input, fmRead) | 21 | let inputStream = openFileStream(input, fmRead) |
22 | defer: inputStream.close() | 22 | defer: inputStream.close() |
23 | let outputStream = openFileStream(output, fmWrite) | 23 | let outputStream = openFileStream(output, fmWrite) |
24 | defer: outputStream.close() | 24 | defer: outputStream.close() |
25 | operation(inputStream.bitReader(), outputStream.bitWriter()) | 25 | operation(inputStream.bitReader(), outputStream.bitWriter()) |
26 | 26 | ||
27 | proc compress(bitReader: BitReader, bitWriter: BitWriter) = | 27 | proc compress*(bitReader: BitReader, bitWriter: BitWriter) = |
28 | while not bitReader.atEnd(): | 28 | while not bitReader.atEnd(): |
29 | let streamBlock = streamblock.readRaw(bitReader) | 29 | let streamBlock = streamblock.readRaw(bitReader) |
30 | streamBlock.writeSerialisedTo(bitWriter) | 30 | streamBlock.writeSerialisedTo(bitWriter) |
31 | bitWriter.flush() | 31 | bitWriter.flush() |
32 | 32 | ||
33 | proc decompress(bitReader: BitReader, bitWriter: BitWriter) = | 33 | proc decompress*(bitReader: BitReader, bitWriter: BitWriter) = |
34 | var hasMore = true | 34 | var hasMore = true |
35 | while hasMore: | 35 | while hasMore: |
36 | let streamBlock = streamblock.readSerialised(bitReader) | 36 | let streamBlock = streamblock.readSerialised(bitReader) |