Introduce stub Foundation support

This commit is contained in:
Patrick Walton
2012-04-09 16:42:46 -07:00
parent 837254a65e
commit 4ab5011d84
3 changed files with 32 additions and 2 deletions
+8 -2
View File
@@ -13,8 +13,14 @@ native mod objc {
#[test]
fn test_nsapp() {
let klass = str::as_c_str("NSApplication") { |s| objc::objc_getClass(s) };
let sel = str::as_c_str("sharedApplication") { |s| objc::sel_registerName(s) };
let klass = str::as_c_str("NSApplication") { |s|
objc::objc_getClass(s)
};
let sel = str::as_c_str("sharedApplication") { |s|
objc::sel_registerName(s)
};
let nsapp = objc::objc_msgSend(klass, sel);
io::println(#fmt("nsapp: %d", (nsapp as int)));
+1
View File
@@ -11,4 +11,5 @@ use std;
mod appkit;
mod base;
mod foundation;
+23
View File
@@ -0,0 +1,23 @@
import base::objc;
#[nolink]
#[link_args="-framework Foundation"]
native mod foundation {
}
enum NSAutoreleasePool {
NSAutoreleasePool_priv(base::id)
}
fn NSAutoreleasePool() -> base::id {
let klass = str::as_c_str("NSAutoreleasePool") { |s|
objc::objc_getClass(s)
};
let alloc_sel = str::as_c_str("alloc") { |s| objc::sel_registerName(s) };
let init_sel = str::as_c_str("init") { |s| objc::sel_registerName(s) };
let pool = objc::objc_msgSend(klass, alloc_sel);
ret objc::objc_msgSend(pool, init_sel);
}