Project

General

Profile

« Previous | Next » 

Revision 8e6cab20

Added by Pierre-Loïc Garoche about 5 years ago

Tuning the pretty printing of Salsa plugin

View differences:

src/plugins/salsa/salsaDatatypes.ml
13 13
  Format.fprintf fmt "]@]";
14 14

  
15 15

  
16
module type VALUE =
17
sig
18
  type t
19
  val union: t -> t -> t
20
  val pp: Format.formatter -> t -> unit
21
    val leq: t -> t -> bool
22
end
23
  
16 24
module Ranges = 
17
  functor (Value: sig type t val union: t -> t -> t val pp: Format.formatter -> t -> unit end)  ->
25
  functor (Value: VALUE)  ->
18 26
struct
27
  module Value = Value
19 28
  type t = Value.t
20 29
  type r_t = (LT.ident, Value.t) Hashtbl.t
21 30

  
......
30 39
  						    pour chaque noeud *)
31 40

  
32 41

  
33
  let pp = pp_hash ~sep:";" (fun k v fmt -> Format.fprintf fmt "%s -> %a" k Value.pp v) 
42
  let pp fmt r =
43
    if Hashtbl.length r = 0 then
44
      Format.fprintf fmt "empty"
45
    else
46
      pp_hash ~sep:";" (fun k v fmt -> Format.fprintf fmt "%s -> %a" k Value.pp v) fmt r
34 47
  let pp_val = Value.pp
35 48

  
36 49
  let add_def ranges name r = 
......
114 127
      (* else *)
115 128
      (* 	Salsa.Builder.mk_cst (ST.I(r*.(1.-.epsilon_float),r*.(1.+.epsilon_float)),Float.ulp (ST.I(r,r))) *)
116 129
    | _ -> assert false
130

  
131
  let leq = Salsa.Float.feSseq
117 132
end
118 133

  
119 134
module RangesInt = Ranges (FloatIntSalsa)
......
212 227
let get_var vars_env v =
213 228
try
214 229
  VarEnv.find v vars_env
215
with Not_found -> Format.eprintf "Impossible to find var %s in var env %a@.@?" v
230
with Not_found -> Format.eprintf "Impossible to find var %s in var env %a@ " v
216 231
  (Utils.fprintf_list ~sep:", " (fun fmt (id, _) -> Format.pp_print_string fmt id)) (VarEnv.bindings vars_env) 
217 232
  ; assert false
218 233

  
......
353 368

  
354 369
  let empty (): fe_t = Hashtbl.create 13
355 370

  
356
  let pp fmt env = pp_hash ~sep:";" (fun k (_,v) fmt -> Format.fprintf fmt "%s -> %a" k MC.pp_val v) fmt env
371
  let pp fmt env = pp_hash ~sep:";@ " (fun k (_,v) fmt -> Format.fprintf fmt "%s -> %a" k MC.pp_val v) fmt env
357 372

  
358 373

  
359 374
  let get_sort_fun env =

Also available in: Unified diff