1 (* Copyright (C) 2000-2002, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
26 (***************************************************************************)
30 (* Andrea Asperti <asperti@cs.unibo.it> *)
34 (***************************************************************************)
38 let mpres_document pres_box =
39 Xml.add_xml_declaration (CicNotationPres.print_box pres_box)
41 let mml_of_cic_sequent metasenv sequent =
42 let unsh_sequent,(asequent,ids_to_terms,
43 ids_to_father_ids,ids_to_inner_sorts,ids_to_hypotheses)
45 Cic2acic.asequent_of_sequent metasenv sequent
47 let content_sequent = Acic2content.map_sequent asequent in
49 (Sequent2pres.sequent2pres ~ids_to_inner_sorts content_sequent)
51 let xmlpres = mpres_document pres_sequent in
52 (Xml2Gdome.document_of_xml DomMisc.domImpl xmlpres,
55 (ids_to_terms,ids_to_father_ids,ids_to_hypotheses,ids_to_inner_sorts)))
57 let mml_of_cic_object obj =
58 let (annobj, ids_to_terms, ids_to_father_ids, ids_to_inner_sorts,
59 ids_to_inner_types, ids_to_conjectures, ids_to_hypotheses)
61 Cic2acic.acic_object_of_cic_object obj
64 Acic2content.annobj2content ~ids_to_inner_sorts ~ids_to_inner_types annobj
66 let pres = Content2pres.content2pres ~ids_to_inner_sorts content in
67 let xmlpres = mpres_document pres in
68 let mathml = Xml2Gdome.document_of_xml DomMisc.domImpl xmlpres in
70 (ids_to_terms, ids_to_father_ids, ids_to_conjectures, ids_to_hypotheses,
71 ids_to_inner_sorts,ids_to_inner_types)))
73 let txt_of_cic_sequent_conclusion size metasenv sequent =
74 let _,(asequent,_,_,ids_to_inner_sorts,_) =
75 Cic2acic.asequent_of_sequent metasenv sequent
77 let _,_,_,t = Acic2content.map_sequent asequent in
78 let t, ids_to_uris = TermAcicContent.ast_of_acic ids_to_inner_sorts t in
79 let t = TermContentPres.pp_ast t in
80 let t = CicNotationPres.render ids_to_uris t in
81 BoxPp.render_to_string (function x::_ -> x | _ -> assert false) size t
83 let txt_of_cic_term size metasenv context t =
84 let fake_sequent = (-1,context,t) in
85 txt_of_cic_sequent_conclusion size metasenv fake_sequent