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 / tools / source-aware / sa
| 1 | #!/bin/sh |
| 2 | # Transport only; all parsing, typing, hashing and decisions execute in native Omega. |
| 3 | set -eu |
| 4 | cd "$(dirname "$0")/../.." |
| 5 | [ "$#" = 1 ] || { echo BAD_COMMAND >&2; exit 64; } |
| 6 | case "$1" in |
| 7 | encode) mode='\001';; decode) mode='\002';; identity) mode='\003';; |
| 8 | provenance) mode='\004';; replay) mode='\005';; legality) mode='\006';; |
| 9 | *) echo BAD_COMMAND >&2; exit 64;; |
| 10 | esac |
| 11 | build=${SA_BUILD:-build/L574} |
| 12 | [ -x "$build/sa" ] || { echo 'MISSING_IMPLEMENTATION: run tools/source-aware/build' >&2; exit 69; } |
| 13 | tmp=$(mktemp -d) |
| 14 | trap 'rm -f "$tmp/out"; rmdir "$tmp"' EXIT HUP INT TERM |
| 15 | # The native entry reads through EOF and checks the bounded input before output. |
| 16 | { printf "$mode"; cat; } | "$build/sa" > "$tmp/out" || exit "$?" |
| 17 | cat "$tmp/out" |