1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162(************************************************************************)(* * 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) *)(************************************************************************)(** Protocol version of this file. This is the date of the last modification. *)letprotocol_version="20230413"(** See xml-protocol.md for a description of the protocol. *)(** UPDATE xml-protocol.md WHEN YOU UPDATE THE PROTOCOL *)typemsg_format=Richppof{width:int;depth:int}|Ppcmdsletmsg_format=ref(Richpp{width=72;depth=max_int})(** * Interface of calls to Coq by CoqIDE *)openUtilopenInterfaceopenSerializeopenXml_datatype(* Marshalling of basic types and type constructors *)moduleXml_marshalling=structletof_search_cst=function|Name_Patterns->constructor"search_cst""name_pattern"[of_strings]|Type_Patterns->constructor"search_cst""type_pattern"[of_strings]|SubType_Patterns->constructor"search_cst""subtype_pattern"[of_strings]|In_Modulem->constructor"search_cst""in_module"[of_listof_stringm]|Include_Blacklist->constructor"search_cst""include_blacklist"[]letto_search_cst=do_match"search_cst"(funsargs->matchswith|"name_pattern"->Name_Pattern(to_string(singletonargs))|"type_pattern"->Type_Pattern(to_string(singletonargs))|"subtype_pattern"->SubType_Pattern(to_string(singletonargs))|"in_module"->In_Module(to_listto_string(singletonargs))|"include_blacklist"->emptyargs;Include_Blacklist|x->raise(Marshal_error("search",PCDatax)))letof_coq_objectfans=letprefix=of_listof_stringans.coq_object_prefixinletqualid=of_listof_stringans.coq_object_qualidinletobj=fans.coq_object_objectinElement("coq_object",[],[prefix;qualid;obj])letto_coq_objectf=function|Element("coq_object",[],[prefix;qualid;obj])->letprefix=to_listto_stringprefixinletqualid=to_listto_stringqualidinletobj=fobjin{coq_object_prefix=prefix;coq_object_qualid=qualid;coq_object_object=obj;}|x->raise(Marshal_error("coq_object",x))letof_option_value=function|IntValuei->constructor"option_value""intvalue"[of_optionof_inti]|BoolValueb->constructor"option_value""boolvalue"[of_boolb]|StringValues->constructor"option_value""stringvalue"[of_strings]|StringOptValues->constructor"option_value""stringoptvalue"[of_optionof_strings]letto_option_value=do_match"option_value"(funsargs->matchswith|"intvalue"->IntValue(to_optionto_int(singletonargs))|"boolvalue"->BoolValue(to_bool(singletonargs))|"stringvalue"->StringValue(to_string(singletonargs))|"stringoptvalue"->StringOptValue(to_optionto_string(singletonargs))|x->raise(Marshal_error("*value",PCDatax)))letof_option_states=Element("option_state",[],[of_bools.opt_sync;of_bools.opt_depr;of_option_values.opt_value])letto_option_state=function|Element("option_state",[],[sync;depr;value])->{opt_sync=to_boolsync;opt_depr=to_booldepr;opt_value=to_option_valuevalue}|x->raise(Marshal_error("option_state",x))letto_stateid=function|Element("state_id",["val",i],[])->letid=int_of_stringiinStateid.of_intid|_->raise(Invalid_argument"to_state_id")letof_stateidi=Element("state_id",["val",string_of_int(Stateid.to_inti)],[])letto_routeid=function|Element("route_id",["val",i],[])->letid=int_of_stringiinid|_->raise(Invalid_argument"to_route_id")letof_routeidi=Element("route_id",["val",string_of_inti],[])letof_box(ppb:Pp.block_type)=letopenPpinmatchppbwith|Pp_hbox->constructor"ppbox""hbox"[]|Pp_vboxi->constructor"ppbox""vbox"[of_inti]|Pp_hvboxi->constructor"ppbox""hvbox"[of_inti]|Pp_hovboxi->constructor"ppbox""hovbox"[of_inti]letto_box=letopenPpindo_match"ppbox"(funsargs->matchswith|"hbox"->emptyargs;Pp_hbox|"vbox"->Pp_vbox(to_int(singletonargs))|"hvbox"->Pp_hvbox(to_int(singletonargs))|"hovbox"->Pp_hovbox(to_int(singletonargs))|x->raise(Marshal_error("*ppbox",PCDatax)))letrecof_pp(pp:Pp.t)=letopenPpinmatchPp.reprppwith|Ppcmd_empty->constructor"ppdoc""empty"[]|Ppcmd_strings->constructor"ppdoc""string"[of_strings]|Ppcmd_gluesl->constructor"ppdoc""glue"[of_listof_ppsl]|Ppcmd_box(bt,s)->constructor"ppdoc""box"[of_pairof_boxof_pp(bt,s)]|Ppcmd_tag(t,s)->constructor"ppdoc""tag"[of_pairof_stringof_pp(t,s)]|Ppcmd_print_break(i,j)->constructor"ppdoc""break"[of_pairof_intof_int(i,j)]|Ppcmd_force_newline->constructor"ppdoc""newline"[]|Ppcmd_commentcmd->constructor"ppdoc""comment"[of_listof_stringcmd]letrecto_ppxpp=letopenPpinPp.unrepr@@do_match"ppdoc"(funsargs->matchswith|"empty"->emptyargs;Ppcmd_empty|"string"->Ppcmd_string(to_string(singletonargs))|"glue"->Ppcmd_glue(to_listto_pp(singletonargs))|"box"->let(bt,s)=to_pairto_boxto_pp(singletonargs)inPpcmd_box(bt,s)|"tag"->let(tg,s)=to_pairto_stringto_pp(singletonargs)inPpcmd_tag(tg,s)|"break"->let(i,j)=to_pairto_intto_int(singletonargs)inPpcmd_print_break(i,j)|"newline"->Ppcmd_force_newline|"comment"->Ppcmd_comment(to_listto_string(singletonargs))|x->raise(Marshal_error("*ppdoc",PCDatax)))xppletof_richppx=Element("richpp",[],[x])(* Run-time Selectable *)letof_pp(pp:Pp.t)=match!msg_formatwith|Richpp{width;depth}->of_richpp(Richpp.richpp_of_pp~width~depthpp)|Ppcmds->of_ppppletof_dbcontinue_optopt=letcode=matchoptwith|StepIn->0|StepOver->1|StepOut->2|Continue->3|Interrupt->4inof_intcodeletto_dbcontinue_optopt=matchto_intoptwith|0->StepIn|1->StepOver|2->StepOut|3->Continue|4->Interrupt|_->failwith"to_dbcontinue_opt"letof_valuef=function|Goodx->Element("value",["val","good"],[fx])|Fail(id,loc,msg)->letloc=matchlocwith|None->[]|Some(s,e)->[("loc_s",string_of_ints);("loc_e",string_of_inte)]inletid=of_stateididinElement("value",["val","fail"]@loc,[id;of_ppmsg])letto_valuef=function|Element("value",attrs,l)->letans=massoc"val"attrsinifans="good"thenGood(f(singletonl))elseifans="fail"thenletloc=tryletloc_s=int_of_string(Serialize.massoc"loc_s"attrs)inletloc_e=int_of_string(Serialize.massoc"loc_e"attrs)inSome(loc_s,loc_e)withMarshal_error_|Failure_->Noneinlet(id,msg)=matchlwith[id;msg]->(id,msg)|_->raise(Marshal_error("val",PCData"no id attribute"))inletid=to_stateididinletmsg=to_ppmsginFail(id,loc,msg)elseraise(Marshal_error("good or fail",PCDataans))|x->raise(Marshal_error("value",x))letof_statuss=letof_so=of_optionof_stringinletof_sl=of_listof_stringinElement("status",[],[of_sls.status_path;of_sos.status_proofname;of_sls.status_allproofs;of_ints.status_proofnum;])letto_status=function|Element("status",[],[path;name;prfs;pnum])->{status_path=to_listto_stringpath;status_proofname=to_optionto_stringname;status_allproofs=to_listto_stringprfs;status_proofnum=to_intpnum;}|x->raise(Marshal_error("status",x))letof_evars=Element("evar",[],[PCDatas.evar_info])letto_evar=function|Element("evar",[],data)->{evar_info=raw_stringdata;}|x->raise(Marshal_error("evar",x))letof_goalg=lethyp=of_listof_ppg.goal_hypinletccl=of_ppg.goal_cclinletid=of_stringg.goal_idinletname=of_optionof_stringg.goal_nameinElement("goal",[],[id;hyp;ccl;name])letto_goal=function|Element("goal",[],[id;hyp;ccl;name])->lethyp=to_listto_pphypinletccl=to_ppcclinletid=to_stringidinletname=to_optionto_stringnamein{goal_hyp=hyp;goal_ccl=ccl;goal_id=id;goal_name=name;}|x->raise(Marshal_error("goal",x))letof_goalsg=letof_glist=of_listof_goalinletfg=of_listof_goalg.fg_goalsinletbg=of_list(of_pairof_glistof_glist)g.bg_goalsinletshelf=of_listof_goalg.shelved_goalsinletgiven_up=of_listof_goalg.given_up_goalsinElement("goals",[],[fg;bg;shelf;given_up])letto_goals=function|Element("goals",[],[fg;bg;shelf;given_up])->letto_glist=to_listto_goalinletfg=to_listto_goalfginletbg=to_list(to_pairto_glistto_glist)bginletshelf=to_listto_goalshelfinletgiven_up=to_listto_goalgiven_upin{fg_goals=fg;bg_goals=bg;shelved_goals=shelf;given_up_goals=given_up}|x->raise(Marshal_error("goals",x))letof_goal_flagsf=letmode=of_stringf.gf_modeinletfg=of_boolf.gf_fginletbg=of_boolf.gf_bginletshelved=of_boolf.gf_shelvedinletgiven_up=of_boolf.gf_given_upinElement("goal_flags",[],[mode;fg;bg;shelved;given_up])letto_goal_flags=function|Element("goal_flags",[],[mode;fg;bg;shelved;given_up])->{gf_mode=to_stringmode;gf_fg=to_boolfg;gf_bg=to_boolbg;gf_shelved=to_boolshelved;gf_given_up=to_boolgiven_up}|x->raise(Marshal_error("goal_flags",x))letof_coq_infoinfo=letversion=of_stringinfo.coqtop_versioninletprotocol=of_stringinfo.protocol_versioninletrelease=of_stringinfo.release_dateinletcompile=of_stringinfo.compile_dateinElement("coq_info",[],[version;protocol;release;compile])letto_coq_info=function|Element("coq_info",[],[version;protocol;release;compile])->{coqtop_version=to_stringversion;protocol_version=to_stringprotocol;release_date=to_stringrelease;compile_date=to_stringcompile;}|x->raise(Marshal_error("coq_info",x))endincludeXml_marshalling(* Reification of basic types and type constructors, and functions
from to xml *)moduleReifType:sigtype'aval_tvalunit_t:unitval_tvalstring_t:stringval_tvalint_t:intval_tvalbool_t:boolval_tvalxml_t:Xml_datatype.xmlval_tvaloption_t:'aval_t->'aoptionval_tvallist_t:'aval_t->'alistval_tvalpair_t:'aval_t->'bval_t->('a*'b)val_tvalunion_t:'aval_t->'bval_t->('a,'b)unionval_tvalgoals_t:goalsval_tvalgoal_flags_t:goal_flagsval_tvalevar_t:evarval_tvalstate_t:statusval_tvaloption_state_t:option_stateval_tvaloption_value_t:option_valueval_tvalcoq_info_t:coq_infoval_tvalcoq_object_t:'aval_t->'acoq_objectval_tvalstate_id_t:state_idval_tvalroute_id_t:route_idval_tvalsearch_cst_t:search_constraintval_tvalpp_t:Pp.tval_tvaldb_cont_opt_t:db_continue_optval_tvalof_value_type:'aval_t->'a->xmlvalto_value_type:'aval_t->xml->'avalprint:'aval_t->'a->stringtypevalue_typevalerase:'aval_t->value_typevalprint_type:value_type->stringvaldocument_type_encoding:(xml->string)->unitend=structtype_val_t=|Unit:unitval_t|String:stringval_t|Int:intval_t|Bool:boolval_t|Xml:Xml_datatype.xmlval_t|Option:'aval_t->'aoptionval_t|List:'aval_t->'alistval_t|Pair:'aval_t*'bval_t->('a*'b)val_t|Union:'aval_t*'bval_t->('a,'b)unionval_t|Goals:goalsval_t|Goal_flags:goal_flagsval_t|Evar:evarval_t|State:statusval_t|Option_state:option_stateval_t|Option_value:option_valueval_t|Coq_info:coq_infoval_t|Coq_object:'aval_t->'acoq_objectval_t|State_id:state_idval_t|Route_id:route_idval_t|Search_cst:search_constraintval_t|Pp:Pp.tval_t|DbContinueOpt:db_continue_optval_ttypevalue_type=Value_type:'aval_t->value_typeleterase(x:'aval_t)=Value_typexletunit_t=Unitletstring_t=Stringletint_t=Intletbool_t=Boolletxml_t=Xmlletoption_tx=Optionxletlist_tx=Listxletpair_txy=Pair(x,y)letunion_txy=Union(x,y)letgoals_t=Goalsletgoal_flags_t=Goal_flagsletevar_t=Evarletstate_t=Stateletoption_state_t=Option_stateletoption_value_t=Option_valueletcoq_info_t=Coq_infoletcoq_object_tx=Coq_objectxletstate_id_t=State_idletroute_id_t=Route_idletsearch_cst_t=Search_cstletpp_t=Ppletdb_cont_opt_t=DbContinueOptletof_value_type(ty:'aval_t):'a->xml=letrecconvert:typea.aval_t->a->xml=function|Unit->of_unit|Bool->of_bool|Xml->(funx->x)|String->of_string|Int->of_int|State->of_status|Option_state->of_option_state|Option_value->of_option_value|Coq_info->of_coq_info|Goals->of_goals|Goal_flags->of_goal_flags|Evar->of_evar|Listt->(of_list(convertt))|Optiont->(of_option(convertt))|Coq_objectt->(of_coq_object(convertt))|Pair(t1,t2)->(of_pair(convertt1)(convertt2))|Union(t1,t2)->(of_union(convertt1)(convertt2))|State_id->of_stateid|Route_id->of_routeid|Search_cst->of_search_cst|Pp->of_pp|DbContinueOpt->of_dbcontinue_optinconverttyletto_value_type(ty:'aval_t):xml->'a=letrecconvert:typea.aval_t->xml->a=function|Unit->to_unit|Bool->to_bool|Xml->(funx->x)|String->to_string|Int->to_int|State->to_status|Option_state->to_option_state|Option_value->to_option_value|Coq_info->to_coq_info|Goals->to_goals|Goal_flags->to_goal_flags|Evar->to_evar|Listt->(to_list(convertt))|Optiont->(to_option(convertt))|Coq_objectt->(to_coq_object(convertt))|Pair(t1,t2)->(to_pair(convertt1)(convertt2))|Union(t1,t2)->(to_union(convertt1)(convertt2))|State_id->to_stateid|Route_id->to_routeid|Search_cst->to_search_cst|Pp->to_pp|DbContinueOpt->to_dbcontinue_optinconverttyletpr_unit()=""letpr_strings=Printf.sprintf"%S"sletpr_inti=string_of_intiletpr_boolb=Printf.sprintf"%B"bletpr_goal(g:goals)=ifg.fg_goals=[]thenifg.bg_goals=[]then"Proof completed."elseletrecpr_focus_=function|[]->assertfalse|[lg,rg]->Printf.sprintf"%i"(List.lengthlg+List.lengthrg)|(lg,rg)::l->Printf.sprintf"%i:%a"(List.lengthlg+List.lengthrg)pr_focuslinPrintf.sprintf"Still focused: [%a]."pr_focusg.bg_goalselseletpr_goal{goal_hyp=hyps;goal_ccl=goal}="["^String.concat"; "(List.mapPp.string_of_ppcmdshyps)^" |- "^Pp.string_of_ppcmdsgoal^"]"inString.concat" "(List.mappr_goalg.fg_goals)letpr_goal_flags(g:goal_flags)=Printf.sprintf"{ fg := %s; bg := %s; shelved := %s; given_up := %s }"(pr_boolg.gf_fg)(pr_boolg.gf_bg)(pr_boolg.gf_shelved)(pr_boolg.gf_given_up)letpr_evar(e:evar)="["^e.evar_info^"]"letpr_status(s:status)=letpath=letl=String.concat"."s.status_pathin"path="^l^";"inletname=matchs.status_proofnamewith|None->"no proof;"|Somen->"proof = "^n^";"in"Status: "^path^nameletpr_coq_info(i:coq_info)="FIXME"letpr_option_value=function|IntValueNone->"none"|IntValue(Somei)->string_of_inti|StringValues->s|StringOptValueNone->"none"|StringOptValue(Somes)->s|BoolValueb->ifbthen"true"else"false"letpr_option_state(s:option_state)=Printf.sprintf"sync := %b; depr := %b; value := %s\n"s.opt_syncs.opt_depr(pr_option_values.opt_value)letpr_listprl="["^String.concat";"(List.mapprl)^"]"letpr_optionpr=functionNone->"None"|Somex->"Some("^prx^")"letpr_coq_object(o:'acoq_object)="FIXME"letpr_pairpr1pr2(a,b)="("^pr1a^","^pr2b^")"letpr_unionpr1pr2=functionInlx->"Inl "^pr1x|Inrx->"Inr "^pr2xletpr_state_id=Stateid.to_stringletpr_db_continue_opt=function|StepIn->"StepIn"|StepOver->"StepOver"|StepOut->"StepOut"|Continue->"Continue"|Interrupt->"Interrupt"letpr_search_cst=function|Name_Patterns->"Name_Pattern "^s|Type_Patterns->"Type_Pattern "^s|SubType_Patterns->"SubType_Pattern "^s|In_Modules->"In_Module "^String.concat"."s|Include_Blacklist->"Include_Blacklist"letpr_pp=Pp.string_of_ppcmdsletrecprint:typea.aval_t->a->string=function|Unit->pr_unit|Bool->pr_bool|String->pr_string|Xml->Xml_printer.to_string_fmt|Int->pr_int|State->pr_status|Option_state->pr_option_state|Option_value->pr_option_value|Search_cst->pr_search_cst|Coq_info->pr_coq_info|Goals->pr_goal|Goal_flags->pr_goal_flags|Evar->pr_evar|Listt->(pr_list(printt))|Optiont->(pr_option(printt))|Coq_objectt->pr_coq_object|Pair(t1,t2)->(pr_pair(printt1)(printt2))|Union(t1,t2)->(pr_union(printt1)(printt2))|State_id->pr_state_id|Route_id->pr_int|Pp->pr_pp|DbContinueOpt->pr_db_continue_opt(* This is to break if a rename/refactoring makes the strings below outdated *)type'aexists=boolletrecprint_val_t:typea.aval_t->string=function|Unit->"unit"|Bool->"bool"|String->"string"|Xml->"xml"|Int->"int"|State->assert(true:statusexists);"Interface.status"|Option_state->assert(true:option_stateexists);"Interface.option_state"|Option_value->assert(true:option_valueexists);"Interface.option_value"|Search_cst->assert(true:search_constraintexists);"Interface.search_constraint"|Coq_info->assert(true:coq_infoexists);"Interface.coq_info"|Goals->assert(true:goalsexists);"Interface.goals"|Goal_flags->assert(true:goal_flagsexists);"Interface.goal_flags"|Evar->assert(true:evarexists);"Interface.evar"|Listt->Printf.sprintf"(%s list)"(print_val_tt)|Optiont->Printf.sprintf"(%s option)"(print_val_tt)|Coq_objectt->assert(true:'acoq_objectexists);Printf.sprintf"(%s Interface.coq_object)"(print_val_tt)|Pair(t1,t2)->Printf.sprintf"(%s * %s)"(print_val_tt1)(print_val_tt2)|Union(t1,t2)->assert(true:('a,'b)CSig.unionexists);Printf.sprintf"((%s, %s) CSig.union)"(print_val_tt1)(print_val_tt2)|State_id->assert(true:Stateid.texists);"Stateid.t"|Route_id->assert(true:route_idexists);"route_id"|Pp->assert(true:Pp.texists);"Pp.t"|DbContinueOpt->assert(true:db_continue_optexists);"Interface.dbcontinue_opt"letprint_type=functionValue_typety->print_val_ttyletdocument_type_encodingpr_xml=Printf.printf"\n=== Data encoding by examples ===\n\n";Printf.printf"%s:\n\n%s\n\n"(print_val_tUnit)(pr_xml(of_unit()));Printf.printf"%s:\n\n%s\n%s\n\n"(print_val_tBool)(pr_xml(of_booltrue))(pr_xml(of_boolfalse));Printf.printf"%s:\n\n%s\n\n"(print_val_tString)(pr_xml(of_string"hello"));Printf.printf"%s:\n\n%s\n\n"(print_val_tInt)(pr_xml(of_int256));Printf.printf"%s:\n\n%s\n\n"(print_val_tState_id)(pr_xml(of_stateidStateid.initial));Printf.printf"%s:\n\n%s\n\n"(print_val_t(ListInt))(pr_xml(of_listof_int[3;4;5]));Printf.printf"%s:\n\n%s\n%s\n\n"(print_val_t(OptionInt))(pr_xml(of_optionof_int(Some3)))(pr_xml(of_optionof_intNone));Printf.printf"%s:\n\n%s\n\n"(print_val_t(Pair(Bool,Int)))(pr_xml(of_pairof_boolof_int(false,3)));Printf.printf"%s:\n\n%s\n\n"(print_val_t(Union(Bool,Int)))(pr_xml(of_unionof_boolof_int(Inlfalse)));Printf.printf"%s:\n\n%s\n\n"(print_val_tPp)(pr_xml(of_ppPp.(hv3(str"foo"++spc()++str"bar"))));print_endline("All other types are records represented by a node named like the OCaml\n"^"type which contains a flattened n-tuple. We provide one example.\n");Printf.printf"%s:\n\n%s\n\n"(print_val_tOption_state)(pr_xml(of_option_state{opt_sync=true;opt_depr=false;opt_value=IntValue(Some37)}));endopenReifType(** Types reification, checked with explicit casts *)letadd_sty_t:add_styval_t=pair_t(pair_t(pair_t(pair_tstring_tint_t)(pair_tstate_id_tbool_t))int_t)(pair_tint_tint_t)letedit_at_sty_t:edit_at_styval_t=state_id_tletquery_sty_t:query_styval_t=pair_troute_id_t(pair_tstring_tstate_id_t)letgoals_sty_t:goals_styval_t=unit_tletevars_sty_t:evars_styval_t=unit_tlethints_sty_t:hints_styval_t=unit_tletstatus_sty_t:status_styval_t=bool_tletsearch_sty_t:search_styval_t=list_t(pair_tsearch_cst_tbool_t)letget_options_sty_t:get_options_styval_t=unit_tletset_options_sty_t:set_options_styval_t=list_t(pair_t(list_tstring_t)option_value_t)letmkcases_sty_t:mkcases_styval_t=string_tletquit_sty_t:quit_styval_t=unit_tletwait_sty_t:wait_styval_t=unit_tletabout_sty_t:about_styval_t=unit_tletinit_sty_t:init_styval_t=option_tstring_tletinterp_sty_t:interp_styval_t=pair_t(pair_tbool_tbool_t)string_tletstop_worker_sty_t:stop_worker_styval_t=string_tletprint_ast_sty_t:print_ast_styval_t=state_id_tletannotate_sty_t:annotate_styval_t=string_tletproof_diff_sty_t:proof_diff_styval_t=pair_tstring_tstate_id_tletdb_cmd_sty_t:db_cmd_styval_t=string_tletdb_upd_bpts_sty_t:db_upd_bpts_styval_t=list_t(pair_t(pair_tstring_tint_t)bool_t)letdb_continue_sty_t:db_continue_styval_t=db_cont_opt_tletdb_stack_sty_t:db_stack_styval_t=unit_tletdb_vars_sty_t:db_vars_styval_t=int_tletdb_configd_sty_t:db_configd_styval_t=unit_tletsubgoals_sty_t:subgoals_styval_t=goal_flags_tletadd_rty_t:add_rtyval_t=pair_tstate_id_t(union_tunit_tstate_id_t)letedit_at_rty_t:edit_at_rtyval_t=union_tunit_t(pair_tstate_id_t(pair_tstate_id_tstate_id_t))letquery_rty_t:query_rtyval_t=unit_tletgoals_rty_t:goals_rtyval_t=option_tgoals_tletevars_rty_t:evars_rtyval_t=option_t(list_tevar_t)lethints_rty_t:hints_rtyval_t=lethint=list_t(pair_tstring_tstring_t)inoption_t(pair_t(list_thint)hint)letstatus_rty_t:status_rtyval_t=state_tletsearch_rty_t:search_rtyval_t=list_t(coq_object_tstring_t)letget_options_rty_t:get_options_rtyval_t=list_t(pair_t(list_tstring_t)option_state_t)letset_options_rty_t:set_options_rtyval_t=unit_tletmkcases_rty_t:mkcases_rtyval_t=list_t(list_tstring_t)letquit_rty_t:quit_rtyval_t=unit_tletwait_rty_t:wait_rtyval_t=unit_tletabout_rty_t:about_rtyval_t=coq_info_tletinit_rty_t:init_rtyval_t=state_id_tletinterp_rty_t:interp_rtyval_t=pair_tstate_id_t(union_tstring_tstring_t)letstop_worker_rty_t:stop_worker_rtyval_t=unit_tletprint_ast_rty_t:print_ast_rtyval_t=xml_tletannotate_rty_t:annotate_rtyval_t=xml_tletproof_diff_rty_t:proof_diff_rtyval_t=pp_tletdb_cmd_rty_t:db_cmd_rtyval_t=unit_tletdb_upd_bpts_rty_t:db_upd_bpts_rtyval_t=unit_tletdb_continue_rty_t:db_continue_rtyval_t=unit_tletdb_stack_rty_t:db_stack_rtyval_t=list_t(pair_tstring_t(option_t(pair_tstring_t(list_tint_t))))letdb_vars_rty_t:db_vars_rtyval_t=list_t(pair_tstring_tpp_t)letdb_configd_rty_t:db_configd_rtyval_t=unit_tletsubgoals_rty_t:subgoals_rtyval_t=option_tgoals_tlet($)x=erasexletcalls=[|"Add",($)add_sty_t,($)add_rty_t;"Edit_at",($)edit_at_sty_t,($)edit_at_rty_t;"Query",($)query_sty_t,($)query_rty_t;"Goal",($)goals_sty_t,($)goals_rty_t;"Evars",($)evars_sty_t,($)evars_rty_t;"Hints",($)hints_sty_t,($)hints_rty_t;"Status",($)status_sty_t,($)status_rty_t;"Search",($)search_sty_t,($)search_rty_t;"GetOptions",($)get_options_sty_t,($)get_options_rty_t;"SetOptions",($)set_options_sty_t,($)set_options_rty_t;"MkCases",($)mkcases_sty_t,($)mkcases_rty_t;"Quit",($)quit_sty_t,($)quit_rty_t;"Wait",($)wait_sty_t,($)wait_rty_t;"About",($)about_sty_t,($)about_rty_t;"Init",($)init_sty_t,($)init_rty_t;"Interp",($)interp_sty_t,($)interp_rty_t;"StopWorker",($)stop_worker_sty_t,($)stop_worker_rty_t;"PrintAst",($)print_ast_sty_t,($)print_ast_rty_t;"Annotate",($)annotate_sty_t,($)annotate_rty_t;"PDiff",($)proof_diff_sty_t,($)proof_diff_rty_t;"Db_cmd",($)db_cmd_sty_t,($)db_cmd_rty_t;"Db_upd_bpts",($)db_upd_bpts_sty_t,($)db_upd_bpts_rty_t;"Db_continue",($)db_continue_sty_t,($)db_continue_rty_t;"Db_stack",($)db_stack_sty_t,($)db_stack_rty_t;"Db_vars",($)db_vars_sty_t,($)db_vars_rty_t;"Db_configd",($)db_configd_sty_t,($)db_configd_rty_t;"Subgoals",($)subgoals_sty_t,($)subgoals_rty_t;|]type'acall=|Add:add_sty->add_rtycall|Edit_at:edit_at_sty->edit_at_rtycall|Query:query_sty->query_rtycall|Goal:goals_sty->goals_rtycall|Evars:evars_sty->evars_rtycall|Hints:hints_sty->hints_rtycall|Status:status_sty->status_rtycall|Search:search_sty->search_rtycall|GetOptions:get_options_sty->get_options_rtycall|SetOptions:set_options_sty->set_options_rtycall|MkCases:mkcases_sty->mkcases_rtycall|Quit:quit_sty->quit_rtycall|About:about_sty->about_rtycall|Init:init_sty->init_rtycall|StopWorker:stop_worker_sty->stop_worker_rtycall(* internal use (fake_ide) only, do not use *)|Wait:wait_sty->wait_rtycall(* retrocompatibility *)|Interp:interp_sty->interp_rtycall|PrintAst:print_ast_sty->print_ast_rtycall|Annotate:annotate_sty->annotate_rtycall|PDiff:proof_diff_sty->proof_diff_rtycall|Db_cmd:db_cmd_sty->db_cmd_rtycall|Db_upd_bpts:db_upd_bpts_sty->db_upd_bpts_rtycall|Db_continue:db_continue_sty->db_continue_rtycall|Db_stack:db_stack_sty->db_stack_rtycall|Db_vars:db_vars_sty->db_vars_rtycall|Db_configd:db_configd_sty->db_configd_rtycall|Subgoals:subgoals_sty->subgoals_rtycall(* the order of the entries must match the order in "calls" above *)letid_of_call:typea.acall->int=function|Add_->0|Edit_at_->1|Query_->2|Goal_->3|Evars_->4|Hints_->5|Status_->6|Search_->7|GetOptions_->8|SetOptions_->9|MkCases_->10|Quit_->11|Wait_->12|About_->13|Init_->14|Interp_->15|StopWorker_->16|PrintAst_->17|Annotate_->18|PDiff_->19|Db_cmd_->20|Db_upd_bpts_->21|Db_continue_->22|Db_stack_->23|Db_vars_->24|Db_configd_->25|Subgoals_->26letstr_of_callc=pi1calls.(id_of_callc)typeunknown_call=Unknown:'acall->unknown_call(** We use phantom types and GADT to protect ourselves against wild casts *)letaddx:add_rtycall=Addxletedit_atx:edit_at_rtycall=Edit_atxletqueryx:query_rtycall=Queryxletgoalsx:goals_rtycall=Goalxletevarsx:evars_rtycall=Evarsxlethintsx:hints_rtycall=Hintsxletstatusx:status_rtycall=Statusxletget_optionsx:get_options_rtycall=GetOptionsxletset_optionsx:set_options_rtycall=SetOptionsxletmkcasesx:mkcases_rtycall=MkCasesxletsearchx:search_rtycall=Searchxletquitx:quit_rtycall=Quitxletinitx:init_rtycall=Initxletwaitx:wait_rtycall=Waitxletinterpx:interp_rtycall=Interpxletstop_workerx:stop_worker_rtycall=StopWorkerxletprint_astx:print_ast_rtycall=PrintAstxletannotatex:annotate_rtycall=Annotatexletproof_diffx:proof_diff_rtycall=PDiffxletdb_cmdx:db_cmd_rtycall=Db_cmdxletdb_upd_bptsx:db_upd_bpts_rtycall=Db_upd_bptsxletdb_continuex:db_continue_rtycall=Db_continuexletdb_stackx:db_stack_rtycall=Db_stackxletdb_varsx:db_vars_rtycall=Db_varsxletdb_configdx:db_configd_rtycall=Db_configdxletsubgoalsx:subgoals_rtycall=Subgoalsxletabstract_eval_call:typea._->acall->bool*avalue=funhandlerc->letsend=reftrueinletmkGood:typea.a->bool*avalue=funx->!send,(Goodx)intrymatchcwith|Addx->mkGood(handler.addx)|Edit_atx->mkGood(handler.edit_atx)|Queryx->mkGood(handler.queryx)|Goalx->mkGood(handler.goalsx)|Evarsx->mkGood(handler.evarsx)|Hintsx->mkGood(handler.hintsx)|Statusx->mkGood(handler.statusx)|Searchx->mkGood(handler.searchx)|GetOptionsx->mkGood(handler.get_optionsx)|SetOptionsx->mkGood(handler.set_optionsx)|MkCasesx->mkGood(handler.mkcasesx)|Quitx->mkGood(handler.quitx)|Waitx->mkGood(handler.waitx)|Aboutx->mkGood(handler.aboutx)|Initx->mkGood(handler.initx)|Interpx->mkGood(handler.interpx)|StopWorkerx->mkGood(handler.stop_workerx)|PrintAstx->mkGood(handler.print_astx)|Annotatex->mkGood(handler.annotatex)|PDiffx->mkGood(handler.proof_diffx)|Db_cmdx->mkGood(handler.db_cmdx)|Db_upd_bptsx->mkGood(handler.db_upd_bptsx)|Db_continuex->mkGood(handler.db_continuex)|Db_stackx->send:=false;mkGood(handler.db_stackx)|Db_varsx->send:=false;mkGood(handler.db_varsx)|Db_configdx->mkGood(handler.db_configdx)|Subgoalsx->mkGood(handler.subgoalsx)withany->letany=Exninfo.captureanyintrue,Fail(handler.handle_exnany)(** brain dead code, edit if protocol messages are added/removed *)letof_answer:typea.acall->avalue->xml=function|Add_->of_value(of_value_typeadd_rty_t)|Edit_at_->of_value(of_value_typeedit_at_rty_t)|Query_->of_value(of_value_typequery_rty_t)|Goal_->of_value(of_value_typegoals_rty_t)|Evars_->of_value(of_value_typeevars_rty_t)|Hints_->of_value(of_value_typehints_rty_t)|Status_->of_value(of_value_typestatus_rty_t)|Search_->of_value(of_value_typesearch_rty_t)|GetOptions_->of_value(of_value_typeget_options_rty_t)|SetOptions_->of_value(of_value_typeset_options_rty_t)|MkCases_->of_value(of_value_typemkcases_rty_t)|Quit_->of_value(of_value_typequit_rty_t)|Wait_->of_value(of_value_typewait_rty_t)|About_->of_value(of_value_typeabout_rty_t)|Init_->of_value(of_value_typeinit_rty_t)|Interp_->of_value(of_value_typeinterp_rty_t)|StopWorker_->of_value(of_value_typestop_worker_rty_t)|PrintAst_->of_value(of_value_typeprint_ast_rty_t)|Annotate_->of_value(of_value_typeannotate_rty_t)|PDiff_->of_value(of_value_typeproof_diff_rty_t)|Db_cmd_->of_value(of_value_typedb_cmd_rty_t)|Db_upd_bpts_->of_value(of_value_typedb_upd_bpts_rty_t)|Db_continue_->of_value(of_value_typedb_continue_rty_t)|Db_stack_->of_value(of_value_typedb_stack_rty_t)|Db_vars_->of_value(of_value_typedb_vars_rty_t)|Db_configd_->of_value(of_value_typedb_configd_rty_t)|Subgoals_->of_value(of_value_typesubgoals_rty_t)letof_answermsg_fmt=msg_format:=msg_fmt;of_answerletto_answer:typea.acall->xml->avalue=function|Add_->to_value(to_value_typeadd_rty_t)|Edit_at_->to_value(to_value_typeedit_at_rty_t)|Query_->to_value(to_value_typequery_rty_t)|Goal_->to_value(to_value_typegoals_rty_t)|Evars_->to_value(to_value_typeevars_rty_t)|Hints_->to_value(to_value_typehints_rty_t)|Status_->to_value(to_value_typestatus_rty_t)|Search_->to_value(to_value_typesearch_rty_t)|GetOptions_->to_value(to_value_typeget_options_rty_t)|SetOptions_->to_value(to_value_typeset_options_rty_t)|MkCases_->to_value(to_value_typemkcases_rty_t)|Quit_->to_value(to_value_typequit_rty_t)|Wait_->to_value(to_value_typewait_rty_t)|About_->to_value(to_value_typeabout_rty_t)|Init_->to_value(to_value_typeinit_rty_t)|Interp_->to_value(to_value_typeinterp_rty_t)|StopWorker_->to_value(to_value_typestop_worker_rty_t)|PrintAst_->to_value(to_value_typeprint_ast_rty_t)|Annotate_->to_value(to_value_typeannotate_rty_t)|PDiff_->to_value(to_value_typeproof_diff_rty_t)|Db_cmd_->to_value(to_value_typedb_cmd_rty_t)|Db_upd_bpts_->to_value(to_value_typedb_upd_bpts_rty_t)|Db_continue_->to_value(to_value_typedb_continue_rty_t)|Db_stack_->to_value(to_value_typedb_stack_rty_t)|Db_vars_->to_value(to_value_typedb_vars_rty_t)|Db_configd_->to_value(to_value_typedb_configd_rty_t)|Subgoals_->to_value(to_value_typesubgoals_rty_t)letof_call:typea.acall->xml=funq->letmkCallx=constructor"call"(str_of_callq)[x]inmatchqwith|Addx->mkCall(of_value_typeadd_sty_tx)|Edit_atx->mkCall(of_value_typeedit_at_sty_tx)|Queryx->mkCall(of_value_typequery_sty_tx)|Goalx->mkCall(of_value_typegoals_sty_tx)|Evarsx->mkCall(of_value_typeevars_sty_tx)|Hintsx->mkCall(of_value_typehints_sty_tx)|Statusx->mkCall(of_value_typestatus_sty_tx)|Searchx->mkCall(of_value_typesearch_sty_tx)|GetOptionsx->mkCall(of_value_typeget_options_sty_tx)|SetOptionsx->mkCall(of_value_typeset_options_sty_tx)|MkCasesx->mkCall(of_value_typemkcases_sty_tx)|Quitx->mkCall(of_value_typequit_sty_tx)|Waitx->mkCall(of_value_typewait_sty_tx)|Aboutx->mkCall(of_value_typeabout_sty_tx)|Initx->mkCall(of_value_typeinit_sty_tx)|Interpx->mkCall(of_value_typeinterp_sty_tx)|StopWorkerx->mkCall(of_value_typestop_worker_sty_tx)|PrintAstx->mkCall(of_value_typeprint_ast_sty_tx)|Annotatex->mkCall(of_value_typeannotate_sty_tx)|PDiffx->mkCall(of_value_typeproof_diff_sty_tx)|Db_cmdx->mkCall(of_value_typedb_cmd_sty_tx)|Db_upd_bptsx->mkCall(of_value_typedb_upd_bpts_sty_tx)|Db_continuex->mkCall(of_value_typedb_continue_sty_tx)|Db_stackx->mkCall(of_value_typedb_stack_sty_tx)|Db_varsx->mkCall(of_value_typedb_vars_sty_tx)|Db_configdx->mkCall(of_value_typedb_configd_sty_tx)|Subgoalsx->mkCall(of_value_typesubgoals_sty_tx)letto_call:xml->unknown_call=do_match"call"(funsa->letmkCallArgvta=to_value_typevt(singletona)inmatchswith|"Add"->Unknown(Add(mkCallArgadd_sty_ta))|"Edit_at"->Unknown(Edit_at(mkCallArgedit_at_sty_ta))|"Query"->Unknown(Query(mkCallArgquery_sty_ta))|"Goal"->Unknown(Goal(mkCallArggoals_sty_ta))|"Evars"->Unknown(Evars(mkCallArgevars_sty_ta))|"Hints"->Unknown(Hints(mkCallArghints_sty_ta))|"Status"->Unknown(Status(mkCallArgstatus_sty_ta))|"Search"->Unknown(Search(mkCallArgsearch_sty_ta))|"GetOptions"->Unknown(GetOptions(mkCallArgget_options_sty_ta))|"SetOptions"->Unknown(SetOptions(mkCallArgset_options_sty_ta))|"MkCases"->Unknown(MkCases(mkCallArgmkcases_sty_ta))|"Quit"->Unknown(Quit(mkCallArgquit_sty_ta))|"Wait"->Unknown(Wait(mkCallArgwait_sty_ta))|"About"->Unknown(About(mkCallArgabout_sty_ta))|"Init"->Unknown(Init(mkCallArginit_sty_ta))|"Interp"->Unknown(Interp(mkCallArginterp_sty_ta))|"StopWorker"->Unknown(StopWorker(mkCallArgstop_worker_sty_ta))|"PrintAst"->Unknown(PrintAst(mkCallArgprint_ast_sty_ta))|"Annotate"->Unknown(Annotate(mkCallArgannotate_sty_ta))|"PDiff"->Unknown(PDiff(mkCallArgproof_diff_sty_ta))|"Db_cmd"->Unknown(Db_cmd(mkCallArgdb_cmd_sty_ta))|"Db_upd_bpts"->Unknown(Db_upd_bpts(mkCallArgdb_upd_bpts_sty_ta))|"Db_continue"->Unknown(Db_continue(mkCallArgdb_continue_sty_ta))|"Db_stack"->Unknown(Db_stack(mkCallArgdb_stack_sty_ta))|"Db_vars"->Unknown(Db_vars(mkCallArgdb_vars_sty_ta))|"Db_configd"->Unknown(Db_configd(mkCallArgdb_configd_sty_ta))|"Subgoals"->Unknown(Subgoals(mkCallArgsubgoals_sty_ta))|x->raise(Marshal_error("call",PCDatax)))(** Debug printing *)letpr_value_genpr=function|Goodv->"GOOD "^prv|Fail(id,None,str)->"FAIL "^Stateid.to_stringid^" ["^Pp.string_of_ppcmdsstr^"]"|Fail(id,Some(i,j),str)->"FAIL "^Stateid.to_stringid^" ("^string_of_inti^","^string_of_intj^")["^Pp.string_of_ppcmdsstr^"]"letpr_valuev=pr_value_gen(fun_->"FIXME")vletpr_full_value:typea.acall->avalue->string=funcallvalue->matchcallwith|Add_->pr_value_gen(printadd_rty_t)value|Edit_at_->pr_value_gen(printedit_at_rty_t)value|Query_->pr_value_gen(printquery_rty_t)value|Goal_->pr_value_gen(printgoals_rty_t)value|Evars_->pr_value_gen(printevars_rty_t)value|Hints_->pr_value_gen(printhints_rty_t)value|Status_->pr_value_gen(printstatus_rty_t)value|Search_->pr_value_gen(printsearch_rty_t)value|GetOptions_->pr_value_gen(printget_options_rty_t)value|SetOptions_->pr_value_gen(printset_options_rty_t)value|MkCases_->pr_value_gen(printmkcases_rty_t)value|Quit_->pr_value_gen(printquit_rty_t)value|Wait_->pr_value_gen(printwait_rty_t)value|About_->pr_value_gen(printabout_rty_t)value|Init_->pr_value_gen(printinit_rty_t)value|Interp_->pr_value_gen(printinterp_rty_t)value|StopWorker_->pr_value_gen(printstop_worker_rty_t)value|PrintAst_->pr_value_gen(printprint_ast_rty_t)value|Annotate_->pr_value_gen(printannotate_rty_t)value|PDiff_->pr_value_gen(printproof_diff_rty_t)value|Db_cmd_->pr_value_gen(printdb_cmd_rty_t)value|Db_upd_bpts_->pr_value_gen(printdb_upd_bpts_rty_t)value|Db_continue_->pr_value_gen(printdb_continue_rty_t)value|Db_stack_->pr_value_gen(printdb_stack_rty_t)value|Db_vars_->pr_value_gen(printdb_vars_rty_t)value|Db_configd_->pr_value_gen(printdb_configd_rty_t)value|Subgoals_->pr_value_gen(printsubgoals_rty_t)valueletpr_call:typea.acall->string=funcall->letreturnwhatx=str_of_callcall^" "^printwhatxinmatchcallwith|Addx->returnadd_sty_tx|Edit_atx->returnedit_at_sty_tx|Queryx->returnquery_sty_tx|Goalx->returngoals_sty_tx|Evarsx->returnevars_sty_tx|Hintsx->returnhints_sty_tx|Statusx->returnstatus_sty_tx|Searchx->returnsearch_sty_tx|GetOptionsx->returnget_options_sty_tx|SetOptionsx->returnset_options_sty_tx|MkCasesx->returnmkcases_sty_tx|Quitx->returnquit_sty_tx|Waitx->returnwait_sty_tx|Aboutx->returnabout_sty_tx|Initx->returninit_sty_tx|Interpx->returninterp_sty_tx|StopWorkerx->returnstop_worker_sty_tx|PrintAstx->returnprint_ast_sty_tx|Annotatex->returnannotate_sty_tx|PDiffx->returnproof_diff_sty_tx|Db_cmdx->returndb_cmd_sty_tx|Db_upd_bptsx->returndb_upd_bpts_sty_tx|Db_continuex->returndb_continue_sty_tx|Db_stackx->returndb_stack_sty_tx|Db_varsx->returndb_vars_sty_tx|Db_configdx->returndb_configd_sty_tx|Subgoalsx->returnsubgoals_sty_txletdocumentto_string_fmt=Printf.printf"=== Available calls ===\n\n";Array.iter(fun(cname,csty,crty)->Printf.printf"%12s : %s\n %14s %s\n"("\""^cname^"\"")(print_typecsty)"->"(print_typecrty))calls;Printf.printf"\n=== Calls XML encoding ===\n\n";Printf.printf"A call \"C\" carrying input a is encoded as:\n\n%s\n\n"(to_string_fmt(constructor"call""C"[PCData"a"]));Printf.printf"A response carrying output b can either be:\n\n%s\n\n"(to_string_fmt(of_value(fun_->PCData"b")(Good())));Printf.printf"or:\n\n%s\n\nwhere the attributes loc_s and loc_c are optional.\n"(to_string_fmt(of_value(fun_->PCData"b")(Fail(Stateid.initial,Some(15,34),Pp.str"error message"))));document_type_encodingto_string_fmt(* Moved from feedback.mli : This is IDE specific and we don't want to
pollute the core with it *)openFeedbackletof_message_level=function|Debug->Serialize.constructor"message_level""debug"[]|Info->Serialize.constructor"message_level""info"[]|Notice->Serialize.constructor"message_level""notice"[]|Warning->Serialize.constructor"message_level""warning"[]|Error->Serialize.constructor"message_level""error"[]letto_message_level=Serialize.do_match"message_level"(funsargs->matchswith|"debug"->emptyargs;Debug|"info"->emptyargs;Info|"notice"->emptyargs;Notice|"warning"->emptyargs;Warning|"error"->emptyargs;Error|x->raiseSerialize.(Marshal_error("error level",PCDatax)))letof_messagelvllocmsg=letlvl=of_message_levellvlinletxloc=of_optionof_loclocinletcontent=of_ppmsginXml_datatype.Element("message",[],[lvl;xloc;content])letto_messagexml=matchxmlwith|Xml_datatype.Element("message",[],[lvl;xloc;content])->Message(to_message_levellvl,to_optionto_locxloc,to_ppcontent)|x->raise(Marshal_error("message",x))letto_feedback_content=do_match"feedback_content"(funsa->matchs,awith|"addedaxiom",_->AddedAxiom|"processed",_->Processed|"processingin",[where]->ProcessingIn(to_stringwhere)|"incomplete",_->Incomplete|"complete",_->Complete|"globref",[loc;filepath;modpath;ident;ty]->GlobRef(to_locloc,to_stringfilepath,to_stringmodpath,to_stringident,to_stringty)|"globdef",[loc;ident;secpath;ty]->GlobDef(to_locloc,to_stringident,to_stringsecpath,to_stringty)|"inprogress",[n]->InProgress(to_intn)|"workerstatus",[ns]->letn,s=to_pairto_stringto_stringnsinWorkerStatus(n,s)|"custom",[loc;name;x]->Custom(to_optionto_locloc,to_stringname,x)|"filedependency",[from;dep]->FileDependency(to_optionto_stringfrom,to_stringdep)|"fileloaded",[dirpath;filename]->FileLoaded(to_stringdirpath,to_stringfilename)|"message",[x]->to_messagex|x,l->raise(Marshal_error("feedback_content",PCData(x^" with attributes "^string_of_int(List.lengthl)))))letof_feedback_content=function|AddedAxiom->constructor"feedback_content""addedaxiom"[]|Processed->constructor"feedback_content""processed"[]|ProcessingInwhere->constructor"feedback_content""processingin"[of_stringwhere]|Incomplete->constructor"feedback_content""incomplete"[]|Complete->constructor"feedback_content""complete"[]|GlobRef(loc,filepath,modpath,ident,ty)->constructor"feedback_content""globref"[of_locloc;of_stringfilepath;of_stringmodpath;of_stringident;of_stringty]|GlobDef(loc,ident,secpath,ty)->constructor"feedback_content""globdef"[of_locloc;of_stringident;of_stringsecpath;of_stringty]|InProgressn->constructor"feedback_content""inprogress"[of_intn]|WorkerStatus(n,s)->constructor"feedback_content""workerstatus"[of_pairof_stringof_string(n,s)]|Custom(loc,name,x)->constructor"feedback_content""custom"[of_optionof_locloc;of_stringname;x]|FileDependency(from,depends_on)->constructor"feedback_content""filedependency"[of_optionof_stringfrom;of_stringdepends_on]|FileLoaded(dirpath,filename)->constructor"feedback_content""fileloaded"[of_stringdirpath;of_stringfilename]|Message(l,loc,m)->constructor"feedback_content""message"[of_messagellocm]letof_edit_or_state_idid=["object","state"],of_stateididletof_feedbackmsg=letcontent=of_feedback_contentmsg.contentsinletobj,id=of_edit_or_state_idmsg.span_idinletroute=string_of_intmsg.routeinElement("feedback",obj@["route",route],[id;content])letof_feedbackmsg_fmt=msg_format:=msg_fmt;of_feedbackletto_feedbackxml=matchxmlwith|Element("feedback",["object","state";"route",route],[id;content])->{doc_id=0;span_id=to_stateidid;route=int_of_stringroute;contents=to_feedback_contentcontent}|x->raise(Marshal_error("feedback",x))letof_ltac_debug_answer~tagmsg=letwraps=Element("ltac_debug",[],s)inwrap[PCDatatag;of_ppmsg]letto_ltac_debug_answerxml=matchxmlwith|Element("ltac_debug",[],[PCDatatag;pp])->letmsg=to_ppppintag,msg|x->raise(Marshal_error("ltac_debug_answer",x))typemsg_type=Feedback|LtacDebugInfo|Otherletmsg_kind=function|Element("feedback",_,_)->Feedback|Element("ltac_debug",_,_)->LtacDebugInfo|_->Otherletof_varsvars=of_value(of_list(of_pairof_stringof_pp))(Goodvars)letof_stackframes=of_value(of_list(of_pairof_string(of_option(of_pairof_string(of_listof_int)))))(Goodframes)(* vim: set foldmethod=marker: *)