Change name of New* functions to *Alloc to mimic Objective-C's
nested alloc/init call idiom.
This commit is contained in:
parent
eced251710
commit
717c7e76fe
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,7 +1,6 @@
|
||||||
clast
|
clast
|
||||||
ast.txt
|
ast.txt
|
||||||
*.ast
|
*.ast
|
||||||
program
|
|
||||||
examples/bluetooth/bluetooth
|
examples/bluetooth/bluetooth
|
||||||
examples/bluetooth/ble/main.go
|
examples/bluetooth/ble/main.go
|
||||||
examples/foundation/foundation
|
examples/foundation/foundation
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cd := ble.NewBle_delegate().Init()
|
cd := ble.Ble_delegateAlloc().Init()
|
||||||
fmt.Println("LE capable:",cd.IsLECapableHardware())
|
fmt.Println("LE capable:",cd.IsLECapableHardware())
|
||||||
time.Sleep(time.Second * 1)
|
time.Sleep(time.Second * 1)
|
||||||
fmt.Println("LE capable:",cd.IsLECapableHardware())
|
fmt.Println("LE capable:",cd.IsLECapableHardware())
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
#import <CoreBluetooth/CoreBluetooth.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char* argv[]) {
|
|
||||||
CBCentralManager *m;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -745,14 +745,14 @@ func (w *Wrapper) Wrap(toproc []string) {
|
||||||
i.Name, len(i.Properties), len(i.Methods))
|
i.Name, len(i.Properties), len(i.Methods))
|
||||||
|
|
||||||
w.goCode.WriteString(fmt.Sprintf(`
|
w.goCode.WriteString(fmt.Sprintf(`
|
||||||
func New%s() *%s {
|
func %sAlloc() *%s {
|
||||||
return (*%s)(unsafe.Pointer(C.New%s()))
|
return (*%s)(unsafe.Pointer(C.%sAlloc()))
|
||||||
}
|
}
|
||||||
`,i.GoName,i.GoName,i.GoName,i.Name))
|
`,i.GoName,i.GoName,i.GoName,i.Name))
|
||||||
|
|
||||||
w.cCode.WriteString(fmt.Sprintf(`
|
w.cCode.WriteString(fmt.Sprintf(`
|
||||||
%s*
|
%s*
|
||||||
New%s() {
|
%sAlloc() {
|
||||||
return [%s alloc];
|
return [%s alloc];
|
||||||
}
|
}
|
||||||
`, i.Name, i.Name, i.Name))
|
`, i.Name, i.Name, i.Name))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user