Merge pull request #24 from kmcallister/rustpkg

Rustpkg
This commit is contained in:
Jack Moffitt
2013-11-07 17:07:57 -08:00
5 changed files with 49 additions and 86 deletions
-23
View File
@@ -1,23 +0,0 @@
VPATH=%VPATH%
RUSTC ?= rustc
RUSTFLAGS ?=
RUST_SRC=$(shell find $(VPATH)/. -type f -name '*.rs')
.PHONY: all clean
all: librustcorefoundation.dummy
librustcorefoundation.dummy: core_foundation.rc $(RUST_SRC)
$(RUSTC) $(RUSTFLAGS) $< --out-dir .
touch $@
rustcorefoundation-test: core_foundation.rc $(RUST_SRC)
$(RUSTC) $(RUSTFLAGS) $< -o $@ --test
check: rustcorefoundation-test
./rustcorefoundation-test
clean:
rm -f *.o *.a *.so *.dylib *.dll *.dummy rustcorefoundation-test
Vendored
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
SRCDIR="$(cd $(dirname $0) && pwd)"
sed "s#%VPATH%#${SRCDIR}#" ${SRCDIR}/Makefile.in > Makefile
-25
View File
@@ -1,25 +0,0 @@
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[link(name = "core_foundation",
vers = "0.1")];
#[crate_type = "lib"];
extern mod std;
pub mod array;
pub mod base;
pub mod boolean;
pub mod data;
pub mod dictionary;
pub mod number;
pub mod set;
pub mod string;
pub mod test;
pub mod url;
+49
View File
@@ -0,0 +1,49 @@
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern mod std;
pub mod array;
pub mod base;
pub mod boolean;
pub mod data;
pub mod dictionary;
pub mod number;
pub mod set;
pub mod string;
pub mod url;
#[cfg(test)]
pub mod test {
#[test]
fn test_stuff() {
use boolean::CFBoolean;
use number::CFNumber;
use dictionary::CFDictionary;
use string::CFString;
/*let n = CFNumber::new_number(42 as i32);
io::println(format!("%d", (&n).retain_count() as int));
(&n).show();*/
let bar = CFString::new_static("Bar");
let baz = CFString::new_static("Baz");
let boo = CFString::new_static("Boo");
let foo = CFString::new_static("Foo");
let tru = CFBoolean::true_value();
let n42 = CFNumber::new(42 as i32);
let d = CFDictionary::new([
(*bar.contents.borrow_ref(), *boo.contents.borrow_type_ref()),
(*baz.contents.borrow_ref(), *tru.contents.borrow_type_ref()),
(*foo.contents.borrow_ref(), *n42.contents.borrow_type_ref()),
]);
d.contents.show();
}
}
-33
View File
@@ -1,33 +0,0 @@
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use boolean::CFBoolean;
use number::CFNumber;
use dictionary::CFDictionary;
use string::CFString;
fn main() {
/*let n = CFNumber::new_number(42 as i32);
io::println(format!("{:d}", (&n).retain_count() as int));
(&n).show();*/
let bar = CFString::new_static("Bar");
let baz = CFString::new_static("Baz");
let boo = CFString::new_static("Boo");
let foo = CFString::new_static("Foo");
let tru = CFBoolean::true_value();
let n42 = CFNumber::new(42 as i32);
let d = CFDictionary::new([
(*bar.contents.borrow_ref(), *boo.contents.borrow_type_ref()),
(*baz.contents.borrow_ref(), *tru.contents.borrow_type_ref()),
(*foo.contents.borrow_ref(), *n42.contents.borrow_type_ref()),
]);
d.contents.show();
}