about summary refs log tree commit diff
path: root/src/lib
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-08-11 18:49:36 -0700
committerBrian Anderson <banderson@mozilla.com>2011-08-12 12:08:27 -0700
commit82b1e3f5cc0d0fec0f7fbab0f9b8766ce732c792 (patch)
tree63ceb8283b98e964a00fd3357e4b7906c0de6ef9 /src/lib
parentc0846525e8329bd39125559f08fb378a461b7957 (diff)
downloadrust-82b1e3f5cc0d0fec0f7fbab0f9b8766ce732c792.tar.gz
rust-82b1e3f5cc0d0fec0f7fbab0f9b8766ce732c792.zip
Convert all uses of std::io to std::ioivec
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/run_program.rs25
-rw-r--r--src/lib/term.rs16
-rw-r--r--src/lib/test.rs12
3 files changed, 28 insertions, 25 deletions
diff --git a/src/lib/run_program.rs b/src/lib/run_program.rs
index b1cbcc24234..3b5751c806f 100644
--- a/src/lib/run_program.rs
+++ b/src/lib/run_program.rs
@@ -36,9 +36,9 @@ fn run_program(prog: str, args: vec[str]) -> int {
 type program =
     obj {
         fn get_id() -> int;
-        fn input() -> io::writer;
-        fn output() -> io::reader;
-        fn err() -> io::reader;
+        fn input() -> ioivec::writer;
+        fn output() -> ioivec::reader;
+        fn err() -> ioivec::reader;
         fn close_input();
         fn finish() -> int;
         fn destroy();
@@ -65,14 +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() -> io::writer {
-            ret io::new_writer(io::fd_buf_writer(in_fd, option::none));
+        fn input() -> ioivec::writer {
+            ret ioivec::new_writer(
+                ioivec::fd_buf_writer(in_fd, option::none));
         }
-        fn output() -> io::reader {
-            ret io::new_reader(io::FILE_buf_reader(out_file, option::none));
+        fn output() -> ioivec::reader {
+            ret ioivec::new_reader(
+                ioivec::FILE_buf_reader(out_file, option::none));
         }
-        fn err() -> io::reader {
-            ret io::new_reader(io::FILE_buf_reader(err_file, option::none));
+        fn err() -> ioivec::reader {
+            ret ioivec::new_reader(
+                ioivec::FILE_buf_reader(err_file, option::none));
         }
         fn close_input() {
             let invalid_fd = -1;
@@ -100,10 +103,10 @@ fn start_program(prog: str, args: vec[str]) -> @program_res {
                                  false));
 }
 
-fn read_all(rd: &io::reader) -> str {
+fn read_all(rd: &ioivec::reader) -> str {
     let buf = "";
     while !rd.eof() {
-        let bytes = ivec::from_vec(rd.read_bytes(4096u));
+        let bytes = rd.read_bytes(4096u);
         buf += str::unsafe_from_bytes(bytes);
     }
     ret buf;
diff --git a/src/lib/term.rs b/src/lib/term.rs
index 6576982dc05..d13b0dee3de 100644
--- a/src/lib/term.rs
+++ b/src/lib/term.rs
@@ -40,11 +40,11 @@ const color_bright_cyan: u8 = 14u8;
 
 const color_bright_white: u8 = 15u8;
 
-fn esc(writer: io::buf_writer) { writer.write([0x1bu8, '[' as u8]); }
+fn esc(writer: ioivec::buf_writer) { writer.write(~[0x1bu8, '[' as u8]); }
 
-fn reset(writer: io::buf_writer) {
+fn reset(writer: ioivec::buf_writer) {
     esc(writer);
-    writer.write(['0' as u8, 'm' as u8]);
+    writer.write(~['0' as u8, 'm' as u8]);
 }
 
 fn color_supported() -> bool {
@@ -55,18 +55,18 @@ fn color_supported() -> bool {
         };
 }
 
-fn set_color(writer: io::buf_writer, first_char: u8, color: u8) {
+fn set_color(writer: ioivec::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]);
+    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: io::buf_writer, color: u8) {
+fn fg(writer: ioivec::buf_writer, color: u8) {
     ret set_color(writer, '3' as u8, color);
 }
 
-fn bg(writer: io::buf_writer, color: u8) {
+fn bg(writer: ioivec::buf_writer, color: u8) {
     ret set_color(writer, '4' as u8, color);
 }
 // export fg;
diff --git a/src/lib/test.rs b/src/lib/test.rs
index 70f9580bf73..04472088789 100644
--- a/src/lib/test.rs
+++ b/src/lib/test.rs
@@ -106,7 +106,7 @@ fn run_tests_console_(opts: &test_opts, tests: &[test_desc],
                       to_task: &test_to_task) -> bool {
 
     type test_state = @{
-        out: io::writer,
+        out: ioivec::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: io::stdout(),
+        out: ioivec::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: &io::writer, use_color: bool) {
+    fn write_ok(out: &ioivec::writer, use_color: bool) {
         write_pretty(out, "ok", term::color_green, use_color);
     }
 
-    fn write_failed(out: &io::writer, use_color: bool) {
+    fn write_failed(out: &ioivec::writer, use_color: bool) {
         write_pretty(out, "FAILED", term::color_red, use_color);
     }
 
-    fn write_ignored(out: &io::writer, use_color: bool) {
+    fn write_ignored(out: &ioivec::writer, use_color: bool) {
         write_pretty(out, "ignored", term::color_yellow, use_color);
     }
 
-    fn write_pretty(out: &io::writer, word: &str, color: u8,
+    fn write_pretty(out: &ioivec::writer, word: &str, color: u8,
                     use_color: bool) {
         if use_color && term::color_supported() {
             term::fg(out.get_buf_writer(), color);