1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162(************************************************************************)(* * 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) *)(************************************************************************)letparse_env_linel=tryScanf.sscanfl"%[^=]=%S"(funnamevalue->Some(name,value))withScanf.Scan_failure_|End_of_file->Noneletwith_icfilef=letic=open_infileintryletrc=ficinclose_inic;rcwithe->close_inic;raiseeletgetenv_from_filename=letbase=Filename.dirnameSys.executable_nameintrywith_ic(base^"/coq_environment.txt")(funic->letrecfind()=letl=input_lineicinmatchparse_env_linelwith|Some(n,v)whenn=name->Somev|_->find()infind())with|Sys_errors->None|End_of_file->Noneletgetenv_optname=matchSys.getenv_optnamewith|Some_asv->v|None->getenv_from_filenameletwarn_deprecated_coq_var=ref(fun~rocq~coq->Printf.eprintf"Deprecated environment variable %s, use %s instead.\n%!"coqrocq)letset_warn_deprecated_coq_varf=warn_deprecated_coq_var:=fletwarn_deprecated_coq_var~rocq~coq=!warn_deprecated_coq_var~rocq~coqletgetenv_rocq_gen~rocq~coq=matchgetenv_optrocqwith|Some_asv->v|None->matchgetenv_optcoqwith|Some_asv->warn_deprecated_coq_var~rocq~coq;v|None->Noneletgetenv_rocqname=getenv_rocq_gen~rocq:("ROCQ"^name)~coq:("COQ"^name)