From fcc8d5865e0002d8d75f1098e956c120d8131c8d Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 29 Aug 2013 15:33:11 -0700 Subject: [PATCH] Update for language changes --- appkit.rs | 1 + base.rs | 12 +++++++++++- foundation.rs | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/appkit.rs b/appkit.rs index 356a878..eebaeae 100644 --- a/appkit.rs +++ b/appkit.rs @@ -50,6 +50,7 @@ extern { fn NSBeep(); } +#[fixed_stack_segment] pub fn NSApp() -> base::id { unsafe { let klass = do "NSApplicatoin".to_c_str().with_ref |s| { base::objc_getClass(s) }; diff --git a/base.rs b/base.rs index db59f43..99edf37 100644 --- a/base.rs +++ b/base.rs @@ -14,7 +14,7 @@ use std::libc::c_long; pub type id = libc::intptr_t; pub type Class = libc::intptr_t; -pub type IMP = *u8; +pub type IMP = extern "C" fn(id, SEL) -> id; pub type SEL = libc::intptr_t; pub type Ivar = libc::intptr_t; @@ -48,6 +48,7 @@ mod test { use super::*; #[test] + #[fixed_stack_segment] pub fn test_nsapp() { let klass = do "NSApplication".to_c_str().with_ref |s| { unsafe { @@ -68,6 +69,7 @@ mod test { } #[test] + #[fixed_stack_segment] pub fn test_custom_obj() { extern fn MyObject_doSomething(this : id, _sel : SEL) -> id { io::println("doSomething"); @@ -120,6 +122,7 @@ mod test { /// Invokes the given selector, which must have the signature: /// /// double f(); +#[fixed_stack_segment] pub fn msg_send_double(theReceiver: id, theSelector: SEL) -> f64 { unsafe { invoke_msg_double(theReceiver, theSelector) @@ -129,6 +132,7 @@ pub fn msg_send_double(theReceiver: id, theSelector: SEL) -> f64 { /// Invokes the given selector, which must have the signature: /// /// id f(); +#[fixed_stack_segment] pub fn msg_send_id(theReceiver: id, theSelector: SEL) -> id { unsafe { invoke_msg_id(theReceiver, theSelector) @@ -138,6 +142,7 @@ pub fn msg_send_id(theReceiver: id, theSelector: SEL) -> id { /// Invokes the given selector, which must have the signature: /// /// id f(NSRect a); +#[fixed_stack_segment] pub fn msg_send_id_NSRect(theReceiver: id, theSelector: SEL, a: NSRect) -> id { unsafe { invoke_msg_id_NSRect(theReceiver, theSelector, &a) @@ -147,6 +152,7 @@ pub fn msg_send_id_NSRect(theReceiver: id, theSelector: SEL, a: NSRect) -> id { /// Invokes the given selector, which must have the signature: /// /// id f(id a, id b, id c, id e, id f); +#[fixed_stack_segment] pub fn msg_send_id_id_id_id_id_id(theReceiver: id, theSelector: SEL, a: id, @@ -163,6 +169,7 @@ pub fn msg_send_id_id_id_id_id_id(theReceiver: id, /// Invokes the given selector, which must have the signature: /// /// long f(); +#[fixed_stack_segment] pub fn msg_send_long(theReceiver: id, theSelector: SEL) -> c_long { unsafe { invoke_msg_long(theReceiver, theSelector) @@ -172,6 +179,7 @@ pub fn msg_send_long(theReceiver: id, theSelector: SEL) -> c_long { /// Invokes the given selector, which must have the signature: /// /// void f(); +#[fixed_stack_segment] pub fn msg_send_void(theReceiver: id, theSelector: SEL) { unsafe { invoke_msg_void(theReceiver, theSelector) @@ -181,6 +189,7 @@ pub fn msg_send_void(theReceiver: id, theSelector: SEL) { /// Invokes the given selector, which must have the signature: /// /// void f(BOOL a); +#[fixed_stack_segment] pub fn msg_send_void_bool(theReceiver: id, theSelector: SEL, a: bool) { unsafe { invoke_msg_void_bool(theReceiver, theSelector, a) @@ -190,6 +199,7 @@ pub fn msg_send_void_bool(theReceiver: id, theSelector: SEL, a: bool) { /// Invokes the given selector, which must have the signature: /// /// void f(id a); +#[fixed_stack_segment] pub fn msg_send_void_id(theReceiver: id, theSelector: SEL, a: id) { unsafe { invoke_msg_void_id(theReceiver, theSelector, a) diff --git a/foundation.rs b/foundation.rs index a7f7a8a..415ad81 100644 --- a/foundation.rs +++ b/foundation.rs @@ -18,6 +18,7 @@ enum NSAutoreleasePool { NSAutoreleasePool_priv(base::id) } +#[fixed_stack_segment] fn NSAutoreleasePool() -> base::id { unsafe { let klass = do "NSAutoreleasePool".to_c_str().with_ref |s| {