123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990(************************************************************************)(* * 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) *)(************************************************************************)letcoqc_init((_,color_mode),_)injections~opts=Flags.quiet:=true;System.trust_file_cache:=true;Colors.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;isTerminal=true});injectionsletcoqc_specific_usage=Boot.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)Vio_compile.do_viooptscoptsinjections;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*Colors.color)*Stm.AsyncOpts.stm_opt,'b)Coqtop.custom_toplevel=Coqtop.{parse_extra=(funextras->letcolor_mode,extras=Colors.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