123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990(**************************************************************************)(* *)(* This file is part of Frama-C. *)(* *)(* Copyright (C) 2007-2023 *)(* CEA (Commissariat à l'énergie atomique et aux énergies *)(* 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). *)(* *)(**************************************************************************)moduleTable=Datatype.String.Hashtblletvarinfos=Table.create13letlogic_functions=Table.create13letaxiomatics=Table.create13letget_variablenamemake=ifTable.memvarinfosnamethenTable.findvarinfosnameelsebegintryGlobals.Vars.find_from_astinfonameGlobalwithNot_found->letvi=make()inTable.addvarinfosnamevi;viendletget_logic_functionnamemake=ifTable.memlogic_functionsnamethenTable.findlogic_functionsnameelsebeginmatchLogic_env.find_all_logic_functionsnamewith|[]->letli=make()inTable.addlogic_functionsnameli;Logic_utils.add_logic_functionli;li|[x]->x|_::_->Options.not_yet_implemented"Logic function overloading"endletin_axiomatic_functions=Table.create13letget_logic_function_in_axiomaticnamemake=ifTable.memin_axiomatic_functionsnamethenTable.findin_axiomatic_functionsnameelsebeginletmake_then_findname=letopenCil_typesinlet(ax_name,ax_list),functions=make()inList.iter(funf->Table.addin_axiomatic_functionsf.l_var_info.lv_namef;Logic_utils.add_logic_functionf)functions;Table.addaxiomaticsax_nameax_list;Table.findin_axiomatic_functionsnameintrymatchLogic_env.find_all_logic_functionsnamewith|[]->make_then_findname|[x]->x|_::_->Options.not_yet_implemented"Logic function overloading"withNot_found->Options.fatal"Failed to build %s"nameendletclear()=Table.clearvarinfosletglobalsloc=letopenCil_typesinletl=[]inletl=Table.fold(fun_xl->GVarDecl(x,loc)::l)varinfoslinletannotxloc=GAnnot(x,loc)inletfun_or_predxloc=annot(Dfun_or_pred(x,loc))locinletaxiomaticnamelistloc=annot(Daxiomatic(name,list,[],loc))locinletl=Table.fold(fun_xl->fun_or_predxloc::l)logic_functionslinletl=Table.fold(funnxl->axiomaticnxloc::l)axiomaticslinl