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/omc/tests/float/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 / omc / tests / float / mutate.om` 126 lines ยท 1979 bytes Raw Blame History 1 note Qualification-only exact-once source substitutions; argv1: 0 FMSUB, 1 unfused, 2 note 2 lost decimal remainder, 3 ties down. Refuse absent/duplicate sites. Never a production compiler. 3 global src uchar `1048576` 4 global needle uchar 256 5 global repl uchar 256 6 global used ulong 1 7 global rlen ulong 1 8 global arg uchar 8 9 text n0 "emit or b vd" 10 text r0 "emit or xor b 32768 vd" 11 text n1 "emit or b vd" 12 text r1 "fp_binop 35 at va vb vd\nfp_binop 33 at vd vc vd" 13 text n2 "put fg_stk 0 fbmul 0 1" 14 text r2 "put fg_stk 0 0" 15 text n3 "if or ne sticky 0 eq and q 1 1" 16 text r3 "if ne sticky 0" 17 fn matches i ulong to bool 18 for j ulong get used 0 19 if ne get src add i j get needle j 20 ret false 21 end 22 end 23 ret true 24 end 25 fn srcout p ulong n ulong to void 26 while lt p n 27 r = write 1 src p sub n p 28 if le r 0 29 exit 94 30 end 31 p = add p ulong r 32 end 33 end 34 fn main to int 35 if ne argcnt 2 36 ret 90 37 end 38 r = argread 1 arg 0 len arg 39 if ne r 1 40 ret 90 41 end 42 m = get arg 0 43 if or lt m 48 gt m 51 44 ret 90 45 end 46 if eq m 48 47 put used 0 len n0 48 put rlen 0 len r0 49 for i ulong len n0 50 put needle i get n0 i 51 end 52 for i ulong len r0 53 put repl i get r0 i 54 end 55 end 56 if eq m 49 57 put used 0 len n1 58 put rlen 0 len r1 59 for i ulong len n1 60 put needle i get n1 i 61 end 62 for i ulong len r1 63 put repl i get r1 i 64 end 65 end 66 if eq m 50 67 put used 0 len n2 68 put rlen 0 len r2 69 for i ulong len n2 70 put needle i get n2 i 71 end 72 for i ulong len r2 73 put repl i get r2 i 74 end 75 end 76 if eq m 51 77 put used 0 len n3 78 put rlen 0 len r3 79 for i ulong len n3 80 put needle i get n3 i 81 end 82 for i ulong len r3 83 put repl i get r3 i 84 end 85 end 86 n = ulong 0 87 go = true 88 while go 89 if eq n len src 90 ret 91 91 end 92 r = read 0 src n sub len src n 93 if lt r 0 94 ret 92 95 end 96 if eq r 0 97 go = false 98 else 99 n = add n ulong r 100 end 101 end 102 found = ulong 0 103 at = ulong 0 104 for i ulong n 105 if le get used 0 sub n i 106 if matches i 107 found = add found 1 108 at = i 109 end 110 end 111 end 112 if ne found 1 113 ret 93 114 end 115 srcout 0 at 116 p = ulong 0 117 while lt p get rlen 0 118 r = write 1 repl p sub get rlen 0 p 119 if le r 0 120 ret 94 121 end 122 p = add p ulong r 123 end 124 srcout add at get used 0 n 125 ret 0 126 end