Project

General

Profile

Revision 785b64f9 src/backends/EMF/EMF_common.ml

View differences:

src/backends/EMF/EMF_common.ml
33 33
*)
34 34
    
35 35
(* Basic printing functions *)
36

  
37
(* If string length of f is longer than 50 chars, we select the 20 first and
38
   last and put a hash in the middle *)
39
let print_protect fmt f =
40
  fprintf str_formatter "%t" f;
41
  let s = flush_str_formatter () in
42
  let l = String.length s in
43
  if l > 50 then
44
    let prefix = String.sub s 0 20 and
45
	suffix = String.sub s (l-20) 20 in
46
    let hash = Hashtbl.hash s in
47
    fprintf fmt "%s_%i_%s" prefix hash suffix
48
  else
49
    fprintf fmt "%s" s
36 50
    
37 51
let pp_var_string fmt v = fprintf fmt "\"%s\"" v
38
(*let pp_var_name fmt v = fprintf fmt "\"%a\"" Printers.pp_var_name v*)
52
let pp_var_name fmt v = print_protect fmt (fun fmt -> Printers.pp_var_name fmt v) 
39 53
(*let pp_node_args = fprintf_list ~sep:", " pp_var_name*)
40 54

  
41 55
(********* Printing types ***********)
......
126 140
    
127 141
let pp_emf_var_decl fmt v =
128 142
  fprintf fmt "@[{\"name\": \"%a\", \"datatype\":\"%a\"}@]"
129
    Printers.pp_var_name v
143
    pp_var_name v
130 144
    pp_var_type v
131 145
    
132 146
let pp_emf_vars_decl fmt vl =

Also available in: Unified diff