omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / physics0 / stream.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note Concatenate rng.om, request.om then this consumer before compilation. |
| 3 | note Request: 8-byte little-endian seed, then 0..256 nonzero tag bytes, then EOF. |
| 4 | note Response: eight successive little-endian 64-bit words, exactly 64 bytes. |
| 5 | note Exit 2 malformed/capacity, 4 I/O failure; no output before validation. |
| 6 | fn main to int |
| 7 | used = ulong 0 |
| 8 | reading = true |
| 9 | while and reading lt used len rngreq |
| 10 | n = read 0 rngreq used sub len rngreq used |
| 11 | if lt n 0 |
| 12 | ret 4 |
| 13 | end |
| 14 | if eq n 0 |
| 15 | reading = false |
| 16 | else |
| 17 | used = add used ulong n |
| 18 | end |
| 19 | end |
| 20 | status = rngreqok used |
| 21 | if ne status 0 |
| 22 | ret status |
| 23 | end |
| 24 | rngpack |
| 25 | sent = ulong 0 |
| 26 | while lt sent len rngout |
| 27 | n = write 1 rngout sent sub len rngout sent |
| 28 | if le n 0 |
| 29 | ret 4 |
| 30 | end |
| 31 | sent = add sent ulong n |
| 32 | end |
| 33 | ret 0 |
| 34 | end |