123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2022 Trili Tech, <contact@trili.tech> *)(* Copyright (c) 2022 Nomadic Labs, <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)moduleInt32=structmoduletypeBOUNDS=sigvalmin_int:int32valmax_int:int32endmoduletypeS=sigtypetincludeBOUNDSincludeTezos_base.TzPervasives.Compare.Swithtypet:=tvalencoding:tData_encoding.tvalto_int32:t->int32valof_int32:int32->toptionendmoduleMake(B:BOUNDS)=structincludeTezos_base.TzPervasives.Compare.Int32(* This includes [type t = int32] *)includeBletto_int32x=xletof_int32n=ifTezos_base.TzPervasives.Compare.Int32.(n<B.min_int)thenNoneelseifTezos_base.TzPervasives.Compare.Int32.(n>B.max_int)thenNoneelseSomenletencoding=Data_encoding.(conv_with_guardto_int32(funx->matchof_int32xwith|None->Error"Out of bounds"|Somex->Okx)int32)endmoduleNonNegative=structincludeTezos_base.Bounded.Non_negative_int32letto_int32=to_valueletof_int32=of_valueletmin_int=min_valueletmax_int=max_valueendletnon_negative_of_legacy_non_negative=Fun.idletlegacy_non_negative_of_non_negative=Fun.idend