def notices
import bend-kit-postgres@0.3.0.0/codec.bend as Codecimport Base
485# Fields up to a zero code byte; each takes two bytes, so the bytes left are enough fuel.
486def notices(f: Nat, s: Loop<U32, Notice>) -> Cur & List<&1, Notice>:
487 match f:
488 case 0n:
489 loop.end(U32, Notice, s)
490 case 1n+p:
491 match s:
492 case Go{c, +code, acc}:
493 notices(p, notice.push(code, acc, cstr(c)))
494 case Stop{c, acc}:
495 (c, List.reverse(&1, Notice, acc))