12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394(**************************************************************************)(* This file is part of BINSEC. *)(* *)(* Copyright (C) 2016-2026 *)(* 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). *)(* *)(**************************************************************************)moduletypeS=sigincludeSigs.HASHABLEmoduleMap:sigincludeMap.Swithtypekey=tvalpop:'at->(key*'a)*'atvalkeys:'at->keylistvalvalues:'at->'alistendmoduleSet:sigincludeSet.Swithtypeelt=tvalpop:t->elt*tendmoduleHtbl:sigincludeHashtbl.Swithtypekey=tvalfilter:(key->'a->bool)->'at->'atvalbindings:'at->(key*'a)listendendmoduleMapSetMaker(C:Sigs.COMPARABLE)=structmoduleMap=structincludeMap.Make(C)letpopm=let((k,_)aselt)=choosemin(elt,removekm)letkeysm=fold(funk_acc->k::acc)m[]|>List.revletvaluesm=fold(fun_vacc->v::acc)m[]|>List.revendmoduleSet=structincludeSet.Make(C)letpopset=leta=choosesetin(a,removeaset)endendmoduleHashed(C:Sigs.HASHABLE)=structincludeCincludeMapSetMaker(C)moduleHtbl=structincludeHashtbl.Make(C)letfilterph=leth'=create(lengthh)initer(funkv->ifpkvthenaddh'kv)h;h'letbindingsh=fold(funkvacc->(k,v)::acc)h[]endendmoduleAuto(C:Sigs.COMPARABLE_EXT)=Hashed(structincludeClethash=Hashtbl.hashend)moduleDefault(C:Sigs.COMPARABLE)=Auto(structincludeCletequalab=compareab=0end)