12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485(**************************************************************************)(* *)(* This file is part of Frama-C. *)(* *)(* Copyright (C) 2007-2023 *)(* 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 licenses/LGPLv2.1). *)(* *)(**************************************************************************)openCil_typesmoduleTyp=structletparamstyp=matchCil.unrollTypetypwith|TFun(_,args,_,_)->Cil.argsToListargs|_->invalid_arg"params"letghost_partitioned_paramstyp=matchCil.unrollTypetypwith|TFun(_,args,_,_)->Cil.argsToPairOfListsargs|_->invalid_arg"params"letparams_typestyp=List.map(fun(_,typ,_)->typ)(paramstyp)letparams_counttyp=List.length(paramstyp)endmoduleList=structincludeListletrecmakena=ifn<=0then[]elsea::make(n-1)aletrectakenl=ifn<=0then[]elsematchlwith|[]->[]|a::l->a::take(n-1)lletrecdropnl=ifn<=0thenlelsematchlwith|[]->[]|_::l->drop(n-1)lletrecbreaknl=ifn<=0then([],l)elsematchlwith|[]->([],[])|a::l->letl1,l2=break(n-1)lin(a::l1,l2)letmapi2fl1l2=leti=ref0inletrecauxl1l2=matchl1,l2with|[],[]->[]|a1::l1,a2::l2->letr=f!ia1a2inincri;r::auxl1l2|_,_->invalid_arg"List.mapi2"inauxl1l2letifindfl=leti=ref0inletrecaux=function|[]->raiseNot_found|a::l->ifnot(fa)then(incri;auxl)inauxl;!iend