Commit d992fcc2 authored by Clément Fumex's avatar Clément Fumex

fix reload bis repetitas

parent 1a970615
......@@ -412,14 +412,14 @@ let read_file env ?format fn =
let add_file c ?format fname =
let theories = read_file c.controller_env ?format fname in
add_file_section c.controller_session fname theories format
add_file_section ~use_shapes:false c.controller_session fname theories format
(** reload files, associating old proof attempts and transformations
to the new goals. old theories and old goals for which we cannot
find a corresponding new theory resp. old goal are kept, with
tasks associated to them *)
let merge_file (old_ses : session) (c : controller) env _ file =
let merge_file (old_ses : session) (c : controller) env ~use_shapes _ file =
let format = file.file_format in
let old_theories = file.file_theories in
let file_name = Filename.concat (get_dir old_ses) file.file_name in
......@@ -430,12 +430,12 @@ let merge_file (old_ses : session) (c : controller) env _ file =
[]
in
add_file_section
c.controller_session ~merge:(old_ses,old_theories,env) file_name new_theories format
c.controller_session ~use_shapes ~merge:(old_ses,old_theories,env) file_name new_theories format
let reload_files (c : controller) (env : Env.env) =
let reload_files (c : controller) (env : Env.env) ~use_shapes =
let old_ses = c.controller_session in
c.controller_session <- empty_session ~shape_version:(get_shape_version old_ses) (get_dir old_ses);
Stdlib.Hstr.iter (merge_file old_ses c env) (get_files old_ses)
Stdlib.Hstr.iter (merge_file old_ses c env ~use_shapes) (get_files old_ses)
end
......@@ -129,7 +129,7 @@ val add_file : controller -> ?format:Env.fformat -> string -> unit
(** [add_fil cont ?fmt fname] parses the source file
[fname] and add the resulting theories to the session of [cont] *)
val reload_files : controller -> Env.env -> unit
val reload_files : controller -> Env.env -> use_shapes:bool -> unit
(** reload the files of the given session:
- each file is parsed again and theories/goals extracted from it. If
......
This diff is collapsed.
......@@ -77,8 +77,8 @@ val empty_session : ?shape_version:int -> string -> session
argument *)
val add_file_section :
?merge:session*theory list*Env.env -> session -> string ->
(Theory.theory list) -> Env.fformat option -> unit
use_shapes:bool -> ?merge:session*theory list*Env.env -> session ->
string -> (Theory.theory list) -> Env.fformat option -> unit
(** [add_file_section ~merge:(old_s,old_ths,env) s fn ths] adds a new
'file' section in session [s], named [fn], containing fresh theory
subsections corresponding to theories [ths]. The tasks of each
......@@ -100,11 +100,11 @@ val update_proof_attempt : session -> proofNodeID -> Whyconf.prover ->
corresponding proof attempt with [st]. *)
val graft_transf : session -> proofNodeID -> string -> string list ->
Task.task list -> transID
Task.task list -> transID
(** [graft_transf s id name l tl] adds the transformation [name] as a
child of the task [id] of the session [s]. [l] is the list of
arguments of the transformation, and [tl] is the list of subtasks.
*)
*)
val remove_proof_attempt : session -> proofNodeID -> Whyconf.prover -> unit
(** [remove_proof_attempt s id pr] removes the proof attempt from the
......@@ -117,6 +117,15 @@ val remove_transformation : session -> transID -> unit
val save_session : session -> unit
(** [save_session s] Save the session [s] *)
val load_session : string -> session
val load_session : string -> session * bool
(** [load_session dir] load a session in directory [dir]; all the
tasks are initialised to None *)
tasks are initialised to None
The returned boolean is set when there was shapes read from disk.
raises [SessionFileError msg] if the database file cannot be read
correctly.
raises [ShapesFileError msg] if the database extra file for shapes
cannot be read.
*)
......@@ -173,11 +173,12 @@ let cont_init () =
else Filename.dirname fname
in
(* we load the session *)
let ses = Session_itp.load_session dir in
let ses,use_shapes = Session_itp.load_session dir in
eprintf "using shapes: %a@." pp_print_bool use_shapes;
(* create the controller *)
let c = Controller_itp.create_controller env ses in
(* update the session *)
C.reload_files c env;
C.reload_files c env ~use_shapes;
(* add files to controller *)
Queue.iter (fun fname -> C.add_file c fname) files;
(* load provers drivers *)
......@@ -534,7 +535,8 @@ let test_save_session _fmt _args =
let test_reload fmt _args =
fprintf fmt "Reloading... @?";
C.reload_files cont env;
(* use_shapes is true since session is in memory *)
C.reload_files cont env ~use_shapes:true;
zipper_init ();
fprintf fmt "done @."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment