summaryrefslogtreecommitdiff
path: root/darwintest/newtypes.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-01 22:40:14 -0500
committerPietro Gagliardi <[email protected]>2014-03-01 22:40:14 -0500
commit3e44abc1b862d778c5b0ae01c353fd2c713ca359 (patch)
treee03506987fd65b7fed3bf0005130dff5a1dcbac5 /darwintest/newtypes.go
parent4599e0d25ea304bd78f87bc87265a2eedf9a7999 (diff)
Now that we have everything up to and including Buttons up and running, we no longer need the darwintest.
Diffstat (limited to 'darwintest/newtypes.go')
-rw-r--r--darwintest/newtypes.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/darwintest/newtypes.go b/darwintest/newtypes.go
deleted file mode 100644
index 97c1d82..0000000
--- a/darwintest/newtypes.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// 27 february 2014
-package main
-
-import (
- "unsafe"
-)
-
-// #cgo LDFLAGS: -lobjc -framework Foundation
-// #include <stdlib.h>
-// #include "objc_darwin.h"
-// /* because cgo doesn't like Nil */
-// Class NilClass = Nil;
-import "C"
-
-var (
- _NSObject_Class = C.object_getClass(_NSObject)
-)
-
-func newClass(name string) C.Class {
- cname := C.CString(name)
- defer C.free(unsafe.Pointer(cname))
-
- c := C.objc_allocateClassPair(_NSObject_Class, cname, 0)
- if c == C.NilClass {
- panic("unable to create Objective-C class " + name)
- }
- C.objc_registerClassPair(c)
- return c
-}
-
-// according to errors spit out by cgo, C function pointers are unsafe.Pointer
-func addDelegateMethod(class C.Class, sel C.SEL, imp unsafe.Pointer) {
- // maps to void (*)(id, SEL, id)
- ty := []C.char{'v', '@', ':', '@', 0}
-
- // clas methods get stored in the metaclass; the objc_allocateClassPair() docs say this will work
- // metaclass := C.object_getClass(C.id(unsafe.Pointer(class)))
- // we're adding instance methods, so just class will do
- ok := C.class_addMethod(class,
- sel,
- C.IMP(imp),
- &ty[0])
- if ok == C.BOOL(C.NO) {
- panic("unable to add ourMethod")
- }
-}