Cosmetic changes (truncate long lines, remove trailing spaces…)
[tatoo.git] / src / run.ml
index 2dd5ad5..b51daf9 100644 (file)
@@ -14,6 +14,8 @@
 (***********************************************************************)
 
 INCLUDE "utils.ml"
+INCLUDE "debug.ml"
+
 open Format
 open Misc
 
@@ -289,23 +291,12 @@ DEFINE AND_(t1,t2) =
          in
 
          let v = eval_form phi fcs nss ps old_status old_summary in
-(*
-         Logger.msg `STATS "Evaluating for tag %a, state %a@\ncontext: %a@\nleft: %a@\nright: %a@\n\t formula %a yields %s"
-           QName.print tag
-           State.print q
-           NodeStatus.print old_status
-           NodeStatus.print fcs
-           NodeStatus.print nss
-           Ata.Formula.print phi
-           (match v with True -> "True" | False -> "False" | _ -> "Unknown");
-*)
          match v with
            True -> StateSet.add q a_sat, a_todo
          | False -> acc
          | Unknown -> a_sat, StateSet.add q a_todo
        ) old_todo (old_sat, StateSet.empty)
      in
-  (*   Logger.msg `STATS ""; *)
      if old_sat != sat || old_todo != todo then
        NodeStatus.make { os_node with sat; todo }
      else old_status
@@ -344,7 +335,8 @@ DEFINE AND_(t1,t2) =
     let init_todo = states_by_rank.(i) in
     let rec loop node =
       let node_id = T.preorder tree node in
-      if node == T.nil (*|| not (Bitvector.get unstable node_id)*) then false else begin
+      if node == T.nil (*|| not (Bitvector.get unstable node_id)*) then false
+      else begin
         let parent = T.parent tree node in
         let fc = T.first_child tree node in
         let fc_id = T.preorder tree fc in
@@ -375,19 +367,20 @@ DEFINE AND_(t1,t2) =
           else c
         in
         IFTRACE(html tree node _i status0 "Entering node");
-
         (* get the node_statuses for the first child, next sibling and parent *)
         let ps = unsafe_get_status status (T.preorder tree parent) in
         let fcs = unsafe_get_status status fc_id in
         let nss = unsafe_get_status status ns_id in
         (* evaluate the transitions with all this statuses *)
-        let status1 = if status0.NodeStatus.node.todo == StateSet.empty then status0 else begin
-          let status1 = eval_trans auto cache2 cache5 tag fcs nss ps status0 in
-          IFTRACE(html tree node _i status1 "Updating transitions");
+        let status1 =
+          if status0.NodeStatus.node.todo == StateSet.empty then status0
+          else begin
+            let status1 = eval_trans auto cache2 cache5 tag fcs nss ps status0 in
+            IFTRACE(html tree node _i status1 "Updating transitions");
           (* update the cache if the status of the node changed *)
-          if status1 != status0 then status.(node_id) <- status1;
-          status1
-        end
+            if status1 != status0 then status.(node_id) <- status1;
+            status1
+          end
         in
         (* recursively traverse the first child *)
         let unstable_left = loop fc in
@@ -395,25 +388,32 @@ DEFINE AND_(t1,t2) =
            get the new status of the first child *)
         let fcs1 = unsafe_get_status status fc_id in
         (* update the status *)
-        let status2 = if status1.NodeStatus.node.todo == StateSet.empty then status1 else begin
-          let status2 = eval_trans auto cache2 cache5 tag fcs1 nss ps status1 in
-          IFTRACE(html tree node _i status2 "Updating transitions (after first-child)");
-          if status2 != status1 then status.(node_id) <- status2;
-          status2
-        end
+        let status2 =
+          if status1.NodeStatus.node.todo == StateSet.empty then status1
+          else begin
+            let status2 = eval_trans auto cache2 cache5 tag fcs1 nss ps status1 in
+            IFTRACE(html tree node _i status2
+                      "Updating transitions (after first-child)");
+            if status2 != status1 then status.(node_id) <- status2;
+            status2
+          end
         in
         let unstable_right = loop ns in
         let nss1 = unsafe_get_status status ns_id in
-        let status3 = if status2.NodeStatus.node.todo == StateSet.empty then status2 else begin
-          let status3 = eval_trans auto cache2 cache5 tag fcs1 nss1 ps status2 in
-          IFTRACE(html tree node _i status3 "Updating transitions (after next-sibling)");
+        let status3 =
+          if status2.NodeStatus.node.todo == StateSet.empty then status2
+          else begin
+            let status3 = eval_trans auto cache2 cache5 tag fcs1 nss1 ps status2 in
+            IFTRACE(html tree node _i status3
+                      "Updating transitions (after next-sibling)");
           if status3 != status2 then status.(node_id) <- status3;
           status3
         end
         in
         let unstable_self =
-          (* if either our left or right child is unstable or if we still have transitions
-             pending, the current node is unstable *)
+          (* if either our left or right child is unstable or if we
+             still have transitions pending, the current node is
+             unstable *)
           unstable_left
           || unstable_right
           || StateSet.empty != status3.NodeStatus.node.todo
@@ -423,7 +423,8 @@ DEFINE AND_(t1,t2) =
             Html.finalize_node
               node_id
               _i
-              Ata.(StateSet.intersect status3.NodeStatus.node.sat (get_selecting_states auto))));
+              Ata.(StateSet.intersect status3.NodeStatus.node.sat
+                     (get_selecting_states auto))));
         unstable_self
       end
     in