X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fhtml.ml;h=b35f17d1cc32e59cef0f01861d4f79a7a8daf712;hb=c2c22bf0d75a390c2538b9fce44aae63c542119a;hp=236ee39cc5e57692f6df68173e17070aa4c0991b;hpb=4b5e86cc5fa3e62a1cb7d29acf79ffb314194efa;p=tatoo.git diff --git a/src/html.ml b/src/html.ml index 236ee39..b35f17d 100644 --- a/src/html.ml +++ b/src/html.ml @@ -34,10 +34,10 @@ let trace ?(msg="") nid r t d = let finalize_node n r b = Hashtbl.replace final n (b,r) -module K = +module K = struct type t = int * StateSet.t * StateSet.t - let hash (a,b,c) = HASHINT3(a, (b.StateSet.id :> int), (c.StateSet.id :> int) ) + let hash (a,b,c) = HASHINT3(a, (b.StateSet.id :> int), (c.StateSet.id :> int)) let equal ((a1,b1,c1) as x) ((a2,b2,c2) as y) = x == y || (a1 == a2 && b1 == b2 && c1 == c2) end @@ -85,7 +85,6 @@ let gen_trace (type s) = fun auto t tree -> let marked, last_round = try Hashtbl.find final node_id with Not_found -> Printf.eprintf ">>> %i\n%!" node_id; false, !max_round; in - let pc = if !max_round == 0 then 1. else float_of_int last_round /. float_of_int !max_round in let scolor, tcolor = let { sat ; todo; _ } = match M.find last_round m with @@ -93,14 +92,28 @@ let gen_trace (type s) = fun auto t tree -> | [ e ] -> e | l -> List.hd (List.tl (List.rev l)) in - let c = (last_round, StateSet.union sat todo, StateSet.empty) in color c, text_color c + let c = (last_round, StateSet.union sat todo, StateSet.empty) in + color c, text_color c in let tag = QName.to_string (T.tag tree node) in let lbox = (String.length tag + 2) * 10 in let s_node = "node" ^ (string_of_int node_id) in - fprintf osvg "\n%!" - s_node s_node x y lbox scolor (if marked then ";stroke-width:4" else ";stroke-width:2;stroke-dasharray:2,2"); - fprintf osvg "%s\n" (x+10) (y+15) tcolor s_node tag; + fprintf osvg + "\n%!" + s_node + s_node + x y + lbox + scolor + (if marked + then ";stroke-width:4" + else ";stroke-width:2;stroke-dasharray:2,2"); + fprintf osvg "%s\n" + (x+10) + (y+15) + tcolor s_node tag; fprintf ohtml "data['%s'] = new Array();\n" s_node; M.iter (fun i l -> @@ -113,10 +126,12 @@ let gen_trace (type s) = fun auto t tree -> let x_next = max (x+lbox) (maxw1+10) in if node != root then begin if node == T.first_child tree parent then - fprintf osvg "\n" + fprintf osvg "\n" (x + lbox / 2) (y-20) (x + lbox / 2) (y); if next != T.nil then - fprintf osvg "\n" + fprintf osvg "\n" (x + lbox) (y+10) x_next (y+10); end; let maxw2, maxy2 = loop osvg ohtml next node x_next y in @@ -151,7 +166,8 @@ Ata.print auto; d.innerHTML = msg; return; };\n"; - fprintf ohtml "\n
\n" + fprintf ohtml "\n
\n" maxw maxh; let fi = open_in "tests/trace/trace.svg" in try @@ -165,5 +181,3 @@ Ata.print auto; pp_print_flush ohtml (); close_out ohtml_; close_in fi - -