Project

General

Profile

Revision 89137ae1 src/backends/C/c_backend_common.ml

View differences:

src/backends/C/c_backend_common.ml
94 94

  
95 95
let rec pp_c_dimension fmt dim =
96 96
  match dim.Dimension.dim_desc with
97
  | Dident id       ->
97
  | Dimension.Dident id       ->
98 98
    fprintf fmt "%s" id
99
  | Dint i          ->
99
  | Dimension.Dint i          ->
100 100
    fprintf fmt "%d" i
101
  | Dbool b         ->
101
  | Dimension.Dbool b         ->
102 102
    fprintf fmt "%B" b
103
  | Dite (i, t, e)  ->
103
  | Dimension.Dite (i, t, e)  ->
104 104
    fprintf fmt "((%a)?%a:%a)"
105 105
       pp_c_dimension i pp_c_dimension t pp_c_dimension e
106
 | Dappl (f, args) ->
106
 | Dimension.Dappl (f, args) ->
107 107
     fprintf fmt "%a" (Basic_library.pp_c f pp_c_dimension) args
108
 | Dlink dim' -> fprintf fmt "%a" pp_c_dimension dim'
109
 | Dvar       -> fprintf fmt "_%s" (Utils.name_of_dimension dim.dim_id)
110
 | Dunivar    -> fprintf fmt "'%s" (Utils.name_of_dimension dim.dim_id)
108
 | Dimension.Dlink dim' -> fprintf fmt "%a" pp_c_dimension dim'
109
 | Dimension.Dvar       -> fprintf fmt "_%s" (Utils.name_of_dimension dim.Dimension.dim_id)
110
 | Dimension.Dunivar    -> fprintf fmt "'%s" (Utils.name_of_dimension dim.Dimension.dim_id)
111 111

  
112 112
let is_basic_c_type t =
113 113
  match (Types.repr t).Types.tdesc with
......
152 152
let pp_c_tag fmt t =
153 153
 pp_print_string fmt (if t = tag_true then "1" else if t = tag_false then "0" else t)
154 154

  
155

  
155 156
(* Prints a constant value *)
156 157
let rec pp_c_const fmt c =
157 158
  match c with
......
168 169
   but an offset suffix may be added for array variables
169 170
*)
170 171
let rec pp_c_val self pp_var fmt v =
172
  (*Format.eprintf "C_backend_common.pp_c_val %a@." pp_val v;*)
171 173
  match v with
172 174
  | Cst c         -> pp_c_const fmt c
173 175
  | Array vl      -> fprintf fmt "{%a}" (Utils.fprintf_list ~sep:", " (pp_c_val self pp_var)) vl
174 176
  | Access (t, i) -> fprintf fmt "%a[%a]" (pp_c_val self pp_var) t (pp_c_val self pp_var) i
175
  | Power (v, n)  -> assert false
177
  | Power (v, n)  -> (Format.eprintf "internal error: C_backend_common.pp_c_val %a@." pp_val v; assert false)
176 178
  | LocalVar v    -> pp_var fmt v
177 179
  | StateVar v    ->
178 180
    (* array memory vars are represented by an indirection to a local var with the right type,

Also available in: Unified diff