omega-bridge
Omega-first language interoperability: checked conversion backends and native language bindings
Brought by drakestapleton
omega-bridge / tests / native / g1 / caller.go
| 1 | // Go caller for the G1 sample calc: reads "i0 i1" lines, prints "i0 i1 status result" per line. |
| 2 | // Every Omega declaration comes from the generated omeganative package; this file has no cgo. |
| 3 | package main |
| 4 | |
| 5 | import ( |
| 6 | "bufio" |
| 7 | "fmt" |
| 8 | "os" |
| 9 | |
| 10 | on "omegacaller/omeganative" |
| 11 | ) |
| 12 | |
| 13 | func main() { |
| 14 | sc := bufio.NewScanner(os.Stdin) |
| 15 | for sc.Scan() { |
| 16 | var a, b uint64 |
| 17 | if _, err := fmt.Sscan(sc.Text(), &a, &b); err != nil { |
| 18 | fmt.Fprintln(os.Stderr, err) |
| 19 | os.Exit(2) |
| 20 | } |
| 21 | var r uint64 |
| 22 | s := on.Omega_calc(&r, a, b) |
| 23 | fmt.Println(a, b, s, r) |
| 24 | } |
| 25 | } |