diff --git a/flake.lock b/flake.lock index 81aabc1..b061a83 100644 --- a/flake.lock +++ b/flake.lock @@ -11,11 +11,11 @@ "sbt-derivation": "sbt-derivation" }, "locked": { - "lastModified": 1774869538, - "narHash": "sha256-9s+Fl3fSMQ5S4/5TPA2fbK6a6SFjC1TDS232ioLqZBA=", + "lastModified": 1777279692, + "narHash": "sha256-8jGwicX2foCJsJr2HiJEpewz4+Wv9YnOaZvsnkQWvic=", "owner": "jiribenes", "repo": "effekt-nix", - "rev": "46c85db0f5e819920c08bd111f5601508dc6af00", + "rev": "8eb4c3eab118389e3532efe8ec9b74de4f3243b8", "type": "github" }, "original": { @@ -44,11 +44,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1774701658, - "narHash": "sha256-CIS/4AMUSwUyC8X5g+5JsMRvIUL3YUfewe8K4VrbsSQ=", + "lastModified": 1776949667, + "narHash": "sha256-GMSVw35Q+294GlrTUKlx087E31z7KurReQ1YHSKp5iw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b63fe7f000adcfa269967eeff72c64cafecbbebe", + "rev": "01fbdeef22b76df85ea168fbfe1bfd9e63681b30", "type": "github" }, "original": { diff --git a/src/utils/huffman.effekt b/src/utils/huffman.effekt index bcb89f9..0ff5456 100644 --- a/src/utils/huffman.effekt +++ b/src/utils/huffman.effekt @@ -29,7 +29,7 @@ record ContentsData(table: AsciiDictionary[String], content: ByteArray) /// Read chunk of the stream and make a character-frequency map (dictionary) /// from it. Return the map, read chunk and its length. /// -def characterCompressionReader(): (AsciiDictionary[Int], Int, ByteArray) / read[Byte] = { +def characterCompressionReader(): (AsciiDictionary[Int], Int, ByteArray) / next[Byte] = { var dict = emptyDict[Int]() val chunkSize = 4096 @@ -37,7 +37,7 @@ def characterCompressionReader(): (AsciiDictionary[Int], Int, ByteArray) / read[ var offset = 0 def go(): Unit = try { - val readByte = do read[Byte]() + val readByte = do next[Byte]() buffer.set(offset, readByte) offset = offset + 1 diff --git a/src/utils/lzss.effekt b/src/utils/lzss.effekt index fc24677..84c729c 100644 --- a/src/utils/lzss.effekt +++ b/src/utils/lzss.effekt @@ -23,13 +23,13 @@ import bytearray /// The offset is the starting position of a match. It is the number of bytes one needs to go back in the search buffer. /// The length is the number of bytes to copy from the search buffer. -def chunkReader(): (Int, ByteArray) / read[Byte] = { +def chunkReader(): (Int, ByteArray) / next[Byte] = { val chunkSize = 2 * 4096 val buffer = bytearray::allocate(chunkSize) var offset = 0 def go(): Unit = try { - val readByte = do read[Byte]() + val readByte = do next[Byte]() buffer.set(offset, readByte) offset = offset + 1 @@ -182,7 +182,7 @@ def count_tokens(buffer: ByteArray, byteCount: Int): Int = { /// Compress the data chunk (block) into the output stream. /// Count the tokens first and then compress the data chunk. -def writeCompressedBlockStream(buffer: ByteArray, byteCount: Int): Unit / { emit[Byte], read[Byte]} = { +def writeCompressedBlockStream(buffer: ByteArray, byteCount: Int): Unit / { emit[Byte], next[Byte]} = { with streamWriter with on[OutOfBounds].report diff --git a/src/utils/stream_io.effekt b/src/utils/stream_io.effekt index fdb1260..05799ac 100644 --- a/src/utils/stream_io.effekt +++ b/src/utils/stream_io.effekt @@ -128,13 +128,13 @@ def numberToBitsStream(number: Int, bitsToWrite: Int) = { /// Object representing bit/byte reading operations interface StreamReader { - def readBit(): Bool / read[Byte] - def readByte(): Byte / read[Byte] + def readBit(): Bool / next[Byte] + def readByte(): Byte / next[Byte] } /// Handler for StreamReader interface. /// Keeps an internal buffer for reading bits and bytes, so no data is lost. -def streamReader { prog: => Unit / StreamReader }: Unit / {read[Byte], stop} = { +def streamReader { prog: => Unit / StreamReader }: Unit / {next[Byte], stop} = { var buffer = 0 var curBit = 0 var readBits = 0 @@ -145,7 +145,7 @@ def streamReader { prog: => Unit / StreamReader }: Unit / {read[Byte], stop} = { def readBit() = { resume { if (curBit <= 0) { - val readByte = do read[Byte] + val readByte = do next[Byte] buffer = readByte.toInt curBit = 128 readBits = 0 @@ -166,9 +166,9 @@ def streamReader { prog: => Unit / StreamReader }: Unit / {read[Byte], stop} = { def readByte() = { resume { if (readBits == 0) { - do read[Byte] + do next[Byte] } else { - val readByte = do read[Byte] + val readByte = do next[Byte] val newBuffer = readByte.toInt val unreadBits = 8 - readBits