diff options
| author | Graydon Hoare <[email protected]> | 2010-10-08 14:54:51 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-10-08 14:54:51 -0700 |
| commit | 5f2459145cb90d7d52cfde1d4ed7719dde1dfdc0 (patch) | |
| tree | 7f2305524744f4b7fb02469f3c9ab0e64b4c9577 /src/boot/util | |
| parent | rustc: Make functions output a type, not a slot (diff) | |
| download | rust-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.ml | 25 |
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. *) |