X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fhtml.ml;h=21b33e66c2f8df377d19646ea3c76120e3c7a4f2;hp=f049195515f4bdcf626e2a3186dd49c2c748c0e9;hb=c6f23a2c3a5c0ee4426d1b00fc2807676abdf132;hpb=a8f210b6229055c3c5101034d359c61476d8408a diff --git a/src/html.ml b/src/html.ml index f049195..21b33e6 100644 --- a/src/html.ml +++ b/src/html.ml @@ -34,7 +34,7 @@ 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) ) @@ -85,10 +85,14 @@ 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; _ } = List.hd(M.find last_round m) in - let c = (last_round, sat, todo) in color c, text_color c + let { sat ; todo; _ } = + match M.find last_round m with + [] -> { sat = StateSet.empty; todo= StateSet.empty; msg = "ERROR" } + | [ 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 in let tag = QName.to_string (T.tag tree node) in let lbox = (String.length tag + 2) * 10 in @@ -160,5 +164,3 @@ Ata.print auto; pp_print_flush ohtml (); close_out ohtml_; close_in fi - -