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 / aienux / allen / tests / look-paint.om
| 1 | note tests/look-paint.om: prints the drawing kit's values in the same order as the C harness |
| 2 | note (~/work/IMacLook/paint/ptest.c over aienux 4b24df65 paint.c); the two outputs must cmp equal. |
| 3 | note Unit: font-data.om font.om look-paint.om tio.om tests/look-paint.om. |
| 4 | global Tcs ulong 12 |
| 5 | fn tdump to void |
| 6 | for i ulong 3072 |
| 7 | tu ulong get Nfrm i |
| 8 | tnl |
| 9 | end |
| 10 | end |
| 11 | fn tword pen ulong y long c uchar color ulong a ulong plus bool to ulong |
| 12 | pen = pkletter pen y c color a plus |
| 13 | tu pen |
| 14 | tnl |
| 15 | ret pen |
| 16 | end |
| 17 | fn tblend to void |
| 18 | put Tcs 0 0 |
| 19 | put Tcs 1 1052688 |
| 20 | put Tcs 2 1193046 |
| 21 | put Tcs 3 16777215 |
| 22 | put Tcs 4 13158655 |
| 23 | put Tcs 5 4227327 |
| 24 | put Tcs 6 16711680 |
| 25 | put Tcs 7 65280 |
| 26 | put Tcs 8 255 |
| 27 | put Tcs 9 8355711 |
| 28 | put Tcs 10 66051 |
| 29 | put Tcs 11 16711422 |
| 30 | for i ulong 12 |
| 31 | for j ulong 12 |
| 32 | a = ulong 0 |
| 33 | while le a 256 |
| 34 | tu pkadd get Tcs i get Tcs j a |
| 35 | tc 32 |
| 36 | tu pkmix get Tcs i get Tcs j a |
| 37 | tc 32 |
| 38 | tu pkscale get Tcs i a |
| 39 | tnl |
| 40 | a = add a 19 |
| 41 | end |
| 42 | end |
| 43 | end |
| 44 | for i ulong 12 |
| 45 | j = rem add i 1 12 |
| 46 | tu pkadd get Tcs i get Tcs j 256 |
| 47 | tc 32 |
| 48 | tu pkmix get Tcs i get Tcs j 256 |
| 49 | tc 32 |
| 50 | tu pkscale get Tcs i 256 |
| 51 | tnl |
| 52 | end |
| 53 | end |
| 54 | fn tthread x0 long y0 long x1 long y1 long color ulong w long to void |
| 55 | put Pa 0 w |
| 56 | pkthread x0 y0 x1 y1 color 0 |
| 57 | end |
| 58 | fn tshapes to void |
| 59 | for i ulong 3072 |
| 60 | put Nfrm i 1052688 |
| 61 | end |
| 62 | pkclip 0 0 64 48 |
| 63 | pkglow 500 400 300 13158655 200 |
| 64 | pkglow -40 700 160 16777215 256 |
| 65 | put Pa 1 200 |
| 66 | put Pa 2 60 |
| 67 | tthread 30 40 900 600 16762368 16 |
| 68 | put Pa 1 30 |
| 69 | put Pa 2 255 |
| 70 | tthread 800 20 100 700 4227327 40 |
| 71 | put Pa 1 255 |
| 72 | put Pa 2 255 |
| 73 | tthread 100 100 110 700 16777215 24 |
| 74 | put Pa 1 0 |
| 75 | put Pa 2 256 |
| 76 | tthread 50 650 950 660 16746496 8 |
| 77 | put Pa 1 100 |
| 78 | put Pa 2 100 |
| 79 | tthread 300 300 300 300 16777215 16 |
| 80 | tthread 300 300 500 500 16777215 0 |
| 81 | put Pa 1 256 |
| 82 | put Pa 2 0 |
| 83 | tthread -200 -100 1200 900 8454016 50 |
| 84 | pkclip 10 5 30 30 |
| 85 | pkglow 300 300 400 16711680 128 |
| 86 | pkclip -5 -5 20 20 |
| 87 | put Pa 1 200 |
| 88 | put Pa 2 200 |
| 89 | tthread 0 0 500 120 16777215 12 |
| 90 | tdump |
| 91 | end |
| 92 | fn trrect to void |
| 93 | put Lg 9 6 |
| 94 | for j ulong 48 |
| 95 | for i ulong 64 |
| 96 | tl pksdrrect long i long j 8 6 40 30 |
| 97 | tc 32 |
| 98 | end |
| 99 | tnl |
| 100 | end |
| 101 | put Lg 9 0 |
| 102 | for j ulong 48 |
| 103 | for i ulong 64 |
| 104 | tl pksdrrect long i long j -3 10 70 15 |
| 105 | tc 32 |
| 106 | end |
| 107 | tnl |
| 108 | end |
| 109 | end |
| 110 | fn tletters to void |
| 111 | if not afinit 14 1250 |
| 112 | trap 9 |
| 113 | end |
| 114 | for i ulong 3072 |
| 115 | if eq and i 1 1 |
| 116 | put Nfrm i 2105408 |
| 117 | else |
| 118 | put Nfrm i 0 |
| 119 | end |
| 120 | end |
| 121 | pkclip 0 0 64 48 |
| 122 | pen = ulong 868 |
| 123 | pen = tword pen 20 65 16769184 230 false |
| 124 | pen = tword pen 20 103 16769184 230 false |
| 125 | pen = tword pen 20 63 16769184 230 false |
| 126 | pen = tword pen 20 106 16769184 230 false |
| 127 | pen = tword pen 20 32 16769184 230 false |
| 128 | pen = tword pen 20 44 16769184 230 false |
| 129 | pen = tword pen 20 87 16769184 230 false |
| 130 | pen = 256 |
| 131 | pen = tword pen 38 105 8438015 256 true |
| 132 | pen = tword pen 38 77 8438015 256 true |
| 133 | pen = tword pen 38 97 8438015 256 true |
| 134 | pen = tword pen 38 99 8438015 256 true |
| 135 | pkclip 10 5 30 30 |
| 136 | pen = 256 |
| 137 | pen = tword pen 30 88 16728128 120 true |
| 138 | pen = tword pen 30 121 16728128 120 true |
| 139 | pkclip 0 0 64 48 |
| 140 | pen = 256 |
| 141 | pen = tword pen 30 81 16728128 0 false |
| 142 | tdump |
| 143 | end |
| 144 | fn main to int |
| 145 | pkinit |
| 146 | for i ulong 677 |
| 147 | a = mul i 97 |
| 148 | tl pksin a |
| 149 | tc 32 |
| 150 | tl pkcos a |
| 151 | tnl |
| 152 | end |
| 153 | y = long -50000 |
| 154 | while le y 50000 |
| 155 | x = long -50000 |
| 156 | while le x 50000 |
| 157 | tu pkatan2 y x |
| 158 | tnl |
| 159 | x = add x 3331 |
| 160 | end |
| 161 | y = add y 2917 |
| 162 | end |
| 163 | tu pkatan2 3 0 |
| 164 | tnl |
| 165 | tu pkatan2 -7 0 |
| 166 | tnl |
| 167 | for i ulong 600 |
| 168 | tu pkexpneg mul i 7 |
| 169 | tnl |
| 170 | end |
| 171 | for i ulong 257 |
| 172 | tu get Plog i |
| 173 | tnl |
| 174 | end |
| 175 | v = ulong 1 |
| 176 | while lt v 4611686018427387904 |
| 177 | tu pklog2q16 v |
| 178 | tc 32 |
| 179 | tu pkisqrt v |
| 180 | tnl |
| 181 | v = add mul v 3 1 |
| 182 | end |
| 183 | tu pklog2q16 0 |
| 184 | tc 32 |
| 185 | tu pkisqrt 0 |
| 186 | tnl |
| 187 | y = long -2000 |
| 188 | while le y 2000 |
| 189 | x = long -3000 |
| 190 | while le x 3000 |
| 191 | tu pkhash x y 909 |
| 192 | tc 32 |
| 193 | tu pknoise x y 909 |
| 194 | tc 32 |
| 195 | tu pkfbm x y 909 4 |
| 196 | tnl |
| 197 | x = add x 413 |
| 198 | end |
| 199 | y = add y 377 |
| 200 | end |
| 201 | t = long -20 |
| 202 | while le t 280 |
| 203 | tu pksmooth t |
| 204 | tc 32 |
| 205 | tu pkeaseout t |
| 206 | tc 32 |
| 207 | tl pkprog ulong add 1000 t 990 1200 |
| 208 | tnl |
| 209 | t = add t 7 |
| 210 | end |
| 211 | tl pkprog 5 9 20 |
| 212 | tc 32 |
| 213 | tl pkprog 50 9 20 |
| 214 | tc 32 |
| 215 | tl pkprog 20 9 20 |
| 216 | tnl |
| 217 | t = long -40 |
| 218 | while le t 40 |
| 219 | tu pkcover t |
| 220 | tnl |
| 221 | t = add t 3 |
| 222 | end |
| 223 | l = ulong 0 |
| 224 | while lt l 40000 |
| 225 | tu pklenc l |
| 226 | tnl |
| 227 | l = add l 61 |
| 228 | end |
| 229 | for i ulong 256 |
| 230 | tu ulong get Slin i |
| 231 | tc 32 |
| 232 | tu ulong get Ssrgb add mul i 16 1 |
| 233 | tnl |
| 234 | end |
| 235 | tblend |
| 236 | put Lg 0 64 |
| 237 | put Lg 1 48 |
| 238 | tshapes |
| 239 | trrect |
| 240 | tletters |
| 241 | tflush |
| 242 | ret 0 |
| 243 | end |