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
|
||||
ast.txt
|
||||
*.ast
|
||||
program
|
||||
examples/bluetooth/bluetooth
|
||||
examples/bluetooth/ble/main.go
|
||||
examples/foundation/foundation
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
cd := ble.NewBle_delegate().Init()
|
||||
cd := ble.Ble_delegateAlloc().Init()
|
||||
fmt.Println("LE capable:",cd.IsLECapableHardware())
|
||||
time.Sleep(time.Second * 1)
|
||||
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))
|
||||
|
||||
w.goCode.WriteString(fmt.Sprintf(`
|
||||
func New%s() *%s {
|
||||
return (*%s)(unsafe.Pointer(C.New%s()))
|
||||
func %sAlloc() *%s {
|
||||
return (*%s)(unsafe.Pointer(C.%sAlloc()))
|
||||
}
|
||||
`,i.GoName,i.GoName,i.GoName,i.Name))
|
||||
|
||||
w.cCode.WriteString(fmt.Sprintf(`
|
||||
%s*
|
||||
New%s() {
|
||||
%sAlloc() {
|
||||
return [%s alloc];
|
||||
}
|
||||
`, i.Name, i.Name, i.Name))
|
||||
|
|
Loading…
Reference in New Issue
Block a user