123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117(**************************************************************************)(* *)(* This file is part of the Frama-C's Luncov plug-in. *)(* *)(* Copyright (C) 2012-2022 *)(* 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 LICENSE) *)(* *)(**************************************************************************)typestatus=Unknownofstring|Uncoverableofstring|Coveredofstringtypenode_elt={labels:intlist;sequences:intlist;condition:(string*string*string)list}typenode={mutableid:int;ls:node_eltlist;mutablestatus:status}letannotateHLabelies={id=i;ls=e.ls;status=s;}letis_unknownhl=matchhl.statuswith|Unknown_->true|_->falseletstring_of_intliststil=letl=List.fold_right(funis->st^(string_of_inti)^"."^s)il""inString.subl0(max0((String.lengthl)-1))letstring_of_tuple(va,t,vb)=matchva,t,vbwith|(va,"=",vb)->va^"=="^vb|(va,"!",vb)->va^"!="^vb|_->raise(Invalid_argument"")letcombine_condlr=if(String.lengthr=0)thenlelse(l^" && "^r)letstring_of_condc=ifc=[]then""elseList.fold_rightcombine_cond(List.mapstring_of_tuplec)""letstring_of_envenv=ifenv=""then"[ ]"elseenvletstring_of_statusstatus=matchstatuswith|Unknownenv->" - UNKNOWN - "^(string_of_envenv)|Uncoverableenv->" - UNCOVERABLE - "^(string_of_envenv)|Coveredenv->" - COVERED - "^(string_of_envenv)letstring_of_noden=(ifn.id>=0then(string_of_intn.id)^") "else"")^(letst=(List.fold_right(funnels->"<"^(string_of_intlist"l"nel.labels)^(if(((List.lengthnel.labels)>0)&&((List.lengthnel.sequences)>0))then"."else"")^(string_of_intlist"s"nel.sequences)^"|;"^(string_of_condnel.condition)^";> + "^s)n.ls"")in(String.subst0((String.lengthst)-3)))^(string_of_statusn.status)^","exceptionSyntaxErrorofstringletcombineelleelri={labels=elle.labels@elri.labels;sequences=elle.sequences@elri.sequences;condition=elle.condition@elri.condition}letcreateDnfFromLabell={id=-1;ls=[{labels=[l];sequences=[];condition=[]}];status=Unknown""}letcreateDnfFromSequences={id=-1;ls=[{labels=[];sequences=[s];condition=[]}];status=Unknown""}letcreateDnfFromGuardhc={id=-1;ls=List.map(funel->{labels=el.labels;sequences=el.sequences;condition=el.condition@c})h.ls;status=Unknown""}letcreateDnfFromConjunctionleri={id=-1;ls=List.concat(List.map(funelle->List.map(funelri->combineelleelri)ri.ls)le.ls);status=Unknown""}letcreateDnfFromDisjunctionleri={id=-1;ls=le.ls@ri.ls;status=Unknown""}