123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263(* Copyright (C) 2023--2024 Petter A. Urkedal <paurkedal@gmail.com>
*
* This library 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, with the LGPL-3.0 Linking Exception.
*
* This library 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
* and the LGPL-3.0 Linking Exception along with this library. If not, see
* <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively.
*)(* Map Implementation *)type'atag=..moduletypeKEY=sigtypevaluetype'atag+=Tag:valuetagvalname:string[@@warning"-32"]valdefault:valueendtype'akey=(moduleKEYwithtypevalue='a)letcreate_key(typea)name(default:a):akey=letmoduleKey=structtypevalue=atype_tag+=Tag:valuetagletname=nameletdefault=defaultendin(moduleKey:KEYwithtypevalue=a)moduleString_map=Map.Make(String)typebinding=Binding:'atag*'a->bindingtypet=bindingString_map.tletdefault=String_map.emptyletmem_namekey_name=String_map.memkey_nameletget:typea.akey->t->a=fun(moduleKey)m->(matchString_map.find_optKey.namemwith|Some(Binding(Key.Tag,v))->v|_->Key.default)letset:typea.akey->a->t->t=fun(moduleKey)vm->String_map.addKey.name(Binding(Key.Tag,v))mletreset:typea.akey->t->t=fun(moduleKey)m->String_map.removeKey.namem(* Configuration Keys *)lettweaks_version:(int*int)key=create_key"tweaks_version"(1,7)