diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-08-15 16:38:23 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-08-16 10:36:19 -0700 |
| commit | f05a91a0dca0bcbb9d9e20584923803df827e35b (patch) | |
| tree | f0e871d856829a09fa3408c7354e0dcbc059f4d9 /src/lib | |
| parent | 38c2363c459b481f40392f78b4db843172961fd4 (diff) | |
| download | rust-f05a91a0dca0bcbb9d9e20584923803df827e35b.tar.gz rust-f05a91a0dca0bcbb9d9e20584923803df827e35b.zip | |
Rename std::ivec to std::vec
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/aio.rs | 10 | ||||
| -rw-r--r-- | src/lib/bitv.rs | 20 | ||||
| -rw-r--r-- | src/lib/deque.rs | 16 | ||||
| -rw-r--r-- | src/lib/ebml.rs | 6 | ||||
| -rw-r--r-- | src/lib/extfmt.rs | 2 | ||||
| -rw-r--r-- | src/lib/getopts.rs | 18 | ||||
| -rw-r--r-- | src/lib/io.rs | 36 | ||||
| -rw-r--r-- | src/lib/list.rs | 2 | ||||
| -rw-r--r-- | src/lib/map.rs | 2 | ||||
| -rw-r--r-- | src/lib/net.rs | 6 | ||||
| -rw-r--r-- | src/lib/posix_fs.rs | 2 | ||||
| -rw-r--r-- | src/lib/run_program.rs | 2 | ||||
| -rw-r--r-- | src/lib/sha1.rs | 14 | ||||
| -rw-r--r-- | src/lib/smallintmap.rs | 8 | ||||
| -rw-r--r-- | src/lib/sort.rs | 4 | ||||
| -rw-r--r-- | src/lib/std.rc | 2 | ||||
| -rw-r--r-- | src/lib/str.rs | 14 | ||||
| -rw-r--r-- | src/lib/test.rs | 24 | ||||
| -rw-r--r-- | src/lib/ufind.rs | 8 | ||||
| -rw-r--r-- | src/lib/uint.rs | 4 | ||||
| -rw-r--r-- | src/lib/vec.rs (renamed from src/lib/ivec.rs) | 0 |
21 files changed, 100 insertions, 100 deletions
diff --git a/src/lib/aio.rs b/src/lib/aio.rs index 83be5daf3d0..bb9caf05697 100644 --- a/src/lib/aio.rs +++ b/src/lib/aio.rs @@ -1,5 +1,5 @@ import task; -import ivec; +import vec; import comm; import comm::_chan; @@ -55,7 +55,7 @@ tag request { type ctx = _chan[request]; fn ip_to_sbuf(ip: net::ip_addr) -> *u8 { - ivec::to_ptr(str::bytes(net::format_addr(ip))) + vec::to_ptr(str::bytes(net::format_addr(ip))) } fn connect_task(ip: net::ip_addr, portnum: int, evt: _chan[socket_event]) { @@ -78,8 +78,8 @@ fn new_client(client: client, evt: _chan[socket_event]) { log "waiting for bytes"; let data: [u8] = reader.recv(); log "got some bytes"; - log ivec::len[u8](data); - if (ivec::len[u8](data) == 0u) { + log vec::len[u8](data); + if (vec::len[u8](data) == 0u) { log "got empty buffer, bailing"; break; } @@ -145,7 +145,7 @@ fn request_task(c: _chan[ctx]) { } write(socket,v,status) { rustrt::aio_writedata(socket, - ivec::to_ptr[u8](v), ivec::len[u8](v), + vec::to_ptr[u8](v), vec::len[u8](v), status); } close_server(server,status) { diff --git a/src/lib/bitv.rs b/src/lib/bitv.rs index 0c80381c4fc..444d388059e 100644 --- a/src/lib/bitv.rs +++ b/src/lib/bitv.rs @@ -32,13 +32,13 @@ fn uint_bits() -> uint { ret 32u + (1u << 32u >> 27u); } fn create(nbits: uint, init: bool) -> t { let elt = if init { !0u } else { 0u }; - let storage = ivec::init_elt_mut[uint](elt, nbits / uint_bits() + 1u); + let storage = vec::init_elt_mut[uint](elt, nbits / uint_bits() + 1u); ret @{storage: storage, nbits: nbits}; } fn process(op: &block(uint, uint) -> uint , v0: &t, v1: &t) -> bool { - let len = ivec::len(v1.storage); - assert (ivec::len(v0.storage) == len); + let len = vec::len(v1.storage); + assert (vec::len(v0.storage) == len); assert (v0.nbits == v1.nbits); let changed = false; for each i: uint in uint::range(0u, len) { @@ -69,8 +69,8 @@ fn assign(v0: &t, v1: t) -> bool { } fn clone(v: t) -> t { - let storage = ivec::init_elt_mut[uint](0u, v.nbits / uint_bits() + 1u); - let len = ivec::len(v.storage); + let storage = vec::init_elt_mut[uint](0u, v.nbits / uint_bits() + 1u); + let len = vec::len(v.storage); for each i: uint in uint::range(0u, len) { storage.(i) = v.storage.(i); } ret @{storage: storage, nbits: v.nbits}; } @@ -88,7 +88,7 @@ fn equal(v0: &t, v1: &t) -> bool { // FIXME: when we can break or return from inside an iterator loop, // we can eliminate this painful while-loop - let len = ivec::len(v1.storage); + let len = vec::len(v1.storage); let i = 0u; while i < len { if v0.storage.(i) != v1.storage.(i) { ret false; } @@ -98,7 +98,7 @@ fn equal(v0: &t, v1: &t) -> bool { } fn clear(v: &t) { - for each i: uint in uint::range(0u, ivec::len(v.storage)) { + for each i: uint in uint::range(0u, vec::len(v.storage)) { v.storage.(i) = 0u; } } @@ -108,7 +108,7 @@ fn set_all(v: &t) { } fn invert(v: &t) { - for each i: uint in uint::range(0u, ivec::len(v.storage)) { + for each i: uint in uint::range(0u, vec::len(v.storage)) { v.storage.(i) = !v.storage.(i); } } @@ -150,7 +150,7 @@ fn init_to_vec(v: t, i: uint) -> uint { ret if get(v, i) { 1u } else { 0u }; } fn to_vec(v: &t) -> [uint] { let sub = bind init_to_vec(v, _); - ret ivec::init_fn[uint](sub, v.nbits); + ret vec::init_fn[uint](sub, v.nbits); } fn to_str(v: &t) -> str { @@ -162,7 +162,7 @@ fn to_str(v: &t) -> str { } fn eq_ivec(v0: &t, v1: &[uint]) -> bool { - assert (v0.nbits == ivec::len[uint](v1)); + assert (v0.nbits == vec::len[uint](v1)); let len = v0.nbits; let i = 0u; while i < len { diff --git a/src/lib/deque.rs b/src/lib/deque.rs index a6c43572bb5..65cae49ab16 100644 --- a/src/lib/deque.rs +++ b/src/lib/deque.rs @@ -28,7 +28,7 @@ fn create[@T]() -> t[T] { fn grow[@T](nelts: uint, lo: uint, elts: &[mutable cell[T]]) -> [mutable cell[T]] { - assert (nelts == ivec::len(elts)); + assert (nelts == vec::len(elts)); let rv = ~[mutable]; let i = 0u; @@ -53,11 +53,11 @@ fn create[@T]() -> t[T] { fn add_front(t: &T) { let oldlo: uint = lo; if lo == 0u { - lo = ivec::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 = ivec::len[cell[T]](elts) - 1u; + lo = vec::len[cell[T]](elts) - 1u; hi = nelts; } elts.(lo) = option::some[T](t); @@ -70,7 +70,7 @@ fn create[@T]() -> t[T] { hi = nelts; } elts.(hi) = option::some[T](t); - hi = (hi + 1u) % ivec::len[cell[T]](elts); + hi = (hi + 1u) % vec::len[cell[T]](elts); nelts += 1u; } @@ -81,13 +81,13 @@ fn create[@T]() -> t[T] { fn pop_front() -> T { let t: T = get[T](elts, lo); elts.(lo) = option::none[T]; - lo = (lo + 1u) % ivec::len[cell[T]](elts); + lo = (lo + 1u) % vec::len[cell[T]](elts); nelts -= 1u; ret t; } fn pop_back() -> T { if hi == 0u { - hi = ivec::len[cell[T]](elts) - 1u; + hi = vec::len[cell[T]](elts) - 1u; } else { hi -= 1u; } let t: T = get[T](elts, hi); elts.(hi) = option::none[T]; @@ -97,12 +97,12 @@ fn create[@T]() -> t[T] { fn peek_front() -> T { ret get[T](elts, lo); } fn peek_back() -> T { ret get[T](elts, hi - 1u); } fn get(i: int) -> T { - let idx: uint = (lo + (i as uint)) % ivec::len[cell[T]](elts); + let idx: uint = (lo + (i as uint)) % vec::len[cell[T]](elts); ret get[T](elts, idx); } } let v: [mutable cell[T]] = - ivec::init_elt_mut(option::none, initial_capacity); + vec::init_elt_mut(option::none, initial_capacity); ret deque[T](0u, 0u, 0u, v); } // Local Variables: diff --git a/src/lib/ebml.rs b/src/lib/ebml.rs index a843cdbcd79..b7603affb6c 100644 --- a/src/lib/ebml.rs +++ b/src/lib/ebml.rs @@ -40,7 +40,7 @@ fn vint_at(data: &[u8], start: uint) -> {val: uint, next: uint} { } fn new_doc(data: &@[u8]) -> doc { - ret {data: data, start: 0u, end: ivec::len[u8](*data)}; + ret {data: data, start: 0u, end: vec::len[u8](*data)}; } fn doc_at(data: &@[u8], start: uint) -> doc { @@ -96,7 +96,7 @@ iter tagged_docs(d: doc, tg: uint) -> doc { } } -fn doc_data(d: doc) -> [u8] { ret ivec::slice[u8](*d.data, d.start, d.end); } +fn doc_data(d: doc) -> [u8] { ret vec::slice[u8](*d.data, d.start, d.end); } fn be_uint_from_bytes(data: &@[u8], start: uint, size: uint) -> uint { let sz = size; @@ -167,7 +167,7 @@ fn start_tag(w: &writer, tag_id: uint) { } fn end_tag(w: &writer) { - let last_size_pos = ivec::pop[uint](w.size_positions); + let last_size_pos = vec::pop[uint](w.size_positions); let 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); diff --git a/src/lib/extfmt.rs b/src/lib/extfmt.rs index 25cdc2a46c8..e188b74ab02 100644 --- a/src/lib/extfmt.rs +++ b/src/lib/extfmt.rs @@ -372,7 +372,7 @@ mod rt { // FIXME: This might be useful in str: but needs to be utf8 safe first fn str_init_elt(c: char, n_elts: uint) -> str { - let svec = ivec::init_elt[u8](c as u8, n_elts); + let svec = vec::init_elt[u8](c as u8, n_elts); ret str::unsafe_from_bytes(svec); } diff --git a/src/lib/getopts.rs b/src/lib/getopts.rs index 68e1b40edc3..f7795520ef5 100644 --- a/src/lib/getopts.rs +++ b/src/lib/getopts.rs @@ -77,7 +77,7 @@ fn name_str(nm: name) -> str { fn find_opt(opts: &[opt], nm: name) -> option::t[uint] { let i = 0u; - let l = ivec::len[opt](opts); + let l = vec::len[opt](opts); while i < l { if opts.(i).name == nm { ret some[uint](i); } i += 1u; } ret none[uint]; } @@ -107,11 +107,11 @@ fn fail_str(f: fail_) -> str { tag result { success(match); failure(fail_); } fn getopts(args: &[str], opts: &[opt]) -> result { - let n_opts = ivec::len[opt](opts); + let n_opts = vec::len[opt](opts); fn f(x: uint) -> [optval] { ret ~[]; } - let vals = ivec::init_fn_mut[[optval]](f, n_opts); + let vals = vec::init_fn_mut[[optval]](f, n_opts); let free: [str] = ~[]; - let l = ivec::len[str](args); + let l = vec::len[str](args); let i = 0u; while i < l { let cur = args.(i); @@ -163,7 +163,7 @@ fn getopts(args: &[str], opts: &[opt]) -> result { maybe. { if !option::is_none[str](i_arg) { vals.(optid) += ~[val(option::get(i_arg))]; - } else if (name_pos < ivec::len[name](names) || + } else if (name_pos < vec::len[name](names) || i + 1u == l || is_arg(args.(i + 1u))) { vals.(optid) += ~[given]; } else { i += 1u; vals.(optid) += ~[val(args.(i))]; } @@ -182,7 +182,7 @@ fn getopts(args: &[str], opts: &[opt]) -> result { } i = 0u; while i < n_opts { - let n = ivec::len[optval](vals.(i)); + let n = vec::len[optval](vals.(i)); let occ = opts.(i).occur; if occ == req { if n == 0u { @@ -209,7 +209,7 @@ fn opt_vals(m: &match, nm: str) -> [optval] { fn opt_val(m: &match, nm: str) -> optval { ret opt_vals(m, nm).(0); } fn opt_present(m: &match, nm: str) -> bool { - ret ivec::len[optval](opt_vals(m, nm)) > 0u; + ret vec::len[optval](opt_vals(m, nm)) > 0u; } fn opt_str(m: &match, nm: str) -> str { @@ -226,7 +226,7 @@ fn opt_strs(m: &match, nm: str) -> [str] { fn opt_maybe_str(m: &match, nm: str) -> option::t[str] { let vals = opt_vals(m, nm); - if ivec::len[optval](vals) == 0u { ret none[str]; } + if vec::len[optval](vals) == 0u { ret none[str]; } ret alt vals.(0) { val(s) { some[str](s) } _ { none[str] } }; } @@ -236,7 +236,7 @@ fn opt_maybe_str(m: &match, nm: str) -> option::t[str] { /// present and an argument was provided. fn opt_default(m: &match, nm: str, def: str) -> option::t[str] { let vals = opt_vals(m, nm); - if ivec::len[optval](vals) == 0u { ret none[str]; } + if vec::len[optval](vals) == 0u { ret none[str]; } ret alt vals.(0) { val(s) { some[str](s) } _ { some[str](def) } } } // Local Variables: diff --git a/src/lib/io.rs b/src/lib/io.rs index 8349b67712e..808c4e84c98 100644 --- a/src/lib/io.rs +++ b/src/lib/io.rs @@ -62,9 +62,9 @@ resource FILE_res(f: os::libc::FILE) { obj FILE_buf_reader(f: os::libc::FILE, res: option::t[@FILE_res]) { fn read(len: uint) -> [u8] { let buf = ~[]; - ivec::reserve[u8](buf, len); - let read = os::libc::fread(ivec::to_ptr[u8](buf), 1u, len, f); - ivec::unsafe::set_len[u8](buf, read); + vec::reserve[u8](buf, len); + let read = os::libc::fread(vec::to_ptr[u8](buf), 1u, len, f); + vec::unsafe::set_len[u8](buf, read); ret buf; } fn read_byte() -> int { ret os::libc::fgetc(f); } @@ -196,24 +196,24 @@ type byte_buf = @{buf: [u8], mutable pos: uint}; obj byte_buf_reader(bbuf: byte_buf) { fn read(len: uint) -> [u8] { - let rest = ivec::len[u8](bbuf.buf) - bbuf.pos; + let rest = vec::len[u8](bbuf.buf) - bbuf.pos; let to_read = len; if rest < to_read { to_read = rest; } - let range = ivec::slice[u8](bbuf.buf, bbuf.pos, bbuf.pos + to_read); + let 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 == ivec::len[u8](bbuf.buf) { ret -1; } + if bbuf.pos == vec::len[u8](bbuf.buf) { ret -1; } let b = bbuf.buf.(bbuf.pos); bbuf.pos += 1u; ret b as int; } fn unread_byte(byte: int) { log_err "TODO: unread_byte"; fail; } - fn eof() -> bool { ret bbuf.pos == ivec::len[u8](bbuf.buf); } + fn eof() -> bool { ret bbuf.pos == vec::len[u8](bbuf.buf); } fn seek(offset: int, whence: seek_style) { let pos = bbuf.pos; - let len = ivec::len[u8](bbuf.buf); + let len = vec::len[u8](bbuf.buf); bbuf.pos = seek_in_buf(offset, pos, len, whence); } fn tell() -> uint { ret bbuf.pos; } @@ -245,8 +245,8 @@ type buf_writer = obj FILE_writer(f: os::libc::FILE, res: option::t[@FILE_res]) { fn write(v: &[u8]) { - let len = ivec::len[u8](v); - let vbuf = ivec::to_ptr[u8](v); + let len = vec::len[u8](v); + let vbuf = vec::to_ptr[u8](v); let nout = os::libc::fwrite(vbuf, len, 1u, f); if nout < 1u { log_err "error dumping buffer"; } } @@ -264,11 +264,11 @@ resource fd_res(fd: int) { obj fd_buf_writer(fd: int, res: option::t[@fd_res]) { fn write(v: &[u8]) { - let len = ivec::len[u8](v); + let len = vec::len[u8](v); let count = 0u; let vbuf; while count < len { - vbuf = ptr::offset(ivec::to_ptr[u8](v), count); + vbuf = ptr::offset(vec::to_ptr[u8](v), count); let nout = os::libc::write(fd, vbuf, len); if nout < 0 { log_err "error dumping buffer"; @@ -401,18 +401,18 @@ obj byte_buf_writer(buf: mutable_byte_buf) { fn write(v: &[u8]) { // Fast path. - if buf.pos == ivec::len(buf.buf) { + if buf.pos == vec::len(buf.buf) { for b: u8 in v { buf.buf += ~[mutable b]; } - buf.pos += ivec::len[u8](v); + buf.pos += vec::len[u8](v); ret; } // FIXME: Optimize: These should be unique pointers. - let vlen = ivec::len[u8](v); + let vlen = vec::len[u8](v); let vpos = 0u; while vpos < vlen { let b = v.(vpos); - if buf.pos == ivec::len(buf.buf) { + if buf.pos == vec::len(buf.buf) { buf.buf += ~[mutable b]; } else { buf.buf.(buf.pos) = b; } buf.pos += 1u; @@ -421,7 +421,7 @@ obj byte_buf_writer(buf: mutable_byte_buf) { } fn seek(offset: int, whence: seek_style) { let pos = buf.pos; - let len = ivec::len(buf.buf); + let len = vec::len(buf.buf); buf.pos = seek_in_buf(offset, pos, len, whence); } fn tell() -> uint { ret buf.pos; } @@ -431,7 +431,7 @@ fn string_writer() -> str_writer { // FIXME: yikes, this is bad. Needs fixing of mutable syntax. let b: [mutable u8] = ~[mutable 0u8]; - ivec::pop(b); + vec::pop(b); let buf: mutable_byte_buf = @{mutable buf: b, mutable pos: 0u}; obj str_writer_wrap(wr: writer, buf: mutable_byte_buf) { fn get_writer() -> writer { ret wr; } diff --git a/src/lib/list.rs b/src/lib/list.rs index 1ef84ee79e7..cd379abd750 100644 --- a/src/lib/list.rs +++ b/src/lib/list.rs @@ -9,7 +9,7 @@ fn from_vec[@T](v: &[T]) -> list[T] { // a reverse vector iterator. Unfortunately generic iterators seem not to // work yet. - for item: T in ivec::reversed(v) { l = cons[T](item, @l); } + for item: T in vec::reversed(v) { l = cons[T](item, @l); } ret l; } diff --git a/src/lib/map.rs b/src/lib/map.rs index 6431d4a4d42..3d9c11e9061 100644 --- a/src/lib/map.rs +++ b/src/lib/map.rs @@ -27,7 +27,7 @@ fn mk_hashmap[@K, @V](hasher: &hashfn[K], eqer: &eqfn[K]) -> hashmap[K, V] { let load_factor: util::rational = {num: 3, den: 4}; tag bucket[@K, @V] { nil; deleted; some(K, V); } fn make_buckets[@K, @V](nbkts: uint) -> [mutable (bucket[K, V])] { - ret ivec::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 // half and lower half of the uint bits. Our bucket probing diff --git a/src/lib/net.rs b/src/lib/net.rs index 6a3a6c409c4..8b8b8113d8d 100644 --- a/src/lib/net.rs +++ b/src/lib/net.rs @@ -1,5 +1,5 @@ import str; -import ivec; +import vec; import uint; tag ip_addr { @@ -20,8 +20,8 @@ fn format_addr(ip : ip_addr) -> str { } fn parse_addr(ip : str) -> ip_addr { - let parts = ivec::map(uint::from_str, str::split(ip, ".".(0))); - if ivec::len(parts) != 4u { fail "Too many dots in IP address"; } + let parts = vec::map(uint::from_str, str::split(ip, ".".(0))); + if vec::len(parts) != 4u { fail "Too many dots in IP address"; } for i in parts { if i > 255u { fail "Invalid IP Address part."; } } ipv4(parts.(0) as u8, parts.(1) as u8, diff --git a/src/lib/posix_fs.rs b/src/lib/posix_fs.rs index 7be7c5b33a6..1a84e0faf5a 100644 --- a/src/lib/posix_fs.rs +++ b/src/lib/posix_fs.rs @@ -24,7 +24,7 @@ fn list_dir(path: str) -> [str] { os::libc::closedir(dir); ret result; } - ivec::push[str](result, rustrt::rust_dirent_filename(ent)); + vec::push[str](result, rustrt::rust_dirent_filename(ent)); } os::libc::closedir(dir); ret result; diff --git a/src/lib/run_program.rs b/src/lib/run_program.rs index c2ee4d72cd0..5c5f110816b 100644 --- a/src/lib/run_program.rs +++ b/src/lib/run_program.rs @@ -25,7 +25,7 @@ fn spawn_process(prog: str, args: &[str], in_fd: int, out_fd: int, // pointer to its buffer let argv = arg_vec(prog, args); let pid = rustrt::rust_run_program( - ivec::to_ptr(argv), in_fd, out_fd, err_fd); + vec::to_ptr(argv), in_fd, out_fd, err_fd); ret pid; } diff --git a/src/lib/sha1.rs b/src/lib/sha1.rs index 9b54ecdaea0..dc487180867 100644 --- a/src/lib/sha1.rs +++ b/src/lib/sha1.rs @@ -82,8 +82,8 @@ fn mk_sha1() -> sha1 { fn process_msg_block(st: &sha1state) { // FIXME: Make precondition - assert (ivec::len(st.h) == digest_buf_len); - assert (ivec::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 t: int; // Loop counter let w = st.work_buf; @@ -187,7 +187,7 @@ fn mk_sha1() -> sha1 { fn pad_msg(st: &sha1state) { // FIXME: Should be a precondition - assert (ivec::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 * the initial padding bits and length. If so, we will pad the @@ -226,7 +226,7 @@ fn mk_sha1() -> sha1 { fn reset() { // FIXME: Should be typestate precondition - assert (ivec::len(st.h) == digest_buf_len); + assert (vec::len(st.h) == digest_buf_len); st.len_low = 0u32; st.len_high = 0u32; st.msg_block_idx = 0u; @@ -248,13 +248,13 @@ fn mk_sha1() -> sha1 { } } let st = - {h: ivec::init_elt_mut[u32](0u32, digest_buf_len), + {h: vec::init_elt_mut[u32](0u32, digest_buf_len), mutable len_low: 0u32, mutable len_high: 0u32, - msg_block: ivec::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: ivec::init_elt_mut[u32](0u32, work_buf_len)}; + work_buf: vec::init_elt_mut[u32](0u32, work_buf_len)}; let sh = sha1(st); sh.reset(); ret sh; diff --git a/src/lib/smallintmap.rs b/src/lib/smallintmap.rs index abb1979b66f..c3da9dfa366 100644 --- a/src/lib/smallintmap.rs +++ b/src/lib/smallintmap.rs @@ -15,11 +15,11 @@ fn mk[@T]() -> smallintmap[T] { } fn insert[@T](m: &smallintmap[T], key: uint, val: &T) { - ivec::grow_set[option::t[T]](m.v, key, none[T], some[T](val)); + vec::grow_set[option::t[T]](m.v, key, none[T], some[T](val)); } fn find[@T](m: &smallintmap[T], key: uint) -> option::t[T] { - if key < ivec::len[option::t[T]](m.v) { ret m.v.(key); } + if key < vec::len[option::t[T]](m.v) { ret m.v.(key); } ret none[T]; } @@ -35,10 +35,10 @@ fn contains_key[@T](m: &smallintmap[T], key: uint) -> bool { } fn truncate[@T](m: &smallintmap[T], len: uint) { - m.v = ivec::slice_mut[option::t[T]](m.v, 0u, len); + m.v = vec::slice_mut[option::t[T]](m.v, 0u, len); } fn max_key[T](m: &smallintmap[T]) -> uint { - ret ivec::len[option::t[T]](m.v); + ret vec::len[option::t[T]](m.v); } diff --git a/src/lib/sort.rs b/src/lib/sort.rs index 19242b74c74..0aa8c5b6d13 100644 --- a/src/lib/sort.rs +++ b/src/lib/sort.rs @@ -1,6 +1,6 @@ -import ivec::len; -import ivec::slice; +import vec::len; +import vec::slice; export merge_sort; export quick_sort; diff --git a/src/lib/std.rc b/src/lib/std.rc index 5b89694c63f..ea70265fc6b 100644 --- a/src/lib/std.rc +++ b/src/lib/std.rc @@ -14,7 +14,7 @@ mod int; mod uint; mod u8; mod u64; -mod ivec; +mod vec; mod str; // General io and system-services modules. diff --git a/src/lib/str.rs b/src/lib/str.rs index d229b7d25fa..2bf8864bc72 100644 --- a/src/lib/str.rs +++ b/src/lib/str.rs @@ -132,7 +132,7 @@ const tag_six_b: uint = 252u; fn is_utf8(v: &[u8]) -> bool { let i = 0u; - let total = ivec::len[u8](v); + let total = vec::len[u8](v); while i < total { let chsize = utf8_char_width(v.(i)); if chsize == 0u { ret false; } @@ -185,7 +185,7 @@ fn buf(s: &str) -> sbuf { ret rustrt::str_buf(s); } fn bytes(s: str) -> [u8] { let sbuffer = buf(s); let ptr = unsafe::reinterpret_cast(sbuffer); - ret ivec::unsafe::from_buf(ptr, byte_len(s)); + ret vec::unsafe::from_buf(ptr, byte_len(s)); } fn unsafe_from_bytes(v: &[mutable? u8]) -> str { @@ -496,13 +496,13 @@ fn replace(s: str, from: str, to: str) : is_not_empty(from) -> str { // FIXME: Also not efficient fn char_slice(s: &str, begin: uint, end: uint) -> str { - from_chars(ivec::slice(to_chars(s), begin, end)) + from_chars(vec::slice(to_chars(s), begin, end)) } fn trim_left(s: &str) -> str { fn count_whities(s: &[char]) -> uint { let i = 0u; - while i < ivec::len(s) { + while i < vec::len(s) { if !char::is_whitespace(s.(i)) { break; } @@ -512,12 +512,12 @@ fn trim_left(s: &str) -> str { } let chars = to_chars(s); let whities = count_whities(chars); - ret from_chars(ivec::slice(chars, whities, ivec::len(chars))); + ret from_chars(vec::slice(chars, whities, vec::len(chars))); } fn trim_right(s: &str) -> str { fn count_whities(s: &[char]) -> uint { - let i = ivec::len(s); + let i = vec::len(s); while 0u < i { if !char::is_whitespace(s.(i - 1u)) { break; @@ -528,7 +528,7 @@ fn trim_right(s: &str) -> str { } let chars = to_chars(s); let whities = count_whities(chars); - ret from_chars(ivec::slice(chars, 0u, whities)); + ret from_chars(vec::slice(chars, 0u, whities)); } fn trim(s: &str) -> str { diff --git a/src/lib/test.rs b/src/lib/test.rs index cdd99874c8a..46f166995d6 100644 --- a/src/lib/test.rs +++ b/src/lib/test.rs @@ -50,7 +50,7 @@ type test_desc = {name: test_name, fn: test_fn, ignore: bool}; // The default console test runner. It accepts the command line // arguments and a vector of test_descs (generated at compile time). fn test_main_ivec(args: &[str], tests: &[test_desc]) { - check (ivec::is_not_empty(args)); + check (vec::is_not_empty(args)); let opts = alt parse_opts(args) { either::left(o) { o } @@ -60,7 +60,7 @@ fn test_main_ivec(args: &[str], tests: &[test_desc]) { } fn test_main(args: &vec[str], tests: &[test_desc]) { - test_main_ivec(ivec::from_vec(args), tests); + test_main_ivec(vec::from_vec(args), tests); } type test_opts = {filter: option::t[str], run_ignored: bool}; @@ -68,11 +68,11 @@ type test_opts = {filter: option::t[str], run_ignored: bool}; type opt_res = either::t[test_opts, str]; // Parses command line arguments into test options -fn parse_opts(args: &[str]) : ivec::is_not_empty(args) -> opt_res { +fn parse_opts(args: &[str]) : vec::is_not_empty(args) -> opt_res { // FIXME (#649): Shouldn't have to check here - check (ivec::is_not_empty(args)); - let args_ = ivec::tail(args); + check (vec::is_not_empty(args)); + let args_ = vec::tail(args); let opts = ~[getopts::optflag("ignored")]; let match = alt getopts::getopts(args_, opts) { @@ -81,7 +81,7 @@ fn parse_opts(args: &[str]) : ivec::is_not_empty(args) -> opt_res { }; let filter = - if ivec::len(match.free) > 0u { + if vec::len(match.free) > 0u { option::some(match.free.(0)) } else { option::none }; @@ -121,7 +121,7 @@ fn run_tests_console_(opts: &test_opts, tests: &[test_desc], fn callback(event: testevent, st: test_state) { alt event { te_filtered(filtered_tests) { - st.total = ivec::len(filtered_tests); + st.total = vec::len(filtered_tests); st.out.write_line(#fmt("\nrunning %u tests", st.total)); } te_wait(test) { @@ -230,13 +230,13 @@ fn run_tests(opts: &test_opts, tests: &[test_desc], // result of a particular test for an unusually long amount of time. let concurrency = get_concurrency(); log #fmt("using %u test tasks", concurrency); - let total = ivec::len(filtered_tests); + let total = vec::len(filtered_tests); let run_idx = 0u; let wait_idx = 0u; let futures = ~[]; while wait_idx < total { - while ivec::len(futures) < concurrency && run_idx < total { + while vec::len(futures) < concurrency && run_idx < total { futures += ~[run_test(filtered_tests.(run_idx), to_task)]; run_idx += 1u; } @@ -245,7 +245,7 @@ fn run_tests(opts: &test_opts, tests: &[test_desc], callback(te_wait(future.test)); let result = future.wait(); callback(te_result(future.test, result)); - futures = ivec::slice(futures, 1u, ivec::len(futures)); + futures = vec::slice(futures, 1u, vec::len(futures)); wait_idx += 1u; } } @@ -275,7 +275,7 @@ fn filter_tests(opts: &test_opts, tests: &[test_desc]) -> [test_desc] { }(_, filter_str); - ivec::filter_map(filter, filtered) + vec::filter_map(filter, filtered) }; // Maybe pull out the ignored test and unignore them @@ -293,7 +293,7 @@ fn filter_tests(opts: &test_opts, tests: &[test_desc]) -> [test_desc] { }; - ivec::filter_map(filter, filtered) + vec::filter_map(filter, filtered) }; // Sort the tests alphabetically diff --git a/src/lib/ufind.rs b/src/lib/ufind.rs index 79a2811653a..ecaec535797 100644 --- a/src/lib/ufind.rs +++ b/src/lib/ufind.rs @@ -13,7 +13,7 @@ type ufind = {mutable nodes: [mutable node]}; fn make() -> ufind { ret {mutable nodes: ~[mutable]}; } fn make_set(ufnd: &ufind) -> uint { - let idx = ivec::len(ufnd.nodes); + let idx = vec::len(ufnd.nodes); ufnd.nodes += ~[mutable none[uint]]; ret idx; } @@ -40,13 +40,13 @@ fn union(ufnd: &ufind, m: uint, n: uint) { } else if (m_root > n_root) { ufnd.nodes.(m_root) = some[uint](n_root); } } -fn set_count(ufnd: &ufind) -> uint { ret ivec::len[node](ufnd.nodes); } +fn set_count(ufnd: &ufind) -> uint { ret vec::len[node](ufnd.nodes); } // Removes all sets with IDs greater than or equal to the given value. fn prune(ufnd: &ufind, n: uint) { // TODO: Use "slice" once we get rid of "mutable?" - let len = ivec::len[node](ufnd.nodes); - while len != n { ivec::pop[node](ufnd.nodes); len -= 1u; } + let len = vec::len[node](ufnd.nodes); + while len != n { vec::pop[node](ufnd.nodes); len -= 1u; } } diff --git a/src/lib/uint.rs b/src/lib/uint.rs index acbaee48ac1..7925f3ba951 100644 --- a/src/lib/uint.rs +++ b/src/lib/uint.rs @@ -43,8 +43,8 @@ fn next_power_of_two(n: uint) -> uint { } fn parse_buf(buf: &[u8], radix: uint) -> uint { - if ivec::len[u8](buf) == 0u { log_err "parse_buf(): buf is empty"; fail; } - let i = ivec::len[u8](buf) - 1u; + if vec::len[u8](buf) == 0u { log_err "parse_buf(): buf is empty"; fail; } + let i = vec::len[u8](buf) - 1u; let power = 1u; let n = 0u; while true { diff --git a/src/lib/ivec.rs b/src/lib/vec.rs index be2a1eeea6f..be2a1eeea6f 100644 --- a/src/lib/ivec.rs +++ b/src/lib/vec.rs |
