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 / om / gpu / dsv41 / decoder / embed-cli.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | fn dsEmbedSession fd int to int |
| 3 | token = new uchar 4 0 |
| 4 | frame = new uchar 40976 0 |
| 5 | while true |
| 6 | used = ulong 0 |
| 7 | while lt used 4 |
| 8 | n = read 0 token used sub 4 used |
| 9 | if eq n -4 |
| 10 | continue |
| 11 | end |
| 12 | if lt n 0 |
| 13 | ret 74 |
| 14 | end |
| 15 | if eq n 0 |
| 16 | if eq used 0 |
| 17 | ret 0 |
| 18 | end |
| 19 | ret 65 |
| 20 | end |
| 21 | used = add used ulong n |
| 22 | end |
| 23 | id = uint 0 |
| 24 | for i ulong 4 |
| 25 | id = or id shl uint get token i mul i 8 |
| 26 | end |
| 27 | if ge id 129280 |
| 28 | ret 65 |
| 29 | end |
| 30 | if not dsInitResidual fd id frame |
| 31 | ret 74 |
| 32 | end |
| 33 | sent = ulong 0 |
| 34 | while lt sent 40976 |
| 35 | n = write 1 frame sent sub 40976 sent |
| 36 | if eq n -4 |
| 37 | continue |
| 38 | end |
| 39 | if le n 0 |
| 40 | ret 74 |
| 41 | end |
| 42 | sent = add sent ulong n |
| 43 | end |
| 44 | end |
| 45 | ret 74 |
| 46 | end |
| 47 | |
| 48 | fn main to int |
| 49 | path = new uchar 4096 0 |
| 50 | n = argread 1 path 0 4096 |
| 51 | if or ne argcnt 2 le n 0 |
| 52 | ret 64 |
| 53 | end |
| 54 | fd = fopen path 0 ulong n 524288 0 |
| 55 | if lt fd 0 |
| 56 | ret 66 |
| 57 | end |
| 58 | rc = int 65 |
| 59 | if dsOpenEmbed int fd |
| 60 | rc = dsEmbedSession int fd |
| 61 | end |
| 62 | if ne fclose int fd 0 |
| 63 | ret 74 |
| 64 | end |
| 65 | ret rc |
| 66 | end |