X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Fsrc%2Fbasic_ag%2FbagOutput.ml;fp=helm%2Fsoftware%2Flambda-delta%2Fsrc%2Fbasic_ag%2FbagOutput.ml;h=feebca464a05bf92fbd2af4d78381dd639511e7a;hb=a5709dff43233c041f77a4ee4b7f2df1a3c51ab6;hp=dfdc6e116f1a4871cee8e301e2747d79181f0dd0;hpb=f3f6b451707a3feb8245717e3fa7ca25df0ce8ef;p=helm.git diff --git a/helm/software/lambda-delta/src/basic_ag/bagOutput.ml b/helm/software/lambda-delta/src/basic_ag/bagOutput.ml index dfdc6e116..feebca464 100644 --- a/helm/software/lambda-delta/src/basic_ag/bagOutput.ml +++ b/helm/software/lambda-delta/src/basic_ag/bagOutput.ml @@ -9,14 +9,17 @@ \ / This software is distributed as is, NO WARRANTY. V_______________________________________________________________ *) -module P = Printf -module F = Format -module U = NUri -module L = Log -module G = Options -module E = Entity -module H = Hierarchy -module Z = Bag +module P = Printf +module F = Format +module U = NUri +module L = Log +module G = Options +module E = Entity +module J = Marks +module H = Hierarchy +module XD = XmlCrg +module Z = Bag +module ZD = BagCrg type counters = { eabsts: int; @@ -78,7 +81,7 @@ let print_counters f c = c.tabbrs in let items = c.eabsts + c.eabbrs in - let locations = Z.locations () in + let locations = J.locations () in L.warn (P.sprintf " Kernel representation summary (basic_ag)"); L.warn (P.sprintf " Total entry items: %7u" items); L.warn (P.sprintf " Declaration items: %7u" c.eabsts); @@ -94,8 +97,16 @@ let print_counters f c = L.warn (P.sprintf " Total binder locations: %7u" locations); f () -let res l id = - if !G.indexes then P.sprintf "#%u" l else id +let name err frm a = + let f n = function + | true -> F.fprintf frm "%s" n + | false -> F.fprintf frm "-%s" n + in + E.name err f a + +let res a l frm = + let err () = F.fprintf frm "@[#%u@]" l in + if !G.indexes then err () else name err frm a let rec pp_term c frm = function | Z.Sort h -> @@ -103,38 +114,36 @@ let rec pp_term c frm = function let f s = F.fprintf frm "@[%s@]" s in H.string_of_sort err f h | Z.LRef i -> - let f = function - | Some (id, _) -> F.fprintf frm "@[%s@]" id - | None -> F.fprintf frm "@[#%u@]" i - in - if !G.indexes then f None else Z.get f c i + let err () = F.fprintf frm "@[#%u@]" i in + let f a _ = name err frm a in + if !G.indexes then err () else Z.get err f c i | Z.GRef s -> F.fprintf frm "@[$%s@]" (U.string_of_uri s) | Z.Cast (u, t) -> F.fprintf frm "@[{%a}.%a@]" (pp_term c) u (pp_term c) t | Z.Appl (v, t) -> F.fprintf frm "@[(%a).%a@]" (pp_term c) v (pp_term c) t - | Z.Bind (l, id, Z.Abst w, t) -> + | Z.Bind (a, l, Z.Abst w, t) -> let f cc = - F.fprintf frm "@[[%s:%a].%a@]" (res l id) (pp_term c) w (pp_term cc) t + F.fprintf frm "@[[%t:%a].%a@]" (res a l) (pp_term c) w (pp_term cc) t in - Z.push "output abst" f c l id (Z.Abst w) - | Z.Bind (l, id, Z.Abbr v, t) -> + Z.push "output abst" f c a l (Z.Abst w) + | Z.Bind (a, l, Z.Abbr v, t) -> let f cc = - F.fprintf frm "@[[%s=%a].%a@]" (res l id) (pp_term c) v (pp_term cc) t + F.fprintf frm "@[[%t=%a].%a@]" (res a l) (pp_term c) v (pp_term cc) t in - Z.push "output abbr" f c l id (Z.Abbr v) - | Z.Bind (l, id, Z.Void, t) -> - let f cc = F.fprintf frm "@[[%s].%a@]" (res l id) (pp_term cc) t in - Z.push "output void" f c l id Z.Void + Z.push "output abbr" f c a l (Z.Abbr v) + | Z.Bind (a, l, Z.Void, t) -> + let f cc = F.fprintf frm "@[[%t].%a@]" (res a l) (pp_term cc) t in + Z.push "output void" f c a l Z.Void let pp_lenv frm c = let pp_entry frm = function - | l, id, Z.Abst w -> - F.fprintf frm "@,@[%s : %a@]" (res l id) (pp_term c) w - | l, id, Z.Abbr v -> - F.fprintf frm "@,@[%s = %a@]" (res l id) (pp_term c) v - | l, id, Z.Void -> - F.fprintf frm "@,%s" (res l id) + | a, l, Z.Abst w -> + F.fprintf frm "@,@[%t : %a@]" (res a l) (pp_term c) w + | a, l, Z.Abbr v -> + F.fprintf frm "@,@[%t = %a@]" (res a l) (pp_term c) v + | a, l, Z.Void -> + F.fprintf frm "@,%t" (res a l) in let iter map frm l = List.iter (map frm) l in let f es = F.fprintf frm "%a" (iter pp_entry) (List.rev es) in @@ -143,3 +152,8 @@ let pp_lenv frm c = let specs = { L.pp_term = pp_term; L.pp_lenv = pp_lenv } + +(* term xml printing ********************************************************) + +let export_term = + ZD.crg_of_bag XD.export_term