12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697(************************************************************************)(* * 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) *)(************************************************************************)letoutputstateopts=Option.iter(funostate_file->letfname=CUnix.make_suffixostate_file".coq"inVernacstate.System.dumpfname)opts.Coqcargs.outputstateletcoqc_init((_,color_mode),_)injections~opts=Flags.quiet:=true;System.trust_file_cache:=true;Coqtop.init_color(ifopts.Coqargs.config.Coqargs.print_emacsthen`EMACSelsecolor_mode);DebugHook.Intf.(set{read_cmd=Coqtop.ltac_debug_parse;submit_answer=Coqtop.ltac_debug_answer});injectionsletcoqc_specific_usage=Usage.{executable_name="coqc";extra_args="file...";extra_options="\n\
coqc 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 -schedule-vio2vo j f1..fn run up to j instances of Coq to turn each fi.vio\
\n into fi.vo\
\n -schedule-vio-checking j f1..fn run up to j instances of Coq to check all\
\n proofs in each fi.vio\
\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 -vio process statements and suspend opaque proofs, and produce a .vio file\
\n\
\nUndocumented:\
\n -quick (deprecated) alias for -vio\
\n -vio2vo [see manual]\
\n -check-vio-tasks [see manual]\
\n"}letcoqc_main((copts,_),stm_opts)injections~opts=Topfmt.(in_phase~phase:CompilationPhase)Ccompile.compile_fileoptsstm_optscoptsinjections;(* Careful this will modify the load-path and state so after this
point some stuff may not be safe anymore. *)Topfmt.(in_phase~phase:CompilationPhase)Ccompile.do_viooptscoptsinjections;(* Allow the user to output an arbitrary state *)outputstatecopts;flush_all();ifcopts.Coqcargs.output_contextthenbeginletsigma,env=lete=Global.env()inEvd.from_enve,einFeedback.msg_noticePp.(Flags.(with_optionraw_print(Prettyp.print_full_pure_contextenv)sigma)++fnl())end;CProfile.print_profile()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_codeletcustom_coqc:((Coqcargs.t*Coqtop.color)*Stm.AsyncOpts.stm_opt,'b)Coqtop.custom_toplevel=Coqtop.{parse_extra=(funextras->letcolor_mode,extras=Coqtop.parse_extra_colorsextrasinletstm_opts,extras=Stmargs.parse_args~init:Stm.AsyncOpts.default_optsextrasinletcoqc_opts=Coqcargs.parseextrasin((coqc_opts,color_mode),stm_opts),[]);usage=coqc_specific_usage;init_extra=coqc_init;run=coqc_run;initial_args=Coqargs.default;}letmain()=Coqtop.start_coqcustom_coqc