Complete conversion to pointer wrapped types. Update tests, fix

parameter handling for functions.
This commit is contained in:
gmp
2019-06-13 16:47:36 -04:00
parent ac9eecafd8
commit 79bb282188
12 changed files with 268 additions and 87 deletions
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"fmt"
"unsafe"
"git.wow.st/gmp/nswrap/examples/functions/ns"
)
func main() {
var s ns.Stat
ns.Puts(ns.CharWithGoString("Hi there"))
ret := ns.Fstat(3,&s)
fmt.Printf("Fstat: %d\n",ret)
fmt.Printf("Opening file\n")
f := ns.Fopen(ns.CharWithGoString("nswrap.yaml"),ns.CharWithGoString("r"))
ret = ns.Fstat(3,&s)
fmt.Printf("Fstat: %d\n",ret)
chr := make([]byte,4096)
i := ns.Fread(unsafe.Pointer(&chr[0]), 1, 4096, f)
if i < 4096 {
chr = chr[:i]
}
fmt.Printf("file contents:\n%s\n",string(chr))
}
+17
View File
@@ -0,0 +1,17 @@
inputfiles:
- /usr/include/stdio.h
- /usr/include/stdlib.h
- /usr/include/sys/stat.h
sysimports:
- stdio.h
- stdlib.h
- sys/stat.h
functions:
- sranddev
- cgetclose
- cgetset
- devname
- puts
- fstat
- fopen
- fread