let term_of_uri uri =
let s = UriManager.string_of_uri uri in
try
- (if String.sub s (String.length s - 4) 4 = ".con" then
+ (if UriManager.uri_is_con uri then
Cic.Const (uri, [])
- else if String.sub s (String.length s - 4) 4 = ".var" then
+ else if UriManager.uri_is_var uri then
Cic.Var (uri, [])
else if not (Str.string_match xpointer_RE s 0) then
raise (UriManager.IllFormedUri s)
| 0 -> []
| _ -> (Cic.Rel (howmany + from)) :: (mk_rels (howmany-1) from)
+let profile =
+ function s ->
+ let total = ref 0.0 in
+ let profile f x =
+ let before = Unix.gettimeofday () in
+ let res = f x in
+ let after = Unix.gettimeofday () in
+ total := !total +. (after -. before);
+ res
+ in
+ at_exit
+ (fun () ->
+ print_endline
+ ("!! TOTAL TIME SPENT IN " ^ s ^ ": " ^ string_of_float !total));
+ profile