X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fhtml.ml;h=b35f17d1cc32e59cef0f01861d4f79a7a8daf712;hp=21b33e66c2f8df377d19646ea3c76120e3c7a4f2;hb=35abea737ead2d4fd121d0cb8bdbda38cfcaa8d3;hpb=78d247dc5e6d5e64a4ab848702c23ce81b6fc615 diff --git a/src/html.ml b/src/html.ml index 21b33e6..b35f17d 100644 --- a/src/html.ml +++ b/src/html.ml @@ -37,7 +37,7 @@ let finalize_node n r b = 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 @@ -92,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 -> @@ -112,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 @@ -150,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