Project

General

Profile

« Previous | Next » 

Revision 8d2d6fa0

Added by LĂ©lio Brun about 3 years ago

Almost works!

View differences:

src/backends/C/c_backend_src.ml
18 18

  
19 19
module type MODIFIERS_SRC = sig
20 20
  val pp_predicates: dep_t list -> formatter -> machine_t list -> unit
21
  val pp_reset_spec: formatter -> ident -> machine_t -> unit
22
  val pp_step_spec: formatter -> ident -> machine_t -> unit
21
  val pp_reset_spec: formatter -> machine_t list -> ident -> machine_t -> unit
22
  val pp_step_spec: formatter -> machine_t list -> ident -> machine_t -> unit
23 23
  val pp_step_instr_spec: machine_t -> ident -> formatter -> (int * instr_t) -> unit
24 24
end
25 25

  
26 26
module EmptyMod = struct
27 27
  let pp_predicates _ _ _ = ()
28
  let pp_reset_spec _ _ _ = ()
29
  let pp_step_spec _ _ _ = ()
28
  let pp_reset_spec _ _ _ _ = ()
29
  let pp_step_spec _ _ _ _ = ()
30 30
  let pp_step_instr_spec _ _ _ _ = ()
31 31
end
32 32

  
......
250 250
    pp_machine_instr dependencies m self fmt instr
251 251

  
252 252
  let pp_machine_step_instr dependencies m self fmt i instr =
253
    fprintf fmt "%a@,%a%a"
253
    fprintf fmt "%a%a%a"
254 254
      (if i = 0 then
255
         (fun fmt () -> Mod.pp_step_instr_spec m self fmt (i, instr))
255
         (fun fmt () -> fprintf fmt "%a@,"
256
             (Mod.pp_step_instr_spec m self) (i, instr))
256 257
       else
257 258
         pp_print_nothing) ()
258 259
      (pp_machine_instr dependencies m self) instr
......
472 473
        ~instrs:m.mstep.step_instrs
473 474
        fmt
474 475

  
475
  let print_reset_code dependencies self fmt m =
476
  let print_reset_code machines dependencies self fmt m =
476 477
    pp_print_function
477
      ~pp_spec:(fun fmt () -> Mod.pp_reset_spec fmt self m)
478
      ~pp_spec:(fun fmt () -> Mod.pp_reset_spec fmt machines self m)
478 479
      ~pp_prototype:(print_reset_prototype self)
479 480
      ~prototype:(m.mname.node_id, m.mstatic)
480 481
      ~pp_local:(pp_c_decl_local_var m)
......
519 520
            fmt minit)
520 521
      fmt
521 522

  
522
  let print_step_code dependencies self fmt m =
523
  let print_step_code machines dependencies self fmt m =
523 524
    if not (!Options.ansi && is_generic_node (node_of_machine m))
524 525
    then
525 526
      (* C99 code *)
526 527
      pp_print_function
527
        ~pp_spec:(fun fmt () -> Mod.pp_step_spec fmt self m)
528
        ~pp_spec:(fun fmt () -> Mod.pp_step_spec fmt machines self m)
528 529
        ~pp_prototype:(print_step_prototype self)
529 530
        ~prototype:(m.mname.node_id, m.mstep.step_inputs, m.mstep.step_outputs)
530 531
        ~pp_local:(pp_c_decl_local_var m)
......
547 548
          let id, _, _ = call_of_expr e in
548 549
          mk_call_var_decl e.expr_loc id) m.mname.node_gencalls in
549 550
      pp_print_function
550
        ~pp_spec:(fun fmt () -> Mod.pp_step_spec fmt self m)
551
        ~pp_spec:(fun fmt () -> Mod.pp_step_spec fmt machines self m)
551 552
        ~pp_prototype:(print_step_prototype self)
552 553
        ~prototype:(m.mname.node_id,
553 554
                    m.mstep.step_inputs @ gen_locals @ gen_calls,
......
698 699
     - last one may print intermediate comment/acsl if/when they are present in
699 700
       the sequence of instruction
700 701
  *)
701
  let print_machine dependencies fmt m =
702
  let print_machine machines dependencies fmt m =
702 703
    if fst (get_stateless_status m) then
703 704
      (* Step function *)
704 705
      print_stateless_code dependencies fmt m
......
707 708
      fprintf fmt "@[<v>%a%a@,@,%a%a@]"
708 709
        print_alloc_function m
709 710
        (* Reset function *)
710
        (print_reset_code dependencies self) m
711
        (print_reset_code machines dependencies self) m
711 712
        (* Step function *)
712
        (print_step_code dependencies self) m
713
        (print_step_code machines dependencies self) m
713 714
        (print_mpfr_code self) m
714 715

  
715 716
  let print_import_standard source_fmt () =
......
830 831
      (pp_print_list
831 832
         ~pp_open_box:pp_open_vbox0
832 833
         ~pp_sep:pp_print_cutcut
833
         (print_machine dependencies)) machines
834
         (print_machine machines dependencies)) machines
834 835

  
835 836
end
836 837

  

Also available in: Unified diff