Project

General

Profile

« Previous | Next » 

Revision a7062da6

Added by LĂ©lio Brun over 3 years ago

another step towards refactoring

View differences:

src/backends/C/c_backend_header.ml
16 16
open Machine_code_common
17 17
open C_backend_common
18 18

  
19
module Mpfr = Lustrec_mpfr
20

  
19 21
(********************************************************************************************)
20 22
(* Header Printing functions *)
21 23
(********************************************************************************************)
......
23 25
module type MODIFIERS_HDR = sig
24 26
  module GhostProto : MODIFIERS_GHOST_PROTO
25 27

  
26
  val print_machine_decl_prefix : Format.formatter -> machine_t -> unit
28
  val print_machine_decl_prefix : formatter -> machine_t -> unit
27 29

  
28 30
  val pp_import_arrow : formatter -> unit -> unit
29 31
end
......
174 176
            print_static_link_macro macro print_static_alloc_macro macro
175 177
        else
176 178
          (* Dynamic allocation *)
177
          fprintf fmt "extern %a;@,extern %a" print_alloc_prototype
179
          fprintf fmt "extern %a;@,extern %a" pp_alloc_prototype
178 180
            (m.mname.node_id, m.mstatic)
179
            print_dealloc_prototype m.mname.node_id
181
            pp_dealloc_prototype m.mname.node_id
180 182

  
181 183
    let print_machine_struct_top_decl_from_header fmt tdecl =
182 184
      let inode = imported_node_of_top tdecl in
......
187 189
    let print_stateless_C_prototype fmt (name, inputs, outputs) =
188 190
      let output = match outputs with [ hd ] -> hd | _ -> assert false in
189 191
      fprintf fmt "%a %s %a"
190
        (pp_basic_c_type ~pp_c_basic_type_desc ~var_opt:None)
192
        (fun x -> pp_basic_c_type ~pp_c_basic_type_desc x)
191 193
        output.var_type name
192 194
        (pp_print_parenthesized pp_c_decl_input_var)
193 195
        inputs
......
317 319
        (* Print the svn version number and the supported C standard (C90 or
318 320
           C99) *)
319 321
        pp_print_version () baseNAME baseNAME (* Import the header *) basename
320
        print_import_prototype
322
        pp_import_prototype
321 323
        {
322 324
          local = true;
323 325
          name = basename;
......
327 329
        (* Print dependencies *)
328 330
        (pp_print_list ~pp_open_box:pp_open_vbox0
329 331
           ~pp_prologue:(pp_print_endcut "/* Import dependencies */")
330
           print_import_alloc_prototype ~pp_epilogue:pp_print_cutcut)
332
           pp_import_alloc_prototype ~pp_epilogue:pp_print_cutcut)
331 333
        dependencies
332 334
        (* Print the struct definitions of all machines. *)
333 335
        (pp_print_list ~pp_open_box:pp_open_vbox0
334 336
           ~pp_prologue:(pp_print_endcut "/* Struct definitions */")
335
           ~pp_sep:pp_print_cutcut print_machine_struct
337
           ~pp_sep:pp_print_cutcut pp_machine_struct
336 338
           ~pp_epilogue:pp_print_cutcut)
337 339
        machines
338 340
        (* Print the prototypes of all machines *)
......
372 374
           ~pp_prologue:(pp_print_endcut "/* Import dependencies */")
373 375
           (fun fmt dep ->
374 376
             let local, name = dependency_of_top dep in
375
             print_import_prototype fmt
377
             pp_import_prototype fmt
376 378
               {
377 379
                 local;
378 380
                 name;
......
404 406
            /* Global clear declaration */@,\
405 407
            extern %a;@,\
406 408
            @,"
407
           print_global_init_prototype baseNAME print_global_clear_prototype
409
           pp_global_init_prototype baseNAME pp_global_clear_prototype
408 410
           baseNAME
409 411
        else pp_print_nothing)
410 412
        ()

Also available in: Unified diff