123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110(****************************************************************************)(* *)(* 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/>. *)(* *)(****************************************************************************)(** Stateless stacks are domains without an abstract element (e.g., iterators).
Only transfer functions need to be defined.
*)openCore.AllopenMopsa_utilsmoduletypeSTATELESS=sig(** {2 Domain header} *)(** ***************** *)valname:string(** Name of the domain *)valid:unitid(** Identifier of the domain *)valchecks:checklist(** List of checks performed by the domain *)(** {2 Transfer functions} *)(** ********************** *)valinit:program->('a,unit)man->'aflow->'apostoption(** Initialization routine *)valexec:stmt->('a,unit)man->'aflow->'apostoption(** Computation of post-conditions *)valeval:expr->('a,unit)man->'aflow->'aevaloption(** Evaluation of expressions *)valask:('a,'r)query->('a,unit)man->'aflow->('a,'r)casesoption(** Handler of queries *)(** {2 Printing} *)(** ************ *)valprint_expr:('a,unit)man->'aflow->printer->expr->unit(** Printer of an expression's value *)end(*==========================================================================*)(** {2 Registration} *)(*==========================================================================*)(** Instrument transfer functions with some useful pre/post processing *)moduleInstrument(D:STATELESS):STATELESS=structincludeD(* Remove duplicate evaluations *)letevalexpmanflow=matchD.evalexpmanflowwith|Somex->Some(Eval.remove_duplicatesman.latticex)|None->Noneendletdomains:(moduleSTATELESS)listref=ref[]letregister_stateless_domaindom=letmoduleD=(valdom:STATELESS)indomains:=(moduleInstrument(D))::!domainsletfind_stateless_domainname=List.find(fundom->letmoduleS=(valdom:STATELESS)incompareS.namename=0)!domainsletmem_stateless_domainname=List.exists(fundom->letmoduleS=(valdom:STATELESS)incompareS.namename=0)!domainsletstateless_domain_names()=List.map(fundom->letmoduleS=(valdom:STATELESS)inS.name)!domains