Skip to content

Commit cb2cd5b

Browse files
committed
---
yaml --- r: 139758 b: refs/heads/try2 c: 7158102 h: refs/heads/master v: v3
1 parent 33c327f commit cb2cd5b

27 files changed

+307
-1011
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 8bf9fc52f405f2a825cbf2692d872e9e710999b5
8+
refs/heads/try2: 715810290f89dd95c4787ca0ee9019ee6e93477e
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libcore/core.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub use vec::{OwnedVector, OwnedCopyableVector};
9999
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
100100
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
101101

102-
pub use num::NumCast;
102+
pub use num::{Num, NumCast};
103103
pub use ptr::Ptr;
104104
pub use to_str::ToStr;
105105
pub use clone::Clone;

branches/try2/src/libcore/libc.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,8 @@ pub mod consts {
863863
pub static F_TEST : int = 3;
864864
pub static F_TLOCK : int = 2;
865865
pub static F_ULOCK : int = 0;
866+
pub static SIGKILL : int = 9;
867+
pub static SIGTERM : int = 15;
866868
}
867869
pub mod posix01 {
868870
}
@@ -930,6 +932,8 @@ pub mod consts {
930932
pub static F_TEST : int = 3;
931933
pub static F_TLOCK : int = 2;
932934
pub static F_ULOCK : int = 0;
935+
pub static SIGKILL : int = 9;
936+
pub static SIGTERM : int = 15;
933937
}
934938
pub mod posix01 {
935939
}
@@ -998,6 +1002,8 @@ pub mod consts {
9981002
pub static F_TEST : int = 3;
9991003
pub static F_TLOCK : int = 2;
10001004
pub static F_ULOCK : int = 0;
1005+
pub static SIGKILL : int = 9;
1006+
pub static SIGTERM : int = 15;
10011007
}
10021008
pub mod posix01 {
10031009
}
@@ -1482,6 +1488,17 @@ pub mod funcs {
14821488
-> ssize_t;
14831489
}
14841490
}
1491+
1492+
#[nolink]
1493+
#[abi = "cdecl"]
1494+
pub mod signal {
1495+
use libc::types::os::arch::c95::{c_int};
1496+
use libc::types::os::arch::posix88::{pid_t};
1497+
1498+
pub extern {
1499+
unsafe fn kill(pid: pid_t, sig: c_int) -> c_int;
1500+
}
1501+
}
14851502
}
14861503

14871504
#[cfg(target_os = "linux")]
@@ -1623,6 +1640,7 @@ pub mod funcs {
16231640
pub mod extra {
16241641

16251642
pub mod kernel32 {
1643+
use libc::types::os::arch::c95::{c_uint};
16261644
use libc::types::os::arch::extra::{BOOL, DWORD, HMODULE};
16271645
use libc::types::os::arch::extra::{LPCWSTR, LPWSTR, LPTCH};
16281646
use libc::types::os::arch::extra::{LPSECURITY_ATTRIBUTES};
@@ -1663,6 +1681,7 @@ pub mod funcs {
16631681
findFileData: HANDLE)
16641682
-> BOOL;
16651683
unsafe fn FindClose(findFile: HANDLE) -> BOOL;
1684+
unsafe fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint) -> BOOL;
16661685
}
16671686
}
16681687

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

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
1313
use cmath;
1414
use libc::{c_float, c_int};
15-
use num::NumCast;
1615
use num::strconv;
1716
use num;
1817
use option::Option;
@@ -287,30 +286,6 @@ impl num::One for f32 {
287286
fn one() -> f32 { 1.0 }
288287
}
289288

290-
impl NumCast for f32 {
291-
/**
292-
* Cast `n` to an `f32`
293-
*/
294-
#[inline(always)]
295-
fn from<N:NumCast>(n: N) -> f32 { n.to_f32() }
296-
297-
#[inline(always)] fn to_u8(&self) -> u8 { *self as u8 }
298-
#[inline(always)] fn to_u16(&self) -> u16 { *self as u16 }
299-
#[inline(always)] fn to_u32(&self) -> u32 { *self as u32 }
300-
#[inline(always)] fn to_u64(&self) -> u64 { *self as u64 }
301-
#[inline(always)] fn to_uint(&self) -> uint { *self as uint }
302-
303-
#[inline(always)] fn to_i8(&self) -> i8 { *self as i8 }
304-
#[inline(always)] fn to_i16(&self) -> i16 { *self as i16 }
305-
#[inline(always)] fn to_i32(&self) -> i32 { *self as i32 }
306-
#[inline(always)] fn to_i64(&self) -> i64 { *self as i64 }
307-
#[inline(always)] fn to_int(&self) -> int { *self as int }
308-
309-
#[inline(always)] fn to_f32(&self) -> f32 { *self }
310-
#[inline(always)] fn to_f64(&self) -> f64 { *self as f64 }
311-
#[inline(always)] fn to_float(&self) -> float { *self as float }
312-
}
313-
314289
#[cfg(notest)]
315290
impl ops::Add<f32,f32> for f32 {
316291
fn add(&self, other: &f32) -> f32 { *self + *other }
@@ -580,63 +555,6 @@ impl num::FromStrRadix for f32 {
580555
}
581556
}
582557

