diff --git a/fz/paccs/output.pl b/fz/paccs/output.pl index be6902f..65d095f 100644 --- a/fz/paccs/output.pl +++ b/fz/paccs/output.pl @@ -37,6 +37,12 @@ cg_var(decl, var(N,int(LB,UB),_I,_A), _ST) --> cg_var(init, var(_,int(_,_),_,_), _) --> []. +cg_var(decl, val(N,int,lit(INIT,_),_), _) --> + { format_to_codes(S, " const int ~w = ~w;\n", [N, INIT]) }, + S. + +cg_var(init, val(_,int,_,_), _) --> []. + % -- array of variables - - - - - - - - - - - - - - - - - - - - - - - - - - - - cg_var(decl, var(N,array(_T,LB,UB),[],_), _ST) --> !, @@ -51,15 +57,15 @@ cg_var(init, var(N,array(T,ALB,AUB),[],_), _ST) --> !, % -- array of constants - - - - - - - - - - - - - - - - - - - - - - - - - - - - -cg_var(decl, var(N,array(_T,LB,UB),lit(INIT,array(_)),_), _ST) --> +cg_var(decl, val(N,array(_T,LB,UB),lit(INIT,array(_)),_), _ST) --> { nonvar(INIT), INIT=[_|_] }, !, { SZ is UB-LB+1, - format_to_codes(S, " int ~w[~d] = {", [N, SZ]) }, + format_to_codes(S, " const int ~w[~d] = {", [N, SZ]) }, S, cg_constant_list(INIT, " "), " };\n". -cg_var(init, var(_N,array(_T,_LB,_UB),lit(INIT,array(_)),_), _ST) --> +cg_var(init, val(_N,array(_T,_LB,_UB),lit(INIT,array(_)),_), _ST) --> { nonvar(INIT), INIT=[_|_] }, !, []. -- libgit2 0.21.2