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_______________________________________________________________ *)
16 type ('a, 'b) item = Term of 'a * 'b
21 type ('a, 'b) specs = {
22 pp_term : F.formatter -> 'a -> 'b -> unit;
23 pp_context: F.formatter -> 'a -> unit
28 (* Internal functions *******************************************************)
31 let started = ref false in
33 if !started then () else
34 begin P.printf "\n"; started := true end
36 let pp_items frm st l items =
37 let pp_item = function
38 | Term (c, t) -> st.pp_context frm c; st.pp_term frm c t
39 | Context c -> st.pp_context frm c
40 | Warn s -> F.fprintf frm "@[%s\n@]" s
41 | String s -> F.fprintf frm "@[%s @]" s
43 if !level >= l then List.iter pp_item items
45 (* Interface functions ******************************************************)
48 init (); P.printf " %s\n" msg; flush stdout
50 let log st l items = pp_items F.std_formatter st l items
52 let error st items = pp_items F.err_formatter st 0 items
54 let items1 s = [Warn s]
59 let ct_items2 s1 c1 t1 s2 c2 t2 =
60 [Warn s1; Term (c1, t1); Warn s2; Term (c2, t2)]