Project

General

Profile

Revision 080a6d0b src/backends/C/c_backend_common.ml

View differences:

src/backends/C/c_backend_common.ml
222 222
*)
223 223
let rec pp_c_val self pp_var fmt v =
224 224
  match v with
225
    | Cst c         -> pp_c_const fmt c
226
    | Array vl      -> fprintf fmt "{%a}" (Utils.fprintf_list ~sep:", " (pp_c_val self pp_var)) vl
227
    | Access (t, i) -> fprintf fmt "%a[%a]" (pp_c_val self pp_var) t (pp_c_val self pp_var) i
228
    | Power (v, n)  -> assert false
229
    | LocalVar v    -> pp_var fmt v
230
    | StateVar v    ->
225
  | Cst c         -> pp_c_const fmt c
226
  | Array vl      -> fprintf fmt "{%a}" (Utils.fprintf_list ~sep:", " (pp_c_val self pp_var)) vl
227
  | Access (t, i) -> fprintf fmt "%a[%a]" (pp_c_val self pp_var) t (pp_c_val self pp_var) i
228
  | Power (v, n)  -> assert false
229
  | LocalVar v    -> pp_var fmt v
230
  | StateVar v    ->
231 231
    (* array memory vars are represented by an indirection to a local var with the right type,
232 232
       in order to avoid casting everywhere. *)
233
      if Types.is_array_type v.var_type
234
      then fprintf fmt "%a" pp_var v
235
      else fprintf fmt "%s->_reg.%a" self pp_var v
236
    | Fun (n, vl)   -> Basic_library.pp_c n (pp_c_val self pp_var) fmt vl
233
    if Types.is_array_type v.var_type
234
    then fprintf fmt "%a" pp_var v
235
    else fprintf fmt "%s->_reg.%a" self pp_var v
236
  | Fun (n, vl)   -> Basic_library.pp_c n (pp_c_val self pp_var) fmt vl
237 237

  
238 238
let pp_c_checks self fmt m =
239 239
  Utils.fprintf_list ~sep:"" 

Also available in: Unified diff