From 4d4a45023928a5edf704fcf7a1e1a31f02b7c414 Mon Sep 17 00:00:00 2001
From: ploc <ploc@garoche.net>
Date: Mon, 11 Apr 2022 09:35:39 +0200
Subject: [PATCH] updated wrt tiny library API changes

---
 src/_tags.in                |  8 +++----
 src/tools/tiny/tiny_tube.ml | 45 ++++++++++++++++++-------------------
 2 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/src/_tags.in b/src/_tags.in
index 9261d004..508a48b4 100644
--- a/src/_tags.in
+++ b/src/_tags.in
@@ -37,10 +37,10 @@ true: bin_annot, color(always)
 <**/*verifier.native> or <**/*.ml{,i}> : package(yojson)
 <**/*verifier.native>: thread
 
-#<**/*.native>                   : use_str
-<**/main_lustre_compiler.native>: package(unix)
-<**/main_lustre_testgen.native> : package(unix)
-<**/main_lustre_verifier.native> : package(unix)
+# <**/*.native>                   : use_str
+<**/main_lustre_compiler.native>: package(unix,str)
+<**/main_lustre_testgen.native> : package(unix,str)
+<**/main_lustre_verifier.native> : package(unix,str)
 <**/sf_sem.native>              : package(unix)
 <**/*>                          : package(num)
 <**/*>                          : package(zarith)
diff --git a/src/tools/tiny/tiny_tube.ml b/src/tools/tiny/tiny_tube.ml
index 704ace24..8f3db2f7 100644
--- a/src/tools/tiny/tiny_tube.ml
+++ b/src/tools/tiny/tiny_tube.ml
@@ -27,13 +27,13 @@ let pp_var fmt ((n,t),ctx) =
      Format.fprintf fmt "%s __ %s = %b" n bv b  
 
   
-let pp_bound fmt b = Tiny.Scalar.pp fmt b 
+(*let pp_bound fmt b = Tiny.Scalar.pp fmt b *)
 
 module type S =
   sig
     module Results: Tiny.Analyze.Results
     val list: (int * Results.Dom.t) list
-    val bounds:  ((Tiny.Ast.Var.t * (Tiny.Ast.Var.t * bool) option) * (Tiny.Scalar.t * Tiny.Scalar.t)) list
+    val bounds:  ((Tiny.Ast.Var.t * (Tiny.Ast.Var.t * bool) option) * (Tiny.Bounds.t)) list
   end
   
 let process env ast results =
@@ -78,13 +78,12 @@ let build f_header f_content env ast results =
   *)
 
 let pp_bounds fmt bounds =
-  List.iter (fun ((v,ctx) as x, (min, max)) ->
+  List.iter (fun ((v,ctx) as x, bounds) ->
       
       Format.fprintf fmt
-        "%a in %a,%a@."
+        "%a in %a@."
         pp_var x
-        pp_bound min
-        pp_bound max)
+        Tiny.Bounds.pp bounds)
     bounds
   
 let pp env ast results fmt =
@@ -98,12 +97,11 @@ let pp env ast results fmt =
 let export env ast results fmt =
   let m = process env ast results in
   let module M = (val m: S) in
-  List.iter (fun (x, (min, max)) ->
+  List.iter (fun (x, bounds) ->
       Format.fprintf fmt
-        "%a in %a,%a@."
+        "%a in %a@."
         pp_var x
-        pp_bound min
-        pp_bound max)
+        Tiny.Bounds.pp bounds)
     M.bounds;
   Format.fprintf fmt "Tube: %i@." (List.length M.list);
   List.iter (fun (idx, elem) ->
@@ -149,17 +147,21 @@ let export_to_wide_csv  env ast results fmt =
       Format.fprintf fmt "@[<h 0>%i, %a@]"
         idx
         (Utils.fprintf_list ~sep:", "
-           (fun fmt (min_, max_) ->
-             let pp_bound fmt b = match b with
-               | None -> Format.fprintf fmt ","
-               | Some b -> Tiny.Scalar.pp fmt b
-             in
-             Format.fprintf fmt "%a, %a" pp_bound min_ pp_bound max_))
+           (fun fmt bounds_ (* (min_, max_) *) ->
+             match bounds_ with
+               None -> Format.fprintf fmt ",,,"
+             | Some b -> Tiny.Bounds.pp fmt b
+             (* let pp_bound fmt b = match b with
+              *   | None -> Format.fprintf fmt ","
+              *   | Some b -> Tiny.Bounds.pp fmt b (\* Scalar.pp fmt b *\)
+              * in *)
+             (* Format.fprintf fmt "%a, %a" pp_bound min_ pp_bound max_ *)))
         (List.map (fun v -> if List.mem_assoc v bounds_idx then
-                              let min_, max_ = List.assoc v bounds_idx in
-                              Some min_, Some max_
+                              Some (List.assoc v bounds_idx)
+                              (* let min_, max_ = List.assoc v bounds_idx in
+                               * Some min_, Some max_ *)
                             else
-                              None, None
+                              None(* , None *)
            ) ordered_list)
     ))
     bounds;
@@ -181,14 +183,11 @@ let export_to_csv  env ast results fmt =
     | Some ((bname,_ (* type should be bool *) ), bval) ->
         Format.fprintf fmt "%s,%a,%s,%b" n (Tiny.Ast.pp_base_type) t bname bval
   in
-  let pp_bound fmt (min_, max_) =
-    Format.fprintf fmt "%a,%a" Tiny.Scalar.pp min_ Tiny.Scalar.pp max_
-  in
   Format.fprintf fmt "timestep,varid,type,boolpart,boolval,min,max@.";
   Utils.fprintf_list ~sep:"@." (
       fun fmt (idx, idx_bounds) ->
       Utils.fprintf_list ~sep:"@." (fun fmt (vctx, vctx_bound) ->
-          Format.fprintf fmt "%i,%a,%a" idx pp_vctx vctx pp_bound vctx_bound
+          Format.fprintf fmt "%i,%a,%a" idx pp_vctx vctx Tiny.Bounds.pp vctx_bound
         ) fmt idx_bounds
     ) fmt bounds
 
-- 
GitLab