583-
#[test]
584-
pub fn test_num() {
585-
let ten: f32 = num::cast(10);
586-
let two: f32 = num::cast(2);
587-
588-
assert!((ten.add(&two) == num::cast(12)));
589-
assert!((ten.sub(&two) == num::cast(8)));
590-
assert!((ten.mul(&two) == num::cast(20)));
591-
assert!((ten.div(&two) == num::cast(5)));
592-
assert!((ten.modulo(&two) == num::cast(0)));
593-
}
594-
595-
#[test]
596-
fn test_numcast() {
597-
assert!((20u == 20f32.to_uint()));
598-
assert!((20u8 == 20f32.to_u8()));
599-
assert!((20u16 == 20f32.to_u16()));
600-
assert!((20u32 == 20f32.to_u32()));
601-
assert!((20u64 == 20f32.to_u64()));
602-
assert!((20i == 20f32.to_int()));
603-
assert!((20i8 == 20f32.to_i8()));
604-
assert!((20i16 == 20f32.to_i16()));
605-
assert!((20i32 == 20f32.to_i32()));
606-
assert!((20i64 == 20f32.to_i64()));
607-
assert!((20f == 20f32.to_float()));
608-
assert!((20f32 == 20f32.to_f32()));
609-
assert!((20f64 == 20f32.to_f64()));
610-
611-
assert!((20f32 == NumCast::from(20u)));
612-
assert!((20f32 == NumCast::from(20u8)));
613-
assert!((20f32 == NumCast::from(20u16)));
614-
assert!((20f32 == NumCast::from(20u32)));
615-
assert!((20f32 == NumCast::from(20u64)));
616-
assert!((20f32 == NumCast::from(20i)));
617-
assert!((20f32 == NumCast::from(20i8)));
618-
assert!((20f32 == NumCast::from(20i16)));
619-
assert!((20f32 == NumCast::from(20i32)));
620-
assert!((20f32 == NumCast::from(20i64)));
621-
assert!((20f32 == NumCast::from(20f)));
622-
assert!((20f32 == NumCast::from(20f32)));
623-
assert!((20f32 == NumCast::from(20f64)));
624-
625-
assert!((20f32 == num::cast(20u)));
626-
assert!((20f32 == num::cast(20u8)));
627-
assert!((20f32 == num::cast(20u16)));
628-
assert!((20f32 == num::cast(20u32)));
629-
assert!((20f32 == num::cast(20u64)));
630-
assert!((20f32 == num::cast(20i)));
631-
assert!((20f32 == num::cast(20i8)));
632-
assert!((20f32 == num::cast(20i16)));
633-
assert!((20f32 == num::cast(20i32)));
634-
assert!((20f32 == num::cast(20i64)));
635-
assert!((20f32 == num::cast(20f)));
636-
assert!((20f32 == num::cast(20f32)));
637-
assert!((20f32 == num::cast(20f64)));
638-
}
639-
640558
//
641559
// Local Variables:
642560
// mode: rust

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

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
1313
use cmath;
1414
use libc::{c_double, c_int};
15-
use num::NumCast;
1615
use num::strconv;
1716
use num;
1817
use option::Option;
@@ -299,30 +298,6 @@ impl cmp::Ord for f64 {
299298
fn gt(&self, other: &f64) -> bool { (*self) > (*other) }
300299
}
301300

