]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/helena/src/basic_rg/brgGrafite.ml
jet a change in dependences
[helm.git] / helm / software / helena / src / basic_rg / brgGrafite.ml
index 493ad3cac848532158ada852d01665d1062d69c8..27ed9a1c4df539ceb454119a8a69bb9f3f78ac59 100644 (file)
@@ -20,10 +20,14 @@ module E  = Entity
 module R  = Alpha
 module B  = Brg
 
+IFDEF MANAGER THEN
+
 (* Internal functions *******************************************************)
 
 let ok = ref true
 
+let version = KP.sprintf "This file was generated by %s: do not edit" (G.version_string true)
+
 let base = "matita"
 
 let ext = ".ma"
@@ -31,7 +35,7 @@ let ext = ".ma"
 let width = 70
 
 let out_preamble och =
-   let ich = open_in !G.ma_preamble in
+   let ich = open_in !G.preamble in
    let rec aux () = KP.fprintf och "%s\n" (input_line ich); aux () in
    try aux () with End_of_file -> close_in ich
 
@@ -70,58 +74,60 @@ let out_name och a =
    E.name err f a
 
 let rec out_term st p e och = function
-   | B.Sort (_, h)           -> 
-      let sort = if h = 0 then "Type[0]" else if h = 1 then "Prop" else assert false in
+   | B.Sort k                        ->
+      let sort = if k = 0 then "Type[0]" else if k = 1 then "Prop" else assert false in
       KP.fprintf och "%s" sort
-   | B.LRef (_, i)           ->       
-      let _, _, a, b = B.get e i in
-      KP.fprintf och "%a" out_name a
-   | B.GRef (_, s)           ->
+   | B.LRef (_, i)                   ->
+      let _, _, _, y, b = B.get e i in
+      KP.fprintf och "%a" out_name y
+   | B.GRef (_, s)                   ->
       KP.fprintf och "%a" out_uri s
-   | B.Cast (_, u, t)        ->
+   | B.Cast (u, t)                   ->
       KP.fprintf och "(%a : %a)" (out_term st false e) t (out_term st false e) u 
-   | B.Appl (_, v, t)        ->
+   | B.Appl (_, v, t)                ->
       let pt = match t with B.Appl _ -> false | _ -> true in
       let op, cp = if p then "(", ")" else "", "" in
       KP.fprintf och "%s%a %a%s" op (out_term st pt e) t (out_term st true e) v cp
-   | B.Bind (a, B.Abst (n, w), t) ->
+   | B.Bind (y, B.Abst (r, n, w), t) ->
       let op, cp = if p then "(", ")" else "", "" in
-      let a = R.alpha B.mem e a in
-      let ee = B.push e B.empty a (B.abst n w) in
-      let binder = match N.to_string st n, a.E.n_sort with
+      let y = R.alpha B.mem e y in
+      let ee = B.push e B.empty E.empty_node y (B.abst r n w) in
+      let binder = match N.to_string st n, fst y.E.b_main with
          | "1", 0 -> "Π"
          | "1", 1 -> "∀"
          | "2", _ -> "λ"
          | _      -> ok := false; "?"
       in
       KP.fprintf och "%s%s%a:%a.%a%s"
-         op binder out_name a (out_term st false e) w (out_term st false ee) t cp
-   | B.Bind (a, B.Abbr v, t) ->
+         op binder out_name y (out_term st false e) w (out_term st false ee) t cp
+   | B.Bind (y, B.Abbr v, t)         ->
       let op, cp = if p then "(", ")" else "", "" in
-      let a = R.alpha B.mem e a in
-      let ee = B.push e B.empty a (B.abbr v) in
+      let y = R.alpha B.mem e y in
+      let ee = B.push e B.empty E.empty_node y (B.abbr v) in
       KP.fprintf och "%slet %a ≝ %a in %a%s"
-         op out_name a (out_term st false e) v (out_term st false ee) t cp
-   | B.Bind (a, B.Void, t)   -> C.err ()
+         op out_name y (out_term st false e) v (out_term st false ee) t cp
+   | B.Bind (a, B.Void, t)           -> C.err ()
+
+let close_out och () = close_out och
+
+let output_entity och st (_, na, u, b) =
+   out_comment och (KP.sprintf "constant %u" na.E.n_apix);
+   match b with
+      | E.Abbr v ->
+         KP.fprintf och "definition %a ≝ %a.\n\n%!" out_uri u (out_term st false B.empty) v; !ok
+      | E.Abst w ->
+         KP.fprintf och "axiom %a : %a.\n\n%!" out_uri u (out_term st false B.empty) w; !ok
+      | E.Void   -> C.err ()
 
 (* Interface functions ******************************************************)
 
 let open_out fname =
-   let dir = KF.concat !G.ma_dir base in 
+   let dir = KF.concat !G.manager_dir base in 
    let path = KF.concat dir fname in
    let och = open_out (path ^ ext) in
    out_preamble och;
-   out_top_comment och (KP.sprintf "This file was generated by %s: do not edit" G.version_string);
+   out_top_comment och version;
    out_include och "basics/pts";
-   och
-
-let output_entity st och (_, na, s, b) =
-   out_comment och (KP.sprintf "constant %u" na.E.n_apix);
-   match b with
-      | E.Abbr t ->
-         KP.fprintf och "definition %a ≝ %a.\n\n%!" out_uri s (out_term st false B.empty) t; !ok
-      | E.Abst t ->
-         KP.fprintf och "axiom %a : %a.\n\n%!" out_uri s (out_term st false B.empty) t; !ok
-      | E.Void   -> C.err ()
+   output_entity och, close_out och
 
-let close_out och = close_out och
+END