let status = ref None
-let run_script is eval_function =
+let run_script output is eval_function =
let status =
match !status with
| None -> assert false
MatitaLog.debug ("Executing: ``" ^ stm ^ "''")
in
try
- eval_function status is cb
+ eval_function output status is cb
with
| MatitaEngine.Drop
| CicTextualParser2.Parse_error _ as exn -> raise exn
let rec go () =
let str = Stream.of_channel stdin in
try
- run_script str MatitaEngine.eval_from_stream_greedy
+ run_script ignore str MatitaEngine.eval_from_stream_greedy
with
| MatitaEngine.Drop -> pp_ocaml_mode ()
| Sys.Break -> MatitaLog.error "user break!"; go ()
| "stdin" -> stdin
| fname -> open_in fname)
in
- run_script is MatitaEngine.eval_from_stream;
+ let os = open_out (MatitaMisc.obj_file_of_script fname) in
+ let output s = output_string os s in
+ output "(* GENERATED FILE: DO NOT EDIT! *)\n\n";
+ run_script output is MatitaEngine.eval_from_stream;
let elapsed = Unix.time () -. time in
let tm = Unix.gmtime elapsed in
let sec =
begin
MatitaLog.message
(sprintf "execution of %s completed in %s." fname (hou^min^sec));
- close_out (open_out (MatitaMisc.obj_file_of_script fname));
+ close_out os;
exit 0
end
with