Project

General

Profile

« Previous | Next » 

Revision 89fd79f0

Added by LĂ©lio Brun over 3 years ago

a working version for automata with 'last' case of enums as default case

View differences:

src/backends/C/c_backend_src.ml
369 369
            "@[<v 2>switch(%a) {@,%a@,}@]"
370 370
            (pp_c_val m self (pp_c_var_read m))
371 371
            g
372
            (pp_print_list
372
            (pp_print_list_i
373 373
               ~pp_open_box:pp_open_vbox0
374
               (pp_machine_branch dependencies m self mem))
374
               (pp_machine_branch dependencies m self mem (List.length hl)))
375 375
            hl
376 376
      | MSpec s ->
377 377
        fprintf fmt "@[/*@@ %s */@]@ " s
......
380 380
    in
381 381
    fprintf fmt "%a%a" pp_instr instr (Mod.pp_step_instr_spec m self mem) instr
382 382

  
383
  and pp_machine_branch dependencies m self mem fmt (t, h) =
383
  and pp_machine_branch dependencies m self mem n fmt i (t, h) =
384 384
    fprintf
385 385
      fmt
386
      "@[<v 2>case %a:@,%a@,break;@]"
386
      (if i = n - 1
387
       then "@[<v 2>default: // %a@,%a@]"
388
       else "@[<v 2>case %a:@,%a@,break;@]")
387 389
      pp_c_tag
388 390
      t
389 391
      (pp_print_list

Also available in: Unified diff