(* *)
(******************************************************************************)
+(** stylesheets and parameters list **)
+
let parseStyle name =
let style =
Misc.domImpl#createDocumentFromURI
"CICURI", "'cic:/Coq/Init/Datatypes/bool_ind.con'" ]
;;
+(** Stylesheets application **)
+
let apply_stylesheets input styles args =
List.fold_left (fun i style -> Gdome_xslt.applyStylesheet i style args)
input styles
let apply_sequent_stylesheets sequent_doc =
apply_stylesheets sequent_doc sequent_styles sequent_args
;;
+
+(** Utility functions to map objects to MathML Presentation **)
+
+(*CSC: the getter should handle the innertypes, not the FS *)
+
+let innertypesfile =
+ try
+ Sys.getenv "GTOPLEVEL_INNERTYPESFILE"
+ with
+ Not_found -> "/public/innertypes"
+;;
+
+let constanttypefile =
+ try
+ Sys.getenv "GTOPLEVEL_CONSTANTTYPEFILE"
+ with
+ Not_found -> "/public/constanttype"
+;;
+
+let mml_of_cic_term metano term =
+ let metasenv =
+ match !ProofEngine.proof with
+ None -> []
+ | Some (_,metasenv,_,_) -> metasenv
+ in
+ let context =
+ match !ProofEngine.goal with
+ None -> []
+ | Some metano ->
+ let (_,canonical_context,_) =
+ List.find (function (m,_,_) -> m=metano) metasenv
+ in
+ canonical_context
+ in
+ let sequent_gdome,ids_to_terms,ids_to_father_ids,ids_to_hypotheses =
+ SequentPp.XmlPp.print_sequent metasenv (metano,context,term)
+ in
+ let sequent_doc =
+ Xml2Gdome.document_of_xml Misc.domImpl sequent_gdome
+ in
+ let res = apply_sequent_stylesheets sequent_doc in
+ res, (term,ids_to_terms,ids_to_father_ids,ids_to_hypotheses)
+;;
+
+let
+ mml_of_cic_object ~explode_all uri annobj ids_to_inner_sorts ids_to_inner_types
+=
+(*CSC: ????????????????? *)
+ let xml, bodyxml =
+ Cic2Xml.print_object uri ~ids_to_inner_sorts ~ask_dtd_to_the_getter:true
+ annobj
+ in
+ let xmlinnertypes =
+ Cic2Xml.print_inner_types uri ~ids_to_inner_sorts ~ids_to_inner_types
+ ~ask_dtd_to_the_getter:true
+ in
+ let input =
+ match bodyxml with
+ None -> Xml2Gdome.document_of_xml Misc.domImpl xml
+ | Some bodyxml' ->
+ Xml.pp xml (Some constanttypefile) ;
+ Xml2Gdome.document_of_xml Misc.domImpl bodyxml'
+ in
+(*CSC: We save the innertypes to disk so that we can retrieve them in the *)
+(*CSC: stylesheet. This DOES NOT work when UWOBO and/or the getter are not *)
+(*CSC: local. *)
+ Xml.pp xmlinnertypes (Some innertypesfile) ;
+ let output = apply_proof_stylesheets input ~explode_all in
+ output
+;;