]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/components/binaries/xoa/lib.ml
update in ground
[helm.git] / matita / components / binaries / xoa / lib.ml
index e6e203e62738d111c253ac6c311afcd3cc8c13df..f2bf31757a88a9887d1f13a167d5b3ddd004b129 100644 (file)
@@ -9,9 +9,10 @@
      \ /   This software is distributed as is, NO WARRANTY.     
       V_______________________________________________________________ *)
 
-module F   = Filename
+module F = Filename
+module K = Sys
 
-module R   = Helm_registry
+module R = Helm_registry
 
 let template = "matita.ma.templ"
 
@@ -29,19 +30,34 @@ let copy_preamble preamble och =
    in
    try read () with End_of_file -> close_in ich
 
+let print_header def och =
+  let msg = if def then "LOGIC" else "GROUND NOTATION" in
+   let stars = String.make (72 - String.length msg) '*' in
+   Printf.fprintf och "(* %s %s*)\n\n" msg stars
+
 let print_comment och =
-   let stars = String.make (30 - String.length myself) '*' in
-   Printf.fprintf och "(* This file was generated by %s: do not edit %s*)\n\n" myself stars
+   let msg = Printf.sprintf "NOTE: This file was generated by %s, do not edit" myself in
+   let stars = String.make (72 - String.length msg) '*' in
+   Printf.fprintf och "(* %s %s*)\n\n" msg stars
+
+let exists_out name =
+   let path = [
+      R.get_string "xoa.output_dir";
+      name
+   ] in
+   let name = List.fold_left F.concat "" path in
+   K.file_exists (name ^ ".ma")
 
-let open_out preamble name =
+let open_out def preamble name =
    let path = [
-      R.get_string "matita.rt_base_dir"; 
-      R.get_string "xoa.output_dir"; 
+      R.get_string "xoa.output_dir";
       name
    ] in
-   let name = List.fold_left F.concat "" path in 
+   let name = List.fold_left F.concat "" path in
    let och = open_out (name ^ ".ma") in
-   copy_preamble preamble och; print_comment och;
+   copy_preamble preamble och;
+   print_header def och;
+   print_comment och;
    och
 
 let out_include och s =