bend-kit-encoding Releases (4): 0.5.0.0 0xd467fe9d46bdf49ca4040e12ad976043 indexed https://jend.leeeet.dev/files.txt?path=bend-kit-encoding@0.5.0.0 0.4.0.0 0x0468714c0982fd44530e6d9c4e7b5ec4 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-encoding@0.4.0.0 0.3.0.0 0xcfc8be7b076f41f95c8e118383892d55 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-encoding@0.3.0.0 0.2.1.0 0xaec630f7a2f6b6ef96750f95d6e4195b unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-encoding@0.2.1.0 Definitions (24): Encoding.Out (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=Out) # Octets being written: the buffer, the count so far, and the word being filled. type Out is Type: Out{buf: Array, n: U32, w: U32} Encoding.put (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=put) # Bytes enter at the top of w, as in Bytes.from_string; every fourth byte stores the word. def put(o: Out, +b: U32) -> Out: Encoding.done (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=done) def done(o: Out) -> Bytes.Bytes: Encoding.utf8.width (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.width) def utf8.width(+c: U32) -> U32: Encoding.utf8.size (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.size) def utf8.size(s: String, +n: U32) -> U32: Encoding.utf8.cont (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.cont) def utf8.cont(c: U32, n: Nat) -> U32: Encoding.utf8.push4 (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.push4) def utf8.push4(+c: U32, o: Out) -> Out: Encoding.utf8.push3 (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.push3) def utf8.push3(+c: U32, o: Out, small: Bool) -> Out: Encoding.utf8.push2 (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.push2) def utf8.push2(+c: U32, o: Out, small: Bool) -> Out: Encoding.utf8.push (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.push) def utf8.push(+c: U32, o: Out, ascii: Bool) -> Out: Encoding.utf8.encode.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.encode.go) def utf8.encode.go(s: String, o: Out) -> Out: Encoding.utf8.encode (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.encode) # Text to octets. One pass sizes the buffer; a second fills it. def utf8.encode(+s: String) -> Bytes.Bytes: Encoding.Utf8 (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=Utf8) # Decoder state: continuation bytes still needed, the allowed range of the # next one, the code point so far, and the output reversed. type Utf8 is Data: Utf8{need: U32, lo: U32, hi: U32, cp: U32, out: String} Encoding.utf8.bad (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.bad) def utf8.bad(out: String) -> String: Encoding.utf8.lead.multi (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.lead.multi) def utf8.lead.multi(+b: U32, out: String) -> Utf8: Encoding.utf8.lead.high (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.lead.high) def utf8.lead.high(+b: U32, out: String, bad: Bool) -> Utf8: Encoding.utf8.lead (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.lead) # WHATWG: a byte that cannot start a sequence decodes to U+FFFD. def utf8.lead(+b: U32, out: String, ascii: Bool) -> Utf8: Encoding.utf8.more (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.more) def utf8.more(+need: U32, cp: U32, out: String, done: Bool) -> Utf8: Encoding.utf8.cont.in (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.cont.in) # WHATWG: a byte that breaks a sequence yields U+FFFD and is read again as a lead. def utf8.cont.in(+need: U32, cp: U32, +b: U32, out: String, ok: Bool) -> Utf8: Encoding.utf8.step.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.step.if) def utf8.step.if(+need: U32, +lo: U32, +hi: U32, cp: U32, +b: U32, out: String, idle: Bool) -> Utf8: Encoding.utf8.step.st (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.step.st) def utf8.step.st(st: Utf8, +b: U32) -> Utf8: Encoding.utf8.finish (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.finish) def utf8.finish(st: Utf8) -> String: Encoding.utf8.decode.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.decode.go) def utf8.decode.go(n: Nat, r: Array & U32, +i: U32, st: Utf8) -> String: Encoding.utf8.decode (https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.decode) # Octets to text, as WHATWG decodes UTF-8: malformed input becomes U+FFFD. def utf8.decode(b: Bytes.Bytes) -> String: