Commit 034c6d493d02fcbb39c24d171231c8bac4469da2

Authored by Salvador Abreu
1 parent 7d0195a6
Exists in master

arrays

Showing 1 changed file with 9 additions and 3 deletions   Show diff stats
fz/paccs/output.pl
... ... @@ -37,6 +37,12 @@ cg_var(decl, var(N,int(LB,UB),_I,_A), _ST) -->
37 37  
38 38 cg_var(init, var(_,int(_,_),_,_), _) --> [].
39 39  
  40 +cg_var(decl, val(N,int,lit(INIT,_),_), _) -->
  41 + { format_to_codes(S, " const int ~w = ~w;\n", [N, INIT]) },
  42 + S.
  43 +
  44 +cg_var(init, val(_,int,_,_), _) --> [].
  45 +
40 46 % -- array of variables - - - - - - - - - - - - - - - - - - - - - - - - - - - -
41 47  
42 48 cg_var(decl, var(N,array(_T,LB,UB),[],_), _ST) --> !,
... ... @@ -51,15 +57,15 @@ cg_var(init, var(N,array(T,ALB,AUB),[],_), _ST) --> !,
51 57  
52 58 % -- array of constants - - - - - - - - - - - - - - - - - - - - - - - - - - - -
53 59  
54   -cg_var(decl, var(N,array(_T,LB,UB),lit(INIT,array(_)),_), _ST) -->
  60 +cg_var(decl, val(N,array(_T,LB,UB),lit(INIT,array(_)),_), _ST) -->
55 61 { nonvar(INIT), INIT=[_|_] }, !,
56 62 { SZ is UB-LB+1,
57   - format_to_codes(S, " int ~w[~d] = {", [N, SZ]) },
  63 + format_to_codes(S, " const int ~w[~d] = {", [N, SZ]) },
58 64 S,
59 65 cg_constant_list(INIT, " "),
60 66 " };\n".
61 67  
62   -cg_var(init, var(_N,array(_T,_LB,_UB),lit(INIT,array(_)),_), _ST) -->
  68 +cg_var(init, val(_N,array(_T,_LB,_UB),lit(INIT,array(_)),_), _ST) -->
63 69 { nonvar(INIT), INIT=[_|_] }, !,
64 70 [].
65 71  
... ...