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 / check-catalog.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note Emit the native production code image to stdout, without opening a GPU. |
| 3 | fn main to int |
| 4 | if not dnEmit |
| 5 | ret 1 |
| 6 | end |
| 7 | size = get codePos 0 |
| 8 | mem = mapnew -1 0 size 3 33 |
| 9 | if le mem 0 |
| 10 | ret 74 |
| 11 | end |
| 12 | put codeMap 0 mem |
| 13 | if not dnEmit |
| 14 | ret 2 |
| 15 | end |
| 16 | buf = new uchar 65536 0 |
| 17 | pos = ulong 0 |
| 18 | while lt pos size |
| 19 | n = sub size pos |
| 20 | if gt n len buf |
| 21 | n = len buf |
| 22 | end |
| 23 | if ne mapread mem pos buf 0 n long n |
| 24 | ret 74 |
| 25 | end |
| 26 | if ne write 1 buf 0 n long n |
| 27 | ret 74 |
| 28 | end |
| 29 | pos = add pos n |
| 30 | end |
| 31 | if ne mapdrop mem 0 |
| 32 | ret 74 |
| 33 | end |
| 34 | ret 0 |
| 35 | end |