Project

General

Profile

« Previous | Next » 

Revision 89fd79f0

Added by LĂ©lio Brun over 2 years ago

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

View differences:

src/backends/C/c_backend_spec.ml
202 202

  
203 203
let pp_equal pp_l pp_r fmt (l, r) = fprintf fmt "%a == %a" pp_l l pp_r r
204 204

  
205
let pp_gequal pp_l pp_r fmt (l, r) = fprintf fmt "%a >= %a" pp_l l pp_r r
206

  
205 207
let pp_implies pp_l pp_r fmt (l, r) =
206 208
  fprintf fmt "@[<v>%a ==>@ %a@]" pp_l l pp_r r
207 209

  
......
252 254

  
253 255
let pp_ptr_decl fmt v = pp_ptr fmt v.var_id
254 256

  
255
let pp_basic_assign_spec pp_l pp_r fmt typ var_name value =
257
let pp_basic_assign_spec ?(pp_op=pp_equal) pp_l pp_r fmt typ var_name value =
256 258
  if Types.is_real_type typ && !Options.mpfr then assert false
257 259
    (* Mpfr.pp_inject_assign pp_var fmt (var_name, value) *)
258
  else pp_equal pp_l pp_r fmt (var_name, value)
260
  else pp_op pp_l pp_r fmt (var_name, value)
259 261

  
260
let pp_assign_spec m self_l pp_var_l indirect_l self_r pp_var_r indirect_r fmt
262
let pp_assign_spec ?pp_op m self_l pp_var_l indirect_l self_r pp_var_r indirect_r fmt
261 263
    (var_type, var_name, value) =
262 264
  let depth = expansion_depth value in
263 265
  let loop_vars = mk_loop_variables m var_type depth in
......
265 267
  let aux typ fmt vars =
266 268
    match vars with
267 269
    | [] ->
268
      pp_basic_assign_spec
270
      pp_basic_assign_spec ?pp_op
269 271
        (pp_value_suffix
270 272
           ~indirect:indirect_l
271 273
           m
......
564 566
            fmt
565 567
            ((Arrow.arrow_id, (mem_in, inst)), ())
566 568
        else pp_eq fmt ()
569
      | GEqual (a, b) ->
570
        pp_assign_spec ~pp_op:pp_gequal
571
          m
572
          mem_out
573
          (pp_c_var_read ~test_output:false m)
574
          indirect_l
575
          mem_in
576
          (pp_c_var_read ~test_output:false m)
577
          indirect_r
578
          fmt
579
          (type_of_l_value a, val_of_expr a, val_of_expr b)
567 580
      | And fs ->
568 581
        pp_and_l pp_spec' fmt fs
569 582
      | Or fs ->

Also available in: Unified diff