Update for new exports
This commit is contained in:
+2
-2
@@ -6,11 +6,11 @@ RUST_SRC=$(shell find $(VPATH)/. -type f -name '*.rs')
|
||||
all: librustcorefoundation.dummy
|
||||
|
||||
librustcorefoundation.dummy: core_foundation.rc $(RUST_SRC)
|
||||
$(CFG_RUSTC) $(CFG_RUSTC_FLAGS) $< -o $@
|
||||
$(RUSTC) $(RUSTFLAGS) $< -o $@
|
||||
touch $@
|
||||
|
||||
rustcorefoundation-test: core_foundation.rc $(RUST_SRC)
|
||||
$(CFG_RUSTC) $(CFG_RUSTC_FLAGS) $< -o $@ --test
|
||||
$(RUSTC) $(RUSTFLAGS) $< -o $@ --test
|
||||
|
||||
check: rustcorefoundation-test
|
||||
./rustcorefoundation-test
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@ use cast::reinterpret_cast;
|
||||
struct __CFBoolean { private: () }
|
||||
pub type CFBooleanRef = *__CFBoolean;
|
||||
|
||||
struct CFBoolean {
|
||||
pub struct CFBoolean {
|
||||
obj: CFBooleanRef,
|
||||
|
||||
drop {
|
||||
@@ -14,12 +14,12 @@ struct CFBoolean {
|
||||
}
|
||||
}
|
||||
|
||||
mod CFBoolean {
|
||||
fn wrap(obj: CFBooleanRef) -> CFBoolean {
|
||||
pub mod CFBoolean {
|
||||
pub fn wrap(obj: CFBooleanRef) -> CFBoolean {
|
||||
CFBoolean { obj: obj }
|
||||
}
|
||||
|
||||
fn true_value() -> CFBoolean {
|
||||
pub fn true_value() -> CFBoolean {
|
||||
unsafe {
|
||||
let obj = kCFBooleanTrue;
|
||||
CFRetain(reinterpret_cast(&obj));
|
||||
@@ -27,7 +27,7 @@ mod CFBoolean {
|
||||
}
|
||||
}
|
||||
|
||||
fn false_value() -> CFBoolean {
|
||||
pub fn false_value() -> CFBoolean {
|
||||
unsafe {
|
||||
let obj = kCFBooleanFalse;
|
||||
CFRetain(reinterpret_cast(&obj));
|
||||
|
||||
+3
-3
@@ -41,12 +41,12 @@ struct CFDictionary<K:AbstractCFType,V:AbstractCFType> {
|
||||
}
|
||||
}
|
||||
|
||||
mod CFDictionary {
|
||||
fn wrap<K:AbstractCFType,V:AbstractCFType>(obj: CFDictionaryRef) -> CFDictionary<K,V> {
|
||||
pub mod CFDictionary {
|
||||
pub fn wrap<K:AbstractCFType,V:AbstractCFType>(obj: CFDictionaryRef) -> CFDictionary<K,V> {
|
||||
CFDictionary { obj: obj }
|
||||
}
|
||||
|
||||
fn new_dictionary<K:AbstractCFType,V:AbstractCFType>(pairs: &[(K,V)]) -> CFDictionary<K,V> {
|
||||
pub fn new_dictionary<K:AbstractCFType,V:AbstractCFType>(pairs: &[(K,V)]) -> CFDictionary<K,V> {
|
||||
let (keys, values) = (DVec(), DVec());
|
||||
for pairs.each |pair| {
|
||||
// FIXME: "let" would be much nicer here, but that doesn't work yet.
|
||||
|
||||
@@ -5,9 +5,9 @@ use libc::{c_int, c_void};
|
||||
struct __CFNumber { private: () }
|
||||
pub type CFNumberRef = *__CFNumber;
|
||||
|
||||
const kCFNumberSInt32Type: c_int = 3;
|
||||
pub const kCFNumberSInt32Type: c_int = 3;
|
||||
|
||||
struct CFNumber {
|
||||
pub struct CFNumber {
|
||||
obj: CFNumberRef,
|
||||
|
||||
drop {
|
||||
@@ -17,12 +17,12 @@ struct CFNumber {
|
||||
}
|
||||
}
|
||||
|
||||
mod CFNumber {
|
||||
fn wrap(obj: CFNumberRef) -> CFNumber {
|
||||
pub mod CFNumber {
|
||||
pub fn wrap(obj: CFNumberRef) -> CFNumber {
|
||||
CFNumber { obj: obj }
|
||||
}
|
||||
|
||||
fn new_number<T:Copy ConvertibleToCFNumber>(n: T) -> CFNumber {
|
||||
pub fn new_number<T:Copy ConvertibleToCFNumber>(n: T) -> CFNumber {
|
||||
unsafe {
|
||||
CFNumber {
|
||||
obj: CFNumberCreate(kCFAllocatorDefault, n.cf_number_type(), reinterpret_cast(& &n))
|
||||
@@ -39,7 +39,7 @@ impl CFNumber : AbstractCFType {
|
||||
}
|
||||
}
|
||||
|
||||
trait ConvertibleToCFNumber {
|
||||
pub trait ConvertibleToCFNumber {
|
||||
// FIXME: Should be static, but that breaks.
|
||||
pure fn cf_number_type(&self) -> CFNumberType;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ impl i32 : ConvertibleToCFNumber {
|
||||
pure fn cf_number_type(&self) -> CFNumberType { kCFNumberSInt32Type as CFNumberType }
|
||||
}
|
||||
|
||||
type CFNumberType = CFIndex;
|
||||
pub type CFNumberType = CFIndex;
|
||||
|
||||
#[link_args="-framework CoreFoundation"]
|
||||
#[nolink]
|
||||
|
||||
@@ -12,7 +12,7 @@ const kCFStringEncodingUTF8: u32 = 0x08000100;
|
||||
struct __CFString { private: () }
|
||||
pub type CFStringRef = *__CFString;
|
||||
|
||||
struct CFString {
|
||||
pub struct CFString {
|
||||
obj: CFStringRef,
|
||||
|
||||
drop {
|
||||
@@ -22,12 +22,12 @@ struct CFString {
|
||||
}
|
||||
}
|
||||
|
||||
mod CFString {
|
||||
fn wrap(obj: CFStringRef) -> CFString {
|
||||
pub mod CFString {
|
||||
pub fn wrap(obj: CFStringRef) -> CFString {
|
||||
CFString { obj: obj }
|
||||
}
|
||||
|
||||
fn new_static(string: &static/str) -> CFString {
|
||||
pub fn new_static(string: &static/str) -> CFString {
|
||||
let string_ref = do str::as_buf(string) |bytes, len| {
|
||||
CFStringCreateWithBytesNoCopy(kCFAllocatorDefault,
|
||||
bytes,
|
||||
|
||||
Reference in New Issue
Block a user