X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Flib%2Flog.ml;h=39cc5837ac3fd105a02099426b23e85d41c921d1;hb=de66af7241ad8ab71d5857d14570e4662f2488dc;hp=4cea12cda89eef2d4e0c5d45bae5ebd9b9c8797b;hpb=d38cea7e4865091412e1414f5594dd7c124de47e;p=helm.git diff --git a/helm/software/lambda-delta/lib/log.ml b/helm/software/lambda-delta/lib/log.ml index 4cea12cda..39cc5837a 100644 --- a/helm/software/lambda-delta/lib/log.ml +++ b/helm/software/lambda-delta/lib/log.ml @@ -17,6 +17,9 @@ type ('a, 'b) item = Term of 'a * 'b | Context of 'a | Warn of string | String of string + | Loc + +type ('a, 'b) message = ('a, 'b) item list type ('a, 'b) specs = { pp_term : 'a -> F.formatter -> 'b -> unit; @@ -25,6 +28,8 @@ type ('a, 'b) specs = { let level = ref 0 +let loc = ref 0 + (* Internal functions *******************************************************) let std = F.std_formatter @@ -37,6 +42,7 @@ let pp_items frm st l items = | Context c -> F.fprintf frm "%a" st.pp_context c | Warn s -> F.fprintf frm "@,%s" s | String s -> F.fprintf frm "%s " s + | Loc -> F.fprintf frm " (line %u)" !loc in let iter map frm l = List.iter (map frm) l in if !level >= l then F.fprintf frm "%a" (iter pp_item) items @@ -67,10 +73,10 @@ let t_items1 st c t = let ct_items1 sc c st t = [Warn sc; Context c; Warn st; Term (c, t)] -let ct_items2 sc c st1 t1 st2 t2 = - ct_items1 sc c st1 t1 @ [Warn st2; Term (c, t2)] +let ct_items2 sc1 c1 st1 t1 sc2 c2 st2 t2 = + ct_items1 sc1 c1 st1 t1 @ ct_items1 sc2 c2 st2 t2 let ct_items3 sc c st1 t1 st2 t2 st3 t3 = - ct_items2 sc c st1 t1 st2 t2 @ [Warn st3; Term (c, t3)] + ct_items1 sc c st1 t1 @ [Warn st2; Term (c, t2); Warn st3; Term (c, t3)] let warn msg = F.fprintf std "@,%s" msg