1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283(**************************************************************************)(* *)(* This file is part of WP plug-in of Frama-C. *)(* *)(* Copyright (C) 2007-2024 *)(* 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). *)(* *)(**************************************************************************)moduleL=Wp_parametersmoduleT=Why3.TheorymoduleF=Filepath.NormalizedmoduleW=Why3moduleWConf=Why3.Whyconf(* -------------------------------------------------------------------------- *)letcreate_why3_envloadpath=letmain=WConf.get_main@@WConf.read_configNoneinW.Env.create_env@@WConf.loadpathmain@F.to_string_listloadpathletextract_paththname=letsegments=String.split_on_char'.'thnameinmatchList.revsegmentswith|hd::tl->hd,List.revtl|[]->"",[](* For debug only*)letpp_idfmt(id:W.Ident.ident)=Format.pp_print_stringfmtid.id_stringletimport_theoryenvthname=lettheory_name,theory_path=extract_paththnameintrylettheory=W.Env.read_theoryenvtheory_paththeory_nameinList.iter(fun(tdecl:T.tdecl)->matchtdecl.td_nodewith|Decldecl->beginmatchdecl.d_nodewith|Dtypets->L.debug~level:0"Type %a"pp_idts.ts_name|Ddataddatas->List.iter(fun((ts,_):W.Decl.data_decl)->L.debug~level:0"Data %a"pp_idts.ts_name)ddatas|Dparamls->L.debug~level:0"Param %a"pp_idls.ls_name|Dlogicdlogics->List.iter(fun((ls,_):W.Decl.logic_decl)->L.debug~level:0"Logic %a"pp_idls.ls_name)dlogics|_->()end|Useth->L.debug~level:0"Use %a"pp_idth.th_name|Clone_|Meta_->())theory.th_declswithW.Env.LibraryNotFound_->L.error"Library %s not found"thnamelet()=Boot.Main.extendbeginfun()->letenv=create_why3_env@@L.Library.get()inList.iter(import_theoryenv)@@L.Import.get()end(* -------------------------------------------------------------------------- *)