Camel case various core constructors

This commit is contained in:
Brian Anderson 2012-08-27 14:22:25 -07:00
parent 4ba9fdd362
commit 161a82e433
113 changed files with 530 additions and 545 deletions

View file

@ -168,10 +168,10 @@ fn main(args: ~[~str]) {
let rng = rand::seeded_rng(copy seed);
let mut results = empty_results();
int_benchmarks::<Managed<LinearMap<uint, uint>>>(
|| Managed(linear_map(uint::hash, uint::eq)),
|| Managed(LinearMap(uint::hash, uint::eq)),
rng, num_keys, &mut results);
str_benchmarks::<Managed<LinearMap<~str, uint>>>(
|| Managed(linear_map(str::hash, str::eq)),
|| Managed(LinearMap(str::hash, str::eq)),
rng, num_keys, &mut results);
write_results("libstd::map::hashmap", &results);
}

View file

@ -64,7 +64,7 @@ fn read_line() {
}
fn str_set() {
let r = rand::rng();
let r = rand::Rng();
let s = map::hashmap(str::hash, str::eq);
@ -82,7 +82,7 @@ fn str_set() {
}
fn vec_plus() {
let r = rand::rng();
let r = rand::Rng();
let mut v = ~[];
let mut i = 0;
@ -99,7 +99,7 @@ fn vec_plus() {
}
fn vec_append() {
let r = rand::rng();
let r = rand::Rng();
let mut v = ~[];
let mut i = 0;
@ -116,7 +116,7 @@ fn vec_append() {
}
fn vec_push_all() {
let r = rand::rng();
let r = rand::Rng();
let mut v = ~[];
for uint::range(0, 1500) |i| {

View file

@ -1,7 +1,7 @@
// A raw test of vector appending performance.
use std;
import dvec::dvec;
import dvec::DVec;
import io::WriterUtil;
fn collect_raw(num: uint) -> ~[uint] {
@ -13,7 +13,7 @@ fn collect_raw(num: uint) -> ~[uint] {
}
fn collect_dvec(num: uint) -> ~[mut uint] {
let result = dvec();
let result = DVec();
for uint::range(0u, num) |i| {
result.push(i);
}

View file

@ -88,7 +88,7 @@ fn make_graph(N: uint, edges: ~[(node_id, node_id)]) -> graph {
fn gen_search_keys(graph: graph, n: uint) -> ~[node_id] {
let keys = map::hashmap::<node_id, ()>(node_hash, sys::shape_eq);
let r = rand::rng();
let r = rand::Rng();
while keys.size() < n {
let k = r.gen_uint_range(0u, graph.len());

View file

@ -33,8 +33,8 @@ fn main(args: ~[~str]) {
let num_tasks = option::get(uint::from_str(args[1]));
let msg_per_task = option::get(uint::from_str(args[2]));
let num_port = port();
let mut num_chan = chan(num_port);
let num_port = Port();
let mut num_chan = Chan(num_port);
let start = time::precise_time_s();
@ -42,12 +42,12 @@ fn main(args: ~[~str]) {
let mut futures = ~[];
for uint::range(1u, num_tasks) |i| {
let get_chan = port();
let get_chan_chan = chan(get_chan);
let get_chan = Port();
let get_chan_chan = Chan(get_chan);
futures += ~[do future::spawn |copy num_chan, move get_chan_chan| {
let p = port();
get_chan_chan.send(chan(p));
let p = Port();
get_chan_chan.send(Chan(p));
thread_ring(i, msg_per_task, num_chan, p)
}];

View file

@ -122,12 +122,12 @@ fn creature(
fn rendezvous(nn: uint, set: ~[color]) {
// these ports will allow us to hear from the creatures
let from_creatures: comm::Port<creature_info> = comm::port();
let from_creatures_log: comm::Port<~str> = comm::port();
let from_creatures: comm::Port<creature_info> = comm::Port();
let from_creatures_log: comm::Port<~str> = comm::Port();
// these channels will be passed to the creatures so they can talk to us
let to_rendezvous = comm::chan(from_creatures);
let to_rendezvous_log = comm::chan(from_creatures_log);
let to_rendezvous = comm::Chan(from_creatures);
let to_rendezvous_log = comm::Chan(from_creatures_log);
// these channels will allow us to talk to each creature by 'name'/index
let to_creature: ~[comm::Chan<Option<creature_info>>] =

View file

@ -45,7 +45,7 @@ fn select_random(r: u32, genelist: ~[aminoacids]) -> char {
fn make_random_fasta(wr: io::Writer, id: ~str, desc: ~str, genelist: ~[aminoacids], n: int) {
wr.write_line(~">" + id + ~" " + desc);
let rng = @{mut last: rand::rng().next()};
let rng = @{mut last: rand::Rng().next()};
let mut op: ~str = ~"";
for uint::range(0u, n as uint) |_i| {
str::push_char(op, select_random(myrandom_next(rng, 100u32),

View file

@ -138,8 +138,8 @@ fn main(args: ~[~str]) {
// initialize each sequence sorter
let sizes = ~[1u,2u,3u,4u,6u,12u,18u];
let from_child = vec::map (sizes, |_sz| comm::port() );
let to_parent = vec::mapi(sizes, |ii, _sz| comm::chan(from_child[ii]) );
let from_child = vec::map (sizes, |_sz| comm::Port() );
let to_parent = vec::mapi(sizes, |ii, _sz| comm::Chan(from_child[ii]) );
let to_child = vec::mapi(sizes, fn@(ii: uint, sz: uint) -> comm::Chan<~[u8]> {
return do task::spawn_listener |from_parent| {
make_sequence_processor(sz, from_parent, to_parent[ii]);

View file

@ -100,8 +100,8 @@ impl devnull: io::Writer {
fn writer(path: ~str, writech: comm::Chan<comm::Chan<line>>, size: uint)
{
let p: comm::Port<line> = comm::port();
let ch = comm::chan(p);
let p: comm::Port<line> = comm::Port();
let ch = comm::Chan(p);
comm::send(writech, ch);
let cout: io::Writer = match path {
~"" => {
@ -168,8 +168,8 @@ fn main(args: ~[~str]) {
let size = if vec::len(args) < 2_u { 80_u }
else { uint::from_str(args[1]).get() };
let writep = comm::port();
let writech = comm::chan(writep);
let writep = comm::Port();
let writech = comm::Chan(writep);
do task::spawn {
writer(path, writech, size);
};

View file

@ -6,8 +6,8 @@ const n_threads: int = 503;
fn start(+token: int) {
import iter::*;
let p = comm::port();
let mut ch = comm::chan(p);
let p = comm::Port();
let mut ch = comm::Chan(p);
for int::range(2, n_threads + 1) |i| {
let id = n_threads + 2 - i;
let to_child = do task::spawn_listener::<int> |p, copy ch| {

View file

@ -10,13 +10,13 @@
// Creates in the background 'num_tasks' tasks, all blocked forever.
// Doesn't return until all such tasks are ready, but doesn't block forever itself.
fn grandchild_group(num_tasks: uint) {
let po = comm::port();
let ch = comm::chan(po);
let po = comm::Port();
let ch = comm::Chan(po);
for num_tasks.times {
do task::spawn { // linked
comm::send(ch, ());
comm::recv(comm::port::<()>()); // block forever
comm::recv(comm::Port::<()>()); // block forever
}
}
#error["Grandchild group getting started"];

View file

@ -7,8 +7,8 @@ enum msg {
}
fn calc(children: uint, parent_ch: comm::Chan<msg>) {
let port = comm::port();
let chan = comm::chan(port);
let port = comm::Port();
let chan = comm::Chan(port);
let mut child_chs = ~[];
let mut sum = 0;
@ -58,8 +58,8 @@ fn main(args: ~[~str]) {
};
let children = uint::from_str(args[1]).get();
let port = comm::port();
let chan = comm::chan(port);
let port = comm::Port();
let chan = comm::Chan(port);
do task::spawn {
calc(children, chan);
};

View file

@ -28,9 +28,7 @@ import u64;
import task;
import comm;
import comm::Chan;
import comm::chan;
import comm::Port;
import comm::port;
import comm::recv;
import comm::send;
@ -62,8 +60,8 @@ impl ~str: hash_key {
// These used to be in task, but they disappeard.
type joinable_task = Port<()>;
fn spawn_joinable(+f: fn~()) -> joinable_task {
let p = port();
let c = chan(p);
let p = Port();
let c = Chan(p);
do task::spawn() |move f| {
f();
c.send(());
@ -214,9 +212,9 @@ mod map_reduce {
key: K,
out: Chan<Chan<reduce_proto<V>>>)
{
let p = port();
let p = Port();
send(out, chan(p));
send(out, Chan(p));
let mut ref_count = 0;
let mut is_done = false;
@ -277,8 +275,8 @@ mod map_reduce {
}
None => {
// log(error, "creating new reducer for " + k);
let p = port();
let ch = chan(p);
let p = Port();
let ch = Chan(p);
let r = reduce, kk = k;
vec::push(tasks,
spawn_joinable(|| reduce_task(r, kk, ch) ));
@ -355,7 +353,7 @@ struct random_word_reader: word_reader {
let rng: rand::Rng;
new(count: uint) {
self.remaining = count;
self.rng = rand::rng();
self.rng = rand::Rng();
}
fn read_word() -> Option<~str> {