]> matita.cs.unibo.it Git - helm.git/blob - helm/software/lambda-delta/toplevel/metaLibrary.ml
Additional contribs.
[helm.git] / helm / software / lambda-delta / toplevel / metaLibrary.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 F = Format
13 module O = MetaOutput
14
15 type out_channel = Pervasives.out_channel * F.formatter
16
17 (* internal functions *******************************************************)
18
19 let hal_dir = "hal"
20
21 let hal_ext = ".hal"
22
23 (* interface functions ******************************************************)
24
25 let open_out f name =      
26    let _ = Sys.command (Printf.sprintf "mkdir -p %s" hal_dir) in
27    let och = open_out (Filename.concat hal_dir (name ^ hal_ext)) in
28    let frm = F.formatter_of_out_channel och in
29    F.pp_set_margin frm max_int;
30    f (och, frm)
31
32 let write_entity f (_, frm) entity =
33    O.pp_entity f frm entity
34    
35 let close_out f (och, _) =
36    close_out och; f ()