Fixed most errors. Now I just need to add a sysData pool.

This commit is contained in:
Pietro Gagliardi 2014-03-01 17:01:28 -05:00
parent 9b4e30ccf9
commit 56eb64429d
4 changed files with 13 additions and 6 deletions

View File

@ -15,6 +15,9 @@ Go wrapper functions (bleh_darwin.go) call these directly and take care of stdin
#include <Foundation/NSGeometry.h> #include <Foundation/NSGeometry.h>
/* exception to the above: cgo doesn't like Nil and delegate_darwin.go has //export so I can't have this there */
Class NilClass = Nil;
/* /*
NSUInteger is listed as being in <objc/NSObjCRuntime.h>... which doesn't exist. Rather than relying on undocumented header file locations or explicitly typedef-ing NSUInteger to the (documented) unsigned long, I'll just place things here for maximum safety. I use uintptr_t as that should encompass every possible unsigned long. NSUInteger is listed as being in <objc/NSObjCRuntime.h>... which doesn't exist. Rather than relying on undocumented header file locations or explicitly typedef-ing NSUInteger to the (documented) unsigned long, I'll just place things here for maximum safety. I use uintptr_t as that should encompass every possible unsigned long.
*/ */

View File

@ -19,8 +19,6 @@ This creates a class goAppDelegate that will be used as the delegate for /everyt
// #include "objc_darwin.h" // #include "objc_darwin.h"
// extern void appDelegate_uitask(id, SEL, id); /* from uitask_darwin.go */ // extern void appDelegate_uitask(id, SEL, id); /* from uitask_darwin.go */
// extern BOOL appDelegate_windowShouldClose(id, SEL, id); // extern BOOL appDelegate_windowShouldClose(id, SEL, id);
// /* because cgo doesn't like Nil */
// static Class NilClass = Nil;
import "C" import "C"
var ( var (
@ -37,9 +35,7 @@ var (
) )
func mkAppDelegate() error { func mkAppDelegate() error {
var appdelegateclass C.Class appdelegateclass, err := makeDelegateClass(_goAppDelegate)
appdelegateclass, err = makeDelegateClass(_goAppDelegate)
if err != nil { if err != nil {
return fmt.Errorf("error creating NSApplication delegate: %v", err) return fmt.Errorf("error creating NSApplication delegate: %v", err)
} }

View File

@ -10,12 +10,19 @@ Furthermore, Objective-C selectors work by basically sending the arguments to ob
The format should be self-explanatory. The format should be self-explanatory.
*/ */
/* for some reason I now have to use an include guard after commit [master 9b4e30c] ("Started to build a single global delegate object; now to fix issues.") */
#ifndef _OBJC_DARWIN_H_
#define _OBJC_DARWIN_H_
#include <objc/message.h> #include <objc/message.h>
#include <objc/objc.h> #include <objc/objc.h>
#include <objc/runtime.h> #include <objc/runtime.h>
#include <stdint.h> #include <stdint.h>
/* for delegate_darwin.go */
extern Class NilClass;
inline id objc_msgSend_noargs(id obj, SEL sel) inline id objc_msgSend_noargs(id obj, SEL sel)
{ {
return objc_msgSend(obj, sel); return objc_msgSend(obj, sel);
@ -77,3 +84,5 @@ m3(sel_id_bool, SEL, id, BOOL)
extern id _objc_msgSend_rect_uint_uint_bool(id obj, SEL sel, int64_t x, int64_t y, int64_t w, int64_t h, uintptr_t b, uintptr_t c, BOOL d); extern id _objc_msgSend_rect_uint_uint_bool(id obj, SEL sel, int64_t x, int64_t y, int64_t w, int64_t h, uintptr_t b, uintptr_t c, BOOL d);
m4(id_sel_id_id, id, SEL, id, id) m4(id_sel_id_id, id, SEL, id, id)
#endif

View File

@ -2,7 +2,6 @@
package ui package ui
import ( import (
"fmt"
"runtime" "runtime"
"unsafe" "unsafe"
) )