302-
impl NumCast for f64 {
303-
/**
304-
* Cast `n` to an `f64`
305-
*/
306-
#[inline(always)]
307-
fn from<N:NumCast>(n: N) -> f64 { n.to_f64() }
308-
309-
#[inline(always)] fn to_u8(&self) -> u8 { *self as u8 }
310-
#[inline(always)] fn to_u16(&self) -> u16 { *self as u16 }
311-
#[inline(always)] fn to_u32(&self) -> u32 { *self as u32 }
312-
#[inline(always)] fn to_u64(&self) -> u64 { *self as u64 }
313-
#[inline(always)] fn to_uint(&self) -> uint { *self as uint }
314-
315-
#[inline(always)] fn to_i8(&self) -> i8 { *self as i8 }
316-
#[inline(always)] fn to_i16(&self) -> i16 { *self as i16 }
317-
#[inline(always)] fn to_i32(&self) -> i32 { *self as i32 }
318-
#[inline(always)] fn to_i64(&self) -> i64 { *self as i64 }
319-
#[inline(always)] fn to_int(&self) -> int { *self as int }
320-
321-
#[inline(always)] fn to_f32(&self) -> f32 { *self as f32 }
322-
#[inline(always)] fn to_f64(&self) -> f64 { *self }
323-
#[inline(always)] fn to_float(&self) -> float { *self as float }
324-
}
325-
326301
impl num::Zero for f64 {
327302
#[inline(always)]
328303
fn zero() -> f64 { 0.0 }
@@ -602,63 +577,6 @@ impl num::FromStrRadix for f64 {
602577
}
603578
}
604579

605-
#[test]
606-
pub fn test_num() {
607-
let ten: f64 = num::cast(10);
608-
let two: f64 = num::cast(2);
609-
610-
assert!((ten.add(&two) == num::cast(12)));
611-
assert!((ten.sub(&two) == num::cast(8)));
612-
assert!((ten.mul(&two) == num::cast(20)));
613-
assert!((ten.div(&two) == num::cast(5)));
614-
assert!((ten.modulo(&two) == num::cast(0)));
615-
}
616-
617-
#[test]
618-
fn test_numcast() {
619-
assert!((20u == 20f64.to_uint()));
620-
assert!((20u8 == 20f64.to_u8()));
621-
assert!((20u16 == 20f64.to_u16()));
622-
assert!((20u32 == 20f64.to_u32()));
623-
assert!((20u64 == 20f64.to_u64()));
624-
assert!((20i == 20f64.to_int()));
625-
assert!((20i8 == 20f64.to_i8()));
626-
assert!((20i16 == 20f64.to_i16()));
627-
assert!((20i32 == 20f64.to_i32()));
628-
assert!((20i64 == 20f64.to_i64()));
629-
assert!((20f == 20f64.to_float()));
630-
assert!((20f32 == 20f64.to_f32()));
631-
assert!((20f64 == 20f64.to_f64()));
632-
633-
assert!((20f64 == NumCast::from(20u)));
634-
assert!((20f64 == NumCast::from(20u8)));
635-
assert!((20f64 == NumCast::from(20u16)));
636-
assert!((20f64 == NumCast::from(20u32)));
637-
assert!((20f64 == NumCast::from(20u64)));
638-
assert!((20f64 == NumCast::from(20i)));
639-
assert!((20f64 == NumCast::from(20i8)));
640-
assert!((20f64 == NumCast::from(20i16)));
641-
assert!((20f64 == NumCast::from(20i32)));
642-
assert!((20f64 == NumCast::from(20i64)));
643-
assert!((20f64 == NumCast::from(20f)));
644-
assert!((20f64 == NumCast::from(20f32)));
645-
assert!((20f64 == NumCast::from(20f64)));
646-
647-
assert!((20f64 == num::cast(20u)));
648-
assert!((20f64 == num::cast(20u8)));
649-
assert!((20f64 == num::cast(20u16)));
650-
assert!((20f64 == num::cast(20u32)));
651-
assert!((20f64 == num::cast(20u64)));
652-
assert!((20f64 == num::cast(20i)));
653-
assert!((20f64 == num::cast(20i8)));
654-
assert!((20f64 == num::cast(20i16)));
655-
assert!((20f64 == num::cast(20i32)));
656-
assert!((20f64 == num::cast(20i64)));
657-
assert!((20f64 == num::cast(20f)));
658-
assert!((20f64 == num::cast(20f32)));
659-
assert!((20f64 == num::cast(20f64)));
660-
}
661-
662580
//
663581
// Local Variables:
664582
// mode: rust

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

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// PORT this must match in width according to architecture
2222

