Project

General

Profile

Revision 14c56a07

View differences:

src/backends/C/c_backend_header.ml
43 43
  | Fun (n, vl)   -> Basic_library.pp_c n (print_static_val pp_var) fmt vl
44 44
  | _             -> (Format.eprintf "Internal error: C_backend_header.print_static_val"; assert false)
45 45

  
46
let print_constant m pp_var fmt v =
47
  Format.fprintf fmt "inst ## %s = %a"
48
    v.var_id
46
let print_constant_decl (m, attr, inst) pp_var fmt v =
47
  Format.fprintf fmt "%s %a = %a"
48
    attr
49
    (pp_c_type (Format.sprintf "%s ## %s" inst v.var_id)) v.var_type
49 50
    (print_static_val pp_var) (Machine_code.get_const_assign m v)
50 51

  
51
let print_static_constant (m, attr, inst) fmt const_locals =
52
let print_static_constant_decl (m, attr, inst) fmt const_locals =
52 53
  let pp_var fmt v =
53 54
    if List.mem v const_locals
54 55
    then
......
56 57
    else 
57 58
      Format.fprintf fmt "%s" v.var_id in
58 59
  Format.fprintf fmt "%a%t"
59
    (Utils.fprintf_list ~sep:";\\@," (print_constant m pp_var)) const_locals
60
    (Utils.fprintf_list ~sep:";\\@," (print_constant_decl (m, attr, inst) pp_var)) const_locals
60 61
    (Utils.pp_final_char_if_non_empty ";\\@," const_locals)
61 62

  
62 63
let print_static_declare_instance (m, attr, inst) const_locals fmt (i, (n, static)) =
......
84 85
    (Utils.pp_final_char_if_non_empty ", " m.mstatic)
85 86
    inst
86 87
    (* constants *)
87
    (print_static_constant (m, attr, inst)) const_locals
88
    (print_static_constant_decl (m, attr, inst)) const_locals
88 89
    attr
89 90
    pp_machine_memtype_name m.mname.node_id
90 91
    inst
test/tests_ok_dev.list
1
./tests/tuples/tuples1.lus
2
./tests/tuples/tuples2.lus
3
./tests/arrays_arnaud/dummy_lib.lusi
4
./tests/arrays_arnaud/arrays.lus,,-check-access
5
./tests/arrays_arnaud/RelOpMatrix.lus
6
./tests/arrays_arnaud/access1.lus,,-check-access
7
./tests/arrays_arnaud/generic1.lus,,-lusi
8
./tests/arrays_arnaud/generic1.lusi
9
./tests/arrays_arnaud/generic1.lus
10
./tests/arrays_arnaud/generic2.lus
11
./tests/arrays_arnaud/generic3.lus,top,-dynamic -check-access
12
./tests/clocks/clocks1.lus,,-lusi
13
./tests/clocks/clocks1.lusi
14
./tests/clocks/clocks1.lus
15
./tests/clocks/clocks2.lus
16
./tests/clocks/clocks6.lus
17
./tests/clocks/clocks7.lus
18
./tests/clocks/clocks8.lus
19
./tests/clocks/clocks9.lus
20
./tests/clocks/oversampling0.lus,,-lusi
21
./tests/clocks/oversampling0.lusi
22
./tests/clocks/oversampling0.lus
23
./tests/lusic/test2.lusi
24
./tests/lusic/test1.lusi
25
./tests/lusic/test1.lus,as_soon_as
26
./tests/lusic/test2.lus
27
./tests/automata/aut1.lus
28
./tests/automata/heater3.lus
29
./tests/automata/heater4.lus
30
./tests/linear_ctl/libarrays.lusi
31
./tests/linear_ctl/ex1_mat.lus
32
./tests/linear_ctl/ex1_mat_xt.lus

Also available in: Unified diff