diff --git a/src/socPredef2c.ml b/src/socPredef2c.ml index 5ce8632bca97410f4cb53eeb98f98edea6e1823a..09b4bc3bddbf79d534c5149926976ee778594869 100644 --- a/src/socPredef2c.ml +++ b/src/socPredef2c.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 18/06/2014 (at 11:14) by Erwan Jahier> *) +(* Time-stamp: <modified the 18/06/2014 (at 14:06) by Erwan Jahier> *) open Data open Soc @@ -191,27 +191,30 @@ let (get_iterator : Soc.t -> string -> Soc.t -> int -> string) = let iter_inputs,iter_outputs = soc.profile in let node_step = match soc.step with [step] -> step.name | _ -> assert false in - let step_args, ctx, array_index = + let step_args, ctx, array_index,ctx_access = match soc.instances with | [] -> ( + let ctx_access = Printf.sprintf "%s." (get_ctx_name soc.key) in let (array_index : int -> var -> string) = - fun i (vn,vt) -> Printf.sprintf "%s.%s[%d]" (get_ctx_name soc.key) vn i + fun i (vn,vt) -> Printf.sprintf "%s%s[%d]" ctx_access vn i in + Array.make n "", Array.make n (get_ctx_name it_soc.key), - array_index + array_index,ctx_access ) | _ -> let inst_names = List.map fst soc.instances in let inst_names = List.rev inst_names in let step_args = List.map (fun sn -> ("&ctx->"^(id2s sn))) inst_names in let ctx = List.map (fun sn -> ("ctx->"^(id2s sn))) inst_names in + let ctx_access = Printf.sprintf "ctx->" in let (array_index : int -> var -> string) = - fun i (vn,vt) -> Printf.sprintf "ctx->%s[%d]" vn i + fun i (vn,vt) -> Printf.sprintf "%s%s[%d]" ctx_access vn i in Array.of_list step_args, Array.of_list ctx, - array_index + array_index,ctx_access in let buff = ref "" in for i=0 to n-1 do @@ -221,7 +224,7 @@ let (get_iterator : Soc.t -> string -> Soc.t -> int -> string) = (List.map (array_index i) iter_inputs, List.map (array_index i) iter_outputs) | "fold" | "red" | "fill" | "fillred" -> - let a_in = fst (List.hd iter_inputs) in + let a_in = ctx_access ^ (fst (List.hd iter_inputs)) in ( a_in::(List.map (array_index i) (List.tl iter_inputs)), a_in::(List.map (array_index i) (List.tl iter_outputs))) | _ -> assert false (* should not occur *) @@ -233,8 +236,8 @@ let (get_iterator : Soc.t -> string -> Soc.t -> int -> string) = if iterator <> "map" then ( let type_in = snd (List.hd iter_inputs) in - let a_in = fst (List.hd iter_inputs) in - let a_out = fst (List.hd iter_outputs) in + let a_in = ctx_access ^ (fst (List.hd iter_inputs)) in + let a_out = ctx_access ^ (fst (List.hd iter_outputs)) in buff := !buff^(Soc2cUtil.gen_assign type_in a_out a_in) (* a_out=a_n *) ); !buff diff --git a/test/lus2lic.sum b/test/lus2lic.sum index baf0328f87f4f24bd9cd58834034a58eaeb5aaef..c8306bd0f84a56d8e99167e172f7eb0c97816309 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,4 +1,4 @@ -Test Run By jahier on Wed Jun 18 11:15:34 2014 +Test Run By jahier on Wed Jun 18 14:08:00 2014 Native configuration is i686-pc-linux-gnu === lus2lic tests === @@ -88,7 +88,7 @@ PASS: ./lus2lic {-ec -o /tmp/redIf.ec should_work/redIf.lus} PASS: ./myec2c {-o /tmp/redIf.c /tmp/redIf.ec} PASS: ../utils/test_lus2lic_no_node should_work/redIf.lus PASS: ./lus2lic {-2c should_work/redIf.lus -n redIf} -FAIL: Check that the generated C code compiles : gcc redIf_redIf.c redIf_redIf_loop.c +PASS: gcc redIf_redIf.c redIf_redIf_loop.c PASS: ./lus2lic {-o /tmp/t0.lic should_work/t0.lus} PASS: ./lus2lic {-ec -o /tmp/t0.ec should_work/t0.lus} PASS: ./myec2c {-o /tmp/t0.c /tmp/t0.ec} @@ -159,7 +159,7 @@ PASS: ./lus2lic {-ec -o /tmp/deSimone.ec should_work/deSimone.lus} PASS: ./myec2c {-o /tmp/deSimone.c /tmp/deSimone.ec} PASS: ../utils/test_lus2lic_no_node should_work/deSimone.lus PASS: ./lus2lic {-2c should_work/deSimone.lus -n deSimone} -FAIL: Check that the generated C code compiles : gcc deSimone_deSimone.c deSimone_deSimone_loop.c +PASS: gcc deSimone_deSimone.c deSimone_deSimone_loop.c PASS: ./lus2lic {-o /tmp/bug2.lic should_work/bug2.lus} PASS: ./lus2lic {-ec -o /tmp/bug2.ec should_work/bug2.lus} PASS: ./myec2c {-o /tmp/bug2.c /tmp/bug2.ec} @@ -177,7 +177,7 @@ PASS: ./lus2lic {-ec -o /tmp/yyy.ec should_work/yyy.lus} PASS: ./myec2c {-o /tmp/yyy.c /tmp/yyy.ec} PASS: ../utils/test_lus2lic_no_node should_work/yyy.lus PASS: ./lus2lic {-2c should_work/yyy.lus -n yyy} -FAIL: Check that the generated C code compiles : gcc yyy_yyy.c yyy_yyy_loop.c +PASS: gcc yyy_yyy.c yyy_yyy_loop.c PASS: ./lus2lic {-o /tmp/toolate.lic should_work/toolate.lus} PASS: ./lus2lic {-ec -o /tmp/toolate.ec should_work/toolate.lus} PASS: ./myec2c {-o /tmp/toolate.c /tmp/toolate.ec} @@ -247,7 +247,7 @@ PASS: ./lus2lic {-ec -o /tmp/iter.ec should_work/iter.lus} PASS: ./myec2c {-o /tmp/iter.c /tmp/iter.ec} PASS: ../utils/test_lus2lic_no_node should_work/iter.lus PASS: ./lus2lic {-2c should_work/iter.lus -n iter} -FAIL: Check that the generated C code compiles : gcc iter_iter.c iter_iter_loop.c +PASS: gcc iter_iter.c iter_iter_loop.c PASS: ./lus2lic {-o /tmp/call05.lic should_work/call05.lus} PASS: ./lus2lic {-ec -o /tmp/call05.ec should_work/call05.lus} FAIL: Try ec2c on the result: ./myec2c {-o /tmp/call05.c /tmp/call05.ec} @@ -540,7 +540,7 @@ PASS: ./lus2lic {-ec -o /tmp/calculs_max.ec should_work/calculs_max.lus} PASS: ./myec2c {-o /tmp/calculs_max.c /tmp/calculs_max.ec} PASS: ../utils/test_lus2lic_no_node should_work/calculs_max.lus PASS: ./lus2lic {-2c should_work/calculs_max.lus -n calculs_max} -FAIL: Check that the generated C code compiles : gcc calculs_max_calculs_max.c calculs_max_calculs_max_loop.c +PASS: gcc calculs_max_calculs_max.c calculs_max_calculs_max_loop.c PASS: ./lus2lic {-o /tmp/testCA.lic should_work/testCA.lus} PASS: ./lus2lic {-ec -o /tmp/testCA.ec should_work/testCA.lus} PASS: ./myec2c {-o /tmp/testCA.c /tmp/testCA.ec} @@ -620,7 +620,7 @@ PASS: ./lus2lic {-ec -o /tmp/pipeline.ec should_work/pipeline.lus} PASS: ./myec2c {-o /tmp/pipeline.c /tmp/pipeline.ec} PASS: ../utils/test_lus2lic_no_node should_work/pipeline.lus PASS: ./lus2lic {-2c should_work/pipeline.lus -n pipeline} -FAIL: Check that the generated C code compiles : gcc pipeline_pipeline.c pipeline_pipeline_loop.c +PASS: gcc pipeline_pipeline.c pipeline_pipeline_loop.c PASS: ./lus2lic {-o /tmp/mapinf.lic should_work/mapinf.lus} PASS: ./lus2lic {-ec -o /tmp/mapinf.ec should_work/mapinf.lus} PASS: ./myec2c {-o /tmp/mapinf.c /tmp/mapinf.ec} @@ -753,7 +753,7 @@ PASS: ./lus2lic {-ec -o /tmp/FillFollowedByRed.ec should_work/FillFollowedByRed. PASS: ./myec2c {-o /tmp/FillFollowedByRed.c /tmp/FillFollowedByRed.ec} PASS: ../utils/test_lus2lic_no_node should_work/FillFollowedByRed.lus PASS: ./lus2lic {-2c should_work/FillFollowedByRed.lus -n FillFollowedByRed} -FAIL: Check that the generated C code compiles : gcc FillFollowedByRed_FillFollowedByRed.c FillFollowedByRed_FillFollowedByRed_loop.c +PASS: gcc FillFollowedByRed_FillFollowedByRed.c FillFollowedByRed_FillFollowedByRed_loop.c PASS: ./lus2lic {-o /tmp/sample_time_change.lic should_work/sample_time_change.lus} PASS: ./lus2lic {-ec -o /tmp/sample_time_change.ec should_work/sample_time_change.lus} PASS: ./myec2c {-o /tmp/sample_time_change.c /tmp/sample_time_change.ec} @@ -950,7 +950,7 @@ PASS: ./lus2lic {-ec -o /tmp/iterFibo.ec should_work/iterFibo.lus} PASS: ./myec2c {-o /tmp/iterFibo.c /tmp/iterFibo.ec} PASS: ../utils/test_lus2lic_no_node should_work/iterFibo.lus PASS: ./lus2lic {-2c should_work/iterFibo.lus -n iterFibo} -FAIL: Check that the generated C code compiles : gcc iterFibo_iterFibo.c iterFibo_iterFibo_loop.c +PASS: gcc iterFibo_iterFibo.c iterFibo_iterFibo_loop.c PASS: ./lus2lic {-o /tmp/morel2.lic should_work/morel2.lus} PASS: ./lus2lic {-ec -o /tmp/morel2.ec should_work/morel2.lus} PASS: ./myec2c {-o /tmp/morel2.c /tmp/morel2.ec} @@ -995,7 +995,7 @@ PASS: ./lus2lic {-ec -o /tmp/moyenne.ec should_work/moyenne.lus} PASS: ./myec2c {-o /tmp/moyenne.c /tmp/moyenne.ec} PASS: ../utils/test_lus2lic_no_node should_work/moyenne.lus PASS: ./lus2lic {-2c should_work/moyenne.lus -n moyenne} -FAIL: Check that the generated C code compiles : gcc moyenne_moyenne.c moyenne_moyenne_loop.c +PASS: gcc moyenne_moyenne.c moyenne_moyenne_loop.c PASS: ./lus2lic {-o /tmp/activation1.lic should_work/activation1.lus} PASS: ./lus2lic {-ec -o /tmp/activation1.ec should_work/activation1.lus} PASS: ./myec2c {-o /tmp/activation1.c /tmp/activation1.ec} @@ -1082,7 +1082,7 @@ PASS: ./lus2lic {-ec -o /tmp/rediter.ec should_work/rediter.lus} PASS: ./myec2c {-o /tmp/rediter.c /tmp/rediter.ec} PASS: ../utils/test_lus2lic_no_node should_work/rediter.lus PASS: ./lus2lic {-2c should_work/rediter.lus -n rediter} -FAIL: Check that the generated C code compiles : gcc rediter_rediter.c rediter_rediter_loop.c +PASS: gcc rediter_rediter.c rediter_rediter_loop.c PASS: ./lus2lic {-o /tmp/mapdeRed.lic should_work/mapdeRed.lus} PASS: ./lus2lic {-ec -o /tmp/mapdeRed.ec should_work/mapdeRed.lus} PASS: ./myec2c {-o /tmp/mapdeRed.c /tmp/mapdeRed.ec} @@ -1175,7 +1175,7 @@ PASS: ./lus2lic {-ec -o /tmp/predef02.ec should_work/predef02.lus} PASS: ./myec2c {-o /tmp/predef02.c /tmp/predef02.ec} PASS: ../utils/test_lus2lic_no_node should_work/predef02.lus PASS: ./lus2lic {-2c should_work/predef02.lus -n predef02} -FAIL: Check that the generated C code compiles : gcc predef02_predef02.c predef02_predef02_loop.c +PASS: gcc predef02_predef02.c predef02_predef02_loop.c PASS: ./lus2lic {-o /tmp/toto.lic should_work/toto.lus} PASS: ./lus2lic {-ec -o /tmp/toto.ec should_work/toto.lus} PASS: ./myec2c {-o /tmp/toto.c /tmp/toto.ec} @@ -1294,7 +1294,7 @@ PASS: ./lus2lic {-ec -o /tmp/iterate.ec should_work/iterate.lus} PASS: ./myec2c {-o /tmp/iterate.c /tmp/iterate.ec} PASS: ../utils/test_lus2lic_no_node should_work/iterate.lus PASS: ./lus2lic {-2c should_work/iterate.lus -n iterate} -FAIL: Check that the generated C code compiles : gcc iterate_iterate.c iterate_iterate_loop.c +PASS: gcc iterate_iterate.c iterate_iterate_loop.c PASS: ./lus2lic {-o /tmp/overload.lic should_work/overload.lus} PASS: ./lus2lic {-ec -o /tmp/overload.ec should_work/overload.lus} PASS: ./myec2c {-o /tmp/overload.c /tmp/overload.ec} @@ -1479,9 +1479,9 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman === lus2lic Summary === -# of expected passes 1222 -# of unexpected failures 187 +# of expected passes 1234 +# of unexpected failures 175 # of unexpected successes 21 # of expected failures 37 -testcase ./lus2lic.tests/non-reg.exp completed in 135 seconds +testcase ./lus2lic.tests/non-reg.exp completed in 129 seconds testcase ./lus2lic.tests/progression.exp completed in 0 seconds diff --git a/test/lus2lic.time b/test/lus2lic.time index 6513cee9d9e16c5caa0ef5af1fd3b107ef03a757..b771258b27d419d55d4c949273a79842020ac0d2 100644 --- a/test/lus2lic.time +++ b/test/lus2lic.time @@ -1,2 +1,2 @@ -testcase ./lus2lic.tests/non-reg.exp completed in 135 seconds +testcase ./lus2lic.tests/non-reg.exp completed in 129 seconds testcase ./lus2lic.tests/progression.exp completed in 0 seconds