Project

General

Profile

Revision 13aec2da

View differences:

src/backends/C/c_backend_common.ml
23 23
    (if !Options.ansi then "ANSI C90" else "C99")
24 24
    (if !Options.mpfr then "MPFR multi-precision" else "(double) floating-point")
25 25

  
26
let protect_filename s =
27
  Str.global_replace (Str.regexp "\\.\\|\\ ") "_" s
28

  
26 29
let file_to_module_name basename =
27 30
  let baseNAME = Ocaml_utils.uppercase basename in
28
  let baseNAME = Str.global_replace (Str.regexp "\\.\\|\\ ") "_" baseNAME in
31
  let baseNAME = protect_filename baseNAME in
29 32
  baseNAME
30 33

  
31 34
(* Generation of a non-clashing name for the self memory variable (for step and reset functions) *)
src/backends/C/c_backend_header.ml
281 281
      (pp_c_type cdecl.const_id) cdecl.const_type
282 282

  
283 283
let rec pp_c_struct_type_field filename cpt fmt (label, tdesc) =
284
  fprintf fmt "%a;" (pp_c_type_decl filename cpt label) tdesc
284
   fprintf fmt "%a;" (pp_c_type_decl filename cpt label) tdesc
285 285
and pp_c_type_decl filename cpt var fmt tdecl =
286 286
  match tdecl with
287 287
  | Tydec_any           -> assert false
......
297 297
  | Tydec_enum tl ->
298 298
    begin
299 299
      incr cpt;
300
      fprintf fmt "enum _enum_%s_%d { %a } %s" filename !cpt (Utils.fprintf_list ~sep:", " pp_print_string) tl var
300
      fprintf fmt "enum _enum_%s_%d { %a } %s" (protect_filename filename) !cpt (Utils.fprintf_list ~sep:", " pp_print_string) tl var
301 301
    end
302 302
  | Tydec_struct fl ->
303 303
    begin
304 304
      incr cpt;
305
      fprintf fmt "struct _struct_%s_%d { %a } %s" filename !cpt (Utils.fprintf_list ~sep:" " (pp_c_struct_type_field filename cpt)) fl var
305
      fprintf fmt "struct _struct_%s_%d { %a } %s" (protect_filename filename) !cpt (Utils.fprintf_list ~sep:" " (pp_c_struct_type_field filename cpt)) fl var
306 306
    end
307 307

  
308 308
let print_type_definitions fmt filename =

Also available in: Unified diff