123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778(****************************************************************************)(* *)(* 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/>. *)(* *)(****************************************************************************)(** Render the output of an analysis depending on the selected engine. *)openCore.AllopenCommonopenMopsa_utils(* Output engines *)(* -------------- *)letengines=Hashtbl.create16let()=Hashtbl.addenginesF_text(moduleText:OUTPUT)let()=Hashtbl.addenginesF_json(moduleJson:OUTPUT)letget_output_engine():(moduleOUTPUT)=Hashtbl.findengines!opt_format(* Result rendering *)(* ---------------- *)(* Print collected alarms in the desired output format *)letreportmanflow~time~files=letreport=Core.Flow.get_reportflowinletreturn_v=if!opt_silent||is_safe_reportreportthen0else1inletmoduleE=(val(get_output_engine()))inE.reportmanflow~time~files~out:!opt_file;return_vletpanic~btraceexn~time~filescontinuation=letmoduleE=(val(get_output_engine()))inE.panicexn~btrace~time~files~out:!opt_filecontinuation;2lethelp(args:ArgExt.arglist)=letmoduleE=(val(get_output_engine()))inE.helpargs~out:!opt_fileletlist_domains(domains:stringlist)=letmoduleE=(val(get_output_engine()))inE.list_domainsdomains~out:!opt_fileletlist_reductions(reductions:stringlist)=letmoduleE=(val(get_output_engine()))inE.list_reductionsreductions~out:!opt_fileletlist_checks(checks:checklist)=letmoduleE=(val(get_output_engine()))inE.list_checkschecks~out:!opt_fileletlist_hooks(hooks:stringlist)=letmoduleE=(val(get_output_engine()))inE.list_hookshooks~out:!opt_fileletprintprinterrange=letmoduleE=(val(get_output_engine()))inE.printprinter~range~out:!opt_file