omega-bridge
Omega-first language interoperability: checked conversion backends and native language bindings
Brought by drakestapleton
omega-bridge / evidence / native-bindings / omega_native.go
| 1 | // Generated by omega-bridge src/native.om: native call ABI v1 (docs/NATIVE-ABI.md). |
| 2 | // cgo package omeganative: this file, omega_native.h and libomega_native.so in one folder. Regenerate it; |
| 3 | // do not edit it. No run-time path is baked in: the program's build names the folder (CGO_LDFLAGS set to |
| 4 | // -Wl,-rpath,<folder>), or LD_LIBRARY_PATH does. |
| 5 | // Status: 0 done; 1..14 the Omega trap code; 32 argument refused (nil, wrong length, misaligned, |
| 6 | // overlap); 33 reentry; 34 bad runtime entry; 35 no stack. The result is written only on status 0. |
| 7 | // A long is its two's-complement bits (an int64 as uint64); an array is an unsafe.Pointer to memory |
| 8 | // holding no Go pointers, then its element count. |
| 9 | package omeganative |
| 10 | |
| 11 | /* |
| 12 | #cgo CFLAGS: -I${SRCDIR} |
| 13 | #cgo LDFLAGS: -L${SRCDIR} -lomega_native |
| 14 | #include "omega_native.h" |
| 15 | */ |
| 16 | import "C" |
| 17 | |
| 18 | import "unsafe" |
| 19 | |
| 20 | const ( |
| 21 | OmegaOK uint32 = 0 |
| 22 | OmegaBadArg uint32 = 32 |
| 23 | OmegaReentry uint32 = 33 |
| 24 | OmegaBadRt uint32 = 34 |
| 25 | OmegaNoStack uint32 = 35 |
| 26 | ) |
| 27 | |
| 28 | // fn madd a ulong b ulong c ulong to ulong |
| 29 | func Omega_madd(result *uint64, o_a uint64, o_b uint64, o_c uint64) uint32 { |
| 30 | return uint32(C.omega_madd((*C.uint64_t)(unsafe.Pointer(result)), C.uint64_t(o_a), C.uint64_t(o_b), C.uint64_t(o_c))) |
| 31 | } |
| 32 | |
| 33 | // fn smadd a long b long c long to long |
| 34 | func Omega_smadd(result *uint64, o_a uint64, o_b uint64, o_c uint64) uint32 { |
| 35 | return uint32(C.omega_smadd((*C.uint64_t)(unsafe.Pointer(result)), C.uint64_t(o_a), C.uint64_t(o_b), C.uint64_t(o_c))) |
| 36 | } |
| 37 | |
| 38 | // fn fill buf edit ulong 4 k ulong to ulong |
| 39 | func Omega_fill(result *uint64, o_buf unsafe.Pointer, o_buf_len uint64, o_k uint64) uint32 { |
| 40 | return uint32(C.omega_fill((*C.uint64_t)(unsafe.Pointer(result)), o_buf, C.uint64_t(o_buf_len), C.uint64_t(o_k))) |
| 41 | } |
| 42 | |
| 43 | // fn spin n ulong to ulong |
| 44 | func Omega_spin(result *uint64, o_n uint64) uint32 { |
| 45 | return uint32(C.omega_spin((*C.uint64_t)(unsafe.Pointer(result)), C.uint64_t(o_n))) |
| 46 | } |
| 47 | |
| 48 | // fn mix a ulong b long c view uchar 3 d edit uchar 2 e view ulong 2 f ulong to void |
| 49 | func Omega_mix(result *uint64, o_a uint64, o_b uint64, o_c unsafe.Pointer, o_c_len uint64, o_d unsafe.Pointer, o_d_len uint64, o_e unsafe.Pointer, o_e_len uint64, o_f uint64) uint32 { |
| 50 | return uint32(C.omega_mix((*C.uint64_t)(unsafe.Pointer(result)), C.uint64_t(o_a), C.uint64_t(o_b), o_c, C.uint64_t(o_c_len), o_d, C.uint64_t(o_d_len), o_e, C.uint64_t(o_e_len), C.uint64_t(o_f))) |
| 51 | } |
| 52 | |
| 53 | // fn big n ulong to ulong |
| 54 | func Omega_big(result *uint64, o_n uint64) uint32 { |
| 55 | return uint32(C.omega_big((*C.uint64_t)(unsafe.Pointer(result)), C.uint64_t(o_n))) |
| 56 | } |