Merge branch 'lucca-master' into HEAD
authorLucca Hirschi <lucca.hirschi@gmail.com>
Wed, 4 Jul 2012 12:48:49 +0000 (14:48 +0200)
committerLucca Hirschi <lucca.hirschi@gmail.com>
Wed, 4 Jul 2012 12:48:49 +0000 (14:48 +0200)
Conflicts:
src/run.ml

src/asta.ml
src/run.ml
src/test.ml
tests/results/my.result

index 9059d8d..06396be 100644 (file)
@@ -13,6 +13,8 @@
 (*                                                                     *)
 (***********************************************************************)
 
+(* utils.ml-> INCLUDE "utils.ml" HASHINT2 () *)
+
 type state = State.t
 
 type label = QNameSet.t
@@ -124,12 +126,12 @@ let print fmt asta =
       StateSet.print asta.bottom;
     pp "@[<v 0># Top states: %a@ @]"
       StateSet.print asta.top;
-    let print_list_tr fmt z=
+    let print_list_tr fmt z =
       if SetT.is_empty z 
       then Format.fprintf fmt "ø"
       else
        SetT.iter (fun x -> Format.fprintf fmt "|  %a  @ "  Transition.print x) z in
-    let print_box_list fmt trans  =
+    let print_box_list fmt trans =
       Format.fprintf fmt "  @[<hov 0>%a @]" print_list_tr trans in
     Format.fprintf fmt "@[<v 0># Queries transitions:@ %a@ @]"
       print_box_list asta.trans_q;
index 8333689..444cce7 100644 (file)
 (*                                                                     *)
 (***********************************************************************)
 
-
-(* Il faut tout paramétrer par tr!!!! je ne sais pas comment faire >< **)
-
 module Node  =
 struct
-  type t = Tree.node
-  let tr = Tree.load_xml_string ""
-  let compare n1 n2 = (Tree.preorder tr n2) - (Tree.preorder tr n1)
+  type t = int
+  let hash n = n
+  let compare n1 n2 = n1 - n2
+  let equal n1 n2 = n1 = n2
 end
   
-module NodeMap = Map.Make (Node)
-
-type t = StateSet.t NodeMap.t
-
-let compute tree asta = NodeMap.empty
-
-let print fmt run = ()
+module NodeHash = Hashtbl.Make (Node)
+  
+type t = (StateSet.t*StateSet.t) NodeHash.t
+(** Map from node to query and recognizing states *)
+    
+let compute tree asta =
+  let size_tree = 10000 in              (* todo *)
+  let map = NodeHash.create size_tree in
+  
+  
+  map
+    
+let print fmt run =
+  let print_d_set fmt (s_1,s_2) = 
+    Format.fprintf fmt "@[<hov 0>(%a,@ %a)@]"
+      StateSet.print s_1 StateSet.print s_2 in
+  let print_map fmt run = 
+    let pp = Format.fprintf fmt in
+    if NodeHash.length run = 0
+    then Format.fprintf fmt "ø"
+    else
+      NodeHash.iter (fun cle set -> pp "|  %i-->%a@ " cle print_d_set set)
+        run in
+  let print_box fmt run =
+    let pp = Format.fprintf fmt in
+    pp "@[<v 0># Mapping: %a@ @]"
+      print_map run
+  in
+  Format.fprintf fmt "@[<v 1>##### RUN #####@, %a@ @]@." print_box run
index e6cd725..935023d 100644 (file)
@@ -33,10 +33,10 @@ let query () =
   let arg2 = Sys.argv.(2) in
   if arg2 = "-f"
   then  let fq = open_in Sys.argv.(3) in
-       let q = XPath.parse_file fq in
-       close_in fq;
-       fprintf err_formatter "Parse query OK ! ";
-       q
+        let q = XPath.parse_file fq in
+        close_in fq;
+        fprintf err_formatter "Parse query OK ! ";
+        q
   else let q = XPath.parse_string arg2 in
        fprintf err_formatter "Parse query OK ! ";
        q
@@ -62,6 +62,5 @@ let () =
   Tree.print_xml stderr doc (Tree.root doc);
   output_string stderr "\n";
   Asta.print err_formatter asta;
-  fprintf err_formatter "@[<v 0>##### Run #####@.  %a@]\n"
-    Run.print run;
+  Run.print err_formatter run;
   exit 0
index 63faaef..760aeaf 100644 (file)
@@ -1,4 +1,4 @@
-Parse query OK ! Parse Tree OK ! Compil OK ! Run OK ! 
+Parse Tree OK ! Parse query OK ! Compil OK ! Run OK ! 
 ##### Query #####
   /descendant::a[descendant::c[child::e and not descendant::f[not descendant::e]/descendant::g]]/descendant::b[child::g]
 
@@ -38,4 +38,7 @@ Parse query OK ! Parse Tree OK ! Compil OK ! Run OK !
     |  q₇ ----F(c)---> ↓₁q₆ ∧ ̅↓̅₁̅q̅₅  
     |  q₇ ----Cof(ø)---> ↓₁q₇ ∨ ↓₂q₇    
  
-##### Run #####
+##### RUN #####
+  # Mapping: ø
+