Return Golang bools from Objective-C functions that return BOOL.

Move nswrap command to cmd/nswrap.
This commit is contained in:
gmp
2019-05-06 09:00:38 -04:00
parent 717c7e76fe
commit 959b87342e
3 changed files with 22 additions and 4 deletions
+9 -1
View File
@@ -350,7 +350,12 @@ func GoToC(name string, pnames []string, rtype *Type, ptypes []*Type) string {
if IsGoInterface(rtgt) {
rtgt = "*Id"
}
ret.WriteString("return (" + rtgt + ")(")
if rtgt == "BOOL" {
ret.WriteString("return (")
rtgt = "bool"
} else {
ret.WriteString("return (" + rtgt + ")(")
}
if rtype.IsPointer() {
ret.WriteString("unsafe.Pointer(")
}
@@ -382,6 +387,9 @@ func GoToC(name string, pnames []string, rtype *Type, ptypes []*Type) string {
ret.WriteString(")")
}
}
if rt == "BOOL" {
ret.WriteString(" != 0")
}
return ret.String()
}