X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql_interpreter%2Fmqint.ml;h=5755aa3a6fd399d8ff0b29ff785b8fd8a24a7391;hb=ab2b9e54afe3a66d7283e6205e63dd48a2733b73;hp=b275de355372b898404fe49d85f668acb5fff179;hpb=70ddfe8d7aad2f58a759736c5678fa99e2611da3;p=helm.git diff --git a/helm/ocaml/mathql_interpreter/mqint.ml b/helm/ocaml/mathql_interpreter/mqint.ml index b275de355..5755aa3a6 100644 --- a/helm/ocaml/mathql_interpreter/mqint.ml +++ b/helm/ocaml/mathql_interpreter/mqint.ml @@ -103,7 +103,7 @@ let rec exec_set_exp c = function let ll2 = string_of_int (List.length rs2) in let diff = string_of_float (after -. before) in if !stat then - (print_endline("INTERSECT(" ^ ll1 ^ "," ^ ll2 ^ ") = " ^ string_of_int (List.length res) ^ + (prerr_endline("INTERSECT(" ^ ll1 ^ "," ^ ll2 ^ ") = " ^ string_of_int (List.length res) ^ ": " ^ diff ^ "s"); flush stdout); res @@ -113,7 +113,7 @@ let rec exec_set_exp c = function let after = Sys.time() in let diff = string_of_float (after -. before) in if !stat then - (print_endline ("UNION: " ^ diff ^ "s"); + (prerr_endline ("UNION: " ^ diff ^ "s"); flush stdout); res | MathQL.LetSVar (svar, sexp1, sexp2) -> @@ -121,8 +121,8 @@ let rec exec_set_exp c = function let c1 = upd_svars c ((svar, exec_set_exp c sexp1) :: c.svars) in let res = exec_set_exp c1 sexp2 in if ! stat then - (print_string ("LETIN " ^ svar ^ " = " ^ string_of_int (List.length res) ^ ": "); - print_endline (string_of_float (Sys.time() -. before) ^ "s"); + (prerr_string ("LETIN " ^ svar ^ " = " ^ string_of_int (List.length res) ^ ": "); + prerr_endline (string_of_float (Sys.time() -. before) ^ "s"); flush stdout); res | MathQL.LetVVar (vvar, vexp, sexp) -> @@ -130,8 +130,8 @@ let rec exec_set_exp c = function let c1 = upd_vvars c ((vvar, exec_val_exp c vexp) :: c.vvars) in let res = exec_set_exp c1 sexp in if ! stat then - (print_string ("LETIN " ^ vvar ^ " = " ^ string_of_int (List.length res) ^ ": "); - print_endline (string_of_float (Sys.time() -. before) ^ "s"); + (prerr_string ("LETIN " ^ vvar ^ " = " ^ string_of_int (List.length res) ^ ": "); + prerr_endline (string_of_float (Sys.time() -. before) ^ "s"); flush stdout); res | MathQL.Relation (inv, rop, path, sexp, assl) -> @@ -139,16 +139,16 @@ let rec exec_set_exp c = function if ! dbname = postgres_db then (let res = relation_ex inv rop path (exec_set_exp c sexp) assl in if ! stat then - (print_string ("RELATION " ^ (fst path) ^ " = " ^ string_of_int(List.length res) ^ ": "); - print_endline (string_of_float (Sys.time() -. before) ^ "s"); + (prerr_string ("RELATION " ^ (fst path) ^ " = " ^ string_of_int(List.length res) ^ ": "); + prerr_endline (string_of_float (Sys.time() -. before) ^ "s"); flush stdout); res) else (let res = relation_galax_ex inv rop path (exec_set_exp c sexp) assl in if !stat then - (print_string ("RELATION-GALAX " ^ (fst path) ^ " = " ^ string_of_int(List.length res) ^ ": "); - print_endline (string_of_float (Sys.time() -. before) ^ "s"); + (prerr_string ("RELATION-GALAX " ^ (fst path) ^ " = " ^ string_of_int(List.length res) ^ ": "); + prerr_endline (string_of_float (Sys.time() -. before) ^ "s"); flush stdout); res) @@ -156,17 +156,20 @@ let rec exec_set_exp c = function | MathQL.Select (rvar, sexp, bexp) -> let before = Sys.time() in let rset = (exec_set_exp c sexp) in - let rec select_ex rset = - match rset with - [] -> [] - | r::tl -> let c1 = upd_rvars c ((rvar,r)::c.rvars) in - if (exec_boole_exp c1 bexp) then r::(select_ex tl) - else select_ex tl + let rec select_ex = + function + [] -> [] + | r::tl -> + let c1 = upd_rvars c ((rvar,r)::c.rvars) in + if (exec_boole_exp c1 bexp) then + r::(select_ex tl) + else + select_ex tl in let res = select_ex rset in if ! stat then - (print_string ("SELECT " ^ rvar ^ " = " ^ string_of_int (List.length res) ^ ": "); - print_endline (string_of_float (Sys.time() -. before) ^ "s"); + (prerr_string ("SELECT " ^ rvar ^ " = " ^ string_of_int (List.length res) ^ ": "); + prerr_endline (string_of_float (Sys.time() -. before) ^ "s"); flush stdout); res | MathQL.Diff (sexp1, sexp2) -> diff_ex (exec_set_exp c sexp1) (exec_set_exp c sexp2) @@ -186,7 +189,9 @@ and exec_boole_exp c = meet_ex (exec_val_exp c vexp1) (exec_val_exp c vexp2) | MathQL.Eq (vexp1, vexp2) -> (exec_val_exp c vexp1) = (exec_val_exp c vexp2) | MathQL.Ex l bexp -> - if l = [] then (exec_boole_exp c bexp) else + if l = [] then + (exec_boole_exp c bexp) + else let latt = List.map (fun uri ->