1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495(************************************************************************)(* * 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) *)(************************************************************************)letcoqc_init((_,color_mode),_)injections~opts=Flags.quiet:=true;System.trust_file_cache:=true;Colors.init_colorcolor_mode;DebugHook.Intf.(set{read_cmd=Coqtop.ltac_debug_parse;submit_answer=Coqtop.ltac_debug_answer;isTerminal=true});injectionsletcoqc_specific_usage=Boot.Usage.{executable_name="rocq compile";extra_args="file...";extra_options="\n\
rocq compile specific options:\
\n -o f.vo use f.vo as the output file name\
\n -verbose compile and output the input file\
\n -noglob do not dump globalizations\
\n -dump-glob f dump globalizations in file f (to be used by coqdoc)\
\n -vos process statements but ignore opaque proofs, and produce a .vos file\
\n -vok process the file by loading .vos instead of .vo files for\
\n dependencies, and produce an empty .vok file on success\
\n"}letcoqc_main((copts,_),stm_opts)injections~opts=Topfmt.(in_phase~phase:CompilationPhase)Ccompile.compile_fileoptsstm_optscoptsinjections;flush_all();ifcopts.Coqcargs.output_contextthenbeginletsigma,env=lete=Global.env()inEvd.from_enve,einletaccess=Library.indirect_accessor[@@warning"-3"]inFeedback.msg_noticePp.(Flags.(with_optionraw_print(fun()->Prettyp.print_full_pure_contextaccessenvsigma)())++fnl())end;()letcoqc_runcopts~optsinjections=let_feeder=Feedback.add_feederCoqloop.coqloop_feedintrycoqc_main~optscoptsinjections;exit0withexn->flush_all();Topfmt.print_err_exnexn;flush_all();letexit_code=if(CErrors.is_anomalyexn)then129else1inexitexit_codeletfix_stm_optsoptsstm_opts=matchopts.Coqcargs.compilation_modewith|BuildVos->(* We need to disable error resiliency, otherwise some errors
will be ignored in batch mode. c.f. #6707
This is not necessary in the vo case as it fully checks the
document anyways. *)letopenStm.AsyncOptsin{stm_optswithasync_proofs_mode=APon;async_proofs_n_workers=0;async_proofs_cmd_error_resilience=false;async_proofs_tac_error_resilience=FNone;}|BuildVo|BuildVok->stm_optsletcustom_coqc:((Coqcargs.t*Colors.color)*Stm.AsyncOpts.stm_opt,'b)Coqtop.custom_toplevel=Coqtop.{parse_extra=(funoptsextras->letcolor_mode,extras=Colors.parse_extra_colors~emacs:opts.config.print_emacsextrasinletstm_opts,extras=Stmargs.parse_argsoptsextrasinletcoqc_opts=Coqcargs.parseextrasinletstm_opts=fix_stm_optscoqc_optsstm_optsin((coqc_opts,color_mode),stm_opts),[]);usage=coqc_specific_usage;init_extra=coqc_init;run=coqc_run;initial_args=Coqargs.default;}letmainargs=let()=Memtrace_init.init()inCoqtop.start_coqcustom_coqcargs