Initial commit

This commit is contained in:
Patrick Walton
2012-03-27 15:43:50 -07:00
commit a39122e026
3 changed files with 42 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
#[nolink]
#[link_args="-framework AppKit"]
native mod appkit {
fn NSBeep();
}
+22
View File
@@ -0,0 +1,22 @@
use std;
type id = libc::intptr_t;
type SEL = libc::intptr_t;
const nil : id = 0 as id;
native mod objc {
fn objc_getClass(name : *libc::c_char) -> id;
fn objc_msgSend(theReceiver : id, theSelector : SEL) -> id;
fn sel_registerName(name : *libc::c_char) -> SEL;
}
#[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 nsapp = objc::objc_msgSend(klass, sel);
io::println(#fmt("nsapp: %d", (nsapp as int)));
}
+14
View File
@@ -0,0 +1,14 @@
#[link(name = "cocoa",
vers = "0.1",
uuid = "5b7b7262-780d-465d-892c-15eab956dedc",
url = "http://github.com/pcwalton/cocoa")];
#[comment = "The Servo Parallel Browser Project"];
#[license = "MIT"];
#[crate_type = "lib"];
use std;
mod appkit;
mod base;