]> matita.cs.unibo.it Git - helm.git/blob - helm/software/components/acic_procedural/acic2Procedural.ml
....
[helm.git] / helm / software / components / acic_procedural / acic2Procedural.ml
1 (* Copyright (C) 2003-2005, HELM Team.
2  * 
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.
6  * 
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.
11  * 
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.
16  *
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,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://cs.unibo.it/helm/.
24  *)
25
26 module P1 = Procedural1
27 module X  = ProceduralTeX
28
29 let tex_formatter = ref None
30
31 (* interface functions ******************************************************)
32
33 let procedural_of_acic_object ~ids_to_inner_sorts ~ids_to_inner_types 
34    ?info ?depth ?flavour prefix anobj = 
35    let st = {
36       sorts       = ids_to_inner_sorts;
37       types       = ids_to_inner_types;
38       max_depth   = depth;
39       depth       = 0;
40       context     = [];
41       case        = []
42    } in
43    L.time_stamp "P : LEVEL 1  ";
44    HLog.debug "Procedural: level 1 transformation";
45    let steps = proc_obj st ?flavour ?info anobj in
46    let _ = match !tex_formatter with
47       | None     -> ()
48       | Some frm -> X.tex_of_steps frm st.sorts steps
49    in
50    L.time_stamp "P : RENDERING";
51    HLog.debug "Procedural: grafite rendering";
52    let r = List.rev (T.render_steps [] steps) in
53    L.time_stamp "P : DONE     "; r
54
55 let procedural_of_acic_term ~ids_to_inner_sorts ~ids_to_inner_types ?depth
56    prefix context annterm = 
57    let st = {
58       sorts       = ids_to_inner_sorts;
59       types       = ids_to_inner_types;
60       max_depth   = depth;
61       depth       = 0;
62       context     = context;
63       case        = []
64    } in
65    HLog.debug "Procedural: level 1 transformation";
66    let steps = proc_proof st annterm in
67    let _ = match !tex_formatter with
68       | None     -> ()
69       | Some frm -> X.tex_of_steps frm st.sorts steps
70    in
71    HLog.debug "Procedural: grafite rendering";
72    List.rev (T.render_steps [] steps)