From a3ec0b1f643d00b9418e4884bd7caa07bf052201 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 6 May 2011 22:13:13 +0200 Subject: Rename std modules to be camelcased (Have fun mergining your stuff with this.) --- src/comp/util/common.rs | 50 +++++++++++++++++------------------ src/comp/util/typestate_ann.rs | 60 +++++++++++++++++++++--------------------- 2 files changed, 55 insertions(+), 55 deletions(-) (limited to 'src/comp/util') diff --git a/src/comp/util/common.rs b/src/comp/util/common.rs index b736b048..b1a39893 100644 --- a/src/comp/util/common.rs +++ b/src/comp/util/common.rs @@ -1,18 +1,18 @@ -import std.map; -import std.map.hashmap; -import std._uint; -import std._int; -import std._vec; -import std.option.none; +import std.Map; +import std.Map.hashmap; +import std.UInt; +import std.Int; +import std.Vec; +import std.Option.none; import front.ast; import util.typestate_ann.ts_ann; import middle.fold; import middle.fold.respan; -import std.io.stdout; -import std.io.str_writer; -import std.io.string_writer; +import std.IO.stdout; +import std.IO.str_writer; +import std.IO.string_writer; import pretty.pprust.print_block; import pretty.pprust.print_expr; import pretty.pprust.print_decl; @@ -56,10 +56,10 @@ 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; - ret std.map.mk_hashmap[str,V](hasher, eqer); +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; + ret std.Map.mk_hashmap[str,V](hasher, eqer); } fn def_eq(&ast.def_id a, &ast.def_id b) -> bool { @@ -73,48 +73,48 @@ fn hash_def(&ast.def_id d) -> uint { ret h; } -fn new_def_hash[V]() -> std.map.hashmap[ast.def_id,V] { - let std.map.hashfn[ast.def_id] hasher = hash_def; - let std.map.eqfn[ast.def_id] eqer = def_eq; - ret std.map.mk_hashmap[ast.def_id,V](hasher, eqer); +fn new_def_hash[V]() -> std.Map.hashmap[ast.def_id,V] { + let std.Map.hashfn[ast.def_id] hasher = hash_def; + let std.Map.eqfn[ast.def_id] eqer = def_eq; + ret std.Map.mk_hashmap[ast.def_id,V](hasher, eqer); } -fn new_int_hash[V]() -> std.map.hashmap[int,V] { +fn new_int_hash[V]() -> std.Map.hashmap[int,V] { fn hash_int(&int x) -> uint { ret x as uint; } fn eq_int(&int a, &int b) -> bool { ret a == b; } auto hasher = hash_int; auto eqer = eq_int; - ret std.map.mk_hashmap[int,V](hasher, eqer); + ret std.Map.mk_hashmap[int,V](hasher, eqer); } -fn new_uint_hash[V]() -> std.map.hashmap[uint,V] { +fn new_uint_hash[V]() -> std.Map.hashmap[uint,V] { fn hash_uint(&uint x) -> uint { ret x; } fn eq_uint(&uint a, &uint b) -> bool { ret a == b; } auto hasher = hash_uint; auto eqer = eq_uint; - ret std.map.mk_hashmap[uint,V](hasher, eqer); + ret std.Map.mk_hashmap[uint,V](hasher, eqer); } 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 plain_ann(middle.ty.ctxt tcx) -> ast.ann { diff --git a/src/comp/util/typestate_ann.rs b/src/comp/util/typestate_ann.rs index 9e815b46..949eaeb2 100644 --- a/src/comp/util/typestate_ann.rs +++ b/src/comp/util/typestate_ann.rs @@ -1,21 +1,21 @@ import front.ast.ident; -import std._vec; -import std.bitv; +import std.Vec; +import std.BitV; /* This says: this expression requires the idents in
 to be initialized,
    and given the precondition, it guarantees that the idents in  are
    initialized.
  */
-type precond  = bitv.t; /* 1 means "this variable must be initialized"
+type precond  = BitV.t; /* 1 means "this variable must be initialized"
                            0 means "don't care about this variable" */
-type postcond = bitv.t; /* 1 means "this variable is initialized"
+type postcond = BitV.t; /* 1 means "this variable is initialized"
                            0 means "don't know about this variable */
 
-type prestate = bitv.t; /* 1 means "this variable is definitely initialized"
+type prestate = BitV.t; /* 1 means "this variable is definitely initialized"
                            0 means "don't know whether this variable is
                            initialized" */
-type poststate = bitv.t; /* 1 means "this variable is definitely initialized"
+type poststate = BitV.t; /* 1 means "this variable is definitely initialized"
                             0 means "don't know whether this variable is
                             initialized" */
 
@@ -29,7 +29,7 @@ type pre_and_post_state = rec(prestate prestate, poststate poststate);
 type ts_ann = rec(pre_and_post conditions, pre_and_post_state states);
 
 fn true_precond(uint num_vars) -> precond {
-  be bitv.create(num_vars, false);
+  be BitV.create(num_vars, false);
 }
 
 fn true_postcond(uint num_vars) -> postcond {
@@ -45,7 +45,7 @@ fn empty_poststate(uint num_vars) -> poststate {
 }
 
 fn false_postcond(uint num_vars) -> postcond {
-    be bitv.create(num_vars, true);
+    be BitV.create(num_vars, true);
 }
 
 fn empty_pre_post(uint num_vars) -> pre_and_post {
@@ -72,15 +72,15 @@ fn get_post(&pre_and_post p) -> postcond {
 }
 
 fn difference(&precond p1, &precond p2) -> bool {
-  be bitv.difference(p1, p2);
+  be BitV.difference(p1, p2);
 }
 
 fn union(&precond p1, &precond p2) -> bool {
-  be bitv.union(p1, p2);
+  be BitV.union(p1, p2);
 }
 
 fn intersect(&precond p1, &precond p2) -> bool {
-  be bitv.intersect(p1, p2);
+  be BitV.intersect(p1, p2);
 }
 
 fn pps_len(&pre_and_post p) -> uint {
@@ -91,62 +91,62 @@ fn pps_len(&pre_and_post p) -> uint {
 
 fn require_and_preserve(uint i, &pre_and_post p) -> () {
   // sets the ith bit in p's pre and post
-  bitv.set(p.precondition, i, true);
-  bitv.set(p.postcondition, i, true);
+  BitV.set(p.precondition, i, true);
+  BitV.set(p.postcondition, i, true);
 }
 
 fn set_in_postcond(uint i, &pre_and_post p) -> bool {
   // sets the ith bit in p's post
-  auto was_set = bitv.get(p.postcondition, i);
-  bitv.set(p.postcondition, i, true);
+  auto was_set = BitV.get(p.postcondition, i);
+  BitV.set(p.postcondition, i, true);
   ret !was_set;
 }
 
 fn set_in_poststate(uint i, &pre_and_post_state s) -> bool {
   // sets the ith bit in p's post
-  auto was_set = bitv.get(s.poststate, i);
-  bitv.set(s.poststate, i, true);
+  auto was_set = BitV.get(s.poststate, i);
+  BitV.set(s.poststate, i, true);
   ret !was_set;
 }
 
 // Sets all the bits in a's precondition to equal the
 // corresponding bit in p's precondition.
 fn set_precondition(&ts_ann a, &precond p) -> () {
-  bitv.copy(a.conditions.precondition, p);
+  BitV.copy(a.conditions.precondition, p);
 }
 
 // Sets all the bits in a's postcondition to equal the
 // corresponding bit in p's postcondition.
 fn set_postcondition(&ts_ann a, &postcond p) -> () {
-  bitv.copy(a.conditions.postcondition, p);
+  BitV.copy(a.conditions.postcondition, p);
 }
 
 // Sets all the bits in a's prestate to equal the
 // corresponding bit in p's prestate.
 fn set_prestate(@ts_ann a, &prestate p) -> bool {
-  ret bitv.copy(a.states.prestate, p);
+  ret BitV.copy(a.states.prestate, p);
 }
 
 // Sets all the bits in a's postcondition to equal the
 // corresponding bit in p's postcondition.
 fn set_poststate(@ts_ann a, &poststate p) -> bool {
-  ret bitv.copy(a.states.poststate, p);
+  ret BitV.copy(a.states.poststate, p);
 }
 
 // Set all the bits in p that are set in new
 fn extend_prestate(&prestate p, &poststate new) -> bool {
-  ret bitv.union(p, new);
+  ret BitV.union(p, new);
 }
 
 // Set all the bits in p that are set in new
 fn extend_poststate(&poststate p, &poststate new) -> bool {
-  ret bitv.union(p, new);
+  ret BitV.union(p, new);
 }
 
 // Clears the given bit in p
 fn relax_prestate(uint i, &prestate p) -> bool {
-    auto was_set = bitv.get(p, i);
-    bitv.set(p, i, false);
+    auto was_set = BitV.get(p, i);
+    BitV.set(p, i, false);
     ret was_set;
 }
 
@@ -164,16 +164,16 @@ fn pp_clone(&pre_and_post p) -> pre_and_post {
 }
 
 fn clone(prestate p) -> prestate {
-    ret bitv.clone(p);
+    ret BitV.clone(p);
 }
 
 // returns true if a implies b
 // that is, returns true except if for some bits c and d,
 // c = 1 and d = 0
-fn implies(bitv.t a, bitv.t b) -> bool {
-  auto tmp = bitv.clone(b);
-  bitv.difference(tmp, a);
-  ret bitv.is_false(tmp);
+fn implies(BitV.t a, BitV.t b) -> bool {
+  auto tmp = BitV.clone(b);
+  BitV.difference(tmp, a);
+  ret BitV.is_false(tmp);
 }
 
 //
-- 
cgit v1.2.3