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.
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_______________________________________________________________ *)
15 module R = Helm_registry
17 let template = "../../../matita/matita.ma.templ"
19 let myself = F.basename Sys.argv.(0)
21 let rt_base_dir = F.dirname Sys.argv.(0)
24 F.concat rt_base_dir template
26 let copy_preamble preamble och =
27 let ich = open_in preamble in
29 Printf.fprintf och "%s\n" (input_line ich); read ()
31 try read () with End_of_file -> close_in ich
33 let print_header def och =
34 let msg = if def then "LOGIC" else "GROUND NOTATION" in
35 let stars = String.make (72 - String.length msg) '*' in
36 Printf.fprintf och "(* %s %s*)\n\n" msg stars
38 let print_comment och =
39 let msg = Printf.sprintf "NOTE: This file was generated by %s, do not edit" myself in
40 let stars = String.make (72 - String.length msg) '*' in
41 Printf.fprintf och "(* %s %s*)\n\n" msg stars
45 R.get_string "xoa.output_dir";
48 let name = List.fold_left F.concat "" path in
49 K.file_exists (name ^ ".ma")
51 let open_out def preamble name =
53 R.get_string "xoa.output_dir";
56 let name = List.fold_left F.concat "" path in
57 let och = open_out (name ^ ".ma") in
58 copy_preamble preamble och;
63 let out_include och s =
64 Printf.fprintf och "include \"%s\".\n\n" s