]> git.lizzy.rs Git - rust.git/commitdiff
Finally rename std::_xxx to std::xxx
authorMarijn Haverbeke <marijnh@gmail.com>
Tue, 17 May 2011 18:41:41 +0000 (20:41 +0200)
committerMarijn Haverbeke <marijnh@gmail.com>
Tue, 17 May 2011 18:41:41 +0000 (20:41 +0200)
Except for _task, which is still a keyword.

92 files changed:
src/comp/back/link.rs
src/comp/back/x86.rs
src/comp/driver/rustc.rs
src/comp/driver/session.rs
src/comp/front/ast.rs
src/comp/front/codemap.rs
src/comp/front/creader.rs
src/comp/front/eval.rs
src/comp/front/extenv.rs
src/comp/front/extfmt.rs
src/comp/front/lexer.rs
src/comp/front/parser.rs
src/comp/front/token.rs
src/comp/lib/llvm.rs
src/comp/middle/fold.rs
src/comp/middle/metadata.rs
src/comp/middle/resolve.rs
src/comp/middle/trans.rs
src/comp/middle/tstate/ann.rs
src/comp/middle/tstate/annotate.rs
src/comp/middle/tstate/auxiliary.rs
src/comp/middle/tstate/bitvectors.rs
src/comp/middle/tstate/ck.rs
src/comp/middle/tstate/collect_locals.rs
src/comp/middle/tstate/pre_post_conditions.rs
src/comp/middle/tstate/states.rs
src/comp/middle/ty.rs
src/comp/middle/typeck.rs
src/comp/middle/typestate_check.rs
src/comp/pretty/pp.rs
src/comp/pretty/pprust.rs
src/comp/util/common.rs
src/comp/util/interner.rs
src/lib/_int.rs [deleted file]
src/lib/_str.rs [deleted file]
src/lib/_u8.rs [deleted file]
src/lib/_uint.rs [deleted file]
src/lib/_vec.rs [deleted file]
src/lib/bitv.rs
src/lib/dbg.rs
src/lib/deque.rs
src/lib/ebml.rs
src/lib/extfmt.rs
src/lib/fs.rs
src/lib/generic_os.rs
src/lib/getopts.rs
src/lib/int.rs [new file with mode: 0644]
src/lib/io.rs
src/lib/linux_os.rs
src/lib/macos_os.rs
src/lib/map.rs
src/lib/posix_fs.rs
src/lib/run_program.rs
src/lib/sha1.rs
src/lib/sort.rs
src/lib/std.rc
src/lib/str.rs [new file with mode: 0644]
src/lib/u8.rs [new file with mode: 0644]
src/lib/ufind.rs
src/lib/uint.rs [new file with mode: 0644]
src/lib/util.rs
src/lib/vec.rs [new file with mode: 0644]
src/lib/win32_os.rs
src/test/bench/99-bottles/99bob-iter.rs
src/test/bench/99-bottles/99bob-pattern.rs
src/test/bench/99-bottles/99bob-simple.rs
src/test/bench/99-bottles/99bob-tail.rs
src/test/bench/shootout/binarytrees.rs
src/test/bench/shootout/fannkuchredux.rs
src/test/bench/shootout/fasta.rs
src/test/run-pass/alt-pattern-drop.rs
src/test/run-pass/box-inside-if.rs
src/test/run-pass/box-inside-if2.rs
src/test/run-pass/lib-bitv.rs
src/test/run-pass/lib-int.rs
src/test/run-pass/lib-io.rs
src/test/run-pass/lib-map.rs
src/test/run-pass/lib-qsort.rs
src/test/run-pass/lib-sha1.rs
src/test/run-pass/lib-sort.rs
src/test/run-pass/lib-str-buf.rs
src/test/run-pass/lib-str.rs
src/test/run-pass/lib-uint.rs
src/test/run-pass/lib-vec-str-conversions.rs
src/test/run-pass/lib-vec.rs
src/test/run-pass/mutable-alias-vec.rs
src/test/run-pass/rt-circular-buffer.rs
src/test/run-pass/str-append.rs
src/test/run-pass/syntax-extension-fmt.rs
src/test/run-pass/utf8_chars.rs
src/test/run-pass/vec-append.rs
src/test/run-pass/vec-ref-count.rs

index 97bfb87e2e35b52c9af1f6778fa678a3b2fa90c2..60256eeb435a3d7678cf791d500be1ac7a53bcbc 100644 (file)
@@ -1,7 +1,7 @@
 import driver::session;
 import lib::llvm::llvm;
 import middle::trans;
-import std::_str;
+import std::str;
 import std::fs;
 
 import lib::llvm::llvm::ModuleRef;
@@ -25,7 +25,7 @@ fn llvm_err(session::session sess, str msg) {
     if ((buf as uint) == 0u) {
         sess.err(msg);
     } else {
-        sess.err(msg + ": " + _str::str_from_cstr(buf));
+        sess.err(msg + ": " + str::str_from_cstr(buf));
     }
     fail;
 }
@@ -33,7 +33,7 @@ fn llvm_err(session::session sess, str msg) {
 fn link_intrinsics(session::session sess, ModuleRef llmod) {
     auto path = fs::connect(sess.get_opts().sysroot, "intrinsics.bc");
     auto membuf =
-        llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(_str::buf(path));
+        llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(str::buf(path));
     if ((membuf as uint) == 0u) {
         llvm_err(sess, "installation problem: couldn't open intrinstics.bc");
         fail;
@@ -69,12 +69,12 @@ fn is_object_or_assembly_or_exe(output_type ot) -> bool {
     // Decides what to call an intermediate file, given the name of the output
     // and the extension to use.
     fn mk_intermediate_name(str output_path, str extension) -> str {
-        auto dot_pos = _str::index(output_path, '.' as u8);
+        auto dot_pos = str::index(output_path, '.' as u8);
         auto stem;
         if (dot_pos < 0) {
             stem = output_path;
         } else {
-            stem = _str::substr(output_path, 0u, dot_pos as uint);
+            stem = str::substr(output_path, 0u, dot_pos as uint);
         }
         ret stem + "." + extension;
     }
@@ -105,12 +105,12 @@ fn run_passes(session::session sess, ModuleRef llmod, str output) {
                         auto filename = mk_intermediate_name(output,
                                                              "no-opt.bc");
                         llvm::LLVMWriteBitcodeToFile(llmod,
-                                                    _str::buf(filename));
+                                                    str::buf(filename));
                     }
                 }
                 case (_) {
                     auto filename = mk_intermediate_name(output, "bc");
-                    llvm::LLVMWriteBitcodeToFile(llmod, _str::buf(filename));
+                    llvm::LLVMWriteBitcodeToFile(llmod, str::buf(filename));
                 }
             }
         }
@@ -161,14 +161,14 @@ fn run_passes(session::session sess, ModuleRef llmod, str output) {
                 // Always output the bitcode file with --save-temps
                 auto filename = mk_intermediate_name(output, "opt.bc");
                 llvm::LLVMRunPassManager(pm.llpm, llmod);
-                llvm::LLVMWriteBitcodeToFile(llmod, _str::buf(output));
+                llvm::LLVMWriteBitcodeToFile(llmod, str::buf(output));
                 pm = mk_pass_manager();
 
                 // Save the assembly file if -S is used
                 if (opts.output_type == output_type_assembly) {
                         llvm::LLVMRustWriteOutputFile(pm.llpm, llmod,
-                               _str::buf(x86::get_target_triple()),
-                               _str::buf(output), LLVMAssemblyFile);
+                               str::buf(x86::get_target_triple()),
+                               str::buf(output), LLVMAssemblyFile);
                 }
 
                 // Save the object file for -c or --save-temps alone
@@ -176,16 +176,16 @@ fn run_passes(session::session sess, ModuleRef llmod, str output) {
                 if ((opts.output_type == output_type_object) ||
                     (opts.output_type == output_type_exe)) {
                         llvm::LLVMRustWriteOutputFile(pm.llpm, llmod,
-                               _str::buf(x86::get_target_triple()),
-                               _str::buf(output), LLVMObjectFile);
+                               str::buf(x86::get_target_triple()),
+                               str::buf(output), LLVMObjectFile);
                }
             } else {
 
                 // If we aren't saving temps then just output the file
                 // type corresponding to the '-c' or '-S' flag used
                 llvm::LLVMRustWriteOutputFile(pm.llpm, llmod,
-                                     _str::buf(x86::get_target_triple()),
-                                     _str::buf(output),
+                                     str::buf(x86::get_target_triple()),
+                                     str::buf(output),
                                      FileType);
             }
 
@@ -201,7 +201,7 @@ fn run_passes(session::session sess, ModuleRef llmod, str output) {
         // flag, then output it here
         llvm::LLVMRunPassManager(pm.llpm, llmod);
 
-        llvm::LLVMWriteBitcodeToFile(llmod, _str::buf(output));
+        llvm::LLVMWriteBitcodeToFile(llmod, str::buf(output));
         llvm::LLVMDisposeModule(llmod);
 
         if (opts.time_llvm_passes) {
index fffb82053f6769dfc563725e65cfdf2dbbea9285..839851c4968c7b3b81c89ada4b83fe7894c5c21b 100644 (file)
@@ -1,7 +1,7 @@
 import lib::llvm::llvm;
 import lib::llvm::llvm::ModuleRef;
-import std::_str;
-import std::_vec;
+import std::str;
+import std::vec;
 import std::os::target_os;
 import util::common::istr;
 
@@ -241,7 +241,7 @@ fn copy_arg(bool pass_task, uint i) -> str {
         }
         auto m = ["movl  " + src_off + "(%ebp),%eax",
                      "movl  %eax," + dst_off + "(%esp)"];
-        ret _str::connect(m, "\n\t");
+        ret str::connect(m, "\n\t");
     }
 
     auto carg = bind copy_arg(pass_task, _);
@@ -259,7 +259,7 @@ fn copy_arg(bool pass_task, uint i) -> str {
         + ["subl  $" + wstr(n_args) + ", %esp   # esp -= args",
               "andl  $~0xf, %esp    # align esp down"]
 
-        + _vec::init_fn[str](carg, (n_args) as uint)
+        + vec::init_fn[str](carg, (n_args) as uint)
 
         +  ["movl  %edx, %edi     # save task from edx to edi",
                "call  *%ecx          # call *%ecx",
@@ -278,7 +278,7 @@ fn decl_glue(int align, str prefix, str name, vec[str] insns) -> str {
     ret "\t.globl " + sym + "\n" +
         "\t.balign " + istr(align) + "\n" +
         sym + ":\n" +
-        "\t" + _str::connect(insns, "\n\t");
+        "\t" + str::connect(insns, "\n\t");
 }
 
 
@@ -291,8 +291,8 @@ fn decl_native_glue(int align, str prefix, abi::native_glue_type ngt, uint n)
 }
 
 fn get_symbol_prefix() -> str {
-    if (_str::eq(target_os(), "macos") ||
-        _str::eq(target_os(), "win32")) {
+    if (str::eq(target_os(), "macos") ||
+        str::eq(target_os(), "win32")) {
         ret "_";
     } else {
         ret "";
@@ -313,44 +313,44 @@ fn get_module_asm() -> str {
                       abi::yield_glue_name(),
                       rust_yield_glue())]
 
-        + _vec::init_fn[str](bind decl_native_glue(align, prefix,
+        + vec::init_fn[str](bind decl_native_glue(align, prefix,
             abi::ngt_rust, _), (abi::n_native_glues + 1) as uint)
-        + _vec::init_fn[str](bind decl_native_glue(align, prefix,
+        + vec::init_fn[str](bind decl_native_glue(align, prefix,
             abi::ngt_pure_rust, _), (abi::n_native_glues + 1) as uint)
-        + _vec::init_fn[str](bind decl_native_glue(align, prefix,
+        + vec::init_fn[str](bind decl_native_glue(align, prefix,
             abi::ngt_cdecl, _), (abi::n_native_glues + 1) as uint);
 
 
-    ret _str::connect(glues, "\n\n");
+    ret str::connect(glues, "\n\n");
 }
 
 fn get_meta_sect_name() -> str {
-    if (_str::eq(target_os(), "macos")) {
+    if (str::eq(target_os(), "macos")) {
         ret "__DATA,__note.rustc";
     }
-    if (_str::eq(target_os(), "win32")) {
+    if (str::eq(target_os(), "win32")) {
         ret ".note.rustc";
     }
     ret ".note.rustc";
 }
 
 fn get_data_layout() -> str {
-    if (_str::eq(target_os(), "macos")) {
+    if (str::eq(target_os(), "macos")) {
       ret "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64" +
         "-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +
         "-n8:16:32";
     }
-    if (_str::eq(target_os(), "win32")) {
+    if (str::eq(target_os(), "win32")) {
       ret "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32";
     }
     ret "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32";
 }
 
 fn get_target_triple() -> str {
-    if (_str::eq(target_os(), "macos")) {
+    if (str::eq(target_os(), "macos")) {
         ret "i686-apple-darwin";
     }
-    if (_str::eq(target_os(), "win32")) {
+    if (str::eq(target_os(), "win32")) {
         ret "i686-pc-mingw32";
     }
     ret "i686-unknown-linux-gnu";
index 6beb805169dfd79eaa72215eb5ef9ab4772377aa..4ccc73f117a9ae65c594cde1f2daccf50f61c35b 100644 (file)
@@ -19,8 +19,8 @@
 import std::option;
 import std::option::some;
 import std::option::none;
-import std::_str;
-import std::_vec;
+import std::str;
+import std::vec;
 import std::io;
 import std::run;
 
@@ -59,9 +59,9 @@ fn default_environment(session::session sess,
 fn parse_input(session::session sess,
                       parser::parser p,
                       str input) -> @ast::crate {
-    if (_str::ends_with(input, ".rc")) {
+    if (str::ends_with(input, ".rc")) {
         ret parser::parse_crate_from_crate_file(p);
-    } else if (_str::ends_with(input, ".rs")) {
+    } else if (str::ends_with(input, ".rs")) {
         ret parser::parse_crate_from_source_file(p);
     }
     sess.err("unknown input file type: " + input);
@@ -130,7 +130,7 @@ fn pretty_print_input(session::session sess,
 fn version(str argv0) {
     auto vers = "unknown version";
     auto env_vers = #env("CFG_VERSION");
-    if (_str::byte_len(env_vers) != 0u) {
+    if (str::byte_len(env_vers) != 0u) {
         vers = env_vers;
     }
     io::stdout().write_str(#fmt("%s %s\n", argv0, vers));
@@ -166,25 +166,25 @@ fn usage(str argv0) {
 }
 
 fn get_os(str triple) -> session::os {
-    if (_str::find(triple, "win32") >= 0 ||
-        _str::find(triple, "mingw32") >= 0 ) {
+    if (str::find(triple, "win32") >= 0 ||
+        str::find(triple, "mingw32") >= 0 ) {
         ret session::os_win32;
-    } else if (_str::find(triple, "darwin") >= 0) { ret session::os_macos; }
-    else if (_str::find(triple, "linux") >= 0) { ret session::os_linux; }
+    } else if (str::find(triple, "darwin") >= 0) { ret session::os_macos; }
+    else if (str::find(triple, "linux") >= 0) { ret session::os_linux; }
     else { log_err "Unknown operating system!"; fail; }
 }
 
 fn get_arch(str triple) -> session::arch {
-    if (_str::find(triple, "i386") >= 0 ||
-        _str::find(triple, "i486") >= 0 ||
-        _str::find(triple, "i586") >= 0 ||
-        _str::find(triple, "i686") >= 0 ||
-        _str::find(triple, "i786") >= 0 ) {
+    if (str::find(triple, "i386") >= 0 ||
+        str::find(triple, "i486") >= 0 ||
+        str::find(triple, "i586") >= 0 ||
+        str::find(triple, "i686") >= 0 ||
+        str::find(triple, "i786") >= 0 ) {
         ret session::arch_x86;
-    } else if (_str::find(triple, "x86_64") >= 0) {
+    } else if (str::find(triple, "x86_64") >= 0) {
         ret session::arch_x64;
-    } else if (_str::find(triple, "arm") >= 0 ||
-        _str::find(triple, "xscale") >= 0 ) {
+    } else if (str::find(triple, "arm") >= 0 ||
+        str::find(triple, "xscale") >= 0 ) {
         ret session::arch_arm;
     }
     else {
@@ -195,14 +195,14 @@ fn get_arch(str triple) -> session::arch {
 
 fn get_default_sysroot(str binary) -> str {
     auto dirname = fs::dirname(binary);
-    if (_str::eq(dirname, binary)) { ret "."; }
+    if (str::eq(dirname, binary)) { ret "."; }
     ret dirname;
 }
 
 fn main(vec[str] args) {
 
     let str triple =
-        std::_str::rustrt::str_from_cstr(llvm::llvm::LLVMRustGetHostTriple());
+        std::str::rustrt::str_from_cstr(llvm::llvm::LLVMRustGetHostTriple());
 
     let @session::config target_cfg =
         @rec(os = get_os(triple),
@@ -221,7 +221,7 @@ fn main(vec[str] args) {
                     optflag("stats"),
                     optflag("time-passes"), optflag("time-llvm-passes"),
                     optflag("no-typestate"), optflag("noverify")];
-    auto binary = _vec::shift[str](args);
+    auto binary = vec::shift[str](args);
     auto match;
     alt (getopts::getopts(args, opts)) {
         case (getopts::failure(?f)) {
@@ -298,7 +298,7 @@ fn main(vec[str] args) {
         session::session(target_crate_num, target_cfg, sopts,
                         crate_cache, md, front::codemap::new_codemap());
 
-    auto n_inputs = _vec::len[str](match.free);
+    auto n_inputs = vec::len[str](match.free);
 
     if (glue) {
         if (n_inputs > 0u) {
@@ -325,8 +325,8 @@ fn main(vec[str] args) {
     } else {
         alt (output_file) {
             case (none[str]) {
-                let vec[str] parts = _str::split(ifile, '.' as u8);
-                _vec::pop[str](parts);
+                let vec[str] parts = str::split(ifile, '.' as u8);
+                vec::pop[str](parts);
                 saved_out_filename = parts.(0);
                 alt (output_type) {
                     case (link::output_type_none) { parts += ["pp"]; }
@@ -337,7 +337,7 @@ fn main(vec[str] args) {
                     case (link::output_type_object) { parts += ["o"]; }
                     case (link::output_type_exe) { parts += ["o"]; }
                 }
-                auto ofile = _str::connect(parts, ".");
+                auto ofile = str::connect(parts, ".");
                 compile_input(sess, env, ifile, ofile);
             }
             case (some[str](?ofile)) {
index 71d4d9d2ddfae5f31b71df8e5864e4a146872147..1b03567aec5b4dc5f817bd674aadef64bf58bd06 100644 (file)
@@ -2,7 +2,7 @@
 import front::codemap;
 import util::common::span;
 import util::common::ty_mach;
-import std::_uint;
+import std::uint;
 import std::term;
 import std::io;
 import std::map;
index 5dfc2d8ddfadb6736a16d7228ea65a245df035eb..2b5959028d4724f8e5f8ac8245466c3638fa1b8b 100644 (file)
@@ -1,7 +1,7 @@
 import std::map::hashmap;
 import std::option;
-import std::_str;
-import std::_vec;
+import std::str;
+import std::vec;
 import util::common::span;
 import util::common::spanned;
 import util::common::ty_mach;
@@ -454,7 +454,7 @@ fn is_exported(ident i, _mod m) -> bool {
     for (@ast::view_item vi in m.view_items) {
         alt (vi.node) {
             case (ast::view_item_export(?id)) {
-                if (_str::eq(i, id)) {
+                if (str::eq(i, id)) {
                     ret true;
                 }
                 count += 1;
index cd959d9d88deb49db61ea5a8954e52f9093bafa3..a9aacd8c6c2e26bc8ad66f71d7cddaba39f9f918 100644 (file)
@@ -1,4 +1,4 @@
-import std::_vec;
+import std::vec;
 
 /* A codemap is a thing that maps uints to file/line/column positions
  * in a crate. This to make it possible to represent the positions
@@ -24,18 +24,18 @@ fn new_filemap(str filename, uint start_pos) -> filemap {
 }
 
 fn next_line(filemap file, uint pos) {
-    _vec::push[uint](file.lines, pos);
+    vec::push[uint](file.lines, pos);
 }
 
 fn lookup_pos(codemap map, uint pos) -> loc {
-    auto a = 0u; auto b = _vec::len[filemap](map.files);
+    auto a = 0u; auto b = vec::len[filemap](map.files);
     while (b - a > 1u) {
         auto m = (a + b) / 2u;
         if (map.files.(m).start_pos > pos) { b = m; }
         else { a = m; }
     }
     auto f = map.files.(a);
-    a = 0u; b = _vec::len[uint](f.lines);
+    a = 0u; b = vec::len[uint](f.lines);
     while (b - a > 1u) {
         auto m = (a + b) / 2u;
         if (f.lines.(m) > pos) { b = m; }
index 3ac7b3638e1e6087a480f9cd4e59a5a39bca1d07..7d61afc1de9542a06f511645c5675f9f58049063 100644 (file)
@@ -14,9 +14,9 @@
 import util::common;
 import util::common::span;
 
-import std::_str;
-import std::_uint;
-import std::_vec;
+import std::str;
+import std::uint;
+import std::vec;
 import std::ebml;
 import std::fs;
 import std::io;
@@ -117,7 +117,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty::t {
             while (peek(st) as char != ']') {
                 auto name = "";
                 while (peek(st) as char != '=') {
-                    name += _str::unsafe_from_byte(next(st));
+                    name += str::unsafe_from_byte(next(st));
                 }
                 st.pos = st.pos + 1u;
                 fields += [rec(ident=name, mt=parse_mt(st, sd))];
@@ -155,7 +155,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty::t {
                 }
                 auto name = "";
                 while (peek(st) as char != '[') {
-                    name += _str::unsafe_from_byte(next(st));
+                    name += str::unsafe_from_byte(next(st));
                 }
                 auto func = parse_ty_fn(st, sd);
                 methods += [rec(proto=proto,
@@ -205,7 +205,7 @@ fn parse_mt(@pstate st, str_def sd) -> ty::mt {
 fn parse_def(@pstate st, str_def sd) -> ast::def_id {
     auto def = "";
     while (peek(st) as char != '|') {
-        def += _str::unsafe_from_byte(next(st));
+        def += str::unsafe_from_byte(next(st));
     }
     st.pos = st.pos + 1u;
     ret sd(def);
@@ -260,7 +260,7 @@ fn parse_ty_fn(@pstate st, str_def sd) -> tup(vec[ty::arg], ty::t) {
 
 fn parse_def_id(vec[u8] buf) -> ast::def_id {
     auto colon_idx = 0u;
-    auto len = _vec::len[u8](buf);
+    auto len = vec::len[u8](buf);
     while (colon_idx < len && buf.(colon_idx) != (':' as u8)) {
         colon_idx += 1u;
     }
@@ -269,10 +269,10 @@ fn parse_def_id(vec[u8] buf) -> ast::def_id {
         fail;
     }
 
-    auto crate_part = _vec::slice[u8](buf, 0u, colon_idx);
-    auto def_part = _vec::slice[u8](buf, colon_idx + 1u, len);
-    auto crate_num = _uint::parse_buf(crate_part, 10u) as int;
-    auto def_num = _uint::parse_buf(def_part, 10u) as int;
+    auto crate_part = vec::slice[u8](buf, 0u, colon_idx);
+    auto def_part = vec::slice[u8](buf, colon_idx + 1u, len);
+    auto crate_num = uint::parse_buf(crate_part, 10u) as int;
+    auto def_num = uint::parse_buf(def_part, 10u) as int;
     ret tup(crate_num, def_num);
 }
 
@@ -289,8 +289,8 @@ fn lookup_hash(&ebml::doc d, fn(vec[u8]) -> bool eq_fn, uint hash)
     auto belt = metadata::tag_index_buckets_bucket_elt;
     for each (ebml::doc elt in ebml::tagged_docs(bucket, belt)) {
         auto pos = ebml::be_uint_from_bytes(elt.data, elt.start, 4u);
-        if (eq_fn(_vec::slice[u8](elt.data, elt.start+4u, elt.end))) {
-            _vec::push(result, ebml::doc_at(d.data, pos));
+        if (eq_fn(vec::slice[u8](elt.data, elt.start+4u, elt.end))) {
+            vec::push(result, ebml::doc_at(d.data, pos));
         }
     }
     ret result;
@@ -300,16 +300,16 @@ fn lookup_hash(&ebml::doc d, fn(vec[u8]) -> bool eq_fn, uint hash)
 // definition the path refers to.
 fn resolve_path(vec[ast::ident] path, vec[u8] data) -> vec[ast::def_id] {
     fn eq_item(vec[u8] data, str s) -> bool {
-        ret _str::eq(_str::unsafe_from_bytes(data), s);
+        ret str::eq(str::unsafe_from_bytes(data), s);
     }
-    auto s = _str::connect(path, "::");
+    auto s = str::connect(path, "::");
     auto md = ebml::new_doc(data);
     auto paths = ebml::get_doc(md, metadata::tag_paths);
     auto eqer = bind eq_item(_, s);
     let vec[ast::def_id] result = [];
     for (ebml::doc doc in lookup_hash(paths, eqer, metadata::hash_path(s))) {
         auto did_doc = ebml::get_doc(doc, metadata::tag_def_id);
-        _vec::push(result, parse_def_id(ebml::doc_data(did_doc)));
+        vec::push(result, parse_def_id(ebml::doc_data(did_doc)));
     }
     ret result;
 }
@@ -320,7 +320,7 @@ fn eq_item(vec[u8] bytes, int item_id) -> bool {
     }
     auto eqer = bind eq_item(_, item_id);
     auto found = lookup_hash(items, eqer, metadata::hash_def_num(item_id));
-    if (_vec::len(found) == 0u) {
+    if (vec::len(found) == 0u) {
         ret option::none[ebml::doc];
     } else {
         ret option::some[ebml::doc](found.(0));
@@ -345,7 +345,7 @@ fn item_kind(&ebml::doc item) -> u8 {
 
 fn item_symbol(&ebml::doc item) -> str {
     auto sym = ebml::get_doc(item, metadata::tag_items_data_item_symbol);
-    ret _str::unsafe_from_bytes(ebml::doc_data(sym));
+    ret str::unsafe_from_bytes(ebml::doc_data(sym));
 }
 
 fn variant_tag_id(&ebml::doc d) -> ast::def_id {
@@ -359,13 +359,13 @@ fn parse_external_def_id(int this_cnum, str s) -> ast::def_id {
         // that, in turn, links against another crate. We need a mapping
         // from crate ID to crate "meta" attributes as part of the crate
         // metadata:
-        auto buf = _str::bytes(s);
+        auto buf = str::bytes(s);
         auto external_def_id = parse_def_id(buf);
         ret tup(this_cnum, external_def_id._1);
     }
 
     auto tp = ebml::get_doc(item, metadata::tag_items_data_item_type);
-    auto s = _str::unsafe_from_bytes(ebml::doc_data(tp));
+    auto s = str::unsafe_from_bytes(ebml::doc_data(tp));
     ret parse_ty_data(item.data, this_cnum, tp.start, tp.end - tp.start,
                       bind parse_external_def_id(this_cnum, _), tcx);
 }
@@ -384,25 +384,25 @@ fn tag_variant_ids(&ebml::doc item, int this_cnum) -> vec[ast::def_id] {
     auto v = metadata::tag_items_data_item_variant;
     for each (ebml::doc p in ebml::tagged_docs(item, v)) {
         auto ext = parse_def_id(ebml::doc_data(p));
-        _vec::push[ast::def_id](ids, tup(this_cnum, ext._1));
+        vec::push[ast::def_id](ids, tup(this_cnum, ext._1));
     }
     ret ids;
 }
 
 fn get_metadata_section(str filename) -> option::t[vec[u8]] {
     auto mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile
-        (_str::buf(filename));
+        (str::buf(filename));
     if (mb as int == 0) {ret option::none[vec[u8]];}
     auto of = mk_object_file(mb);
     auto si = mk_section_iter(of.llof);
     while (llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False) {
         auto name_buf = llvm::LLVMGetSectionName(si.llsi);
-        auto name = _str::str_from_cstr(name_buf);
-        if (_str::eq(name, x86::get_meta_sect_name())) {
+        auto name = str::str_from_cstr(name_buf);
+        if (str::eq(name, x86::get_meta_sect_name())) {
             auto cbuf = llvm::LLVMGetSectionContents(si.llsi);
             auto csz = llvm::LLVMGetSectionSize(si.llsi);
-            auto cvbuf = cbuf as _vec::vbuf;
-            ret option::some[vec[u8]](_vec::vec_from_vbuf[u8](cvbuf, csz));
+            auto cvbuf = cbuf as vec::vbuf;
+            ret option::some[vec[u8]](vec::vec_from_vbuf[u8](cvbuf, csz));
         }
         llvm::LLVMMoveToNextSection(si.llsi);
     }
@@ -481,7 +481,7 @@ fn lookup_defs(session::session sess, int cnum, vec[ast::ident] path)
     -> vec[ast::def] {
     auto data = sess.get_external_crate(cnum).data;
 
-    ret _vec::map(bind lookup_def(cnum, data, _),
+    ret vec::map(bind lookup_def(cnum, data, _),
                   resolve_path(path, data));
 }
 
@@ -580,8 +580,8 @@ fn list_file_metadata(str path, io::writer out) {
 fn read_path(&ebml::doc d) -> tup(str, uint) {
     auto desc = ebml::doc_data(d);
     auto pos = ebml::be_uint_from_bytes(desc, 0u, 4u);
-    auto pathbytes = _vec::slice[u8](desc, 4u, _vec::len[u8](desc));
-    auto path = _str::unsafe_from_bytes(pathbytes);
+    auto pathbytes = vec::slice[u8](desc, 4u, vec::len[u8](desc));
+    auto path = str::unsafe_from_bytes(pathbytes);
     ret tup(path, pos);
 }
 
index c44af3d0926bed9c19fd0ca682aaddf1768a02ca..b66c6909e61064bf09ff2e86705090d494b6d9b9 100644 (file)
@@ -1,5 +1,5 @@
-import std::_vec;
-import std::_str;
+import std::vec;
+import std::str;
 import std::option;
 import std::option::some;
 import std::option::none;
@@ -92,7 +92,7 @@ fn val_as_str(val v) -> str {
 
 fn lookup(session::session sess, env e, span sp, ident i) -> val {
     for (tup(ident, val) pair in e) {
-        if (_str::eq(i, pair._0)) {
+        if (str::eq(i, pair._0)) {
             ret pair._1;
         }
     }
@@ -115,8 +115,8 @@ fn eval_lit(ctx cx, span sp, @ast::lit lit) -> val {
 fn eval_expr(ctx cx, env e, @ast::expr x) -> val {
     alt (x.node) {
         case (ast::expr_path(?pth, _)) {
-            if (_vec::len[ident](pth.node.idents) == 1u &&
-                _vec::len[@ast::ty](pth.node.types) == 0u) {
+            if (vec::len[ident](pth.node.idents) == 1u &&
+                vec::len[@ast::ty](pth.node.types) == 0u) {
                 ret lookup(cx.sess, e, x.span, pth.node.idents.(0));
             }
             cx.sess.span_err(x.span, "evaluating structured path-name");
@@ -225,7 +225,7 @@ fn val_eq(session::session sess, span sp, val av, val bv) -> bool {
         ret val_as_int(av) == val_as_int(bv);
     }
     if (val_is_str(av) && val_is_str(bv)) {
-        ret _str::eq(val_as_str(av),
+        ret str::eq(val_as_str(av),
                     val_as_str(bv));
     }
     sess.span_err(sp, "bad types in comparison");
@@ -394,7 +394,7 @@ fn eval_crate_directive(ctx cx,
             cx.next_ann = p0.next_ann_num();
             auto im = ast::item_mod(id, m0, next_id);
             auto i = @spanned(cdir.span.lo, cdir.span.hi, im);
-            _vec::push[@ast::item](items, i);
+            vec::push[@ast::item](items, i);
         }
 
         case (ast::cdir_dir_mod(?id, ?dir_opt, ?cdirs)) {
@@ -411,11 +411,11 @@ fn eval_crate_directive(ctx cx,
             auto m0 = eval_crate_directives_to_mod(cx, e, cdirs, full_path);
             auto im = ast::item_mod(id, m0, cx.p.next_def_id());
             auto i = @spanned(cdir.span.lo, cdir.span.hi, im);
-            _vec::push[@ast::item](items, i);
+            vec::push[@ast::item](items, i);
         }
 
         case (ast::cdir_view_item(?vi)) {
-            _vec::push[@ast::view_item](view_items, vi);
+            vec::push[@ast::view_item](view_items, vi);
         }
 
         case (ast::cdir_meta(?mi)) {
index f9ac6a52085daae69efaadf111ff08b5ea81bad1..f5d86dde3e71ab966b303269bc5c22aeeb5998f7 100644 (file)
@@ -6,8 +6,8 @@
 
 import util::common;
 
-import std::_str;
-import std::_vec;
+import std::str;
+import std::vec;
 import std::option;
 import std::generic_os;
 
@@ -19,7 +19,7 @@ fn expand_syntax_ext(parser::parser p,
                      vec[@ast::expr] args,
                      option::t[str] body) -> @ast::expr {
 
-    if (_vec::len[@ast::expr](args) != 1u) {
+    if (vec::len[@ast::expr](args) != 1u) {
         p.err("malformed #env call");
     }
 
index 9c15d11e4c434971bb33df08d63af4473bf2633a..8ef37b8536cac57667bb16897c8b032e17a570a1 100644 (file)
@@ -7,8 +7,8 @@
 import front::parser::parser;
 import util::common;
 
-import std::_str;
-import std::_vec;
+import std::str;
+import std::vec;
 import std::option;
 import std::option::none;
 import std::option::some;
@@ -50,7 +50,7 @@ fn expand_syntax_ext(parser p,
                      vec[@ast::expr] args,
                      option::t[str] body) -> @ast::expr {
 
-    if (_vec::len[@ast::expr](args) == 0u) {
+    if (vec::len[@ast::expr](args) == 0u) {
         // FIXME: Handle error correctly.
         log_err "malformed #fmt call";
         fail;
@@ -62,8 +62,8 @@ fn expand_syntax_ext(parser p,
     // log fmt;
 
     auto pieces = parse_fmt_string(fmt);
-    auto args_len = _vec::len[@ast::expr](args);
-    auto fmt_args = _vec::slice[@ast::expr](args, 1u, args_len - 1u);
+    auto args_len = vec::len[@ast::expr](args);
+    auto fmt_args = vec::slice[@ast::expr](args, 1u, args_len - 1u);
     ret pieces_to_expr(p, pieces, args);
 }
 
@@ -203,7 +203,7 @@ fn make_flags(parser p, common::span sp, vec[flag] flags)
             // FIXME: 0-length vectors can't have their type inferred
             // through the rec that these flags are a member of, so
             // this is a hack placeholder flag
-            if (_vec::len[@ast::expr](flagexprs) == 0u) {
+            if (vec::len[@ast::expr](flagexprs) == 0u) {
                 flagexprs += [make_rt_path_expr(p, sp, "flag_none")];
             }
 
@@ -407,7 +407,7 @@ fn is_signed_type(conv cnv) -> bool {
     fn log_conv(conv c) {
         alt (c.param) {
             case (some[int](?p)) {
-                log "param: " + std::_int::to_str(p, 10u);
+                log "param: " + std::int::to_str(p, 10u);
             }
             case (_) {
                 log "param: none";
@@ -434,10 +434,10 @@ fn log_conv(conv c) {
         }
         alt (c.width) {
             case (count_is(?i)) {
-                log "width: count is " + std::_int::to_str(i, 10u);
+                log "width: count is " + std::int::to_str(i, 10u);
             }
             case (count_is_param(?i)) {
-                log "width: count is param " + std::_int::to_str(i, 10u);
+                log "width: count is param " + std::int::to_str(i, 10u);
             }
             case (count_is_next_param) {
                 log "width: count is next param";
@@ -448,10 +448,10 @@ fn log_conv(conv c) {
         }
         alt (c.precision) {
             case (count_is(?i)) {
-                log "prec: count is " + std::_int::to_str(i, 10u);
+                log "prec: count is " + std::int::to_str(i, 10u);
             }
             case (count_is_param(?i)) {
-                log "prec: count is param " + std::_int::to_str(i, 10u);
+                log "prec: count is param " + std::int::to_str(i, 10u);
             }
             case (count_is_next_param) {
                 log "prec: count is next param";
@@ -507,7 +507,7 @@ fn log_conv(conv c) {
                 tmp_expr = make_add_expr(p, sp, tmp_expr, s_expr);
             }
             case (piece_conv(?conv)) {
-                if (n >= _vec::len[@ast::expr](args)) {
+                if (n >= vec::len[@ast::expr](args)) {
                     log_err "too many conversions in #fmt string";
                     fail;
                 }
index c151dc2f7be1a397304e0ddff82bbf46f1639130..d5e885c7bf0549477489e5018c929fbac6c9b63f 100644 (file)
@@ -1,7 +1,7 @@
 import std::io;
-import std::_str;
-import std::_vec;
-import std::_int;
+import std::str;
+import std::vec;
+import std::int;
 import std::map;
 import std::map::hashmap;
 import std::option;
@@ -54,13 +54,13 @@ fn curr() -> char {
         }
 
         fn next() -> char {
-            if (pos < len) {ret _str::char_at(file, pos);}
+            if (pos < len) {ret str::char_at(file, pos);}
             else {ret -1 as char;}
         }
 
         fn init() {
             if (pos < len) {
-                auto next = _str::char_range_at(file, pos);
+                auto next = str::char_range_at(file, pos);
                 pos = next._1;
                 ch = next._0;
             }
@@ -72,7 +72,7 @@ fn bump() {
                 if (ch == '\n') {
                     codemap::next_line(fm, chpos);
                 }
-                auto next = _str::char_range_at(file, pos);
+                auto next = str::char_range_at(file, pos);
                 pos = next._1;
                 ch = next._0;
             } else {
@@ -90,9 +90,9 @@ fn err(str m) {
             sess.span_err(rec(lo=chpos, hi=chpos), m);
         }
     }
-    auto file = _str::unsafe_from_bytes(rdr.read_whole_stream());
+    auto file = str::unsafe_from_bytes(rdr.read_whole_stream());
     let vec[str] strs = [];
-    auto rd = reader(sess, file, _str::byte_len(file), 0u, -1 as char,
+    auto rd = reader(sess, file, str::byte_len(file), 0u, -1 as char,
                      filemap.start_pos, filemap.start_pos,
                      strs, filemap, itr);
     rd.init();
@@ -228,15 +228,15 @@ fn scan_exponent(reader rdr) -> option::t[str] {
     auto res = "";
 
     if (c == 'e' || c == 'E') {
-        res += _str::from_bytes([c as u8]);
+        res += str::from_bytes([c as u8]);
         rdr.bump();
         c = rdr.curr();
         if (c == '-' || c == '+') {
-            res += _str::from_bytes([c as u8]);
+            res += str::from_bytes([c as u8]);
             rdr.bump();
         }
         auto exponent = scan_dec_digits(rdr);
-        if (_str::byte_len(exponent) > 0u) {
+        if (str::byte_len(exponent) > 0u) {
             ret(some(res + exponent));
         }
         else {
@@ -256,7 +256,7 @@ fn scan_dec_digits(reader rdr) -> str {
 
     while (is_dec_digit (c) || c == '_') {
         if (c != '_') {
-            res += _str::from_bytes([c as u8]);
+            res += str::from_bytes([c as u8]);
         }
         rdr.bump();
         c = rdr.curr();
@@ -458,12 +458,12 @@ fn next_token(reader rdr) -> token::token {
 
     if (is_alpha(c) || c == '_') {
         while (is_alnum(c) || c == '_') {
-            _str::push_char(accum_str, c);
+            str::push_char(accum_str, c);
             rdr.bump();
             c = rdr.curr();
         }
 
-        if (_str::eq(accum_str, "_")) {
+        if (str::eq(accum_str, "_")) {
             ret token::UNDERSCORE;
         }
 
@@ -621,37 +621,37 @@ fn binop(reader rdr, token::binop op) -> token::token {
                         alt (rdr.next()) {
                             case ('n') {
                                 rdr.bump();
-                                _str::push_byte(accum_str, '\n' as u8);
+                                str::push_byte(accum_str, '\n' as u8);
                             }
                             case ('r') {
                                 rdr.bump();
-                                _str::push_byte(accum_str, '\r' as u8);
+                                str::push_byte(accum_str, '\r' as u8);
                             }
                             case ('t') {
                                 rdr.bump();
-                                _str::push_byte(accum_str, '\t' as u8);
+                                str::push_byte(accum_str, '\t' as u8);
                             }
                             case ('\\') {
                                 rdr.bump();
-                                _str::push_byte(accum_str, '\\' as u8);
+                                str::push_byte(accum_str, '\\' as u8);
                             }
                             case ('"') {
                                 rdr.bump();
-                                _str::push_byte(accum_str, '"' as u8);
+                                str::push_byte(accum_str, '"' as u8);
                             }
 
                             case ('x') {
-                                _str::push_char(accum_str,
+                                str::push_char(accum_str,
                                                scan_numeric_escape(rdr));
                             }
 
                             case ('u') {
-                                _str::push_char(accum_str,
+                                str::push_char(accum_str,
                                                scan_numeric_escape(rdr));
                             }
 
                             case ('U') {
-                                _str::push_char(accum_str,
+                                str::push_char(accum_str,
                                                scan_numeric_escape(rdr));
                             }
 
@@ -663,7 +663,7 @@ fn binop(reader rdr, token::binop op) -> token::token {
                         }
                     }
                     case (_) {
-                        _str::push_char(accum_str, rdr.curr());
+                        str::push_char(accum_str, rdr.curr());
                     }
                 }
                 rdr.bump();
@@ -754,7 +754,7 @@ fn read_line_comment(reader rdr) -> cmnt {
     while (rdr.curr() == ' ') {rdr.bump();}
     auto val = "";
     while (rdr.curr() != '\n' && !rdr.is_eof()) {
-        _str::push_char(val, rdr.curr());
+        str::push_char(val, rdr.curr());
         rdr.bump();
     }
     ret rec(val=cmnt_line(val),
@@ -771,7 +771,7 @@ fn read_block_comment(reader rdr) -> cmnt {
     auto level = 1;
     while (true) {
         if (rdr.curr() == '\n') {
-            _vec::push[str](lines, val);
+            vec::push[str](lines, val);
             val = "";
             consume_whitespace(rdr);
         } else {
@@ -779,13 +779,13 @@ fn read_block_comment(reader rdr) -> cmnt {
                 level -= 1;
                 if (level == 0) {
                     rdr.bump(); rdr.bump();
-                    _vec::push[str](lines, val);
+                    vec::push[str](lines, val);
                     break;
                 }
             } else if (rdr.curr() == '/' && rdr.next() == '*') {
                 level += 1;
             }
-            _str::push_char(val, rdr.curr());
+            str::push_char(val, rdr.curr());
             rdr.bump();
         }
         if (rdr.is_eof()) {
@@ -800,16 +800,16 @@ fn read_block_comment(reader rdr) -> cmnt {
 
 fn gather_comments(session sess, str path) -> vec[cmnt] {
     auto srdr = io::file_reader(path);
-    auto itr = @interner::mk_interner[str](_str::hash, _str::eq);
+    auto itr = @interner::mk_interner[str](str::hash, str::eq);
     auto rdr = new_reader(sess, srdr, codemap::new_filemap(path, 0u), itr);
     let vec[cmnt] comments = [];
     while (!rdr.is_eof()) {
         while (true) {
             consume_whitespace(rdr);
             if (rdr.curr() == '/' && rdr.next() == '/') {
-                _vec::push[cmnt](comments, read_line_comment(rdr));
+                vec::push[cmnt](comments, read_line_comment(rdr));
             } else if (rdr.curr() == '/' && rdr.next() == '*') {
-                _vec::push[cmnt](comments, read_block_comment(rdr));
+                vec::push[cmnt](comments, read_block_comment(rdr));
             } else { break; }
         }
         next_token(rdr);
index 34162a44f75f5ce8c66f1d89faa5e427a1a0cadd..c4135814175d9a5be795228c8ba3a348c66a0dab 100644 (file)
@@ -1,6 +1,6 @@
 import std::io;
-import std::_vec;
-import std::_str;
+import std::vec;
+import std::str;
 import std::option;
 import std::option::some;
 import std::option::none;
@@ -156,13 +156,13 @@ fn next_ann_num() -> uint {
             }
         }
     auto ftype = SOURCE_FILE;
-    if (_str::ends_with(path, ".rc")) {
+    if (str::ends_with(path, ".rc")) {
         ftype = CRATE_FILE;
     }
     auto srdr = io::file_reader(path);
     auto filemap = codemap::new_filemap(path, pos);
-    _vec::push[codemap::filemap](sess.get_codemap().files, filemap);
-    auto itr = @interner::mk_interner[str](_str::hash, _str::eq);
+    vec::push[codemap::filemap](sess.get_codemap().files, filemap);
+    auto itr = @interner::mk_interner[str](str::hash, str::eq);
     auto rdr = lexer::new_reader(sess, srdr, filemap, itr);
     // Make sure npos points at first actual token:
     lexer::consume_any_whitespace(rdr);
@@ -278,14 +278,14 @@ fn parse_str_lit_or_env_ident(parser p) -> ast::ident {
 
 fn is_word(&parser p, &str word) -> bool {
     ret alt (p.peek()) {
-        case (token::IDENT(?sid, false)) { _str::eq(word, p.get_str(sid)) }
+        case (token::IDENT(?sid, false)) { str::eq(word, p.get_str(sid)) }
         case (_) { false }
     };
 }
 fn eat_word(&parser p, &str word) -> bool {
     alt (p.peek()) {
         case (token::IDENT(?sid, false)) {
-            if (_str::eq(word, p.get_str(sid))) {
+            if (str::eq(word, p.get_str(sid))) {
                 p.bump();
                 ret true;
             } else { ret false; }
@@ -433,7 +433,7 @@ fn parse_constrs(parser p) -> common::spanned[vec[@ast::constr]] {
         while (true) {
             auto constr = parse_ty_constr(p);
             hi = constr.span.hi;
-            _vec::push[@ast::constr](constrs, constr);
+            vec::push[@ast::constr](constrs, constr);
             if (p.peek() == token::COMMA) {
                 p.bump();
             } else {
@@ -818,7 +818,7 @@ fn parse_elt(parser p) -> ast::elt {
             if (eat_word(p, "with")) {
                 with_obj = some[ast::ident](parse_ident(p));
             } else {
-                _vec::push[@ast::method](meths,
+                vec::push[@ast::method](meths,
                                          parse_method(p));
             }
         }
@@ -1004,16 +1004,16 @@ fn expand_syntax_ext(parser p, ast::span sp,
                      &ast::path path, vec[@ast::expr] args,
                      option::t[str] body) -> ast::expr_ {
 
-    assert (_vec::len[ast::ident](path.node.idents) > 0u);
+    assert (vec::len[ast::ident](path.node.idents) > 0u);
     auto extname = path.node.idents.(0);
-    if (_str::eq(extname, "fmt")) {
+    if (str::eq(extname, "fmt")) {
         auto expanded = extfmt::expand_syntax_ext(p, args, body);
         auto newexpr = ast::expr_ext(path, args, body,
                                     expanded,
                                     p.get_ann());
 
         ret newexpr;
-    } else if (_str::eq(extname, "env")) {
+    } else if (str::eq(extname, "env")) {
         auto expanded = extenv::expand_syntax_ext(p, sp, args, body);
         auto newexpr = ast::expr_ext(path, args, body,
                                     expanded,
@@ -1833,7 +1833,7 @@ fn parse_item_obj(parser p, ast::layer lyr) -> @ast::item {
         if (eat_word(p, "drop")) {
             dtor = some[@ast::method](parse_dtor(p));
         } else {
-            _vec::push[@ast::method](meths,
+            vec::push[@ast::method](meths,
                                      parse_method(p));
         }
     }
@@ -1953,12 +1953,12 @@ fn parse_item_native_mod(parser p) -> @ast::item {
     auto abi = ast::native_abi_cdecl;
     if (!is_word(p, "mod")) {
         auto t = parse_str_lit_or_env_ident(p);
-        if (_str::eq(t, "cdecl")) {
-        } else if (_str::eq(t, "rust")) {
+        if (str::eq(t, "cdecl")) {
+        } else if (str::eq(t, "rust")) {
             abi = ast::native_abi_rust;
-        } else if (_str::eq(t, "llvm")) {
+        } else if (str::eq(t, "llvm")) {
             abi = ast::native_abi_llvm;
-        } else if (_str::eq(t, "rust-intrinsic")) {
+        } else if (str::eq(t, "rust-intrinsic")) {
             abi = ast::native_abi_rust_intrinsic;
         } else {
             p.err("unsupported abi: " + t);
@@ -2079,16 +2079,16 @@ fn peeking_at_item(parser p) -> bool {
     alt (p.peek()) {
         case (token::IDENT(?sid, false)) {
             auto st = p.get_str(sid);
-            ret _str::eq(st, "state") ||
-                _str::eq(st, "gc") ||
-                _str::eq(st, "const") ||
-                _str::eq(st, "fn") ||
-                _str::eq(st, "pred") ||
-                _str::eq(st, "iter") ||
-                _str::eq(st, "mod") ||
-                _str::eq(st, "type") ||
-                _str::eq(st, "tag") ||
-                _str::eq(st, "obj");
+            ret str::eq(st, "state") ||
+                str::eq(st, "gc") ||
+                str::eq(st, "const") ||
+                str::eq(st, "fn") ||
+                str::eq(st, "pred") ||
+                str::eq(st, "iter") ||
+                str::eq(st, "mod") ||
+                str::eq(st, "type") ||
+                str::eq(st, "tag") ||
+                str::eq(st, "obj");
         }
         case (_) { ret false; }
     }
@@ -2193,7 +2193,7 @@ fn parse_rest_import_name(parser p, ast::ident first,
             defined_id = i;
         }
         case (_) {
-            auto len = _vec::len[ast::ident](identifiers);
+            auto len = vec::len[ast::ident](identifiers);
             defined_id = identifiers.(len - 1u);
         }
     }
@@ -2262,8 +2262,8 @@ fn is_view_item(&parser p) -> bool {
     alt (p.peek()) {
         case (token::IDENT(?sid, false)) {
             auto st = p.get_str(sid);
-            ret _str::eq(st, "use") || _str::eq(st, "import") ||
-                _str::eq(st, "export");
+            ret str::eq(st, "use") || str::eq(st, "import") ||
+                str::eq(st, "export");
         }
         case (_) { ret false; }
     }
@@ -2389,7 +2389,7 @@ fn parse_crate_directives(parser p, token::token term)
 
     while (p.peek() != term) {
         auto cdir = @parse_crate_directive(p);
-        _vec::push[@ast::crate_directive](cdirs, cdir);
+        vec::push[@ast::crate_directive](cdirs, cdir);
     }
 
     ret cdirs;
index b72d41e7d24d3eb35c001ad3be58ff90932e3024..41b8f30d6283338c019011515445390f1651d933 100644 (file)
@@ -2,9 +2,9 @@
 import util::common::ty_mach_to_str;
 import util::common::new_str_hash;
 import util::interner;
-import std::_int;
-import std::_uint;
-import std::_str;
+import std::int;
+import std::uint;
+import std::str;
 
 type str_num = uint;
 
@@ -133,10 +133,10 @@ fn to_str(lexer::reader r, token t) -> str {
         case (POUND) { ret "#"; }
 
         /* Literals */
-        case (LIT_INT(?i)) { ret _int::to_str(i, 10u); }
-        case (LIT_UINT(?u)) { ret _uint::to_str(u, 10u); }
+        case (LIT_INT(?i)) { ret int::to_str(i, 10u); }
+        case (LIT_UINT(?u)) { ret uint::to_str(u, 10u); }
         case (LIT_MACH_INT(?tm, ?i)) {
-            ret  _int::to_str(i, 10u)
+            ret  int::to_str(i, 10u)
                 + "_" + ty_mach_to_str(tm);
         }
         case (LIT_MACH_FLOAT(?tm, ?s)) {
@@ -152,8 +152,8 @@ fn to_str(lexer::reader r, token t) -> str {
         case (LIT_CHAR(?c)) {
             // FIXME: escape.
             auto tmp = "'";
-            _str::push_char(tmp, c);
-            _str::push_byte(tmp, '\'' as u8);
+            str::push_char(tmp, c);
+            str::push_byte(tmp, '\'' as u8);
             ret tmp;
         }
 
@@ -163,7 +163,7 @@ fn to_str(lexer::reader r, token t) -> str {
 
         /* Name components */
         case (IDENT(?s, _)) { ret interner::get[str](*r.get_interner(), s); }
-        case (IDX(?i)) { ret "_" + _int::to_str(i, 10u); }
+        case (IDX(?i)) { ret "_" + int::to_str(i, 10u); }
         case (UNDERSCORE) { ret "_"; }
 
         case (BRACEQUOTE(_)) { ret "<bracequote>"; }
index 4a8e42a42d000c3fd4648200aacab2c75030ee68..6774d224aafe315bd8a66790a81822246853c7d2 100644 (file)
@@ -1,7 +1,7 @@
-import std::_vec;
-import std::_str;
-import std::_str::rustrt::sbuf;
-import std::_vec::rustrt::vbuf;
+import std::vec;
+import std::str;
+import std::str::rustrt::sbuf;
+import std::vec::rustrt::vbuf;
 
 import llvm::ModuleRef;
 import llvm::ContextRef;
@@ -908,8 +908,8 @@ fn AggregateRet(vec[ValueRef] RetVals) -> ValueRef {
         assert (!*terminated);
         *terminated = true;
         ret llvm::LLVMBuildAggregateRet(B,
-                                       _vec::buf[ValueRef](RetVals),
-                                       _vec::len[ValueRef](RetVals));
+                                       vec::buf[ValueRef](RetVals),
+                                       vec::len[ValueRef](RetVals));
     }
 
     fn Br(BasicBlockRef Dest) -> ValueRef {
@@ -944,10 +944,10 @@ fn Invoke(ValueRef Fn,
         assert (!*terminated);
         *terminated = true;
         ret llvm::LLVMBuildInvoke(B, Fn,
-                                 _vec::buf[ValueRef](Args),
-                                 _vec::len[ValueRef](Args),
+                                 vec::buf[ValueRef](Args),
+                                 vec::len[ValueRef](Args),
                                  Then, Catch,
-                                 _str::buf(""));
+                                 str::buf(""));
     }
 
     fn Unwind() -> ValueRef {
@@ -965,176 +965,176 @@ fn Unreachable() -> ValueRef {
     /* Arithmetic */
     fn Add(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildAdd(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildAdd(B, LHS, RHS, str::buf(""));
     }
 
     fn NSWAdd(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildNSWAdd(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildNSWAdd(B, LHS, RHS, str::buf(""));
     }
 
     fn NUWAdd(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildNUWAdd(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildNUWAdd(B, LHS, RHS, str::buf(""));
     }
 
     fn FAdd(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFAdd(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildFAdd(B, LHS, RHS, str::buf(""));
     }
 
     fn Sub(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildSub(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildSub(B, LHS, RHS, str::buf(""));
     }
 
     fn NSWSub(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildNSWSub(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildNSWSub(B, LHS, RHS, str::buf(""));
     }
 
     fn NUWSub(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildNUWSub(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildNUWSub(B, LHS, RHS, str::buf(""));
     }
 
     fn FSub(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFSub(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildFSub(B, LHS, RHS, str::buf(""));
     }
 
     fn Mul(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildMul(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildMul(B, LHS, RHS, str::buf(""));
     }
 
     fn NSWMul(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildNSWMul(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildNSWMul(B, LHS, RHS, str::buf(""));
     }
 
     fn NUWMul(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildNUWMul(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildNUWMul(B, LHS, RHS, str::buf(""));
     }
 
     fn FMul(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFMul(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildFMul(B, LHS, RHS, str::buf(""));
     }
 
     fn UDiv(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildUDiv(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildUDiv(B, LHS, RHS, str::buf(""));
     }
 
     fn SDiv(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildSDiv(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildSDiv(B, LHS, RHS, str::buf(""));
     }
 
     fn ExactSDiv(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildExactSDiv(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildExactSDiv(B, LHS, RHS, str::buf(""));
     }
 
     fn FDiv(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFDiv(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildFDiv(B, LHS, RHS, str::buf(""));
     }
 
     fn URem(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildURem(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildURem(B, LHS, RHS, str::buf(""));
     }
 
     fn SRem(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildSRem(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildSRem(B, LHS, RHS, str::buf(""));
     }
 
     fn FRem(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFRem(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildFRem(B, LHS, RHS, str::buf(""));
     }
 
     fn Shl(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildShl(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildShl(B, LHS, RHS, str::buf(""));
     }
 
     fn LShr(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildLShr(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildLShr(B, LHS, RHS, str::buf(""));
     }
 
     fn AShr(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildAShr(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildAShr(B, LHS, RHS, str::buf(""));
     }
 
     fn And(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildAnd(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildAnd(B, LHS, RHS, str::buf(""));
     }
 
     fn Or(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildOr(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildOr(B, LHS, RHS, str::buf(""));
     }
 
     fn Xor(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildXor(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildXor(B, LHS, RHS, str::buf(""));
     }
 
     fn BinOp(Opcode Op, ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildBinOp(B, Op, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildBinOp(B, Op, LHS, RHS, str::buf(""));
     }
 
     fn Neg(ValueRef V) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildNeg(B, V, _str::buf(""));
+        ret llvm::LLVMBuildNeg(B, V, str::buf(""));
     }
 
     fn NSWNeg(ValueRef V) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildNSWNeg(B, V, _str::buf(""));
+        ret llvm::LLVMBuildNSWNeg(B, V, str::buf(""));
     }
 
     fn NUWNeg(ValueRef V) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildNUWNeg(B, V, _str::buf(""));
+        ret llvm::LLVMBuildNUWNeg(B, V, str::buf(""));
     }
     fn FNeg(ValueRef V) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFNeg(B, V, _str::buf(""));
+        ret llvm::LLVMBuildFNeg(B, V, str::buf(""));
     }
     fn Not(ValueRef V) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildNot(B, V, _str::buf(""));
+        ret llvm::LLVMBuildNot(B, V, str::buf(""));
     }
 
     /* Memory */
     fn Malloc(TypeRef Ty) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildMalloc(B, Ty, _str::buf(""));
+        ret llvm::LLVMBuildMalloc(B, Ty, str::buf(""));
     }
 
     fn ArrayMalloc(TypeRef Ty, ValueRef Val) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildArrayMalloc(B, Ty, Val, _str::buf(""));
+        ret llvm::LLVMBuildArrayMalloc(B, Ty, Val, str::buf(""));
     }
 
     fn Alloca(TypeRef Ty) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildAlloca(B, Ty, _str::buf(""));
+        ret llvm::LLVMBuildAlloca(B, Ty, str::buf(""));
     }
 
     fn ArrayAlloca(TypeRef Ty, ValueRef Val) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildArrayAlloca(B, Ty, Val, _str::buf(""));
+        ret llvm::LLVMBuildArrayAlloca(B, Ty, Val, str::buf(""));
     }
 
     fn Free(ValueRef PointerVal) -> ValueRef {
@@ -1144,7 +1144,7 @@ fn Free(ValueRef PointerVal) -> ValueRef {
 
     fn Load(ValueRef PointerVal) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildLoad(B, PointerVal, _str::buf(""));
+        ret llvm::LLVMBuildLoad(B, PointerVal, str::buf(""));
     }
 
     fn Store(ValueRef Val, ValueRef Ptr) -> ValueRef {
@@ -1155,140 +1155,140 @@ fn Store(ValueRef Val, ValueRef Ptr) -> ValueRef {
     fn GEP(ValueRef Pointer, vec[ValueRef] Indices) -> ValueRef {
         assert (!*terminated);
         ret llvm::LLVMBuildGEP(B, Pointer,
-                              _vec::buf[ValueRef](Indices),
-                              _vec::len[ValueRef](Indices),
-                              _str::buf(""));
+                              vec::buf[ValueRef](Indices),
+                              vec::len[ValueRef](Indices),
+                              str::buf(""));
     }
 
     fn InBoundsGEP(ValueRef Pointer, vec[ValueRef] Indices) -> ValueRef {
         assert (!*terminated);
         ret llvm::LLVMBuildInBoundsGEP(B, Pointer,
-                                      _vec::buf[ValueRef](Indices),
-                                      _vec::len[ValueRef](Indices),
-                                      _str::buf(""));
+                                      vec::buf[ValueRef](Indices),
+                                      vec::len[ValueRef](Indices),
+                                      str::buf(""));
     }
 
     fn StructGEP(ValueRef Pointer, uint Idx) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildStructGEP(B, Pointer, Idx, _str::buf(""));
+        ret llvm::LLVMBuildStructGEP(B, Pointer, Idx, str::buf(""));
     }
 
     fn GlobalString(sbuf _Str) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildGlobalString(B, _Str, _str::buf(""));
+        ret llvm::LLVMBuildGlobalString(B, _Str, str::buf(""));
     }
 
     fn GlobalStringPtr(sbuf _Str) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildGlobalStringPtr(B, _Str, _str::buf(""));
+        ret llvm::LLVMBuildGlobalStringPtr(B, _Str, str::buf(""));
     }
 
     /* Casts */
     fn Trunc(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildTrunc(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildTrunc(B, Val, DestTy, str::buf(""));
     }
 
     fn ZExt(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildZExt(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildZExt(B, Val, DestTy, str::buf(""));
     }
 
     fn SExt(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildSExt(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildSExt(B, Val, DestTy, str::buf(""));
     }
 
     fn FPToUI(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFPToUI(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildFPToUI(B, Val, DestTy, str::buf(""));
     }
 
     fn FPToSI(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFPToSI(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildFPToSI(B, Val, DestTy, str::buf(""));
     }
 
     fn UIToFP(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildUIToFP(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildUIToFP(B, Val, DestTy, str::buf(""));
     }
 
     fn SIToFP(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildSIToFP(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildSIToFP(B, Val, DestTy, str::buf(""));
     }
 
     fn FPTrunc(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFPTrunc(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildFPTrunc(B, Val, DestTy, str::buf(""));
     }
 
     fn FPExt(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFPExt(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildFPExt(B, Val, DestTy, str::buf(""));
     }
 
     fn PtrToInt(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildPtrToInt(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildPtrToInt(B, Val, DestTy, str::buf(""));
     }
 
     fn IntToPtr(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildIntToPtr(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildIntToPtr(B, Val, DestTy, str::buf(""));
     }
 
     fn BitCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildBitCast(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildBitCast(B, Val, DestTy, str::buf(""));
     }
 
     fn ZExtOrBitCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildZExtOrBitCast(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildZExtOrBitCast(B, Val, DestTy, str::buf(""));
     }
 
     fn SExtOrBitCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildSExtOrBitCast(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildSExtOrBitCast(B, Val, DestTy, str::buf(""));
     }
 
     fn TruncOrBitCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildTruncOrBitCast(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildTruncOrBitCast(B, Val, DestTy, str::buf(""));
     }
 
     fn Cast(Opcode Op, ValueRef Val, TypeRef DestTy, sbuf Name) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildCast(B, Op, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildCast(B, Op, Val, DestTy, str::buf(""));
     }
 
     fn PointerCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildPointerCast(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildPointerCast(B, Val, DestTy, str::buf(""));
     }
 
     fn IntCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildIntCast(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildIntCast(B, Val, DestTy, str::buf(""));
     }
 
     fn FPCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFPCast(B, Val, DestTy, _str::buf(""));
+        ret llvm::LLVMBuildFPCast(B, Val, DestTy, str::buf(""));
     }
 
 
     /* Comparisons */
     fn ICmp(uint Op, ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildICmp(B, Op, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildICmp(B, Op, LHS, RHS, str::buf(""));
     }
 
     fn FCmp(uint Op, ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildFCmp(B, Op, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildFCmp(B, Op, LHS, RHS, str::buf(""));
     }
 
 
@@ -1296,95 +1296,95 @@ fn FCmp(uint Op, ValueRef LHS, ValueRef RHS) -> ValueRef {
     fn Phi(TypeRef Ty, vec[ValueRef] vals,
            vec[BasicBlockRef] bbs) -> ValueRef {
         assert (!*terminated);
-        auto phi = llvm::LLVMBuildPhi(B, Ty, _str::buf(""));
-        assert (_vec::len[ValueRef](vals) == _vec::len[BasicBlockRef](bbs));
+        auto phi = llvm::LLVMBuildPhi(B, Ty, str::buf(""));
+        assert (vec::len[ValueRef](vals) == vec::len[BasicBlockRef](bbs));
         llvm::LLVMAddIncoming(phi,
-                             _vec::buf[ValueRef](vals),
-                             _vec::buf[BasicBlockRef](bbs),
-                             _vec::len[ValueRef](vals));
+                             vec::buf[ValueRef](vals),
+                             vec::buf[BasicBlockRef](bbs),
+                             vec::len[ValueRef](vals));
         ret phi;
     }
 
     fn AddIncomingToPhi(ValueRef phi,
                         vec[ValueRef] vals,
                         vec[BasicBlockRef] bbs) {
-        assert (_vec::len[ValueRef](vals) == _vec::len[BasicBlockRef](bbs));
+        assert (vec::len[ValueRef](vals) == vec::len[BasicBlockRef](bbs));
         llvm::LLVMAddIncoming(phi,
-                             _vec::buf[ValueRef](vals),
-                             _vec::buf[BasicBlockRef](bbs),
-                             _vec::len[ValueRef](vals));
+                             vec::buf[ValueRef](vals),
+                             vec::buf[BasicBlockRef](bbs),
+                             vec::len[ValueRef](vals));
     }
 
     fn Call(ValueRef Fn, vec[ValueRef] Args) -> ValueRef {
         assert (!*terminated);
         ret llvm::LLVMBuildCall(B, Fn,
-                               _vec::buf[ValueRef](Args),
-                               _vec::len[ValueRef](Args),
-                               _str::buf(""));
+                               vec::buf[ValueRef](Args),
+                               vec::len[ValueRef](Args),
+                               str::buf(""));
     }
 
     fn FastCall(ValueRef Fn, vec[ValueRef] Args) -> ValueRef {
         assert (!*terminated);
         auto v = llvm::LLVMBuildCall(B, Fn,
-                                    _vec::buf[ValueRef](Args),
-                                    _vec::len[ValueRef](Args),
-                                    _str::buf(""));
+                                    vec::buf[ValueRef](Args),
+                                    vec::len[ValueRef](Args),
+                                    str::buf(""));
         llvm::LLVMSetInstructionCallConv(v, LLVMFastCallConv);
         ret v;
     }
 
     fn Select(ValueRef If, ValueRef Then, ValueRef Else) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildSelect(B, If, Then, Else, _str::buf(""));
+        ret llvm::LLVMBuildSelect(B, If, Then, Else, str::buf(""));
     }
 
     fn VAArg(ValueRef list, TypeRef Ty) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildVAArg(B, list, Ty, _str::buf(""));
+        ret llvm::LLVMBuildVAArg(B, list, Ty, str::buf(""));
     }
 
     fn ExtractElement(ValueRef VecVal, ValueRef Index) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildExtractElement(B, VecVal, Index, _str::buf(""));
+        ret llvm::LLVMBuildExtractElement(B, VecVal, Index, str::buf(""));
     }
 
     fn InsertElement(ValueRef VecVal, ValueRef EltVal,
                      ValueRef Index) -> ValueRef {
         assert (!*terminated);
         ret llvm::LLVMBuildInsertElement(B, VecVal, EltVal, Index,
-                                        _str::buf(""));
+                                        str::buf(""));
     }
 
     fn ShuffleVector(ValueRef V1, ValueRef V2, ValueRef Mask) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildShuffleVector(B, V1, V2, Mask, _str::buf(""));
+        ret llvm::LLVMBuildShuffleVector(B, V1, V2, Mask, str::buf(""));
     }
 
     fn ExtractValue(ValueRef AggVal, uint Index) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildExtractValue(B, AggVal, Index, _str::buf(""));
+        ret llvm::LLVMBuildExtractValue(B, AggVal, Index, str::buf(""));
     }
 
     fn InsertValue(ValueRef AggVal, ValueRef EltVal,
                    uint Index) -> ValueRef {
         assert (!*terminated);
         ret llvm::LLVMBuildInsertValue(B, AggVal, EltVal, Index,
-                                       _str::buf(""));
+                                       str::buf(""));
     }
 
     fn IsNull(ValueRef Val) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildIsNull(B, Val, _str::buf(""));
+        ret llvm::LLVMBuildIsNull(B, Val, str::buf(""));
     }
 
     fn IsNotNull(ValueRef Val) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildIsNotNull(B, Val, _str::buf(""));
+        ret llvm::LLVMBuildIsNotNull(B, Val, str::buf(""));
     }
 
     fn PtrDiff(ValueRef LHS, ValueRef RHS) -> ValueRef {
         assert (!*terminated);
-        ret llvm::LLVMBuildPtrDiff(B, LHS, RHS, _str::buf(""));
+        ret llvm::LLVMBuildPtrDiff(B, LHS, RHS, str::buf(""));
     }
 
     fn Trap() -> ValueRef {
@@ -1393,13 +1393,13 @@ fn Trap() -> ValueRef {
         let ValueRef FN = llvm::LLVMGetBasicBlockParent(BB);
         let ModuleRef M = llvm::LLVMGetGlobalParent(FN);
         let ValueRef T = llvm::LLVMGetNamedFunction(M,
-                                                    _str::buf("llvm.trap"));
+                                                    str::buf("llvm.trap"));
         assert (T as int != 0);
         let vec[ValueRef] Args = [];
         ret llvm::LLVMBuildCall(B, T,
-                               _vec::buf[ValueRef](Args),
-                               _vec::len[ValueRef](Args),
-                               _str::buf(""));
+                               vec::buf[ValueRef](Args),
+                               vec::len[ValueRef](Args),
+                               str::buf(""));
     }
 
     drop {
@@ -1520,8 +1520,8 @@ fn tys_str(type_names names,
             let TypeRef out_ty = llvm::LLVMGetReturnType(ty);
             let uint n_args = llvm::LLVMCountParamTypes(ty);
             let vec[TypeRef] args =
-                _vec::init_elt[TypeRef](0 as TypeRef, n_args);
-            llvm::LLVMGetParamTypes(ty, _vec::buf[TypeRef](args));
+                vec::init_elt[TypeRef](0 as TypeRef, n_args);
+            llvm::LLVMGetParamTypes(ty, vec::buf[TypeRef](args));
             s += tys_str(names, outer, args);
             s += ") -> ";
             s += type_to_str_inner(names, outer, out_ty);
@@ -1532,8 +1532,8 @@ fn tys_str(type_names names,
             let str s = "{";
             let uint n_elts = llvm::LLVMCountStructElementTypes(ty);
             let vec[TypeRef] elts =
-                _vec::init_elt[TypeRef](0 as TypeRef, n_elts);
-            llvm::LLVMGetStructElementTypes(ty, _vec::buf[TypeRef](elts));
+                vec::init_elt[TypeRef](0 as TypeRef, n_elts);
+            llvm::LLVMGetStructElementTypes(ty, vec::buf[TypeRef](elts));
             s += tys_str(names, outer, elts);
             s += "}";
             ret s;
@@ -1546,7 +1546,7 @@ fn tys_str(type_names names,
             for (TypeRef tout in outer0) {
                 i += 1u;
                 if (tout as int == ty as int) {
-                    let uint n = _vec::len[TypeRef](outer0) - i;
+                    let uint n = vec::len[TypeRef](outer0) - i;
                     ret "*\\" + util::common::istr(n as int);
                 }
             }
@@ -1573,7 +1573,7 @@ fn tys_str(type_names names,
 type target_data = rec(TargetDataRef lltd, target_data_dtor dtor);
 
 fn mk_target_data(str string_rep) -> target_data {
-    auto lltd = llvm::LLVMCreateTargetData(_str::buf(string_rep));
+    auto lltd = llvm::LLVMCreateTargetData(str::buf(string_rep));
     ret rec(lltd=lltd, dtor=target_data_dtor(lltd));
 }
 
index 8d615bde42ec4341d4ecfdda6b1246be748eed93..f0de3c4b3cbcfcade872f3d21bc55bd257da0f2e 100644 (file)
@@ -33,8 +33,8 @@
 import front::ast::mt;
 import front::ast::purity;
 
-import std::_uint;
-import std::_vec;
+import std::uint;
+import std::vec;
 
 type ast_fold[ENV] =
     @rec
 fn fold_path[ENV](&ENV env, &ast_fold[ENV] fld, &path p) -> path {
     let vec[@ast::ty] tys_ = [];
     for (@ast::ty t in p.node.types) {
-        _vec::push[@ast::ty](tys_, fold_ty(env, fld, t));
+        vec::push[@ast::ty](tys_, fold_ty(env, fld, t));
     }
     let ast::path_ p_ = rec(idents=p.node.idents, types=tys_);
     ret fld.fold_path(env, p.span, p_);
@@ -404,7 +404,7 @@ fn fold_ty[ENV](&ENV env, &ast_fold[ENV] fld, &@ty t) -> @ty {
             let vec[mt] elts_ = [];
             for (mt elt in elts) {
                 auto ty_ = fold_ty(env, fld, elt.ty);
-                _vec::push[mt](elts_, rec(ty=ty_, mut=elt.mut));
+                vec::push[mt](elts_, rec(ty=ty_, mut=elt.mut));
             }
             ret fld.fold_ty_tup(env_, t.span, elts_);
         }
@@ -413,7 +413,7 @@ fn fold_ty[ENV](&ENV env, &ast_fold[ENV] fld, &@ty t) -> @ty {
             let vec[ast::ty_field] flds_ = [];
             for (ast::ty_field f in flds) {
                 auto ty_ = fold_ty(env, fld, f.mt.ty);
-                _vec::push[ast::ty_field]
+                vec::push[ast::ty_field]
                     (flds_, rec(mt=rec(ty=ty_, mut=f.mt.mut) with f));
             }
             ret fld.fold_ty_rec(env_, t.span, flds_);
@@ -426,7 +426,7 @@ fn fold_ty[ENV](&ENV env, &ast_fold[ENV] fld, &@ty t) -> @ty {
                                       m.inputs, m.output);
                 alt (tfn.node) {
                     case (ast::ty_fn(?p, ?ins, ?out)) {
-                        _vec::push[ast::ty_method]
+                        vec::push[ast::ty_method]
                             (meths_, rec(proto=p, inputs=ins,
                                          output=out with m));
                     }
@@ -541,7 +541,7 @@ fn fold_exprs[ENV](&ENV env, &ast_fold[ENV] fld,
                    &vec[@expr] es) -> vec[@expr] {
     let vec[@expr] exprs = [];
     for (@expr e in es) {
-        _vec::push[@expr](exprs, fold_expr(env, fld, e));
+        vec::push[@expr](exprs, fold_expr(env, fld, e));
     }
     ret exprs;
 }
@@ -893,7 +893,7 @@ fn fold_block[ENV](&ENV env, &ast_fold[ENV] fld, &block blk) -> block {
     let vec[@ast::stmt] stmts = [];
     for (@ast::stmt s in blk.node.stmts) {
         auto new_stmt = fold_stmt[ENV](env_, fld, s);
-        _vec::push[@ast::stmt](stmts, new_stmt);
+        vec::push[@ast::stmt](stmts, new_stmt);
     }
 
     auto expr = none[@ast::expr];
@@ -980,7 +980,7 @@ fn fold_obj[ENV](&ENV env, &ast_fold[ENV] fld, &ast::_obj ob) -> ast::_obj {
                                                 m.node.ann),
                                span=m.span);
         let ENV _env = fld.update_env_for_item(env, i);
-        _vec::push[@ast::method](meths, fold_method(_env, fld, m));
+        vec::push[@ast::method](meths, fold_method(_env, fld, m));
     }
     ret fld.fold_obj(env, fields, meths, dtor);
 }
@@ -1023,7 +1023,7 @@ fn fold_anon_obj[ENV](&ENV env, &ast_fold[ENV] fld, &ast::anon_obj ob)
                                                 m.node.ann),
                                span=m.span);
         let ENV _env = fld.update_env_for_item(env, i);
-        _vec::push[@ast::method](meths, fold_method(_env, fld, m));
+        vec::push[@ast::method](meths, fold_method(_env, fld, m));
     }
     ret fld.fold_anon_obj(env, fields, meths, with_obj);
 }
@@ -1124,12 +1124,12 @@ fn fold_mod[ENV](&ENV e, &ast_fold[ENV] fld, &ast::_mod m) -> ast::_mod {
 
     for (@view_item vi in m.view_items) {
         auto new_vi = fold_view_item[ENV](e, fld, vi);
-        _vec::push[@view_item](view_items, new_vi);
+        vec::push[@view_item](view_items, new_vi);
     }
 
     for (@item i in m.items) {
         auto new_item = fold_item[ENV](e, fld, i);
-        _vec::push[@item](items, new_item);
+        vec::push[@item](items, new_item);
     }
 
     ret fld.fold_mod(e, rec(view_items=view_items, items=items));
@@ -1162,12 +1162,12 @@ fn fold_native_mod[ENV](&ENV e, &ast_fold[ENV] fld,
 
     for (@view_item vi in m.view_items) {
         auto new_vi = fold_view_item[ENV](e, fld, vi);
-        _vec::push[@view_item](view_items, new_vi);
+        vec::push[@view_item](view_items, new_vi);
     }
 
     for (@native_item i in m.items) {
         auto new_item = fold_native_item[ENV](e, fld, i);
-        _vec::push[@native_item](items, new_item);
+        vec::push[@native_item](items, new_item);
     }
 
     ret fld.fold_native_mod(e, rec(native_name=m.native_name,
index 1cad201103f9142ea5a24c185d42c57be7ee60a2..7f518506254bca08c7beff12e48a82eb12851165 100644 (file)
@@ -1,6 +1,6 @@
-import std::_str;
-import std::_uint;
-import std::_vec;
+import std::str;
+import std::uint;
+import std::vec;
 import std::map::hashmap;
 import std::ebml;
 import std::io;
@@ -120,8 +120,8 @@ fn estimate_sz(uint u) -> uint {
                         if (abbrev_len < len) {
                             // I.e. it's actually an abbreviation.
                             auto s = ("#"
-                                      + _uint::to_str(pos, 16u) + ":"
-                                      + _uint::to_str(len, 16u) + "#");
+                                      + uint::to_str(pos, 16u) + ":"
+                                      + uint::to_str(len, 16u) + "#");
                             auto a = rec(pos=pos, len=len, s=s);
                             abbrevs.insert(t, a);
                         }
@@ -265,7 +265,7 @@ fn enc_ty_fn(&io::writer w, &@ctxt cx, &vec[ty::arg] args, &ty::t out) {
 
 // Returns a Plain Old LLVM String:
 fn C_postr(&str s) -> ValueRef {
-    ret llvm::LLVMConstString(_str::buf(s), _str::byte_len(s), False);
+    ret llvm::LLVMConstString(str::buf(s), str::byte_len(s), False);
 }
 
 
@@ -273,13 +273,13 @@ fn C_postr(&str s) -> ValueRef {
 
 fn encode_name(&ebml::writer ebml_w, &str name) {
     ebml::start_tag(ebml_w, tag_paths_data_name);
-    ebml_w.writer.write(_str::bytes(name));
+    ebml_w.writer.write(str::bytes(name));
     ebml::end_tag(ebml_w);
 }
 
 fn encode_def_id(&ebml::writer ebml_w, &ast::def_id id) {
     ebml::start_tag(ebml_w, tag_def_id);
-    ebml_w.writer.write(_str::bytes(def_to_str(id)));
+    ebml_w.writer.write(str::bytes(def_to_str(id)));
     ebml::end_tag(ebml_w);
 }
 
@@ -301,7 +301,7 @@ fn add_to_index(&ebml::writer ebml_w,
                 &mutable vec[tup(str, uint)] index,
                 &str name) {
     auto full_path = path + [name];
-    index += [tup(_str::connect(full_path, "::"), ebml_w.writer.tell())];
+    index += [tup(str::connect(full_path, "::"), ebml_w.writer.tell())];
 }
 
 fn encode_native_module_item_paths(&ebml::writer ebml_w,
@@ -424,13 +424,13 @@ fn def_to_str(&ast::def_id did) -> str {
 
 fn encode_type_param_count(&ebml::writer ebml_w, &vec[ast::ty_param] tps) {
     ebml::start_tag(ebml_w, tag_items_data_item_ty_param_count);
-    ebml::write_vint(ebml_w.writer, _vec::len[ast::ty_param](tps));
+    ebml::write_vint(ebml_w.writer, vec::len[ast::ty_param](tps));
     ebml::end_tag(ebml_w);
 }
 
 fn encode_variant_id(&ebml::writer ebml_w, &ast::def_id vid) {
     ebml::start_tag(ebml_w, tag_items_data_item_variant);
-    ebml_w.writer.write(_str::bytes(def_to_str(vid)));
+    ebml_w.writer.write(str::bytes(def_to_str(vid)));
     ebml::end_tag(ebml_w);
 }
 
@@ -447,20 +447,20 @@ fn encode_type(&@trans::crate_ctxt cx, &ebml::writer ebml_w, &ty::t typ) {
 fn encode_symbol(&@trans::crate_ctxt cx, &ebml::writer ebml_w,
                  &ast::def_id did) {
     ebml::start_tag(ebml_w, tag_items_data_item_symbol);
-    ebml_w.writer.write(_str::bytes(cx.item_symbols.get(did)));
+    ebml_w.writer.write(str::bytes(cx.item_symbols.get(did)));
     ebml::end_tag(ebml_w);
 }
 
 fn encode_discriminant(&@trans::crate_ctxt cx, &ebml::writer ebml_w,
                        &ast::def_id did) {
     ebml::start_tag(ebml_w, tag_items_data_item_symbol);
-    ebml_w.writer.write(_str::bytes(cx.discrim_symbols.get(did)));
+    ebml_w.writer.write(str::bytes(cx.discrim_symbols.get(did)));
     ebml::end_tag(ebml_w);
 }
 
 fn encode_tag_id(&ebml::writer ebml_w, &ast::def_id id) {
     ebml::start_tag(ebml_w, tag_items_data_item_tag_id);
-    ebml_w.writer.write(_str::bytes(def_to_str(id)));
+    ebml_w.writer.write(str::bytes(def_to_str(id)));
     ebml::end_tag(ebml_w);
 }
 
@@ -478,7 +478,7 @@ fn encode_tag_variant_info(&@trans::crate_ctxt cx, &ebml::writer ebml_w,
         encode_kind(ebml_w, 'v' as u8);
         encode_tag_id(ebml_w, did);
         encode_type(cx, ebml_w, trans::node_ann_type(cx, variant.node.ann));
-        if (_vec::len[ast::variant_arg](variant.node.args) > 0u) {
+        if (vec::len[ast::variant_arg](variant.node.args) > 0u) {
             encode_symbol(cx, ebml_w, variant.node.id);
         }
         encode_discriminant(cx, ebml_w, variant.node.id);
@@ -611,7 +611,7 @@ fn hash_def_num(&int def_num) -> uint {
 
 fn hash_path(&str s) -> uint {
     auto h = 5381u;
-    for (u8 ch in _str::bytes(s)) {
+    for (u8 ch in str::bytes(s)) {
         h = ((h << 5u) + h) ^ (ch as uint);
     }
     ret h;
@@ -620,7 +620,7 @@ fn hash_path(&str s) -> uint {
 fn create_index[T](&vec[tup(T, uint)] index, fn(&T) -> uint hash_fn)
         -> vec[vec[tup(T, uint)]] {
     let vec[vec[tup(T, uint)]] buckets = [];
-    for each (uint i in _uint::range(0u, 256u)) {
+    for each (uint i in uint::range(0u, 256u)) {
         let vec[tup(T, uint)] bucket = [];
         buckets += [bucket];
     }
@@ -712,9 +712,9 @@ fn write_metadata(&@trans::crate_ctxt cx, &@ast::crate crate) {
 
     auto llconst = trans::C_struct([llmeta]);
     auto llglobal = llvm::LLVMAddGlobal(cx.llmod, trans::val_ty(llconst),
-                                       _str::buf("rust_metadata"));
+                                       str::buf("rust_metadata"));
     llvm::LLVMSetInitializer(llglobal, llconst);
-    llvm::LLVMSetSection(llglobal, _str::buf(x86::get_meta_sect_name()));
+    llvm::LLVMSetSection(llglobal, str::buf(x86::get_meta_sect_name()));
 }
 
 //
index 21851c4a261daa184f92ac7b795955027cbfde64..28692f23928d022b33050186a8a0dbc655834d17 100644 (file)
@@ -18,8 +18,8 @@
 import std::option;
 import std::option::some;
 import std::option::none;
-import std::_str;
-import std::_vec;
+import std::str;
+import std::vec;
 
 // Resolving happens in two passes. The first pass collects defids of all
 // (internal) imports and modules, so that they can be looked up when needed,
@@ -52,7 +52,7 @@
 type ext_hash = hashmap[tup(def_id,str,namespace),def];
 fn new_ext_hash() -> ext_hash {
     fn hash(&tup(def_id,str,namespace) v) -> uint {
-        ret _str::hash(v._1) + util::common::hash_def(v._0) + (alt (v._2) {
+        ret str::hash(v._1) + util::common::hash_def(v._0) + (alt (v._2) {
             case (ns_value) { 1u }
             case (ns_type) { 2u }
             case (ns_module) { 3u }
@@ -61,7 +61,7 @@ fn hash(&tup(def_id,str,namespace) v) -> uint {
     fn eq(&tup(def_id,str,namespace) v1,
           &tup(def_id,str,namespace) v2) -> bool {
         ret util::common::def_eq(v1._0, v2._0) &&
-            _str::eq(v1._1, v2._1) &&
+            str::eq(v1._1, v2._1) &&
             v1._2 == v2._2;
     }
     ret std::map::mk_hashmap[tup(def_id,str,namespace),def](hash, eq);
@@ -223,7 +223,7 @@ fn walk_pat(&env e, &list[scope] sc, &@ast::pat pat) {
                     }
                     case (_) {
                         e.sess.span_err(p.span, "not a tag variant: " +
-                                        _str::connect(p.node.idents, "::"));
+                                        str::connect(p.node.idents, "::"));
                         fail;
                     }
                 }
@@ -321,7 +321,7 @@ fn resolve_import(&env e, &@ast::view_item it, &list[scope] sc) {
     }
     e.imports.insert(defid._1, resolving(it.span));
     
-    auto n_idents = _vec::len(ids);
+    auto n_idents = vec::len(ids);
     auto end_id = ids.(n_idents - 1u);
 
     if (n_idents == 1u) {
@@ -377,7 +377,7 @@ fn unresolved(&env e, &span sp, &ident id, &str kind) {
 
 fn lookup_path_strict(&env e, &list[scope] sc, &span sp, vec[ident] idents,
                       namespace ns) -> def {
-    auto n_idents = _vec::len(idents);
+    auto n_idents = vec::len(idents);
     auto headns = if (n_idents == 1u) { ns } else { ns_module };
     auto dcur = lookup_in_scope_strict(e, sc, sp, idents.(0), headns);
     auto i = 1u;
@@ -477,7 +477,7 @@ fn in_scope(&env e, &ident id, &scope s, namespace ns)
                 if (ns == ns_value) {
                     alt (d.node) {
                         case (ast::decl_local(?local)) {
-                            if (_str::eq(local.ident, id)) {
+                            if (str::eq(local.ident, id)) {
                                 ret some(ast::def_local(local.id));
                             }
                         }
@@ -529,7 +529,7 @@ fn lookup_in_ty_params(&ident id, &vec[ast::ty_param] ty_params)
     -> option::t[def] {
     auto i = 0u;
     for (ast::ty_param tp in ty_params) {
-        if (_str::eq(tp, id)) {
+        if (str::eq(tp, id)) {
             ret some(ast::def_ty_arg(i));
         }
         i += 1u;
@@ -540,7 +540,7 @@ fn lookup_in_ty_params(&ident id, &vec[ast::ty_param] ty_params)
 fn lookup_in_pat(&ident id, &ast::pat pat) -> option::t[def] {
     alt (pat.node) {
         case (ast::pat_bind(?name, ?defid, _)) {
-            if (_str::eq(name, id)) { ret some(ast::def_binding(defid)); }
+            if (str::eq(name, id)) { ret some(ast::def_binding(defid)); }
         }
         case (ast::pat_wild(_)) {}
         case (ast::pat_lit(_, _)) {}
@@ -560,7 +560,7 @@ fn lookup_in_fn(&ident id, &ast::fn_decl decl, &vec[ast::ty_param] ty_params,
     alt (ns) {
         case (ns_value) {
             for (ast::arg a in decl.inputs) {
-                if (_str::eq(a.ident, id)) {
+                if (str::eq(a.ident, id)) {
                     ret some(ast::def_arg(a.id));
                 }
             }
@@ -578,7 +578,7 @@ fn lookup_in_obj(&ident id, &ast::_obj ob, &vec[ast::ty_param] ty_params,
     alt (ns) {
         case (ns_value) {
             for (ast::obj_field f in ob.fields) {
-                if (_str::eq(f.ident, id)) {
+                if (str::eq(f.ident, id)) {
                     ret some(ast::def_obj_field(f.id));
                 }
             }
@@ -598,7 +598,7 @@ fn lookup_in_block(&ident id, &ast::block_ b, namespace ns)
             case (ast::stmt_decl(?d,_)) {
                 alt (d.node) {
                     case (ast::decl_local(?loc)) {
-                        if (ns == ns_value && _str::eq(id, loc.ident)) {
+                        if (ns == ns_value && str::eq(id, loc.ident)) {
                             ret some(ast::def_local(loc.id));
                         }
                     }
@@ -607,12 +607,12 @@ fn lookup_in_block(&ident id, &ast::block_ b, namespace ns)
                             case (ast::item_tag(?name, ?variants, _,
                                                ?defid, _)) {
                                 if (ns == ns_type) {
-                                    if (_str::eq(name, id)) {
+                                    if (str::eq(name, id)) {
                                         ret some(ast::def_ty(defid));
                                     }
                                 } else if (ns == ns_value) {
                                     for (ast::variant v in variants) {
-                                        if (_str::eq(v.node.name, id)) {
+                                        if (str::eq(v.node.name, id)) {
                                             ret some(ast::def_variant(
                                                       defid, v.node.id));
                                         }
@@ -620,7 +620,7 @@ fn lookup_in_block(&ident id, &ast::block_ b, namespace ns)
                                 }
                             }
                             case (_) {
-                                if (_str::eq(ast::item_ident(it), id)) {
+                                if (str::eq(ast::item_ident(it), id)) {
                                     auto found = found_def_item(it, ns);
                                     if (!option::is_none(found)) {ret found;}
                                 }
index ad315df2dbff1ff3b53120f0ed155e2630cd405f..29f66d8b5631bb0ab4b36fd3c6f68dfb06fdc96e 100644 (file)
@@ -1,9 +1,9 @@
-import std::_int;
-import std::_str;
-import std::_uint;
-import std::_vec;
-import std::_str::rustrt::sbuf;
-import std::_vec::rustrt::vbuf;
+import std::int;
+import std::str;
+import std::uint;
+import std::vec;
+import std::str::rustrt::sbuf;
+import std::vec::rustrt::vbuf;
 import std::map;
 import std::map::hashmap;
 import std::option;
@@ -197,7 +197,7 @@ fn extend_path(@local_ctxt cx, &str name) -> @local_ctxt {
 }
 
 fn path_name(&vec[str] path) -> str {
-    ret _str::connect(path, sep());
+    ret str::connect(path, sep());
 }
 
 
@@ -215,7 +215,7 @@ fn get_type_sha1(&@crate_ctxt ccx, &ty::t t) -> str {
                            abbrevs=metadata::ac_no_abbrevs);
 
             ccx.sha.input_str(metadata::Encode::ty_str(cx, t));
-            hash = _str::substr(ccx.sha.result_str(), 0u, 16u);
+            hash = str::substr(ccx.sha.result_str(), 0u, 16u);
             ccx.type_sha1s.insert(t, hash);
         }
     }
@@ -335,8 +335,8 @@ fn T_size_t() -> TypeRef {
 
 fn T_fn(vec[TypeRef] inputs, TypeRef output) -> TypeRef {
     ret llvm::LLVMFunctionType(output,
-                              _vec::buf[TypeRef](inputs),
-                              _vec::len[TypeRef](inputs),
+                              vec::buf[TypeRef](inputs),
+                              vec::len[TypeRef](inputs),
                               False);
 }
 
@@ -350,8 +350,8 @@ fn T_ptr(TypeRef t) -> TypeRef {
 }
 
 fn T_struct(&vec[TypeRef] elts) -> TypeRef {
-    ret llvm::LLVMStructType(_vec::buf[TypeRef](elts),
-                            _vec::len[TypeRef](elts),
+    ret llvm::LLVMStructType(vec::buf[TypeRef](elts),
+                            vec::len[TypeRef](elts),
                             False);
 }
 
@@ -381,9 +381,9 @@ fn T_task(&type_names tn) -> TypeRef {
 fn T_tydesc_field(&type_names tn, int field) -> TypeRef {
     // Bit of a kludge: pick the fn typeref out of the tydesc..
     let vec[TypeRef] tydesc_elts =
-        _vec::init_elt[TypeRef](T_nil(), abi::n_tydesc_fields as uint);
+        vec::init_elt[TypeRef](T_nil(), abi::n_tydesc_fields as uint);
     llvm::LLVMGetStructElementTypes(T_tydesc(tn),
-                                   _vec::buf[TypeRef](tydesc_elts));
+                                   vec::buf[TypeRef](tydesc_elts));
     auto t = llvm::LLVMGetElementType(tydesc_elts.(field));
     ret t;
 }
@@ -401,7 +401,7 @@ fn T_glue_fn(&type_names tn) -> TypeRef {
 
 fn T_dtor(&@crate_ctxt ccx, TypeRef llself_ty) -> TypeRef {
     ret type_of_fn_full(ccx, ast::proto_fn, some[TypeRef](llself_ty),
-                        _vec::empty[ty::arg](), ty::mk_nil(ccx.tcx), 0u);
+                        vec::empty[ty::arg](), ty::mk_nil(ccx.tcx), 0u);
 }
 
 fn T_cmp_glue_fn(&type_names tn) -> TypeRef {
@@ -565,7 +565,7 @@ fn T_opaque_closure_ptr(&type_names tn) -> TypeRef {
 }
 
 fn T_tag(&type_names tn, uint size) -> TypeRef {
-    auto s = "tag_" + _uint::to_str(size, 10u);
+    auto s = "tag_" + uint::to_str(size, 10u);
     if (tn.name_has_type(s)) {
         ret tn.get_type(s);
     }
@@ -596,7 +596,7 @@ fn T_opaque_tag_ptr(&type_names tn) -> TypeRef {
 }
 
 fn T_captured_tydescs(&type_names tn, uint n) -> TypeRef {
-    ret T_struct(_vec::init_elt[TypeRef](T_ptr(T_tydesc(tn)), n));
+    ret T_struct(vec::init_elt[TypeRef](T_ptr(T_tydesc(tn)), n));
 }
 
 fn T_obj_ptr(&type_names tn, uint n_captured_tydescs) -> TypeRef {
@@ -857,7 +857,7 @@ fn type_of_inner(&@crate_ctxt cx, &ty::t t) -> TypeRef {
     assert (llty as int != 0);
     if (cx.sess.get_opts().save_temps) {
         llvm::LLVMAddTypeName(cx.llmod,
-                             _str::buf(ty::ty_to_short_str(cx.tcx, t)),
+                             str::buf(ty::ty_to_short_str(cx.tcx, t)),
                              llty);
     }
     cx.lltypes.insert(t, llty);
@@ -919,7 +919,7 @@ fn sanitize(&str s) -> str {
                         c != (' ' as u8) && c != ('\t' as u8) &&
                         c != (';' as u8)) {
                         auto v = [c];
-                        result += _str::from_bytes(v);
+                        result += str::from_bytes(v);
                     }
                 }
             }
@@ -944,11 +944,11 @@ fn C_integral(TypeRef t, uint u, Bool sign_extend) -> ValueRef {
 }
 
 fn C_float(&str s) -> ValueRef {
-    ret llvm::LLVMConstRealOfString(T_float(), _str::buf(s));
+    ret llvm::LLVMConstRealOfString(T_float(), str::buf(s));
 }
 
 fn C_floating(&str s, TypeRef t) -> ValueRef {
-    ret llvm::LLVMConstRealOfString(t, _str::buf(s));
+    ret llvm::LLVMConstRealOfString(t, str::buf(s));
 }
 
 fn C_nil() -> ValueRef {
@@ -975,9 +975,9 @@ fn C_u8(uint i) -> ValueRef {
 // This is a 'c-like' raw string, which differs from
 // our boxed-and-length-annotated strings.
 fn C_cstr(&@crate_ctxt cx, &str s) -> ValueRef {
-    auto sc = llvm::LLVMConstString(_str::buf(s), _str::byte_len(s), False);
+    auto sc = llvm::LLVMConstString(str::buf(s), str::byte_len(s), False);
     auto g = llvm::LLVMAddGlobal(cx.llmod, val_ty(sc),
-                                _str::buf(cx.names.next("str")));
+                                str::buf(cx.names.next("str")));
     llvm::LLVMSetInitializer(g, sc);
     llvm::LLVMSetGlobalConstant(g, True);
     llvm::LLVMSetLinkage(g, lib::llvm::LLVMInternalLinkage
@@ -987,15 +987,15 @@ fn C_cstr(&@crate_ctxt cx, &str s) -> ValueRef {
 
 // A rust boxed-and-length-annotated string.
 fn C_str(&@crate_ctxt cx, &str s) -> ValueRef {
-    auto len = _str::byte_len(s);
+    auto len = str::byte_len(s);
     auto box = C_struct([C_int(abi::const_refcount as int),
                             C_int(len + 1u as int), // 'alloc'
                             C_int(len + 1u as int), // 'fill'
                             C_int(0),               // 'pad'
-                            llvm::LLVMConstString(_str::buf(s),
+                            llvm::LLVMConstString(str::buf(s),
                                                  len, False)]);
     auto g = llvm::LLVMAddGlobal(cx.llmod, val_ty(box),
-                                _str::buf(cx.names.next("str")));
+                                str::buf(cx.names.next("str")));
     llvm::LLVMSetInitializer(g, box);
     llvm::LLVMSetGlobalConstant(g, True);
     llvm::LLVMSetLinkage(g, lib::llvm::LLVMInternalLinkage
@@ -1010,24 +1010,24 @@ fn C_zero_byte_arr(uint size) -> ValueRef {
         elts += [C_u8(0u)];
         i += 1u;
     }
-    ret llvm::LLVMConstArray(T_i8(), _vec::buf[ValueRef](elts),
-                            _vec::len[ValueRef](elts));
+    ret llvm::LLVMConstArray(T_i8(), vec::buf[ValueRef](elts),
+                            vec::len[ValueRef](elts));
 }
 
 fn C_struct(&vec[ValueRef] elts) -> ValueRef {
-    ret llvm::LLVMConstStruct(_vec::buf[ValueRef](elts),
-                             _vec::len[ValueRef](elts),
+    ret llvm::LLVMConstStruct(vec::buf[ValueRef](elts),
+                             vec::len[ValueRef](elts),
                              False);
 }
 
 fn C_array(TypeRef ty, &vec[ValueRef] elts) -> ValueRef {
-    ret llvm::LLVMConstArray(ty, _vec::buf[ValueRef](elts),
-                            _vec::len[ValueRef](elts));
+    ret llvm::LLVMConstArray(ty, vec::buf[ValueRef](elts),
+                            vec::len[ValueRef](elts));
 }
 
 fn decl_fn(ModuleRef llmod, &str name, uint cc, TypeRef llty) -> ValueRef {
     let ValueRef llfn =
-        llvm::LLVMAddFunction(llmod, _str::buf(name), llty);
+        llvm::LLVMAddFunction(llmod, str::buf(name), llty);
     llvm::LLVMSetFunctionCallConv(llfn, cc);
     ret llfn;
 }
@@ -1075,7 +1075,7 @@ fn decl_native_glue(ModuleRef llmod, &type_names tn,
         args += [T_int()]; // taskptr, will not be passed
     }
 
-    args += _vec::init_elt[TypeRef](T_int(), n as uint);
+    args += vec::init_elt[TypeRef](T_int(), n as uint);
 
     ret decl_fastcall_fn(llmod, s, T_fn(args, T_int()));
 }
@@ -1096,7 +1096,7 @@ fn get_extern_const(&hashmap[str, ValueRef] externs,
     if (externs.contains_key(name)) {
         ret externs.get(name);
     }
-    auto c = llvm::LLVMAddGlobal(llmod, ty, _str::buf(name));
+    auto c = llvm::LLVMAddGlobal(llmod, ty, str::buf(name));
     externs.insert(name, c);
     ret c;
 }
@@ -1104,7 +1104,7 @@ fn get_extern_const(&hashmap[str, ValueRef] externs,
 fn get_simple_extern_fn(&hashmap[str, ValueRef] externs,
                         ModuleRef llmod, &str name,
                         int n_args) -> ValueRef {
-    auto inputs = _vec::init_elt[TypeRef](T_int(), n_args as uint);
+    auto inputs = vec::init_elt[TypeRef](T_int(), n_args as uint);
     auto output = T_int();
     auto t = T_fn(inputs, output);
     ret get_extern_fn(externs, llmod, name, lib::llvm::LLVMCCallConv, t);
@@ -1114,7 +1114,7 @@ fn trans_native_call(&builder b, @glue_fns glues, ValueRef lltaskptr,
                      &hashmap[str, ValueRef] externs,
                      &type_names tn, ModuleRef llmod, &str name,
                      bool pass_task, &vec[ValueRef] args) -> ValueRef {
-    let int n = (_vec::len[ValueRef](args) as int);
+    let int n = (vec::len[ValueRef](args) as int);
     let ValueRef llnative = get_simple_extern_fn(externs, llmod, name, n);
     llnative = llvm::LLVMConstPointerCast(llnative, T_int());
 
@@ -1445,7 +1445,7 @@ fn GEP_tup_like(&@block_ctxt cx, &ty::t t,
     fn split_type(&@crate_ctxt ccx, &ty::t t, &vec[int] ixs, uint n)
         -> rec(vec[ty::t] prefix, ty::t target) {
 
-        let uint len = _vec::len[int](ixs);
+        let uint len = vec::len[int](ixs);
 
         // We don't support 0-index or 1-index GEPs: The former is nonsense
         // and the latter would only be meaningful if we supported non-0
@@ -1467,7 +1467,7 @@ fn split_type(&@crate_ctxt ccx, &ty::t t, &vec[int] ixs, uint n)
         let vec[ty::t] prefix = [];
         let int i = 0;
         while (i < ix) {
-            _vec::push[ty::t](prefix,
+            vec::push[ty::t](prefix,
                             ty::get_element_type(ccx.tcx, t, i as uint));
             i += 1 ;
         }
@@ -1696,8 +1696,8 @@ fn get_derived_tydesc(&@block_ctxt cx, &ty::t t, bool escapes,
     let uint n_params = ty::count_ty_params(bcx.fcx.lcx.ccx.tcx, t);
     auto tys = linearize_ty_params(bcx, t);
 
-    assert (n_params == _vec::len[uint](tys._0));
-    assert (n_params == _vec::len[ValueRef](tys._1));
+    assert (n_params == vec::len[uint](tys._0));
+    assert (n_params == vec::len[ValueRef](tys._1));
 
     auto root_ti = get_static_tydesc(bcx, t, tys._0);
     static_ti = some[@tydesc_info](root_ti);
@@ -1833,7 +1833,7 @@ fn declare_tydesc(&@local_ctxt cx, &ty::t t,
     }
 
     auto gvar = llvm::LLVMAddGlobal(ccx.llmod, T_tydesc(ccx.tn),
-                                    _str::buf(name));
+                                    str::buf(name));
 
     auto info = @rec(ty = t,
                      tydesc = gvar,
@@ -1892,23 +1892,23 @@ fn make_generic_glue(&@local_ctxt cx,
         llty = T_ptr(type_of(cx.ccx, t));
     }
 
-    auto ty_param_count = _vec::len[uint](ty_params);
+    auto ty_param_count = vec::len[uint](ty_params);
 
     auto lltyparams = llvm::LLVMGetParam(llfn, 3u);
 
     auto copy_args_bcx = new_raw_block_ctxt(fcx, fcx.llcopyargs);
 
-    auto lltydescs = _vec::empty_mut[ValueRef]();
+    auto lltydescs = vec::empty_mut[ValueRef]();
     auto p = 0u;
     while (p < ty_param_count) {
         auto llparam = copy_args_bcx.build.GEP(lltyparams,
                                                [C_int(p as int)]);
         llparam = copy_args_bcx.build.Load(llparam);
-        _vec::grow_set[ValueRef](lltydescs, ty_params.(p), 0 as ValueRef,
+        vec::grow_set[ValueRef](lltydescs, ty_params.(p), 0 as ValueRef,
                                 llparam);
         p += 1u;
     }
-    fcx.lltydescs = _vec::freeze[ValueRef](lltydescs);
+    fcx.lltydescs = vec::freeze[ValueRef](lltydescs);
 
     auto bcx = new_top_block_ctxt(fcx);
     auto lltop = bcx.llbb;
@@ -2248,7 +2248,7 @@ fn decr_refcnt_and_if_zero(&@block_ctxt cx,
 
 fn maybe_name_value(&@crate_ctxt cx, ValueRef v, &str s) {
     if (cx.sess.get_opts().save_temps) {
-        llvm::LLVMSetValueName(v, _str::buf(s));
+        llvm::LLVMSetValueName(v, str::buf(s));
     }
 }
 
@@ -2527,7 +2527,7 @@ fn tag_variants(&@crate_ctxt cx, &ast::def_id id) -> vec[variant_info] {
             for (ast::variant variant in variants) {
                 auto ctor_ty = node_ann_type(cx, variant.node.ann);
                 let vec[ty::t] arg_tys = [];
-                if (_vec::len[ast::variant_arg](variant.node.args) > 0u) {
+                if (vec::len[ast::variant_arg](variant.node.args) > 0u) {
                     for (ty::arg a in ty::ty_fn_args(cx.tcx, ctor_ty)) {
                         arg_tys += [a.ty];
                     }
@@ -2548,7 +2548,7 @@ fn tag_variant_with_id(&@crate_ctxt cx,
     auto variants = tag_variants(cx, tag_id);
 
     auto i = 0u;
-    while (i < _vec::len[variant_info](variants)) {
+    while (i < vec::len[variant_info](variants)) {
         auto variant = variants.(i);
         if (common::def_eq(variant.id, variant_id)) {
             ret variant;
@@ -2644,7 +2644,7 @@ fn iter_boxpp(@block_ctxt cx,
         }
         case (ty::ty_tag(?tid, ?tps)) {
             auto variants = tag_variants(cx.fcx.lcx.ccx, tid);
-            auto n_variants = _vec::len[variant_info](variants);
+            auto n_variants = vec::len[variant_info](variants);
 
             // Cast the tags to types we can GEP into.
             auto lltagty = T_opaque_tag_ptr(cx.fcx.lcx.ccx.tn);
@@ -2681,10 +2681,10 @@ fn iter_boxpp(@block_ctxt cx,
             for (variant_info variant in variants) {
                 auto variant_cx = new_sub_block_ctxt(bcx,
                                                      "tag-iter-variant-" +
-                                                     _uint::to_str(i, 10u));
+                                                     uint::to_str(i, 10u));
                 llvm::LLVMAddCase(llswitch, C_int(i as int), variant_cx.llbb);
 
-                if (_vec::len[ty::t](variant.args) > 0u) {
+                if (vec::len[ty::t](variant.args) > 0u) {
                     // N-ary variant.
                     auto fn_ty = variant.ctor_ty;
                     alt (ty::struct(bcx.fcx.lcx.ccx.tcx, fn_ty)) {
@@ -3670,12 +3670,12 @@ fn join_results(&@block_ctxt parent_cx,
         }
     }
 
-    alt (_vec::len[result](live)) {
+    alt (vec::len[result](live)) {
         case (0u) {
             // No incoming edges are live, so we're in dead-code-land.
             // Arbitrarily pick the first dead edge, since the caller
             // is just going to propagate it outward.
-            assert (_vec::len[result](ins) >= 1u);
+            assert (vec::len[result](ins) >= 1u);
             ret ins.(0);
         }
 
@@ -3806,10 +3806,10 @@ fn walk_expr(env e, &@ast::expr expr) {
             case (ast::expr_path(?path, ?ann)) {
                 alt (e.def_map.get(ast::ann_tag(ann))) {
                     case (ast::def_arg(?did)) {
-                        _vec::push[ast::def_id](e.refs, did);
+                        vec::push[ast::def_id](e.refs, did);
                     }
                     case (ast::def_local(?did)) {
-                        _vec::push[ast::def_id](e.refs, did);
+                        vec::push[ast::def_id](e.refs, did);
                     }
                     case (_) {}
                 }
@@ -3892,7 +3892,7 @@ fn trans_for_each(&@block_ctxt cx,
     }
 
     auto upvars = collect_upvars(cx, body, decl_id);
-    auto upvar_count = _vec::len[ast::def_id](upvars);
+    auto upvar_count = vec::len[ast::def_id](upvars);
 
     auto llbindingsptr;
     if (upvar_count > 0u) {
@@ -3931,7 +3931,7 @@ fn trans_for_each(&@block_ctxt cx,
     }
 
     // Create an environment and populate it with the bindings.
-    auto tydesc_count = _vec::len[ValueRef](cx.fcx.lltydescs);
+    auto tydesc_count = vec::len[ValueRef](cx.fcx.lltydescs);
     auto llenvptrty = T_closure_ptr(lcx.ccx.tn, T_ptr(T_nil()),
                                     val_ty(llbindingsptr), tydesc_count);
     auto llenvptr = alloca(cx, llvm::LLVMGetElementType(llenvptrty));
@@ -4149,7 +4149,7 @@ fn trans_pat_match(&@block_ctxt cx, &@ast::pat pat, ValueRef llval,
             auto ty_params = ty::ann_to_type_params(cx.fcx.lcx.ccx.node_types,
                                                     ann);
 
-            if (_vec::len[@ast::pat](subpats) > 0u) {
+            if (vec::len[@ast::pat](subpats) > 0u) {
                 auto llblobptr = matched_cx.build.GEP(lltagptr,
                     [C_int(0), C_int(1)]);
                 auto i = 0;
@@ -4201,7 +4201,7 @@ fn trans_pat_binding(&@block_ctxt cx, &@ast::pat pat,
             }
         }
         case (ast::pat_tag(_, ?subpats, ?ann)) {
-            if (_vec::len[@ast::pat](subpats) == 0u) { ret res(cx, llval); }
+            if (vec::len[@ast::pat](subpats) == 0u) { ret res(cx, llval); }
 
             // Get the appropriate variant for this tag.
             auto vdef = ast::variant_def_ids
@@ -4326,7 +4326,7 @@ fn lval_generic_fn(&@block_ctxt cx,
     auto tys = ty::ann_to_type_params(cx.fcx.lcx.ccx.node_types, ann);
     auto monoty = ty::ann_to_type(cx.fcx.lcx.ccx.node_types, ann);
 
-    if (_vec::len[ty::t](tys) != 0u) {
+    if (vec::len[ty::t](tys) != 0u) {
         auto bcx = lv.res.bcx;
         let vec[ValueRef] tydescs = [];
         let vec[option::t[@tydesc_info]] tis = [];
@@ -4336,7 +4336,7 @@ fn lval_generic_fn(&@block_ctxt cx,
             auto td = get_tydesc(bcx, t, true, ti);
             tis += [ti];
             bcx = td.bcx;
-            _vec::push[ValueRef](tydescs, td.val);
+            vec::push[ValueRef](tydescs, td.val);
         }
         auto gen = rec( item_type = tpt._1,
                         static_tis = tis,
@@ -4356,7 +4356,7 @@ fn lookup_discriminant(&@local_ctxt lcx, &ast::def_id tid, &ast::def_id vid)
             assert (lcx.ccx.sess.get_targ_crate_num() != vid._0);
             auto sym = creader::get_symbol(lcx.ccx.sess, vid);
             auto gvar = llvm::LLVMAddGlobal(lcx.ccx.llmod, T_int(),
-                                           _str::buf(sym));
+                                           str::buf(sym));
             llvm::LLVMSetLinkage(gvar, lib::llvm::LLVMExternalLinkage
                                  as llvm::Linkage);
             llvm::LLVMSetGlobalConstant(gvar, True);
@@ -4818,7 +4818,7 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
                 case (none[@ast::expr]) {
                 }
                 case (some[@ast::expr](?e)) {
-                    _vec::push[@ast::expr](bound, e);
+                    vec::push[@ast::expr](bound, e);
                 }
             }
         }
@@ -4838,9 +4838,9 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
                 lltydescs = ginfo.tydescs;
             }
         }
-        auto ty_param_count = _vec::len[ValueRef](lltydescs);
+        auto ty_param_count = vec::len[ValueRef](lltydescs);
 
-        if (_vec::len[@ast::expr](bound) == 0u && ty_param_count == 0u) {
+        if (vec::len[@ast::expr](bound) == 0u && ty_param_count == 0u) {
             // Trivial 'binding': just return the static pair-ptr.
             ret f_res.res;
         } else {
@@ -4856,8 +4856,8 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
                 auto arg = trans_expr(bcx, e);
                 bcx = arg.bcx;
 
-                _vec::push[ValueRef](bound_vals, arg.val);
-                _vec::push[ty::t](bound_tys,
+                vec::push[ValueRef](bound_vals, arg.val);
+                vec::push[ty::t](bound_tys,
                                  ty::expr_ty(cx.fcx.lcx.ccx.tcx,
                                              cx.fcx.lcx.ccx.node_types, e));
 
@@ -4874,7 +4874,7 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
             let ty::t tydesc_ty = ty::mk_type(cx.fcx.lcx.ccx.tcx);
 
             let vec[ty::t] captured_tys =
-                _vec::init_elt[ty::t](tydesc_ty, ty_param_count);
+                vec::init_elt[ty::t](tydesc_ty, ty_param_count);
 
             let vec[ty::t] closure_tys =
                 [tydesc_ty,
@@ -5297,7 +5297,7 @@ fn trans_vec(&@block_ctxt cx, &vec[@ast::expr] args,
     auto bcx = cx;
     auto unit_sz = size_of(bcx, unit_ty);
     bcx = unit_sz.bcx;
-    auto data_sz = bcx.build.Mul(C_int(_vec::len[@ast::expr](args) as int),
+    auto data_sz = bcx.build.Mul(C_int(vec::len[@ast::expr](args) as int),
                                  unit_sz.val);
 
     // FIXME: pass tydesc properly.
@@ -5315,8 +5315,8 @@ fn trans_vec(&@block_ctxt cx, &vec[@ast::expr] args,
 
     auto pseudo_tup_ty =
         ty::mk_imm_tup(cx.fcx.lcx.ccx.tcx,
-                      _vec::init_elt[ty::t](unit_ty,
-                                           _vec::len[@ast::expr](args)));
+                      vec::init_elt[ty::t](unit_ty,
+                                           vec::len[@ast::expr](args)));
     let int i = 0;
 
     for (@ast::expr e in args) {
@@ -5393,7 +5393,7 @@ fn trans_rec(&@block_ctxt cx, &vec[ast::field] fields,
         auto src_res = res(bcx, C_nil());
 
         for (ast::field f in fields) {
-            if (_str::eq(f.ident, tf.ident)) {
+            if (str::eq(f.ident, tf.ident)) {
                 expr_provided = true;
                 src_res = trans_expr(bcx, f.expr);
             }
@@ -5626,13 +5626,13 @@ fn load_if_immediate(&@block_ctxt cx, ValueRef v, &ty::t t) -> ValueRef {
 
 fn trans_log(int lvl, &@block_ctxt cx, &@ast::expr e) -> result {
     auto lcx = cx.fcx.lcx;
-    auto modname = _str::connect(lcx.module_path, "::");
+    auto modname = str::connect(lcx.module_path, "::");
     auto global;
     if (lcx.ccx.module_data.contains_key(modname)) {
         global = lcx.ccx.module_data.get(modname);
     } else {
         global = llvm::LLVMAddGlobal(lcx.ccx.llmod, T_int(),
-                                    _str::buf("_rust_mod_log_" + modname));
+                                    str::buf("_rust_mod_log_" + modname));
         llvm::LLVMSetGlobalConstant(global, False);
         llvm::LLVMSetInitializer(global, C_null(T_int()));
         llvm::LLVMSetLinkage(global, lib::llvm::LLVMInternalLinkage
@@ -6067,9 +6067,9 @@ fn new_block_ctxt(&@fn_ctxt cx, &block_parent parent,
                   block_kind kind,
                   &str name) -> @block_ctxt {
     let vec[cleanup] cleanups = [];
-    auto s = _str::buf("");
+    auto s = str::buf("");
     if (cx.lcx.ccx.sess.get_opts().save_temps) {
-        s = _str::buf(cx.lcx.ccx.names.next(name));
+        s = str::buf(cx.lcx.ccx.names.next(name));
     }
     let BasicBlockRef llbb = llvm::LLVMAppendBasicBlock(cx.llfn, s);
     ret @rec(llbb=llbb,
@@ -6114,10 +6114,10 @@ fn trans_block_cleanups(&@block_ctxt cx,
     auto bcx = cx;
 
     if (cleanup_cx.kind == NON_SCOPE_BLOCK) {
-        assert (_vec::len[cleanup](cleanup_cx.cleanups) == 0u);
+        assert (vec::len[cleanup](cleanup_cx.cleanups) == 0u);
     }
 
-    auto i = _vec::len[cleanup](cleanup_cx.cleanups);
+    auto i = vec::len[cleanup](cleanup_cx.cleanups);
     while (i > 0u) {
         i -= 1u;
         auto c = cleanup_cx.cleanups.(i);
@@ -6282,9 +6282,9 @@ fn new_local_ctxt(&@crate_ctxt ccx) -> @local_ctxt {
 // tydescs.
 fn mk_standard_basic_blocks(ValueRef llfn) ->
         tup(BasicBlockRef, BasicBlockRef, BasicBlockRef) {
-    ret tup(llvm::LLVMAppendBasicBlock(llfn, _str::buf("allocas")),
-            llvm::LLVMAppendBasicBlock(llfn, _str::buf("copy_args")),
-            llvm::LLVMAppendBasicBlock(llfn, _str::buf("derived_tydescs")));
+    ret tup(llvm::LLVMAppendBasicBlock(llfn, str::buf("allocas")),
+            llvm::LLVMAppendBasicBlock(llfn, str::buf("copy_args")),
+            llvm::LLVMAppendBasicBlock(llfn, str::buf("derived_tydescs")));
 }
 
 // NB: must keep 4 fns in sync:
@@ -6324,7 +6324,7 @@ fn new_fn_ctxt(@local_ctxt cx,
              llobjfields=llobjfields,
              lllocals=lllocals,
              llupvars=llupvars,
-             mutable lltydescs=_vec::empty[ValueRef](),
+             mutable lltydescs=vec::empty[ValueRef](),
              derived_tydescs=derived_tydescs,
              lcx=cx);
 }
@@ -6478,7 +6478,7 @@ fn populate_fn_ctxt_from_llself(@fn_ctxt fcx, self_vt llself) {
     // its magic.
     auto fields_tup_ty = ty::mk_imm_tup(fcx.lcx.ccx.tcx, field_tys);
 
-    auto n_typarams = _vec::len[ast::ty_param](bcx.fcx.lcx.obj_typarams);
+    auto n_typarams = vec::len[ast::ty_param](bcx.fcx.lcx.obj_typarams);
     let TypeRef llobj_box_ty = T_obj_ptr(bcx.fcx.lcx.ccx.tn, n_typarams);
 
     auto box_cell =
@@ -6595,7 +6595,7 @@ fn trans_vtbl(@local_ctxt cx,
     let vec[ValueRef] methods = [dtor];
 
     fn meth_lteq(&@ast::method a, &@ast::method b) -> bool {
-        ret _str::lteq(a.node.ident, b.node.ident);
+        ret str::lteq(a.node.ident, b.node.ident);
     }
 
     auto meths = std::sort::merge_sort[@ast::method](bind meth_lteq(_,_),
@@ -6609,7 +6609,7 @@ fn meth_lteq(&@ast::method a, &@ast::method b) -> bool {
                 llfnty = type_of_fn_full(cx.ccx, proto,
                                          some[TypeRef](llself_ty),
                                          inputs, output,
-                                         _vec::len[ast::ty_param](ty_params));
+                                         vec::len[ast::ty_param](ty_params));
             }
         }
 
@@ -6628,7 +6628,7 @@ fn meth_lteq(&@ast::method a, &@ast::method b) -> bool {
     auto vtbl = C_struct(methods);
     auto vtbl_name = mangle_name_by_seq(cx.ccx, cx.path, "vtbl");
     auto gvar = llvm::LLVMAddGlobal(cx.ccx.llmod, val_ty(vtbl),
-                                   _str::buf(vtbl_name));
+                                   str::buf(vtbl_name));
     llvm::LLVMSetInitializer(gvar, vtbl);
     llvm::LLVMSetGlobalConstant(gvar, True);
     llvm::LLVMSetLinkage(gvar, lib::llvm::LLVMInternalLinkage
@@ -6696,22 +6696,22 @@ fn trans_obj(@local_ctxt cx, &ast::_obj ob, ast::def_id oid,
 
     // FIXME we should probably also allocate a box for empty objs that have a
     // dtor, since otherwise they are never dropped, and the dtor never runs
-    if (_vec::len[ast::ty_param](ty_params) == 0u &&
-        _vec::len[ty::arg](arg_tys) == 0u) {
+    if (vec::len[ast::ty_param](ty_params) == 0u &&
+        vec::len[ty::arg](arg_tys) == 0u) {
         // Store null into pair, if no args or typarams.
         bcx.build.Store(C_null(llbox_ty), pair_box);
     } else {
         // Malloc a box for the body and copy args in.
         let vec[ty::t] obj_fields = [];
         for (ty::arg a in arg_tys) {
-            _vec::push[ty::t](obj_fields, a.ty);
+            vec::push[ty::t](obj_fields, a.ty);
         }
 
         // Synthesize an obj body type.
         auto tydesc_ty = ty::mk_type(ccx.tcx);
         let vec[ty::t] tps = [];
         for (ast::ty_param tp in ty_params) {
-            _vec::push[ty::t](tps, tydesc_ty);
+            vec::push[ty::t](tps, tydesc_ty);
         }
 
         let ty::t typarams_ty = ty::mk_imm_tup(ccx.tcx, tps);
@@ -6797,7 +6797,7 @@ fn trans_obj(@local_ctxt cx, &ast::_obj ob, ast::def_id oid,
 fn trans_tag_variant(@local_ctxt cx, ast::def_id tag_id,
                      &ast::variant variant, int index,
                      &vec[ast::ty_param] ty_params) {
-    if (_vec::len[ast::variant_arg](variant.node.args) == 0u) {
+    if (vec::len[ast::variant_arg](variant.node.args) == 0u) {
         ret;    // nullary constructors are just constants
     }
 
@@ -6807,7 +6807,7 @@ fn trans_tag_variant(@local_ctxt cx, ast::def_id tag_id,
     for (ast::variant_arg varg in variant.node.args) {
         fn_args += [rec(mode=ast::alias,
                            ty=varg.ty,
-                           ident="arg" + _uint::to_str(i, 10u),
+                           ident="arg" + uint::to_str(i, 10u),
                            id=varg.id)];
     }
 
@@ -6949,7 +6949,7 @@ fn get_pair_fn_ty(TypeRef llpairty) -> TypeRef {
     // Bit of a kludge: pick the fn typeref out of the pair.
     let vec[TypeRef] pair_tys = [T_nil(), T_nil()];
     llvm::LLVMGetStructElementTypes(llpairty,
-                                   _vec::buf[TypeRef](pair_tys));
+                                   vec::buf[TypeRef](pair_tys));
     ret llvm::LLVMGetElementType(pair_tys.(0));
 }
 
@@ -6965,7 +6965,7 @@ fn decl_fn_and_pair(&@crate_ctxt ccx,
     alt (ty::struct(ccx.tcx, node_ann_type(ccx, ann))) {
         case (ty::ty_fn(?proto, ?inputs, ?output)) {
             llfty = type_of_fn(ccx, proto, inputs, output,
-                               _vec::len[ast::ty_param](ty_params));
+                               vec::len[ast::ty_param](ty_params));
             llpairty = T_fn_pair(ccx.tn, llfty);
         }
         case (_) {
@@ -6987,7 +6987,7 @@ fn decl_fn_and_pair(&@crate_ctxt ccx,
 fn register_fn_pair(&@crate_ctxt cx, str ps, TypeRef llpairty, ValueRef llfn,
                     ast::def_id id) {
     let ValueRef gvar = llvm::LLVMAddGlobal(cx.llmod, llpairty,
-                                           _str::buf(ps));
+                                           str::buf(ps));
     auto pair = C_struct([llfn,
                              C_null(T_opaque_closure_ptr(cx.tn))]);
 
@@ -7013,7 +7013,7 @@ fn native_fn_ty_param_count(&@crate_ctxt cx, &ast::def_id id) -> uint {
             fail;
         }
         case (ast::native_item_fn(_, _, _, ?tps, _, _)) {
-            count = _vec::len[ast::ty_param](tps);
+            count = vec::len[ast::ty_param](tps);
         }
     }
     ret count;
@@ -7101,7 +7101,7 @@ fn decl_native_fn_and_pair(&@crate_ctxt ccx,
     if (pass_task) { call_args += [lltaskptr]; }
 
     auto arg_n = 3u;
-    for each (uint i in _uint::range(0u, num_ty_param)) {
+    for each (uint i in uint::range(0u, num_ty_param)) {
         auto llarg = llvm::LLVMGetParam(fcx.llfn, arg_n);
         fcx.lltydescs += [llarg];
         assert (llarg as int != 0);
@@ -7232,13 +7232,13 @@ fn new_walk_ctxt() -> @walk_ctxt {
 fn enter_item(@walk_ctxt cx, &@ast::item item) {
     alt (item.node) {
         case (ast::item_fn(?name, _, _, _, _)) {
-            _vec::push[str](cx.path, name);
+            vec::push[str](cx.path, name);
         }
         case (ast::item_obj(?name, _, _, _, _)) {
-            _vec::push[str](cx.path, name);
+            vec::push[str](cx.path, name);
         }
         case (ast::item_mod(?name, _, _)) {
-            _vec::push[str](cx.path, name);
+            vec::push[str](cx.path, name);
         }
         case (_) { }
     }
@@ -7247,13 +7247,13 @@ fn enter_item(@walk_ctxt cx, &@ast::item item) {
 fn leave_item(@walk_ctxt cx, &@ast::item item) {
     alt (item.node) {
         case (ast::item_fn(_, _, _, _, _)) {
-            _vec::pop[str](cx.path);
+            vec::pop[str](cx.path);
         }
         case (ast::item_obj(_, _, _, _, _)) {
-            _vec::pop[str](cx.path);
+            vec::pop[str](cx.path);
         }
         case (ast::item_mod(_, _, _)) {
-            _vec::pop[str](cx.path);
+            vec::pop[str](cx.path);
         }
         case (_) { }
     }
@@ -7281,7 +7281,7 @@ fn collect_item_1(&@crate_ctxt ccx, @walk_ctxt wcx, &@ast::item i) {
         case (ast::item_const(?name, _, _, ?cid, ?ann)) {
             auto typ = node_ann_type(ccx, ann);
             auto g = llvm::LLVMAddGlobal(ccx.llmod, type_of(ccx, typ),
-                                        _str::buf(ccx.names.next(name)));
+                                        str::buf(ccx.names.next(name)));
             llvm::LLVMSetLinkage(g, lib::llvm::LLVMInternalLinkage
                                 as llvm::Linkage);
             ccx.items.insert(cid, i);
@@ -7345,7 +7345,7 @@ fn collect_tag_ctor(&@crate_ctxt ccx, @walk_ctxt wcx, &@ast::item i) {
     alt (i.node) {
         case (ast::item_tag(_, ?variants, ?tps, _, _)) {
             for (ast::variant variant in variants) {
-                if (_vec::len[ast::variant_arg](variant.node.args) != 0u) {
+                if (vec::len[ast::variant_arg](variant.node.args) != 0u) {
                     decl_fn_and_pair(ccx, wcx.path + [variant.node.name],
                                      "tag", tps, variant.node.ann,
                                      variant.node.id);
@@ -7373,7 +7373,7 @@ fn trans_constant(&@crate_ctxt ccx, @walk_ctxt wcx, &@ast::item it) {
     alt (it.node) {
         case (ast::item_tag(?ident, ?variants, _, ?tag_id, _)) {
             auto i = 0u;
-            auto n_variants = _vec::len[ast::variant](variants);
+            auto n_variants = vec::len[ast::variant](variants);
             while (i < n_variants) {
                 auto variant = variants.(i);
 
@@ -7383,7 +7383,7 @@ fn trans_constant(&@crate_ctxt ccx, @walk_ctxt wcx, &@ast::item it) {
                                             #fmt("_rust_tag_discrim_%s_%u",
                                                  ident, i));
                 auto discrim_gvar = llvm::LLVMAddGlobal(ccx.llmod, T_int(),
-                                                       _str::buf(s));
+                                                       str::buf(s));
 
                 llvm::LLVMSetInitializer(discrim_gvar, discrim_val);
                 llvm::LLVMSetGlobalConstant(discrim_gvar, True);
@@ -7443,7 +7443,7 @@ fn trans_exit_task_glue(@glue_fns glues,
 
     auto llfn = glues.exit_task_glue;
 
-    auto entrybb = llvm::LLVMAppendBasicBlock(llfn, _str::buf("entry"));
+    auto entrybb = llvm::LLVMAppendBasicBlock(llfn, str::buf("entry"));
     auto build = new_builder(entrybb);
 
     let ValueRef arg1 = llvm::LLVMGetParam(llfn, 0u);
@@ -7465,9 +7465,9 @@ fn trans_exit_task_glue(@glue_fns glues,
 }
 
 fn create_typedefs(&@crate_ctxt cx) {
-    llvm::LLVMAddTypeName(cx.llmod, _str::buf("crate"), T_crate(cx.tn));
-    llvm::LLVMAddTypeName(cx.llmod, _str::buf("task"), T_task(cx.tn));
-    llvm::LLVMAddTypeName(cx.llmod, _str::buf("tydesc"), T_tydesc(cx.tn));
+    llvm::LLVMAddTypeName(cx.llmod, str::buf("crate"), T_crate(cx.tn));
+    llvm::LLVMAddTypeName(cx.llmod, str::buf("task"), T_task(cx.tn));
+    llvm::LLVMAddTypeName(cx.llmod, str::buf("tydesc"), T_tydesc(cx.tn));
 }
 
 fn create_crate_constant(ValueRef crate_ptr, @glue_fns glues) {
@@ -7509,7 +7509,7 @@ fn find_main_fn(&@crate_ctxt cx) -> ValueRef {
     let ValueRef v = C_nil();
     let uint n = 0u;
     for each (@tup(ast::def_id, str) i in cx.item_symbols.items()) {
-        if (_str::ends_with(i._1, e)) {
+        if (str::ends_with(i._1, e)) {
             n += 1u;
             v = cx.item_ids.get(i._0);
         }
@@ -7533,7 +7533,7 @@ fn trans_main_fn(@local_ctxt cx, ValueRef llcrate, ValueRef crate_map) {
     auto T_rust_start_args = [T_int(), T_int(), T_int(), T_int(), T_int()];
 
     auto main_name;
-    if (_str::eq(std::os::target_os(), "win32")) {
+    if (str::eq(std::os::target_os(), "win32")) {
         main_name = "WinMain@16";
     } else {
         main_name = "main";
@@ -7558,7 +7558,7 @@ fn trans_main_fn(@local_ctxt cx, ValueRef llcrate, ValueRef crate_map) {
     //
 
     let BasicBlockRef llbb =
-        llvm::LLVMAppendBasicBlock(llmain, _str::buf(""));
+        llvm::LLVMAppendBasicBlock(llmain, str::buf(""));
     auto b = new_builder(llbb);
 
     auto start_args = [p2i(llrust_main), p2i(llcrate), llargc, llargv,
@@ -7629,7 +7629,7 @@ fn decl_no_op_type_glue(ModuleRef llmod, type_names tn) -> ValueRef {
 }
 
 fn make_no_op_type_glue(ValueRef fun) {
-    auto bb_name = _str::buf("_rust_no_op_type_glue_bb");
+    auto bb_name = str::buf("_rust_no_op_type_glue_bb");
     auto llbb = llvm::LLVMAppendBasicBlock(fun, bb_name);
     new_builder(llbb).RetVoid();
 }
@@ -7733,7 +7733,7 @@ fn trans_vec_append_glue(@local_ctxt cx) {
                     llobjfields=new_def_hash[ValueRef](),
                     lllocals=new_def_hash[ValueRef](),
                     llupvars=new_def_hash[ValueRef](),
-                    mutable lltydescs=_vec::empty[ValueRef](),
+                    mutable lltydescs=vec::empty[ValueRef](),
                     derived_tydescs=derived_tydescs,
                     lcx=cx);
 
@@ -7857,13 +7857,13 @@ fn make_glues(ModuleRef llmod, &type_names tn) -> @glue_fns {
                                                  T_void())),
 
              native_glues_rust =
-                 _vec::init_fn[ValueRef](bind decl_native_glue(llmod, tn,
+                 vec::init_fn[ValueRef](bind decl_native_glue(llmod, tn,
                     abi::ngt_rust, _), abi::n_native_glues + 1 as uint),
              native_glues_pure_rust =
-                 _vec::init_fn[ValueRef](bind decl_native_glue(llmod, tn,
+                 vec::init_fn[ValueRef](bind decl_native_glue(llmod, tn,
                     abi::ngt_pure_rust, _), abi::n_native_glues + 1 as uint),
              native_glues_cdecl =
-                 _vec::init_fn[ValueRef](bind decl_native_glue(llmod, tn,
+                 vec::init_fn[ValueRef](bind decl_native_glue(llmod, tn,
                     abi::ngt_cdecl, _), abi::n_native_glues + 1 as uint),
              no_op_type_glue = decl_no_op_type_glue(llmod, tn),
              vec_append_glue = make_vec_append_glue(llmod, tn));
@@ -7873,19 +7873,19 @@ fn make_common_glue(&session::session sess, &str output) {
     // FIXME: part of this is repetitive and is probably a good idea
     // to autogen it.
     auto llmod =
-        llvm::LLVMModuleCreateWithNameInContext(_str::buf("rust_out"),
+        llvm::LLVMModuleCreateWithNameInContext(str::buf("rust_out"),
                                                llvm::LLVMGetGlobalContext());
 
-    llvm::LLVMSetDataLayout(llmod, _str::buf(x86::get_data_layout()));
-    llvm::LLVMSetTarget(llmod, _str::buf(x86::get_target_triple()));
+    llvm::LLVMSetDataLayout(llmod, str::buf(x86::get_data_layout()));
+    llvm::LLVMSetTarget(llmod, str::buf(x86::get_target_triple()));
     auto td = mk_target_data(x86::get_data_layout());
     auto tn = mk_type_names();
     let ValueRef crate_ptr =
-        llvm::LLVMAddGlobal(llmod, T_crate(tn), _str::buf("rust_crate"));
+        llvm::LLVMAddGlobal(llmod, T_crate(tn), str::buf("rust_crate"));
 
     auto intrinsics = declare_intrinsics(llmod);
 
-    llvm::LLVMSetModuleInlineAsm(llmod, _str::buf(x86::get_module_asm()));
+    llvm::LLVMSetModuleInlineAsm(llmod, str::buf(x86::get_module_asm()));
 
     auto glues = make_glues(llmod, tn);
     create_crate_constant(crate_ptr, glues);
@@ -7900,23 +7900,23 @@ fn create_module_map(&@crate_ctxt ccx) -> ValueRef {
     auto elttype = T_struct([T_int(), T_int()]);
     auto maptype = T_array(elttype, ccx.module_data.size() + 1u);
     auto map = llvm::LLVMAddGlobal(ccx.llmod, maptype,
-                                  _str::buf("_rust_mod_map"));
+                                  str::buf("_rust_mod_map"));
     llvm::LLVMSetLinkage(map, lib::llvm::LLVMInternalLinkage
                          as llvm::Linkage);
     let vec[ValueRef] elts = [];
     for each (@tup(str, ValueRef) item in ccx.module_data.items()) {
         auto elt = C_struct([p2i(C_cstr(ccx, item._0)), p2i(item._1)]);
-        _vec::push[ValueRef](elts, elt);
+        vec::push[ValueRef](elts, elt);
     }
     auto term = C_struct([C_int(0), C_int(0)]);
-    _vec::push[ValueRef](elts, term);
+    vec::push[ValueRef](elts, term);
     llvm::LLVMSetInitializer(map, C_array(elttype, elts));
     ret map;
 }
 
 fn crate_name(&@crate_ctxt ccx, &str deflt) -> str {
     for (@ast::meta_item item in ccx.sess.get_metadata()) {
-        if (_str::eq(item.node.name, "name")) {
+        if (str::eq(item.node.name, "name")) {
             ret item.node.value;
         }
     }
@@ -7930,15 +7930,15 @@ fn create_crate_map(&@crate_ctxt ccx) -> ValueRef {
     while (ccx.sess.has_external_crate(i)) {
         auto name = ccx.sess.get_external_crate(i).name;
         auto cr = llvm::LLVMAddGlobal(ccx.llmod, T_int(),
-                                     _str::buf("_rust_crate_map_" + name));
-        _vec::push[ValueRef](subcrates, p2i(cr));
+                                     str::buf("_rust_crate_map_" + name));
+        vec::push[ValueRef](subcrates, p2i(cr));
         i += 1;
     }
-    _vec::push[ValueRef](subcrates, C_int(0));
+    vec::push[ValueRef](subcrates, C_int(0));
     auto sym_name = "_rust_crate_map_" + crate_name(ccx, "__none__");
-    auto arrtype = T_array(T_int(), _vec::len[ValueRef](subcrates));
+    auto arrtype = T_array(T_int(), vec::len[ValueRef](subcrates));
     auto maptype = T_struct([T_int(), arrtype]);
-    auto map = llvm::LLVMAddGlobal(ccx.llmod, maptype, _str::buf(sym_name));
+    auto map = llvm::LLVMAddGlobal(ccx.llmod, maptype, str::buf(sym_name));
     llvm::LLVMSetLinkage(map, lib::llvm::LLVMExternalLinkage
                          as llvm::Linkage);
     llvm::LLVMSetInitializer(map, C_struct([p2i(create_module_map(ccx)),
@@ -7951,15 +7951,15 @@ fn trans_crate(&session::session sess, &@ast::crate crate, &ty::ctxt tcx,
                &str output)
         -> ModuleRef {
     auto llmod =
-        llvm::LLVMModuleCreateWithNameInContext(_str::buf("rust_out"),
+        llvm::LLVMModuleCreateWithNameInContext(str::buf("rust_out"),
                                                llvm::LLVMGetGlobalContext());
 
-    llvm::LLVMSetDataLayout(llmod, _str::buf(x86::get_data_layout()));
-    llvm::LLVMSetTarget(llmod, _str::buf(x86::get_target_triple()));
+    llvm::LLVMSetDataLayout(llmod, str::buf(x86::get_data_layout()));
+    llvm::LLVMSetTarget(llmod, str::buf(x86::get_target_triple()));
     auto td = mk_target_data(x86::get_data_layout());
     auto tn = mk_type_names();
     let ValueRef crate_ptr =
-        llvm::LLVMAddGlobal(llmod, T_crate(tn), _str::buf("rust_crate"));
+        llvm::LLVMAddGlobal(llmod, T_crate(tn), str::buf("rust_crate"));
 
     auto intrinsics = declare_intrinsics(llmod);
 
index 6dbc3970a2560c2b6d44a63e450fab61efce4bf9..3e8c8e34a58c5ba8dac681e52353e2a0d05e2c9d 100644 (file)
@@ -1,5 +1,5 @@
 import front::ast::ident;
-import std::_vec;
+import std::vec;
 import std::bitv;
 
 /* 
index 83d277d1a6a25df0f8140e4011b4dc71b74efd32..92e6accdbec33fd216c3a1bdfe71d06d26f66c06 100644 (file)
@@ -1,4 +1,4 @@
-import std::_vec;
+import std::vec;
 import std::option;
 import std::option::some;
 import std::option::none;
@@ -131,7 +131,7 @@ fn one(fn_info_map fm, &@expr e) -> @expr {
         ret annotate_expr(fm, e);
     }
     auto f = bind one(fm,_);
-    ret _vec::map[@expr, @expr](f, es);
+    ret vec::map[@expr, @expr](f, es);
 }
 fn annotate_elts(&fn_info_map fm, &vec[elt] es) -> vec[elt] {
     fn one(fn_info_map fm, &elt e) -> elt {
@@ -139,7 +139,7 @@ fn one(fn_info_map fm, &elt e) -> elt {
                 expr=annotate_expr(fm, e.expr));
     }
     auto f = bind one(fm,_);
-    ret _vec::map[elt, elt](f, es);
+    ret vec::map[elt, elt](f, es);
 }
 fn annotate_fields(&fn_info_map fm, &vec[field] fs) -> vec[field] {
     fn one(fn_info_map fm, &field f) -> field {
@@ -148,7 +148,7 @@ fn one(fn_info_map fm, &field f) -> field {
                  expr=annotate_expr(fm, f.expr));
     }
     auto f = bind one(fm,_);
-    ret _vec::map[field, field](f, fs);
+    ret vec::map[field, field](f, fs);
 }
 fn annotate_option_exp(&fn_info_map fm, &option::t[@expr] o)
   -> option::t[@expr] {
@@ -164,7 +164,7 @@ fn one(fn_info_map fm, &option::t[@expr] o) -> option::t[@expr] {
         ret annotate_option_exp(fm, o);
     }
     auto f = bind one(fm,_);
-    ret _vec::map[option::t[@expr], option::t[@expr]](f, es);
+    ret vec::map[option::t[@expr], option::t[@expr]](f, es);
 }
 fn annotate_decl(&fn_info_map fm, &@decl d) -> @decl {
     auto d1 = d.node;
@@ -194,7 +194,7 @@ fn one(fn_info_map fm, &arm a) -> arm {
                  block=annotate_block(fm, a.block));
     }
     auto f = bind one(fm,_);
-    ret _vec::map[arm, arm](f, alts);
+    ret vec::map[arm, arm](f, alts);
 
 }
 fn annotate_expr(&fn_info_map fm, &@expr e) -> @expr {
@@ -345,7 +345,7 @@ fn annotate_block(&fn_info_map fm, &block b) -> block {
    
     for (@stmt s in b.node.stmts) {
         auto new_s = annotate_stmt(fm, s);
-        _vec::push[@stmt](new_stmts, new_s);
+        vec::push[@stmt](new_stmts, new_s);
     }
     fn ann_e(fn_info_map fm, &@expr e) -> @expr {
         ret annotate_expr(fm, e);
@@ -367,7 +367,7 @@ fn annotate_mod(&fn_info_map fm, &_mod m) -> _mod {
    
     for (@item i in m.items) {
         auto new_i = annotate_item(fm, i);
-        _vec::push[@item](new_items, new_i);
+        vec::push[@item](new_items, new_i);
     }
     ret rec(items=new_items with m);
 }
@@ -387,7 +387,7 @@ fn one(fn_info_map fm, &@method m) -> @method {
         ret annotate_method(fm, m);
     }
     auto f = bind one(fm,_);
-    auto new_methods = _vec::map[@method, @method](f, o.methods);
+    auto new_methods = vec::map[@method, @method](f, o.methods);
     auto new_dtor    = option::map[@method, @method](f, o.dtor);
     ret rec(methods=new_methods, dtor=new_dtor with o);
 }
@@ -479,7 +479,7 @@ fn annotate_module(&fn_info_map fm, &_mod module) -> _mod {
    
     for (@item i in module.items) {
         auto new_item = annotate_item(fm, i);
-        _vec::push[@item](new_items, new_item);
+        vec::push[@item](new_items, new_item);
     }
 
     ret rec(items = new_items with module);
index 45d1aed94a1dae80d9323984c59c927cc211ec69..664327fee9d1b689408d5e10ff4c9499753e9dce 100644 (file)
@@ -1,6 +1,6 @@
 import std::bitv;
-import std::_vec::len;
-import std::_vec::pop;
+import std::vec::len;
+import std::vec::pop;
 import std::option;
 import std::option::none;
 import std::option::some;
index 667a0889e24ea0724147ca60f16a472692f9f224..a0b9e5a3ece45510701708fa60b7717267a4a266 100644 (file)
@@ -1,7 +1,7 @@
 import std::bitv;
-import std::_vec;
-import std::_vec::len;
-import std::_vec::slice;
+import std::vec;
+import std::vec::len;
+import std::vec::slice;
 
 import front::ast;
 import front::ast::def_id;
@@ -74,7 +74,7 @@ fn seq_preconds(fn_info enclosing, vec[pre_and_post] pps) -> precond {
 /* works on either postconds or preconds
  should probably rethink the whole type synonym situation */
 fn union_postconds_go(&postcond first, &vec[postcond] rest) -> postcond {
-  auto sz = _vec::len[postcond](rest);
+  auto sz = vec::len[postcond](rest);
 
   if (sz > 0u) {
     auto other = rest.(0);
@@ -96,7 +96,7 @@ fn union_postconds(uint nv, &vec[postcond] pcs) -> postcond {
 
 /* Gee, maybe we could use foldl or something */
 fn intersect_postconds_go(&postcond first, &vec[postcond] rest) -> postcond {
-  auto sz = _vec::len[postcond](rest);
+  auto sz = vec::len[postcond](rest);
 
   if (sz > 0u) {
     auto other = rest.(0);
index a1df6e0f55cb735365537f3a0e4d0e095586da61..af2455c9a6e519bec91dd87517315761d03bc67c 100644 (file)
 import tstate::ann::implies;
 import tstate::ann::ann_precond;
 import tstate::ann::ann_prestate;
-import std::_vec::map;
-import std::_vec;
-import std::_vec::slice;
-import std::_vec::unzip;
-import std::_vec::plus_option;
-import std::_vec::cat_options;
+import std::vec::map;
+import std::vec;
+import std::vec::slice;
+import std::vec::unzip;
+import std::vec::plus_option;
+import std::vec::cat_options;
 
 import std::option;
 import std::option::t;
@@ -123,7 +123,7 @@ fn do_one_(fn_ctxt fcx, &@stmt s, @poststate post, uint nv) -> () {
 
     auto do_one = bind do_one_(fcx, _, post, nv);
  
-  _vec::map[@stmt, ()](do_one, f.body.node.stmts);
+  vec::map[@stmt, ()](do_one, f.body.node.stmts);
   fn do_inner_(fn_ctxt fcx, &@expr e, @poststate post) -> () {
     check_states_expr(fcx, e);
     *post = expr_poststate(e);
@@ -187,7 +187,7 @@ fn one(crate_ctxt ccx, &@method m) -> () {
         ret check_method_states(ccx, m);
     }
     auto f = bind one(ccx,_);
-    _vec::map[@method, ()](f, methods);
+    vec::map[@method, ()](f, methods);
     option::map[@method, ()](f, dtor);
     ret rec(fields=fields, methods=methods, dtor=dtor);
 }
index 79761ceb72df14023cbe11f6c7a0732cd71f53e6..8ec5656cfe63645d60462e7d72486536564af13e 100644 (file)
@@ -1,5 +1,5 @@
-import std::_vec;
-import std::_vec::plus_option;
+import std::vec;
+import std::vec::plus_option;
 
 import front::ast;
 import front::ast::crate;
@@ -39,12 +39,12 @@ fn var_is_local(def_id v, fn_info m) -> bool {
 fn collect_local(&@vec[tup(ident, def_id)] vars, &span sp, &@local loc)
     -> @decl {
     log("collect_local: pushing " + loc.ident);
-    _vec::push[tup(ident, def_id)](*vars, tup(loc.ident, loc.id));
+    vec::push[tup(ident, def_id)](*vars, tup(loc.ident, loc.id));
     ret @respan(sp, decl_local(loc));
 }
 
 fn find_locals(_fn f) -> @vec[tup(ident,def_id)] {
-  auto res = @_vec::alloc[tup(ident,def_id)](0u);
+  auto res = @vec::alloc[tup(ident,def_id)](0u);
 
   auto fld = new_identity_fold[@vec[tup(ident, def_id)]]();
   fld = @rec(fold_decl_local = bind collect_local(_,_,_) with *fld);
@@ -72,7 +72,7 @@ fn mk_fn_info(_fn f, def_id f_id, ident f_name) -> fn_info {
        just collect locally declared vars */
 
     let @vec[tup(ident,def_id)] locals = find_locals(f);
-    // log (uistr(_vec::len[tup(ident, def_id)](locals)) + " locals");
+    // log (uistr(vec::len[tup(ident, def_id)](locals)) + " locals");
     for (tup(ident,def_id) p in *locals) {
         next = add_var(p._1, p._0, next, res);
     }
@@ -98,7 +98,7 @@ fn mk_fn_info_item_fn(&crate_ctxt ccx, &span sp, &ident i, &_fn f,
 fn mk_fn_info_item_obj(&crate_ctxt ccx, &span sp, &ident i, &_obj o,
                        &vec[ty_param] ty_params,
                        &obj_def_ids odid, &ann a) -> @item {
-    auto all_methods = _vec::clone[@method](o.methods);
+    auto all_methods = vec::clone[@method](o.methods);
     plus_option[@method](all_methods, o.dtor);
     auto f_inf;
     for (@method m in all_methods) {
index 587c6a25502e9e26320bbd2e8728cb496e4a67f5..c84c5e2d612e8d6c9d036a88898f90ab6cf11770 100644 (file)
@@ -1,5 +1,5 @@
-import std::_vec;
-import std::_vec::plus_option;
+import std::vec;
+import std::vec::plus_option;
 import std::option;
 import std::option::none;
 import std::option::some;
@@ -180,7 +180,7 @@ fn do_a_method(crate_ctxt ccx, &@method m) -> () {
         find_pre_post_fn(fcx, m.node.meth);
     }
     auto f = bind do_a_method(ccx,_);
-    _vec::map[@method, ()](f, o.methods);
+    vec::map[@method, ()](f, o.methods);
     option::map[@method, ()](f, o.dtor);
 }
 
@@ -233,19 +233,19 @@ fn do_one(fn_ctxt fcx, &@expr e) -> () {
     }
     auto f = bind do_one(fcx, _);
 
-    _vec::map[@expr, ()](f, args);
+    vec::map[@expr, ()](f, args);
 
     fn get_pp(&@expr e) -> pre_and_post {
         ret expr_pp(e);
     }
     auto g = get_pp;
-    auto pps = _vec::map[@expr, pre_and_post](g, args);
+    auto pps = vec::map[@expr, pre_and_post](g, args);
     auto h = get_post;
 
     set_pre_and_post(a,
        rec(precondition=seq_preconds(enclosing, pps),
            postcondition=union_postconds
-           (nv, (_vec::map[pre_and_post, postcond](h, pps)))));
+           (nv, (vec::map[pre_and_post, postcond](h, pps)))));
 }
 
 fn find_pre_post_loop(&fn_ctxt fcx, &@decl d, &@expr index,
@@ -292,13 +292,13 @@ fn pp_one(&@expr e) -> pre_and_post {
 
     alt (e.node) {
         case (expr_call(?operator, ?operands, ?a)) {
-            auto args = _vec::clone[@expr](operands);
-            _vec::push[@expr](args, operator);
+            auto args = vec::clone[@expr](operands);
+            vec::push[@expr](args, operator);
             find_pre_post_exprs(fcx, args, a);
         }
         case (expr_spawn(_, _, ?operator, ?operands, ?a)) {
-            auto args = _vec::clone[@expr](operands);
-            _vec::push[@expr](args, operator);
+            auto args = vec::clone[@expr](operands);
+            vec::push[@expr](args, operator);
             find_pre_post_exprs(fcx, args, a);
         }
         case (expr_vec(?args, _, ?a)) {
@@ -352,7 +352,7 @@ fn pp_one(&@expr e) -> pre_and_post {
         }
         case (expr_rec(?fields,?maybe_base,?a)) {
             auto es = field_exprs(fields);
-            _vec::plus_option[@expr](es, maybe_base);
+            vec::plus_option[@expr](es, maybe_base);
             find_pre_post_exprs(fcx, es, a);
         }
         case (expr_assign(?lhs, ?rhs, ?a)) {
@@ -505,7 +505,7 @@ fn do_an_alt(&fn_ctxt fcx, &arm an_alt) -> pre_and_post {
                 ret block_pp(an_alt.block);
             }
             auto f = bind do_an_alt(fcx, _);
-            auto alt_pps = _vec::map[arm, pre_and_post](f, alts);
+            auto alt_pps = vec::map[arm, pre_and_post](f, alts);
             fn combine_pp(pre_and_post antec, 
                           fn_info enclosing, &pre_and_post pp,
                           &pre_and_post next) -> pre_and_post {
@@ -519,7 +519,7 @@ fn combine_pp(pre_and_post antec,
                              postcondition=false_postcond(num_local_vars));
             auto g = bind combine_pp(antec_pp, fcx.enclosing, _, _);
 
-            auto alts_overall_pp = _vec::foldl[pre_and_post, pre_and_post]
+            auto alts_overall_pp = vec::foldl[pre_and_post, pre_and_post]
                                     (g, e_pp, alt_pps);
 
             set_pre_and_post(a, alts_overall_pp);
@@ -545,8 +545,8 @@ fn combine_pp(pre_and_post antec,
             set_pre_and_post(a, expr_pp(p));
         }
         case(expr_bind(?operator, ?maybe_args, ?a)) {
-            auto args = _vec::cat_options[@expr](maybe_args);
-            _vec::push[@expr](args, operator); /* ??? order of eval? */
+            auto args = vec::cat_options[@expr](maybe_args);
+            vec::push[@expr](args, operator); /* ??? order of eval? */
             find_pre_post_exprs(fcx, args, a);
         }
         case (expr_break(?a)) {
@@ -643,7 +643,7 @@ fn do_one_(fn_ctxt fcx, &@stmt s) -> () {
     }
     auto do_one = bind do_one_(fcx, _);
     
-    _vec::map[@stmt, ()](do_one, b.node.stmts);
+    vec::map[@stmt, ()](do_one, b.node.stmts);
     fn do_inner_(fn_ctxt fcx, &@expr e) -> () {
         find_pre_post_expr(fcx, e);
     }
@@ -656,7 +656,7 @@ fn get_pp_stmt(&@stmt s) -> pre_and_post {
         ret stmt_pp(*s);
     }
     auto f = get_pp_stmt;
-    pps += _vec::map[@stmt, pre_and_post](f, b.node.stmts);
+    pps += vec::map[@stmt, pre_and_post](f, b.node.stmts);
     fn get_pp_expr(&@expr e) -> pre_and_post {
         ret expr_pp(e);
     }
@@ -666,10 +666,10 @@ fn get_pp_expr(&@expr e) -> pre_and_post {
 
     auto block_precond  = seq_preconds(fcx.enclosing, pps);
     auto h = get_post;
-    auto postconds =  _vec::map[pre_and_post, postcond](h, pps);
+    auto postconds =  vec::map[pre_and_post, postcond](h, pps);
     /* A block may be empty, so this next line ensures that the postconds
        vector is non-empty. */
-    _vec::push[postcond](postconds, block_precond);
+    vec::push[postcond](postconds, block_precond);
     auto block_postcond = empty_poststate(nv);
     /* conservative approximation */
     if (! has_nonlocal_exits(b)) {
index aee8b5edb271bd977df94fe112d967dd4666c675..294302cfab27569464ee1171632bf0ab13732ee4 100644 (file)
@@ -1,7 +1,7 @@
 import std::bitv;
-import std::_vec;
-import std::_vec::plus_option;
-import std::_vec::cat_options;
+import std::vec;
+import std::vec::plus_option;
+import std::vec::cat_options;
 import std::option;
 import std::option::get;
 import std::option::is_none;
@@ -538,7 +538,7 @@ fn find_pre_post_state_expr(&fn_ctxt fcx, &prestate pres, @expr e) -> bool {
         changed = find_pre_post_state_expr(fcx, pres, e) || changed;
         auto e_post = expr_poststate(e);
         auto a_post;
-        if (_vec::len[arm](alts) > 0u) {
+        if (vec::len[arm](alts) > 0u) {
             a_post = false_postcond(num_local_vars);
             for (arm an_alt in alts) {
                 changed = find_pre_post_state_block(fcx, e_post,
@@ -766,8 +766,8 @@ fn do_a_method(crate_ctxt ccx, &@method m) -> bool {
                                    m.node.meth);
     }
     auto f = bind do_a_method(ccx,_);
-    auto flags = _vec::map[@method, bool](f, o.methods);
-    auto changed = _vec::or(flags);
+    auto flags = vec::map[@method, bool](f, o.methods);
+    auto changed = vec::or(flags);
     changed = changed || maybe[@method, bool](false, f, o.dtor);
     ret changed;
 }
index a999b6e29d6ac766a360108c380181508450fc10..62ac2f6bd3ad454ce3eaaf97a1b74f8838f361ff 100644 (file)
@@ -1,6 +1,6 @@
-import std::_str;
-import std::_uint;
-import std::_vec;
+import std::str;
+import std::uint;
+import std::vec;
 import std::box;
 import std::ufind;
 import std::map;
@@ -194,7 +194,7 @@ fn mk_type_store() -> @type_store {
     intern(ts, ty_type, none[str]);
     intern(ts, ty_bot, none[str]);
 
-    assert _vec::len(ts.vect) == idx_first_others;
+    assert vec::len(ts.vect) == idx_first_others;
 
     ret ts;
 }
@@ -479,11 +479,11 @@ fn cname(&ctxt cx, &t typ) -> option::t[str] {
 // Stringification
 
 fn path_to_str(&ast::path pth) -> str {
-    auto result = _str::connect(pth.node.idents,  "::");
-    if (_vec::len[@ast::ty](pth.node.types) > 0u) {
+    auto result = str::connect(pth.node.idents,  "::");
+    if (vec::len[@ast::ty](pth.node.types) > 0u) {
         auto f = pretty::pprust::ty_to_str;
         result += "[";
-        result += _str::connect(_vec::map(f, pth.node.types), ",");
+        result += str::connect(vec::map(f, pth.node.types), ",");
         result += "]";
     }
     ret result;
@@ -527,7 +527,7 @@ fn fn_to_str(ctxt cx,
             }
 
             s += "(";
-            s += _str::connect(_vec::map[arg,str](f, inputs), ", ");
+            s += str::connect(vec::map[arg,str](f, inputs), ", ");
             s += ")";
 
             if (struct(cx, output) != ty_nil) {
@@ -585,24 +585,24 @@ fn mt_to_str(ctxt cx, &mt m) -> str {
 
         case (ty_tup(?elems)) {
             auto f = bind mt_to_str(cx, _);
-            auto strs = _vec::map[mt,str](f, elems);
-            s += "tup(" + _str::connect(strs, ",") + ")";
+            auto strs = vec::map[mt,str](f, elems);
+            s += "tup(" + str::connect(strs, ",") + ")";
         }
 
         case (ty_rec(?elems)) {
             auto f = bind field_to_str(cx, _);
-            auto strs = _vec::map[field,str](f, elems);
-            s += "rec(" + _str::connect(strs, ",") + ")";
+            auto strs = vec::map[field,str](f, elems);
+            s += "rec(" + str::connect(strs, ",") + ")";
         }
 
         case (ty_tag(?id, ?tps)) {
             // The user should never see this if the cname is set properly!
             s += "<tag#" + util::common::istr(id._0) + ":" +
                 util::common::istr(id._1) + ">";
-            if (_vec::len[t](tps) > 0u) {
+            if (vec::len[t](tps) > 0u) {
                 auto f = bind ty_to_str(cx, _);
-                auto strs = _vec::map[t,str](f, tps);
-                s += "[" + _str::connect(strs, ",") + "]";
+                auto strs = vec::map[t,str](f, tps);
+                s += "[" + str::connect(strs, ",") + "]";
             }
         }
 
@@ -617,8 +617,8 @@ fn mt_to_str(ctxt cx, &mt m) -> str {
 
         case (ty_obj(?meths)) {
             auto f = bind method_to_str(cx, _);
-            auto m = _vec::map[method,str](f, meths);
-            s += "obj {\n\t" + _str::connect(m, "\n\t") + "\n}";
+            auto m = vec::map[method,str](f, meths);
+            s += "obj {\n\t" + str::connect(m, "\n\t") + "\n}";
         }
 
         case (ty_var(?v)) {
@@ -631,11 +631,11 @@ fn mt_to_str(ctxt cx, &mt m) -> str {
         }
 
         case (ty_param(?id)) {
-            s += "'" + _str::unsafe_from_bytes([('a' as u8) + (id as u8)]);
+            s += "'" + str::unsafe_from_bytes([('a' as u8) + (id as u8)]);
         }
 
         case (ty_bound_param(?id)) {
-            s += "''" + _str::unsafe_from_bytes([('a' as u8) +
+            s += "''" + str::unsafe_from_bytes([('a' as u8) +
                                                     (id as u8)]);
         }
 
@@ -652,7 +652,7 @@ fn ty_to_short_str(ctxt cx, t typ) -> str {
     auto f = def_to_str;
     auto ecx = @rec(ds=f, tcx=cx, abbrevs=metadata::ac_no_abbrevs);
     auto s = metadata::Encode::ty_str(ecx, typ);
-    if (_str::byte_len(s) >= 32u) { s = _str::substr(s, 0u, 32u); }
+    if (str::byte_len(s) >= 32u) { s = str::substr(s, 0u, 32u); }
     ret s;
 }
 
@@ -955,14 +955,14 @@ fn type_has_dynamic_size(&ctxt cx, &t ty) -> bool {
     alt (struct(cx, ty)) {
         case (ty_tup(?mts)) {
             auto i = 0u;
-            while (i < _vec::len[mt](mts)) {
+            while (i < vec::len[mt](mts)) {
                 if (type_has_dynamic_size(cx, mts.(i).ty)) { ret true; }
                 i += 1u;
             }
         }
         case (ty_rec(?fields)) {
             auto i = 0u;
-            while (i < _vec::len[field](fields)) {
+            while (i < vec::len[field](fields)) {
                 if (type_has_dynamic_size(cx, fields.(i).mt.ty)) {
                     ret true;
                 }
@@ -971,7 +971,7 @@ fn type_has_dynamic_size(&ctxt cx, &t ty) -> bool {
         }
         case (ty_tag(_, ?subtys)) {
             auto i = 0u;
-            while (i < _vec::len[t](subtys)) {
+            while (i < vec::len[t](subtys)) {
                 if (type_has_dynamic_size(cx, subtys.(i))) { ret true; }
                 i += 1u;
             }
@@ -1139,7 +1139,7 @@ fn hash_fn(uint id, &vec[arg] args, &t rty) -> uint {
         case (ty_obj(?methods)) {
             auto h = 27u;
             for (method m in methods) {
-                h += h << 5u + _str::hash(m.ident);
+                h += h << 5u + str::hash(m.ident);
             }
             ret h;
         }
@@ -1157,7 +1157,7 @@ fn hash_type_info(&sty st, &option::t[str] cname_opt) -> uint {
     auto h = hash_type_structure(st);
     alt (cname_opt) {
         case (none[str]) { /* no-op */ }
-        case (some[str](?s)) { h += h << 5u + _str::hash(s); }
+        case (some[str](?s)) { h += h << 5u + str::hash(s); }
     }
     ret h;
 }
@@ -1178,8 +1178,8 @@ fn equal_fn(&vec[arg] args_a, &t rty_a,
                 &vec[arg] args_b, &t rty_b) -> bool {
         if (!eq_ty(rty_a, rty_b)) { ret false; }
 
-        auto len = _vec::len[arg](args_a);
-        if (len != _vec::len[arg](args_b)) { ret false; }
+        auto len = vec::len[arg](args_a);
+        if (len != vec::len[arg](args_b)) { ret false; }
 
         auto i = 0u;
         while (i < len) {
@@ -1257,8 +1257,8 @@ fn equal_def(&ast::def_id did_a, &ast::def_id did_b) -> bool {
                 case (ty_tag(?id_b, ?tys_b)) {
                     if (!equal_def(id_a, id_b)) { ret false; }
 
-                    auto len = _vec::len[t](tys_a);
-                    if (len != _vec::len[t](tys_b)) { ret false; }
+                    auto len = vec::len[t](tys_a);
+                    if (len != vec::len[t](tys_b)) { ret false; }
                     auto i = 0u;
                     while (i < len) {
                         if (!eq_ty(tys_a.(i), tys_b.(i))) { ret false; }
@@ -1302,8 +1302,8 @@ fn equal_def(&ast::def_id did_a, &ast::def_id did_b) -> bool {
         case (ty_tup(?mts_a)) {
             alt (b) {
                 case (ty_tup(?mts_b)) {
-                    auto len = _vec::len[mt](mts_a);
-                    if (len != _vec::len[mt](mts_b)) { ret false; }
+                    auto len = vec::len[mt](mts_a);
+                    if (len != vec::len[mt](mts_b)) { ret false; }
                     auto i = 0u;
                     while (i < len) {
                         if (!equal_mt(mts_a.(i), mts_b.(i))) { ret false; }
@@ -1317,12 +1317,12 @@ fn equal_def(&ast::def_id did_a, &ast::def_id did_b) -> bool {
         case (ty_rec(?flds_a)) {
             alt (b) {
                 case (ty_rec(?flds_b)) {
-                    auto len = _vec::len[field](flds_a);
-                    if (len != _vec::len[field](flds_b)) { ret false; }
+                    auto len = vec::len[field](flds_a);
+                    if (len != vec::len[field](flds_b)) { ret false; }
                     auto i = 0u;
                     while (i < len) {
                         auto fld_a = flds_a.(i); auto fld_b = flds_b.(i);
-                        if (!_str::eq(fld_a.ident, fld_b.ident) ||
+                        if (!str::eq(fld_a.ident, fld_b.ident) ||
                                 !equal_mt(fld_a.mt, fld_b.mt)) {
                             ret false;
                         }
@@ -1354,13 +1354,13 @@ fn equal_def(&ast::def_id did_a, &ast::def_id did_b) -> bool {
         case (ty_obj(?methods_a)) {
             alt (b) {
                 case (ty_obj(?methods_b)) {
-                    auto len = _vec::len[method](methods_a);
-                    if (len != _vec::len[method](methods_b)) { ret false; }
+                    auto len = vec::len[method](methods_a);
+                    if (len != vec::len[method](methods_b)) { ret false; }
                     auto i = 0u;
                     while (i < len) {
                         auto m_a = methods_a.(i); auto m_b = methods_b.(i);
                         if (m_a.proto != m_b.proto ||
-                                !_str::eq(m_a.ident, m_b.ident) ||
+                                !str::eq(m_a.ident, m_b.ident) ||
                                 !equal_fn(m_a.inputs, m_a.output,
                                           m_b.inputs, m_b.output)) {
                             ret false;
@@ -1432,7 +1432,7 @@ fn eq_raw_ty(&raw_t a, &raw_t b) -> bool {
         case (some[str](?s_a)) {
             alt (b.cname) {
                 case (some[str](?s_b)) {
-                    if (!_str::eq(s_a, s_b)) { ret false; }
+                    if (!str::eq(s_a, s_b)) { ret false; }
                 }
                 case (_) { ret false; }
             }
@@ -1534,7 +1534,7 @@ fn counter(ctxt cx, @mutable vec[uint] param_indices, t ty) {
     let @mutable vec[uint] param_indices = @mutable v;
     auto f = bind counter(cx, param_indices, _);
     walk_ty(cx, f, ty);
-    ret _vec::len[uint](*param_indices);
+    ret vec::len[uint](*param_indices);
 }
 
 fn type_contains_vars(&ctxt cx, &t typ) -> bool {
@@ -1605,7 +1605,7 @@ fn native_item_ty(&node_type_table ntt, &@ast::native_item it)
     auto result_ty;
     alt (it.node) {
         case (ast::native_item_fn(_, _, _, ?tps, _, ?ann)) {
-            ty_param_count = _vec::len[ast::ty_param](tps);
+            ty_param_count = vec::len[ast::ty_param](tps);
             result_ty = ann_to_type(ntt, ann);
         }
     }
@@ -1621,22 +1621,22 @@ fn item_ty(&node_type_table ntt, &@ast::item it) -> ty_param_count_and_ty {
             result_ty = ann_to_type(ntt, ann);
         }
         case (ast::item_fn(_, _, ?tps, _, ?ann)) {
-            ty_param_count = _vec::len[ast::ty_param](tps);
+            ty_param_count = vec::len[ast::ty_param](tps);
             result_ty = ann_to_type(ntt, ann);
         }
         case (ast::item_mod(_, _, _)) {
             fail;   // modules are typeless
         }
         case (ast::item_ty(_, _, ?tps, _, ?ann)) {
-            ty_param_count = _vec::len[ast::ty_param](tps);
+            ty_param_count = vec::len[ast::ty_param](tps);
             result_ty = ann_to_type(ntt, ann);
         }
         case (ast::item_tag(_, _, ?tps, ?did, ?ann)) {
-            ty_param_count = _vec::len[ast::ty_param](tps);
+            ty_param_count = vec::len[ast::ty_param](tps);
             result_ty = ann_to_type(ntt, ann);
         }
         case (ast::item_obj(_, _, ?tps, _, ?ann)) {
-            ty_param_count = _vec::len[ast::ty_param](tps);
+            ty_param_count = vec::len[ast::ty_param](tps);
             result_ty = ann_to_type(ntt, ann);
         }
     }
@@ -1781,7 +1781,7 @@ fn field_num(&session::session sess, &span sp,
                 accum += (c as uint) - ('0' as uint);
             } else {
                 auto s = "";
-                s += _str::unsafe_from_byte(c);
+                s += str::unsafe_from_byte(c);
                 sess.span_err(sp,
                               "bad numeric field on tuple: "
                               + " non-digit character: "
@@ -1797,7 +1797,7 @@ fn field_idx(&session::session sess, &span sp,
              &ast::ident id, &vec[field] fields) -> uint {
     let uint i = 0u;
     for (field f in fields) {
-        if (_str::eq(f.ident, id)) {
+        if (str::eq(f.ident, id)) {
             ret i;
         }
         i += 1u;
@@ -1810,7 +1810,7 @@ fn method_idx(&session::session sess, &span sp,
               &ast::ident id, &vec[method] meths) -> uint {
     let uint i = 0u;
     for (method m in meths) {
-        if (_str::eq(m.ident, id)) {
+        if (str::eq(m.ident, id)) {
             ret i;
         }
         i += 1u;
@@ -1821,7 +1821,7 @@ fn method_idx(&session::session sess, &span sp,
 
 fn sort_methods(&vec[method] meths) -> vec[method] {
     fn method_lteq(&method a, &method b) -> bool {
-        ret _str::lteq(a.ident, b.ident);
+        ret str::lteq(a.ident, b.ident);
     }
 
     ret std::sort::merge_sort[method](bind method_lteq(_,_), meths);
@@ -1896,8 +1896,8 @@ fn unify_fn_common(&@ctxt cx,
                        &vec[arg] expected_inputs, &t expected_output,
                        &vec[arg] actual_inputs, &t actual_output)
         -> fn_common_res {
-        auto expected_len = _vec::len[arg](expected_inputs);
-        auto actual_len = _vec::len[arg](actual_inputs);
+        auto expected_len = vec::len[arg](expected_inputs);
+        auto actual_len = vec::len[arg](actual_inputs);
         if (expected_len != actual_len) {
             ret fn_common_res_err(ures_err(terr_arg_count,
                                            expected, actual));
@@ -2012,8 +2012,8 @@ fn unify_obj(&@ctxt cx,
                  &vec[method] actual_meths) -> result {
       let vec[method] result_meths = [];
       let uint i = 0u;
-      let uint expected_len = _vec::len[method](expected_meths);
-      let uint actual_len = _vec::len[method](actual_meths);
+      let uint expected_len = vec::len[method](expected_meths);
+      let uint actual_len = vec::len[method](actual_meths);
 
       if (expected_len != actual_len) {
         ret ures_err(terr_meth_count, expected, actual);
@@ -2022,7 +2022,7 @@ fn unify_obj(&@ctxt cx,
       while (i < expected_len) {
         auto e_meth = expected_meths.(i);
         auto a_meth = actual_meths.(i);
-        if (! _str::eq(e_meth.ident, a_meth.ident)) {
+        if (! str::eq(e_meth.ident, a_meth.ident)) {
           ret ures_err(terr_obj_meths(e_meth.ident, a_meth.ident),
                        expected, actual);
         }
@@ -2086,7 +2086,7 @@ fn unify_step(&@ctxt cx, &t expected, &t actual) -> result {
 
                     case (_) {
                         // Just bind the type variable to the expected type.
-                        auto vlen = _vec::len[vec[t]](cx.types);
+                        auto vlen = vec::len[vec[t]](cx.types);
                         if (actual_n < vlen) {
                             cx.types.(actual_n) += [expected];
                         } else {
@@ -2154,7 +2154,7 @@ fn unify_step(&@ctxt cx, &t expected, &t actual) -> result {
                         // ty::ty_tup case
                         let vec[t] result_tps = [];
                         auto i = 0u;
-                        auto expected_len = _vec::len[t](expected_tps);
+                        auto expected_len = vec::len[t](expected_tps);
                         while (i < expected_len) {
                             auto expected_tp = expected_tps.(i);
                             auto actual_tp = actual_tps.(i);
@@ -2165,7 +2165,7 @@ fn unify_step(&@ctxt cx, &t expected, &t actual) -> result {
 
                             alt (result) {
                                 case (ures_ok(?rty)) {
-                                    _vec::push[t](result_tps, rty);
+                                    vec::push[t](result_tps, rty);
                                 }
                                 case (_) {
                                     ret result;
@@ -2294,8 +2294,8 @@ fn unify_step(&@ctxt cx, &t expected, &t actual) -> result {
             case (ty::ty_tup(?expected_elems)) {
                 alt (struct(cx.tcx, actual)) {
                     case (ty::ty_tup(?actual_elems)) {
-                        auto expected_len = _vec::len[ty::mt](expected_elems);
-                        auto actual_len = _vec::len[ty::mt](actual_elems);
+                        auto expected_len = vec::len[ty::mt](expected_elems);
+                        auto actual_len = vec::len[ty::mt](actual_elems);
                         if (expected_len != actual_len) {
                             auto err = terr_tuple_size(expected_len,
                                                        actual_len);
@@ -2348,8 +2348,8 @@ fn unify_step(&@ctxt cx, &t expected, &t actual) -> result {
             case (ty::ty_rec(?expected_fields)) {
                 alt (struct(cx.tcx, actual)) {
                     case (ty::ty_rec(?actual_fields)) {
-                        auto expected_len = _vec::len[field](expected_fields);
-                        auto actual_len = _vec::len[field](actual_fields);
+                        auto expected_len = vec::len[field](expected_fields);
+                        auto actual_len = vec::len[field](actual_fields);
                         if (expected_len != actual_len) {
                             auto err = terr_record_size(expected_len,
                                                         actual_len);
@@ -2374,7 +2374,7 @@ fn unify_step(&@ctxt cx, &t expected, &t actual) -> result {
                                 case (some[ast::mutability](?m)) { mut = m; }
                             }
 
-                            if (!_str::eq(expected_field.ident,
+                            if (!str::eq(expected_field.ident,
                                          actual_field.ident)) {
                                 auto err =
                                     terr_record_fields(expected_field.ident,
@@ -2388,7 +2388,7 @@ fn unify_step(&@ctxt cx, &t expected, &t actual) -> result {
                             alt (result) {
                                 case (ures_ok(?rty)) {
                                     auto mt = rec(ty=rty, mut=mut);
-                                    _vec::push[field]
+                                    vec::push[field]
                                         (result_fields,
                                          rec(mt=mt with expected_field));
                                 }
@@ -2455,7 +2455,7 @@ fn unify_step(&@ctxt cx, &t expected, &t actual) -> result {
             case (ty::ty_var(?expected_id)) {
                 // Add a binding.
                 auto expected_n = get_or_create_set(cx, expected_id);
-                auto vlen = _vec::len[vec[t]](cx.types);
+                auto vlen = vec::len[vec[t]](cx.types);
                 if (expected_n < vlen) {
                     cx.types.(expected_n) += [actual];
                 } else {
@@ -2519,7 +2519,7 @@ fn substituter(@ctxt cx, vec[t] types, t typ) -> t {
     fn unify_sets(&@ctxt cx) -> vec[t] {
         let vec[t] throwaway = [];
         let vec[mutable vec[t]] set_types = [mutable throwaway];
-        _vec::pop[vec[t]](set_types);   // FIXME: botch
+        vec::pop[vec[t]](set_types);   // FIXME: botch
 
         for (ufind::node node in cx.sets.nodes) {
             let vec[t] v = [];
@@ -2527,7 +2527,7 @@ fn unify_sets(&@ctxt cx) -> vec[t] {
         }
 
         auto i = 0u;
-        while (i < _vec::len[vec[t]](set_types)) {
+        while (i < vec::len[vec[t]](set_types)) {
             auto root = ufind::find(cx.sets, i);
             set_types.(root) += cx.types.(i);
             i += 1u;
@@ -2535,7 +2535,7 @@ fn unify_sets(&@ctxt cx) -> vec[t] {
 
         let vec[t] result = [];
         for (vec[t] types in set_types) {
-            if (_vec::len[t](types) > 1u) {
+            if (vec::len[t](types) > 1u) {
                 log_err "unification of > 1 types in a type set is " +
                     "unimplemented";
                 fail;
@@ -2552,7 +2552,7 @@ fn unify(&t expected,
              &ty_ctxt tcx) -> result {
         let vec[t] throwaway = [];
         let vec[mutable vec[t]] types = [mutable throwaway];
-        _vec::pop[vec[t]](types);   // FIXME: botch
+        vec::pop[vec[t]](types);   // FIXME: botch
 
         auto cx = @rec(sets=ufind::make(),
                        var_ids=common::new_int_hash[uint](),
@@ -2565,7 +2565,7 @@ fn unify(&t expected,
         case (ures_ok(?typ)) {
             // Fast path: if there are no local variables, don't perform
             // substitutions.
-            if (_vec::len(cx.sets.nodes) == 0u) {
+            if (vec::len(cx.sets.nodes) == 0u) {
                 ret ures_ok(typ);
             }
 
@@ -2591,16 +2591,16 @@ fn type_err_to_str(&ty::type_err err) -> str {
             ret "vectors differ in mutability";
         }
         case (terr_tuple_size(?e_sz, ?a_sz)) {
-            ret "expected a tuple with " + _uint::to_str(e_sz, 10u) +
-                " elements but found one with " + _uint::to_str(a_sz, 10u) +
+            ret "expected a tuple with " + uint::to_str(e_sz, 10u) +
+                " elements but found one with " + uint::to_str(a_sz, 10u) +
                 " elements";
         }
         case (terr_tuple_mutability) {
             ret "tuple elements differ in mutability";
         }
         case (terr_record_size(?e_sz, ?a_sz)) {
-            ret "expected a record with " + _uint::to_str(e_sz, 10u) +
-                " fields but found one with " + _uint::to_str(a_sz, 10u) +
+            ret "expected a record with " + uint::to_str(e_sz, 10u) +
+                " fields but found one with " + uint::to_str(a_sz, 10u) +
                 " fields";
         }
         case (terr_record_mutability) {
index ef29ba2ade7dccf2681797b9f678e347605183bd..ad100cf238971396f5b38a32b7014da964c4e1de 100644 (file)
@@ -37,9 +37,9 @@
 import middle::ty::unify::ures_ok;
 import middle::ty::unify::ures_err;
 
-import std::_str;
-import std::_uint;
-import std::_vec;
+import std::str;
+import std::uint;
+import std::vec;
 import std::map;
 import std::map::hashmap;
 import std::option;
@@ -97,12 +97,12 @@ fn substituter(@crate_ctxt ccx, vec[ty::t] supplied, ty::t typ) -> ty::t {
         }
     }
 
-    auto supplied_len = _vec::len[ty::t](supplied);
+    auto supplied_len = vec::len[ty::t](supplied);
     if (ty_param_count != supplied_len) {
         ccx.sess.span_err(sp, "expected " +
-                          _uint::to_str(ty_param_count, 10u) +
+                          uint::to_str(ty_param_count, 10u) +
                           " type parameter(s) but found " +
-                          _uint::to_str(supplied_len, 10u) + " parameter(s)");
+                          uint::to_str(supplied_len, 10u) + " parameter(s)");
         fail;
     }
 
@@ -187,7 +187,7 @@ fn instantiate_path(&@fn_ctxt fcx, &ast::path pth, &ty_param_count_and_ty tpt,
     auto t = bind_params_in_type(fcx.ccx.tcx, tpt._1);
 
     auto ty_substs_opt;
-    auto ty_substs_len = _vec::len[@ast::ty](pth.node.types);
+    auto ty_substs_len = vec::len[@ast::ty](pth.node.types);
     if (ty_substs_len > 0u) {
         let vec[ty::t] ty_substs = [];
         auto i = 0u;
@@ -298,7 +298,7 @@ fn instantiate(&ty::ctxt tcx,
         case (ast::ty_tup(?fields)) {
             let vec[ty::mt] flds = [];
             for (ast::mt field in fields) {
-                _vec::push[ty::mt](flds, ast_mt_to_mt(tcx, getter, field));
+                vec::push[ty::mt](flds, ast_mt_to_mt(tcx, getter, field));
             }
             typ = ty::mk_tup(tcx, flds);
         }
@@ -306,14 +306,14 @@ fn instantiate(&ty::ctxt tcx,
             let vec[field] flds = [];
             for (ast::ty_field f in fields) {
                 auto tm = ast_mt_to_mt(tcx, getter, f.mt);
-                _vec::push[field](flds, rec(ident=f.ident, mt=tm));
+                vec::push[field](flds, rec(ident=f.ident, mt=tm));
             }
             typ = ty::mk_rec(tcx, flds);
         }
 
         case (ast::ty_fn(?proto, ?inputs, ?output)) {
             auto f = bind ast_arg_to_arg(tcx, getter, _);
-            auto i = _vec::map[ast::ty_arg, arg](f, inputs);
+            auto i = vec::map[ast::ty_arg, arg](f, inputs);
             auto out_ty = ast_ty_to_ty(tcx, getter, output);
             typ = ty::mk_fn(tcx, proto, i, out_ty);
         }
@@ -341,9 +341,9 @@ fn instantiate(&ty::ctxt tcx,
             let vec[ty::method] tmeths = [];
             auto f = bind ast_arg_to_arg(tcx, getter, _);
             for (ast::ty_method m in meths) {
-                auto ins = _vec::map[ast::ty_arg, arg](f, m.inputs);
+                auto ins = vec::map[ast::ty_arg, arg](f, m.inputs);
                 auto out = ast_ty_to_ty(tcx, getter, m.output);
-                _vec::push[ty::method](tmeths,
+                vec::push[ty::method](tmeths,
                                   rec(proto=m.proto,
                                       ident=m.ident,
                                       inputs=ins,
@@ -377,7 +377,7 @@ fn getter(@crate_ctxt ccx, &ast::def_id id) -> ty::ty_param_count_and_ty {
 // Writes a type parameter count and type pair into the node type table.
 fn write_type(&node_type_table ntt, uint node_id,
               &ty_param_substs_opt_and_ty tpot) {
-    _vec::grow_set[option::t[ty::ty_param_substs_opt_and_ty]]
+    vec::grow_set[option::t[ty::ty_param_substs_opt_and_ty]]
         (*ntt,
          node_id,
          none[ty_param_substs_opt_and_ty],
@@ -425,10 +425,10 @@ fn ty_of_fn_decl(&@ctxt cx,
                      ast::proto proto,
                      &vec[ast::ty_param] ty_params,
                      &ast::def_id def_id) -> ty::ty_param_count_and_ty {
-        auto input_tys = _vec::map[ast::arg,arg](ty_of_arg, decl.inputs);
+        auto input_tys = vec::map[ast::arg,arg](ty_of_arg, decl.inputs);
         auto output_ty = convert(decl.output);
         auto t_fn = ty::mk_fn(cx.tcx, proto, input_tys, output_ty);
-        auto ty_param_count = _vec::len[ast::ty_param](ty_params);
+        auto ty_param_count = vec::len[ast::ty_param](ty_params);
         auto tpt = tup(ty_param_count, t_fn);
         cx.type_cache.insert(def_id, tpt);
         ret tpt;
@@ -441,10 +441,10 @@ fn ty_of_native_fn_decl(&@ctxt cx,
                             ast::native_abi abi,
                             &vec[ast::ty_param] ty_params,
                             &ast::def_id def_id) -> ty::ty_param_count_and_ty{
-        auto input_tys = _vec::map[ast::arg,arg](ty_of_arg, decl.inputs);
+        auto input_tys = vec::map[ast::arg,arg](ty_of_arg, decl.inputs);
         auto output_ty = convert(decl.output);
         auto t_fn = ty::mk_native_fn(cx.tcx, abi, input_tys, output_ty);
-        auto ty_param_count = _vec::len[ast::ty_param](ty_params);
+        auto ty_param_count = vec::len[ast::ty_param](ty_params);
         auto tpt = tup(ty_param_count, t_fn);
         cx.type_cache.insert(def_id, tpt);
         ret tpt;
@@ -479,7 +479,7 @@ fn ty_of_method(@ctxt cx, &@ast::method m) -> method {
         auto get = bind getter(cx, _);
         auto convert = bind ast_ty_to_ty(cx.tcx, get, _);
         auto f = bind ty_of_arg(cx, _);
-        auto inputs = _vec::map[ast::arg,arg](f, m.node.meth.decl.inputs);
+        auto inputs = vec::map[ast::arg,arg](f, m.node.meth.decl.inputs);
         auto output = convert(m.node.meth.decl.output);
         ret rec(proto=m.node.meth.proto, ident=m.node.ident,
                 inputs=inputs, output=output);
@@ -492,7 +492,7 @@ fn ty_of_obj(@ctxt cx,
         auto methods = get_obj_method_types(cx, obj_info);
         auto t_obj = ty::mk_obj(cx.tcx, ty::sort_methods(methods));
         t_obj = ty::rename(cx.tcx, t_obj, id);
-        auto ty_param_count = _vec::len[ast::ty_param](ty_params);
+        auto ty_param_count = vec::len[ast::ty_param](ty_params);
         ret tup(ty_param_count, t_obj);
     }
 
@@ -508,7 +508,7 @@ fn ty_of_obj_ctor(@ctxt cx,
         for (ast::obj_field f in obj_info.fields) {
             auto g = bind getter(cx, _);
             auto t_field = ast_ty_to_ty(cx.tcx, g, f.ty);
-            _vec::push[arg](t_inputs, rec(mode=ty::mo_alias, ty=t_field));
+            vec::push[arg](t_inputs, rec(mode=ty::mo_alias, ty=t_field));
         }
 
         auto t_fn = ty::mk_fn(cx.tcx, ast::proto_fn, t_inputs, t_obj._1);
@@ -555,7 +555,7 @@ fn ty_of_item(&@ctxt cx, &@ast::item it) -> ty::ty_param_count_and_ty {
                 // Tell ast_ty_to_ty() that we want to perform a recursive
                 // call to resolve any named types.
                 auto typ = convert(t);
-                auto ty_param_count = _vec::len[ast::ty_param](tps);
+                auto ty_param_count = vec::len[ast::ty_param](tps);
                 auto tpt = tup(ty_param_count, typ);
                 cx.type_cache.insert(def_id, tpt);
                 ret tpt;
@@ -573,7 +573,7 @@ fn ty_of_item(&@ctxt cx, &@ast::item it) -> ty::ty_param_count_and_ty {
 
                 auto t = ty::mk_tag(cx.tcx, def_id, subtys);
 
-                auto ty_param_count = _vec::len[ast::ty_param](tps);
+                auto ty_param_count = vec::len[ast::ty_param](tps);
                 auto tpt = tup(ty_param_count, t);
                 cx.type_cache.insert(def_id, tpt);
                 ret tpt;
@@ -625,13 +625,13 @@ fn get_tag_variant_types(&@ctxt cx, &ast::def_id tag_id,
             i += 1u;
         }
 
-        auto ty_param_count = _vec::len[ast::ty_param](ty_params);
+        auto ty_param_count = vec::len[ast::ty_param](ty_params);
 
         for (ast::variant variant in variants) {
             // Nullary tag constructors get turned into constants; n-ary tag
             // constructors get turned into functions.
             auto result_ty;
-            if (_vec::len[ast::variant_arg](variant.node.args) == 0u) {
+            if (vec::len[ast::variant_arg](variant.node.args) == 0u) {
                 result_ty = ty::mk_tag(cx.tcx, tag_id, ty_param_tys);
             } else {
                 // As above, tell ast_ty_to_ty() that trans_ty_item_to_ty()
@@ -662,7 +662,7 @@ fn get_tag_variant_types(&@ctxt cx, &ast::def_id tag_id,
     }
 
     fn get_obj_method_types(&@ctxt cx, &ast::_obj object) -> vec[method] {
-        ret _vec::map[@ast::method,method](bind ty_of_method(cx, _),
+        ret vec::map[@ast::method,method](bind ty_of_method(cx, _),
                                            object.methods);
     }
 
@@ -726,7 +726,7 @@ fn convert(@ctxt cx, @mutable option::t[ast::native_abi] abi,
                 // ty_of_obj().)
                 auto method_types = get_obj_method_types(cx, object);
                 auto i = 0u;
-                while (i < _vec::len[@ast::method](object.methods)) {
+                while (i < vec::len[@ast::method](object.methods)) {
                     write_type_only(cx.node_types,
                                     ast::ann_tag(object.methods.(i).node.ann),
                                     ty::method_ty_to_fn_ty(cx.tcx,
@@ -736,11 +736,11 @@ fn convert(@ctxt cx, @mutable option::t[ast::native_abi] abi,
 
                 // Write in the types of the object fields.
                 //
-                // FIXME: We want to use _uint::range() here, but that causes
+                // FIXME: We want to use uint::range() here, but that causes
                 // an assertion in trans.
                 auto args = ty::ty_fn_args(cx.tcx, tpt._1);
                 i = 0u;
-                while (i < _vec::len[ty::arg](args)) {
+                while (i < vec::len[ty::arg](args)) {
                     auto fld = object.fields.(i);
                     write_type_only(cx.node_types, ast::ann_tag(fld.ann),
                                     args.(i).ty);
@@ -840,7 +840,7 @@ fn simple(&@fn_ctxt fcx, &ty::t expected,
         // FIXME: horrid botch
         let vec[mutable ty::t] param_substs =
             [mutable ty::mk_nil(fcx.ccx.tcx)];
-        _vec::pop(param_substs);
+        vec::pop(param_substs);
         ret with_params(fcx, expected, actual, param_substs);
     }
 
@@ -999,7 +999,7 @@ fn full(&@fn_ctxt fcx, &span sp, &ty::t expected, &ty::t actual,
 
         let vec[mutable ty::t] ty_param_substs =
             [mutable ty::mk_nil(fcx.ccx.tcx)];
-        _vec::pop(ty_param_substs);   // FIXME: horrid botch
+        vec::pop(ty_param_substs);   // FIXME: horrid botch
         for (ty::t ty_param_subst in ty_param_substs_0) {
             ty_param_substs += [mutable ty_param_subst];
         }
@@ -1042,7 +1042,7 @@ fn are_compatible(&@fn_ctxt fcx, &ty::t expected, &ty::t actual) -> bool {
 // Returns the types of the arguments to a tag variant.
 fn variant_arg_types(&@crate_ctxt ccx, &span sp, &ast::def_id vid,
                      &vec[ty::t] tag_ty_params) -> vec[ty::t] {
-    auto ty_param_count = _vec::len[ty::t](tag_ty_params);
+    auto ty_param_count = vec::len[ty::t](tag_ty_params);
 
     let vec[ty::t] result = [];
 
@@ -1137,7 +1137,7 @@ fn pushdown_pat(&@fn_ctxt fcx, &ty::t expected, &@ast::pat pat) {
                                                    pat.span,
                                                    t1, t2);
                     
-                    _vec::push(tparams, res);
+                    vec::push(tparams, res);
                     j += 1u;
                 }
 
@@ -1247,7 +1247,7 @@ fn pushdown_expr_full(&@fn_ctxt fcx, &ty::t expected, &@ast::expr e,
                             case (none[@ast::expr]) {
                                 auto i = 0u;
                                 for (ast::field field_0 in fields_0) {
-                                    assert (_str::eq(field_0.ident,
+                                    assert (str::eq(field_0.ident,
                                                    field_mts.(i).ident));
                                     auto e_1 =
                                         pushdown_expr(fcx,
@@ -1269,7 +1269,7 @@ fn pushdown_expr_full(&@fn_ctxt fcx, &ty::t expected, &@ast::expr e,
                                 for (ast::field field_0 in fields_0) {
 
                                     for (ty::field ft in field_mts) {
-                                        if (_str::eq(field_0.ident,
+                                        if (str::eq(field_0.ident,
                                                     ft.ident)) {
                                             auto e_1 =
                                                 pushdown_expr(fcx, ft.mt.ty,
@@ -1713,7 +1713,7 @@ fn check_pat(&@fn_ctxt fcx, &@ast::pat pat) {
                 (fcx.ccx.tcx.def_map.get(ast::ann_tag(old_ann)));
             auto t = ty::lookup_item_type(fcx.ccx.sess, fcx.ccx.tcx,
                                          fcx.ccx.type_cache, vdef._1)._1;
-            auto len = _vec::len[ast::ident](p.node.idents);
+            auto len = vec::len[ast::ident](p.node.idents);
             auto last_id = p.node.idents.(len - 1u);
 
             auto tpt = ty::lookup_item_type(fcx.ccx.sess, fcx.ccx.tcx,
@@ -1724,14 +1724,14 @@ fn check_pat(&@fn_ctxt fcx, &@ast::pat pat) {
             alt (struct(fcx.ccx.tcx, t)) {
                 // N-ary variants have function types.
                 case (ty::ty_fn(_, ?args, ?tag_ty)) {
-                    auto arg_len = _vec::len[arg](args);
-                    auto subpats_len = _vec::len[@ast::pat](subpats);
+                    auto arg_len = vec::len[arg](args);
+                    auto subpats_len = vec::len[@ast::pat](subpats);
                     if (arg_len != subpats_len) {
                         // TODO: pluralize properly
                         auto err_msg = "tag type " + last_id + " has " +
-                                       _uint::to_str(subpats_len, 10u) +
+                                       uint::to_str(subpats_len, 10u) +
                                        " field(s), but this pattern has " +
-                                       _uint::to_str(arg_len, 10u) +
+                                       uint::to_str(arg_len, 10u) +
                                        " field(s)";
 
                         fcx.ccx.sess.span_err(pat.span, err_msg);
@@ -1748,13 +1748,13 @@ fn check_pat(&@fn_ctxt fcx, &@ast::pat pat) {
 
                 // Nullary variants have tag types.
                 case (ty::ty_tag(?tid, _)) {
-                    auto subpats_len = _vec::len[@ast::pat](subpats);
+                    auto subpats_len = vec::len[@ast::pat](subpats);
                     if (subpats_len > 0u) {
                         // TODO: pluralize properly
                         auto err_msg = "tag type " + last_id +
                                        " has no field(s)," +
                                        " but this pattern has " +
-                                       _uint::to_str(subpats_len, 10u) +
+                                       uint::to_str(subpats_len, 10u) +
                                        " field(s)";
 
                         fcx.ccx.sess.span_err(pat.span, err_msg);
@@ -1855,13 +1855,13 @@ fn check_call_or_bind(&@fn_ctxt fcx, &@ast::expr f,
                     auto arg_ty = rec(mode=mo_either,
                                       ty=expr_ty(fcx.ccx.tcx,
                                                  fcx.ccx.node_types, a_0));
-                    _vec::push[arg](arg_tys_0, arg_ty);
+                    vec::push[arg](arg_tys_0, arg_ty);
                 }
                 case (none[@ast::expr]) {
                     args_0 += [none[@ast::expr]];
 
                     auto typ = next_ty_var(fcx.ccx);
-                    _vec::push[arg](arg_tys_0, rec(mode=mo_either, ty=typ));
+                    vec::push[arg](arg_tys_0, rec(mode=mo_either, ty=typ));
                 }
             }
         }
@@ -2028,7 +2028,7 @@ fn check_call(&@fn_ctxt fcx, &@ast::expr f, &vec[@ast::expr] args)
 
             // The definition doesn't take type parameters. If the programmer
             // supplied some, that's an error.
-            if (_vec::len[@ast::ty](pth.node.types) > 0u) {
+            if (vec::len[@ast::ty](pth.node.types) > 0u) {
                 fcx.ccx.sess.span_err(expr.span, "this kind of value does " +
                                       "not take type parameters");
                 fail;
@@ -2471,7 +2471,7 @@ fn check_call(&@fn_ctxt fcx, &@ast::expr f, &vec[@ast::expr] args)
                     // For each blank argument, add the type of that argument
                     // to the resulting function type.
                     auto i = 0u;
-                    while (i < _vec::len[option::t[@ast::expr]](args)) {
+                    while (i < vec::len[option::t[@ast::expr]](args)) {
                         alt (args.(i)) {
                             case (some[@ast::expr](_)) { /* no-op */ }
                             case (none[@ast::expr]) {
@@ -2623,7 +2623,7 @@ fn check_call(&@fn_ctxt fcx, &@ast::expr f, &vec[@ast::expr] args)
             let vec[@ast::expr] args_1 = [];
 
             let ty::t t;
-            if (_vec::len[@ast::expr](args) == 0u) {
+            if (vec::len[@ast::expr](args) == 0u) {
                 t = next_ty_var(fcx.ccx);
             } else {
                 auto expr_1 = check_expr(fcx, args.(0));
@@ -2635,7 +2635,7 @@ fn check_call(&@fn_ctxt fcx, &@ast::expr f, &vec[@ast::expr] args)
                 auto expr_t = expr_ty(fcx.ccx.tcx, fcx.ccx.node_types,
                                       expr_1);
                 Demand::simple(fcx, expr.span, t, expr_t);
-                _vec::push[@ast::expr](args_1,expr_1);
+                vec::push[@ast::expr](args_1,expr_1);
             }
 
             auto typ = ty::mk_vec(fcx.ccx.tcx, rec(ty=t, mut=mut));
@@ -2653,7 +2653,7 @@ fn check_call(&@fn_ctxt fcx, &@ast::expr f, &vec[@ast::expr] args)
                 auto expr_1 = check_expr(fcx, e.expr);
                 auto expr_t = expr_ty(fcx.ccx.tcx, fcx.ccx.node_types,
                                       expr_1);
-                _vec::push[ast::elt](elts_1, rec(expr=expr_1 with e));
+                vec::push[ast::elt](elts_1, rec(expr=expr_1 with e));
                 elts_mt += [rec(ty=expr_t, mut=e.mut)];
             }
 
@@ -2681,10 +2681,10 @@ fn check_call(&@fn_ctxt fcx, &@ast::expr f, &vec[@ast::expr] args)
                 auto expr_1 = check_expr(fcx, f.expr);
                 auto expr_t = expr_ty(fcx.ccx.tcx, fcx.ccx.node_types,
                                       expr_1);
-                _vec::push[ast::field](fields_1, rec(expr=expr_1 with f));
+                vec::push[ast::field](fields_1, rec(expr=expr_1 with f));
 
                 auto expr_mt = rec(ty=expr_t, mut=f.mut);
-                _vec::push[field](fields_t, rec(ident=f.ident, mt=expr_mt));
+                vec::push[field](fields_t, rec(ident=f.ident, mt=expr_mt));
             }
 
             auto ann;
@@ -2721,7 +2721,7 @@ fn check_call(&@fn_ctxt fcx, &@ast::expr f, &vec[@ast::expr] args)
                     for (ty::field f in fields_t) {
                         auto found = false;
                         for (ty::field bf in base_fields) {
-                            if (_str::eq(f.ident, bf.ident)) {
+                            if (str::eq(f.ident, bf.ident)) {
                                 Demand::simple(fcx, expr.span, f.mt.ty,
                                               bf.mt.ty);
                                 found = true;
@@ -2749,7 +2749,7 @@ fn check_call(&@fn_ctxt fcx, &@ast::expr f, &vec[@ast::expr] args)
                 case (ty::ty_tup(?args)) {
                     let uint ix = ty::field_num(fcx.ccx.sess,
                                                expr.span, field);
-                    if (ix >= _vec::len[ty::mt](args)) {
+                    if (ix >= vec::len[ty::mt](args)) {
                         fcx.ccx.sess.span_err(expr.span,
                                               "bad index on tuple");
                     }
@@ -2765,7 +2765,7 @@ fn check_call(&@fn_ctxt fcx, &@ast::expr f, &vec[@ast::expr] args)
                 case (ty::ty_rec(?fields)) {
                     let uint ix = ty::field_idx(fcx.ccx.sess,
                                                expr.span, field, fields);
-                    if (ix >= _vec::len[typeck::field](fields)) {
+                    if (ix >= vec::len[typeck::field](fields)) {
                         fcx.ccx.sess.span_err(expr.span,
                                               "bad index on record");
                     }
@@ -2781,7 +2781,7 @@ fn check_call(&@fn_ctxt fcx, &@ast::expr f, &vec[@ast::expr] args)
                 case (ty::ty_obj(?methods)) {
                     let uint ix = ty::method_idx(fcx.ccx.sess,
                                                 expr.span, field, methods);
-                    if (ix >= _vec::len[typeck::method](methods)) {
+                    if (ix >= vec::len[typeck::method](methods)) {
                         fcx.ccx.sess.span_err(expr.span,
                                               "bad index on obj");
                     }
@@ -2998,7 +2998,7 @@ fn check_stmt(&@fn_ctxt fcx, &@ast::stmt stmt) -> @ast::stmt {
 fn check_block(&@fn_ctxt fcx, &ast::block block) -> ast::block {
     let vec[@ast::stmt] stmts = [];
     for (@ast::stmt s in block.node.stmts) {
-        _vec::push[@ast::stmt](stmts, check_stmt(fcx, s));
+        vec::push[@ast::stmt](stmts, check_stmt(fcx, s));
     }
 
     auto expr = none[@ast::expr];
@@ -3125,7 +3125,7 @@ fn hash_unify_cache_entry(&unify_cache_entry uce) -> uint {
     h += h << 5u + ty::hash_ty(uce._1);
 
     auto i = 0u;
-    auto tys_len = _vec::len(uce._2);
+    auto tys_len = vec::len(uce._2);
     while (i < tys_len) {
         h += h << 5u + ty::hash_ty(uce._2.(i));
         i += 1u;
@@ -3138,8 +3138,8 @@ fn eq_unify_cache_entry(&unify_cache_entry a, &unify_cache_entry b) -> bool {
     if (!ty::eq_ty(a._0, b._0) || !ty::eq_ty(a._1, b._1)) { ret false; }
 
     auto i = 0u;
-    auto tys_len = _vec::len(a._2);
-    if (_vec::len(b._2) != tys_len) { ret false; }
+    auto tys_len = vec::len(a._2);
+    if (vec::len(b._2) != tys_len) { ret false; }
 
     while (i < tys_len) {
         if (!ty::eq_ty(a._2.(i), b._2.(i))) { ret false; }
index 4e89863e43f3d3019ee7f6eb87865910050601a0..e7ecb4245b0f74dbf0feac5fc55a452b3d48d393 100644 (file)
 import std::io::stdout;
 import std::io::str_writer;
 import std::io::string_writer;
-import std::_vec::map;
-import std::_vec;
-import std::_vec::len;
-import std::_vec::pop;
-import std::_vec::push;
-import std::_vec::slice;
-import std::_vec::unzip;
-import std::_vec::plus_option;
-import std::_vec::cat_options;
+import std::vec::map;
+import std::vec;
+import std::vec::len;
+import std::vec::pop;
+import std::vec::push;
+import std::vec::slice;
+import std::vec::unzip;
+import std::vec::plus_option;
+import std::vec::cat_options;
 import std::option;
 import std::option::t;
 import std::option::some;
 import std::list::nil;
 import std::list::foldl;
 import std::list::find;
-import std::_uint;
+import std::uint;
 import std::bitv;
 import std::util::fst;
 import std::util::snd;
@@ -310,12 +310,12 @@ fn num_locals(fn_info m) -> uint {
 fn collect_local(&@vec[tup(ident, def_id)] vars, &span sp, &@ast::local loc)
     -> @decl {
     log("collect_local: pushing " + loc.ident);
-    _vec::push[tup(ident, def_id)](*vars, tup(loc.ident, loc.id));
+    vec::push[tup(ident, def_id)](*vars, tup(loc.ident, loc.id));
     ret @respan(sp, decl_local(loc));
 }
 
 fn find_locals(_fn f) -> @vec[tup(ident,def_id)] {
-  auto res = @_vec::alloc[tup(ident,def_id)](0u);
+  auto res = @vec::alloc[tup(ident,def_id)](0u);
 
   auto fld = fold::new_identity_fold[@vec[tup(ident, def_id)]]();
   fld = @rec(fold_decl_local = bind collect_local(_,_,_) with *fld);
@@ -341,7 +341,7 @@ fn mk_fn_info(_fn f) -> fn_info {
      just collect locally declared vars */
 
   let @vec[tup(ident,def_id)] locals = find_locals(f);
-  log(uistr(_vec::len[tup(ident, def_id)](*locals)) + " locals");
+  log(uistr(vec::len[tup(ident, def_id)](*locals)) + " locals");
   for (tup(ident,def_id) p in *locals) {
     next = add_var(p._1, p._0, next, res);
   }
@@ -363,7 +363,7 @@ fn mk_fn_info_item_fn(&fn_info_map fi, &span sp, &ident i, &ast::_fn f,
 fn mk_fn_info_item_obj(&fn_info_map fi, &span sp, &ident i, &ast::_obj o,
                        &vec[ast::ty_param] ty_params,
                        &ast::obj_def_ids odid, &ann a) -> @item {
-    auto all_methods = _vec::clone[@method](o.methods);
+    auto all_methods = vec::clone[@method](o.methods);
     plus_option[@method](all_methods, o.dtor);
     for (@method m in all_methods) {
         fi.insert(m.node.id, mk_fn_info(m.node.meth));
@@ -651,7 +651,7 @@ fn seq_preconds(fn_info enclosing, vec[pre_and_post] pps) -> precond {
 /* works on either postconds or preconds
  should probably rethink the whole type synonym situation */
 fn union_postconds_go(&postcond first, &vec[postcond] rest) -> postcond {
-  auto sz = _vec::len[postcond](rest);
+  auto sz = vec::len[postcond](rest);
 
   if (sz > 0u) {
     auto other = rest.(0);
@@ -673,7 +673,7 @@ fn union_postconds(uint nv, &vec[postcond] pcs) -> postcond {
 
 /* Gee, maybe we could use foldl or something */
 fn intersect_postconds_go(&postcond first, &vec[postcond] rest) -> postcond {
-  auto sz = _vec::len[postcond](rest);
+  auto sz = vec::len[postcond](rest);
 
   if (sz > 0u) {
     auto other = rest.(0);
@@ -719,7 +719,7 @@ fn do_a_method(def_map dm, fn_info_map fm, &@method m) -> () {
         find_pre_post_fn(dm, fm, fm.get(m.node.id), m.node.meth);
     }
     auto f = bind do_a_method(dm, fm, _);
-    _vec::map[@method, ()](f, o.methods);
+    vec::map[@method, ()](f, o.methods);
     option::map[@method, ()](f, o.dtor);
 }
 
@@ -729,8 +729,8 @@ fn do_a_method(def_map dm, fn_info_map fm, &@method m) -> bool {
         ret find_pre_post_state_fn(dm, fm, fm.get(m.node.id), m.node.meth);
     }
     auto f = bind do_a_method(dm, fm, _);
-    auto flags = _vec::map[@method, bool](f, o.methods);
-    auto changed = _vec::or(flags);
+    auto flags = vec::map[@method, bool](f, o.methods);
+    auto changed = vec::or(flags);
     changed = changed || maybe[@method, bool](false, f, o.dtor);
     ret changed;
 }
@@ -777,19 +777,19 @@ fn do_one(def_map dm, fn_info_map fm, fn_info enclosing,
     }
     auto f = bind do_one(dm, fm, enclosing, _);
 
-    _vec::map[@expr, ()](f, args);
+    vec::map[@expr, ()](f, args);
 
     fn get_pp(&@expr e) -> pre_and_post {
         ret expr_pp(e);
     }
     auto g = get_pp;
-    auto pps = _vec::map[@expr, pre_and_post](g, args);
+    auto pps = vec::map[@expr, pre_and_post](g, args);
     auto h = get_post;
 
     set_pre_and_post(a,
        rec(precondition=seq_preconds(enclosing, pps),
            postcondition=union_postconds
-           (nv, (_vec::map[pre_and_post, postcond](h, pps)))));
+           (nv, (vec::map[pre_and_post, postcond](h, pps)))));
 }
 
 fn find_pre_post_loop(&def_map dm, &fn_info_map fm, &fn_info enclosing,
@@ -816,13 +816,13 @@ fn find_pre_post_expr(&def_map dm, &fn_info_map fm, &fn_info enclosing,
     
     alt (e.node) {
         case (expr_call(?operator, ?operands, ?a)) {
-            auto args = _vec::clone[@expr](operands);
-            _vec::push[@expr](args, operator);
+            auto args = vec::clone[@expr](operands);
+            vec::push[@expr](args, operator);
             find_pre_post_exprs(dm, fm, enclosing, args, a);
         }
         case (expr_spawn(_, _, ?operator, ?operands, ?a)) {
-            auto args = _vec::clone[@expr](operands);
-            _vec::push[@expr](args, operator);
+            auto args = vec::clone[@expr](operands);
+            vec::push[@expr](args, operator);
             find_pre_post_exprs(dm, fm, enclosing, args, a);
         }
         case (expr_vec(?args, _, ?a)) {
@@ -875,7 +875,7 @@ fn find_pre_post_expr(&def_map dm, &fn_info_map fm, &fn_info enclosing,
         }
         case (expr_rec(?fields,?maybe_base,?a)) {
             auto es = field_exprs(fields);
-            _vec::plus_option[@expr](es, maybe_base);
+            vec::plus_option[@expr](es, maybe_base);
             find_pre_post_exprs(dm, fm, enclosing, es, a);
         }
         case (expr_assign(?lhs, ?rhs, ?a)) {
@@ -1048,7 +1048,7 @@ fn do_an_alt(def_map dm, fn_info_map fm, fn_info enc, &arm an_alt)
                 ret block_pp(an_alt.block);
             }
             auto f = bind do_an_alt(dm, fm, enclosing, _);
-            auto alt_pps = _vec::map[arm, pre_and_post](f, alts);
+            auto alt_pps = vec::map[arm, pre_and_post](f, alts);
             fn combine_pp(pre_and_post antec, 
                           fn_info enclosing, &pre_and_post pp,
                           &pre_and_post next) -> pre_and_post {
@@ -1062,7 +1062,7 @@ fn combine_pp(pre_and_post antec,
                              postcondition=false_postcond(num_local_vars));
             auto g = bind combine_pp(antec_pp, enclosing, _, _);
 
-            auto alts_overall_pp = _vec::foldl[pre_and_post, pre_and_post]
+            auto alts_overall_pp = vec::foldl[pre_and_post, pre_and_post]
                                     (g, e_pp, alt_pps);
 
             set_pre_and_post(a, alts_overall_pp);
@@ -1088,8 +1088,8 @@ fn combine_pp(pre_and_post antec,
             set_pre_and_post(a, expr_pp(p));
         }
         case(expr_bind(?operator, ?maybe_args, ?a)) {
-            auto args = _vec::cat_options[@expr](maybe_args);
-            _vec::push[@expr](args, operator); /* ??? order of eval? */
+            auto args = vec::cat_options[@expr](maybe_args);
+            vec::push[@expr](args, operator); /* ??? order of eval? */
             find_pre_post_exprs(dm, fm, enclosing, args, a);
         }
         case (expr_break(?a)) {
@@ -1207,7 +1207,7 @@ fn do_one_(def_map dm, fn_info_map fm, fn_info i, &@stmt s) -> () {
     }
     auto do_one = bind do_one_(dm, fm, enclosing, _);
     
-    _vec::map[@stmt, ()](do_one, b.node.stmts);
+    vec::map[@stmt, ()](do_one, b.node.stmts);
     fn do_inner_(def_map dm, fn_info_map fm, fn_info i, &@expr e) -> () {
         find_pre_post_expr(dm, fm, i, e);
     }
@@ -1220,7 +1220,7 @@ fn get_pp_stmt(&@stmt s) -> pre_and_post {
         ret stmt_pp(*s);
     }
     auto f = get_pp_stmt;
-    pps += _vec::map[@stmt, pre_and_post](f, b.node.stmts);
+    pps += vec::map[@stmt, pre_and_post](f, b.node.stmts);
     fn get_pp_expr(&@expr e) -> pre_and_post {
         ret expr_pp(e);
     }
@@ -1230,10 +1230,10 @@ fn get_pp_expr(&@expr e) -> pre_and_post {
 
     auto block_precond  = seq_preconds(enclosing, pps);
     auto h = get_post;
-    auto postconds =  _vec::map[pre_and_post, postcond](h, pps);
+    auto postconds =  vec::map[pre_and_post, postcond](h, pps);
     /* A block may be empty, so this next line ensures that the postconds
        vector is non-empty. */
-    _vec::push[postcond](postconds, block_precond);
+    vec::push[postcond](postconds, block_precond);
     auto block_postcond = empty_poststate(nv);
     /* conservative approximation */
     if (! has_nonlocal_exits(b)) {
@@ -1708,7 +1708,7 @@ fn find_pre_post_state_expr(&def_map dm, &fn_info_map fm, &fn_info enclosing,
                   || changed;
         auto e_post = expr_poststate(e);
         auto a_post;
-        if (_vec::len[arm](alts) > 0u) {
+        if (vec::len[arm](alts) > 0u) {
             a_post = false_postcond(num_local_vars);
             for (arm an_alt in alts) {
                 changed = find_pre_post_state_block(dm, fm, enclosing, e_post,
@@ -1987,7 +1987,7 @@ fn do_one_(fn_info i, &@stmt s) -> () {
   }
   auto do_one = bind do_one_(enclosing, _);
  
-  _vec::map[@stmt, ()](do_one, f.body.node.stmts);
+  vec::map[@stmt, ()](do_one, f.body.node.stmts);
   fn do_inner_(fn_info i, &@expr e) -> () {
     check_states_expr(i, e);
   }
@@ -2034,7 +2034,7 @@ fn one(def_map dm, fn_info_map fm, &@method m) -> () {
         ret check_method_states(dm, fm, m);
     }
     auto f = bind one(dm, f_info_map,_);
-    _vec::map[@method, ()](f, methods);
+    vec::map[@method, ()](f, methods);
     option::map[@method, ()](f, dtor);
     ret rec(fields=fields, methods=methods, dtor=dtor);
 }
@@ -2125,7 +2125,7 @@ fn one(fn_info_map fm, &@expr e) -> @expr {
         ret annotate_expr(fm, e);
     }
     auto f = bind one(fm,_);
-    ret _vec::map[@expr, @expr](f, es);
+    ret vec::map[@expr, @expr](f, es);
 }
 fn annotate_elts(&fn_info_map fm, &vec[elt] es) -> vec[elt] {
     fn one(fn_info_map fm, &elt e) -> elt {
@@ -2133,7 +2133,7 @@ fn one(fn_info_map fm, &elt e) -> elt {
                 expr=annotate_expr(fm, e.expr));
     }
     auto f = bind one(fm,_);
-    ret _vec::map[elt, elt](f, es);
+    ret vec::map[elt, elt](f, es);
 }
 fn annotate_fields(&fn_info_map fm, &vec[field] fs) -> vec[field] {
     fn one(fn_info_map fm, &field f) -> field {
@@ -2142,7 +2142,7 @@ fn one(fn_info_map fm, &field f) -> field {
                  expr=annotate_expr(fm, f.expr));
     }
     auto f = bind one(fm,_);
-    ret _vec::map[field, field](f, fs);
+    ret vec::map[field, field](f, fs);
 }
 fn annotate_option_exp(&fn_info_map fm, &option::t[@expr] o)
   -> option::t[@expr] {
@@ -2158,7 +2158,7 @@ fn one(fn_info_map fm, &option::t[@expr] o) -> option::t[@expr] {
         ret annotate_option_exp(fm, o);
     }
     auto f = bind one(fm,_);
-    ret _vec::map[option::t[@expr], option::t[@expr]](f, es);
+    ret vec::map[option::t[@expr], option::t[@expr]](f, es);
 }
 fn annotate_decl(&fn_info_map fm, &@decl d) -> @decl {
     auto d1 = d.node;
@@ -2188,7 +2188,7 @@ fn one(fn_info_map fm, &arm a) -> arm {
                  block=annotate_block(fm, a.block));
     }
     auto f = bind one(fm,_);
-    ret _vec::map[arm, arm](f, alts);
+    ret vec::map[arm, arm](f, alts);
 
 }
 fn annotate_expr(&fn_info_map fm, &@expr e) -> @expr {
@@ -2339,7 +2339,7 @@ fn annotate_block(&fn_info_map fm, &block b) -> block {
 
     for (@stmt s in b.node.stmts) {
         auto new_s = annotate_stmt(fm, s);
-        _vec::push[@stmt](new_stmts, new_s);
+        vec::push[@stmt](new_stmts, new_s);
     }
     fn ann_e(fn_info_map fm, &@expr e) -> @expr {
         ret annotate_expr(fm, e);
@@ -2361,7 +2361,7 @@ fn annotate_mod(&fn_info_map fm, &ast::_mod m) -> ast::_mod {
 
     for (@item i in m.items) {
         auto new_i = annotate_item(fm, i);
-        _vec::push[@item](new_items, new_i);
+        vec::push[@item](new_items, new_i);
     }
     ret rec(items=new_items with m);
 }
@@ -2381,7 +2381,7 @@ fn one(fn_info_map fm, &@method m) -> @method {
         ret annotate_method(fm, m);
     }
     auto f = bind one(fm,_);
-    auto new_methods = _vec::map[@method, @method](f, o.methods);
+    auto new_methods = vec::map[@method, @method](f, o.methods);
     auto new_dtor    = option::map[@method, @method](f, o.dtor);
     ret rec(methods=new_methods, dtor=new_dtor with o);
 }
@@ -2474,7 +2474,7 @@ fn annotate_module(&fn_info_map fm, &ast::_mod module) -> ast::_mod {
 
     for (@item i in module.items) {
         auto new_item = annotate_item(fm, i);
-        _vec::push[@item](new_items, new_item);
+        vec::push[@item](new_items, new_item);
     }
 
     ret rec(items = new_items with module);
index 28ea69c8b9d451ae710308717c81713a281dd95d..11c18edd88a3a65d68a26228118744687f932bb3 100644 (file)
@@ -1,6 +1,6 @@
 import std::io;
-import std::_vec;
-import std::_str;
+import std::vec;
+import std::str;
 
 tag boxtype {box_h; box_v; box_hv; box_align;}
 tag contexttype {cx_h; cx_v;}
@@ -57,12 +57,12 @@ fn write_spaces(ps p, uint i) {
 
 fn push_context(ps p, contexttype tp, uint indent) {
   before_print(p, false);
-  _vec::push[context](p.context, rec(tp=tp, indent=indent));
+  vec::push[context](p.context, rec(tp=tp, indent=indent));
   p.start_of_box = true;
 }
 
 fn pop_context(ps p) {
-  _vec::pop[context](p.context);
+  vec::pop[context](p.context);
 }
 
 fn add_token(ps p, token tok) {
@@ -89,7 +89,7 @@ fn buffer_token(ps p, token tok) {
   } else {
     alt (tok) {
       case (open(?tp,_)) {
-        _vec::push[boxtype](p.scandepth, tp);
+        vec::push[boxtype](p.scandepth, tp);
         if (p.scanning == scan_h) {
           if (tp == box_h) {
             check_potential_brk(p);
@@ -97,14 +97,14 @@ fn buffer_token(ps p, token tok) {
         }
       }
       case (close) {
-        _vec::pop[boxtype](p.scandepth);
-        if (_vec::len[boxtype](p.scandepth) == 0u) {
+        vec::pop[boxtype](p.scandepth);
+        if (vec::len[boxtype](p.scandepth) == 0u) {
           finish_scan(p, true);
         }
       }
       case (brk(_)) {
         if (p.scanning == scan_h) {
-          if (p.scandepth.(_vec::len[boxtype](p.scandepth)-1u) == box_v) {
+          if (p.scandepth.(vec::len[boxtype](p.scandepth)-1u) == box_v) {
             finish_scan(p, true);
           }
         }
@@ -123,7 +123,7 @@ fn check_potential_brk(ps p) {
 
 fn finish_scan(ps p, bool fits) {
   auto buf = p.buffered;
-  auto front = _vec::shift[token](buf);
+  auto front = vec::shift[token](buf);
   auto chosen_tp = cx_h;
   if (!fits) {chosen_tp = cx_v;}
   alt (front) {
@@ -154,10 +154,10 @@ fn start_scan(ps p, token tok, scantype tp) {
 }
 
 fn cur_context(ps p) -> context {
-  ret p.context.(_vec::len[context](p.context)-1u);
+  ret p.context.(vec::len[context](p.context)-1u);
 }
 fn base_indent(ps p) -> uint {
-  auto i = _vec::len[context](p.context);
+  auto i = vec::len[context](p.context);
   while (i > 0u) {
     i -= 1u;
     auto cx = p.context.(i);
@@ -191,7 +191,7 @@ fn do_token(ps p, token tok) {
       line_break(p);
     }
     case (word(?w)) {
-      auto len = _str::char_len(w);
+      auto len = str::char_len(w);
       if (len + p.col + p.spaces > p.width && !start_of_box &&
           !p.start_of_line) {
         line_break(p);
@@ -203,7 +203,7 @@ fn do_token(ps p, token tok) {
     case (cword(?w)) {
       before_print(p, true);
       p.out.write_str(w);
-      p.col += _str::char_len(w);
+      p.col += str::char_len(w);
     }
     case (open(?tp, ?indent)) {
       if (tp == box_v) {
@@ -248,8 +248,8 @@ fn token_size(token tok) -> uint {
   alt (tok) {
     case (brk(?sz)) {ret sz;}
     case (hardbrk) {ret 0xFFFFFFu;}
-    case (word(?w)) {ret _str::char_len(w);}
-    case (cword(?w)) {ret _str::char_len(w);}
+    case (word(?w)) {ret str::char_len(w);}
+    case (cword(?w)) {ret str::char_len(w);}
     case (open(_, _)) {ret 0u;}
     case (close) {ret 0u;}
   }
index 31264bab1bca282e8deeaaf769aaa0f3c4c6375d..db09f2785329a86f107827921709d964266fc2b3 100644 (file)
@@ -1,5 +1,5 @@
-import std::_vec;
-import std::_str;
+import std::vec;
+import std::str;
 import std::io;
 import std::option;
 import driver::session::session;
@@ -92,7 +92,7 @@ fn commasep[IN](ps s, vec[IN] elts, fn(ps, &IN) op) {
 }
 fn commasep_cmnt[IN](ps s, vec[IN] elts, fn(ps, &IN) op,
                             fn(&IN) -> common::span get_span) {
-    auto len = _vec::len[IN](elts);
+    auto len = vec::len[IN](elts);
     auto i = 0u;
     for (IN elt in elts) {
         op(s, elt);
@@ -162,7 +162,7 @@ fn print_field(ps s, &ast::ty_field f) {
             fn get_span(&ast::ty_field f) -> common::span {
               // Try to reconstruct the span for this field
               auto sp = f.mt.ty.span;
-              auto hi = sp.hi + _str::char_len(f.ident) + 1u;
+              auto hi = sp.hi + str::char_len(f.ident) + 1u;
               ret rec(hi=hi with sp);
             }
             auto f = print_field;
@@ -272,7 +272,7 @@ fn print_item(ps s, @ast::item item) {
             for (ast::variant v in variants) {
                 maybe_print_comment(s, v.span.lo);
                 wrd(s.s, v.node.name);
-                if (_vec::len[ast::variant_arg](v.node.args) > 0u) {
+                if (vec::len[ast::variant_arg](v.node.args) > 0u) {
                     popen(s);
                     fn print_variant_arg(ps s, &ast::variant_arg arg) {
                         print_type(s, arg.ty);
@@ -360,7 +360,7 @@ fn print_literal(ps s, @ast::lit lit) {
     alt (lit.node) {
         case (ast::lit_str(?st)) {print_string(s, st);}
         case (ast::lit_char(?ch)) {
-            wrd(s.s, "'" + escape_str(_str::from_bytes([ch as u8]), '\'')
+            wrd(s.s, "'" + escape_str(str::from_bytes([ch as u8]), '\'')
                 + "'");
         }
         case (ast::lit_int(?val)) {
@@ -436,7 +436,7 @@ fn get_span(&ast::field field) -> common::span {
             commasep_cmnt[ast::field](s, fields, f, gs);
             alt (wth) {
                 case (option::some[@ast::expr](?expr)) {
-                    if (_vec::len[ast::field](fields) > 0u) {space(s.s);}
+                    if (vec::len[ast::field](fields) > 0u) {space(s.s);}
                     hbox(s);
                     wrd1(s, "with");
                     print_expr(s, expr);
@@ -673,7 +673,7 @@ fn print_opt(ps s, &option::t[@ast::expr] expr) {
         case (ast::expr_ext(?path, ?args, ?body, _, _)) {
             wrd(s.s, "#");
             print_path(s, path);
-            if (_vec::len[@ast::expr](args) > 0u) {
+            if (vec::len[@ast::expr](args) > 0u) {
                 popen(s);
                 commasep_exprs(s, args);
                 pclose(s);
@@ -761,7 +761,7 @@ fn print_path(ps s, ast::path path) {
         else {wrd(s.s, "::");}
         wrd(s.s, id);
     }
-    if (_vec::len[@ast::ty](path.node.types) > 0u) {
+    if (vec::len[@ast::ty](path.node.types) > 0u) {
         wrd(s.s, "[");
         auto f = print_type;
         commasep[@ast::ty](s, path.node.types, f);
@@ -777,7 +777,7 @@ fn print_pat(ps s, &@ast::pat pat) {
         case (ast::pat_lit(?lit,_)) {print_literal(s, lit);}
         case (ast::pat_tag(?path,?args,_)) {
             print_path(s, path);
-            if (_vec::len[@ast::pat](args) > 0u) {
+            if (vec::len[@ast::pat](args) > 0u) {
                 popen_h(s);
                 auto f = print_pat;
                 commasep[@ast::pat](s, args, f);
@@ -822,7 +822,7 @@ fn print_arg(ps s, &ast::arg x) {
 }
 
 fn print_type_params(ps s, vec[ast::ty_param] params) {
-    if (_vec::len[ast::ty_param](params) > 0u) {
+    if (vec::len[ast::ty_param](params) > 0u) {
         wrd(s.s, "[");
         fn printParam(ps s, &ast::ty_param param) {
             wrd(s.s, param);
@@ -840,7 +840,7 @@ fn print_view_item(ps s, @ast::view_item item) {
         case (ast::view_item_use(?id,?mta,_,_)) {
             wrd1(s, "use");
             wrd(s.s, id);
-            if (_vec::len[@ast::meta_item](mta) > 0u) {
+            if (vec::len[@ast::meta_item](mta) > 0u) {
                 popen(s);
                 fn print_meta(ps s, &@ast::meta_item item) {
                     hbox(s);
@@ -856,7 +856,7 @@ fn print_meta(ps s, &@ast::meta_item item) {
         }
         case (ast::view_item_import(?id,?ids,_)) {
             wrd1(s, "import");
-            if (!_str::eq(id, ids.(_vec::len[str](ids)-1u))) {
+            if (!str::eq(id, ids.(vec::len[str](ids)-1u))) {
                 wrd1(s, id);
                 wrd1(s, "=");
             }
@@ -906,7 +906,7 @@ fn print_maybe_parens(ps s, @ast::expr expr, int outer_prec) {
 
 fn escape_str(str st, char to_escape) -> str {
     let str out = "";
-    auto len = _str::byte_len(st);
+    auto len = str::byte_len(st);
     auto i = 0u;
     while (i < len) {
         alt (st.(i) as char) {
@@ -916,7 +916,7 @@ fn escape_str(str st, char to_escape) -> str {
             case ('\\') {out += "\\\\";}
             case (?cur) {
                 if (cur == to_escape) {out += "\\";}
-                _str::push_byte(out, cur as u8);
+                str::push_byte(out, cur as u8);
             }
         }
         i += 1u;
@@ -966,7 +966,7 @@ fn print_arg(ps s, &ast::ty_arg input) {
 fn next_comment(ps s) -> option::t[lexer::cmnt] {
     alt (s.comments) {
         case (option::some[vec[lexer::cmnt]](?cmnts)) {
-            if (s.cur_cmnt < _vec::len[lexer::cmnt](cmnts)) {
+            if (s.cur_cmnt < vec::len[lexer::cmnt](cmnts)) {
                 ret option::some[lexer::cmnt](cmnts.(s.cur_cmnt));
             } else {ret option::none[lexer::cmnt];}
         }
index 602b1458cf961f4dc5840dfe19594c96043214be..206862c5f9b46d23a8f29eec82410424413d5313 100644 (file)
@@ -1,8 +1,8 @@
 import std::map;
 import std::map::hashmap;
-import std::_uint;
-import std::_int;
-import std::_vec;
+import std::uint;
+import std::int;
+import std::vec;
 import std::option::none;
 import front::ast;
 import front::ast::ty;
@@ -60,8 +60,8 @@ fn ty_mach_to_str(ty_mach tm) -> str {
 }
 
 fn new_str_hash[V]() -> std::map::hashmap[str,V] {
-    let std::map::hashfn[str] hasher = std::_str::hash;
-    let std::map::eqfn[str] eqer = std::_str::eq;
+    let std::map::hashfn[str] hasher = std::str::hash;
+    let std::map::eqfn[str] eqer = std::str::eq;
     ret std::map::mk_hashmap[str,V](hasher, eqer);
 }
 
@@ -99,25 +99,25 @@ fn new_uint_hash[V]() -> std::map::hashmap[uint,V] {
 }
 
 fn istr(int i) -> str {
-    ret _int::to_str(i, 10u);
+    ret int::to_str(i, 10u);
 }
 
 fn uistr(uint i) -> str {
-    ret _uint::to_str(i, 10u);
+    ret uint::to_str(i, 10u);
 }
 
 fn elt_expr(&ast::elt e) -> @ast::expr { ret e.expr; }
 
 fn elt_exprs(&vec[ast::elt] elts) -> vec[@ast::expr] {
     auto f = elt_expr;
-    ret _vec::map[ast::elt, @ast::expr](f, elts);
+    ret vec::map[ast::elt, @ast::expr](f, elts);
 }
 
 fn field_expr(&ast::field f) -> @ast::expr { ret f.expr; }
 
 fn field_exprs(vec[ast::field] fields) -> vec [@ast::expr] {
     auto f = field_expr;
-    ret _vec::map[ast::field, @ast::expr](f, fields);
+    ret vec::map[ast::field, @ast::expr](f, fields);
 }
 
 fn expr_to_str(&@ast::expr e) -> str {
index 59426664b4a673e3f3edce94ce4dd8a96206c788..60d6b3102f0eb5e40b4c03e0915c2fc1719d3984 100644 (file)
@@ -2,7 +2,7 @@
 // allows bidirectional lookup; i.e. given a value, one can easily find the
 // type, and vice versa.
 
-import std::_vec;
+import std::vec;
 import std::map;
 import std::map::hashmap;
 import std::map::hashfn;
@@ -28,7 +28,7 @@ fn intern[T](&interner[T] itr, &T val) -> uint {
     alt (itr.map.find(val)) {
         case (some[uint](?idx)) { ret idx; }
         case (none[uint]) {
-            auto new_idx = _vec::len[T](itr.vect);
+            auto new_idx = vec::len[T](itr.vect);
             itr.map.insert(val, new_idx);
             itr.vect += [val];
             ret new_idx;
diff --git a/src/lib/_int.rs b/src/lib/_int.rs
deleted file mode 100644 (file)
index 321602e..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-
-fn add(int x, int y) -> int { ret x + y; }
-fn sub(int x, int y) -> int { ret x - y; }
-fn mul(int x, int y) -> int { ret x * y; }
-fn div(int x, int y) -> int { ret x / y; }
-fn rem(int x, int y) -> int { ret x % y; }
-
-fn lt(int x, int y) -> bool { ret x < y; }
-fn le(int x, int y) -> bool { ret x <= y; }
-fn eq(int x, int y) -> bool { ret x == y; }
-fn ne(int x, int y) -> bool { ret x != y; }
-fn ge(int x, int y) -> bool { ret x >= y; }
-fn gt(int x, int y) -> bool { ret x > y; }
-
-fn positive(int x) -> bool { ret x > 0; }
-fn negative(int x) -> bool { ret x < 0; }
-fn nonpositive(int x) -> bool { ret x <= 0; }
-fn nonnegative(int x) -> bool { ret x >= 0; }
-
-iter range(int lo, int hi) -> int {
-    let int lo_ = lo;
-    while (lo_ < hi) {
-        put lo_;
-        lo_ += 1;
-    }
-}
-
-fn to_str(int n, uint radix) -> str
-{
-    assert (0u < radix && radix <= 16u);
-    if (n < 0) {
-        ret "-" + _uint::to_str((-n) as uint, radix);
-    } else {
-        ret _uint::to_str(n as uint, radix);
-    }
-}
-
-fn pow(int base, uint exponent) -> int {
-
-    if (exponent == 0u) {
-        ret 1;
-    } else if (base == 0) {
-        ret 0;
-    } else {
-        auto accum = base;
-        auto count = exponent;
-        while (count > 1u) {
-            accum *= base;
-            count -= 1u;
-        }
-        ret accum;
-    }
-}
-
-// Local Variables:
-// mode: rust;
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
-// End:
diff --git a/src/lib/_str.rs b/src/lib/_str.rs
deleted file mode 100644 (file)
index 1ab1b01..0000000
+++ /dev/null
@@ -1,490 +0,0 @@
-import rustrt::sbuf;
-
-import _vec::rustrt::vbuf;
-
-native "rust" mod rustrt {
-    type sbuf;
-    fn str_buf(str s) -> sbuf;
-    fn str_vec(str s) -> vec[u8];
-    fn str_byte_len(str s) -> uint;
-    fn str_alloc(uint n_bytes) -> str;
-    fn str_from_vec(vec[mutable? u8] b) -> str;
-    fn str_from_cstr(sbuf cstr) -> str;
-    fn str_from_buf(sbuf buf, uint len) -> str;
-    fn str_push_byte(str s, uint byte) -> str;
-    fn str_slice(str s, uint begin, uint end) -> str;
-    fn refcount[T](str s) -> uint;
-}
-
-fn eq(&str a, &str b) -> bool {
-    let uint i = byte_len(a);
-    if (byte_len(b) != i) {
-        ret false;
-    }
-    while (i > 0u) {
-        i -= 1u;
-        auto cha = a.(i);
-        auto chb = b.(i);
-        if (cha != chb) {
-            ret false;
-        }
-    }
-    ret true;
-}
-
-fn lteq(&str a, &str b) -> bool {
-    let uint i = byte_len(a);
-    let uint j = byte_len(b);
-    let uint n = i;
-    if (j < n) {
-        n = j;
-    }
-
-    let uint x = 0u;
-    while (x < n) {
-        auto cha = a.(x);
-        auto chb = b.(x);
-        if (cha < chb) {
-            ret true;
-        }
-        else if (cha > chb) {
-            ret false;
-        }
-        x += 1u;
-    }
-
-    ret i <= j;
-}
-
-
-fn hash(&str s) -> uint {
-    // djb hash.
-    // FIXME: replace with murmur.
-    let uint u = 5381u;
-    for (u8 c in s) {
-        u *= 33u;
-        u += (c as uint);
-    }
-    ret u;
-}
-
-// UTF-8 tags and ranges
-const u8 tag_cont_u8 = 0x80_u8;
-const uint tag_cont = 0x80_u;
-const uint max_one_b = 0x80_u;
-const uint tag_two_b = 0xc0_u;
-const uint max_two_b = 0x800_u;
-const uint tag_three_b = 0xe0_u;
-const uint max_three_b = 0x10000_u;
-const uint tag_four_b = 0xf0_u;
-const uint max_four_b = 0x200000_u;
-const uint tag_five_b = 0xf8_u;
-const uint max_five_b = 0x4000000_u;
-const uint tag_six_b = 0xfc_u;
-
-fn is_utf8(vec[u8] v) -> bool {
-    auto i = 0u;
-    auto total = _vec::len[u8](v);
-    while (i < total) {
-        auto chsize = utf8_char_width(v.(i));
-        if (chsize == 0u) {ret false;}
-        if (i + chsize > total) {ret false;}
-        i += 1u;
-        while (chsize > 1u) {
-            if (v.(i) & 0xc0_u8 != tag_cont_u8) {ret false;}
-            i += 1u;
-            chsize -= 1u;
-        }
-    }
-    ret true;
-}
-
-fn is_ascii(str s) -> bool {
-    let uint i = byte_len(s);
-    while (i > 0u) {
-        i -= 1u;
-        if ((s.(i) & 0x80_u8) != 0u8) {
-            ret false;
-        }
-    }
-    ret true;
-}
-
-fn alloc(uint n_bytes) -> str {
-    ret rustrt::str_alloc(n_bytes);
-}
-
-// Returns the number of bytes (a.k.a. UTF-8 code units) in s.
-// Contrast with a function that would return the number of code
-// points (char's), combining character sequences, words, etc.  See
-// http://icu-project.org/apiref/icu4c/classBreakIterator.html for a
-// way to implement those.
-fn byte_len(str s) -> uint {
-    ret rustrt::str_byte_len(s);
-}
-
-fn buf(str s) -> sbuf {
-    ret rustrt::str_buf(s);
-}
-
-fn bytes(str s) -> vec[u8] {
-    ret rustrt::str_vec(s);
-}
-
-fn from_bytes(vec[u8] v) : is_utf8(v) -> str {
-    ret rustrt::str_from_vec(v);
-}
-
-// FIXME temp thing
-fn unsafe_from_bytes(vec[mutable? u8] v) -> str {
-    ret rustrt::str_from_vec(v);
-}
-
-fn unsafe_from_byte(u8 u) -> str {
-    ret rustrt::str_from_vec([u]);
-}
-
-fn str_from_cstr(sbuf cstr) -> str {
-    ret rustrt::str_from_cstr(cstr);
-}
-
-fn str_from_buf(sbuf buf, uint len) -> str {
-    ret rustrt::str_from_buf(buf, len);
-}
-
-fn push_utf8_bytes(&mutable str s, char ch) {
-    auto code = ch as uint;
-    if (code < max_one_b) {
-        s = rustrt::str_push_byte(s, code);
-    } else if (code < max_two_b) {
-        s = rustrt::str_push_byte(s, ((code >> 6u) & 0x1f_u) | tag_two_b);
-        s = rustrt::str_push_byte(s, (code & 0x3f_u) | tag_cont);
-    } else if (code < max_three_b) {
-        s = rustrt::str_push_byte(s, ((code >> 12u) & 0x0f_u) | tag_three_b);
-        s = rustrt::str_push_byte(s, ((code >> 6u) & 0x3f_u) | tag_cont);
-        s = rustrt::str_push_byte(s, (code & 0x3f_u) | tag_cont);
-    } else if (code < max_four_b) {
-        s = rustrt::str_push_byte(s, ((code >> 18u) & 0x07_u) | tag_four_b);
-        s = rustrt::str_push_byte(s, ((code >> 12u) & 0x3f_u) | tag_cont);
-        s = rustrt::str_push_byte(s, ((code >> 6u) & 0x3f_u) | tag_cont);
-        s = rustrt::str_push_byte(s, (code & 0x3f_u) | tag_cont);
-    } else if (code < max_five_b) {
-        s = rustrt::str_push_byte(s, ((code >> 24u) & 0x03_u) | tag_five_b);
-        s = rustrt::str_push_byte(s, ((code >> 18u) & 0x3f_u) | tag_cont);
-        s = rustrt::str_push_byte(s, ((code >> 12u) & 0x3f_u) | tag_cont);
-        s = rustrt::str_push_byte(s, ((code >> 6u) & 0x3f_u) | tag_cont);
-        s = rustrt::str_push_byte(s, (code & 0x3f_u) | tag_cont);
-    } else {
-        s = rustrt::str_push_byte(s, ((code >> 30u) & 0x01_u) | tag_six_b);
-        s = rustrt::str_push_byte(s, ((code >> 24u) & 0x3f_u) | tag_cont);
-        s = rustrt::str_push_byte(s, ((code >> 18u) & 0x3f_u) | tag_cont);
-        s = rustrt::str_push_byte(s, ((code >> 12u) & 0x3f_u) | tag_cont);
-        s = rustrt::str_push_byte(s, ((code >> 6u) & 0x3f_u) | tag_cont);
-        s = rustrt::str_push_byte(s, (code & 0x3f_u) | tag_cont);
-    }
-}
-
-fn from_char(char ch) -> str {
-    auto buf = "";
-    push_utf8_bytes(buf, ch);
-    ret buf;
-}
-
-fn from_chars(vec[char] chs) -> str {
-    auto buf = "";
-    for (char ch in chs) {push_utf8_bytes(buf, ch);}
-    ret buf;
-}
-
-fn utf8_char_width(u8 b) -> uint {
-    let uint byte = b as uint;
-    if (byte < 0x80_u) {ret 1u;}
-    if (byte < 0xc0_u) {ret 0u;} // Not a valid start byte
-    if (byte < 0xe0_u) {ret 2u;}
-    if (byte < 0xf0_u) {ret 3u;}
-    if (byte < 0xf8_u) {ret 4u;}
-    if (byte < 0xfc_u) {ret 5u;}
-    ret 6u;
-}
-
-fn char_range_at(str s, uint i) -> tup(char, uint) {
-    auto b0 = s.(i);
-    auto w = utf8_char_width(b0);
-    assert (w != 0u);
-    if (w == 1u) {ret tup(b0 as char, i + 1u);}
-    auto val = 0u;
-    auto end = i + w;
-    i += 1u;
-    while (i < end) {
-        auto byte = s.(i);
-        assert (byte & 0xc0_u8 == tag_cont_u8);
-        val <<= 6u;
-        val += (byte & 0x3f_u8) as uint;
-        i += 1u;
-    }
-    // Clunky way to get the right bits from the first byte. Uses two shifts,
-    // the first to clip off the marker bits at the left of the byte, and then
-    // a second (as uint) to get it to the right position.
-    val += ((b0 << ((w + 1u) as u8)) as uint) << ((w - 1u) * 6u - w - 1u);
-    ret tup(val as char, i);
-}
-
-fn char_at(str s, uint i) -> char {
-    ret char_range_at(s, i)._0;
-}
-
-fn char_len(str s) -> uint {
-    auto i = 0u;
-    auto len = 0u;
-    auto total = byte_len(s);
-    while (i < total) {
-        auto chsize = utf8_char_width(s.(i));
-        assert (chsize > 0u);
-        len += 1u;
-        i += chsize;
-    }
-    assert (i == total);
-    ret len;
-}
-
-fn to_chars(str s) -> vec[char] {
-    let vec[char] buf = [];
-    auto i = 0u;
-    auto len = byte_len(s);
-    while (i < len) {
-        auto cur = char_range_at(s, i);
-        _vec::push[char](buf, cur._0);
-        i = cur._1;
-    }
-    ret buf;
-}
-
-fn push_char(&mutable str s, char ch) {
-    s += from_char(ch);
-}
-
-fn pop_char(&mutable str s) -> char {
-    auto end = byte_len(s);
-    while (end > 0u && s.(end - 1u) & 0xc0_u8 == tag_cont_u8) {end -= 1u;}
-    assert (end > 0u);
-    auto ch = char_at(s, end - 1u);
-    s = substr(s, 0u, end - 1u);
-    ret ch;
-}
-
-fn shift_char(&mutable str s) -> char {
-    auto r = char_range_at(s, 0u);
-    s = substr(s, r._1, byte_len(s) - r._1);
-    ret r._0;
-}
-
-fn unshift_char(&mutable str s, char ch) {
-    // Workaround for rustboot order-of-evaluation issue -- if I put s
-    // directly after the +, the string ends up containing (only) the
-    // character, twice.
-    auto x = s;
-    s = from_char(ch) + x;
-}
-
-fn refcount(str s) -> uint {
-    auto r = rustrt::refcount[u8](s);
-    if (r == dbg::const_refcount) {
-        ret r;
-    } else {
-        // -1 because calling this function incremented the refcount.
-        ret  r - 1u;
-    }
-}
-
-
-// Standard bits from the world of string libraries.
-
-fn index(str s, u8 c) -> int {
-    let int i = 0;
-    for (u8 k in s) {
-        if (k == c) {
-            ret i;
-        }
-        i += 1;
-    }
-    ret -1;
-}
-
-fn rindex(str s, u8 c) -> int {
-    let int n = _str::byte_len(s) as int;
-    while (n >= 0) {
-        if (s.(n) == c) {
-            ret n;
-        }
-        n -= 1;
-    }
-    ret n;
-}
-
-fn find(str haystack, str needle) -> int {
-
-    let int haystack_len = byte_len(haystack) as int;
-    let int needle_len = byte_len(needle) as int;
-
-    if (needle_len == 0) {
-        ret 0;
-    }
-
-    fn match_at(&str haystack,
-                &str needle,
-                int i) -> bool {
-        let int j = i;
-        for (u8 c in needle) {
-            if (haystack.(j) != c) {
-                ret false;
-            }
-            j += 1;
-        }
-        ret true;
-    }
-
-    let int i = 0;
-    while (i <= haystack_len - needle_len) {
-        if (match_at(haystack, needle, i)) {
-            ret i;
-        }
-        i += 1;
-    }
-    ret  -1;
-}
-
-fn starts_with(str haystack, str needle) -> bool {
-    let uint haystack_len = byte_len(haystack);
-    let uint needle_len = byte_len(needle);
-    if (needle_len == 0u) {
-        ret true;
-    }
-    if (needle_len > haystack_len) {
-        ret false;
-    }
-    ret eq(substr(haystack, 0u, needle_len), needle);
-}
-
-fn ends_with(str haystack, str needle) -> bool {
-    let uint haystack_len = byte_len(haystack);
-    let uint needle_len = byte_len(needle);
-    if (needle_len == 0u) {
-        ret true;
-    }
-    if (needle_len > haystack_len) {
-        ret false;
-    }
-    ret eq(substr(haystack,
-                  haystack_len - needle_len,
-                  needle_len),
-           needle);
-}
-
-fn substr(str s, uint begin, uint len) -> str {
-    ret slice(s, begin, begin + len);
-}
-
-fn slice(str s, uint begin, uint end) -> str {
-    // FIXME: Typestate precondition
-    assert (begin <= end);
-    assert (end <= _str::byte_len(s));
-    ret rustrt::str_slice(s, begin, end);
-}
-
-fn shift_byte(&mutable str s) -> u8 {
-    auto len = byte_len(s);
-    assert (len > 0u);
-    auto b = s.(0);
-    s = substr(s, 1u, len - 1u);
-    ret b;
-}
-
-fn pop_byte(&mutable str s) -> u8 {
-    auto len = byte_len(s);
-    assert (len > 0u);
-    auto b = s.(len - 1u);
-    s = substr(s, 0u, len - 1u);
-    ret b;
-}
-
-fn push_byte(&mutable str s, u8 b) {
-    s = rustrt::str_push_byte(s, b as uint);
-}
-
-fn unshift_byte(&mutable str s, u8 b) {
-    auto res = alloc(byte_len(s) + 1u);
-    res += unsafe_from_byte(b);
-    res += s;
-    s = res;
-}
-
-fn split(str s, u8 sep) -> vec[str] {
-    let vec[str] v = [];
-    let str accum = "";
-    let bool ends_with_sep = false;
-    for (u8 c in s) {
-        if (c == sep) {
-            v += [accum];
-            accum = "";
-            ends_with_sep = true;
-        } else {
-            accum += unsafe_from_byte(c);
-            ends_with_sep = false;
-        }
-    }
-    if (_str::byte_len(accum) != 0u ||
-        ends_with_sep) {
-        v += [accum];
-    }
-    ret v;
-}
-
-fn concat(vec[str] v) -> str {
-    let str s = "";
-    for (str ss in v) {
-        s += ss;
-    }
-    ret s;
-}
-
-fn connect(vec[str] v, str sep) -> str {
-    let str s = "";
-    let bool first = true;
-    for (str ss in v) {
-        if (first) {
-            first = false;
-        } else {
-            s += sep;
-        }
-        s += ss;
-    }
-    ret s;
-}
-
-// FIXME: This only handles ASCII
-fn to_upper(str s) -> str {
-    auto outstr = "";
-    auto ascii_a = 'a' as u8;
-    auto ascii_z = 'z' as u8;
-    auto diff = 32u8;
-    for (u8 byte in s) {
-        auto next;
-        if (ascii_a <= byte && byte <= ascii_z) {
-            next = byte - diff;
-        } else {
-            next = byte;
-        }
-        push_byte(outstr, next);
-    }
-    ret outstr;
-}
-
-
-// Local Variables:
-// mode: rust;
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
-// End:
diff --git a/src/lib/_u8.rs b/src/lib/_u8.rs
deleted file mode 100644 (file)
index e094e58..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-fn add(u8 x, u8 y) -> u8 { ret x + y; }
-fn sub(u8 x, u8 y) -> u8 { ret x - y; }
-fn mul(u8 x, u8 y) -> u8 { ret x * y; }
-fn div(u8 x, u8 y) -> u8 { ret x / y; }
-fn rem(u8 x, u8 y) -> u8 { ret x % y; }
-
-fn lt(u8 x, u8 y) -> bool { ret x < y; }
-fn le(u8 x, u8 y) -> bool { ret x <= y; }
-fn eq(u8 x, u8 y) -> bool { ret x == y; }
-fn ne(u8 x, u8 y) -> bool { ret x != y; }
-fn ge(u8 x, u8 y) -> bool { ret x >= y; }
-fn gt(u8 x, u8 y) -> bool { ret x > y; }
-
-iter range(u8 lo, u8 hi) -> u8 {
-    while (lo < hi) {
-        put lo;
-        lo += 1u8;
-    }
-}
-
-// Local Variables:
-// mode: rust;
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
-// End:
diff --git a/src/lib/_uint.rs b/src/lib/_uint.rs
deleted file mode 100644 (file)
index a68901c..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-
-fn add(uint x, uint y) -> uint { ret x + y; }
-fn sub(uint x, uint y) -> uint { ret x - y; }
-fn mul(uint x, uint y) -> uint { ret x * y; }
-fn div(uint x, uint y) -> uint { ret x / y; }
-fn rem(uint x, uint y) -> uint { ret x % y; }
-
-fn lt(uint x, uint y) -> bool { ret x < y; }
-fn le(uint x, uint y) -> bool { ret x <= y; }
-fn eq(uint x, uint y) -> bool { ret x == y; }
-fn ne(uint x, uint y) -> bool { ret x != y; }
-fn ge(uint x, uint y) -> bool { ret x >= y; }
-fn gt(uint x, uint y) -> bool { ret x > y; }
-
-iter range(uint lo, uint hi) -> uint {
-    auto lo_ = lo;
-    while (lo_ < hi) {
-        put lo_;
-        lo_ += 1u;
-    }
-}
-
-fn next_power_of_two(uint n) -> uint {
-    // FIXME change |* uint(4)| below to |* uint(8) / uint(2)| and watch the
-    // world explode.
-    let uint halfbits = sys::rustrt::size_of[uint]() * 4u;
-    let uint tmp = n - 1u;
-    let uint shift = 1u;
-    while (shift <= halfbits) {
-        tmp |= tmp >> shift;
-        shift <<= 1u;
-    }
-    ret tmp + 1u;
-}
-
-fn parse_buf(vec[u8] buf, uint radix) -> uint {
-    if (_vec::len[u8](buf) == 0u) {
-        log_err "parse_buf(): buf is empty";
-        fail;
-    }
-
-    auto i = _vec::len[u8](buf) - 1u;
-    auto power = 1u;
-    auto n = 0u;
-    while (true) {
-        n += (((buf.(i)) - ('0' as u8)) as uint) * power;
-        power *= radix;
-        if (i == 0u) { ret n; }
-        i -= 1u;
-    }
-
-    fail;
-}
-
-fn to_str(uint num, uint radix) -> str
-{
-    auto n = num;
-
-    assert (0u < radix && radix <= 16u);
-    fn digit(uint n) -> char {
-        alt (n) {
-            case (0u) { ret '0'; }
-            case (1u) { ret '1'; }
-            case (2u) { ret '2'; }
-            case (3u) { ret '3'; }
-            case (4u) { ret '4'; }
-            case (5u) { ret '5'; }
-            case (6u) { ret '6'; }
-            case (7u) { ret '7'; }
-            case (8u) { ret '8'; }
-            case (9u) { ret '9'; }
-            case (10u) { ret 'a'; }
-            case (11u) { ret 'b'; }
-            case (12u) { ret 'c'; }
-            case (13u) { ret 'd'; }
-            case (14u) { ret 'e'; }
-            case (15u) { ret 'f'; }
-        }
-        fail;
-    }
-
-    if (n == 0u) { ret "0"; }
-
-    let str s = "";
-    while (n != 0u) {
-        s += _str::unsafe_from_byte(digit(n % radix) as u8);
-        n /= radix;
-    }
-
-    let str s1 = "";
-    let uint len = _str::byte_len(s);
-    while (len != 0u) {
-        len -= 1u;
-        s1 += _str::unsafe_from_byte(s.(len));
-    }
-    ret s1;
-
-}
-
-// Local Variables:
-// mode: rust;
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
-// End:
diff --git a/src/lib/_vec.rs b/src/lib/_vec.rs
deleted file mode 100644 (file)
index 70446e0..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-import option::none;
-import option::some;
-import util::orb;
-
-type vbuf = rustrt::vbuf;
-
-type operator2[T,U,V] = fn(&T, &U) -> V;
-
-type array[T] = vec[mutable? T];
-
-native "rust" mod rustrt {
-    type vbuf;
-
-    fn vec_buf[T](vec[T] v, uint offset) -> vbuf;
-
-    fn vec_len[T](vec[T] v) -> uint;
-    /**
-     * Sometimes we modify the vec internal data via vec_buf and need to
-     * update the vec's fill length accordingly.
-     */
-    fn vec_len_set[T](vec[T] v, uint n);
-
-    /**
-     * The T in vec_alloc[T, U] is the type of the vec to allocate.  The
-     * U is the type of an element in the vec.  So to allocate a vec[U] we
-     * want to invoke this as vec_alloc[vec[U], U].
-     */
-    fn vec_alloc[T, U](uint n_elts) -> vec[U];
-    fn vec_alloc_mut[T, U](uint n_elts) -> vec[mutable U];
-
-    fn refcount[T](vec[T] v) -> uint;
-
-    fn vec_print_debug_info[T](vec[T] v);
-
-    fn vec_from_vbuf[T](vbuf v, uint n_elts) -> vec[T];
-
-    fn unsafe_vec_to_mut[T](vec[T] v) -> vec[mutable T];
-}
-
-fn alloc[T](uint n_elts) -> vec[T] {
-    ret rustrt::vec_alloc[vec[T], T](n_elts);
-}
-
-fn alloc_mut[T](uint n_elts) -> vec[mutable T] {
-    ret rustrt::vec_alloc_mut[vec[mutable T], T](n_elts);
-}
-
-fn refcount[T](array[T] v) -> uint {
-    auto r = rustrt::refcount[T](v);
-    if (r == dbg::const_refcount) {
-        ret r;
-    } else {
-        // -1 because calling this function incremented the refcount.
-        ret  r - 1u;
-    }
-}
-
-fn vec_from_vbuf[T](vbuf v, uint n_elts) -> vec[T] {
-    ret rustrt::vec_from_vbuf[T](v, n_elts);
-}
-
-// FIXME: Remove me; this is a botch to get around rustboot's bad typechecker.
-fn empty[T]() -> vec[T] {
-    ret alloc[T](0u);
-}
-
-// FIXME: Remove me; this is a botch to get around rustboot's bad typechecker.
-fn empty_mut[T]() -> vec[mutable T] {
-    ret alloc_mut[T](0u);
-}
-
-type init_op[T] = fn(uint i) -> T;
-
-fn init_fn[T](&init_op[T] op, uint n_elts) -> vec[T] {
-    let vec[T] v = alloc[T](n_elts);
-    let uint i = 0u;
-    while (i < n_elts) {
-        v += [op(i)];
-        i += 1u;
-    }
-    ret v;
-}
-
-fn init_fn_mut[T](&init_op[T] op, uint n_elts) -> vec[mutable T] {
-    let vec[mutable T] v = alloc_mut[T](n_elts);
-    let uint i = 0u;
-    while (i < n_elts) {
-        v += [mutable op(i)];
-        i += 1u;
-    }
-    ret v;
-}
-
-fn init_elt[T](&T t, uint n_elts) -> vec[T] {
-    /**
-     * FIXME (issue #81): should be:
-     *
-     * fn elt_op[T](&T x, uint i) -> T { ret x; }
-     * let init_op[T] inner = bind elt_op[T](t, _);
-     * ret init_fn[T](inner, n_elts);
-     */
-    let vec[T] v = alloc[T](n_elts);
-    let uint i = n_elts;
-    while (i > 0u) {
-        i -= 1u;
-        v += [t];
-    }
-    ret v;
-}
-
-fn init_elt_mut[T](&T t, uint n_elts) -> vec[mutable T] {
-    let vec[mutable T] v = alloc_mut[T](n_elts);
-    let uint i = n_elts;
-    while (i > 0u) {
-        i -= 1u;
-        v += [mutable t];
-    }
-    ret v;
-}
-
-fn buf[T](array[T] v) -> vbuf {
-    ret rustrt::vec_buf[T](v, 0u);
-}
-
-fn len[T](array[T] v) -> uint {
-    ret rustrt::vec_len[T](v);
-}
-
-fn len_set[T](array[T] v, uint n) {
-    rustrt::vec_len_set[T](v, n);
-}
-
-fn buf_off[T](array[T] v, uint offset) -> vbuf {
-     assert (offset < len[T](v));
-    ret rustrt::vec_buf[T](v, offset);
-}
-
-fn print_debug_info[T](array[T] v) {
-    rustrt::vec_print_debug_info[T](v);
-}
-
-// Returns the last element of v.
-fn last[T](array[T] v) -> option::t[T] {
-    auto l = len[T](v);
-    if (l == 0u) {
-        ret none[T];
-    }
-    ret some[T](v.(l - 1u));
-}
-
-// Returns elements from [start..end) from v.
-
-fn slice[T](array[T] v, uint start, uint end) -> vec[T] {
-    assert (start <= end);
-    assert (end <= len[T](v));
-    auto result = alloc[T](end - start);
-    let uint i = start;
-    while (i < end) {
-        result += [v.(i)];
-        i += 1u;
-    }
-    ret result;
-}
-
-fn shift[T](&mutable array[T] v) -> T {
-    auto ln = len[T](v);
-    assert (ln > 0u);
-    auto e = v.(0);
-    v = slice[T](v, 1u, ln);
-    ret e;
-}
-
-fn pop[T](&mutable array[T] v) -> T {
-    auto ln = len[T](v);
-    assert (ln > 0u);
-    ln -= 1u;
-    auto e = v.(ln);
-    v = slice[T](v, 0u, ln);
-    ret e;
-}
-
-fn push[T](&mutable array[T] v, &T t) {
-    v += [t];
-}
-
-fn unshift[T](&mutable array[T] v, &T t) {
-    auto res = alloc[T](len[T](v) + 1u);
-    res += [t];
-    res += v;
-    v = res;
-}
-
-fn grow[T](&array[T] v, uint n, &T initval) {
-    let uint i = n;
-    while (i > 0u) {
-        i -= 1u;
-        v += [initval];
-    }
-}
-
-fn grow_set[T](&vec[mutable T] v, uint index, &T initval, &T val) {
-    auto length = _vec::len(v);
-    if (index >= length) {
-        grow(v, index - length + 1u, initval);
-    }
-    v.(index) = val;
-}
-
-fn map[T, U](&option::operator[T,U] f, &array[T] v) -> vec[U] {
-    let vec[U] u = alloc[U](len[T](v));
-    for (T ve in v) {
-        u += [f(ve)];
-    }
-    ret u;
-}
-
-fn map2[T,U,V](&operator2[T,U,V] f, &array[T] v0, &array[U] v1) -> vec[V] {
-    auto v0_len = len[T](v0);
-    if (v0_len != len[U](v1)) {
-        fail;
-    }
-
-    let vec[V] u = alloc[V](v0_len);
-    auto i = 0u;
-    while (i < v0_len) {
-        u += [f(v0.(i), v1.(i))];
-        i += 1u;
-    }
-
-    ret u;
-}
-
-fn find[T](fn (&T) -> bool f, &array[T] v) -> option::t[T] {
-    for (T elt in v) {
-        if (f(elt)) {
-            ret some[T](elt);
-        }
-    }
-
-    ret none[T];
-}
-
-fn foldl[T, U](fn (&U, &T) -> U p, &U z, &vec[T] v) -> U {
-    auto sz = len[T](v);
-
-    if (sz == 0u) {
-        ret z;
-    }
-    else {
-        auto rest = slice[T](v, 1u, sz);
-
-        ret (p(foldl[T,U](p, z, rest), v.(0)));
-    }
-}
-
-fn unzip[T, U](&vec[tup(T, U)] v) -> tup(vec[T], vec[U]) {
-    auto sz = len[tup(T, U)](v);
-
-    if (sz == 0u) {
-        ret tup(alloc[T](0u), alloc[U](0u));
-    }
-    else {
-        auto rest = slice[tup(T, U)](v, 1u, sz);
-        auto tl   = unzip[T, U](rest);
-        auto a    = [v.(0)._0];
-        auto b    = [v.(0)._1];
-        ret tup(a + tl._0, b + tl._1);
-    }
-}
-
-fn or(&vec[bool] v) -> bool {
-    auto f = orb;
-    ret _vec::foldl[bool, bool](f, false, v);
-}
-
-fn clone[T](&vec[T] v) -> vec[T] {
-    ret slice[T](v, 0u, len[T](v));
-}
-
-fn plus_option[T](&vec[T] v, &option::t[T] o) -> () {
-    alt (o) {
-        case (none[T]) {}
-        case (some[T](?x)) { v += [x]; }
-    }
-}
-
-fn cat_options[T](&vec[option::t[T]] v) -> vec[T] {
-    let vec[T] res = [];
-
-    for (option::t[T] o in v) {
-        alt (o) {
-            case (none[T]) { }
-            case (some[T](?t)) {
-                res += [t];
-            }
-        }
-    }
-
-    ret res;
-}
-
-// TODO: Remove in favor of built-in "freeze" operation when it's implemented.
-fn freeze[T](vec[mutable T] v) -> vec[T] {
-    let vec[T] result = [];
-    for (T elem in v) {
-        result += [elem];
-    }
-    ret result;
-}
-
-// Local Variables:
-// mode: rust;
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
-// End:
index f34ce56524ed1959feb055782cb22e3bf13f6cab..708cc621868b0c61125338fe2b15bc14af2a95b5 100644 (file)
@@ -21,19 +21,19 @@ fn create(uint nbits, bool init) -> t {
         elt = 0u;
     }
 
-    auto storage = _vec::init_elt_mut[uint](elt, nbits / uint_bits() + 1u);
+    auto storage = vec::init_elt_mut[uint](elt, nbits / uint_bits() + 1u);
     ret rec(storage = storage, nbits = nbits);
 }
 
 fn process(&fn(uint, uint) -> uint op, &t v0, &t v1) -> bool {
-    auto len = _vec::len(v1.storage);
+    auto len = vec::len(v1.storage);
 
-    assert (_vec::len(v0.storage) == len);
+    assert (vec::len(v0.storage) == len);
     assert (v0.nbits == v1.nbits);
 
     auto changed = false;
 
-    for each (uint i in _uint::range(0u, len)) {
+    for each (uint i in uint::range(0u, len)) {
         auto w0 = v0.storage.(i);
         auto w1 = v1.storage.(i);
 
@@ -75,9 +75,9 @@ fn copy(&t v0, t v1) -> bool {
 }
 
 fn clone(t v) -> t {
-    auto storage = _vec::init_elt_mut[uint](0u, v.nbits / uint_bits() + 1u);
-    auto len = _vec::len(v.storage);
-    for each (uint i in _uint::range(0u, len)) {
+    auto storage = vec::init_elt_mut[uint](0u, v.nbits / uint_bits() + 1u);
+    auto len = vec::len(v.storage);
+    for each (uint i in uint::range(0u, len)) {
         storage.(i) = v.storage.(i);
     }
     ret rec(storage = storage, nbits = v.nbits);
@@ -97,7 +97,7 @@ fn get(&t v, uint i) -> bool {
 fn equal(&t v0, &t v1) -> bool {
     // FIXME: when we can break or return from inside an iterator loop,
     //        we can eliminate this painful while-loop
-    auto len = _vec::len(v1.storage);
+    auto len = vec::len(v1.storage);
     auto i = 0u;
     while (i < len) {
         if (v0.storage.(i) != v1.storage.(i)) {
@@ -109,13 +109,13 @@ fn equal(&t v0, &t v1) -> bool {
 }
 
 fn clear(&t v) {
-    for each (uint i in _uint::range(0u, _vec::len(v.storage))) {
+    for each (uint i in uint::range(0u, vec::len(v.storage))) {
         v.storage.(i) = 0u;
     }
 }
 
 fn invert(&t v) {
-    for each (uint i in _uint::range(0u, _vec::len(v.storage))) {
+    for each (uint i in uint::range(0u, vec::len(v.storage))) {
         v.storage.(i) = ~v.storage.(i);
     }
 }
@@ -176,7 +176,7 @@ fn init_to_vec(t v, uint i) -> uint {
 
 fn to_vec(&t v) -> vec[uint] {
     auto sub = bind init_to_vec(v, _);
-    ret _vec::init_fn[uint](sub, v.nbits);
+    ret vec::init_fn[uint](sub, v.nbits);
 }
 
 fn to_str(&t v) -> str {
@@ -196,7 +196,7 @@ fn to_str(&t v) -> str {
 
 // FIXME: can we just use structural equality on to_vec?
 fn eq_vec(&t v0, &vec[uint] v1) -> bool {
-    assert (v0.nbits == _vec::len[uint](v1));
+    assert (v0.nbits == vec::len[uint](v1));
     auto len = v0.nbits;
     auto i = 0u;
     while (i < len) {
index be3675625674732181ec43f7eecd200d0b49a866..c1d719794246f7ddd5c349b531fd4cfe77139759 100644 (file)
@@ -20,7 +20,7 @@
 }
 
 fn debug_vec[T](vec[T] v) {
-    _vec::print_debug_info[T](v);
+    vec::print_debug_info[T](v);
 }
 
 fn debug_tydesc[T]() {
index c0ded5bf54677cee3a157bd1ab559bd8454abcb8..9da1651f04782dae33418a94383df8ee4eb4faa3 100644 (file)
@@ -28,7 +28,7 @@ fn create[T]() -> t[T] {
      * elsewhere.
      */
     fn grow[T](uint nelts, uint lo, vec[cell[T]] elts) -> vec[cell[T]] {
-        assert (nelts == _vec::len[cell[T]](elts));
+        assert (nelts == vec::len[cell[T]](elts));
 
         fn fill[T](uint i, uint nelts, uint lo,
                    vec[cell[T]] old) -> cell[T] {
@@ -39,9 +39,9 @@ fn fill[T](uint i, uint nelts, uint lo,
             }
         }
 
-        let uint nalloc = _uint::next_power_of_two(nelts + 1u);
-        let _vec::init_op[cell[T]] copy_op = bind fill[T](_, nelts, lo, elts);
-        ret _vec::init_fn[cell[T]](copy_op, nalloc);
+        let uint nalloc = uint::next_power_of_two(nelts + 1u);
+        let vec::init_op[cell[T]] copy_op = bind fill[T](_, nelts, lo, elts);
+        ret vec::init_fn[cell[T]](copy_op, nalloc);
     }
 
     fn get[T](vec[cell[T]] elts, uint i) -> T {
@@ -63,14 +63,14 @@ fn add_front(&T t) {
                 let uint oldlo = lo;
 
                 if (lo == 0u) {
-                    lo = _vec::len[cell[T]](elts) - 1u;
+                    lo = vec::len[cell[T]](elts) - 1u;
                 } else {
                     lo -= 1u;
                 }
 
                 if (lo == hi) {
                     elts = grow[T](nelts, oldlo, elts);
-                    lo = _vec::len[cell[T]](elts) - 1u;
+                    lo = vec::len[cell[T]](elts) - 1u;
                     hi = nelts;
                 }
 
@@ -86,7 +86,7 @@ fn add_back(&T t) {
                 }
 
                 elts.(hi) = option::some[T](t);
-                hi = (hi + 1u) % _vec::len[cell[T]](elts);
+                hi = (hi + 1u) % vec::len[cell[T]](elts);
                 nelts += 1u;
             }
 
@@ -97,14 +97,14 @@ fn add_back(&T t) {
             fn pop_front() -> T {
                 let T t = get[T](elts, lo);
                 elts.(lo) = option::none[T];
-                lo = (lo + 1u) % _vec::len[cell[T]](elts);
+                lo = (lo + 1u) % vec::len[cell[T]](elts);
                 nelts -= 1u;
                 ret t;
             }
 
             fn pop_back() -> T {
                 if (hi == 0u) {
-                    hi = _vec::len[cell[T]](elts) - 1u;
+                    hi = vec::len[cell[T]](elts) - 1u;
                 } else {
                     hi -= 1u;
                 }
@@ -124,12 +124,12 @@ fn peek_back() -> T {
             }
 
             fn get(int i) -> T {
-                let uint idx = (lo + (i as uint)) % _vec::len[cell[T]](elts);
+                let uint idx = (lo + (i as uint)) % vec::len[cell[T]](elts);
                 ret get[T](elts, idx);
             }
 
         }
-    let vec[cell[T]] v = _vec::init_elt[cell[T]](option::none[T],
+    let vec[cell[T]] v = vec::init_elt[cell[T]](option::none[T],
                                                 initial_capacity);
 
     ret deque[T](0u, 0u, 0u, v);
index 0a5831d73333049245a17dee768296aef54251ff..62f90decf932c14b7a470005145819ac9141ec10 100644 (file)
@@ -38,7 +38,7 @@ fn vint_at(vec[u8] data, uint start) -> tup(uint, uint) {
 }
 
 fn new_doc(vec[u8] data) -> doc {
-    ret rec(data=data, start=0u, end=_vec::len[u8](data));
+    ret rec(data=data, start=0u, end=vec::len[u8](data));
 }
 
 fn doc_at(vec[u8] data, uint start) -> doc {
@@ -65,7 +65,7 @@ fn get_doc(doc d, uint tg) -> doc {
     alt (maybe_get_doc(d, tg)) {
         case (some[doc](?d)) {ret d;}
         case (none[doc]) {
-            log_err "failed to find block with tag " + _uint::to_str(tg, 10u);
+            log_err "failed to find block with tag " + uint::to_str(tg, 10u);
             fail;
         }
     }
@@ -94,7 +94,7 @@ fn get_doc(doc d, uint tg) -> doc {
 }
 
 fn doc_data(doc d) -> vec[u8] {
-    ret _vec::slice[u8](d.data, d.start, d.end);
+    ret vec::slice[u8](d.data, d.start, d.end);
 }
 
 fn be_uint_from_bytes(vec[u8] data, uint start, uint size) -> uint {
@@ -175,7 +175,7 @@ fn start_tag(&writer w, uint tag_id) {
 }
 
 fn end_tag(&writer w) {
-    auto last_size_pos = _vec::pop[uint](w.size_positions);
+    auto last_size_pos = vec::pop[uint](w.size_positions);
     auto cur_pos = w.writer.tell();
     w.writer.seek(last_size_pos as int, io::seek_set);
     write_sized_vint(w.writer, cur_pos - last_size_pos - 4u, 4u);
index 876bf1b7f9046d3385faa32617ec7477030eb2d0..b74d12c84d470063b37c6f918037011de33737aa 100644 (file)
@@ -80,11 +80,11 @@ mod ct {
 
     fn parse_fmt_string(str s) -> vec[piece] {
         let vec[piece] pieces = [];
-        auto lim = _str::byte_len(s);
+        auto lim = str::byte_len(s);
         auto buf = "";
 
         fn flush_buf(str buf, &vec[piece] pieces) -> str {
-            if (_str::byte_len(buf) > 0u) {
+            if (str::byte_len(buf) > 0u) {
                 auto piece = piece_string(buf);
                 pieces += [piece];
             }
@@ -93,15 +93,15 @@ fn flush_buf(str buf, &vec[piece] pieces) -> str {
 
         auto i = 0u;
         while (i < lim) {
-            auto curr = _str::substr(s, i, 1u);
-            if (_str::eq(curr, "%")) {
+            auto curr = str::substr(s, i, 1u);
+            if (str::eq(curr, "%")) {
                 i += 1u;
                 if (i >= lim) {
                     log_err "unterminated conversion at end of string";
                     fail;
                 }
-                auto curr2 = _str::substr(s, i, 1u);
-                if (_str::eq(curr2, "%")) {
+                auto curr2 = str::substr(s, i, 1u);
+                if (str::eq(curr2, "%")) {
                     i += 1u;
                 } else {
                     buf = flush_buf(buf, pieces);
@@ -270,27 +270,27 @@ fn parse_type(str s, uint i, uint lim) -> tup(ty, uint) {
         }
 
         auto t;
-        auto tstr = _str::substr(s, i, 1u);
-        if (_str::eq(tstr, "b")) {
+        auto tstr = str::substr(s, i, 1u);
+        if (str::eq(tstr, "b")) {
             t = ty_bool;
-        } else if (_str::eq(tstr, "s")) {
+        } else if (str::eq(tstr, "s")) {
             t = ty_str;
-        } else if (_str::eq(tstr, "c")) {
+        } else if (str::eq(tstr, "c")) {
             t = ty_char;
-        } else if (_str::eq(tstr, "d")
-                   || _str::eq(tstr, "i")) {
+        } else if (str::eq(tstr, "d")
+                   || str::eq(tstr, "i")) {
             // TODO: Do we really want two signed types here?
             // How important is it to be printf compatible?
             t = ty_int(signed);
-        } else if (_str::eq(tstr, "u")) {
+        } else if (str::eq(tstr, "u")) {
             t = ty_int(unsigned);
-        } else if (_str::eq(tstr, "x")) {
+        } else if (str::eq(tstr, "x")) {
             t = ty_hex(case_lower);
-        } else if (_str::eq(tstr, "X")) {
+        } else if (str::eq(tstr, "X")) {
             t = ty_hex(case_upper);
-        } else if (_str::eq(tstr, "t")) {
+        } else if (str::eq(tstr, "t")) {
             t = ty_bits;
-        } else if (_str::eq(tstr, "o")) {
+        } else if (str::eq(tstr, "o")) {
             t = ty_octal;
         } else {
             log_err "unknown type in conversion";
@@ -364,7 +364,7 @@ fn conv_uint(&conv cv, uint u) -> str {
                 res = uint_to_str_prec(u, 16u, prec);
             }
             case (ty_hex_upper) {
-                res = _str::to_upper(uint_to_str_prec(u, 16u, prec));
+                res = str::to_upper(uint_to_str_prec(u, 16u, prec));
             }
             case (ty_bits) {
                 res = uint_to_str_prec(u, 2u, prec);
@@ -389,7 +389,7 @@ fn conv_bool(&conv cv, bool b) -> str {
     }
 
     fn conv_char(&conv cv, char c) -> str {
-        ret pad(cv, _str::from_char(c), pad_nozero);
+        ret pad(cv, str::from_char(c), pad_nozero);
     }
 
     fn conv_str(&conv cv, str s) -> str {
@@ -399,9 +399,9 @@ fn conv_str(&conv cv, str s) -> str {
             }
             case (count_is(?max)) {
                 // For strings, precision is the maximum characters displayed
-                if (max as uint < _str::char_len(s)) {
+                if (max as uint < str::char_len(s)) {
                     // FIXME: substr works on bytes, not chars!
-                    unpadded = _str::substr(s, 0u, max as uint);
+                    unpadded = str::substr(s, 0u, max as uint);
                 }
             }
         }
@@ -420,15 +420,15 @@ fn int_to_str_prec(int num, uint radix, uint prec) -> str {
 
     // Convert a uint to string with a minimum number of digits.  If precision
     // is 0 and num is 0 then the result is the empty string. Could move this
-    // to _uint: but it doesn't seem all that useful.
+    // to uint: but it doesn't seem all that useful.
     fn uint_to_str_prec(uint num, uint radix, uint prec) -> str {
         auto s;
 
         if (prec == 0u && num == 0u) {
             s = "";
         } else {
-            s = _uint::to_str(num, radix);
-            auto len = _str::char_len(s);
+            s = uint::to_str(num, radix);
+            auto len = str::char_len(s);
             if (len < prec) {
                 auto diff = prec - len;
                 auto pad = str_init_elt('0', diff);
@@ -450,12 +450,12 @@ fn get_int_precision(&conv cv) -> uint {
         }
     }
 
-    // FIXME: This might be useful in _str: but needs to be utf8 safe first
+    // FIXME: This might be useful in str: but needs to be utf8 safe first
     fn str_init_elt(char c, uint n_elts) -> str {
-        auto svec = _vec::init_elt[u8](c as u8, n_elts);
+        auto svec = vec::init_elt[u8](c as u8, n_elts);
         // FIXME: Using unsafe_from_bytes because rustboot
         // can't figure out the is_utf8 predicate on from_bytes?
-        ret _str::unsafe_from_bytes(svec);
+        ret str::unsafe_from_bytes(svec);
     }
 
     tag pad_mode {
@@ -476,7 +476,7 @@ fn pad(&conv cv, str s, pad_mode mode) -> str {
             }
         }
 
-        auto strlen = _str::char_len(s);
+        auto strlen = str::char_len(s);
         if (uwidth <= strlen) {
             ret s;
         }
@@ -532,16 +532,16 @@ fn have_precision(&conv cv) -> bool {
         // instead.
         if (signed
             && zero_padding
-            && _str::byte_len(s) > 0u) {
+            && str::byte_len(s) > 0u) {
 
             auto head = s.(0);
             if (head == '+' as u8
                 || head == '-' as u8
                 || head == ' ' as u8) {
 
-                auto headstr = _str::unsafe_from_bytes([head]);
-                auto bytelen = _str::byte_len(s);
-                auto numpart = _str::substr(s, 1u, bytelen - 1u);
+                auto headstr = str::unsafe_from_bytes([head]);
+                auto bytelen = str::byte_len(s);
+                auto numpart = str::substr(s, 1u, bytelen - 1u);
                 ret headstr + padstr + numpart;
             }
         }
index c726fc0985c6a9c5288589cdab0314357e15ed59..51c1ff9cdde52d8646f7ab1ad95d88b0e29ae8a9 100644 (file)
@@ -3,24 +3,24 @@
 }
 
 fn path_sep() -> str {
-    ret _str::from_char(os_fs::path_sep);
+    ret str::from_char(os_fs::path_sep);
 }
 
 type path = str;
 
 fn dirname(path p) -> path {
-    let int i = _str::rindex(p, os_fs::path_sep as u8);
+    let int i = str::rindex(p, os_fs::path_sep as u8);
     if (i == -1) {
-        i = _str::rindex(p, os_fs::alt_path_sep as u8);
+        i = str::rindex(p, os_fs::alt_path_sep as u8);
         if (i == -1) {
             ret p;
         }
     }
-    ret _str::substr(p, 0u, i as uint);
+    ret str::substr(p, 0u, i as uint);
 }
 
 fn connect(path pre, path post) -> path {
-    auto len = _str::byte_len(pre);
+    auto len = str::byte_len(pre);
     if (pre.(len - 1u) == (os_fs::path_sep as u8)) { // Trailing '/'?
         ret pre + post;
     }
@@ -32,14 +32,14 @@ fn file_is_dir(path p) -> bool {
 }
 
 fn list_dir(path p) -> vec[str] {
-  auto pl = _str::byte_len(p);
+  auto pl = str::byte_len(p);
   if (pl == 0u || p.(pl - 1u) as char != os_fs::path_sep) {
     p += path_sep();
   }
   let vec[str] full_paths = [];
   for (str filename in os_fs::list_dir(p)) {
-    if (!_str::eq(filename, ".")) {if (!_str::eq(filename, "..")) {
-      _vec::push[str](full_paths, p + filename);
+    if (!str::eq(filename, ".")) {if (!str::eq(filename, "..")) {
+      vec::push[str](full_paths, p + filename);
     }}
   }
   ret full_paths;
index 6b2795af93e90b6700f2a6a878255900cfc78328..4c8d27a5d202efd01871bfcfbfea45732c255c17 100644 (file)
@@ -1,9 +1,9 @@
 fn getenv(str n) -> option::t[str] {
-  auto s = os::libc::getenv(_str::buf(n));
+  auto s = os::libc::getenv(str::buf(n));
   if ((s as int) == 0) {
     ret option::none[str];
   } else {
-    ret option::some[str](_str::str_from_cstr(s));
+    ret option::some[str](str::str_from_cstr(s));
   }
 }
 
index a553b7e4128b6724176b62dfc04a2cdae8f9c698..c3b485a43b06d22c2e14f7429639099b42317ec0 100644 (file)
@@ -17,7 +17,7 @@
 type opt = rec(name name, hasarg hasarg, occur occur);
 
 fn mkname(str nm) -> name {
-    if (_str::char_len(nm) == 1u) { ret short(_str::char_at(nm, 0u)); }
+    if (str::char_len(nm) == 1u) { ret short(str::char_at(nm, 0u)); }
     else { ret long(nm); }
 }
 fn reqopt(str name) -> opt {
@@ -41,11 +41,11 @@ fn optmulti(str name) -> opt {
 type match = rec(vec[opt] opts, vec[mutable vec[optval]] vals, vec[str] free);
 
 fn is_arg(str arg) -> bool {
-    ret _str::byte_len(arg) > 1u && arg.(0) == '-' as u8;
+    ret str::byte_len(arg) > 1u && arg.(0) == '-' as u8;
 }
 fn name_str(name nm) -> str {
     alt (nm) {
-        case (short(?ch)) {ret _str::from_char(ch);}
+        case (short(?ch)) {ret str::from_char(ch);}
         case (long(?s)) {ret s;}
     }
 }
@@ -55,7 +55,7 @@ fn name_eq(name a, name b) -> bool {
     alt (a) {
         case (long(?a)) {
             alt (b) {
-                case (long(?b)) { ret _str::eq(a, b); }
+                case (long(?b)) { ret str::eq(a, b); }
                 case (_) { ret false; }
             }
         }
@@ -64,7 +64,7 @@ fn name_eq(name a, name b) -> bool {
 }
 fn find_opt(vec[opt] opts, name nm) -> option::t[uint] {
     auto i = 0u;
-    auto l = _vec::len[opt](opts);
+    auto l = vec::len[opt](opts);
     while (i < l) {
         if (name_eq(opts.(i).name, nm)) { ret some[uint](i); }
         i += 1u;
@@ -102,41 +102,41 @@ fn fail_str(fail_ f) -> str {
 }
 
 fn getopts(vec[str] args, vec[opt] opts) -> result {
-    auto n_opts = _vec::len[opt](opts);
-    fn empty_(uint x) -> vec[optval]{ret _vec::empty[optval]();}
+    auto n_opts = vec::len[opt](opts);
+    fn empty_(uint x) -> vec[optval]{ret vec::empty[optval]();}
     auto f = empty_;
-    auto vals = _vec::init_fn_mut[vec[optval]](f, n_opts);
+    auto vals = vec::init_fn_mut[vec[optval]](f, n_opts);
     let vec[str] free = [];
 
-    auto l = _vec::len[str](args);
+    auto l = vec::len[str](args);
     auto i = 0u;
     while (i < l) {
         auto cur = args.(i);
-        auto curlen = _str::byte_len(cur);
+        auto curlen = str::byte_len(cur);
         if (!is_arg(cur)) {
-            _vec::push[str](free, cur);
-        } else if (_str::eq(cur, "--")) {
-            free += _vec::slice[str](args, i + 1u, l);
+            vec::push[str](free, cur);
+        } else if (str::eq(cur, "--")) {
+            free += vec::slice[str](args, i + 1u, l);
             break;
         } else {
             auto names;
             auto i_arg = option::none[str];
             if (cur.(1) == '-' as u8) {
-                auto tail = _str::slice(cur, 2u, curlen);
-                auto eq = _str::index(tail, '=' as u8);
+                auto tail = str::slice(cur, 2u, curlen);
+                auto eq = str::index(tail, '=' as u8);
                 if (eq == -1) {
                     names = [long(tail)];
                 } else {
-                    names = [long(_str::slice(tail, 0u, eq as uint))];
+                    names = [long(str::slice(tail, 0u, eq as uint))];
                     i_arg = option::some[str]
-                        (_str::slice(tail, (eq as uint) + 1u, curlen - 2u));
+                        (str::slice(tail, (eq as uint) + 1u, curlen - 2u));
                 }
             } else {
                 auto j = 1u;
                 names = [];
                 while (j < curlen) {
-                    auto range = _str::char_range_at(cur, j);
-                    _vec::push[name](names, short(range._0));
+                    auto range = str::char_range_at(cur, j);
+                    vec::push[name](names, short(range._0));
                     j = range._1;
                 }
             }
@@ -152,29 +152,29 @@ fn getopts(vec[str] args, vec[opt] opts) -> result {
                 }
                 alt (opts.(optid).hasarg) {
                     case (no) {
-                        _vec::push[optval](vals.(optid), given);
+                        vec::push[optval](vals.(optid), given);
                     }
                     case (maybe) {
                         if (!option::is_none[str](i_arg)) {
-                            _vec::push[optval](vals.(optid),
+                            vec::push[optval](vals.(optid),
                                               val(option::get[str](i_arg)));
-                        } else if (name_pos < _vec::len[name](names) ||
+                        } else if (name_pos < vec::len[name](names) ||
                                    i + 1u == l || is_arg(args.(i + 1u))) {
-                            _vec::push[optval](vals.(optid), given);
+                            vec::push[optval](vals.(optid), given);
                         } else {
                             i += 1u;
-                            _vec::push[optval](vals.(optid), val(args.(i)));
+                            vec::push[optval](vals.(optid), val(args.(i)));
                         }
                     }
                     case (yes) {
                         if (!option::is_none[str](i_arg)) {
-                            _vec::push[optval](vals.(optid),
+                            vec::push[optval](vals.(optid),
                                               val(option::get[str](i_arg)));
                         } else if (i + 1u == l) {
                             ret failure(argument_missing(name_str(nm)));
                         } else {
                             i += 1u;
-                            _vec::push[optval](vals.(optid), val(args.(i)));
+                            vec::push[optval](vals.(optid), val(args.(i)));
                         }
                     }
                 }
@@ -185,7 +185,7 @@ fn getopts(vec[str] args, vec[opt] opts) -> result {
 
     i = 0u;
     while (i < n_opts) {
-        auto n = _vec::len[optval](vals.(i));
+        auto n = vec::len[optval](vals.(i));
         auto occ = opts.(i).occur;
         if (occ == req) {if (n == 0u) {
             ret failure(option_missing(name_str(opts.(i).name)));
@@ -212,7 +212,7 @@ fn opt_val(match m, str nm) -> optval {
     ret opt_vals(m, nm).(0);
 }
 fn opt_present(match m, str nm) -> bool {
-    ret _vec::len[optval](opt_vals(m, nm)) > 0u;
+    ret vec::len[optval](opt_vals(m, nm)) > 0u;
 }
 fn opt_str(match m, str nm) -> str {
     alt (opt_val(m, nm)) {
@@ -224,7 +224,7 @@ fn opt_strs(match m, str nm) -> vec[str] {
     let vec[str] acc = [];
     for (optval v in opt_vals(m, nm)) {
         alt (v) {
-            case (val(?s)) { _vec::push[str](acc, s); }
+            case (val(?s)) { vec::push[str](acc, s); }
             case (_) {}
         }
     }
@@ -232,7 +232,7 @@ fn opt_strs(match m, str nm) -> vec[str] {
 }
 fn opt_maybe_str(match m, str nm) -> option::t[str] {
     auto vals = opt_vals(m, nm);
-    if (_vec::len[optval](vals) == 0u) { ret none[str]; }
+    if (vec::len[optval](vals) == 0u) { ret none[str]; }
     alt (vals.(0)) {
         case (val(?s)) { ret some[str](s); }
         case (_) { ret none[str]; }
diff --git a/src/lib/int.rs b/src/lib/int.rs
new file mode 100644 (file)
index 0000000..1e253b3
--- /dev/null
@@ -0,0 +1,62 @@
+
+fn add(int x, int y) -> int { ret x + y; }
+fn sub(int x, int y) -> int { ret x - y; }
+fn mul(int x, int y) -> int { ret x * y; }
+fn div(int x, int y) -> int { ret x / y; }
+fn rem(int x, int y) -> int { ret x % y; }
+
+fn lt(int x, int y) -> bool { ret x < y; }
+fn le(int x, int y) -> bool { ret x <= y; }
+fn eq(int x, int y) -> bool { ret x == y; }
+fn ne(int x, int y) -> bool { ret x != y; }
+fn ge(int x, int y) -> bool { ret x >= y; }
+fn gt(int x, int y) -> bool { ret x > y; }
+
+fn positive(int x) -> bool { ret x > 0; }
+fn negative(int x) -> bool { ret x < 0; }
+fn nonpositive(int x) -> bool { ret x <= 0; }
+fn nonnegative(int x) -> bool { ret x >= 0; }
+
+iter range(int lo, int hi) -> int {
+    let int lo_ = lo;
+    while (lo_ < hi) {
+        put lo_;
+        lo_ += 1;
+    }
+}
+
+fn to_str(int n, uint radix) -> str
+{
+    assert (0u < radix && radix <= 16u);
+    if (n < 0) {
+        ret "-" + uint::to_str((-n) as uint, radix);
+    } else {
+        ret uint::to_str(n as uint, radix);
+    }
+}
+
+fn pow(int base, uint exponent) -> int {
+
+    if (exponent == 0u) {
+        ret 1;
+    } else if (base == 0) {
+        ret 0;
+    } else {
+        auto accum = base;
+        auto count = exponent;
+        while (count > 1u) {
+            accum *= base;
+            count -= 1u;
+        }
+        ret accum;
+    }
+}
+
+// Local Variables:
+// mode: rust;
+// fill-column: 78;
+// indent-tabs-mode: nil
+// c-basic-offset: 4
+// buffer-file-coding-system: utf-8-unix
+// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
+// End:
index 57675916f46724f6684af9fa0ea4ddebff4aebc4..b79c09e0ef578fc3f3b69ae93d0ac470380865fd 100644 (file)
@@ -57,9 +57,9 @@ fn convert_whence(seek_style whence) -> int {
 
 state obj FILE_buf_reader(os::libc::FILE f, bool must_close) {
     fn read(uint len) -> vec[u8] {
-        auto buf = _vec::alloc[u8](len);
-        auto read = os::libc::fread(_vec::buf[u8](buf), 1u, len, f);
-        _vec::len_set[u8](buf, read);
+        auto buf = vec::alloc[u8](len);
+        auto read = os::libc::fread(vec::buf[u8](buf), 1u, len, f);
+        vec::len_set[u8](buf, read);
         ret buf;
     }
     fn read_byte() -> int {
@@ -100,7 +100,7 @@ fn read_char() -> char {
         auto c0 = rdr.read_byte();
         if (c0 == -1) {ret -1 as char;} // FIXME will this stay valid?
         auto b0 = c0 as u8;
-        auto w = _str::utf8_char_width(b0);
+        auto w = str::utf8_char_width(b0);
         assert (w > 0u);
         if (w == 1u) {ret b0 as char;}
         auto val = 0u;
@@ -112,7 +112,7 @@ fn read_char() -> char {
             val <<= 6u;
             val += (next & 0x3f) as uint;
         }
-        // See _str::char_at
+        // See str::char_at
         val += ((b0 << ((w + 1u) as u8)) as uint) << ((w - 1u) * 6u - w - 1u);
         ret val as char;
     }
@@ -126,9 +126,9 @@ fn read_line() -> str {
         while (go_on) {
             auto ch = rdr.read_byte();
             if (ch == -1 || ch == 10) {go_on = false;}
-            else {_vec::push[u8](buf, ch as u8);}
+            else {vec::push[u8](buf, ch as u8);}
         }
-        ret _str::unsafe_from_bytes(buf);
+        ret str::unsafe_from_bytes(buf);
     }
     fn read_c_str() -> str {
         let vec[u8] buf = [];
@@ -136,9 +136,9 @@ fn read_c_str() -> str {
         while (go_on) {
             auto ch = rdr.read_byte();
             if (ch < 1) {go_on = false;}
-            else {_vec::push[u8](buf, ch as u8);}
+            else {vec::push[u8](buf, ch as u8);}
         }
-        ret _str::unsafe_from_bytes(buf);
+        ret str::unsafe_from_bytes(buf);
     }
     // FIXME deal with eof?
     fn read_le_uint(uint size) -> uint {
@@ -191,7 +191,7 @@ fn stdin() -> reader {
 }
 
 fn file_reader(str path) -> reader {
-    auto f = os::libc::fopen(_str::buf(path), _str::buf("r"));
+    auto f = os::libc::fopen(str::buf(path), str::buf("r"));
     if (f as uint == 0u) {
         log_err "error opening " + path;
         fail;
@@ -212,17 +212,17 @@ fn new_reader_(buf_reader bufr) -> reader {
 
 state obj byte_buf_reader(byte_buf bbuf) {
     fn read(uint len) -> vec[u8] {
-        auto rest = _vec::len[u8](bbuf.buf) - bbuf.pos;
+        auto rest = vec::len[u8](bbuf.buf) - bbuf.pos;
         auto to_read = len;
         if (rest < to_read) {
             to_read = rest;
         }
-        auto range = _vec::slice[u8](bbuf.buf, bbuf.pos, bbuf.pos + to_read);
+        auto range = vec::slice[u8](bbuf.buf, bbuf.pos, bbuf.pos + to_read);
         bbuf.pos += to_read;
         ret range;
     }
     fn read_byte() -> int {
-        if (bbuf.pos == _vec::len[u8](bbuf.buf)) {ret -1;}
+        if (bbuf.pos == vec::len[u8](bbuf.buf)) {ret -1;}
         auto b = bbuf.buf.(bbuf.pos);
         bbuf.pos += 1u;
         ret b as int;
@@ -234,12 +234,12 @@ fn unread_byte(int byte) {
     }
 
     fn eof() -> bool {
-        ret bbuf.pos == _vec::len[u8](bbuf.buf);
+        ret bbuf.pos == vec::len[u8](bbuf.buf);
     }
 
     fn seek(int offset, seek_style whence) {
         auto pos = bbuf.pos;
-        auto len = _vec::len[u8](bbuf.buf);
+        auto len = vec::len[u8](bbuf.buf);
         bbuf.pos = seek_in_buf(offset, pos, len, whence);
     }
 
@@ -270,8 +270,8 @@ fn new_byte_buf_reader(vec[u8] buf) -> byte_buf_reader {
 
 state obj FILE_writer(os::libc::FILE f, bool must_close) {
     fn write(vec[u8] v) {
-        auto len = _vec::len[u8](v);
-        auto vbuf = _vec::buf[u8](v);
+        auto len = vec::len[u8](v);
+        auto vbuf = vec::buf[u8](v);
         auto nout = os::libc::fwrite(vbuf, len, 1u, f);
         if (nout < 1u) {
             log_err "error dumping buffer";
@@ -293,11 +293,11 @@ fn tell() -> uint {
 
 state obj fd_buf_writer(int fd, bool must_close) {
     fn write(vec[u8] v) {
-        auto len = _vec::len[u8](v);
+        auto len = vec::len[u8](v);
         auto count = 0u;
         auto vbuf;
         while (count < len) {
-            vbuf = _vec::buf_off[u8](v, count);
+            vbuf = vec::buf_off[u8](v, count);
             auto nout = os::libc::write(fd, vbuf, len);
             if (nout < 0) {
                 log_err "error dumping buffer";
@@ -337,7 +337,7 @@ fn file_buf_writer(str path, vec[fileflag] flags) -> buf_writer {
         }
     }
 
-    auto fd = os::libc::open(_str::buf(path),
+    auto fd = os::libc::open(str::buf(path),
                            fflags,
                            os::libc_constants::S_IRUSR() |
                            os::libc_constants::S_IWUSR());
@@ -390,17 +390,17 @@ fn get_buf_writer() -> buf_writer {
         ret out;
     }
     fn write_str(str s) {
-        out.write(_str::bytes(s));
+        out.write(str::bytes(s));
     }
     fn write_char(char ch) {
         // FIXME needlessly consy
-        out.write(_str::bytes(_str::from_char(ch)));
+        out.write(str::bytes(str::from_char(ch)));
     }
     fn write_int(int n) {
-        out.write(_str::bytes(_int::to_str(n, 10u)));
+        out.write(str::bytes(int::to_str(n, 10u)));
     }
     fn write_uint(uint n) {
-        out.write(_str::bytes(_uint::to_str(n, 10u)));
+        out.write(str::bytes(uint::to_str(n, 10u)));
     }
     fn write_bytes(vec[u8] bytes) {
         out.write(bytes);
@@ -427,7 +427,7 @@ fn file_writer(str path, vec[fileflag] flags) -> writer {
 
 // FIXME: fileflags
 fn buffered_file_buf_writer(str path) -> buf_writer {
-    auto f = os::libc::fopen(_str::buf(path), _str::buf("w"));
+    auto f = os::libc::fopen(str::buf(path), str::buf("w"));
     if (f as uint == 0u) {
         log_err "error opening " + path;
         fail;
@@ -451,21 +451,21 @@ fn stdout() -> writer {
 state obj byte_buf_writer(mutable_byte_buf buf) {
     fn write(vec[u8] v) {
         // Fast path.
-        if (buf.pos == _vec::len(buf.buf)) {
+        if (buf.pos == vec::len(buf.buf)) {
             // FIXME: Fix our type system. There's no reason you shouldn't be
             // able to add a mutable vector to an immutable one.
-            auto mv = _vec::rustrt::unsafe_vec_to_mut[u8](v);
+            auto mv = vec::rustrt::unsafe_vec_to_mut[u8](v);
             buf.buf += mv;
-            buf.pos += _vec::len[u8](v);
+            buf.pos += vec::len[u8](v);
             ret;
         }
 
         // FIXME: Optimize: These should be unique pointers.
-        auto vlen = _vec::len[u8](v);
+        auto vlen = vec::len[u8](v);
         auto vpos = 0u;
         while (vpos < vlen) {
             auto b = v.(vpos);
-            if (buf.pos == _vec::len(buf.buf)) {
+            if (buf.pos == vec::len(buf.buf)) {
                 buf.buf += [mutable b];
             } else {
                 buf.buf.(buf.pos) = b;
@@ -477,7 +477,7 @@ fn write(vec[u8] v) {
 
     fn seek(int offset, seek_style whence) {
         auto pos = buf.pos;
-        auto len = _vec::len(buf.buf);
+        auto len = vec::len(buf.buf);
         buf.pos = seek_in_buf(offset, pos, len, whence);
     }
 
@@ -487,12 +487,12 @@ fn seek(int offset, seek_style whence) {
 fn string_writer() -> str_writer {
     // FIXME: yikes, this is bad. Needs fixing of mutable syntax.
     let vec[mutable u8] b = [mutable 0u8];
-    _vec::pop(b);
+    vec::pop(b);
 
     let mutable_byte_buf buf = @rec(mutable buf = b, mutable pos = 0u);
     state obj str_writer_wrap(writer wr, mutable_byte_buf buf) {
         fn get_writer() -> writer {ret wr;}
-        fn get_str() -> str {ret _str::unsafe_from_bytes(buf.buf);}
+        fn get_str() -> str {ret str::unsafe_from_bytes(buf.buf);}
     }
     ret str_writer_wrap(new_writer(byte_buf_writer(buf)), buf);
 }
index f014c9c0df2f1dc7fb86163d227e0753c7123619..73e4e948ffab183696b7d331dc6a9fa42a72d23a 100644 (file)
@@ -1,5 +1,5 @@
-import _str::sbuf;
-import _vec::vbuf;
+import str::sbuf;
+import vec::vbuf;
 
 // FIXME Somehow merge stuff duplicated here and macosx_os.rs. Made difficult
 // by https://github.com/graydon/rust/issues#issue/268
@@ -66,17 +66,17 @@ fn dylib_filename(str base) -> str {
 
 fn pipe() -> tup(int, int) {
     let vec[mutable int] fds = [mutable 0, 0];
-    assert (os::libc::pipe(_vec::buf(fds)) == 0);
+    assert (os::libc::pipe(vec::buf(fds)) == 0);
     ret tup(fds.(0), fds.(1));
 }
 
 fn fd_FILE(int fd) -> libc::FILE {
-    ret libc::fdopen(fd, _str::buf("r"));
+    ret libc::fdopen(fd, str::buf("r"));
 }
 
 fn waitpid(int pid) -> int {
     let vec[mutable int] status = [mutable 0];
-    assert (os::libc::waitpid(pid, _vec::buf(status), 0) != -1);
+    assert (os::libc::waitpid(pid, vec::buf(status), 0) != -1);
     ret status.(0);
 }
 
index 0e37051278b97d72939127e50a973193398fa2c3..27fd762620de0697c3f56acf7ff3565557a0e2a5 100644 (file)
@@ -1,5 +1,5 @@
-import _str::sbuf;
-import _vec::vbuf;
+import str::sbuf;
+import vec::vbuf;
 
 native mod libc = "libc.dylib" {
 
@@ -63,17 +63,17 @@ fn dylib_filename(str base) -> str {
 
 fn pipe() -> tup(int, int) {
     let vec[mutable int] fds = [mutable 0, 0];
-    assert (os::libc::pipe(_vec::buf(fds)) == 0);
+    assert (os::libc::pipe(vec::buf(fds)) == 0);
     ret tup(fds.(0), fds.(1));
 }
 
 fn fd_FILE(int fd) -> libc::FILE {
-    ret libc::fdopen(fd, _str::buf("r"));
+    ret libc::fdopen(fd, str::buf("r"));
 }
 
 fn waitpid(int pid) -> int {
     let vec[mutable int] status = [mutable 0];
-    assert (os::libc::waitpid(pid, _vec::buf(status), 0) != -1);
+    assert (os::libc::waitpid(pid, vec::buf(status), 0) != -1);
     ret status.(0);
 }
 
index 5483dccf3420a714ea80eb595f95b2db641c98b8..8e63369cebb606db1c9e678786ceee3a08a6294c 100644 (file)
@@ -29,7 +29,7 @@ fn mk_hashmap[K, V](&hashfn[K] hasher, &eqfn[K] eqer) -> hashmap[K, V] {
     }
 
     fn make_buckets[K, V](uint nbkts) -> vec[mutable bucket[K, V]] {
-        ret _vec::init_elt_mut[bucket[K, V]](nil[K, V], nbkts);
+        ret vec::init_elt_mut[bucket[K, V]](nil[K, V], nbkts);
     }
 
     // Derive two hash functions from the one given by taking the upper
@@ -148,7 +148,7 @@ fn insert(&K key, &V val) -> bool {
                 let util::rational load = rec(num=(nelts + 1u) as int,
                                              den=nbkts as int);
                 if (!util::rational_leq(load, lf)) {
-                    let uint nnewbkts = _uint::next_power_of_two(nbkts + 1u);
+                    let uint nnewbkts = uint::next_power_of_two(nbkts + 1u);
                     let vec[mutable bucket[K, V]] newbkts =
                         make_buckets[K, V](nnewbkts);
                     rehash[K, V](hasher, eqer, bkts, nbkts,
index 7a0606ec89151fd5fcf12eabd3d0b1ab9f2d1f53..4c90f02b312174ffd51be3752e7af5d88ff9aef7 100644 (file)
@@ -4,7 +4,7 @@
 
 fn list_dir(str path) -> vec[str] {
   // TODO ensure this is always closed
-  auto dir = os::libc::opendir(_str::buf(path));
+  auto dir = os::libc::opendir(str::buf(path));
   assert (dir as uint != 0u);
   let vec[str] result = [];
   while (true) {
@@ -13,7 +13,7 @@ fn list_dir(str path) -> vec[str] {
         os::libc::closedir(dir);
         ret result;
     }
-    _vec::push[str](result, rustrt::rust_dirent_filename(ent));
+    vec::push[str](result, rustrt::rust_dirent_filename(ent));
   }
   os::libc::closedir(dir);
   ret result;
index 06fe23596c061d83f624d2d557f3d365c1172680..b4f2e5c9d1b6c4f4f088521908bd27a7f7ab5a23 100644 (file)
@@ -1,21 +1,21 @@
-import _str::sbuf;
-import _vec::vbuf;
+import str::sbuf;
+import vec::vbuf;
 
 native "rust" mod rustrt {
     fn rust_run_program(vbuf argv, int in_fd, int out_fd, int err_fd) -> int;
 }
 
 fn arg_vec(str prog, vec[str] args) -> vec[sbuf] {
-    auto argptrs = [_str::buf(prog)];
+    auto argptrs = [str::buf(prog)];
     for (str arg in args) {
-        _vec::push[sbuf](argptrs, _str::buf(arg));
+        vec::push[sbuf](argptrs, str::buf(arg));
     }
-    _vec::push[sbuf](argptrs, 0 as sbuf);
+    vec::push[sbuf](argptrs, 0 as sbuf);
     ret argptrs;
 }
 
 fn run_program(str prog, vec[str] args) -> int {
-    auto pid = rustrt::rust_run_program(_vec::buf[sbuf](arg_vec(prog, args)),
+    auto pid = rustrt::rust_run_program(vec::buf[sbuf](arg_vec(prog, args)),
                                        0, 0, 0);
     ret os::waitpid(pid);
 }
@@ -33,7 +33,7 @@ fn start_program(str prog, vec[str] args) -> @program {
     auto pipe_input = os::pipe();
     auto pipe_output = os::pipe();
     auto pid = rustrt::rust_run_program
-        (_vec::buf[sbuf](arg_vec(prog, args)),
+        (vec::buf[sbuf](arg_vec(prog, args)),
          pipe_input._0, pipe_output._1, 0);
     if (pid == -1) {fail;}
     os::libc::close(pipe_input._0);
@@ -80,7 +80,7 @@ fn program_output(str prog, vec[str] args)
     auto buf = "";
     while (!out.eof()) {
         auto bytes = out.read_bytes(4096u);
-        buf += _str::unsafe_from_bytes(bytes);
+        buf += str::unsafe_from_bytes(bytes);
     }
     ret rec(status=pr.finish(), out=buf);
 }
index 4ae004079c36eca0b471d1f7b3ac8bb8dee7c1c7..c16b78dc69dd8032d1e0e7bd3ee959ab563a25e8 100644 (file)
@@ -74,8 +74,8 @@ fn add_input(&sha1state st, &vec[u8] msg) {
     fn process_msg_block(&sha1state st) {
 
         // FIXME: Make precondition
-        assert (_vec::len(st.h) == digest_buf_len);
-        assert (_vec::len(st.work_buf) == work_buf_len);
+        assert (vec::len(st.h) == digest_buf_len);
+        assert (vec::len(st.work_buf) == work_buf_len);
 
         let int t; // Loop counter
         auto w = st.work_buf;
@@ -196,7 +196,7 @@ fn mk_result(&sha1state st) -> vec[u8] {
      */
     fn pad_msg(&sha1state st) {
         // FIXME: Should be a precondition
-        assert (_vec::len(st.msg_block) == msg_block_len);
+        assert (vec::len(st.msg_block) == msg_block_len);
 
         /*
          * Check to see if the current message block is too small to hold
@@ -240,7 +240,7 @@ fn pad_msg(&sha1state st) {
 
         fn reset() {
             // FIXME: Should be typestate precondition
-            assert (_vec::len(st.h) == digest_buf_len);
+            assert (vec::len(st.h) == digest_buf_len);
 
             st.len_low = 0u32;
             st.len_high = 0u32;
@@ -260,7 +260,7 @@ fn input(&vec[u8] msg) {
         }
 
         fn input_str(&str msg) {
-            add_input(st, _str::bytes(msg));
+            add_input(st, str::bytes(msg));
         }
 
         fn result() -> vec[u8] {
@@ -271,19 +271,19 @@ fn result_str() -> str {
             auto r = mk_result(st);
             auto s = "";
             for (u8 b in r) {
-                s += _uint::to_str(b as uint, 16u);
+                s += uint::to_str(b as uint, 16u);
             }
             ret s;
         }
     }
 
-    auto st = rec(h = _vec::init_elt_mut[u32](0u32, digest_buf_len),
+    auto st = rec(h = vec::init_elt_mut[u32](0u32, digest_buf_len),
                   mutable len_low = 0u32,
                   mutable len_high = 0u32,
-                  msg_block = _vec::init_elt_mut[u8](0u8, msg_block_len),
+                  msg_block = vec::init_elt_mut[u8](0u8, msg_block_len),
                   mutable msg_block_idx = 0u,
                   mutable computed = false,
-                  work_buf = _vec::init_elt_mut[u32](0u32, work_buf_len));
+                  work_buf = vec::init_elt_mut[u32](0u32, work_buf_len));
     auto sh = sha1(st);
     sh.reset();
     ret sh;
index f74a7d7df71c7155353fc8a76b0c3d170bd2dcb9..92f03903a81879525bc7a7bfe53fd3368993f97f 100644 (file)
@@ -1,5 +1,5 @@
-import _vec::len;
-import _vec::slice;
+import vec::len;
+import vec::slice;
 
 type lteq[T] = fn(&T a, &T b) -> bool;
 
index 6e2650e6b8a153f757845a21f621d99fbc44d6ff..c0839ce90980d819e8d518fcf10b969914c69034 100644 (file)
@@ -6,11 +6,11 @@ meta (name = "std",
 
 // Built-in types support modules.
 
-mod _int;
-mod _uint;
-mod _u8;
-mod _vec;
-mod _str;
+mod int;
+mod uint;
+mod u8;
+mod vec;
+mod str;
 
 // General io and system-services modules.
 
@@ -29,13 +29,13 @@ auth io = unsafe;
 auth fs = unsafe;
 auth os_fs = unsafe;
 auth run = unsafe;
-auth _str = unsafe;
-auth _vec = unsafe;
+auth str = unsafe;
+auth vec = unsafe;
 auth _task = unsafe;
 
 auth dbg = unsafe;
 
-auth _uint::next_power_of_two = unsafe;
+auth uint::next_power_of_two = unsafe;
 auth map::mk_hashmap = unsafe;
 auth rand::mk_rng = unsafe;
 
diff --git a/src/lib/str.rs b/src/lib/str.rs
new file mode 100644 (file)
index 0000000..27049c8
--- /dev/null
@@ -0,0 +1,490 @@
+import rustrt::sbuf;
+
+import vec::rustrt::vbuf;
+
+native "rust" mod rustrt {
+    type sbuf;
+    fn str_buf(str s) -> sbuf;
+    fn str_vec(str s) -> vec[u8];
+    fn str_byte_len(str s) -> uint;
+    fn str_alloc(uint n_bytes) -> str;
+    fn str_from_vec(vec[mutable? u8] b) -> str;
+    fn str_from_cstr(sbuf cstr) -> str;
+    fn str_from_buf(sbuf buf, uint len) -> str;
+    fn str_push_byte(str s, uint byte) -> str;
+    fn str_slice(str s, uint begin, uint end) -> str;
+    fn refcount[T](str s) -> uint;
+}
+
+fn eq(&str a, &str b) -> bool {
+    let uint i = byte_len(a);
+    if (byte_len(b) != i) {
+        ret false;
+    }
+    while (i > 0u) {
+        i -= 1u;
+        auto cha = a.(i);
+        auto chb = b.(i);
+        if (cha != chb) {
+            ret false;
+        }
+    }
+    ret true;
+}
+
+fn lteq(&str a, &str b) -> bool {
+    let uint i = byte_len(a);
+    let uint j = byte_len(b);
+    let uint n = i;
+    if (j < n) {
+        n = j;
+    }
+
+    let uint x = 0u;
+    while (x < n) {
+        auto cha = a.(x);
+        auto chb = b.(x);
+        if (cha < chb) {
+            ret true;
+        }
+        else if (cha > chb) {
+            ret false;
+        }
+        x += 1u;
+    }
+
+    ret i <= j;
+}
+
+
+fn hash(&str s) -> uint {
+    // djb hash.
+    // FIXME: replace with murmur.
+    let uint u = 5381u;
+    for (u8 c in s) {
+        u *= 33u;
+        u += (c as uint);
+    }
+    ret u;
+}
+
+// UTF-8 tags and ranges
+const u8 tag_cont_u8 = 0x80_u8;
+const uint tag_cont = 0x80_u;
+const uint max_one_b = 0x80_u;
+const uint tag_two_b = 0xc0_u;
+const uint max_two_b = 0x800_u;
+const uint tag_three_b = 0xe0_u;
+const uint max_three_b = 0x10000_u;
+const uint tag_four_b = 0xf0_u;
+const uint max_four_b = 0x200000_u;
+const uint tag_five_b = 0xf8_u;
+const uint max_five_b = 0x4000000_u;
+const uint tag_six_b = 0xfc_u;
+
+fn is_utf8(vec[u8] v) -> bool {
+    auto i = 0u;
+    auto total = vec::len[u8](v);
+    while (i < total) {
+        auto chsize = utf8_char_width(v.(i));
+        if (chsize == 0u) {ret false;}
+        if (i + chsize > total) {ret false;}
+        i += 1u;
+        while (chsize > 1u) {
+            if (v.(i) & 0xc0_u8 != tag_cont_u8) {ret false;}
+            i += 1u;
+            chsize -= 1u;
+        }
+    }
+    ret true;
+}
+
+fn is_ascii(str s) -> bool {
+    let uint i = byte_len(s);
+    while (i > 0u) {
+        i -= 1u;
+        if ((s.(i) & 0x80_u8) != 0u8) {
+            ret false;
+        }
+    }
+    ret true;
+}
+
+fn alloc(uint n_bytes) -> str {
+    ret rustrt::str_alloc(n_bytes);
+}
+
+// Returns the number of bytes (a.k.a. UTF-8 code units) in s.
+// Contrast with a function that would return the number of code
+// points (char's), combining character sequences, words, etc.  See
+// http://icu-project.org/apiref/icu4c/classBreakIterator.html for a
+// way to implement those.
+fn byte_len(str s) -> uint {
+    ret rustrt::str_byte_len(s);
+}
+
+fn buf(str s) -> sbuf {
+    ret rustrt::str_buf(s);
+}
+
+fn bytes(str s) -> vec[u8] {
+    ret rustrt::str_vec(s);
+}
+
+fn from_bytes(vec[u8] v) : is_utf8(v) -> str {
+    ret rustrt::str_from_vec(v);
+}
+
+// FIXME temp thing
+fn unsafe_from_bytes(vec[mutable? u8] v) -> str {
+    ret rustrt::str_from_vec(v);
+}
+
+fn unsafe_from_byte(u8 u) -> str {
+    ret rustrt::str_from_vec([u]);
+}
+
+fn str_from_cstr(sbuf cstr) -> str {
+    ret rustrt::str_from_cstr(cstr);
+}
+
+fn str_from_buf(sbuf buf, uint len) -> str {
+    ret rustrt::str_from_buf(buf, len);
+}
+
+fn push_utf8_bytes(&mutable str s, char ch) {
+    auto code = ch as uint;
+    if (code < max_one_b) {
+        s = rustrt::str_push_byte(s, code);
+    } else if (code < max_two_b) {
+        s = rustrt::str_push_byte(s, ((code >> 6u) & 0x1f_u) | tag_two_b);
+        s = rustrt::str_push_byte(s, (code & 0x3f_u) | tag_cont);
+    } else if (code < max_three_b) {
+        s = rustrt::str_push_byte(s, ((code >> 12u) & 0x0f_u) | tag_three_b);
+        s = rustrt::str_push_byte(s, ((code >> 6u) & 0x3f_u) | tag_cont);
+        s = rustrt::str_push_byte(s, (code & 0x3f_u) | tag_cont);
+    } else if (code < max_four_b) {
+        s = rustrt::str_push_byte(s, ((code >> 18u) & 0x07_u) | tag_four_b);
+        s = rustrt::str_push_byte(s, ((code >> 12u) & 0x3f_u) | tag_cont);
+        s = rustrt::str_push_byte(s, ((code >> 6u) & 0x3f_u) | tag_cont);
+        s = rustrt::str_push_byte(s, (code & 0x3f_u) | tag_cont);
+    } else if (code < max_five_b) {
+        s = rustrt::str_push_byte(s, ((code >> 24u) & 0x03_u) | tag_five_b);
+        s = rustrt::str_push_byte(s, ((code >> 18u) & 0x3f_u) | tag_cont);
+        s = rustrt::str_push_byte(s, ((code >> 12u) & 0x3f_u) | tag_cont);
+        s = rustrt::str_push_byte(s, ((code >> 6u) & 0x3f_u) | tag_cont);
+        s = rustrt::str_push_byte(s, (code & 0x3f_u) | tag_cont);
+    } else {
+        s = rustrt::str_push_byte(s, ((code >> 30u) & 0x01_u) | tag_six_b);
+        s = rustrt::str_push_byte(s, ((code >> 24u) & 0x3f_u) | tag_cont);
+        s = rustrt::str_push_byte(s, ((code >> 18u) & 0x3f_u) | tag_cont);
+        s = rustrt::str_push_byte(s, ((code >> 12u) & 0x3f_u) | tag_cont);
+        s = rustrt::str_push_byte(s, ((code >> 6u) & 0x3f_u) | tag_cont);
+        s = rustrt::str_push_byte(s, (code & 0x3f_u) | tag_cont);
+    }
+}
+
+fn from_char(char ch) -> str {
+    auto buf = "";
+    push_utf8_bytes(buf, ch);
+    ret buf;
+}
+
+fn from_chars(vec[char] chs) -> str {
+    auto buf = "";
+    for (char ch in chs) {push_utf8_bytes(buf, ch);}
+    ret buf;
+}
+
+fn utf8_char_width(u8 b) -> uint {
+    let uint byte = b as uint;
+    if (byte < 0x80_u) {ret 1u;}
+    if (byte < 0xc0_u) {ret 0u;} // Not a valid start byte
+    if (byte < 0xe0_u) {ret 2u;}
+    if (byte < 0xf0_u) {ret 3u;}
+    if (byte < 0xf8_u) {ret 4u;}
+    if (byte < 0xfc_u) {ret 5u;}
+    ret 6u;
+}
+
+fn char_range_at(str s, uint i) -> tup(char, uint) {
+    auto b0 = s.(i);
+    auto w = utf8_char_width(b0);
+    assert (w != 0u);
+    if (w == 1u) {ret tup(b0 as char, i + 1u);}
+    auto val = 0u;
+    auto end = i + w;
+    i += 1u;
+    while (i < end) {
+        auto byte = s.(i);
+        assert (byte & 0xc0_u8 == tag_cont_u8);
+        val <<= 6u;
+        val += (byte & 0x3f_u8) as uint;
+        i += 1u;
+    }
+    // Clunky way to get the right bits from the first byte. Uses two shifts,
+    // the first to clip off the marker bits at the left of the byte, and then
+    // a second (as uint) to get it to the right position.
+    val += ((b0 << ((w + 1u) as u8)) as uint) << ((w - 1u) * 6u - w - 1u);
+    ret tup(val as char, i);
+}
+
+fn char_at(str s, uint i) -> char {
+    ret char_range_at(s, i)._0;
+}
+
+fn char_len(str s) -> uint {
+    auto i = 0u;
+    auto len = 0u;
+    auto total = byte_len(s);
+    while (i < total) {
+        auto chsize = utf8_char_width(s.(i));
+        assert (chsize > 0u);
+        len += 1u;
+        i += chsize;
+    }
+    assert (i == total);
+    ret len;
+}
+
+fn to_chars(str s) -> vec[char] {
+    let vec[char] buf = [];
+    auto i = 0u;
+    auto len = byte_len(s);
+    while (i < len) {
+        auto cur = char_range_at(s, i);
+        vec::push[char](buf, cur._0);
+        i = cur._1;
+    }
+    ret buf;
+}
+
+fn push_char(&mutable str s, char ch) {
+    s += from_char(ch);
+}
+
+fn pop_char(&mutable str s) -> char {
+    auto end = byte_len(s);
+    while (end > 0u && s.(end - 1u) & 0xc0_u8 == tag_cont_u8) {end -= 1u;}
+    assert (end > 0u);
+    auto ch = char_at(s, end - 1u);
+    s = substr(s, 0u, end - 1u);
+    ret ch;
+}
+
+fn shift_char(&mutable str s) -> char {
+    auto r = char_range_at(s, 0u);
+    s = substr(s, r._1, byte_len(s) - r._1);
+    ret r._0;
+}
+
+fn unshift_char(&mutable str s, char ch) {
+    // Workaround for rustboot order-of-evaluation issue -- if I put s
+    // directly after the +, the string ends up containing (only) the
+    // character, twice.
+    auto x = s;
+    s = from_char(ch) + x;
+}
+
+fn refcount(str s) -> uint {
+    auto r = rustrt::refcount[u8](s);
+    if (r == dbg::const_refcount) {
+        ret r;
+    } else {
+        // -1 because calling this function incremented the refcount.
+        ret  r - 1u;
+    }
+}
+
+
+// Standard bits from the world of string libraries.
+
+fn index(str s, u8 c) -> int {
+    let int i = 0;
+    for (u8 k in s) {
+        if (k == c) {
+            ret i;
+        }
+        i += 1;
+    }
+    ret -1;
+}
+
+fn rindex(str s, u8 c) -> int {
+    let int n = str::byte_len(s) as int;
+    while (n >= 0) {
+        if (s.(n) == c) {
+            ret n;
+        }
+        n -= 1;
+    }
+    ret n;
+}
+
+fn find(str haystack, str needle) -> int {
+
+    let int haystack_len = byte_len(haystack) as int;
+    let int needle_len = byte_len(needle) as int;
+
+    if (needle_len == 0) {
+        ret 0;
+    }
+
+    fn match_at(&str haystack,
+                &str needle,
+                int i) -> bool {
+        let int j = i;
+        for (u8 c in needle) {
+            if (haystack.(j) != c) {
+                ret false;
+            }
+            j += 1;
+        }
+        ret true;
+    }
+
+    let int i = 0;
+    while (i <= haystack_len - needle_len) {
+        if (match_at(haystack, needle, i)) {
+            ret i;
+        }
+        i += 1;
+    }
+    ret  -1;
+}
+
+fn starts_with(str haystack, str needle) -> bool {
+    let uint haystack_len = byte_len(haystack);
+    let uint needle_len = byte_len(needle);
+    if (needle_len == 0u) {
+        ret true;
+    }
+    if (needle_len > haystack_len) {
+        ret false;
+    }
+    ret eq(substr(haystack, 0u, needle_len), needle);
+}
+
+fn ends_with(str haystack, str needle) -> bool {
+    let uint haystack_len = byte_len(haystack);
+    let uint needle_len = byte_len(needle);
+    if (needle_len == 0u) {
+        ret true;
+    }
+    if (needle_len > haystack_len) {
+        ret false;
+    }
+    ret eq(substr(haystack,
+                  haystack_len - needle_len,
+                  needle_len),
+           needle);
+}
+
+fn substr(str s, uint begin, uint len) -> str {
+    ret slice(s, begin, begin + len);
+}
+
+fn slice(str s, uint begin, uint end) -> str {
+    // FIXME: Typestate precondition
+    assert (begin <= end);
+    assert (end <= str::byte_len(s));
+    ret rustrt::str_slice(s, begin, end);
+}
+
+fn shift_byte(&mutable str s) -> u8 {
+    auto len = byte_len(s);
+    assert (len > 0u);
+    auto b = s.(0);
+    s = substr(s, 1u, len - 1u);
+    ret b;
+}
+
+fn pop_byte(&mutable str s) -> u8 {
+    auto len = byte_len(s);
+    assert (len > 0u);
+    auto b = s.(len - 1u);
+    s = substr(s, 0u, len - 1u);
+    ret b;
+}
+
+fn push_byte(&mutable str s, u8 b) {
+    s = rustrt::str_push_byte(s, b as uint);
+}
+
+fn unshift_byte(&mutable str s, u8 b) {
+    auto res = alloc(byte_len(s) + 1u);
+    res += unsafe_from_byte(b);
+    res += s;
+    s = res;
+}
+
+fn split(str s, u8 sep) -> vec[str] {
+    let vec[str] v = [];
+    let str accum = "";
+    let bool ends_with_sep = false;
+    for (u8 c in s) {
+        if (c == sep) {
+            v += [accum];
+            accum = "";
+            ends_with_sep = true;
+        } else {
+            accum += unsafe_from_byte(c);
+            ends_with_sep = false;
+        }
+    }
+    if (str::byte_len(accum) != 0u ||
+        ends_with_sep) {
+        v += [accum];
+    }
+    ret v;
+}
+
+fn concat(vec[str] v) -> str {
+    let str s = "";
+    for (str ss in v) {
+        s += ss;
+    }
+    ret s;
+}
+
+fn connect(vec[str] v, str sep) -> str {
+    let str s = "";
+    let bool first = true;
+    for (str ss in v) {
+        if (first) {
+            first = false;
+        } else {
+            s += sep;
+        }
+        s += ss;
+    }
+    ret s;
+}
+
+// FIXME: This only handles ASCII
+fn to_upper(str s) -> str {
+    auto outstr = "";
+    auto ascii_a = 'a' as u8;
+    auto ascii_z = 'z' as u8;
+    auto diff = 32u8;
+    for (u8 byte in s) {
+        auto next;
+        if (ascii_a <= byte && byte <= ascii_z) {
+            next = byte - diff;
+        } else {
+            next = byte;
+        }
+        push_byte(outstr, next);
+    }
+    ret outstr;
+}
+
+
+// Local Variables:
+// mode: rust;
+// fill-column: 78;
+// indent-tabs-mode: nil
+// c-basic-offset: 4
+// buffer-file-coding-system: utf-8-unix
+// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
+// End:
diff --git a/src/lib/u8.rs b/src/lib/u8.rs
new file mode 100644 (file)
index 0000000..e094e58
--- /dev/null
@@ -0,0 +1,28 @@
+fn add(u8 x, u8 y) -> u8 { ret x + y; }
+fn sub(u8 x, u8 y) -> u8 { ret x - y; }
+fn mul(u8 x, u8 y) -> u8 { ret x * y; }
+fn div(u8 x, u8 y) -> u8 { ret x / y; }
+fn rem(u8 x, u8 y) -> u8 { ret x % y; }
+
+fn lt(u8 x, u8 y) -> bool { ret x < y; }
+fn le(u8 x, u8 y) -> bool { ret x <= y; }
+fn eq(u8 x, u8 y) -> bool { ret x == y; }
+fn ne(u8 x, u8 y) -> bool { ret x != y; }
+fn ge(u8 x, u8 y) -> bool { ret x >= y; }
+fn gt(u8 x, u8 y) -> bool { ret x > y; }
+
+iter range(u8 lo, u8 hi) -> u8 {
+    while (lo < hi) {
+        put lo;
+        lo += 1u8;
+    }
+}
+
+// Local Variables:
+// mode: rust;
+// fill-column: 78;
+// indent-tabs-mode: nil
+// c-basic-offset: 4
+// buffer-file-coding-system: utf-8-unix
+// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
+// End:
index c7790049be22fb87b2ba1eed840e86f31d95cc4a..316bd589ee738aee1342520fd550cece80b54beb 100644 (file)
@@ -8,12 +8,12 @@
 
 fn make() -> ufind {
     let vec[mutable node] v = [mutable none[uint]];
-    _vec::pop(v);  // FIXME: botch
+    vec::pop(v);  // FIXME: botch
     ret rec(mutable nodes=v);
 }
 
 fn make_set(&ufind ufnd) -> uint {
-    auto idx = _vec::len(ufnd.nodes);
+    auto idx = vec::len(ufnd.nodes);
     ufnd.nodes += [mutable none[uint]];
     ret idx;
 }
diff --git a/src/lib/uint.rs b/src/lib/uint.rs
new file mode 100644 (file)
index 0000000..f4beb59
--- /dev/null
@@ -0,0 +1,107 @@
+
+fn add(uint x, uint y) -> uint { ret x + y; }
+fn sub(uint x, uint y) -> uint { ret x - y; }
+fn mul(uint x, uint y) -> uint { ret x * y; }
+fn div(uint x, uint y) -> uint { ret x / y; }
+fn rem(uint x, uint y) -> uint { ret x % y; }
+
+fn lt(uint x, uint y) -> bool { ret x < y; }
+fn le(uint x, uint y) -> bool { ret x <= y; }
+fn eq(uint x, uint y) -> bool { ret x == y; }
+fn ne(uint x, uint y) -> bool { ret x != y; }
+fn ge(uint x, uint y) -> bool { ret x >= y; }
+fn gt(uint x, uint y) -> bool { ret x > y; }
+
+iter range(uint lo, uint hi) -> uint {
+    auto lo_ = lo;
+    while (lo_ < hi) {
+        put lo_;
+        lo_ += 1u;
+    }
+}
+
+fn next_power_of_two(uint n) -> uint {
+    // FIXME change |* uint(4)| below to |* uint(8) / uint(2)| and watch the
+    // world explode.
+    let uint halfbits = sys::rustrt::size_of[uint]() * 4u;
+    let uint tmp = n - 1u;
+    let uint shift = 1u;
+    while (shift <= halfbits) {
+        tmp |= tmp >> shift;
+        shift <<= 1u;
+    }
+    ret tmp + 1u;
+}
+
+fn parse_buf(vec[u8] buf, uint radix) -> uint {
+    if (vec::len[u8](buf) == 0u) {
+        log_err "parse_buf(): buf is empty";
+        fail;
+    }
+
+    auto i = vec::len[u8](buf) - 1u;
+    auto power = 1u;
+    auto n = 0u;
+    while (true) {
+        n += (((buf.(i)) - ('0' as u8)) as uint) * power;
+        power *= radix;
+        if (i == 0u) { ret n; }
+        i -= 1u;
+    }
+
+    fail;
+}
+
+fn to_str(uint num, uint radix) -> str
+{
+    auto n = num;
+
+    assert (0u < radix && radix <= 16u);
+    fn digit(uint n) -> char {
+        alt (n) {
+            case (0u) { ret '0'; }
+            case (1u) { ret '1'; }
+            case (2u) { ret '2'; }
+            case (3u) { ret '3'; }
+            case (4u) { ret '4'; }
+            case (5u) { ret '5'; }
+            case (6u) { ret '6'; }
+            case (7u) { ret '7'; }
+            case (8u) { ret '8'; }
+            case (9u) { ret '9'; }
+            case (10u) { ret 'a'; }
+            case (11u) { ret 'b'; }
+            case (12u) { ret 'c'; }
+            case (13u) { ret 'd'; }
+            case (14u) { ret 'e'; }
+            case (15u) { ret 'f'; }
+        }
+        fail;
+    }
+
+    if (n == 0u) { ret "0"; }
+
+    let str s = "";
+    while (n != 0u) {
+        s += str::unsafe_from_byte(digit(n % radix) as u8);
+        n /= radix;
+    }
+
+    let str s1 = "";
+    let uint len = str::byte_len(s);
+    while (len != 0u) {
+        len -= 1u;
+        s1 += str::unsafe_from_byte(s.(len));
+    }
+    ret s1;
+
+}
+
+// Local Variables:
+// mode: rust;
+// fill-column: 78;
+// indent-tabs-mode: nil
+// c-basic-offset: 4
+// buffer-file-coding-system: utf-8-unix
+// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
+// End:
index b8d8ed6587d79eee01c4081590108161a32b65f6..f075b97e7f88315d0f9a2529816f0b150f293c93 100644 (file)
@@ -4,7 +4,7 @@ fn id[T](&T x) -> T {
 
 /* FIXME (issue #141):  See test/run-pass/constrained-type.rs.  Uncomment
  * the constraint once fixed. */
-type rational = rec(int num, int den); // : _int::positive(*.den);
+type rational = rec(int num, int den); // : int::positive(*.den);
 
 fn rational_leq(&rational x, &rational y) -> bool {
     // NB: Uses the fact that rationals have positive denominators WLOG:
diff --git a/src/lib/vec.rs b/src/lib/vec.rs
new file mode 100644 (file)
index 0000000..f251225
--- /dev/null
@@ -0,0 +1,318 @@
+import option::none;
+import option::some;
+import util::orb;
+
+type vbuf = rustrt::vbuf;
+
+type operator2[T,U,V] = fn(&T, &U) -> V;
+
+type array[T] = vec[mutable? T];
+
+native "rust" mod rustrt {
+    type vbuf;
+
+    fn vec_buf[T](vec[T] v, uint offset) -> vbuf;
+
+    fn vec_len[T](vec[T] v) -> uint;
+    /**
+     * Sometimes we modify the vec internal data via vec_buf and need to
+     * update the vec's fill length accordingly.
+     */
+    fn vec_len_set[T](vec[T] v, uint n);
+
+    /**
+     * The T in vec_alloc[T, U] is the type of the vec to allocate.  The
+     * U is the type of an element in the vec.  So to allocate a vec[U] we
+     * want to invoke this as vec_alloc[vec[U], U].
+     */
+    fn vec_alloc[T, U](uint n_elts) -> vec[U];
+    fn vec_alloc_mut[T, U](uint n_elts) -> vec[mutable U];
+
+    fn refcount[T](vec[T] v) -> uint;
+
+    fn vec_print_debug_info[T](vec[T] v);
+
+    fn vec_from_vbuf[T](vbuf v, uint n_elts) -> vec[T];
+
+    fn unsafe_vec_to_mut[T](vec[T] v) -> vec[mutable T];
+}
+
+fn alloc[T](uint n_elts) -> vec[T] {
+    ret rustrt::vec_alloc[vec[T], T](n_elts);
+}
+
+fn alloc_mut[T](uint n_elts) -> vec[mutable T] {
+    ret rustrt::vec_alloc_mut[vec[mutable T], T](n_elts);
+}
+
+fn refcount[T](array[T] v) -> uint {
+    auto r = rustrt::refcount[T](v);
+    if (r == dbg::const_refcount) {
+        ret r;
+    } else {
+        // -1 because calling this function incremented the refcount.
+        ret  r - 1u;
+    }
+}
+
+fn vec_from_vbuf[T](vbuf v, uint n_elts) -> vec[T] {
+    ret rustrt::vec_from_vbuf[T](v, n_elts);
+}
+
+// FIXME: Remove me; this is a botch to get around rustboot's bad typechecker.
+fn empty[T]() -> vec[T] {
+    ret alloc[T](0u);
+}
+
+// FIXME: Remove me; this is a botch to get around rustboot's bad typechecker.
+fn empty_mut[T]() -> vec[mutable T] {
+    ret alloc_mut[T](0u);
+}
+
+type init_op[T] = fn(uint i) -> T;
+
+fn init_fn[T](&init_op[T] op, uint n_elts) -> vec[T] {
+    let vec[T] v = alloc[T](n_elts);
+    let uint i = 0u;
+    while (i < n_elts) {
+        v += [op(i)];
+        i += 1u;
+    }
+    ret v;
+}
+
+fn init_fn_mut[T](&init_op[T] op, uint n_elts) -> vec[mutable T] {
+    let vec[mutable T] v = alloc_mut[T](n_elts);
+    let uint i = 0u;
+    while (i < n_elts) {
+        v += [mutable op(i)];
+        i += 1u;
+    }
+    ret v;
+}
+
+fn init_elt[T](&T t, uint n_elts) -> vec[T] {
+    /**
+     * FIXME (issue #81): should be:
+     *
+     * fn elt_op[T](&T x, uint i) -> T { ret x; }
+     * let init_op[T] inner = bind elt_op[T](t, _);
+     * ret init_fn[T](inner, n_elts);
+     */
+    let vec[T] v = alloc[T](n_elts);
+    let uint i = n_elts;
+    while (i > 0u) {
+        i -= 1u;
+        v += [t];
+    }
+    ret v;
+}
+
+fn init_elt_mut[T](&T t, uint n_elts) -> vec[mutable T] {
+    let vec[mutable T] v = alloc_mut[T](n_elts);
+    let uint i = n_elts;
+    while (i > 0u) {
+        i -= 1u;
+        v += [mutable t];
+    }
+    ret v;
+}
+
+fn buf[T](array[T] v) -> vbuf {
+    ret rustrt::vec_buf[T](v, 0u);
+}
+
+fn len[T](array[T] v) -> uint {
+    ret rustrt::vec_len[T](v);
+}
+
+fn len_set[T](array[T] v, uint n) {
+    rustrt::vec_len_set[T](v, n);
+}
+
+fn buf_off[T](array[T] v, uint offset) -> vbuf {
+     assert (offset < len[T](v));
+    ret rustrt::vec_buf[T](v, offset);
+}
+
+fn print_debug_info[T](array[T] v) {
+    rustrt::vec_print_debug_info[T](v);
+}
+
+// Returns the last element of v.
+fn last[T](array[T] v) -> option::t[T] {
+    auto l = len[T](v);
+    if (l == 0u) {
+        ret none[T];
+    }
+    ret some[T](v.(l - 1u));
+}
+
+// Returns elements from [start..end) from v.
+
+fn slice[T](array[T] v, uint start, uint end) -> vec[T] {
+    assert (start <= end);
+    assert (end <= len[T](v));
+    auto result = alloc[T](end - start);
+    let uint i = start;
+    while (i < end) {
+        result += [v.(i)];
+        i += 1u;
+    }
+    ret result;
+}
+
+fn shift[T](&mutable array[T] v) -> T {
+    auto ln = len[T](v);
+    assert (ln > 0u);
+    auto e = v.(0);
+    v = slice[T](v, 1u, ln);
+    ret e;
+}
+
+fn pop[T](&mutable array[T] v) -> T {
+    auto ln = len[T](v);
+    assert (ln > 0u);
+    ln -= 1u;
+    auto e = v.(ln);
+    v = slice[T](v, 0u, ln);
+    ret e;
+}
+
+fn push[T](&mutable array[T] v, &T t) {
+    v += [t];
+}
+
+fn unshift[T](&mutable array[T] v, &T t) {
+    auto res = alloc[T](len[T](v) + 1u);
+    res += [t];
+    res += v;
+    v = res;
+}
+
+fn grow[T](&array[T] v, uint n, &T initval) {
+    let uint i = n;
+    while (i > 0u) {
+        i -= 1u;
+        v += [initval];
+    }
+}
+
+fn grow_set[T](&vec[mutable T] v, uint index, &T initval, &T val) {
+    auto length = vec::len(v);
+    if (index >= length) {
+        grow(v, index - length + 1u, initval);
+    }
+    v.(index) = val;
+}
+
+fn map[T, U](&option::operator[T,U] f, &array[T] v) -> vec[U] {
+    let vec[U] u = alloc[U](len[T](v));
+    for (T ve in v) {
+        u += [f(ve)];
+    }
+    ret u;
+}
+
+fn map2[T,U,V](&operator2[T,U,V] f, &array[T] v0, &array[U] v1) -> vec[V] {
+    auto v0_len = len[T](v0);
+    if (v0_len != len[U](v1)) {
+        fail;
+    }
+
+    let vec[V] u = alloc[V](v0_len);
+    auto i = 0u;
+    while (i < v0_len) {
+        u += [f(v0.(i), v1.(i))];
+        i += 1u;
+    }
+
+    ret u;
+}
+
+fn find[T](fn (&T) -> bool f, &array[T] v) -> option::t[T] {
+    for (T elt in v) {
+        if (f(elt)) {
+            ret some[T](elt);
+        }
+    }
+
+    ret none[T];
+}
+
+fn foldl[T, U](fn (&U, &T) -> U p, &U z, &vec[T] v) -> U {
+    auto sz = len[T](v);
+
+    if (sz == 0u) {
+        ret z;
+    }
+    else {
+        auto rest = slice[T](v, 1u, sz);
+
+        ret (p(foldl[T,U](p, z, rest), v.(0)));
+    }
+}
+
+fn unzip[T, U](&vec[tup(T, U)] v) -> tup(vec[T], vec[U]) {
+    auto sz = len[tup(T, U)](v);
+
+    if (sz == 0u) {
+        ret tup(alloc[T](0u), alloc[U](0u));
+    }
+    else {
+        auto rest = slice[tup(T, U)](v, 1u, sz);
+        auto tl   = unzip[T, U](rest);
+        auto a    = [v.(0)._0];
+        auto b    = [v.(0)._1];
+        ret tup(a + tl._0, b + tl._1);
+    }
+}
+
+fn or(&vec[bool] v) -> bool {
+    auto f = orb;
+    ret vec::foldl[bool, bool](f, false, v);
+}
+
+fn clone[T](&vec[T] v) -> vec[T] {
+    ret slice[T](v, 0u, len[T](v));
+}
+
+fn plus_option[T](&vec[T] v, &option::t[T] o) -> () {
+    alt (o) {
+        case (none[T]) {}
+        case (some[T](?x)) { v += [x]; }
+    }
+}
+
+fn cat_options[T](&vec[option::t[T]] v) -> vec[T] {
+    let vec[T] res = [];
+
+    for (option::t[T] o in v) {
+        alt (o) {
+            case (none[T]) { }
+            case (some[T](?t)) {
+                res += [t];
+            }
+        }
+    }
+
+    ret res;
+}
+
+// TODO: Remove in favor of built-in "freeze" operation when it's implemented.
+fn freeze[T](vec[mutable T] v) -> vec[T] {
+    let vec[T] result = [];
+    for (T elem in v) {
+        result += [elem];
+    }
+    ret result;
+}
+
+// Local Variables:
+// mode: rust;
+// fill-column: 78;
+// indent-tabs-mode: nil
+// c-basic-offset: 4
+// buffer-file-coding-system: utf-8-unix
+// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
+// End:
index 2baed39cac1bf1d1f368a9c3ae015f0dee261ffc..1540bd0ea671ef6a6aa42dfd0a1d99c29fdc21f9 100644 (file)
@@ -1,5 +1,5 @@
-import _str::sbuf;
-import _vec::vbuf;
+import str::sbuf;
+import vec::vbuf;
 
 native mod libc = "msvcrt.dll" {
     fn open(sbuf s, int flags, uint mode) -> int = "_open";
@@ -53,13 +53,13 @@ fn dylib_filename(str base) -> str {
 
 fn pipe() -> tup(int, int) {
     let vec[mutable int] fds = [mutable 0, 0];
-    assert (os::libc::_pipe(_vec::buf(fds), 1024u,
+    assert (os::libc::_pipe(vec::buf(fds), 1024u,
                         libc_constants::O_BINARY()) == 0);
     ret tup(fds.(0), fds.(1));
 }
 
 fn fd_FILE(int fd) -> libc::FILE {
-    ret libc::_fdopen(fd, _str::buf("r"));
+    ret libc::_fdopen(fd, str::buf("r"));
 }
 
 native "rust" mod rustrt {
index 5aa3dc2f5445550083bf3cc6de01ba6465fcfe10..37194a39e510624f12d43c5f8a44ac8ba4b7e801 100644 (file)
@@ -3,8 +3,8 @@
  * http://99-bottles-of-beer.net/
  */
 use std;
-import std::_int;
-import std::_str;
+import std::int;
+import std::str;
 
 fn b1() -> str {
   ret "# of beer on the wall, # of beer.";
@@ -32,15 +32,15 @@ fn sub(str t, int n) -> str {
     ns = "1 bottle";
   }
  case (_) {
-    ns = _int::to_str(n, 10u) + " bottles";
+    ns = int::to_str(n, 10u) + " bottles";
   }
   }
-  while (i < _str::byte_len(t)) {
+  while (i < str::byte_len(t)) {
     if (t.(i) == ('#' as u8)) {
       b += ns;
     }
     else {
-      _str::push_byte(b, t.(i));
+      str::push_byte(b, t.(i));
     }
     i += 1u;
   }
index 311fca460c8c511315b65c6c0d767d6454fc2561..96d61e8e23268e34ab37104c2def1b3004935d3e 100644 (file)
@@ -3,8 +3,8 @@
  * http://99-bottles-of-beer.net/
  */
 use std;
-import std::_int;
-import std::_str;
+import std::int;
+import std::str;
 
 tag bottle { none; dual; single; multiple(int);}
 
@@ -25,8 +25,8 @@ fn show(bottle b) {
       log "Take one down and pass it around, 1 bottle of beer on the wall.";
     }
     case (multiple(?n)) {
-      let str nb =  _int::to_str(n, 10u);
-      let str mb = _int::to_str(n - 1, 10u);
+      let str nb =  int::to_str(n, 10u);
+      let str mb = int::to_str(n - 1, 10u);
       log nb + " bottles of beer on the wall, " + nb + " bottles of beer,";
       log "Take one down and pass it around, " 
         + mb + " bottles of beer on the wall.";
index 569b076a5ec67e20c022581360c96a60498d0119..6aa6d6b1e2e8e69fc9c2135359874a0de2f79cb7 100644 (file)
@@ -3,8 +3,8 @@
  * http://99-bottles-of-beer.net/
  */
 use std;
-import std::_int;
-import std::_str;
+import std::int;
+import std::str;
 
 fn b1() -> str {
   ret "# of beer on the wall, # of beer.";
@@ -31,15 +31,15 @@ fn sub(str t, int n) -> str {
     ns = "1 bottle";
   }
  case (_) {
-    ns = _int::to_str(n, 10u) + " bottles";
+    ns = int::to_str(n, 10u) + " bottles";
   }
   }
-  while (i < _str::byte_len(t)) {
+  while (i < str::byte_len(t)) {
     if (t.(i) == ('#' as u8)) {
       b += ns;
     }
     else {
-      _str::push_byte(b, t.(i));
+      str::push_byte(b, t.(i));
     }
     i += 1u;
   }
index 202b653b78f79b281c2cf8362a383d216bd24be9..8da4a5b76b72328bbe8297d4198285022dd0a1b2 100644 (file)
@@ -3,13 +3,13 @@
  * http://99-bottles-of-beer.net/
  */
 use std;
-import std::_int;
-import std::_str;
+import std::int;
+import std::str;
 
 fn main() {
   fn multiple(int n) {
-    let str nb =  _int::to_str(n, 10u);
-    let str mb =  _int::to_str(n - 1, 10u);
+    let str nb =  int::to_str(n, 10u);
+    let str mb =  int::to_str(n - 1, 10u);
     log nb + " bottles of beer on the wall, " + nb + " bottles of beer,";
     log "Take one down and pass it around, " 
       + mb + " bottles of beer on the wall.";
index 735ac2d506e7f503bc9b804a44fb255ce59f5159..ef0de64363ce85935ca2f9aa5a0b8dbc9b11728b 100644 (file)
@@ -1,6 +1,6 @@
 use std;
 
-import std::_int;
+import std::int;
 
 tag tree {
   nil;
@@ -49,7 +49,7 @@ fn main() {
 
   auto depth = min_depth;
   while (depth <= max_depth) {
-    auto iterations = _int::pow(2, (max_depth - depth + min_depth) as uint);
+    auto iterations = int::pow(2, (max_depth - depth + min_depth) as uint);
     auto chk = 0;
 
     auto i = 1;
index 0d24d338202905ec5742a33b49d34fac556d1c5f..cca3592ce68f3e5e98ad64fa4cf4cc6f767e5dd6 100644 (file)
@@ -2,8 +2,8 @@
 
 use std;
 
-import std::_int;
-import std::_vec;
+import std::int;
+import std::vec;
 
 fn fannkuch(int n) -> int {
 
@@ -12,9 +12,9 @@ fn perm1init(uint i) -> int {
   }
   auto perm1init_ = perm1init; // Rustboot workaround
 
-  auto perm = _vec::init_elt(0, n as uint);
-  auto perm1 = _vec::init_fn(perm1init_, n as uint);
-  auto count = _vec::init_elt(0, n as uint);
+  auto perm = vec::init_elt(0, n as uint);
+  auto perm1 = vec::init_fn(perm1init_, n as uint);
+  auto count = vec::init_elt(0, n as uint);
 
   auto f = 0;
   auto i = 0;
index b7a890971e334bf8aa87eb8e22bef58de4c7ac15..1fc7ef43be3a9e306e874bc45b27b1bc5eb2d96c 100644 (file)
@@ -7,10 +7,10 @@
  * http://shootout.alioth.debian.org/
  */
 use std;
-import std::_vec;
-import std::_str;
-import std::_uint;
-import std::_int;
+import std::vec;
+import std::str;
+import std::uint;
+import std::int;
 
 fn LINE_LENGTH() -> uint {
   ret 60u;
@@ -54,21 +54,21 @@ fn bisect(vec[aminoacids] v, uint lo, uint hi, u32 target) -> char {
       ret v.(hi)._0;
     }
   }
-  ret bisect(genelist, 0u, _vec::len[aminoacids](genelist) - 1u, r);
+  ret bisect(genelist, 0u, vec::len[aminoacids](genelist) - 1u, r);
 }
 
 fn make_random_fasta(str id, str desc, vec[aminoacids] genelist, int n) {
   log(">" + id + " " + desc);
   auto rng = myrandom(std::rand::mk_rng().next());
   let str op = "";
-  for each (uint i in _uint::range(0u, n as uint)) {
-    _str::push_byte(op, select_random(rng.next(100u32), genelist) as u8);
-    if (_str::byte_len(op) >= LINE_LENGTH()) {
+  for each (uint i in uint::range(0u, n as uint)) {
+    str::push_byte(op, select_random(rng.next(100u32), genelist) as u8);
+    if (str::byte_len(op) >= LINE_LENGTH()) {
       log(op);
       op = "";
     }
   }
-  if (_str::byte_len(op) > 0u) {
+  if (str::byte_len(op) > 0u) {
     log(op);
   }
 }
@@ -76,16 +76,16 @@ fn make_random_fasta(str id, str desc, vec[aminoacids] genelist, int n) {
 fn make_repeat_fasta(str id, str desc, str s, int n) {
   log(">" + id + " " + desc);
   let str op = "";
-  let uint sl = _str::byte_len(s);
-  for each (uint i in _uint::range(0u, n as uint)) {
+  let uint sl = str::byte_len(s);
+  for each (uint i in uint::range(0u, n as uint)) {
 
-    _str::push_byte(op, s.(i % sl));
-    if (_str::byte_len(op) >= LINE_LENGTH()) {
+    str::push_byte(op, s.(i % sl));
+    if (str::byte_len(op) >= LINE_LENGTH()) {
       log(op);
       op = "";
     }
   }
-  if (_str::byte_len(op) > 0u) {
+  if (str::byte_len(op) > 0u) {
     log(op);
   }
 }
index a59248ebfa8eb699171d256d190f7308fa5d72a8..fafa0bf7a601de8ff39a4e16ef17ac1898e2faba 100644 (file)
@@ -1,7 +1,7 @@
 // -*- rust -*-
 
 use std;
-import std::_str;
+import std::str;
 
 // FIXME: import std::dbg.const_refcount. Currently
 // cross-crate const references don't work.
@@ -20,13 +20,13 @@ fn foo(str s) {
     case (_) { log "?"; fail; }
   }
 
-  log _str::refcount(s);
-  assert (_str::refcount(s) == const_refcount);
+  log str::refcount(s);
+  assert (str::refcount(s) == const_refcount);
 }
 
 fn main() {
   let str s = "hi";     // ref up
   foo(s);               // ref up then down
-  log _str::refcount(s);
-  assert (_str::refcount(s) == const_refcount);
+  log str::refcount(s);
+  assert (str::refcount(s) == const_refcount);
 }
index 21a2a02a30b627d087941bfd3c42aa449a4d8b66..94e709dccbce481950bddbf4d56b94bb8dfb1bd4 100644 (file)
@@ -1,7 +1,7 @@
 // -*- rust -*-
 // xfail-stage0
 use std;
-import std::_vec;
+import std::vec;
 
 fn some_vec(int x) -> vec[int] {
   ret [];
index 4aa7201bc6b003d71dc89eb21fae978aeeca1aa5..cf319c9056291cd18e577ca7cde9fff8968450e1 100644 (file)
@@ -1,7 +1,7 @@
 // -*- rust -*-
 // xfail-stage0
 use std;
-import std::_vec;
+import std::vec;
 
 fn some_vec(int x) -> vec[int] {
   ret [];
index 706f3c22cd58211df2aa0e5787c4485140d530c2..8dddc28177587ceb3f14eb4c277f7c7277b8c8b4 100644 (file)
@@ -1,5 +1,5 @@
 use std;
-import std::_vec;
+import std::vec;
 import std::bitv;
 
 fn test_0_elements() {
@@ -7,7 +7,7 @@ fn test_0_elements() {
   auto exp;
 
   act = bitv::create(0u, false);
-  exp = _vec::init_elt[uint](0u, 0u);
+  exp = vec::init_elt[uint](0u, 0u);
   // FIXME: why can't I write vec[uint]()?
   assert (bitv::eq_vec(act, exp));
 }
index 20d70ccf756cc08f90bf7cda477ad1752f8427c0..cd525f67c56ae186a37476f8d3adcda231e25466 100644 (file)
@@ -1,25 +1,25 @@
 use std;
 
-import std::_int;
-import std::_str::eq;
+import std::int;
+import std::str::eq;
 
 fn test_to_str() {
-  assert (eq(_int::to_str(0, 10u), "0"));
-  assert (eq(_int::to_str(1, 10u), "1"));
-  assert (eq(_int::to_str(-1, 10u), "-1"));
-  assert (eq(_int::to_str(255, 16u), "ff"));
-  assert (eq(_int::to_str(100, 10u), "100"));
+  assert (eq(int::to_str(0, 10u), "0"));
+  assert (eq(int::to_str(1, 10u), "1"));
+  assert (eq(int::to_str(-1, 10u), "-1"));
+  assert (eq(int::to_str(255, 16u), "ff"));
+  assert (eq(int::to_str(100, 10u), "100"));
 }
 
 fn test_pow() {
-  assert (_int::pow(0, 0u) == 1);
-  assert (_int::pow(0, 1u) == 0);
-  assert (_int::pow(0, 2u) == 0);
-  assert (_int::pow(-1, 0u) == -1);
-  assert (_int::pow(1, 0u) == 1);
-  assert (_int::pow(-3, 2u) == 9);
-  assert (_int::pow(-3, 3u) == -27);
-  assert (_int::pow(4, 9u) == 262144);
+  assert (int::pow(0, 0u) == 1);
+  assert (int::pow(0, 1u) == 0);
+  assert (int::pow(0, 2u) == 0);
+  assert (int::pow(-1, 0u) == -1);
+  assert (int::pow(1, 0u) == 1);
+  assert (int::pow(-3, 2u) == 9);
+  assert (int::pow(-3, 3u) == -27);
+  assert (int::pow(4, 9u) == 262144);
 }
 
 fn main() {
index 3462e93f7c51290875e0d7ab1b82793126e97f2a..c7561ecc1534f765efbc71b6b4e117ea01f83298 100644 (file)
@@ -5,7 +5,7 @@
 
 use std;
 import std::io;
-import std::_str;
+import std::str;
 
 fn test_simple(str tmpfilebase) {
   let str tmpfile = tmpfilebase + ".tmp";
@@ -21,7 +21,7 @@ fn test_simple(str tmpfilebase) {
   let io::reader inp = io::file_reader(tmpfile);
   let str frood2 = inp.read_c_str();
   log frood2;
-  assert (_str::eq(frood, frood2));
+  assert (str::eq(frood, frood2));
 }
 
 fn main(vec[str] argv) {
index 402ef108149960b5c55bd4b51ecd4357f5c223d9..fcded5636189d926bf90824b3627595c0fe54b4e 100644 (file)
@@ -2,8 +2,8 @@
 
 use std;
 import std::map;
-import std::_str;
-import std::_uint;
+import std::str;
+import std::uint;
 import std::util;
 
 fn test_simple() {
@@ -19,8 +19,8 @@ fn hash_uint(&uint u) -> uint {
   let map::hashfn[uint] hasher_uint = hash_uint;
   let map::eqfn[uint] eqer_uint = eq_uint;
 
-  let map::hashfn[str] hasher_str = _str::hash;
-  let map::eqfn[str] eqer_str = _str::eq;
+  let map::hashfn[str] hasher_str = str::hash;
+  let map::eqfn[str] eqer_str = str::eq;
 
 
   log "uint -> uint";
@@ -77,15 +77,15 @@ fn hash_uint(&uint u) -> uint {
   assert (hm_us.insert(11u, "thirteen"));
   assert (hm_us.insert(12u, "fourteen"));
 
-  assert (_str::eq(hm_us.get(11u), "thirteen"));
-  assert (_str::eq(hm_us.get(12u), "fourteen"));
-  assert (_str::eq(hm_us.get(10u), "twelve"));
+  assert (str::eq(hm_us.get(11u), "thirteen"));
+  assert (str::eq(hm_us.get(12u), "fourteen"));
+  assert (str::eq(hm_us.get(10u), "twelve"));
 
   assert (!hm_us.insert(12u, "fourteen"));
-  assert (_str::eq(hm_us.get(12u), "fourteen"));
+  assert (str::eq(hm_us.get(12u), "fourteen"));
 
   assert (!hm_us.insert(12u, "twelve"));
-  assert (_str::eq(hm_us.get(12u), "twelve"));
+  assert (str::eq(hm_us.get(12u), "twelve"));
 
 
   log "str -> str";
@@ -97,15 +97,15 @@ fn hash_uint(&uint u) -> uint {
   assert (hm_ss.insert(eleven, "thirteen"));
   assert (hm_ss.insert(twelve, "fourteen"));
 
-  assert (_str::eq(hm_ss.get("eleven"), "thirteen"));
-  assert (_str::eq(hm_ss.get("twelve"), "fourteen"));
-  assert (_str::eq(hm_ss.get("ten"), "twelve"));
+  assert (str::eq(hm_ss.get("eleven"), "thirteen"));
+  assert (str::eq(hm_ss.get("twelve"), "fourteen"));
+  assert (str::eq(hm_ss.get("ten"), "twelve"));
 
   assert (!hm_ss.insert("twelve", "fourteen"));
-  assert (_str::eq(hm_ss.get("twelve"), "fourteen"));
+  assert (str::eq(hm_ss.get("twelve"), "fourteen"));
 
   assert (!hm_ss.insert("twelve", "twelve"));
-  assert (_str::eq(hm_ss.get("twelve"), "twelve"));
+  assert (str::eq(hm_ss.get("twelve"), "twelve"));
 
   log "*** finished test_simple";
 }
@@ -136,8 +136,8 @@ fn hash_uint(&uint u) -> uint {
   let uint i = 0u;
   while (i < num_to_insert) {
     assert (hm_uu.insert(i, i * i));
-    log "inserting " + _uint::to_str(i, 10u)
-      + " -> " + _uint::to_str(i * i, 10u);
+    log "inserting " + uint::to_str(i, 10u)
+      + " -> " + uint::to_str(i * i, 10u);
     i += 1u;
   }
 
@@ -145,8 +145,8 @@ fn hash_uint(&uint u) -> uint {
 
   i = 0u;
   while (i < num_to_insert) {
-    log "get(" + _uint::to_str(i, 10u) + ") = "
-      + _uint::to_str(hm_uu.get(i), 10u);
+    log "get(" + uint::to_str(i, 10u) + ") = "
+      + uint::to_str(hm_uu.get(i), 10u);
     assert (hm_uu.get(i) == i * i);
     i += 1u;
   }
@@ -160,8 +160,8 @@ fn hash_uint(&uint u) -> uint {
 
   i = 0u;
   while (i < num_to_insert) {
-    log "get(" + _uint::to_str(i, 10u) + ") = "
-      + _uint::to_str(hm_uu.get(i), 10u);
+    log "get(" + uint::to_str(i, 10u) + ") = "
+      + uint::to_str(hm_uu.get(i), 10u);
     assert (hm_uu.get(i) == i * i);
     i += 1u;
   }
@@ -169,16 +169,16 @@ fn hash_uint(&uint u) -> uint {
 
   log "str -> str";
 
-  let map::hashfn[str] hasher_str = _str::hash;
-  let map::eqfn[str] eqer_str = _str::eq;
+  let map::hashfn[str] hasher_str = str::hash;
+  let map::eqfn[str] eqer_str = str::eq;
   let map::hashmap[str, str] hm_ss = map::mk_hashmap[str, str](hasher_str,
                                                              eqer_str);
 
   i = 0u;
   while (i < num_to_insert) {
-    assert (hm_ss.insert(_uint::to_str(i, 2u), _uint::to_str(i * i, 2u)));
-    log "inserting \"" + _uint::to_str(i, 2u)
-      + "\" -> \"" + _uint::to_str(i * i, 2u) + "\"";
+    assert (hm_ss.insert(uint::to_str(i, 2u), uint::to_str(i * i, 2u)));
+    log "inserting \"" + uint::to_str(i, 2u)
+      + "\" -> \"" + uint::to_str(i * i, 2u) + "\"";
     i += 1u;
   }
 
@@ -187,20 +187,20 @@ fn hash_uint(&uint u) -> uint {
   i = 0u;
   while (i < num_to_insert) {
     log "get(\""
-      + _uint::to_str(i, 2u)
+      + uint::to_str(i, 2u)
       + "\") = \""
-      + hm_ss.get(_uint::to_str(i, 2u)) + "\"";
+      + hm_ss.get(uint::to_str(i, 2u)) + "\"";
 
-    assert (_str::eq(hm_ss.get(_uint::to_str(i, 2u)),
-                   _uint::to_str(i * i, 2u)));
+    assert (str::eq(hm_ss.get(uint::to_str(i, 2u)),
+                   uint::to_str(i * i, 2u)));
     i += 1u;
   }
 
-  assert (hm_ss.insert(_uint::to_str(num_to_insert, 2u),
-                      _uint::to_str(17u, 2u)));
+  assert (hm_ss.insert(uint::to_str(num_to_insert, 2u),
+                      uint::to_str(17u, 2u)));
 
-  assert (_str::eq(hm_ss.get(_uint::to_str(num_to_insert, 2u)),
-                 _uint::to_str(17u, 2u)));
+  assert (str::eq(hm_ss.get(uint::to_str(num_to_insert, 2u)),
+                 uint::to_str(17u, 2u)));
 
   log "-----";
 
@@ -208,10 +208,10 @@ fn hash_uint(&uint u) -> uint {
 
   i = 0u;
   while (i < num_to_insert) {
-    log "get(\"" + _uint::to_str(i, 2u) + "\") = \""
-      + hm_ss.get(_uint::to_str(i, 2u)) + "\"";
-    assert (_str::eq(hm_ss.get(_uint::to_str(i, 2u)),
-                   _uint::to_str(i * i, 2u)));
+    log "get(\"" + uint::to_str(i, 2u) + "\") = \""
+      + hm_ss.get(uint::to_str(i, 2u)) + "\"";
+    assert (str::eq(hm_ss.get(uint::to_str(i, 2u)),
+                   uint::to_str(i * i, 2u)));
     i += 1u;
   }
 
@@ -241,8 +241,8 @@ fn hash(&uint u) -> uint {
   let uint i = 0u;
   while (i < num_to_insert) {
     assert (hm.insert(i, i * i));
-    log "inserting " + _uint::to_str(i, 10u)
-      + " -> " + _uint::to_str(i * i, 10u);
+    log "inserting " + uint::to_str(i, 10u)
+      + " -> " + uint::to_str(i * i, 10u);
     i += 1u;
   }
 
@@ -279,8 +279,8 @@ fn hash(&uint u) -> uint {
 
   i = 1u;
   while (i < num_to_insert) {
-    log "get(" + _uint::to_str(i, 10u) + ") = "
-      + _uint::to_str(hm.get(i), 10u);
+    log "get(" + uint::to_str(i, 10u) + ") = "
+      + uint::to_str(hm.get(i), 10u);
     assert (hm.get(i) == i * i);
     i += 2u;
   }
@@ -294,8 +294,8 @@ fn hash(&uint u) -> uint {
 
   i = 1u;
   while (i < num_to_insert) {
-    log "get(" + _uint::to_str(i, 10u) + ") = "
-      + _uint::to_str(hm.get(i), 10u);
+    log "get(" + uint::to_str(i, 10u) + ") = "
+      + uint::to_str(hm.get(i), 10u);
     assert (hm.get(i) == i * i);
     i += 2u;
   }
@@ -305,8 +305,8 @@ fn hash(&uint u) -> uint {
   i = 0u;
   while (i < num_to_insert) {
     assert (hm.insert(i, i * i));
-    log "inserting " + _uint::to_str(i, 10u)
-      + " -> " + _uint::to_str(i * i, 10u);
+    log "inserting " + uint::to_str(i, 10u)
+      + " -> " + uint::to_str(i * i, 10u);
     i += 2u;
   }
 
@@ -316,8 +316,8 @@ fn hash(&uint u) -> uint {
 
   i = 0u;
   while (i < num_to_insert) {
-    log "get(" + _uint::to_str(i, 10u) + ") = "
-      + _uint::to_str(hm.get(i), 10u);
+    log "get(" + uint::to_str(i, 10u) + ") = "
+      + uint::to_str(hm.get(i), 10u);
     assert (hm.get(i) == i * i);
     i += 1u;
   }
@@ -333,8 +333,8 @@ fn hash(&uint u) -> uint {
 
   i = 0u;
   while (i < num_to_insert) {
-    log "get(" + _uint::to_str(i, 10u) + ") = "
-      + _uint::to_str(hm.get(i), 10u);
+    log "get(" + uint::to_str(i, 10u) + ") = "
+      + uint::to_str(hm.get(i), 10u);
     assert (hm.get(i) == i * i);
     i += 1u;
   }
index 473950cd8644288102c26515a2fe2ad50f5cacc2..53afba476a9a76cb3e60ab14652e9ef8ddd743e1 100644 (file)
@@ -1,7 +1,7 @@
 use std;
 
 fn check_sort(vec[mutable int] v1, vec[mutable int] v2) {
-  auto len = std::_vec::len[int](v1);
+  auto len = std::vec::len[int](v1);
 
   fn ltequal(&int a, &int b) -> bool {
     ret a <= b;
index 7f137cb871c15154a31a677698b5f6a993df125a..1c9f843cfadbe5e43a8cfae372576e724490726d 100644 (file)
@@ -5,8 +5,8 @@
 use std;
 
 import std::sha1;
-import std::_vec;
-import std::_str;
+import std::vec;
+import std::str;
 
 fn main() {
 
@@ -66,8 +66,8 @@ fn a_million_letter_a() -> str {
     auto tests = fips_180_1_tests + wikipedia_tests;
 
     fn check_vec_eq(vec[u8] v0, vec[u8] v1) {
-        assert (_vec::len[u8](v0) == _vec::len[u8](v1));
-        auto len = _vec::len[u8](v0);
+        assert (vec::len[u8](v0) == vec::len[u8](v1));
+        auto len = vec::len[u8](v0);
         auto i = 0u;
         while (i < len) {
             auto a = v0.(i);
@@ -88,11 +88,11 @@ fn check_vec_eq(vec[u8] v0, vec[u8] v1) {
 
     // Test that it works when accepting the message in pieces
     for (test t in tests) {
-        auto len = _str::byte_len(t.input);
+        auto len = str::byte_len(t.input);
         auto left = len;
         while (left > 0u) {
             auto take = (left + 1u) / 2u;
-            sh.input_str(_str::substr(t.input, len - left, take));
+            sh.input_str(str::substr(t.input, len - left, take));
             left = left - take;
         }
         auto out = sh.result();
index fe0c9e9473fb9c090f012cddbd74c1c5bd2b928d..b63feae4fd7b3a556d78e848838f996fe589952b 100644 (file)
@@ -1,7 +1,7 @@
 use std;
 
 fn check_sort(vec[int] v1, vec[int] v2) {
-  auto len = std::_vec::len[int](v1);
+  auto len = std::vec::len[int](v1);
   fn lteq(&int a, &int b) -> bool {
     ret a <= b;
   }
index af1148a5f8a2399483aad570a031a1c39c4550b4..a401838000c0c723bcb3624e37d4f08ed2d8c904 100644 (file)
@@ -4,7 +4,7 @@
 // -*- rust -*-
 
 use std;
-import std::_str;
+import std::str;
 
 fn main() {
     auto s = "hello";
index 185694a25a1bba3c308105060a919d10c37d51a4..a7c3cac81130aefe3b8e152c819dddc693ca3b7b 100644 (file)
@@ -1,38 +1,38 @@
 // xfail-stage0
 
 use std;
-import std::_str;
+import std::str;
 
 fn test_bytes_len() {
-  assert (_str::byte_len("") == 0u);
-  assert (_str::byte_len("hello world") == 11u);
-  assert (_str::byte_len("\x63") == 1u);
-  assert (_str::byte_len("\xa2") == 2u);
-  assert (_str::byte_len("\u03c0") == 2u);
-  assert (_str::byte_len("\u2620") == 3u);
-  assert (_str::byte_len("\U0001d11e") == 4u);
+  assert (str::byte_len("") == 0u);
+  assert (str::byte_len("hello world") == 11u);
+  assert (str::byte_len("\x63") == 1u);
+  assert (str::byte_len("\xa2") == 2u);
+  assert (str::byte_len("\u03c0") == 2u);
+  assert (str::byte_len("\u2620") == 3u);
+  assert (str::byte_len("\U0001d11e") == 4u);
 }
 
 fn test_index_and_rindex() {
-  assert (_str::index("hello", 'e' as u8) == 1);
-  assert (_str::index("hello", 'o' as u8) == 4);
-  assert (_str::index("hello", 'z' as u8) == -1);
-  assert (_str::rindex("hello", 'l' as u8) == 3);
-  assert (_str::rindex("hello", 'h' as u8) == 0);
-  assert (_str::rindex("hello", 'z' as u8) == -1);
+  assert (str::index("hello", 'e' as u8) == 1);
+  assert (str::index("hello", 'o' as u8) == 4);
+  assert (str::index("hello", 'z' as u8) == -1);
+  assert (str::rindex("hello", 'l' as u8) == 3);
+  assert (str::rindex("hello", 'h' as u8) == 0);
+  assert (str::rindex("hello", 'z' as u8) == -1);
 }
 
 fn test_split() {
   fn t(&str s, char c, int i, &str k) {
     log "splitting: " + s;
     log i;
-    auto v = _str::split(s, c as u8);
+    auto v = str::split(s, c as u8);
     log "split to: ";
     for (str z in v) {
       log z;
     }
     log "comparing: " + v.(i) + " vs. " + k;
-    assert (_str::eq(v.(i), k));
+    assert (str::eq(v.(i), k));
   }
   t("abc.hello.there", '.', 0, "abc");
   t("abc.hello.there", '.', 1, "hello");
@@ -45,7 +45,7 @@ fn t(&str s, char c, int i, &str k) {
 
 fn test_find() {
   fn t(&str haystack, &str needle, int i) {
-    let int j = _str::find(haystack,needle);
+    let int j = str::find(haystack,needle);
     log "searched for " + needle;
     log j;
     assert (i == j);
@@ -59,8 +59,8 @@ fn t(&str haystack, &str needle, int i) {
 
 fn test_substr() {
   fn t(&str a, &str b, int start) {
-    assert (_str::eq(_str::substr(a, start as uint,
-                              _str::byte_len(b)), b));
+    assert (str::eq(str::substr(a, start as uint,
+                              str::byte_len(b)), b));
   }
 
   t("hello", "llo", 2);
@@ -70,7 +70,7 @@ fn t(&str a, &str b, int start) {
 
 fn test_concat() {
   fn t(&vec[str] v, &str s) {
-    assert (_str::eq(_str::concat(v), s));
+    assert (str::eq(str::concat(v), s));
   }
 
   t(["you", "know", "I'm", "no", "good"], "youknowI'mnogood");
@@ -81,7 +81,7 @@ fn t(&vec[str] v, &str s) {
 
 fn test_connect() {
   fn t(&vec[str] v, &str sep, &str s) {
-    assert (_str::eq(_str::connect(v, sep), s));
+    assert (str::eq(str::connect(v, sep), s));
   }
 
   t(["you", "know", "I'm", "no", "good"], " ", "you know I'm no good");
@@ -96,14 +96,14 @@ fn test_to_upper() {
   auto unicode = "\u65e5\u672c";
   auto input = "abcDEF" + unicode + "xyz:.;";
   auto expected = "ABCDEF" + unicode + "XYZ:.;";
-  auto actual = _str::to_upper(input);
-  assert (_str::eq(expected, actual));
+  auto actual = str::to_upper(input);
+  assert (str::eq(expected, actual));
 }
 
 fn test_slice() {
-  assert (_str::eq("ab", _str::slice("abc", 0u, 2u)));
-  assert (_str::eq("bc", _str::slice("abc", 1u, 3u)));
-  assert (_str::eq("", _str::slice("abc", 1u, 1u)));
+  assert (str::eq("ab", str::slice("abc", 0u, 2u)));
+  assert (str::eq("bc", str::slice("abc", 1u, 3u)));
+  assert (str::eq("", str::slice("abc", 1u, 1u)));
 
   fn a_million_letter_a() -> str {
     auto i = 0;
@@ -125,8 +125,8 @@ fn half_a_million_letter_a() -> str {
     ret res;
   }
 
-  assert (_str::eq(half_a_million_letter_a(),
-                 _str::slice(a_million_letter_a(),
+  assert (str::eq(half_a_million_letter_a(),
+                 str::slice(a_million_letter_a(),
                            0u,
                            500000u)));
 }
index 3de24ba3d4963da28d3afb3f34ea75053539eb7b..e9618c4abb0e7df42b96a8e7a6841747caf4acd4 100644 (file)
@@ -1,47 +1,47 @@
 // -*- rust -*-
 
 use std;
-import std::_uint;
+import std::uint;
 
 fn main() {
-  assert (_uint::next_power_of_two(0u) == 0u);
-  assert (_uint::next_power_of_two(1u) == 1u);
-  assert (_uint::next_power_of_two(2u) == 2u);
-  assert (_uint::next_power_of_two(3u) == 4u);
-  assert (_uint::next_power_of_two(4u) == 4u);
-  assert (_uint::next_power_of_two(5u) == 8u);
-  assert (_uint::next_power_of_two(6u) == 8u);
-  assert (_uint::next_power_of_two(7u) == 8u);
-  assert (_uint::next_power_of_two(8u) == 8u);
-  assert (_uint::next_power_of_two(9u) == 16u);
-  assert (_uint::next_power_of_two(10u) == 16u);
-  assert (_uint::next_power_of_two(11u) == 16u);
-  assert (_uint::next_power_of_two(12u) == 16u);
-  assert (_uint::next_power_of_two(13u) == 16u);
-  assert (_uint::next_power_of_two(14u) == 16u);
-  assert (_uint::next_power_of_two(15u) == 16u);
-  assert (_uint::next_power_of_two(16u) == 16u);
-  assert (_uint::next_power_of_two(17u) == 32u);
-  assert (_uint::next_power_of_two(18u) == 32u);
-  assert (_uint::next_power_of_two(19u) == 32u);
-  assert (_uint::next_power_of_two(20u) == 32u);
-  assert (_uint::next_power_of_two(21u) == 32u);
-  assert (_uint::next_power_of_two(22u) == 32u);
-  assert (_uint::next_power_of_two(23u) == 32u);
-  assert (_uint::next_power_of_two(24u) == 32u);
-  assert (_uint::next_power_of_two(25u) == 32u);
-  assert (_uint::next_power_of_two(26u) == 32u);
-  assert (_uint::next_power_of_two(27u) == 32u);
-  assert (_uint::next_power_of_two(28u) == 32u);
-  assert (_uint::next_power_of_two(29u) == 32u);
-  assert (_uint::next_power_of_two(30u) == 32u);
-  assert (_uint::next_power_of_two(31u) == 32u);
-  assert (_uint::next_power_of_two(32u) == 32u);
-  assert (_uint::next_power_of_two(33u) == 64u);
-  assert (_uint::next_power_of_two(34u) == 64u);
-  assert (_uint::next_power_of_two(35u) == 64u);
-  assert (_uint::next_power_of_two(36u) == 64u);
-  assert (_uint::next_power_of_two(37u) == 64u);
-  assert (_uint::next_power_of_two(38u) == 64u);
-  assert (_uint::next_power_of_two(39u) == 64u);
+  assert (uint::next_power_of_two(0u) == 0u);
+  assert (uint::next_power_of_two(1u) == 1u);
+  assert (uint::next_power_of_two(2u) == 2u);
+  assert (uint::next_power_of_two(3u) == 4u);
+  assert (uint::next_power_of_two(4u) == 4u);
+  assert (uint::next_power_of_two(5u) == 8u);
+  assert (uint::next_power_of_two(6u) == 8u);
+  assert (uint::next_power_of_two(7u) == 8u);
+  assert (uint::next_power_of_two(8u) == 8u);
+  assert (uint::next_power_of_two(9u) == 16u);
+  assert (uint::next_power_of_two(10u) == 16u);
+  assert (uint::next_power_of_two(11u) == 16u);
+  assert (uint::next_power_of_two(12u) == 16u);
+  assert (uint::next_power_of_two(13u) == 16u);
+  assert (uint::next_power_of_two(14u) == 16u);
+  assert (uint::next_power_of_two(15u) == 16u);
+  assert (uint::next_power_of_two(16u) == 16u);
+  assert (uint::next_power_of_two(17u) == 32u);
+  assert (uint::next_power_of_two(18u) == 32u);
+  assert (uint::next_power_of_two(19u) == 32u);
+  assert (uint::next_power_of_two(20u) == 32u);
+  assert (uint::next_power_of_two(21u) == 32u);
+  assert (uint::next_power_of_two(22u) == 32u);
+  assert (uint::next_power_of_two(23u) == 32u);
+  assert (uint::next_power_of_two(24u) == 32u);
+  assert (uint::next_power_of_two(25u) == 32u);
+  assert (uint::next_power_of_two(26u) == 32u);
+  assert (uint::next_power_of_two(27u) == 32u);
+  assert (uint::next_power_of_two(28u) == 32u);
+  assert (uint::next_power_of_two(29u) == 32u);
+  assert (uint::next_power_of_two(30u) == 32u);
+  assert (uint::next_power_of_two(31u) == 32u);
+  assert (uint::next_power_of_two(32u) == 32u);
+  assert (uint::next_power_of_two(33u) == 64u);
+  assert (uint::next_power_of_two(34u) == 64u);
+  assert (uint::next_power_of_two(35u) == 64u);
+  assert (uint::next_power_of_two(36u) == 64u);
+  assert (uint::next_power_of_two(37u) == 64u);
+  assert (uint::next_power_of_two(38u) == 64u);
+  assert (uint::next_power_of_two(39u) == 64u);
 }
index c85374bf3cd7961a70bbd19491838727105f7cb6..10783b4fb2dfd9e4e210640aba025f20c1a3c07f 100644 (file)
@@ -1,8 +1,8 @@
 // -*- rust -*-
 
 use std;
-import std::_str;
-import std::_vec;
+import std::str;
+import std::vec;
 
 fn test_simple() {
   let str s1 = "All mimsy were the borogoves";
@@ -14,12 +14,12 @@ fn test_simple() {
    * working, but we should implement is_utf8 before that happens.
    */
 
-  let vec[u8] v = _str::bytes(s1);
-  let str s2 = _str::from_bytes(v);
+  let vec[u8] v = str::bytes(s1);
+  let str s2 = str::from_bytes(v);
 
   let uint i = 0u;
-  let uint n1 = _str::byte_len(s1);
-  let uint n2 = _vec::len[u8](v);
+  let uint n1 = str::byte_len(s1);
+  let uint n2 = vec::len[u8](v);
 
   assert (n1 == n2);
 
@@ -33,7 +33,7 @@ fn test_simple() {
   }
 
   log "refcnt is";
-  log _str::refcount(s1);
+  log str::refcount(s1);
 }
 
 fn main() {
index 63e903d2d8ebf7d0768331eb7dbc7fa6705d9b8d..af49eacf4c4ca140632896906aad88c5fc3ce2dd 100644 (file)
@@ -1,8 +1,8 @@
 use std;
 
 fn test_init_elt() {
-  let vec[uint] v = std::_vec::init_elt[uint](5u, 3u);
-  assert (std::_vec::len[uint](v) == 3u);
+  let vec[uint] v = std::vec::init_elt[uint](5u, 3u);
+  assert (std::vec::len[uint](v) == 3u);
   assert (v.(0) == 5u);
   assert (v.(1) == 5u);
   assert (v.(2) == 5u);
@@ -13,8 +13,8 @@ fn id(uint x) -> uint {
 }
 fn test_init_fn() {
   let fn(uint)->uint op = id;
-  let vec[uint] v = std::_vec::init_fn[uint](op, 5u);
-  assert (std::_vec::len[uint](v) == 5u);
+  let vec[uint] v = std::vec::init_fn[uint](op, 5u);
+  assert (std::vec::len[uint](v) == 5u);
   assert (v.(0) == 0u);
   assert (v.(1) == 1u);
   assert (v.(2) == 2u);
@@ -24,8 +24,8 @@ fn test_init_fn() {
 
 fn test_slice() {
   let vec[int] v = [1,2,3,4,5];
-  auto v2 = std::_vec::slice[int](v, 2u, 4u);
-  assert (std::_vec::len[int](v2) == 2u);
+  auto v2 = std::vec::slice[int](v, 2u, 4u);
+  assert (std::vec::len[int](v2) == 2u);
   assert (v2.(0) == 3);
   assert (v2.(1) == 4);
 }
@@ -34,7 +34,7 @@ fn test_map() {
   fn square(&int x) -> int { ret x * x; }
   let std::option::operator[int, int] op = square;
   let vec[int] v = [1, 2, 3, 4, 5];
-  let vec[int] s = std::_vec::map[int, int](op, v);
+  let vec[int] s = std::vec::map[int, int](op, v);
   let int i = 0;
   while (i < 5) {
     assert (v.(i) * v.(i) == s.(i));
@@ -47,7 +47,7 @@ fn test_map2() {
   auto f = times;
   auto v0 = [1, 2, 3, 4, 5];
   auto v1 = [5, 4, 3, 2, 1];
-  auto u = std::_vec::map2[int,int,int](f, v0, v1);
+  auto u = std::vec::map2[int,int,int](f, v0, v1);
 
   auto i = 0;
   while (i < 5) {
index a09d8dc4ab8a691d0b4c9991d6a52d3f0407e42e..2a03471db4cf6d4ea91efa402a46d3abcc6251f1 100644 (file)
@@ -11,7 +11,7 @@ fn main() {
   grow(v);
   grow(v);
   grow(v);
-  auto len = std::_vec::len[int](v);
+  auto len = std::vec::len[int](v);
   log len;
   assert (len == (3 as uint));
 }
index b742af7cd124d078fb29c9157666492b118460b5..30a8e57d1b7e040b436a5769ff50b416a60d9f73 100644 (file)
@@ -6,8 +6,8 @@
 use std;
 
 import std::option;
-import std::_uint;
-import std::_vec;
+import std::uint;
+import std::vec;
 
 // A 12-byte unit to send over the channel
 type record = rec(u32 val1, u32 val2, u32 val3);
@@ -33,7 +33,7 @@ fn test_grow() {
 
     let record val = rec(val1=0u32, val2=0u32, val3=0u32);
 
-    for each (uint i in _uint::range(0u, 100u)) {
+    for each (uint i in uint::range(0u, 100u)) {
         mychan <| val;
     }
 }
@@ -53,11 +53,11 @@ fn test_shrink2() {
 
     let record val = rec(val1=0u32, val2=0u32, val3=0u32);
 
-    for each (uint i in _uint::range(0u, 100u)) {
+    for each (uint i in uint::range(0u, 100u)) {
         mychan <| val;
     }
 
-    for each (uint i in _uint::range(0u, 100u)) {
+    for each (uint i in uint::range(0u, 100u)) {
         auto x <- myport;
     }
 }
@@ -67,7 +67,7 @@ fn test_rotate() {
     let port[record] myport = port();
     auto mychan = chan(myport);
 
-    for each (uint i in _uint::range(0u, 100u)) {
+    for each (uint i in uint::range(0u, 100u)) {
         auto val = rec(val1=i as u32,
                        val2=i as u32,
                        val3=i as u32);
@@ -86,15 +86,15 @@ fn test_rotate_grow() {
     let port[record] myport = port();
     auto mychan = chan(myport);
 
-    for each (uint j in _uint::range(0u, 10u)) {
-        for each (uint i in _uint::range(0u, 10u)) {
+    for each (uint j in uint::range(0u, 10u)) {
+        for each (uint i in uint::range(0u, 10u)) {
             let record val = rec(val1=i as u32,
                                  val2=i as u32,
                                  val3=i as u32);
             mychan <| val;
         }
 
-        for each (uint i in _uint::range(0u, 10u)) {
+        for each (uint i in uint::range(0u, 10u)) {
             auto x <- myport;
             assert (x.val1 == i as u32);
             assert (x.val2 == i as u32);
index ed2e3a7a90dbcd7cae7760195c17b4c2f5b50cc8..7dc17cd652fe0fc3ef9b5e19075d4e42edf4143b 100644 (file)
@@ -1,7 +1,7 @@
 // -*- rust -*-
 
 use std;
-import std::_str;
+import std::str;
 
 fn test1() {
   let str s = "hello";
@@ -20,8 +20,8 @@ fn test2() {
   log a;
   log b;
 
-  assert (_str::eq(a, "abcABCabc"));
-  assert (_str::eq(b, "ABCabcABC"));
+  assert (str::eq(a, "abcABCabc"));
+  assert (str::eq(b, "ABCabcABC"));
 }
 
 fn main() {
index 0fea6a694730e33f4d9a4e0b1b95fb6904465585..27050091554668e56c848cca6ad9a5cd875c8c37 100644 (file)
@@ -1,10 +1,10 @@
 use std;
-import std::_str;
+import std::str;
 
 fn test(str actual, str expected) {
   log actual;
   log expected;
-  assert (_str::eq(actual, expected));
+  assert (str::eq(actual, expected));
 }
 
 fn main() {
index 22a97ed7002080531d5265fb1cb914cd82c76188..491f192ab4f62dbabd6338e497478e69fff577f3 100644 (file)
@@ -2,34 +2,34 @@
 // xfail-stage1
 // xfail-stage2
 use std;
-import std::_str;
-import std::_vec;
+import std::str;
+import std::vec;
 import std::io;
 
 fn main() {
   // Chars of 1, 2, 3, and 4 bytes
   let vec[char] chs = ['e', 'é', '€', 0x10000 as char];
-  let str s = _str::from_chars(chs);
+  let str s = str::from_chars(chs);
 
-  assert (_str::byte_len(s) == 10u);
-  assert (_str::char_len(s) == 4u);
-  assert (_vec::len[char](_str::to_chars(s)) == 4u);
-  assert (_str::eq(_str::from_chars(_str::to_chars(s)), s));
-  assert (_str::char_at(s, 0u) == 'e');
-  assert (_str::char_at(s, 1u) == 'é');
+  assert (str::byte_len(s) == 10u);
+  assert (str::char_len(s) == 4u);
+  assert (vec::len[char](str::to_chars(s)) == 4u);
+  assert (str::eq(str::from_chars(str::to_chars(s)), s));
+  assert (str::char_at(s, 0u) == 'e');
+  assert (str::char_at(s, 1u) == 'é');
 
-  assert (_str::is_utf8(_str::bytes(s)));
-  assert (!_str::is_utf8([0x80_u8]));
-  assert (!_str::is_utf8([0xc0_u8]));
-  assert (!_str::is_utf8([0xc0_u8, 0x10_u8]));
+  assert (str::is_utf8(str::bytes(s)));
+  assert (!str::is_utf8([0x80_u8]));
+  assert (!str::is_utf8([0xc0_u8]));
+  assert (!str::is_utf8([0xc0_u8, 0x10_u8]));
 
   auto stack = "a×c€";
-  assert (_str::pop_char(stack) == '€');
-  assert (_str::pop_char(stack) == 'c');
-  _str::push_char(stack, 'u');
-  assert (_str::eq(stack, "a×u"));
-  assert (_str::shift_char(stack) == 'a');
-  assert (_str::shift_char(stack) == '×');
-  _str::unshift_char(stack, 'ß');
-  assert (_str::eq(stack, "ßu"));
+  assert (str::pop_char(stack) == '€');
+  assert (str::pop_char(stack) == 'c');
+  str::push_char(stack, 'u');
+  assert (str::eq(stack, "a×u"));
+  assert (str::shift_char(stack) == 'a');
+  assert (str::shift_char(stack) == '×');
+  str::unshift_char(stack, 'ß');
+  assert (str::eq(stack, "ßu"));
 }
index 1d0d2509570b45211243fd4a3bb4cf2ffc692265..46b0cd6f2a1ed2d13ea5a034e48ec512e45e2bb7 100644 (file)
@@ -4,8 +4,8 @@
 // -*- rust -*-
 
 use std;
-import std::_str;
-import std::_vec;
+import std::str;
+import std::vec;
 
 
 // FIXME: import std::dbg::const_refcount. Currently
@@ -53,30 +53,30 @@ fn slow_growth2_helper(str s) {   // ref up: s
     let vec[str] v = [mumble]; // ref up: v, mumble
     let acc a = acc(v);           // ref up: a, v
 
-    log _vec::refcount[str](v);
-    assert (_vec::refcount[str](v) == 2u);
+    log vec::refcount[str](v);
+    assert (vec::refcount[str](v) == 2u);
 
     a.add(s);                     // ref up: mumble, s.  ref down: v
 
-    log _vec::refcount[str](v);
-    log _str::refcount(s);
-    log _str::refcount(mumble);
+    log vec::refcount[str](v);
+    log str::refcount(s);
+    log str::refcount(mumble);
 
-    assert (_vec::refcount[str](v) == 1u);
-    assert (_str::refcount(s) == const_refcount);
-    assert (_str::refcount(mumble) == const_refcount);
+    assert (vec::refcount[str](v) == 1u);
+    assert (str::refcount(s) == const_refcount);
+    assert (str::refcount(mumble) == const_refcount);
 
     log v.(0);
-    log _vec::len[str](v);
-    assert (_str::eq(v.(0), mumble));
-    assert (_vec::len[str](v) == 1u);
+    log vec::len[str](v);
+    assert (str::eq(v.(0), mumble));
+    assert (vec::len[str](v) == 1u);
   }                               // ref down: a, mumble, s, v
 
-  log _str::refcount(s);
-  log _str::refcount(mumble);
+  log str::refcount(s);
+  log str::refcount(mumble);
 
-  assert (_str::refcount(s) == const_refcount);
-  assert (_str::refcount(mumble) == const_refcount);
+  assert (str::refcount(s) == const_refcount);
+  assert (str::refcount(mumble) == const_refcount);
 
   log mumble;
   log ss;
@@ -85,8 +85,8 @@ fn slow_growth2_helper(str s) {   // ref up: s
 fn slow_growth2() {
   let str s = "hi";               // ref up: s
   slow_growth2_helper(s);
-  log _str::refcount(s);
-  assert (_str::refcount(s) == const_refcount);
+  log str::refcount(s);
+  assert (str::refcount(s) == const_refcount);
 }
 
 fn main() {
index cb26e4845d5eb33183353003f30c0ee5bcf36f67..c46e4d5ee18a79fa46cd15a73797a2c9ad3d53bc 100644 (file)
@@ -1,12 +1,12 @@
 use std;
-import std::_vec;
+import std::vec;
 
 fn main() {
     auto v = [1, 2, 3];
-    log_err _vec::refcount[int](v);
-    log_err _vec::refcount[int](v);
-    log_err _vec::refcount[int](v);
-    assert (_vec::refcount[int](v) == 1u || _vec::refcount[int](v) == 2u);
-    assert (_vec::refcount[int](v) == 1u || _vec::refcount[int](v) == 2u);
+    log_err vec::refcount[int](v);
+    log_err vec::refcount[int](v);
+    log_err vec::refcount[int](v);
+    assert (vec::refcount[int](v) == 1u || vec::refcount[int](v) == 2u);
+    assert (vec::refcount[int](v) == 1u || vec::refcount[int](v) == 2u);
 }