aboutsummaryrefslogtreecommitdiff
path: root/lib/util.ml
diff options
context:
space:
mode:
authorherbelin2009-01-02 17:19:41 +0000
committerherbelin2009-01-02 17:19:41 +0000
commit7e0edc16cd7beeff5c569fd0df531cb975642415 (patch)
tree0fddf1afa8586238c2f90bbd0ac2c1c80efeb7f8 /lib/util.ml
parentbd62a667bc97c9dac0c288c873a14f9bf42d76b0 (diff)
Made the debugger work again:
- call to open_process_full from Envars.camlp4lib was apparently disturbing stdin/stdout/stderr and precipitating coqtop.byte death in ocamldebug; renounced to add camlp4 to the ml path (why was it useful?) which was the reason for calling camlp4lib (seems like camlp4lib is now useless), - Envars was needing str.cma which was missing when calling printers.cma; renounced to use str.cma since its only use was for an elementary split function. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@11734 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib/util.ml')
-rw-r--r--lib/util.ml18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 6803412fdb..fe715f0a77 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -109,19 +109,23 @@ let ordinal n =
(* string parsing *)
-let parse_loadpath s =
+let split_string_at c s =
let len = String.length s in
- let rec decoupe_dirs n =
+ let rec split n =
try
- let pos = String.index_from s n '/' in
- if pos = n then
- invalid_arg "parse_loadpath: find an empty dir in loadpath";
+ let pos = String.index_from s n c in
let dir = String.sub s n (pos-n) in
- dir :: (decoupe_dirs (succ pos))
+ dir :: split (succ pos)
with
| Not_found -> [String.sub s n (len-n)]
in
- if len = 0 then [] else decoupe_dirs 0
+ if len = 0 then [] else split 0
+
+let parse_loadpath s =
+ let l = split_string_at '/' s in
+ if List.mem "" l then
+ invalid_arg "parse_loadpath: find an empty dir in loadpath";
+ l
module Stringset = Set.Make(struct type t = string let compare = compare end)