diff --git a/Makefile.in b/Makefile.in index dc8b5cc..63a4e08 100644 --- a/Makefile.in +++ b/Makefile.in @@ -12,7 +12,7 @@ RUST_SRC = $(shell find $(VPATH)/. -type f -name '*.rs') all: libcocoa.dummy libcocoa.dummy: cocoa.rc $(RUST_SRC) libmsgsend.a - $(RUSTC) $(RUSTFLAGS) $< -o $@ + $(RUSTC) $(RUSTFLAGS) $< touch $@ cocoa-test: cocoa.rc $(RUST_SRC) libmsgsend.a diff --git a/base.rs b/base.rs index bb13bf3..db59f43 100644 --- a/base.rs +++ b/base.rs @@ -44,22 +44,22 @@ extern { #[cfg(test)] mod test { - use std::{str,io,libc}; + use std::{io, libc}; use super::*; #[test] pub fn test_nsapp() { - let klass = str::as_c_str("NSApplication", |s| - unsafe { - objc_getClass(s) - } - ); + let klass = do "NSApplication".to_c_str().with_ref |s| { + unsafe { + objc_getClass(s) + } + }; - let sel = str::as_c_str("sharedApplication", |s| - unsafe { - sel_registerName(s) - } - ); + let sel = do "sharedApplication".to_c_str().with_ref |s| { + unsafe { + sel_registerName(s) + } + }; unsafe { let nsapp = objc_msgSend(klass, sel); @@ -74,36 +74,40 @@ mod test { return this; } - let NSObject = str::as_c_str("NSObject", |s| - unsafe { - objc_getClass(s) - } - ); - let MyObject = str::as_c_str("MyObject", |s| - unsafe { - objc_allocateClassPair(NSObject, s, 0 as libc::size_t) - } - ); - let doSomething = str::as_c_str("doSomething", |s| - unsafe { - sel_registerName(s) - } - ); - let _ = str::as_c_str("@@:", |types| - unsafe { - class_addMethod(MyObject, - doSomething, - MyObject_doSomething, - types) - } - ); + let NSObject = do "NSObject".to_c_str().with_ref |s| { + unsafe { + objc_getClass(s) + } + }; + let MyObject = do "MyObject".to_c_str().with_ref |s| { + unsafe { + objc_allocateClassPair(NSObject, s, 0 as libc::size_t) + } + }; + let doSomething = do "doSomething".to_c_str().with_ref |s| { + unsafe { + sel_registerName(s) + } + }; + let _ = do "@@:".to_c_str().with_ref |types| { + unsafe { + class_addMethod(MyObject, + doSomething, + MyObject_doSomething, + types) + } + }; unsafe { objc_registerClassPair(MyObject); } - let alloc = str::as_c_str("alloc", |s| unsafe { sel_registerName(s) }); - let init = str::as_c_str("init", |s| unsafe { sel_registerName(s) }); + let alloc = do "alloc".to_c_str().with_ref |s| { + unsafe { sel_registerName(s) } + }; + let init = do "init".to_c_str().with_ref |s| { + unsafe { sel_registerName(s) } + }; unsafe { let mut obj = objc_msgSend(MyObject, alloc);