]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/bin/roles/rolesOutput.ml
update in binaries for λδ
[helm.git] / matita / matita / contribs / lambdadelta / bin / roles / rolesOutput.ml
1 (*
2     ||M||  This file is part of HELM, an Hypertextual, Electronic
3     ||A||  Library of Mathematics, developed at the Computer Science
4     ||T||  Department, University of Bologna, Italy.
5     ||I||
6     ||T||  HELM is free software; you can redistribute it and/or
7     ||A||  modify it under the terms of the GNU General Public License
8     \   /  version 2 or (at your option) any later version.
9      \ /   This software is distributed as is, NO WARRANTY.
10       V_______________________________________________________________ *)
11
12 module ET = RolesTypes
13 module EU = RolesUtils
14
15 let indent n =
16   String.make (2*n) ' '
17
18 let out_tag i tag h map och l =
19   let aux och = List.iter (map (succ i) och) l in
20   if h then Printf.fprintf och "%s(%s%t)\n" (indent i) tag aux
21   else Printf.fprintf och "%s(%s\n%t%s)\n" (indent i) tag aux (indent i)
22
23 let string_map f _i och x =
24   Printf.fprintf och " %S" (f x)
25
26 let out_stage i och v =
27   out_tag i "ver" true (string_map EU.string_of_stage) och [v]
28
29 let out_old i och os =
30   out_tag i "old" true (string_map EU.string_of_oobj) och os
31
32 let out_new i och ns =
33   out_tag i "new" true (string_map EU.string_of_nobj) och ns
34
35 let out_role i och r =
36   let map i och r =
37     out_stage i och r.ET.rs;
38     out_old i och r.ET.ro;
39     out_new i och r.ET.rn
40   in
41   out_tag i "rel" false map och [r]
42
43 let out_roles i och rs =
44   out_tag i "base" false out_role och rs
45
46 let out_status och st =
47   let map i och st =
48     out_roles i och st.ET.sr;
49     out_stage i och st.ET.ss;
50     out_old i och st.ET.so;
51     out_new i och st.ET.sn
52   in
53   output_string och "roles:";
54   out_tag 0 "top" false map och [st]