]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/getter/http_getter.ml
rebuilt against ocaml 3.08.3
[helm.git] / helm / ocaml / getter / http_getter.ml
index 84b2277a1f998eea9973e9bae000f25b63571bd3..f7ca2388c89b9653d04f8087ac4d021fc8d1e966 100644 (file)
@@ -264,16 +264,7 @@ let resolve uri =
   if remote () then
     resolve_remote uri
   else
-    
-    (**** FIXME ******)
-    if is_cic_uri uri && Pcre.pmatch ~pat:"\\.univ$" uri then
-      begin
-       prerr_endline "!!! E' in ~tassi !!!";
-       "file:///home/tassi/mylib" ^ 
-       (String.sub uri 4 ((String.length uri) - 4)) ^ ".xml.gz"
-      end
-    else
-      (map_of_uri uri)#resolve uri
+    (map_of_uri uri)#resolve uri
        
 let register ~uri ~url =
   if remote () then
@@ -285,7 +276,9 @@ let unregister uri =
   if remote () then
     unregister_remote uri
   else
-    (map_of_uri uri)#remove uri
+    try
+      (map_of_uri uri)#remove uri
+    with Key_not_found _ -> ()
 
 let update ?(logger = fun _ -> ()) () =
   if remote () then
@@ -297,9 +290,9 @@ let getxml ?(format = `Normal) ?(patch_dtd = true) uri =
   if remote () then
     getxml_remote ~format ~patch_dtd uri
   else begin
-Http_getter_logger.log ("GETXML: " ^ uri);
+    Http_getter_logger.log ~level:2 ("getxml: " ^ uri);
     let url = resolve uri in
-Http_getter_logger.log ("RESOLVED_URI: " ^ url) ;
+    Http_getter_logger.log ~level:2 ("resolved_uri: " ^ url) ;
     let (fname, outchan) = temp_file_of_uri uri in
     Http_getter_cache.respond_xml ~via_http:false ~enc:format ~patch:patch_dtd
       ~uri ~url outchan;
@@ -382,8 +375,8 @@ let getalluris () =
     getalluris_remote ()
   else
     let filter uri =
-      (Pcre.pmatch ~rex:heading_cic_RE uri) &&
-      not (Pcre.pmatch ~rex:trailing_types_RE uri)
+      (Pcre.pmatch ~rex:heading_cic_RE uri)
+(*       && not (Pcre.pmatch ~rex:trailing_types_RE uri) *)
     in
     return_uris (Lazy.force cic_map) filter
 
@@ -498,9 +491,6 @@ let ls =
                  let dir =
                   "theory" ^ String.sub !dir_found 3
                    (String.length !dir_found - 3) ^ ".theory" in
-(*
-prerr_endline ("### " ^ uri ^ " ==> " ^ !dir_found ^ " ==> " ^ dir);
-*)
                  if not (List.mem dir !valid_candidates) then
                  valid_candidates := dir::!valid_candidates
                end
@@ -513,10 +503,6 @@ prerr_endline ("### " ^ uri ^ " ==> " ^ !dir_found ^ " ==> " ^ dir);
              then
               (index_not_generated_yet := false ;
                store_obj "index.theory"));
-(*
-prerr_endline ("@@@ " ^ String.concat " " !valid_candidates);
-prerr_endline ("!!! " ^ String.concat " " (List.map fst !candidates_found));
-*)
       List.iter
        (fun (uri,localpart) ->
          if not (List.mem uri !valid_candidates) then
@@ -540,4 +526,10 @@ prerr_endline ("!!! " ^ String.concat " " (List.map fst !candidates_found));
 let getxml' uri = getxml (UriManager.string_of_uri uri)
 let resolve' uri = resolve (UriManager.string_of_uri uri)
 let register' uri url = register ~uri:(UriManager.string_of_uri uri) ~url
+let init () =
+  Http_getter_logger.set_log_level
+    (Helm_registry.get_opt_default Helm_registry.get_int 1 "getter.log_level");
+  Http_getter_logger.set_log_file
+    (Helm_registry.get_opt Helm_registry.get_string "getter.log_file");
+  Http_getter_env.reload ()