2323
use f64;
24-
use num::NumCast;
2524
use num::strconv;
2625
use num;
2726
use option::Option;
@@ -417,30 +416,6 @@ impl num::One for float {
417416
fn one() -> float { 1.0 }
418417
}
419418
420-
impl NumCast for float {
421-
/**
422-
* Cast `n` to a `float`
423-
*/
424-
#[inline(always)]
425-
fn from<N:NumCast>(n: N) -> float { n.to_float() }
426-
427-
#[inline(always)] fn to_u8(&self) -> u8 { *self as u8 }
428-
#[inline(always)] fn to_u16(&self) -> u16 { *self as u16 }
429-
#[inline(always)] fn to_u32(&self) -> u32 { *self as u32 }
430-
#[inline(always)] fn to_u64(&self) -> u64 { *self as u64 }
431-
#[inline(always)] fn to_uint(&self) -> uint { *self as uint }
432-
433-
#[inline(always)] fn to_i8(&self) -> i8 { *self as i8 }
434-
#[inline(always)] fn to_i16(&self) -> i16 { *self as i16 }
435-
#[inline(always)] fn to_i32(&self) -> i32 { *self as i32 }
436-
#[inline(always)] fn to_i64(&self) -> i64 { *self as i64 }
437-
#[inline(always)] fn to_int(&self) -> int { *self as int }
438-
439-
#[inline(always)] fn to_f32(&self) -> f32 { *self as f32 }
440-
#[inline(always)] fn to_f64(&self) -> f64 { *self as f64 }
441-
#[inline(always)] fn to_float(&self) -> float { *self }
442-
}
443-
444419
impl num::Round for float {
445420
#[inline(always)]
446421
fn round(&self, mode: num::RoundMode) -> float {
@@ -688,63 +663,6 @@ pub fn test_round() {
688663
assert!(round(-3.5) == -4.0);
689664
}
690665

691-
#[test]
692-
pub fn test_num() {
693-
let ten: float = num::cast(10);
694-
let two: float = num::cast(2);
695-
696-
assert!((ten.add(&two) == num::cast(12)));
697-
assert!((ten.sub(&two) == num::cast(8)));
698-
assert!((ten.mul(&two) == num::cast(20)));
699-
assert!((ten.div(&two) == num::cast(5)));
700-
assert!((ten.modulo(&two) == num::cast(0)));
701-
}
702-
703-
#[test]
704-
fn test_numcast() {
705-
assert!((20u == 20f.to_uint()));
706-
assert!((20u8 == 20f.to_u8()));
707-
assert!((20u16 == 20f.to_u16()));
708-
assert!((20u32 == 20f.to_u32()));
709-
assert!((20u64 == 20f.to_u64()));
710-
assert!((20i == 20f.to_int()));
711-
assert!((20i8 == 20f.to_i8()));
712-
assert!((20i16 == 20f.to_i16()));
713-
assert!((20i32 == 20f.to_i32()));
714-
assert!((20i64 == 20f.to_i64()));
715-
assert!((20f == 20f.to_float()));
716-
assert!((20f32 == 20f.to_f32()));
717-
assert!((20f64 == 20f.to_f64()));
718-
719-
assert!((20f == NumCast::from(20u)));
720-
assert!((20f == NumCast::from(20u8)));
721-
assert!((20f == NumCast::from(20u16)));
722-
assert!((20f == NumCast::from(20u32)));
723-
assert!((20f == NumCast::from(20u64)));
724-
assert!((20f == NumCast::from(20i)));
725-
assert!((20f == NumCast::from(20i8)));
726-
assert!((20f == NumCast::from(20i16)));
727-
assert!((20f == NumCast::from(20i32)));
728-
assert!((20f == NumCast::from(20i64)));
729-
assert!((20f == NumCast::from(20f)));
730-
assert!((20f == NumCast::from(20f32)));
731-
assert!((20f == NumCast::from(20f64)));
732-
733-
assert!((20f == num::cast(20u)));
734-
assert!((20f == num::cast(20u8)));
735-
assert!((20f == num::cast(20u16)));
736-
assert!((20f == num::cast(20u32)));
737-
assert!((20f == num::cast(20u64)));
738-
assert!((20f == num::cast(20i)));
739-
assert!((20f == num::cast(20i8)));
740-
assert!((20f == num::cast(20i16)));
741-
assert!((20f == num::cast(20i32)));
742-
assert!((20f == num::cast(20i64)));
743-
assert!((20f == num::cast(20f)));
744-
assert!((20f == num::cast(20f32)));
745-
assert!((20f == num::cast(20f64)));
746-
}
747-
748666

749667
//
750668
// Local Variables:

0 commit comments

Comments
 (0)