1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768(***************************************************************************)(* This file is part of the third-party OCaml library `smtml`. *)(* Copyright (C) 2023-2024 formalsec *)(* *)(* This program is free software: you can redistribute it and/or modify *)(* it under the terms of the GNU General Public License as published by *)(* the Free Software Foundation, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* This program 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 General Public License for more details. *)(* *)(* You should have received a copy of the GNU General Public License *)(* along with this program. If not, see <https://www.gnu.org/licenses/>. *)(***************************************************************************)openTytypet=|True|False|Intofint|Realoffloat|Strofstring|NumofNum.tletequal(v1:t)(v2:t):Bool.t=match(v1,v2)with|True,True|False,False->true|Intx1,Intx2->Int.equalx1x2|Realx1,Realx2->x1=x2|Strx1,Strx2->String.equalx1x2|Numx1,Numx2->Num.(x1=x2)|_->falseletcomparev1v2=match(v1,v2)with|True,True|False,False->0|Intx1,Intx2->Int.comparex1x2|Realx1,Realx2->Float.comparex1x2|Strx1,Strx2->String.comparex1x2|Numx1,Numx2->Num.comparex1x2|_->comparev1v2lettype_of(v:t):Ty.t=matchvwith|True|False->Ty_bool|Int_->Ty_int|Real_->Ty_real|Str_->Ty_str|Numn->Num.type_ofnletppfmt(v:t)=letopenFormatinmatchvwith|True->pp_print_stringfmt"true"|False->pp_print_stringfmt"false"|Intx->pp_print_intfmtx|Realx->fprintffmt"%F"x|Numx->Num.ppfmtx|Strx->Format.fprintffmt"%S"xletpp_numfmt(v:t)=matchvwithNumx->Num.pp_hexfmtx|_->ppfmtvletto_stringv=Format.asprintf"%a"ppv