Rename std::ioivec to std::io

This commit is contained in:
Brian Anderson 2011-08-11 19:14:38 -07:00
parent 0b71d1d445
commit 7d05da96f7
27 changed files with 148 additions and 148 deletions

View File

@ -30,7 +30,7 @@ import std::str;
import std::vec;
import std::ivec;
import std::int;
import std::ioivec;
import std::io;
import std::run;
import std::getopts;
import std::getopts::optopt;
@ -101,9 +101,9 @@ fn parse_input(sess: session::session, cfg: &ast::crate_cfg, input: str) ->
fn parse_input_src(sess: session::session, cfg: &ast::crate_cfg,
infile: str) -> {crate: @ast::crate, src: str} {
let srcbytes = if infile != "-" {
ioivec::file_reader(infile)
io::file_reader(infile)
} else {
ioivec::stdin()
io::stdin()
}.read_whole_stream();
let src = str::unsafe_from_bytes(srcbytes);
let crate = parser::parse_crate_from_source_str(infile, src, cfg,
@ -235,18 +235,18 @@ fn pretty_print_input(sess: session::session, cfg: ast::crate_cfg, input: str,
ppm_normal. { ann = pprust::no_ann(); }
}
pprust::print_crate(sess.get_codemap(), crate, input,
ioivec::string_reader(src), ioivec::stdout(), ann);
io::string_reader(src), io::stdout(), ann);
}
fn version(argv0: str) {
let vers = "unknown version";
let env_vers = #env("CFG_VERSION");
if str::byte_len(env_vers) != 0u { vers = env_vers; }
ioivec::stdout().write_str(#fmt("%s %s\n", argv0, vers));
io::stdout().write_str(#fmt("%s %s\n", argv0, vers));
}
fn usage(argv0: str) {
ioivec::stdout().write_str(#fmt("usage: %s [options] <input>\n", argv0) +
io::stdout().write_str(#fmt("usage: %s [options] <input>\n", argv0) +
"
options:
@ -507,7 +507,7 @@ fn main(args: vec[str]) {
}
let ls = opt_present(match, "ls");
if ls {
metadata::creader::list_file_metadata(ifile, ioivec::stdout());
metadata::creader::list_file_metadata(ifile, io::stdout());
ret;
}

View File

@ -15,7 +15,7 @@ import util::common;
import std::ivec;
import std::str;
import std::fs;
import std::ioivec;
import std::io;
import std::option;
import std::option::none;
import std::option::some;
@ -80,7 +80,7 @@ fn visit_item(e: env, i: &@ast::item) {
}
// A diagnostic function for dumping crate metadata to an output stream
fn list_file_metadata(path: str, out: ioivec::writer) {
fn list_file_metadata(path: str, out: io::writer) {
alt get_metadata_section(path) {
option::some(bytes) { decoder::list_crate_metadata(bytes, out); }
option::none. {

View File

@ -4,7 +4,7 @@ import std::ebmlivec;
import std::ivec;
import std::option;
import std::str;
import std::ioivec;
import std::io;
import std::map::hashmap;
import syntax::ast;
import front::attr;
@ -343,13 +343,13 @@ fn get_attributes(md: &ebmlivec::doc) -> [ast::attribute] {
ret attrs;
}
fn list_meta_items(meta_items: &ebmlivec::doc, out: ioivec::writer) {
fn list_meta_items(meta_items: &ebmlivec::doc, out: io::writer) {
for mi: @ast::meta_item in get_meta_items(meta_items) {
out.write_str(#fmt("%s\n", pprust::meta_item_to_str(*mi)));
}
}
fn list_crate_attributes(md: &ebmlivec::doc, out: ioivec::writer) {
fn list_crate_attributes(md: &ebmlivec::doc, out: io::writer) {
out.write_str("=Crate Attributes=\n");
for attr: ast::attribute in get_attributes(md) {
@ -379,7 +379,7 @@ fn get_crate_deps(data: @[u8]) -> [crate_dep] {
ret deps;
}
fn list_crate_deps(data: @[u8], out: ioivec::writer) {
fn list_crate_deps(data: @[u8], out: io::writer) {
out.write_str("=External Dependencies=\n");
for dep: crate_dep in get_crate_deps(data) {
@ -389,7 +389,7 @@ fn list_crate_deps(data: @[u8], out: ioivec::writer) {
out.write_str("\n");
}
fn list_crate_items(bytes: &@[u8], md: &ebmlivec::doc, out: ioivec::writer) {
fn list_crate_items(bytes: &@[u8], md: &ebmlivec::doc, out: io::writer) {
out.write_str("=Items=\n");
let paths = ebmlivec::get_doc(md, tag_paths);
let items = ebmlivec::get_doc(md, tag_items);
@ -410,7 +410,7 @@ fn list_crate_items(bytes: &@[u8], md: &ebmlivec::doc, out: ioivec::writer) {
out.write_str("\n");
}
fn list_crate_metadata(bytes: &@[u8], out: ioivec::writer) {
fn list_crate_metadata(bytes: &@[u8], out: io::writer) {
let md = ebmlivec::new_doc(bytes);
list_crate_attributes(md, out);
list_crate_deps(bytes, out);

View File

@ -3,7 +3,7 @@
import std::ivec;
import std::str;
import std::uint;
import std::ioivec;
import std::io;
import std::option;
import std::option::some;
import std::option::none;
@ -201,7 +201,7 @@ fn encode_type(ecx: &@encode_ctxt, ebml_w: &ebmlivec::writer, typ: &ty::t) {
@{ds: f,
tcx: ecx.ccx.tcx,
abbrevs: tyencode::ac_use_abbrevs(ecx.type_abbrevs)};
tyencode::enc_ty(ioivec::new_writer_(ebml_w.writer), ty_str_ctxt, typ);
tyencode::enc_ty(io::new_writer_(ebml_w.writer), ty_str_ctxt, typ);
ebmlivec::end_tag(ebml_w);
}
@ -409,8 +409,8 @@ fn create_index[T](index: &[entry[T]], hash_fn: fn(&T) -> uint ) ->
}
fn encode_index[T](ebml_w: &ebmlivec::writer, buckets: &[@[entry[T]]],
write_fn: fn(&ioivec::writer, &T) ) {
let writer = ioivec::new_writer_(ebml_w.writer);
write_fn: fn(&io::writer, &T) ) {
let writer = io::new_writer_(ebml_w.writer);
ebmlivec::start_tag(ebml_w, tag_index);
let bucket_locs: [uint] = ~[];
ebmlivec::start_tag(ebml_w, tag_index_buckets);
@ -432,9 +432,9 @@ fn encode_index[T](ebml_w: &ebmlivec::writer, buckets: &[@[entry[T]]],
ebmlivec::end_tag(ebml_w);
}
fn write_str(writer: &ioivec::writer, s: &str) { writer.write_str(s); }
fn write_str(writer: &io::writer, s: &str) { writer.write_str(s); }
fn write_int(writer: &ioivec::writer, n: &int) {
fn write_int(writer: &io::writer, n: &int) {
writer.write_be_uint(n as uint, 4u);
}
@ -586,7 +586,7 @@ fn encode_metadata(cx: &@crate_ctxt, crate: &@crate) -> str {
let abbrevs = map::mk_hashmap(ty::hash_ty, ty::eq_ty);
let ecx = @{ccx: cx, type_abbrevs: abbrevs};
let string_w = ioivec::string_writer();
let string_w = io::string_writer();
let buf_w = string_w.get_writer().get_buf_writer();
let ebml_w = ebmlivec::create_writer(buf_w);
@ -619,7 +619,7 @@ fn encode_metadata(cx: &@crate_ctxt, crate: &@crate) -> str {
// Get the encoded string for a type
fn encoded_ty(tcx: &ty::ctxt, t: &ty::t) -> str {
let cx = @{ds: def_to_str, tcx: tcx, abbrevs: tyencode::ac_no_abbrevs};
let sw = ioivec::string_writer();
let sw = io::string_writer();
tyencode::enc_ty(sw.get_writer(), cx, t);
ret sw.get_str();
}

View File

@ -1,6 +1,6 @@
// Type encoding
import std::ioivec;
import std::io;
import std::map::hashmap;
import std::option::some;
import std::option::none;
@ -35,14 +35,14 @@ fn cx_uses_abbrevs(cx: &@ctxt) -> bool {
}
}
fn enc_ty(w: &ioivec::writer, cx: &@ctxt, t: &ty::t) {
fn enc_ty(w: &io::writer, cx: &@ctxt, t: &ty::t) {
alt cx.abbrevs {
ac_no_abbrevs. {
let result_str;
alt cx.tcx.short_names_cache.find(t) {
some(s) { result_str = s; }
none. {
let sw = ioivec::string_writer();
let sw = io::string_writer();
enc_sty(sw.get_writer(), cx, ty::struct(cx.tcx, t));
result_str = sw.get_str();
cx.tcx.short_names_cache.insert(t, result_str);
@ -80,7 +80,7 @@ fn enc_ty(w: &ioivec::writer, cx: &@ctxt, t: &ty::t) {
}
}
}
fn enc_mt(w: &ioivec::writer, cx: &@ctxt, mt: &ty::mt) {
fn enc_mt(w: &io::writer, cx: &@ctxt, mt: &ty::mt) {
alt mt.mut {
imm. { }
mut. { w.write_char('m'); }
@ -88,7 +88,7 @@ fn enc_mt(w: &ioivec::writer, cx: &@ctxt, mt: &ty::mt) {
}
enc_ty(w, cx, mt.ty);
}
fn enc_sty(w: &ioivec::writer, cx: &@ctxt, st: &ty::sty) {
fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
alt st {
ty::ty_nil. { w.write_char('n'); }
ty::ty_bot. { w.write_char('z'); }
@ -192,7 +192,7 @@ fn enc_sty(w: &ioivec::writer, cx: &@ctxt, st: &ty::sty) {
}
}
}
fn enc_proto(w: &ioivec::writer, proto: proto) {
fn enc_proto(w: &io::writer, proto: proto) {
alt proto {
proto_iter. { w.write_char('W'); }
proto_fn. { w.write_char('F'); }
@ -200,7 +200,7 @@ fn enc_proto(w: &ioivec::writer, proto: proto) {
}
}
fn enc_ty_fn(w: &ioivec::writer, cx: &@ctxt, args: &[ty::arg], out: &ty::t,
fn enc_ty_fn(w: &io::writer, cx: &@ctxt, args: &[ty::arg], out: &ty::t,
cf: &controlflow, constrs: &[@ty::constr]) {
w.write_char('[');
for arg: ty::arg in args {
@ -230,7 +230,7 @@ fn enc_ty_fn(w: &ioivec::writer, cx: &@ctxt, args: &[ty::arg], out: &ty::t,
}
// FIXME less copy-and-paste
fn enc_constr(w: &ioivec::writer, cx: &@ctxt, c: &@ty::constr) {
fn enc_constr(w: &io::writer, cx: &@ctxt, c: &@ty::constr) {
w.write_str(path_to_str(c.node.path));
w.write_char('(');
w.write_str(cx.ds(c.node.id));
@ -247,7 +247,7 @@ fn enc_constr(w: &ioivec::writer, cx: &@ctxt, c: &@ty::constr) {
w.write_char(')');
}
fn enc_ty_constr(w: &ioivec::writer, cx: &@ctxt, c: &@ty::type_constr) {
fn enc_ty_constr(w: &io::writer, cx: &@ctxt, c: &@ty::type_constr) {
w.write_str(path_to_str(c.node.path));
w.write_char('(');
w.write_str(cx.ds(c.node.id));

View File

@ -2,7 +2,7 @@ import std::ivec;
import std::uint;
import std::str;
import std::termivec;
import std::ioivec;
import std::io;
import std::option;
import std::option::some;
import std::option::none;
@ -84,15 +84,15 @@ fn emit_diagnostic(sp: &option::t[span], msg: &str, kind: &str, color: u8,
}
none. { }
}
ioivec::stdout().write_str(ss + ": ");
io::stdout().write_str(ss + ": ");
if termivec::color_supported() {
termivec::fg(ioivec::stdout().get_buf_writer(), color);
termivec::fg(io::stdout().get_buf_writer(), color);
}
ioivec::stdout().write_str(#fmt("%s:", kind));
io::stdout().write_str(#fmt("%s:", kind));
if termivec::color_supported() {
termivec::reset(ioivec::stdout().get_buf_writer());
termivec::reset(io::stdout().get_buf_writer());
}
ioivec::stdout().write_str(#fmt(" %s\n", msg));
io::stdout().write_str(#fmt(" %s\n", msg));
maybe_highlight_lines(sp, cm, maybe_lines);
}
@ -108,7 +108,7 @@ fn maybe_highlight_lines(sp: &option::t[span], cm: &codemap,
// FIXME: reading in the entire file is the worst possible way to
// get access to the necessary lines.
let file = ioivec::read_whole_file_str(lines.name);
let file = io::read_whole_file_str(lines.name);
let fm = get_filemap(cm, lines.name);
// arbitrarily only print up to six lines of the error
@ -121,10 +121,10 @@ fn maybe_highlight_lines(sp: &option::t[span], cm: &codemap,
}
// Print the offending lines
for line: uint in display_lines {
ioivec::stdout().write_str(#fmt("%s:%u ", fm.name, line + 1u));
io::stdout().write_str(#fmt("%s:%u ", fm.name, line + 1u));
let s = get_line(fm, line as int, file);
if !str::ends_with(s, "\n") { s += "\n"; }
ioivec::stdout().write_str(s);
io::stdout().write_str(s);
}
if elided {
let last_line = display_lines.(ivec::len(display_lines) - 1u);
@ -133,7 +133,7 @@ fn maybe_highlight_lines(sp: &option::t[span], cm: &codemap,
let out = "";
while indent > 0u { out += " "; indent -= 1u; }
out += "...\n";
ioivec::stdout().write_str(out);
io::stdout().write_str(out);
}
@ -158,7 +158,7 @@ fn maybe_highlight_lines(sp: &option::t[span], cm: &codemap,
let width = hi.col - lo.col - 1u;
while width > 0u { str::push_char(s, '~'); width -= 1u; }
}
ioivec::stdout().write_str(s + "\n");
io::stdout().write_str(s + "\n");
}
}
_ { }

View File

@ -1,5 +1,5 @@
import std::ioivec;
import std::io;
import std::int;
import std::ivec;
import std::str;
@ -709,7 +709,7 @@ fn is_lit(t: &token::token) -> bool {
type lit = {lit: str, pos: uint};
fn gather_comments_and_literals(cm: &codemap::codemap, path: str,
srdr: ioivec::reader) ->
srdr: io::reader) ->
{cmnts: [cmnt], lits: [lit]} {
let src = str::unsafe_from_bytes(srdr.read_whole_stream());
let itr = @interner::mk[str](str::hash, str::eq);

View File

@ -1,5 +1,5 @@
import std::ioivec;
import std::io;
import std::ivec;
import std::str;
import std::option;
@ -62,7 +62,7 @@ fn new_parser_from_file(sess: parse_sess, cfg:
ast::crate_cfg, path: str,
chpos: uint, byte_pos: uint,
ftype: file_type) -> parser {
let src = ioivec::read_whole_file_str(path);
let src = io::read_whole_file_str(path);
let filemap = codemap::new_filemap(path, chpos, byte_pos);
sess.cm.files += ~[filemap];
let itr = @interner::mk(str::hash, str::eq);

View File

@ -1,5 +1,5 @@
import std::ioivec;
import std::io;
import std::ivec;
import std::str;
@ -98,7 +98,7 @@ type print_stack_elt = {offset: int, pbreak: print_stack_break};
const size_infinity: int = 0xffff;
fn mk_printer(out: ioivec::writer, linewidth: uint) -> printer {
fn mk_printer(out: io::writer, linewidth: uint) -> printer {
// Yes 3, it makes the ring buffers big enough to never
// fall behind.
@ -198,7 +198,7 @@ fn mk_printer(out: ioivec::writer, linewidth: uint) -> printer {
* the method called 'pretty_print', and the 'PRINT' process is the method
* called 'print'.
*/
obj printer(out: ioivec::writer,
obj printer(out: io::writer,
buf_len: uint,
mutable margin: int, // width of lines we're constrained to

View File

@ -1,7 +1,7 @@
import std::ivec;
import std::int;
import std::ioivec;
import std::io;
import std::str;
import std::uint;
import std::option;
@ -52,7 +52,7 @@ fn ibox(s: &ps, u: uint) { s.boxes += ~[pp::inconsistent]; pp::ibox(s.s, u); }
fn end(s: &ps) { ivec::pop(s.boxes); pp::end(s.s); }
fn rust_printer(writer: ioivec::writer) -> ps {
fn rust_printer(writer: io::writer) -> ps {
let boxes: [pp::breaks] = ~[];
ret @{s: pp::mk_printer(writer, default_columns),
cm: none[codemap],
@ -73,7 +73,7 @@ const default_columns: uint = 78u;
// it can scan the input text for comments and literals to
// copy forward.
fn print_crate(cm: &codemap, crate: @ast::crate, filename: str,
in: ioivec::reader, out: ioivec::writer, ann: &pp_ann) {
in: io::reader, out: io::writer, ann: &pp_ann) {
let boxes: [pp::breaks] = ~[];
let r = lexer::gather_comments_and_literals(cm, filename, in);
let s =
@ -103,7 +103,7 @@ fn item_to_str(i: &@ast::item) -> str { be to_str(i, print_item); }
fn path_to_str(p: &ast::path) -> str { be to_str(p, print_path); }
fn fun_to_str(f: &ast::_fn, name: str, params: &[ast::ty_param]) -> str {
let writer = ioivec::string_writer();
let writer = io::string_writer();
let s = rust_printer(writer.get_writer());
print_fn(s, f.decl, f.proto, name, params, f.decl.constraints);
eof(s.s);
@ -111,7 +111,7 @@ fn fun_to_str(f: &ast::_fn, name: str, params: &[ast::ty_param]) -> str {
}
fn block_to_str(blk: &ast::blk) -> str {
let writer = ioivec::string_writer();
let writer = io::string_writer();
let s = rust_printer(writer.get_writer());
// containing cbox, will be closed by print-block at }
@ -1494,7 +1494,7 @@ fn escape_str(st: str, to_escape: char) -> str {
}
fn to_str[T](t: &T, f: fn(&ps, &T) ) -> str {
let writer = ioivec::string_writer();
let writer = io::string_writer();
let s = rust_printer(writer.get_writer());
f(s, t);
eof(s.s);

View File

@ -14,9 +14,9 @@ import syntax::codemap::span;
import ast::lit;
import ast::path;
import syntax::visit;
import std::ioivec::stdout;
import std::ioivec::str_writer;
import std::ioivec::string_writer;
import std::io::stdout;
import std::io::str_writer;
import std::io::string_writer;
import syntax::print;
import print::pprust::print_block;
import print::pprust::print_item;

View File

@ -6,8 +6,8 @@ import std::getopts;
import std::getopts::optopt;
import std::getopts::opt_present;
import std::getopts::opt_str;
import std::ioivec;
import std::ioivec::stdout;
import std::io;
import std::io::stdout;
import std::vec;
import std::ivec;
import std::str;
@ -22,15 +22,15 @@ import rustc::syntax::parse::parser;
import rustc::syntax::print::pprust;
fn write_file(filename: &str, content: &str) {
ioivec::file_writer(filename,
~[ioivec::create,
ioivec::truncate]).write_str(content);
io::file_writer(filename,
~[io::create,
io::truncate]).write_str(content);
// Work around https://github.com/graydon/rust/issues/726
std::run::run_program("chmod", ["644", filename]);
}
fn file_contains(filename: &str, needle: &str) -> bool {
let contents = ioivec::read_whole_file_str(filename);
let contents = io::read_whole_file_str(filename);
ret str::find(contents, needle) != -1;
}
@ -139,10 +139,10 @@ iter under(n: uint) -> uint {
while i < n { put i; i += 1u; }
}
fn devnull() -> ioivec::writer { std::ioivec::string_writer().get_writer() }
fn devnull() -> io::writer { std::io::string_writer().get_writer() }
fn as_str(f: fn(ioivec::writer) ) -> str {
let w = std::ioivec::string_writer();
fn as_str(f: fn(io::writer) ) -> str {
let w = std::io::string_writer();
f(w.get_writer());
ret w.get_str();
}
@ -159,7 +159,7 @@ fn check_variants_of_ast(crate: &ast::crate, codemap: &codemap::codemap, filenam
// It would be best to test the *crate* for stability, but testing the
// string for stability is easier and ok for now.
let str3 = as_str(bind pprust::print_crate(codemap, crate2, filename,
ioivec::string_reader(""), _,
io::string_reader(""), _,
pprust::no_ann()));
// 1u would be sane here, but the pretty-printer currently has lots of whitespace and paren issues,
// and https://github.com/graydon/rust/issues/766 is hilarious.
@ -229,7 +229,7 @@ fn parse_and_print(code: &str) -> str {
let crate =
parser::parse_crate_from_source_str(filename, code, ~[], sess);
ret as_str(bind pprust::print_crate(sess.cm, crate, filename,
ioivec::string_reader(code), _,
io::string_reader(code), _,
pprust::no_ann()));
}
@ -320,7 +320,7 @@ fn check_convergence(files: &[str]) {
log_err #fmt("pp convergence tests: %u files", ivec::len(files));
for file in files {
if !file_is_confusing(file) {
let s = ioivec::read_whole_file_str(file);
let s = io::read_whole_file_str(file);
if !content_is_confusing(s) {
log_err #fmt("pp converge: %s", file);
// Change from 7u to 2u when https://github.com/graydon/rust/issues/759 is fixed
@ -333,13 +333,13 @@ fn check_convergence(files: &[str]) {
fn check_variants(files: &[str]) {
for file in files {
if !file_is_confusing(file) {
let s = ioivec::read_whole_file_str(file);
let s = io::read_whole_file_str(file);
if content_is_dangerous_to_modify(s) || content_is_confusing(s) { cont; }
log_err "check_variants: " + file;
let sess = @{cm: codemap::new_codemap(), mutable next_id: 0};
let crate = parser::parse_crate_from_source_str(file, s, ~[], sess);
log_err as_str(bind pprust::print_crate(sess.cm, crate, file,
ioivec::string_reader(s), _,
io::string_reader(s), _,
pprust::no_ann()));
check_variants_of_ast(*crate, sess.cm, file);
}

View File

@ -117,9 +117,9 @@ fn doc_as_uint(d: doc) -> uint {
// ebml writing
type writer = {writer: ioivec::buf_writer, mutable size_positions: [uint]};
type writer = {writer: io::buf_writer, mutable size_positions: [uint]};
fn write_sized_vint(w: &ioivec::buf_writer, n: uint, size: uint) {
fn write_sized_vint(w: &io::buf_writer, n: uint, size: uint) {
let buf: [u8];
alt size {
1u { buf = ~[0x80u8 | (n as u8)]; }
@ -139,7 +139,7 @@ fn write_sized_vint(w: &ioivec::buf_writer, n: uint, size: uint) {
w.write(buf);
}
fn write_vint(w: &ioivec::buf_writer, n: uint) {
fn write_vint(w: &io::buf_writer, n: uint) {
if n < 0x7fu { write_sized_vint(w, n, 1u); ret; }
if n < 0x4000u { write_sized_vint(w, n, 2u); ret; }
if n < 0x200000u { write_sized_vint(w, n, 3u); ret; }
@ -148,7 +148,7 @@ fn write_vint(w: &ioivec::buf_writer, n: uint) {
fail;
}
fn create_writer(w: &ioivec::buf_writer) -> writer {
fn create_writer(w: &io::buf_writer) -> writer {
let size_positions: [uint] = ~[];
ret {writer: w, mutable size_positions: size_positions};
}
@ -169,9 +169,9 @@ fn start_tag(w: &writer, tag_id: uint) {
fn end_tag(w: &writer) {
let last_size_pos = ivec::pop[uint](w.size_positions);
let cur_pos = w.writer.tell();
w.writer.seek(last_size_pos as int, ioivec::seek_set);
w.writer.seek(last_size_pos as int, io::seek_set);
write_sized_vint(w.writer, cur_pos - last_size_pos - 4u, 4u);
w.writer.seek(cur_pos as int, ioivec::seek_set);
w.writer.seek(cur_pos as int, io::seek_set);
}
// TODO: optionally perform "relaxations" on end_tag to more efficiently
// encode sizes; this is a fixed point iteration

View File

@ -36,9 +36,9 @@ fn run_program(prog: str, args: vec[str]) -> int {
type program =
obj {
fn get_id() -> int;
fn input() -> ioivec::writer;
fn output() -> ioivec::reader;
fn err() -> ioivec::reader;
fn input() -> io::writer;
fn output() -> io::reader;
fn err() -> io::reader;
fn close_input();
fn finish() -> int;
fn destroy();
@ -65,17 +65,17 @@ fn start_program(prog: str, args: vec[str]) -> @program_res {
err_file: os::libc::FILE,
mutable finished: bool) {
fn get_id() -> int { ret pid; }
fn input() -> ioivec::writer {
ret ioivec::new_writer(
ioivec::fd_buf_writer(in_fd, option::none));
fn input() -> io::writer {
ret io::new_writer(
io::fd_buf_writer(in_fd, option::none));
}
fn output() -> ioivec::reader {
ret ioivec::new_reader(
ioivec::FILE_buf_reader(out_file, option::none));
fn output() -> io::reader {
ret io::new_reader(
io::FILE_buf_reader(out_file, option::none));
}
fn err() -> ioivec::reader {
ret ioivec::new_reader(
ioivec::FILE_buf_reader(err_file, option::none));
fn err() -> io::reader {
ret io::new_reader(
io::FILE_buf_reader(err_file, option::none));
}
fn close_input() {
let invalid_fd = -1;
@ -103,7 +103,7 @@ fn start_program(prog: str, args: vec[str]) -> @program_res {
false));
}
fn read_all(rd: &ioivec::reader) -> str {
fn read_all(rd: &io::reader) -> str {
let buf = "";
while !rd.eof() {
let bytes = rd.read_bytes(4096u);

View File

@ -20,7 +20,7 @@ mod str;
// General io and system-services modules.
mod ioivec;
mod io;
mod sys;
mod task;
mod comm;

View File

@ -40,9 +40,9 @@ const color_bright_cyan: u8 = 14u8;
const color_bright_white: u8 = 15u8;
fn esc(writer: ioivec::buf_writer) { writer.write(~[0x1bu8, '[' as u8]); }
fn esc(writer: io::buf_writer) { writer.write(~[0x1bu8, '[' as u8]); }
fn reset(writer: ioivec::buf_writer) {
fn reset(writer: io::buf_writer) {
esc(writer);
writer.write(~['0' as u8, 'm' as u8]);
}
@ -55,18 +55,18 @@ fn color_supported() -> bool {
};
}
fn set_color(writer: ioivec::buf_writer, first_char: u8, color: u8) {
fn set_color(writer: io::buf_writer, first_char: u8, color: u8) {
assert (color < 16u8);
esc(writer);
if color >= 8u8 { writer.write(~['1' as u8, ';' as u8]); color -= 8u8; }
writer.write(~[first_char, ('0' as u8) + color, 'm' as u8]);
}
fn fg(writer: ioivec::buf_writer, color: u8) {
fn fg(writer: io::buf_writer, color: u8) {
ret set_color(writer, '3' as u8, color);
}
fn bg(writer: ioivec::buf_writer, color: u8) {
fn bg(writer: io::buf_writer, color: u8) {
ret set_color(writer, '4' as u8, color);
}
// export fg;

View File

@ -40,9 +40,9 @@ const color_bright_cyan: u8 = 14u8;
const color_bright_white: u8 = 15u8;
fn esc(writer: ioivec::buf_writer) { writer.write(~[0x1bu8, '[' as u8]); }
fn esc(writer: io::buf_writer) { writer.write(~[0x1bu8, '[' as u8]); }
fn reset(writer: ioivec::buf_writer) {
fn reset(writer: io::buf_writer) {
esc(writer);
writer.write(~['0' as u8, 'm' as u8]);
}
@ -60,18 +60,18 @@ fn color_supported() -> bool {
};
}
fn set_color(writer: ioivec::buf_writer, first_char: u8, color: u8) {
fn set_color(writer: io::buf_writer, first_char: u8, color: u8) {
assert (color < 16u8);
esc(writer);
if color >= 8u8 { writer.write(~['1' as u8, ';' as u8]); color -= 8u8; }
writer.write(~[first_char, ('0' as u8) + color, 'm' as u8]);
}
fn fg(writer: ioivec::buf_writer, color: u8) {
fn fg(writer: io::buf_writer, color: u8) {
ret set_color(writer, '3' as u8, color);
}
fn bg(writer: ioivec::buf_writer, color: u8) {
fn bg(writer: io::buf_writer, color: u8) {
ret set_color(writer, '4' as u8, color);
}
// export fg;

View File

@ -106,7 +106,7 @@ fn run_tests_console_(opts: &test_opts, tests: &[test_desc],
to_task: &test_to_task) -> bool {
type test_state = @{
out: ioivec::writer,
out: io::writer,
use_color: bool,
mutable total: uint,
mutable passed: uint,
@ -148,7 +148,7 @@ fn run_tests_console_(opts: &test_opts, tests: &[test_desc],
}
let st = @{
out: ioivec::stdout(),
out: io::stdout(),
use_color: use_color(),
mutable total: 0u,
mutable passed: 0u,
@ -181,19 +181,19 @@ fn run_tests_console_(opts: &test_opts, tests: &[test_desc],
ret success;
fn write_ok(out: &ioivec::writer, use_color: bool) {
fn write_ok(out: &io::writer, use_color: bool) {
write_pretty(out, "ok", term::color_green, use_color);
}
fn write_failed(out: &ioivec::writer, use_color: bool) {
fn write_failed(out: &io::writer, use_color: bool) {
write_pretty(out, "FAILED", term::color_red, use_color);
}
fn write_ignored(out: &ioivec::writer, use_color: bool) {
fn write_ignored(out: &io::writer, use_color: bool) {
write_pretty(out, "ignored", term::color_yellow, use_color);
}
fn write_pretty(out: &ioivec::writer, word: &str, color: u8,
fn write_pretty(out: &io::writer, word: &str, color: u8,
use_color: bool) {
if use_color && term::color_supported() {
term::fg(out.get_buf_writer(), color);

View File

@ -17,7 +17,7 @@ import std::uint;
import std::time;
import std::str;
import std::int::range;
import std::ioivec;
import std::io;
import std::getopts;
import std::task;
import std::u64;
@ -94,7 +94,7 @@ fn main(argv: vec[str]) {
let num_trials = 10;
let out = ioivec::stdout();
let out = io::stdout();
for each n: int in range(1, max + 1) {

View File

@ -17,7 +17,7 @@ import std::str;
import std::vec;
import std::map;
import std::ivec;
import std::ioivec;
import std::io;
import std::time;
import std::u64;
@ -27,7 +27,7 @@ import clone = std::task::clone_chan;
fn map(filename: str, emit: map_reduce::putter) {
// log_err "mapping " + filename;
let f = ioivec::file_reader(filename);
let f = io::file_reader(filename);
while true {
@ -51,7 +51,7 @@ fn reduce(word: str, get: map_reduce::getter) {
}
}
// auto out = ioivec::stdout();
// auto out = io::stdout();
// out.write_line(#fmt("%s: %d", word, count));
// log_err "reduce " + word + " done.";
@ -226,7 +226,7 @@ mod map_reduce {
fn main(argv: vec[str]) {
if vec::len(argv) < 2u {
let out = ioivec::stdout();
let out = io::stdout();
out.write_line(#fmt("Usage: %s <filename> ...", argv.(0)));
@ -251,7 +251,7 @@ fn main(argv: vec[str]) {
log_err "MapReduce completed in " + u64::str(elapsed) + "ms";
}
fn read_word(r: ioivec::reader) -> option[str] {
fn read_word(r: io::reader) -> option[str] {
let w = "";
while !r.eof() {

View File

@ -1,6 +1,6 @@
import std::option;
import std::str;
import std::ioivec;
import std::io;
import std::fs;
import common::config;
@ -69,7 +69,7 @@ fn is_test_ignored(config: &config, testfile: &str) -> bool {
}
iter iter_header(testfile: &str) -> str {
let rdr = ioivec::file_reader(testfile);
let rdr = io::file_reader(testfile);
while !rdr.eof() {
let ln = rdr.read_line();

View File

@ -12,7 +12,7 @@ import std::ivec;
import std::os;
import std::run;
import std::unsafe;
import std::ioivec;
import std::io;
import std::str;
export handle;
@ -73,8 +73,8 @@ fn run(handle: &handle, lib_path: &str,
fn writeclose(fd: int, s: &option::t[str]) {
if option::is_some(s) {
let writer = ioivec::new_writer(
ioivec::fd_buf_writer(fd, option::none));
let writer = io::new_writer(
io::fd_buf_writer(fd, option::none));
writer.write_str(option::get(s));
}
@ -84,8 +84,8 @@ fn writeclose(fd: int, s: &option::t[str]) {
fn readclose(fd: int) -> str {
// Copied from run::program_output
let file = os::fd_FILE(fd);
let reader = ioivec::new_reader(
ioivec::FILE_buf_reader(file, option::none));
let reader = io::new_reader(
io::FILE_buf_reader(file, option::none));
let buf = "";
while !reader.eof() {
let bytes = reader.read_bytes(4096u);

View File

@ -1,4 +1,4 @@
import std::ioivec;
import std::io;
import std::str;
import std::option;
import std::vec;
@ -23,7 +23,7 @@ fn run(cx: &cx, testfile: &str) {
test::configure_test_task();
if (cx.config.verbose) {
// We're going to be dumping a lot of info. Start on a new line.
ioivec::stdout().write_str("\n\n");
io::stdout().write_str("\n\n");
}
log #fmt("running %s", testfile);
let props = load_props(testfile);
@ -95,7 +95,7 @@ fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) {
option::none. { 2 }
};
let srcs = ~[ioivec::read_whole_file_str(testfile)];
let srcs = ~[io::read_whole_file_str(testfile)];
let round = 0;
while round < rounds {
@ -114,7 +114,7 @@ fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) {
let expected = alt props.pp_exact {
option::some(file) {
let filepath = fs::connect(fs::dirname(testfile), file);
ioivec::read_whole_file_str(filepath)
io::read_whole_file_str(filepath)
}
option::none. {
srcs.(ivec::len(srcs) - 2u)
@ -167,7 +167,7 @@ actual:\n\
------------------------------------------\n\
\n",
expected, actual);
ioivec::stdout().write_str(msg);
io::stdout().write_str(msg);
fail;
}
}
@ -335,8 +335,8 @@ fn dump_output(config: &config, testfile: &str,
fn dump_output_file(config: &config, testfile: &str,
out: &str, extension: &str) {
let outfile = make_out_name(config, testfile, extension);
let writer = ioivec::file_writer(outfile,
~[ioivec::create, ioivec::truncate]);
let writer = io::file_writer(outfile,
~[io::create, io::truncate]);
writer.write_str(out);
}
@ -370,15 +370,15 @@ fn maybe_dump_to_stdout(config: &config,
let sep2 = #fmt("------%s------------------------------",
"stderr");
let sep3 = "------------------------------------------";
ioivec::stdout().write_line(sep1);
ioivec::stdout().write_line(out);
ioivec::stdout().write_line(sep2);
ioivec::stdout().write_line(err);
ioivec::stdout().write_line(sep3);
io::stdout().write_line(sep1);
io::stdout().write_line(out);
io::stdout().write_line(sep2);
io::stdout().write_line(err);
io::stdout().write_line(sep3);
}
}
fn error(err: &str) { ioivec::stdout().write_line(#fmt("\nerror: %s", err)); }
fn error(err: &str) { io::stdout().write_line(#fmt("\nerror: %s", err)); }
fn fatal(err: &str) -> ! { error(err); fail; }
@ -397,6 +397,6 @@ stderr:\n\
------------------------------------------\n\
\n",
err, procres.cmdline, procres.stdout, procres.stderr);
ioivec::stdout().write_str(msg);
io::stdout().write_str(msg);
fail;
}

View File

@ -1,6 +1,6 @@
import std::option;
import std::generic_os::getenv;
import std::ioivec;
import std::io;
import common::config;
@ -25,5 +25,5 @@ fn lib_path_env_var() -> str { "PATH" }
fn logv(config: &config, s: &str) {
log s;
if config.verbose { ioivec::stdout().write_line(s); }
if config.verbose { io::stdout().write_line(s); }
}

View File

@ -1,6 +1,6 @@
// -*- rust -*-
use std;
import std::ioivec;
import std::io;
import std::str;
#[cfg(target_os = "linux")]
@ -12,11 +12,11 @@ fn test_simple() {
let frood: str = "A hoopy frood who really knows where his towel is.";
log frood;
{
let out: ioivec::writer =
ioivec::file_writer(tmpfile, ~[ioivec::create, ioivec::truncate]);
let out: io::writer =
io::file_writer(tmpfile, ~[io::create, io::truncate]);
out.write_str(frood);
}
let inp: ioivec::reader = ioivec::file_reader(tmpfile);
let inp: io::reader = io::file_reader(tmpfile);
let frood2: str = inp.read_c_str();
log frood2;
assert (str::eq(frood, frood2));

View File

@ -1,7 +1,7 @@
use std;
import std::run;
import std::os;
import std::ioivec;
import std::io;
import std::option;
import std::str;
import std::ivec;
@ -46,8 +46,8 @@ fn test_pipes() {
assert expected == actual;
fn writeclose(fd: int, s: &str) {
let writer = ioivec::new_writer(
ioivec::fd_buf_writer(fd, option::none));
let writer = io::new_writer(
io::fd_buf_writer(fd, option::none));
writer.write_str(s);
os::libc::close(fd);
@ -56,8 +56,8 @@ fn test_pipes() {
fn readclose(fd: int) -> str {
// Copied from run::program_output
let file = os::fd_FILE(fd);
let reader = ioivec::new_reader(
ioivec::FILE_buf_reader(file, option::none));
let reader = io::new_reader(
io::FILE_buf_reader(file, option::none));
let buf = "";
while !reader.eof() {
let bytes = reader.read_bytes(4096u);