Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/qualification/security673/repairs/mutate.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / qualification / security673 / repairs / mutate.om` 138 lines ยท 2527 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note SC1 qualification-only exact-source mutations for corrected authority gates. 3 note Modes 0 read-before-lock, 1 trailing record accepted, 2 unlink error hidden, 3 close omitted. 4 note Refuse unexpected source multiplicity before emitting any artifact. Never a production compiler. 5 global src uchar 262144 6 global arg uchar 8 7 global nd uchar 512 8 global rp uchar 512 9 global lens ulong 3 10 text n0 "err = lacq get dpid 0 1000\nif ne err 0\nret 80\nend\nerr = readrec r\nif ne err 0\nlk = lrel\nret 70\nend\n" 11 text r0 "err = readrec r\nif ne err 0\nret 70\nend\nerr = lacq get dpid 0 1000\nif ne err 0\nret 80\nend\n" 12 text n1 "if or ne n 256 ne extra 0\n" 13 text r1 "if ne n 256\n" 14 text n2 "fn lrm to ulong\nr = unlink lpath 0 len lpath\nif lt r 0\nret 41\n" 15 text r2 "fn lrm to ulong\nr = unlink lpath 0 len lpath\nif lt r 0\nret 0\n" 16 text n3 "cleanup = cfclose int fd\n" 17 fn setup m uchar to void 18 put lens 2 1 19 if eq m 48 20 put lens 0 len n0 21 put lens 1 len r0 22 for i ulong len n0 23 put nd i get n0 i 24 end 25 for i ulong len r0 26 put rp i get r0 i 27 end 28 end 29 if eq m 49 30 put lens 0 len n1 31 put lens 1 len r1 32 for i ulong len n1 33 put nd i get n1 i 34 end 35 for i ulong len r1 36 put rp i get r1 i 37 end 38 end 39 if eq m 50 40 put lens 0 len n2 41 put lens 1 len r2 42 for i ulong len n2 43 put nd i get n2 i 44 end 45 for i ulong len r2 46 put rp i get r2 i 47 end 48 end 49 if eq m 51 50 put lens 0 len n3 51 put lens 1 0 52 put lens 2 4 53 for i ulong len n3 54 put nd i get n3 i 55 end 56 end 57 end 58 fn matches pos ulong to bool 59 for j ulong get lens 0 60 if ne get src add pos j get nd j 61 ret false 62 end 63 end 64 ret true 65 end 66 fn emit pos ulong size ulong replflag bool to void 67 p = ulong 0 68 while lt p size 69 n = long 0 70 if replflag 71 n = write 1 rp p sub size p 72 else 73 n = write 1 src add pos p sub size p 74 end 75 if le n 0 76 exit 94 77 end 78 p = add p ulong n 79 end 80 end 81 fn main to int 82 if ne argcnt 2 83 ret 90 84 end 85 if ne argread 1 arg 0 len arg 1 86 ret 90 87 end 88 m = get arg 0 89 if or lt m 48 gt m 51 90 ret 90 91 end 92 setup m 93 used = ulong 0 94 go = true 95 while go 96 if eq used len src 97 ret 91 98 end 99 n = read 0 src used sub len src used 100 if lt n 0 101 ret 92 102 end 103 if eq n 0 104 go = false 105 else 106 used = add used ulong n 107 end 108 end 109 count = ulong 0 110 for i ulong used 111 if le get lens 0 sub used i 112 if matches i 113 count = add count 1 114 end 115 end 116 end 117 if ne count get lens 2 118 ret 93 119 end 120 pos = ulong 0 121 start = ulong 0 122 while lt pos used 123 hit = false 124 if le get lens 0 sub used pos 125 hit = matches pos 126 end 127 if hit 128 emit start sub pos start false 129 emit 0 get lens 1 true 130 pos = add pos get lens 0 131 start = pos 132 else 133 pos = add pos 1 134 end 135 end 136 emit start sub used start false 137 ret 0 138 end