interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / physics0 / stream.om

34 lines · 763 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note Concatenate rng.om, request.om then this consumer before compilation.
3note Request: 8-byte little-endian seed, then 0..256 nonzero tag bytes, then EOF.
4note Response: eight successive little-endian 64-bit words, exactly 64 bytes.
5note Exit 2 malformed/capacity, 4 I/O failure; no output before validation.
6fn main to int
7used = ulong 0
8reading = true
9while and reading lt used len rngreq
10n = read 0 rngreq used sub len rngreq used
11if lt n 0
12ret 4
13end
14if eq n 0
15reading = false
16else
17used = add used ulong n
18end
19end
20status = rngreqok used
21if ne status 0
22ret status
23end
24rngpack
25sent = ulong 0
26while lt sent len rngout
27n = write 1 rngout sent sub len rngout sent
28if le n 0
29ret 4
30end
31sent = add sent ulong n
32end
33ret 0
34end