From 5f2459145cb90d7d52cfde1d4ed7719dde1dfdc0 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 8 Oct 2010 14:54:51 -0700 Subject: Add -lpath mechanism for logging only a subset of a pass (by module-path prefix) --- src/boot/util/common.ml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/boot/util') 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 @@ -179,6 +179,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. *) -- cgit v1.2.3