Comprehensive update, add some GC fixes, update examples to new MacOS

header file layout.
This commit is contained in:
gmp
2020-06-24 13:03:53 -04:00
parent acc8cab583
commit 8b3a956bbe
26 changed files with 9729 additions and 354 deletions
+8 -9
View File
@@ -2,25 +2,24 @@ package main
import (
"fmt"
"unsafe"
"git.wow.st/gmp/nswrap/examples/functions/ns"
"unsafe"
)
func main() {
var s ns.Stat
ns.Puts(ns.CharWithGoString("Hi there"))
ret := ns.Fstat(3,&s)
fmt.Printf("Fstat: %d\n",ret)
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)
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))
fmt.Printf("file contents:\n%s\n", string(chr))
}
+3 -3
View File
@@ -1,7 +1,7 @@
inputfiles:
- /usr/include/stdio.h
- /usr/include/stdlib.h
- /usr/include/sys/stat.h
- /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h
- /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h
- /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stat.h
sysimports:
- stdio.h
- stdlib.h