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 / rung1 / mklabelled.sh
| 1 | #!/bin/sh |
| 2 | # mklabelled.sh <hex1.hex> -- CHECK INPUT ONLY. Writes a copy of hex1.hex where every branch's |
| 3 | # hand-counted distance is wiped (imm19 field set to 0) and replaced by a label mark '@c', with ':c' |
| 4 | # placed before each target. hex1 must turn that copy back into exactly hex1.bin: then hex1's own label |
| 5 | # arithmetic and my hand-counted distances agree on all 50 branches. It never makes a byte of seed/. |
| 6 | awk 'BEGIN { L="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" } |
| 7 | { line[NR]=$0 } |
| 8 | /# \[[0-9]+\].*-> \[[0-9]+\]/ { match($0,/-> \[[0-9]+\]/); t=substr($0,RSTART+4,RLENGTH-5)+0; if (!(t in lab)) lab[t]=substr(L,++nl,1) } |
| 9 | END { for (n=1;n<=NR;n++) { s=line[n] |
| 10 | if (match(s,/# \[[0-9]+\]/)) { i=substr(s,RSTART+3,RLENGTH-4)+0; if (i in lab) print ":" lab[i] } |
| 11 | if (s ~ /-> \[[0-9]+\]/) { match(s,/-> \[[0-9]+\]/); t=substr(s,RSTART+4,RLENGTH-5)+0 |
| 12 | w=strtonum("0x" substr(s,1,8)); w=and(w, 0xFF00001F); s=sprintf("%08x@%s", w, lab[t]) substr(s,9) } |
| 13 | print s } }' "$1" |