aboutsummaryrefslogtreecommitdiff
path: root/src/boot/util
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-10-08 14:54:51 -0700
committerGraydon Hoare <[email protected]>2010-10-08 14:54:51 -0700
commit5f2459145cb90d7d52cfde1d4ed7719dde1dfdc0 (patch)
tree7f2305524744f4b7fb02469f3c9ab0e64b4c9577 /src/boot/util
parentrustc: Make functions output a type, not a slot (diff)
downloadrust-5f2459145cb90d7d52cfde1d4ed7719dde1dfdc0.tar.xz
rust-5f2459145cb90d7d52cfde1d4ed7719dde1dfdc0.zip
Add -lpath mechanism for logging only a subset of a pass (by module-path prefix)
Diffstat (limited to 'src/boot/util')
-rw-r--r--src/boot/util/common.ml25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/boot/util/common.ml b/src/boot/util/common.ml
index f51d818e..838caa73 100644
--- a/src/boot/util/common.ml
+++ b/src/boot/util/common.ml
@@ -180,6 +180,31 @@ let new_fixup (s:string)
(*
+ * Auxiliary string functions.
+ *)
+
+let split_string (c:char) (s:string) : string list =
+ let ls = ref [] in
+ let b = Buffer.create (String.length s) in
+ let flush _ =
+ if Buffer.length b <> 0
+ then
+ begin
+ ls := (Buffer.contents b) :: (!ls);
+ Buffer.clear b
+ end
+ in
+ let f ch =
+ if c = ch
+ then flush()
+ else Buffer.add_char b ch
+ in
+ String.iter f s;
+ flush();
+ List.rev (!ls)
+;;
+
+(*
* Auxiliary hashtable functions.
*)