Skip to content

Commit 223e0ed

Browse files
committed
---
yaml --- r: 57202 b: refs/heads/try c: 64412ec h: refs/heads/master v: v3
1 parent 8340de0 commit 223e0ed

File tree

29 files changed

+455
-254
lines changed

29 files changed

+455
-254
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
5-
refs/heads/try: ad0b337036f2f9076852d5d6701ec302e3cce101
5+
refs/heads/try: 64412eca10399d64d25346d5f8220c1b1f88cd29
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/num/f32.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
use from_str;
1414
use libc::c_int;
15-
use num::{Zero, One, strconv};
15+
use num::strconv;
1616
use prelude::*;
1717

1818
pub use cmath::c_float_targ_consts::*;
@@ -154,6 +154,12 @@ pub fn gt(x: f32, y: f32) -> bool { return x > y; }
154154
// FIXME (#1999): replace the predicates below with llvm intrinsics or
155155
// calls to the libmath macros in the rust runtime for performance.
156156

157+
/// Returns true if `x` is a zero number (positive or negative zero)
158+
#[inline(always)]
159+
pub fn is_zero(x: f32) -> bool {
160+
return x == 0.0f32 || x == -0.0f32;
161+
}
162+
157163
/// Returns true if `x`is an infinite number
158164
#[inline(always)]
159165
pub fn is_infinite(x: f32) -> bool {
@@ -239,16 +245,12 @@ impl Ord for f32 {
239245
fn gt(&self, other: &f32) -> bool { (*self) > (*other) }
240246
}
241247

242-
impl Zero for f32 {
248+
impl num::Zero for f32 {
243249
#[inline(always)]
244250
fn zero() -> f32 { 0.0 }
245-
246-
/// Returns true if the number is equal to either `0.0` or `-0.0`
247-
#[inline(always)]
248-
fn is_zero(&self) -> bool { *self == 0.0 || *self == -0.0 }
249251
}
250252

251-
impl One for f32 {
253+
impl num::One for f32 {
252254
#[inline(always)]
253255
fn one() -> f32 { 1.0 }
254256
}

branches/try/src/libcore/num/f64.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
use from_str;
1414
use libc::c_int;
15-
use num::{Zero, One, strconv};
15+
use num::strconv;
1616
use prelude::*;
1717

1818
pub use cmath::c_double_targ_consts::*;
@@ -174,6 +174,12 @@ pub fn ge(x: f64, y: f64) -> bool { return x >= y; }
174174
#[inline(always)]
175175
pub fn gt(x: f64, y: f64) -> bool { return x > y; }
176176

177+
/// Returns true if `x` is a zero number (positive or negative zero)
178+
#[inline(always)]
179+
pub fn is_zero(x: f64) -> bool {
180+
return x == 0.0f64 || x == -0.0f64;
181+
}
182+
177183
/// Returns true if `x`is an infinite number
178184
#[inline(always)]
179185
pub fn is_infinite(x: f64) -> bool {
@@ -260,16 +266,12 @@ impl Ord for f64 {
260266
fn gt(&self, other: &f64) -> bool { (*self) > (*other) }
261267
}
262268

263-
impl Zero for f64 {
269+
impl num::Zero for f64 {
264270
#[inline(always)]
265271
fn zero() -> f64 { 0.0 }
266-
267-
/// Returns true if the number is equal to either `0.0` or `-0.0`
268-
#[inline(always)]
269-
fn is_zero(&self) -> bool { *self == 0.0 || *self == -0.0 }
270272
}
271273

272-
impl One for f64 {
274+
impl num::One for f64 {
273275
#[inline(always)]
274276
fn one() -> f64 { 1.0 }
275277
}

branches/try/src/libcore/num/float.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
use from_str;
2424
use libc::c_int;
25-
use num::{Zero, One, strconv};
25+
use num::strconv;
2626
use prelude::*;
2727

2828
pub use f64::{add, sub, mul, quot, rem, lt, le, eq, ne, ge, gt};
@@ -337,6 +337,8 @@ pub fn pow_with_uint(base: uint, pow: uint) -> float {
337337
return total;
338338
}
339339
340+
#[inline(always)]
341+
pub fn is_zero(x: float) -> bool { f64::is_zero(x as f64) }
340342
#[inline(always)]
341343
pub fn is_infinite(x: float) -> bool { f64::is_infinite(x as f64) }
342344
#[inline(always)]
@@ -391,16 +393,12 @@ impl Ord for float {
391393
fn gt(&self, other: &float) -> bool { (*self) > (*other) }
392394
}
393395
394-
impl Zero for float {
396+
impl num::Zero for float {
395397
#[inline(always)]
396398
fn zero() -> float { 0.0 }
397-
398-
/// Returns true if the number is equal to either `0.0` or `-0.0`
399-
#[inline(always)]
400-
fn is_zero(&self) -> bool { *self == 0.0 || *self == -0.0 }
401399
}
402400
403-
impl One for float {
401+
impl num::One for float {
404402
#[inline(always)]
405403
fn one() -> float { 1.0 }
406404
}
@@ -869,11 +867,11 @@ mod tests {
869867
}
870868
// note: -0 == 0, hence these slightly more complex tests
871869
match from_str(~"-0") {
872-
Some(v) if v.is_zero() => assert!(v.is_negative()),
870+
Some(v) if is_zero(v) => assert!(v.is_negative()),
873871
_ => fail!()
874872
}
875873
match from_str(~"0") {
876-
Some(v) if v.is_zero() => assert!(v.is_positive()),
874+
Some(v) if is_zero(v) => assert!(v.is_positive()),
877875
_ => fail!()
878876
}
879877
@@ -916,11 +914,11 @@ mod tests {
916914
}
917915
// note: -0 == 0, hence these slightly more complex tests
918916
match from_str_hex(~"-0") {
919-
Some(v) if v.is_zero() => assert!(v.is_negative()),
917+
Some(v) if is_zero(v) => assert!(v.is_negative()),
920918
_ => fail!()
921919
}
922920
match from_str_hex(~"0") {
923-
Some(v) if v.is_zero() => assert!(v.is_positive()),
921+
Some(v) if is_zero(v) => assert!(v.is_positive()),
924922
_ => fail!()
925923
}
926924
assert_eq!(from_str_hex(~"e"), Some(14.));

branches/try/src/libcore/num/int-template.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use T = self::inst::T;
1212

1313
use from_str::FromStr;
1414
use num::{ToStrRadix, FromStrRadix};
15-
use num::{Zero, One, strconv};
15+
use num::strconv;
1616
use prelude::*;
1717

1818
pub use cmp::{min, max};
@@ -152,15 +152,12 @@ impl Eq for T {
152152
fn ne(&self, other: &T) -> bool { return (*self) != (*other); }
153153
}
154154
155-
impl Zero for T {
155+
impl num::Zero for T {
156156
#[inline(always)]
157157
fn zero() -> T { 0 }
158-
159-
#[inline(always)]
160-
fn is_zero(&self) -> bool { *self == 0 }
161158
}
162159
163-
impl One for T {
160+
impl num::One for T {
164161
#[inline(always)]
165162
fn one() -> T { 1 }
166163
}

branches/try/src/libcore/num/num.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ pub trait IntConvertible {
3737
}
3838

3939
pub trait Zero {
40-
fn zero() -> Self; // FIXME (#5527): This should be an associated constant
41-
fn is_zero(&self) -> bool;
40+
// FIXME (#5527): These should be associated constants
41+
fn zero() -> Self;
4242
}
4343

4444
pub trait One {
45-
fn one() -> Self; // FIXME (#5527): This should be an associated constant
45+
// FIXME (#5527): These should be associated constants
46+
fn one() -> Self;
4647
}
4748

4849
pub trait Signed: Num

branches/try/src/libcore/num/uint-template.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use T_SIGNED = self::inst::T_SIGNED;
1313

1414
use from_str::FromStr;
1515
use num::{ToStrRadix, FromStrRadix};
16-
use num::{Zero, One, strconv};
16+
use num::strconv;
1717
use prelude::*;
1818

1919
pub use cmp::{min, max};
@@ -118,15 +118,12 @@ impl Eq for T {
118118
fn ne(&self, other: &T) -> bool { return (*self) != (*other); }
119119
}
120120
121-
impl Zero for T {
121+
impl num::Zero for T {
122122
#[inline(always)]
123123
fn zero() -> T { 0 }
124-
125-
#[inline(always)]
126-
fn is_zero(&self) -> bool { *self == 0 }
127124
}
128125
129-
impl One for T {
126+
impl num::One for T {
130127
#[inline(always)]
131128
fn one() -> T { 1 }
132129
}

branches/try/src/libcore/os.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ use vec;
4343
pub use libc::fclose;
4444
pub use os::consts::*;
4545

46-
// FIXME: move these to str perhaps? #2620
47-
4846
pub fn close(fd: c_int) -> c_int {
4947
unsafe {
5048
libc::close(fd)
@@ -79,6 +77,8 @@ pub fn getcwd() -> Path {
7977
}
8078
}
8179

80+
// FIXME: move these to str perhaps? #2620
81+
8282
pub fn as_c_charp<T>(s: &str, f: &fn(*c_char) -> T) -> T {
8383
str::as_c_str(s, |b| f(b as *c_char))
8484
}

branches/try/src/libcore/vec.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ pub fn from_slice<T:Copy>(t: &[T]) -> ~[T] {
173173
from_fn(t.len(), |i| t[i])
174174
}
175175

176+
/// Creates a new vector with a capacity of `capacity`
176177
pub fn with_capacity<T>(capacity: uint) -> ~[T] {
177178
let mut vec = ~[];
178179
reserve(&mut vec, capacity);
@@ -1565,6 +1566,16 @@ pub fn each_permutation<T:Copy>(v: &[T], put: &fn(ts: &[T]) -> bool) {
15651566
}
15661567
}
15671568
1569+
// see doc below
1570+
#[cfg(stage0)] // XXX: lifetimes!
1571+
pub fn windowed<T>(n: uint, v: &[T], it: &fn(&[T]) -> bool) {
1572+
assert!(1u <= n);
1573+
if n > v.len() { return; }
1574+
for uint::range(0, v.len() - n + 1) |i| {
1575+
if !it(v.slice(i, i+n)) { return }
1576+
}
1577+
}
1578+
15681579
/**
15691580
* Iterate over all contiguous windows of length `n` of the vector `v`.
15701581
*
@@ -1579,14 +1590,6 @@ pub fn each_permutation<T:Copy>(v: &[T], put: &fn(ts: &[T]) -> bool) {
15791590
* ~~~
15801591
*
15811592
*/
1582-
#[cfg(stage0)] // XXX: lifetimes!
1583-
pub fn windowed<T>(n: uint, v: &[T], it: &fn(&[T]) -> bool) {
1584-
assert!(1u <= n);
1585-
if n > v.len() { return; }
1586-
for uint::range(0, v.len() - n + 1) |i| {
1587-
if !it(v.slice(i, i+n)) { return }
1588-
}
1589-
}
15901593
#[cfg(stage1)]
15911594
#[cfg(stage2)]
15921595
#[cfg(stage3)]
Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
1-
Right now (2013-04-11), only one package works, the branch of rust-sdl at:
2-
https://github.com/catamorphism/rust-sdl/tree/new-rustpkg
1+
Right now, commands that work are "build" and "clean".
32

4-
and only one command works, "build".
3+
`rustpkg build` and `rustpkg clean` should work
4+
5+
for example:
6+
$ cd ~/rust/src/librustpkg/testsuite/pass
7+
$ rustpkg build hello-world
8+
... some output ...
9+
$ rustpkg clean hello-world
10+
11+
-------------
12+
the following test packages in librustpkg/testsuite/pass:
13+
* hello-world
14+
* install-paths
15+
* simple-lib
16+
* deeply/nested/path
17+
* fancy-lib
18+
19+
It fails on the following test packages:
20+
* external-crate (no support for `extern mod` inference yet)
21+
22+
and should fail with proper error messages
23+
on all of the test packages in librustpkg/testsuite/fail
24+
* no-inferred-crates

branches/try/src/librustpkg/conditions.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
// Useful conditions
1212

1313
pub use core::path::Path;
14+
pub use util::PkgId;
1415

1516
condition! {
1617
bad_path: (super::Path, ~str) -> super::Path;
1718
}
19+
20+
condition! {
21+
nonexistent_package: (super::PkgId, ~str) -> super::Path;
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Context data structure used by rustpkg
12+
13+
use core::hashmap::HashMap;
14+
15+
pub struct Ctx {
16+
// I'm not sure what this is for
17+
json: bool,
18+
// Cache of hashes of things already installed
19+
// though I'm not sure why the value is a bool
20+
dep_cache: @mut HashMap<~str, bool>,
21+
}

0 commit comments

Comments
 (0)