aboutsummaryrefslogtreecommitdiff
path: root/src/main.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.nim')
-rw-r--r--src/main.nim6
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 @@
17import os, streams, sugar 17import os, streams, sugar
18import bitreader, bitwriter, streamblock 18import bitreader, bitwriter, streamblock
19 19
20proc transform(operation: (BitReader, BitWriter) -> void, input, output: string) = 20proc 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
27proc compress(bitReader: BitReader, bitWriter: BitWriter) = 27proc 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
33proc decompress(bitReader: BitReader, bitWriter: BitWriter) = 33proc 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)