omega-harness
Agent skills for operating, encoding and communicating in Omega (.om) and the AIEN repositories
Brought by drakestapleton
omega-harness / examples / p10_profile.om
| 1 | note p10_profile: annotations read by the critical source profile seed/profile/profile.om |
| 2 | note (omega-mv #1063, on main). omc treats them as notes; the profile enforces them: |
| 3 | note "note p10 pure" (no put, pure callees only), "note p10 effect" (host words allowed), |
| 4 | note bounded while (bound <= 8192) and every assigned call result read before it is lost. |
| 5 | global ob uchar 24 |
| 6 | note p10 pure |
| 7 | fn sq v ulong to ulong |
| 8 | ret mul v v |
| 9 | end |
| 10 | note p10 effect |
| 11 | fn outu v ulong to ulong |
| 12 | i = ulong 23 |
| 13 | put ob 23 10 |
| 14 | n = v |
| 15 | while true bound 20 |
| 16 | i = sub i 1 |
| 17 | put ob i uchar add rem n 10 48 |
| 18 | n = div n 10 |
| 19 | if eq n 0 |
| 20 | break |
| 21 | end |
| 22 | end |
| 23 | w = write 1 ob i sub 24 i |
| 24 | if ne w long sub 24 i |
| 25 | ret 1 |
| 26 | end |
| 27 | ret 0 |
| 28 | end |
| 29 | fn main to int |
| 30 | s = ulong 0 |
| 31 | for k ulong 10 |
| 32 | s = add s sq k |
| 33 | end |
| 34 | e = outu s |
| 35 | if ne e 0 |
| 36 | ret 1 |
| 37 | end |
| 38 | ret 0 |
| 39 | end |