(******************************************************************************)
(* CSC: IMPERATIVE AND NOT VERY CLEAN, TO GET THE LAST ISSUED QUERY *)
+(* FG : THIS FUNCTION IS BECOMING A REAL NONSENSE *)
let get_last_query =
let query = ref "" in
+ let out s = query := ! query ^ s in
MQueryGenerator.set_confirm_query
- (function q -> query := MQueryUtil.text_of_query q ; true) ;
+ (function q ->
+ query := ""; MQueryUtil.text_of_query out q ""; true);
function result ->
- !query ^ " <h1>Result:</h1> " ^ MQueryUtil.text_of_result result "<br>"
+ out (!query ^ " <h1>Result:</h1> "); MQueryUtil.text_of_result out result "<br>";
+ !query
;;
(** This module provides a functor to disambiguate the input **)
(* MISC FUNCTIONS *)
(* CSC: IMPERATIVE AND NOT VERY CLEAN, TO GET THE LAST ISSUED QUERY *)
+(* FG : THIS FUNCTION IS BECOMING A REAL NONSENSE *)
let get_last_query =
let query = ref "" in
+ let out s = query := ! query ^ s in
MQueryGenerator.set_confirm_query
- (function q -> query := MQueryUtil.text_of_query q ; true) ;
- function result -> !query ^ " <h1>Result:</h1> " ^ MQueryUtil.text_of_result result "<br>"
+ (function q ->
+ query := ""; MQueryUtil.text_of_query out q ""; true);
+ function result ->
+ out (!query ^ " <h1>Result:</h1> "); MQueryUtil.text_of_result out result "<br>";
+ !query
;;
let
in
let log q r =
let och = open_out_gen mode perm ! log_file in
- if ! query_num = 1 then output_string och (time () ^ nl);
- let str =
- "Query: " ^ string_of_int ! query_num ^ nl ^ Util.text_of_query q ^ nl ^
- "Result:" ^ nl ^ Util.text_of_result r nl in
- output_string och str;
+ let out = output_string och in
+ if ! query_num = 1 then out (time () ^ nl);
+ out ("Query: " ^ string_of_int ! query_num ^ nl); Util.text_of_query out q nl;
+ out ("Result:" ^ nl); Util.text_of_result out r nl;
flush och
in
let execute q =
(*let q_let_po = M.LetVVar ("obj_positions", M.Const opos, q_let_pr) in*)
-print_endline ("### " ^ MQueryUtil.text_of_query (q_let_po opos 1)) ; flush stdout;
+print_endline "### "; MQueryUtil.text_of_query print_string (q_let_po opos 1) "\n"; flush stdout;
execute_query (q_let_po opos 1)
+topLevel.cmo: ../mQueryGenerator.cmi ../../ocaml/mathql/mQueryUtil.cmi \
+ ../../ocaml/mathql_interpreter/mqint.cmi
+topLevel.cmx: ../mQueryGenerator.cmx ../../ocaml/mathql/mQueryUtil.cmx \
+ ../../ocaml/mathql_interpreter/mqint.cmx
OCAMLOPTIONS = -I .. -package "$(REQUIRES)" -predicates "$(PREDICATES)"
OCAMLC = ocamlfind ocamlc $(OCAMLOPTIONS)
OCAMLOPT = ocamlfind ocamlopt $(OCAMLOPTIONS)
-OCAMLDEP = ocamldep
+OCAMLDEP = ocamldep -I .. -I ../../ocaml/mathql_interpreter -I ../../ocaml/mathql
LIBRARIES = $(shell ocamlfind query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES))
LIBRARIES_OPT = $(shell ocamlfind query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES))
let default_confirm q =
let module Util = MQueryUtil in
- if ! show_queries then print_string (Util.text_of_query q ^ nl);
+ if ! show_queries then Util.text_of_query print_string q nl;
let b = check_db () in
if ! db_down then print_endline "db_down"; b
Gen.set_confirm_query default_confirm;
try
let q = Util.query_of_text (Lexing.from_channel ich) in
- print_endline (Util.text_of_result (Gen.execute_query q) nl);
+ Util.text_of_result print_string (Gen.execute_query q) nl;
flush stdout
with Gen.Discard -> ()
let module Gen = MQueryGenerator in
Gen.set_confirm_query default_confirm;
try
- print_endline (Util.text_of_result (Gen.locate name) nl);
+ Util.text_of_result print_string (Gen.locate name) nl;
flush stdout
with Gen.Discard -> ()
let gen = List.nth info 1 in
if Mqint.get_stat () then
print_string (num ^ " GEN = " ^ gen ^ ":" ^ string_of_float t1 ^ "s" ^ nl);
- print_string (Util.text_of_result r nl);
+ Util.text_of_result print_string r nl;
flush stdout
with Gen.Discard -> ()
in