123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869(************************************************************************)(* * The Coq Proof Assistant / The Coq 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) *)(************************************************************************)openPpletfatal_errormsg=Topfmt.std_loggerFeedback.Errormsg;flush_all();exit1letwarn_file_no_extension=CWarnings.create~name:"file-no-extension"~category:CWarnings.CoreCategories.filesystem(fun(f,ext)->str"File \""++strf++strbrk"\" has been implicitly expanded to \""++strf++strext++str"\"")letensure_extextf=ifFilename.check_suffixfextthenfelsebeginwarn_file_no_extension(f,ext);f^extendletsafe_chop_extensionf=tryFilename.chop_extensionfwith_->fletensure_bnamesrctgt=letsrc,tgt=Filename.basenamesrc,Filename.basenametgtinletsrc,tgt=safe_chop_extensionsrc,safe_chop_extensiontgtinifsrc<>tgtthenfatal_error(str"Source and target file names must coincide, directories can differ"++fnl()++str"Source: "++strsrc++fnl()++str"Target: "++strtgt)letensure~ext~src~tgt=ensure_bnamesrctgt;ensure_extexttgtletensure_existsf=ifnot(Sys.file_existsf)thenfatal_error(hov0(str"Can't find file"++spc()++strf))letensure_exists_with_prefix~src~tgt:f_out~src_ext~tgt_ext=letlong_f_dot_src=ensure~ext:src_ext~src~tgt:srcinensure_existslong_f_dot_src;letlong_f_dot_tgt=matchf_outwith|None->safe_chop_extensionlong_f_dot_src^tgt_ext|Somef->ensure~ext:tgt_ext~src:long_f_dot_src~tgt:finlong_f_dot_src,long_f_dot_tgtletensure_no_pending_proofs~filenames=matchs.Vernacstate.interp.lemmaswith|Somelemmas->letpfs=Vernacstate.LemmaStack.get_all_proof_nameslemmasinfatal_error(str"There are pending proofs in file "++strfilename++str": "++(pfs|>List.rev|>prlist_with_seppr_commaNames.Id.print)++str".");|None->letpm=s.Vernacstate.interp.programinletwhat_for=Pp.str("file "^filename)inNeList.iter(funpm->Declare.Obls.check_solved_obligations~what_for~pm)pm