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;