123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960(************************************************************************)(* * The Rocq Prover / The Rocq Development Team *)(* v * Copyright INRIA, CNRS and contributors *)(* <O___,, * (see version control and CREDITS file for authors & dates) *)(* \VV/ **************************************************************)(* // * This file is distributed under the terms of the *)(* * GNU Lesser General Public License Version 2.1 *)(* * (see LICENSE file for the text of the license) *)(************************************************************************)(* If [restore] is false, whenever [f] modifies the ref, we will
preserve the modification. *)letwith_modified_ref?(restore=true)rnffx=letacquirex=letold_ref=!rinr:=nf!r;(old_ref,!r,x)inletrelease(old_ref,pre,_)=(* If r was modified don't restore its old value *)ifrestore||pre==!rthenr:=old_ref;r:=old_refinletscope(old_ref,pre,x)=fxinMemprof_coq.Masking.with_resource~acquirex~scope~releaseletwith_optionofx=with_modified_ref~restore:falseo(fun_->true)fxletwithout_optionofx=with_modified_ref~restore:falseo(fun_->false)fx(* hide the [restore] option as internal *)letwith_modified_refrnffx=with_modified_refrnffxletwith_optionsolfx=letvl=List.map(!)olinlet()=List.iter(funr->r:=true)olintryletr=fxinlet()=List.iter2(:=)olvlinrwithreraise->letreraise=Exninfo.capturereraiseinlet()=List.iter2(:=)olvlinExninfo.iraisereraiseletasync_proofs_worker_id=ref"master"letasync_proofs_is_worker()=!async_proofs_worker_id<>"master"letin_debugger=reffalseletin_ml_toplevel=reffalseletin_synterp_phase=refNone(* Translate *)letbeautify=reffalseletbeautify_file=reffalse(* Silent / Verbose *)letquiet=reffalseletsilentlyfx=with_optionquietfxletverboselyfx=without_optionquietfxletif_silentfx=if!quietthenfxletif_verbosefx=ifnot!quietthenfxlettest_mode=reffalse