X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Frun.ml;h=de2ba81c37e7848eae48c1780ba0056a637be011;hp=83fa0e009d39649e94e4aa929d7ab6e3b41aa6d0;hb=881ebcb1df7335560c8715ec673980158f6ee585;hpb=fc25fccd005bca9e1dd3e9f4f3f93d002917367b diff --git a/src/run.ml b/src/run.ml index 83fa0e0..de2ba81 100644 --- a/src/run.ml +++ b/src/run.ml @@ -11,20 +11,43 @@ (* *) (***********************************************************************) - -(* Il faut tout paramétrer par tr!!!! je ne sais pas comment faire >< **) +INCLUDE "utils.ml" 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 "@[(%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 "@[# Mapping: %a@ @]" + print_map run + in + Format.fprintf fmt "@[##### RUN #####@, %a@ @]@." print_box run +