Project

General

Profile

Revision 2d179f5b src/backends/C/c_backend_common.ml

View differences:

src/backends/C/c_backend_common.ml
92 92
let pp_machine_reset_name fmt id = fprintf fmt "%s_reset" id
93 93
let pp_machine_step_name fmt id = fprintf fmt "%s_step" id
94 94

  
95
let pp_c_dimension fmt d =
96
 fprintf fmt "%a" Dimension.pp_dimension d
95
let rec pp_c_dimension fmt dim =
96
  match dim.Dimension.dim_desc with
97
  | Dident id       ->
98
    fprintf fmt "%s" id
99
  | Dint i          ->
100
    fprintf fmt "%d" i
101
  | Dbool b         ->
102
    fprintf fmt "%B" b
103
  | Dite (i, t, e)  ->
104
    fprintf fmt "((%a)?%a:%a)"
105
       pp_c_dimension i pp_c_dimension t pp_c_dimension e
106
 | Dappl (f, args) ->
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)
97 111

  
98 112
let is_basic_c_type t =
99 113
  match (Types.repr t).Types.tdesc with
......
119 133
    | Types.Tstatic (_, t') -> fprintf fmt "const "; aux t' pp_suffix
120 134
    | Types.Tconst ty       -> fprintf fmt "%s %s" ty var
121 135
    | Types.Tarrow (_, _)   -> fprintf fmt "void (*%s)()" var
122
    | _                     -> eprintf "internal error: pp_c_type %a@." Types.print_ty t; assert false
136
    | _                     -> eprintf "internal error: C_backend_common.pp_c_type %a@." Types.print_ty t; assert false
123 137
  in aux t (fun fmt () -> ())
124 138

  
125 139
let rec pp_c_initialize fmt t = 

Also available in: Unified diff