27 |
27 |
Format.fprintf fmt "%s __ %s = %b" n bv b
|
28 |
28 |
|
29 |
29 |
|
30 |
|
let pp_bound fmt b = Tiny.Scalar.pp fmt b
|
|
30 |
(*let pp_bound fmt b = Tiny.Scalar.pp fmt b *)
|
31 |
31 |
|
32 |
32 |
module type S =
|
33 |
33 |
sig
|
34 |
34 |
module Results: Tiny.Analyze.Results
|
35 |
35 |
val list: (int * Results.Dom.t) list
|
36 |
|
val bounds: ((Tiny.Ast.Var.t * (Tiny.Ast.Var.t * bool) option) * (Tiny.Scalar.t * Tiny.Scalar.t)) list
|
|
36 |
val bounds: ((Tiny.Ast.Var.t * (Tiny.Ast.Var.t * bool) option) * (Tiny.Bounds.t)) list
|
37 |
37 |
end
|
38 |
38 |
|
39 |
39 |
let process env ast results =
|
... | ... | |
78 |
78 |
*)
|
79 |
79 |
|
80 |
80 |
let pp_bounds fmt bounds =
|
81 |
|
List.iter (fun ((v,ctx) as x, (min, max)) ->
|
|
81 |
List.iter (fun ((v,ctx) as x, bounds) ->
|
82 |
82 |
|
83 |
83 |
Format.fprintf fmt
|
84 |
|
"%a in %a,%a@."
|
|
84 |
"%a in %a@."
|
85 |
85 |
pp_var x
|
86 |
|
pp_bound min
|
87 |
|
pp_bound max)
|
|
86 |
Tiny.Bounds.pp bounds)
|
88 |
87 |
bounds
|
89 |
88 |
|
90 |
89 |
let pp env ast results fmt =
|
... | ... | |
98 |
97 |
let export env ast results fmt =
|
99 |
98 |
let m = process env ast results in
|
100 |
99 |
let module M = (val m: S) in
|
101 |
|
List.iter (fun (x, (min, max)) ->
|
|
100 |
List.iter (fun (x, bounds) ->
|
102 |
101 |
Format.fprintf fmt
|
103 |
|
"%a in %a,%a@."
|
|
102 |
"%a in %a@."
|
104 |
103 |
pp_var x
|
105 |
|
pp_bound min
|
106 |
|
pp_bound max)
|
|
104 |
Tiny.Bounds.pp bounds)
|
107 |
105 |
M.bounds;
|
108 |
106 |
Format.fprintf fmt "Tube: %i@." (List.length M.list);
|
109 |
107 |
List.iter (fun (idx, elem) ->
|
... | ... | |
149 |
147 |
Format.fprintf fmt "@[<h 0>%i, %a@]"
|
150 |
148 |
idx
|
151 |
149 |
(Utils.fprintf_list ~sep:", "
|
152 |
|
(fun fmt (min_, max_) ->
|
153 |
|
let pp_bound fmt b = match b with
|
154 |
|
| None -> Format.fprintf fmt ","
|
155 |
|
| Some b -> Tiny.Scalar.pp fmt b
|
156 |
|
in
|
157 |
|
Format.fprintf fmt "%a, %a" pp_bound min_ pp_bound max_))
|
|
150 |
(fun fmt bounds_ (* (min_, max_) *) ->
|
|
151 |
match bounds_ with
|
|
152 |
None -> Format.fprintf fmt ",,,"
|
|
153 |
| Some b -> Tiny.Bounds.pp fmt b
|
|
154 |
(* let pp_bound fmt b = match b with
|
|
155 |
* | None -> Format.fprintf fmt ","
|
|
156 |
* | Some b -> Tiny.Bounds.pp fmt b (\* Scalar.pp fmt b *\)
|
|
157 |
* in *)
|
|
158 |
(* Format.fprintf fmt "%a, %a" pp_bound min_ pp_bound max_ *)))
|
158 |
159 |
(List.map (fun v -> if List.mem_assoc v bounds_idx then
|
159 |
|
let min_, max_ = List.assoc v bounds_idx in
|
160 |
|
Some min_, Some max_
|
|
160 |
Some (List.assoc v bounds_idx)
|
|
161 |
(* let min_, max_ = List.assoc v bounds_idx in
|
|
162 |
* Some min_, Some max_ *)
|
161 |
163 |
else
|
162 |
|
None, None
|
|
164 |
None(* , None *)
|
163 |
165 |
) ordered_list)
|
164 |
166 |
))
|
165 |
167 |
bounds;
|
... | ... | |
181 |
183 |
| Some ((bname,_ (* type should be bool *) ), bval) ->
|
182 |
184 |
Format.fprintf fmt "%s,%a,%s,%b" n (Tiny.Ast.pp_base_type) t bname bval
|
183 |
185 |
in
|
184 |
|
let pp_bound fmt (min_, max_) =
|
185 |
|
Format.fprintf fmt "%a,%a" Tiny.Scalar.pp min_ Tiny.Scalar.pp max_
|
186 |
|
in
|
187 |
186 |
Format.fprintf fmt "timestep,varid,type,boolpart,boolval,min,max@.";
|
188 |
187 |
Utils.fprintf_list ~sep:"@." (
|
189 |
188 |
fun fmt (idx, idx_bounds) ->
|
190 |
189 |
Utils.fprintf_list ~sep:"@." (fun fmt (vctx, vctx_bound) ->
|
191 |
|
Format.fprintf fmt "%i,%a,%a" idx pp_vctx vctx pp_bound vctx_bound
|
|
190 |
Format.fprintf fmt "%i,%a,%a" idx pp_vctx vctx Tiny.Bounds.pp vctx_bound
|
192 |
191 |
) fmt idx_bounds
|
193 |
192 |
) fmt bounds
|
194 |
193 |
|
updated wrt tiny library API changes