Delete commented-out code

This commit is contained in:
Patrick Walton 2012-07-12 13:03:28 -07:00
parent 844f540963
commit 62396c1cb9

View file

@ -72,7 +72,6 @@ fn mainloop(po: port<Msg>) {
Draw(sender, dt) {
return_surface(surfaces, dt);
lend_surface(surfaces, sender);
//assert surfaces.s1.surf.az_target == dt;
let mut image_data;
unsafe {
@ -209,135 +208,3 @@ mod platform {
}
}
/*
#[cfg(target_os = "macos")]
mod platform {
use cocoa;
import cocoa::base::*;
mod NSApplication {
fn sharedApplication() -> id {
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);
#debug("nsapp: %d", (nsapp as int));
ret nsapp;
}
}
mod NSAutoreleasePool {
fn alloc() -> id {
let klass = str::as_c_str("NSAutoreleasePool", |s| objc::objc_getClass(s));
let sel = str::as_c_str("alloc", |s| objc::sel_registerName(s));
let pool = objc::objc_msgSend(klass, sel);
#debug("autorelease pool: %?", pool);
ret pool;
}
fn init(pool: id) {
let sel = str::as_c_str("init", |s| objc::sel_registerName(s));
objc::objc_msgSend(pool, sel);
}
fn release(pool: id) {
let sel = str::as_c_str("release", |s| objc::sel_registerName(s));
objc::objc_msgSend(pool, sel);
}
}
mod NSApp {
fn setDelegate(nsapp: id, main: id) {
#debug("NSApp::setDelegate");
let sel = str::as_c_str("setDelegate:", |s| objc::sel_registerName(s));
cocoa::msgSend1Id(nsapp, sel, main);
}
fn run(nsapp: id) {
#debug("NSApp::run");
let sel = str::as_c_str("run", |s| objc::sel_registerName(s));
objc::objc_msgSend(nsapp, sel);
}
}
mod MainObj {
extern fn applicationDidFinishLaunching(this: id, _sel: SEL) {
#debug("applicationDidFinishLaunching");
let fptr: *fn() = ptr::null();
str::as_c_str("fptr", |name| {
let outValue = unsafe { unsafe::reinterpret_cast(ptr::addr_of(fptr)) };
#debug("*fptr %?", outValue);
objc::object_getInstanceVariable(this, name, outValue)
});
#debug("getting osmain fptr: %?", fptr);
unsafe {
// FIXME: We probably don't want to run the main routine in a foreign function
(*fptr)();
}
}
fn create(f: fn()) -> id {
let NSObject = str::as_c_str("NSObject", |s| objc::objc_getClass(s));
let MainObj = str::as_c_str("MainObj", |s| {
objc::objc_allocateClassPair(NSObject, s, 0 as libc::size_t)
});
// Add a field to our class to contain a pointer to a rust closure
let res = str::as_c_str("fptr", |name| {
str::as_c_str("^i", |types| {
objc::class_addIvar(MainObj, name,
sys::size_of::<libc::uintptr_t>() as libc::size_t,
16u8, types)
})
});
assert res == true;
let launchfn = str::as_c_str("applicationDidFinishLaunching:", |s| {
objc::sel_registerName(s)
});
let _ = str::as_c_str("@@:", |types| {
objc::class_addMethod(MainObj, launchfn, applicationDidFinishLaunching, types)
});
objc::objc_registerClassPair(MainObj);
let sel = str::as_c_str("alloc", |s| objc::sel_registerName(s));
let mainobj = objc::objc_msgSend(MainObj, sel);
let sel = str::as_c_str("init", |s| objc::sel_registerName(s));
objc::objc_msgSend(mainobj, sel);
let fptr = ptr::addr_of(f);
str::as_c_str("fptr", |name| {
#debug("setting osmain fptr: %?", fptr);
let value = unsafe { unsafe::reinterpret_cast(fptr) };
#debug("*fptr: %?", value);
objc::object_setInstanceVariable(mainobj, name, value)
});
ret mainobj;
}
fn release(mainobj: id) {
let sel = str::as_c_str("release", |s| objc::sel_registerName(s));
objc::objc_msgSend(mainobj, sel);
}
}
fn runmain(f: fn()) {
let pool = NSAutoreleasePool::alloc();
NSAutoreleasePool::init(pool);
let NSApp = NSApplication::sharedApplication();
let mainobj = MainObj::create(f);
NSApp::setDelegate(NSApp, mainobj);
NSApp::run(NSApp);
MainObj::release(mainobj);
NSAutoreleasePool::release(pool);
}
}
*/