Skip to content

Commit 48f1f31

Browse files
committed
---
yaml --- r: 46973 b: refs/heads/try c: cc89029 h: refs/heads/master i: 46971: a92402a v: v3
1 parent dc78fa6 commit 48f1f31

File tree

20 files changed

+643
-697
lines changed

20 files changed

+643
-697
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: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: adac6cb5c61dfae79901264af4c235b66fb6267a
5+
refs/heads/try: cc8902994248930ef0902ff68483ce1991fa4e24
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: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use cmath;
1414
use cmp;
1515
use libc::{c_float, c_int};
1616
use num::NumCast;
17-
use num::strconv;
1817
use num;
1918
use ops;
2019
use option::Option;
@@ -377,8 +376,8 @@ impl num::Round for f32 {
377376
*/
378377
#[inline(always)]
379378
pub pure fn to_str(num: f32) -> ~str {
380-
let (r, _) = strconv::to_str_common(
381-
&num, 10u, true, true, strconv::SignNeg, strconv::DigAll);
379+
let (r, _) = num::to_str_common(
380+
&num, 10u, true, true, num::SignNeg, num::DigAll);
382381
r
383382
}
384383

@@ -391,8 +390,8 @@ pub pure fn to_str(num: f32) -> ~str {
391390
*/
392391
#[inline(always)]
393392
pub pure fn to_str_hex(num: f32) -> ~str {
394-
let (r, _) = strconv::to_str_common(
395-
&num, 16u, true, true, strconv::SignNeg, strconv::DigAll);
393+
let (r, _) = num::to_str_common(
394+
&num, 16u, true, true, num::SignNeg, num::DigAll);
396395
r
397396
}
398397

@@ -412,8 +411,8 @@ pub pure fn to_str_hex(num: f32) -> ~str {
412411
*/
413412
#[inline(always)]
414413
pub pure fn to_str_radix(num: f32, rdx: uint) -> ~str {
415-
let (r, special) = strconv::to_str_common(
416-
&num, rdx, true, true, strconv::SignNeg, strconv::DigAll);
414+
let (r, special) = num::to_str_common(
415+
&num, rdx, true, true, num::SignNeg, num::DigAll);
417416
if special { fail!(~"number has a special value, \
418417
try to_str_radix_special() if those are expected") }
419418
r
@@ -430,8 +429,7 @@ pub pure fn to_str_radix(num: f32, rdx: uint) -> ~str {
430429
*/
431430
#[inline(always)]
432431
pub pure fn to_str_radix_special(num: f32, rdx: uint) -> (~str, bool) {
433-
strconv::to_str_common(&num, rdx, true, true,
434-
strconv::SignNeg, strconv::DigAll)
432+
num::to_str_common(&num, rdx, true, true, num::SignNeg, num::DigAll)
435433
}
436434

437435
/**
@@ -445,8 +443,8 @@ pub pure fn to_str_radix_special(num: f32, rdx: uint) -> (~str, bool) {
445443
*/
446444
#[inline(always)]
447445
pub pure fn to_str_exact(num: f32, dig: uint) -> ~str {
448-
let (r, _) = strconv::to_str_common(
449-
&num, 10u, true, true, strconv::SignNeg, strconv::DigExact(dig));
446+
let (r, _) = num::to_str_common(
447+
&num, 10u, true, true, num::SignNeg, num::DigExact(dig));
450448
r
451449
}
452450

@@ -461,8 +459,8 @@ pub pure fn to_str_exact(num: f32, dig: uint) -> ~str {
461459
*/
462460
#[inline(always)]
463461
pub pure fn to_str_digits(num: f32, dig: uint) -> ~str {
464-
let (r, _) = strconv::to_str_common(
465-
&num, 10u, true, true, strconv::SignNeg, strconv::DigMax(dig));
462+
let (r, _) = num::to_str_common(
463+
&num, 10u, true, true, num::SignNeg, num::DigMax(dig));
466464
r
467465
}
468466

@@ -507,8 +505,7 @@ impl num::ToStrRadix for f32 {
507505
*/
508506
#[inline(always)]
509507
pub pure fn from_str(num: &str) -> Option<f32> {
510-
strconv::from_str_common(num, 10u, true, true, true,
511-
strconv::ExpDec, false)
508+
num::from_str_common(num, 10u, true, true, true, num::ExpDec, false)
512509
}
513510

514511
/**
@@ -540,8 +537,7 @@ pub pure fn from_str(num: &str) -> Option<f32> {
540537
*/
541538
#[inline(always)]
542539
pub pure fn from_str_hex(num: &str) -> Option<f32> {
543-
strconv::from_str_common(num, 16u, true, true, true,
544-
strconv::ExpBin, false)
540+
num::from_str_common(num, 16u, true, true, true, num::ExpBin, false)
545541
}
546542

547543
/**
@@ -565,8 +561,7 @@ pub pure fn from_str_hex(num: &str) -> Option<f32> {
565561
*/
566562
#[inline(always)]
567563
pub pure fn from_str_radix(num: &str, rdx: uint) -> Option<f32> {
568-
strconv::from_str_common(num, rdx, true, true, false,
569-
strconv::ExpNone, false)
564+
num::from_str_common(num, rdx, true, true, false, num::ExpNone, false)
570565
}
571566

572567
impl from_str::FromStr for f32 {

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

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use cmp;
1515
use libc::{c_double, c_int};
1616
use libc;
1717
use num::NumCast;
18-
use num::strconv;
1918
use num;
2019
use ops;
2120
use option::Option;
@@ -402,8 +401,8 @@ impl num::Round for f64 {
402401
*/
403402
#[inline(always)]
404403
pub pure fn to_str(num: f64) -> ~str {
405-
let (r, _) = strconv::to_str_common(
406-
&num, 10u, true, true, strconv::SignNeg, strconv::DigAll);
404+
let (r, _) = num::to_str_common(
405+
&num, 10u, true, true, num::SignNeg, num::DigAll);
407406
r
408407
}
409408

@@ -416,8 +415,8 @@ pub pure fn to_str(num: f64) -> ~str {
416415
*/
417416
#[inline(always)]
418417
pub pure fn to_str_hex(num: f64) -> ~str {
419-
let (r, _) = strconv::to_str_common(
420-
&num, 16u, true, true, strconv::SignNeg, strconv::DigAll);
418+
let (r, _) = num::to_str_common(
419+
&num, 16u, true, true, num::SignNeg, num::DigAll);
421420
r
422421
}
423422

@@ -437,8 +436,8 @@ pub pure fn to_str_hex(num: f64) -> ~str {
437436
*/
438437
#[inline(always)]
439438
pub pure fn to_str_radix(num: f64, rdx: uint) -> ~str {
440-
let (r, special) = strconv::to_str_common(
441-
&num, rdx, true, true, strconv::SignNeg, strconv::DigAll);
439+
let (r, special) = num::to_str_common(
440+
&num, rdx, true, true, num::SignNeg, num::DigAll);
442441
if special { fail!(~"number has a special value, \
443442
try to_str_radix_special() if those are expected") }
444443
r
@@ -455,8 +454,7 @@ pub pure fn to_str_radix(num: f64, rdx: uint) -> ~str {
455454
*/
456455
#[inline(always)]
457456
pub pure fn to_str_radix_special(num: f64, rdx: uint) -> (~str, bool) {
458-
strconv::to_str_common(&num, rdx, true, true,
459-
strconv::SignNeg, strconv::DigAll)
457+
num::to_str_common(&num, rdx, true, true, num::SignNeg, num::DigAll)
460458
}
461459

462460
/**
@@ -470,8 +468,8 @@ pub pure fn to_str_radix_special(num: f64, rdx: uint) -> (~str, bool) {
470468
*/
471469
#[inline(always)]
472470
pub pure fn to_str_exact(num: f64, dig: uint) -> ~str {
473-
let (r, _) = strconv::to_str_common(
474-
&num, 10u, true, true, strconv::SignNeg, strconv::DigExact(dig));
471+
let (r, _) = num::to_str_common(
472+
&num, 10u, true, true, num::SignNeg, num::DigExact(dig));
475473
r
476474
}
477475

@@ -486,8 +484,8 @@ pub pure fn to_str_exact(num: f64, dig: uint) -> ~str {
486484
*/
487485
#[inline(always)]
488486
pub pure fn to_str_digits(num: f64, dig: uint) -> ~str {
489-
let (r, _) = strconv::to_str_common(
490-
&num, 10u, true, true, strconv::SignNeg, strconv::DigMax(dig));
487+
let (r, _) = num::to_str_common(
488+
&num, 10u, true, true, num::SignNeg, num::DigMax(dig));
491489
r
492490
}
493491

@@ -532,8 +530,7 @@ impl num::ToStrRadix for f64 {
532530
*/
533531
#[inline(always)]
534532
pub pure fn from_str(num: &str) -> Option<f64> {
535-
strconv::from_str_common(num, 10u, true, true, true,
536-
strconv::ExpDec, false)
533+
num::from_str_common(num, 10u, true, true, true, num::ExpDec, false)
537534
}
538535

539536
/**
@@ -565,8 +562,7 @@ pub pure fn from_str(num: &str) -> Option<f64> {
565562
*/
566563
#[inline(always)]
567564
pub pure fn from_str_hex(num: &str) -> Option<f64> {
568-
strconv::from_str_common(num, 16u, true, true, true,
569-
strconv::ExpBin, false)
565+
num::from_str_common(num, 16u, true, true, true, num::ExpBin, false)
570566
}
571567

572568
/**
@@ -590,8 +586,7 @@ pub pure fn from_str_hex(num: &str) -> Option<f64> {
590586
*/
591587
#[inline(always)]
592588
pub pure fn from_str_radix(num: &str, rdx: uint) -> Option<f64> {
593-
strconv::from_str_common(num, rdx, true, true, false,
594-
strconv::ExpNone, false)
589+
num::from_str_common(num, rdx, true, true, false, num::ExpNone, false)
595590
}
596591

597592
impl from_str::FromStr for f64 {

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

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use cmp::{Eq, Ord};
2626
use cmp;
2727
use f64;
2828
use num::NumCast;
29-
use num::strconv;
3029
use num;
3130
use ops;
3231
use option::{None, Option, Some};
@@ -108,8 +107,8 @@ pub mod consts {
108107
*/
109108
#[inline(always)]
110109
pub pure fn to_str(num: float) -> ~str {
111-
let (r, _) = strconv::to_str_common(
112-
&num, 10u, true, true, strconv::SignNeg, strconv::DigAll);
110+
let (r, _) = num::to_str_common(
111+
&num, 10u, true, true, num::SignNeg, num::DigAll);
113112
r
114113
}
115114

@@ -122,8 +121,8 @@ pub pure fn to_str(num: float) -> ~str {
122121
*/
123122
#[inline(always)]
124123
pub pure fn to_str_hex(num: float) -> ~str {
125-
let (r, _) = strconv::to_str_common(
126-
&num, 16u, true, true, strconv::SignNeg, strconv::DigAll);
124+
let (r, _) = num::to_str_common(
125+
&num, 16u, true, true, num::SignNeg, num::DigAll);
127126
r
128127
}
129128

@@ -143,8 +142,8 @@ pub pure fn to_str_hex(num: float) -> ~str {
143142
*/
144143
#[inline(always)]
145144
pub pure fn to_str_radix(num: float, radix: uint) -> ~str {
146-
let (r, special) = strconv::to_str_common(
147-
&num, radix, true, true, strconv::SignNeg, strconv::DigAll);
145+
let (r, special) = num::to_str_common(
146+
&num, radix, true, true, num::SignNeg, num::DigAll);
148147
if special { fail!(~"number has a special value, \
149148
try to_str_radix_special() if those are expected") }
150149
r
@@ -161,8 +160,7 @@ pub pure fn to_str_radix(num: float, radix: uint) -> ~str {
161160
*/
162161
#[inline(always)]
163162
pub pure fn to_str_radix_special(num: float, radix: uint) -> (~str, bool) {
164-
strconv::to_str_common(&num, radix, true, true,
165-
strconv::SignNeg, strconv::DigAll)
163+
num::to_str_common(&num, radix, true, true, num::SignNeg, num::DigAll)
166164
}
167165
168166
/**
@@ -176,8 +174,8 @@ pub pure fn to_str_radix_special(num: float, radix: uint) -> (~str, bool) {
176174
*/
177175
#[inline(always)]
178176
pub pure fn to_str_exact(num: float, digits: uint) -> ~str {
179-
let (r, _) = strconv::to_str_common(
180-
&num, 10u, true, true, strconv::SignNeg, strconv::DigExact(digits));
177+
let (r, _) = num::to_str_common(
178+
&num, 10u, true, true, num::SignNeg, num::DigExact(digits));
181179
r
182180
}
183181
@@ -198,8 +196,8 @@ pub fn test_to_str_exact_do_decimal() {
198196
*/
199197
#[inline(always)]
200198
pub pure fn to_str_digits(num: float, digits: uint) -> ~str {
201-
let (r, _) = strconv::to_str_common(
202-
&num, 10u, true, true, strconv::SignNeg, strconv::DigMax(digits));
199+
let (r, _) = num::to_str_common(
200+
&num, 10u, true, true, num::SignNeg, num::DigMax(digits));
203201
r
204202
}
205203
@@ -244,8 +242,7 @@ impl num::ToStrRadix for float {
244242
*/
245243
#[inline(always)]
246244
pub pure fn from_str(num: &str) -> Option<float> {
247-
strconv::from_str_common(num, 10u, true, true, true,
248-
strconv::ExpDec, false)
245+
num::from_str_common(num, 10u, true, true, true, num::ExpDec, false)
249246
}
250247
251248
/**
@@ -277,8 +274,7 @@ pub pure fn from_str(num: &str) -> Option<float> {
277274
*/
278275
#[inline(always)]
279276
pub pure fn from_str_hex(num: &str) -> Option<float> {
280-
strconv::from_str_common(num, 16u, true, true, true,
281-
strconv::ExpBin, false)
277+
num::from_str_common(num, 16u, true, true, true, num::ExpBin, false)
282278
}
283279
284280
/**
@@ -302,8 +298,7 @@ pub pure fn from_str_hex(num: &str) -> Option<float> {
302298
*/
303299
#[inline(always)]
304300
pub pure fn from_str_radix(num: &str, radix: uint) -> Option<float> {
305-
strconv::from_str_common(num, radix, true, true, false,
306-
strconv::ExpNone, false)
301+
num::from_str_common(num, radix, true, true, false, num::ExpNone, false)
307302
}
308303
309304
impl from_str::FromStr for float {

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use cmp;
1616
use to_str::ToStr;
1717
use from_str::FromStr;
1818
use num::{ToStrRadix, FromStrRadix};
19-
use num::strconv;
2019
use num;
2120
use prelude::*;
2221
use str;
@@ -219,22 +218,22 @@ impl ops::Neg<T> for T {
219218
/// Parse a string as a number in base 10.
220219
#[inline(always)]
221220
pub pure fn from_str(s: &str) -> Option<T> {
222-
strconv::from_str_common(s, 10u, true, false, false,
223-
strconv::ExpNone, false)
221+
num::from_str_common(s, 10u, true, false, false,
222+
num::ExpNone, false)
224223
}
225224
226225
/// Parse a string as a number in the given base.
227226
#[inline(always)]
228227
pub pure fn from_str_radix(s: &str, radix: uint) -> Option<T> {
229-
strconv::from_str_common(s, radix, true, false, false,
230-
strconv::ExpNone, false)
228+
num::from_str_common(s, radix, true, false, false,
229+
num::ExpNone, false)
231230
}
232231
233232
/// Parse a byte slice as a number in the given base.
234233
#[inline(always)]
235234
pub pure fn parse_bytes(buf: &[u8], radix: uint) -> Option<T> {
236-
strconv::from_str_bytes_common(buf, radix, true, false, false,
237-
strconv::ExpNone, false)
235+
num::from_str_bytes_common(buf, radix, true, false, false,
236+
num::ExpNone, false)
238237
}
239238
240239
impl FromStr for T {
@@ -256,24 +255,24 @@ impl FromStrRadix for T {
256255
/// Convert to a string as a byte slice in a given base.
257256
#[inline(always)]
258257
pub pure fn to_str_bytes<U>(n: T, radix: uint, f: fn(v: &[u8]) -> U) -> U {
259-
let (buf, _) = strconv::to_str_bytes_common(&n, radix, false, false,
260-
strconv::SignNeg, strconv::DigAll);
258+
let (buf, _) = num::to_str_bytes_common(&n, radix, false, false,
259+
num::SignNeg, num::DigAll);
261260
f(buf)
262261
}
263262
264263
/// Convert to a string in base 10.
265264
#[inline(always)]
266265
pub pure fn to_str(num: T) -> ~str {
267-
let (buf, _) = strconv::to_str_common(&num, 10u, false, false,
268-
strconv::SignNeg, strconv::DigAll);
266+
let (buf, _) = num::to_str_common(&num, 10u, false, false,
267+
num::SignNeg, num::DigAll);
269268
buf
270269
}
271270
272271
/// Convert to a string in a given base.
273272
#[inline(always)]
274273
pub pure fn to_str_radix(num: T, radix: uint) -> ~str {
275-
let (buf, _) = strconv::to_str_common(&num, radix, false, false,
276-
strconv::SignNeg, strconv::DigAll);
274+
let (buf, _) = num::to_str_common(&num, radix, false, false,
275+
num::SignNeg, num::DigAll);
277276
buf
278277
}
279278

0 commit comments

Comments
 (0)