123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687(****************************************************************************)(* *)(* This file is part of MOPSA, a Modular Open Platform for Static Analysis. *)(* *)(* Copyright (C) 2017-2019 The MOPSA Project. *)(* *)(* This program is free software: 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, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* This program 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. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* along with this program. If not, see <http://www.gnu.org/licenses/>. *)(* *)(****************************************************************************)openAst.SemanticopenMopsa_utilstypedomain=stringtyperoute=|Belowofdomain|Semanticofsemanticletcompare_router1r2=matchr1,r2with|Belowdom1,Belowdom2->String.comparedom1dom2|Semanticsem1,Semanticsem2->String.comparesem1sem2|_->comparer1r2letpp_routefmt=function|Belowdom->Format.fprintffmt"below(%s)"dom|Semanticsem->pp_semanticfmtsemlettoplevel=Semanticany_semanticmoduleDomainSet=SetExt.StringSetmoduleMap=MapExt.Make(structtypet=routeletcompare=compare_routeend)typerouting_table=DomainSet.tMap.tletempty_routing_table=Map.emptyletresolve_routeroutemap=Map.findroutemapletadd_routeselectordomainmap=letold=tryMap.findselectormapwithNot_found->DomainSet.emptyinMap.addselector(DomainSet.adddomainold)mapletadd_routesselectordomainsmap=letold=tryMap.findselectormapwithNot_found->DomainSet.emptyinMap.addselector(DomainSet.uniondomainsold)mapletget_routesmap=Map.bindingsmap|>List.mapfstletjoin_routing_tablem1m2=Map.map2zo(funsem1domains1->domains1)(funsem2domains2->domains2)(funsemdomains1domains2->DomainSet.uniondomains1domains2)m1m2letpp_routing_tablefmtm=Format.(fprintffmt"@[<v>%a@]"(pp_print_list~pp_sep:(funfmt()->fprintffmt"@,")(funfmt(route,domains)->fprintffmt"%a -> {%a}"pp_routeroute(pp_print_list~pp_sep:(funfmt()->fprintffmt", ")pp_print_string)(DomainSet.elementsdomains)))(Map.bindingsm))