Skip to content

Commit b27e7ee

Browse files
eholkbrson
authored andcommitted
---
yaml --- r: 22063 b: refs/heads/snap-stage3 c: 135ebca h: refs/heads/master i: 22061: da3cd8f 22059: be2fba5 22055: 1af409c 22047: c666432 v: v3
1 parent 262353e commit b27e7ee

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f41cf208b7809bcb5cd12e81970802a52b2c265e
4+
refs/heads/snap-stage3: 135ebca8aa1bb546984c1915eac4e5c9bfdcf4d6
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcore/io.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ trait Reader {
4848
trait ReaderUtil {
4949
fn read_bytes(len: uint) -> ~[u8];
5050
fn read_line() -> ~str;
51+
52+
fn read_chars(n: uint) -> ~[char];
53+
fn read_char() -> char;
54+
fn read_c_str() -> ~str;
55+
fn read_le_uint(size: uint) -> uint;
56+
fn read_le_int(size: uint) -> int;
57+
fn read_be_uint(size: uint) -> uint;
58+
fn read_whole_stream() -> ~[u8];
59+
fn each_byte(it: fn(int) -> bool);
60+
fn each_char(it: fn(char) -> bool);
61+
fn each_line(it: fn((&str)) -> bool);
5162
}
5263

5364
impl<T: Reader> T : ReaderUtil {
@@ -69,12 +80,10 @@ impl<T: Reader> T : ReaderUtil {
6980
}
7081
str::from_bytes(buf)
7182
}
72-
}
7383

74-
impl Reader {
7584
fn read_chars(n: uint) -> ~[char] {
7685
// returns the (consumed offset, n_req), appends characters to &chars
77-
fn chars_from_bytes(buf: &~[u8], chars: &mut ~[char])
86+
fn chars_from_bytes<T: Reader>(buf: &~[u8], chars: &mut ~[char])
7887
-> (uint, uint) {
7988
let mut i = 0;
8089
let buf_len = buf.len();
@@ -120,7 +129,7 @@ impl Reader {
120129
break;
121130
}
122131
vec::push_all(buf, data);
123-
let (offset, nbreq) = chars_from_bytes(&buf, &mut chars);
132+
let (offset, nbreq) = chars_from_bytes::<T>(&buf, &mut chars);
124133
let ncreq = n - chars.len();
125134
// again we either know we need a certain number of bytes
126135
// to complete a character, or we make sure we don't

branches/snap-stage3/src/libstd/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
use core::cmp::{Eq, Ord};
1010
use result::{Result, Ok, Err};
11-
use io::WriterUtil;
11+
use io::{WriterUtil, ReaderUtil};
1212
use map::HashMap;
1313
use map::Map;
1414
use sort::Sort;

branches/snap-stage3/src/libstd/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use core::cmp::Eq;
55
use libc::{c_char, c_int, c_long, size_t, time_t};
6-
use io::Reader;
6+
use io::{Reader, ReaderUtil};
77
use result::{Result, Ok, Err};
88

99
export

branches/snap-stage3/src/libsyntax/parse/comments.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use io::println;//XXXXXXXXxxx
2+
use io::ReaderUtil;
23
use util::interner;
34
use lexer::{string_reader, bump, is_eof, nextch,
45
is_whitespace, get_str_from, reader};

branches/snap-stage3/src/rustc/driver/rustc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use core::*;
1212

1313
// -*- rust -*-
1414
use result::{Ok, Err};
15+
use io::ReaderUtil;
1516
use std::getopts;
1617
use std::map::HashMap;
1718
use getopts::{opt_present};

0 commit comments

Comments
 (0)