let html_header = format_of_string " " let html_footer = " " let h_trace = Hashtbl.create 4096 let register_trace t x = Hashtbl.add h_trace (Tree.id t) x let output_trace a t file results = let h_auto = 6+ (Hashtbl.fold (fun _ l a -> (List.length l)+a) a.phi 0) in let max_tt = ref 0 in let outc = open_out file in let outf = Format.formatter_of_out_channel outc in let strf = Format.str_formatter in let pr_str x = Format.fprintf strf x in let pr_out x = Format.fprintf outf x in let rec loop t = if not (Tree.is_nil t) then let tooltip,selected = try let (inconf,outconf,leftres,rightres,trans) = Hashtbl.find h_trace (Tree.id t) in let selected = IntSet.mem (Tree.id t) results in pr_str "
Subtree %i, tag='%s', internal node = %s\nEntered with configuration:\n" (Tree.id t) (Tree.id t) (Tag.to_string (Tree.tag t)) (Tree.dump_node t); iter_pl (fun s -> pr_st strf (Ptset.elements s)) inconf; pr_str "%s" "\nLeft with configuration:\n"; iter_pl (fun s -> pr_st strf (Ptset.elements s)) outconf; pr_str "%s" "\nAccept states for left child:\n"; iter_pl (fun s -> pr_st strf (Ptset.elements s)) leftres; pr_str "%s" "\nAccept states for right child:\n"; iter_pl (fun s -> pr_st strf (Ptset.elements s)) rightres; pr_str "%s" "\nTriggered transitions:\n"; pr_str "%s" ""; List.iter (fun fl -> pr_str "%s" ""; max_tt := max !max_tt (form_list_length fl); ) trans; pr_str "%s" "
";pr_frmlst strf fl;pr_str "
\n"; pr_str "In result set : %s\n
" (if selected then "Yes" else "No"); Format.flush_str_formatter(),selected with Not_found -> "",false in let tag = Tree.tag t in let div_class = (if (tooltip = "") then "skipped" else (if selected then "selected" else "touched"))^ (if tag == Tag.pcdata then "_text" else"") in if tag == Tag.pcdata then pr_out "
%s%s
"div_class (Tree.get_text t) tooltip else begin if (Tree.is_nil (Tree.first_child t)) then pr_out "
<%s/>%s
" div_class (Tree.id t) (Tree.id t) (Tag.to_string tag) tooltip else begin pr_out "
<%s>%s
" div_class (Tree.id t) (Tree.id t) (Tag.to_string tag) tooltip; loop (Tree.first_child t); pr_out "
</%s>
" div_class (Tag.to_string tag); end; end; loop (Tree.next_sibling t); in let max_tt = 25*(!max_tt + 12)+20 in let height = max max_tt (25*h_auto) in pr_out html_header height height height height; pr_out "%s" "
"; dump outf a; pr_out "%s" "
"; pr_out "%s" "
"; loop t; pr_out "%s" html_footer; pr_out "%!"; close_out outc