123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101(****************************************************************************)(* *)(* 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/>. *)(* *)(****************************************************************************)(** Switch of stateless domains *)openMopsa_utilsopenCore.AllopenSig.Combiner.StatelessopenCommonmoduleMake(D1:STATELESS_COMBINER)(D2:STATELESS_COMBINER):STATELESS_COMBINER=struct(**************************************************************************)(** {2 Domain header} *)(**************************************************************************)letid=C_emptyletname=D1.name^" ; "^D2.nameletdomains=DomainSet.unionD1.domainsD2.domainsletsemantics=SemanticSet.unionD1.semanticsD2.semanticsletrouting_table=lett=join_routing_tableD1.routing_tableD2.routing_tableinDomainSet.fold(fund1acc->add_routes(Belowd1)D2.domainsacc)D1.domainstletchecks=D1.checks@D2.checks|>List.sort_uniqcompare(**************************************************************************)(** {2 Transfer functions} *)(**************************************************************************)(** Initialization procedure *)letinitprogmanflow=broadcast_stateless_initD1.initD2.initprogmanflow(** Execution of statements *)letexectargets=cascade_stateless_calltargetsD1.execD1.domainsD2.execD2.domains(** Evaluation of expressions *)letevaltargets=cascade_stateless_calltargetsD1.evalD1.domainsD2.evalD2.domains(** Query handler *)letasktargets=broadcast_stateless_calltargetsD1.askD1.domainsD2.askD2.domains(** Pretty printer of expressions *)letprint_exprtargets=matchsat_targets~targets~domains:D1.domains,sat_targets~targets~domains:D2.domainswith|false,false->raiseNot_found|true,false->D1.print_exprtargets|false,true->D2.print_exprtargets|true,true->letf1=D1.print_exprtargetsinletf2=D2.print_exprtargetsin(funmanflowprintere->f1manflowprintere;f2manflowprintere)endletrecmake(domains:(moduleSTATELESS_COMBINER)list):(moduleSTATELESS_COMBINER)=matchdomainswith|[]->assertfalse|[d]->d|l->leta,b=ListExt.splitlinletaa,bb=makea,makebin(moduleMake(valaa:STATELESS_COMBINER)(valbb:STATELESS_COMBINER))