From 8af591388f3bc0295ba196135452e29e845925a8 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 28 Feb 2014 18:30:06 -0500 Subject: Split most of the objc_msgSend() wrappers into a C header file for convenience. The NSRect functions require special handling because of Apple stupidities that will be discussed when I get to that. --- darwintest/runtimetest.go | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'darwintest/runtimetest.go') diff --git a/darwintest/runtimetest.go b/darwintest/runtimetest.go index d3cf3c1..f92e0f8 100644 --- a/darwintest/runtimetest.go +++ b/darwintest/runtimetest.go @@ -9,26 +9,12 @@ import ( // #cgo LDFLAGS: -lobjc -framework Foundation -framework AppKit // #include -// #include -// #include -// #include -// /* TODO // /* cgo doesn't handle ... */ -// id objc_msgSend_noargs(id obj, SEL sel) { return objc_msgSend(obj, sel); } -// id objc_msgSend_strarg(id obj, SEL sel, char *a) { return objc_msgSend(obj, sel, a); } // id objc_msgSend_NSRect_uint_uint_bool(id obj, SEL sel, CGRect a, NSUInteger b, NSUInteger c, BOOL d) { return objc_msgSend(obj, sel, a, b, c, d); } -// id objc_msgSend_id(id obj, SEL sel, id a) { return objc_msgSend(obj, sel, a); } // id objc_msgSend_NSRect(id obj, SEL sel, CGRect a) { return objc_msgSend(obj, sel, a); } -// id objc_msgSend_sel(id obj, SEL sel, SEL a) { return objc_msgSend(obj, sel, a); } -// id objc_msgSend_uint(id obj, SEL sel, NSUInteger a) { return objc_msgSend(obj, sel, a); } -// id objc_msgSend_id_sel_id_id(id obj, SEL sel, id a, SEL b, id c, id d) { return objc_msgSend(obj, sel, a, b, c, d); } -// id objc_msgSend_id_id_id(id obj, SEL sel, id a, id b, id c) { return objc_msgSend(obj, sel, a, b, c); } -// id objc_msgSend_id_id(id obj, SEL sel, id a, id b) { return objc_msgSend(obj, sel, a, b); } -// id objc_msgSend_sel_id_bool(id obj, SEL sel, SEL a, id b, BOOL c) { return objc_msgSend(obj, sel, a, b, c); } // Class NilClass = Nil; /* for newtypes.go */ // id Nilid = nil; import "C" @@ -102,7 +88,7 @@ func notify(source string) { pool := C.objc_msgSend_noargs( objc_getClass("NSAutoreleasePool"), sel_getUid("new")) - src := C.objc_msgSend_strarg( + src := C.objc_msgSend_str( objc_getClass("NSString"), sel_getUid("stringWithUTF8String:"), csource) @@ -178,7 +164,7 @@ func helloworld() { NSString := objc_getClass("NSString") stringWithUTF8String := sel_getUid("stringWithUTF8String:") - str := C.objc_msgSend_strarg(NSString, + str := C.objc_msgSend_str(NSString, stringWithUTF8String, _hello) UTF8String := sel_getUid("UTF8String") -- cgit v1.2.3