Cosmetic changes (truncate long lines, remove trailing spaces…)
[tatoo.git] / src / html.ml
index 21b33e6..b35f17d 100644 (file)
@@ -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 "<rect id=\"%s\" onclick=\"activate(\'%s\');\" x=\"%i\" y=\"%i\" width=\"%i\" height=\"20\" style=\"fill:%s;stroke:rgb(0,0,0)%s\"/>\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 "<text x=\"%i\" y=\"%i\" style=\"fill:%s;font-size:17;font-family:typewriter;\" onclick=\"activate(\'%s\');\" >%s</text>\n" (x+10) (y+15) tcolor s_node tag;
+      fprintf osvg
+        "<rect id=\"%s\" onclick=\"activate(\'%s\');\" x=\"%i\" y=\"%i\"\
+ width=\"%i\" height=\"20\" style=\"fill:%s;stroke:rgb(0,0,0)%s\"/>\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 "<text x=\"%i\" y=\"%i\" style=\"fill:%s;font-size:17;\
+font-family:typewriter;\" onclick=\"activate(\'%s\');\" >%s</text>\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  "<line x1=\"%i\" y1=\"%i\" x2=\"%i\" y2=\"%i\" style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\n"
+          fprintf osvg  "<line x1=\"%i\" y1=\"%i\" x2=\"%i\" y2=\"%i\"\
+style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\n"
             (x + lbox / 2) (y-20) (x + lbox / 2) (y);
         if next != T.nil then
-          fprintf osvg "<line x1=\"%i\" y1=\"%i\" x2=\"%i\" y2=\"%i\" style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\n"
+          fprintf osvg "<line x1=\"%i\" y1=\"%i\" x2=\"%i\" y2=\"%i\"\
+style=\"stroke:rgb(0,0,0);stroke-width:2\"/>\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 "</script>\n<div id='svg'><svg width=\"%i\" height=\"%i\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n"
+  fprintf ohtml "</script>\n<div id='svg'><svg width=\"%i\"\
+height=\"%i\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n"
     maxw maxh;
   let fi = open_in "tests/trace/trace.svg" in
   try