123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171(**************************************************************************)(* *)(* This file is part of WP plug-in of Frama-C. *)(* *)(* Copyright (C) 2007-2023 *)(* CEA (Commissariat a l'energie atomique et aux energies *)(* alternatives) *)(* *)(* you can redistribute it and/or modify it under the terms of the GNU *)(* Lesser General Public License as published by the Free Software *)(* Foundation, version 2.1. *)(* *)(* It is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file licenses/LGPLv2.1). *)(* *)(**************************************************************************)(* -------------------------------------------------------------------------- *)(* --- PO List View --- *)(* -------------------------------------------------------------------------- *)openWpomoduleWindex=Indexer.Make(Wpo.S)classmodel=object(self)valmutableindex=Windex.emptymethodreload=index<-Windex.emptymethodaddw=index<-Windex.addwindexmethodsize=Windex.sizeindexmethodindexw=Windex.indexwindexmethodgetk=Windex.getkindexmethodcoerce=(self:>Wpo.tWtable.listmodel)endletrender_prover_resultp=leticn_stockname=[`STOCK_IDname]inleticn_statuss=[`PIXBUF(Gtk_helper.Icon.get(Gtk_helper.Icon.Feedbacks))]inleticn_na=[`PIXBUF(Gtk_helper.Icon.getGtk_helper.Icon.Unmark)]inleticn_none=icn_stock""inleticn_valid=icn_statusProperty_status.Feedback.Validinleticn_unknown=icn_statusProperty_status.Feedback.Unknowninleticn_invalid=icn_statusProperty_status.Feedback.Invalidinleticn_failed=icn_stock"gtk-dialog-warning"inleticn_cut=icn_stock"gtk-cut"inleticn_running=icn_stock"gtk-execute"inletopenVCSinleticon_of_verdict~smoke=function|NoResult->icn_none|Valid->ifsmokethenicn_invalidelseicn_valid|Unknown->ifsmokethenicn_validelseicn_unknown|Timeout|Stepout->ifsmokethenicn_validelseicn_cut|Failed->icn_failed|Computing_->icn_runninginfunw->matchWpo.get_resultwp,pwith|{verdict=NoResult},Qed->icn_na|{verdict=NoResult},Tactical->beginmatchProverScript.getwwith|`None->icn_na|`Script->icn_stock"gtk-media-play"|`Proof->icn_stock"gtk-edit"|`Saved->icn_stock"gtk-file"end|result,_->icon_of_verdict~smoke:(Wpo.is_smoke_testw)result.verdictclasspane(gprovers:GuiConfig.provers)=letmodel=newmodelinletlist=newWtable.list~headers:true~rules:truemodel#coerceinobject(self)methodcoerce=list#coercemethodreload=list#reloadmethodaddwpo=beginmodel#addwpo;list#insert_rowwpo;endmethodsize=model#sizemethodindex=model#indexmethodget=model#getmethodupdate_all=list#update_allmethodupdatew=list#update_roww(* -------------------------------------------------------------------------- *)(* --- Prover Columns Management --- *)(* -------------------------------------------------------------------------- *)valmutableprovers:(VCS.prover*GTree.view_column)list=[]methodprivateprover_of_columnc=letid=c#misc#get_oidintrySome(fst(List.find(fun(_,c0)->id=c0#misc#get_oid)provers))withNot_found->Nonemethodprivatecolumn_of_proverp=trySome(snd(List.find(fun(p0,_)->p=p0)provers))withNot_found->Nonemethodprivatecreate_proverp=beginlettitle=VCS.title_of_proverpinletcolumn=list#add_column_pixbuf~title[](render_prover_resultp)inifp<>VCS.Qedthenprovers<-(p,column)::proversendmethodprivateconfigure(dps:Why3.Whyconf.Sprover.t)=begin(* Removing Useless Columns *)List.iter(fun(vcs,column)->matchvcswith|VCS.Why3p->column#set_visible(Why3.Whyconf.Sprover.mempdps);(* ignore (list#view#remove_column column) *)|_->())provers;(* Installing Missing Columns *)Why3.Whyconf.Sprover.iter(fundp->letprv=VCS.Why3dpinmatchself#column_of_proverprvwith|None->self#create_proverprv|Some_->())dps;endinitializerbeginletrenderw=[`TEXT(Pretty_utils.to_stringWpo.pp_indexw.po_idx)]inignore(list#add_column_text~title:"Module"[]render);letrenderw=[`TEXT(Pretty_utils.to_stringWpo.pp_titlew)]inignore(list#add_column_text~title:"Goal"[]render);letrenderw=[`TEXT(Wpo.get_modelw|>WpContext.MODEL.descr)]inignore(list#add_column_text~title:"Model"[]render);List.iterself#create_prover[VCS.Qed;VCS.Tactical];ignore(list#add_column_empty);list#set_selection_mode`MULTIPLE;gprovers#connectself#configure;self#configuregprovers#get;endmethodprivateon_cellfwc=fw(self#prover_of_columnc)methodon_clickf=list#on_click(self#on_cellf)methodon_double_clickf=list#on_double_click(self#on_cellf)methodon_right_clickf=list#on_right_click(self#on_cellf)methodon_selectionf=list#on_selection(fun()->flist#count_selected)methoditer_selected=list#iter_selectedmethodcount_selected=list#count_selectedmethodshoww=letcol=list#view#get_column1inlist#set_focuswcolend