sovereign-intelligence
Front door to Drake Stapleton's sovereign stack.
Brought by drakestapleton
sovereign-intelligence / harness / examples / om2_param_slots.om
| 1 | note om2_param_slots: six parameter slots; an unsized view T * or edit T * takes two (pointer, count), every other parameter one |
| 2 | note here 2 unsized views (4 slots) plus 2 scalars fill all six; a sized view uchar 4 would take one slot |
| 3 | om2 |
| 4 | fn f a view uchar * b view uchar * x int y int to int |
| 5 | ret int add add len a len b ulong add x y |
| 6 | end |
| 7 | fn g a view uchar 4 b view uchar 4 c view uchar 4 x int y int z int to int |
| 8 | ret add add x y z |
| 9 | end |
| 10 | fn main to int |
| 11 | a = new uchar 4 0 |
| 12 | b = new uchar 3 0 |
| 13 | c = new uchar 4 0 |
| 14 | d = new uchar 4 0 |
| 15 | r = f a b 1 2 |
| 16 | if ne r 10 |
| 17 | ret 1 |
| 18 | end |
| 19 | s = g a c d 1 2 3 |
| 20 | if ne s 6 |
| 21 | ret 2 |
| 22 | end |
| 23 | ret 0 |
| 24 | end |