X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fhtml_trace.ml;h=7ce3f3905b4483392aad4f6538f5ced4354e4a00;hb=b866f48cda3ad750790a71658f5a13612f93241f;hp=f5aa8b21ff5d5e6cbded32a1cf92e06bd89940d3;hpb=fee64144491afab22d71f6e2de72a9f18f35cd55;p=tatoo.git
diff --git a/src/html_trace.ml b/src/html_trace.ml
index f5aa8b2..7ce3f39 100644
--- a/src/html_trace.ml
+++ b/src/html_trace.ml
@@ -83,11 +83,19 @@ let get_conf sel l i =
accb || StateSet.intersect a.(i) sel,
a.(i) :: accl) (false,[]) l
+let dup_rev_list l =
+ List.fold_left (fun acc e -> e::e::acc) [] l
+
let gen_trace (type s) = fun auto sat_arrays t tree ->
+ let sat_arrays = dup_rev_list sat_arrays in
let module T = (val (t) : Tree.S with type t = s) in
let root = T.root tree in
let sel = Ata.get_selecting_states auto in
- let rec loop output node parent x y =
+ let todos = Ata.get_states_by_rank auto in
+ let pr_sets = Pretty.print_list ~sep:", "
+ (fun fmt s -> fprintf fmt "'%a'" StateSet.print s)
+ in
+ let rec loop output node parent prevsib x y =
if node != T.nil then begin
let node_id = T.preorder tree node in
let marked, conf = get_conf sel sat_arrays node_id in
@@ -95,9 +103,33 @@ let gen_trace (type s) = fun auto sat_arrays t tree ->
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
+ let first = T.first_child tree node in
+ let next = T.next_sibling tree node in
+ fprintf output "\n"
+ s_node
+ marked
+ (T.preorder tree first) (T.preorder tree next)
+ (T.preorder tree parent) (T.preorder tree prevsib)
+ max_active_pass
+ pr_sets (List.rev diff_list)
+ pr_sets (List.rev full_list);
fprintf output
"\n%!"
+ width=\"%i\" height=\"22\" style=\"fill:%s;stroke:rgb(0,0,0)%s\"/>%!"
s_node
s_node
x y
@@ -111,21 +143,19 @@ font-family:typewriter;\" onclick=\"activate(\'%s\');\" >%s\n"
(x+10)
(y+15)
tcolor s_node tag;
- let first = T.first_child tree node in
- let maxw1, maxy1 = loop output first node x (y + 40) in
- let next = T.next_sibling tree node in
+ let maxw1, maxy1 = loop output first node T.nil x (y + 40) in
let x_next = max (x+lbox) (maxw1+10) in
if node != root then begin
- if node == T.first_child tree parent then
+ if prevsib == T.nil then
fprintf output "\n"
- (x + lbox / 2) (y-20) (x + lbox / 2) (y);
+ (x + lbox / 2) (y-18) (x + lbox / 2) (y);
if next != T.nil then
fprintf output "\n"
- (x + lbox) (y+10) x_next (y+10);
+ (x + lbox) (y+11) x_next (y+11);
end;
- let maxw2, maxy2 = loop output next node x_next y in
+ let maxw2, maxy2 = loop output next parent node x_next y in
maxw2, max maxy1 maxy2
end
else x, y
@@ -133,69 +163,53 @@ style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\n"
ignore (Sys.command "mkdir -p tests/trace");
let ohtml_ = open_out "tests/trace/trace.html" in
let ohtml = formatter_of_out_channel ohtml_ in
- fprintf ohtml "\
-
-\
-\
-\
-\
-