method compute =
begin
exported <- None ;
Wp_error.set_model Descr.name ;
F.clear () ;
let env = Wpo.new_env ~context:Descr.context in
let export = { env=env ; goals=[] } in
List.iter
(fun (strategies) ->
List.iter
(fun strategy ->
let cfg = WpStrategy.cfg_of_strategy strategy in
let kf = Cil2cfg.cfg_kf cfg in
let names = WpAnnot.missing_rte kf in
if names <> [] then
Wp_parameters.warning ~current:false ~once:true
"Missing RTE guards" ;
!Db.progress ();
let bhv = WpStrategy.behavior_name_of_strategy strategy in
let goals,annotations = WP.compute cfg strategy in
if Wp_parameters.Dot.get () then
ignore (Cil2cfg.dot_wp_res cfg Descr.shared annotations) ;
List.iter
(List.iter
(add_goal export kf bhv))
goals
) strategies
) wptasks ;
if export.goals <> [] then
begin
let ctxt = Wpo.file_for_ctxt ~env in
Wp_parameters.debug ~dkey "DO ENV DESCP %s" ctxt ;
Command.pp_to_file ctxt
(fun fmt -> F.iter_all (F.pp_section fmt) (F.pp_decl fmt)) ;
Wp_parameters.debug ~dkey "DONE ENV DESCP %s" ctxt ;
let export_env_lgg l =
Wp_parameters.debug ~dkey "DO export env for %a" Wpo.pp_language l ;
Command.pp_to_file (Wpo.file_for_env ~env l)
(fun fmt ->
match l with
| Wpo.L_coq -> Format.fprintf fmt
"Require Import Reals.@\nRequire Import wp.@\nRequire Import %s.@\n"
(Wpo.coq_for_model Descr.shared) ;
F.iter_all (Coq.export_section fmt) (Coq.export_decl fmt)
| Wpo.L_why ->
F.iter_all (Why.export_section fmt) (Why.export_decl fmt)
| Wpo.L_altergo ->
F.iter_all (Ergo.export_section fmt) (Ergo.export_decl fmt)
)
in
if !Config.is_gui || Wp_parameters.debug_atleast 2 then
begin
export_env_lgg Wpo.L_why ;
export_env_lgg Wpo.L_coq ;
export_env_lgg Wpo.L_altergo ;
end
else
begin
match active_lgg () with
| None -> ()
| Some l -> export_env_lgg l
end
end
else
Wpo.release_env env ;
export.goals
end