Project

General

Profile

Revision 74ca6b61 src/printers.ml

View differences:

src/printers.ml
28 28
    pp_set_formatter_out_functions fmt formatter_out_funs;
29 29
  end
30 30

  
31
let rec print_dec_struct_ty_field fmt (label, cty) =
32
  fprintf fmt "%a : %a" pp_print_string label print_dec_ty cty
33
and print_dec_ty fmt cty =
34
  match (*get_repr_type*) cty with
35
  | Tydec_any -> fprintf fmt "Any"
31
let rec pp_var_struct_type_field fmt (label, tdesc) =
32
  fprintf fmt "%a : %a;" pp_print_string label pp_var_type_dec_desc tdesc
33
and pp_var_type_dec_desc fmt tdesc =
34
  match tdesc with 
35
  | Tydec_any -> fprintf fmt "<any>"
36 36
  | Tydec_int -> fprintf fmt "int"
37 37
  | Tydec_real -> fprintf fmt "real"
38
  (* | Tydec_float -> fprintf fmt "float" *)
38 39
  | Tydec_bool -> fprintf fmt "bool"
39
  | Tydec_clock cty' -> fprintf fmt "%a clock" print_dec_ty cty'
40
  | Tydec_const c -> fprintf fmt "%s" c
41
  | Tydec_enum taglist -> fprintf fmt "enum {%a }"
42
      (Utils.fprintf_list ~sep:", " pp_print_string) taglist
43
  | Tydec_struct fieldlist -> fprintf fmt "struct {%a }"
44
      (Utils.fprintf_list ~sep:"; " print_dec_struct_ty_field) fieldlist
45
  | Tydec_array (d, cty') -> fprintf fmt "%a^%a" print_dec_ty cty' Dimension.pp_dimension d
40
  | Tydec_clock t -> fprintf fmt "%a clock" pp_var_type_dec_desc t
41
  | Tydec_const t -> fprintf fmt "%s" t
42
  | Tydec_enum id_list -> fprintf fmt "enum {%a }" (fprintf_list ~sep:", " pp_print_string) id_list
43
  | Tydec_struct f_list -> fprintf fmt "struct {%a }" (fprintf_list ~sep:" " pp_var_struct_type_field) f_list
44
  | Tydec_array (s, t) -> fprintf fmt "%a^%a" pp_var_type_dec_desc t Dimension.pp_dimension s
45

  
46
let pp_var_type_dec fmt ty =
47
  pp_var_type_dec_desc fmt ty.ty_dec_desc
46 48

  
47 49
let pp_var_name fmt id = fprintf fmt "%s" id.var_id
48
let pp_var_type fmt id = Types.print_node_ty fmt id.var_type
50
let pp_var_type fmt id =
51
  if !Options.print_dec_types then
52
    pp_var_type_dec fmt id.var_dec_type
53
  else
54
    Types.print_node_ty fmt id.var_type
55
let pp_var_clock fmt id = Clocks.print_ck_suffix fmt id.var_clock
49 56
  
50 57
let pp_eq_lhs = fprintf_list ~sep:", " pp_print_string
51 58

  
52
let pp_var fmt id = fprintf fmt "%s%s: %a" (if id.var_dec_const then "const " else "") id.var_id Types.print_ty id.var_type
59
let pp_var fmt id =
60
  fprintf fmt "%s%s: %a"
61
    (if id.var_dec_const then "const " else "")
62
    id.var_id
63
    pp_var_type id
53 64

  
54 65
let pp_quantifiers fmt (q, vars) =
55 66
  match q with
......
176 187
*)
177 188
let pp_node_var fmt id =
178 189
  begin
179
    fprintf fmt "%s%s: %a%a" (if id.var_dec_const then "const " else "") id.var_id Types.print_node_ty id.var_type Clocks.print_ck_suffix id.var_clock;
190
    fprintf fmt "%s%s: %a%a"
191
      (if id.var_dec_const then "const " else "")
192
      id.var_id
193
      pp_var_type id
194
      pp_var_clock id;
180 195
    match id.var_dec_value with
181 196
    | None -> () 
182 197
    | Some v -> fprintf fmt " = %a" pp_expr v
......
235 250

  
236 251
and pp_node_eqs fmt eqs = fprintf_list ~sep:"@ " pp_node_eq fmt eqs
237 252

  
238
let rec pp_var_struct_type_field fmt (label, tdesc) =
239
  fprintf fmt "%a : %a;" pp_print_string label pp_var_type_dec_desc tdesc
240
and pp_var_type_dec_desc fmt tdesc =
241
  match tdesc with 
242
  | Tydec_any -> fprintf fmt "<any>"
243
  | Tydec_int -> fprintf fmt "int"
244
  | Tydec_real -> fprintf fmt "real"
245
  (* | Tydec_float -> fprintf fmt "float" *)
246
  | Tydec_bool -> fprintf fmt "bool"
247
  | Tydec_clock t -> fprintf fmt "%a clock" pp_var_type_dec_desc t
248
  | Tydec_const t -> fprintf fmt "%s" t
249
  | Tydec_enum id_list -> fprintf fmt "enum {%a }" (fprintf_list ~sep:", " pp_print_string) id_list
250
  | Tydec_struct f_list -> fprintf fmt "struct {%a }" (fprintf_list ~sep:" " pp_var_struct_type_field) f_list
251
  | Tydec_array (s, t) -> fprintf fmt "%a^%a" pp_var_type_dec_desc t Dimension.pp_dimension s
252

  
253
let pp_var_type_dec fmt ty =
254
  pp_var_type_dec_desc fmt ty.ty_dec_desc
255

  
256 253
let pp_typedef fmt ty =
257 254
  fprintf fmt "type %s = %a;@ " ty.tydef_id pp_var_type_dec_desc ty.tydef_desc
258 255

  

Also available in: Unified diff