diff --git a/src/soc2c.ml b/src/soc2c.ml index bd73dc6f4efca6c5dc28e352d44f59ec60a926d4..12bb9ec64642ad2c9eed12dc5cc7968022e85321 100644 --- a/src/soc2c.ml +++ b/src/soc2c.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 20/03/2015 (at 15:48) by Erwan Jahier> *) +(* Time-stamp: <modified the 20/03/2015 (at 15:54) by Erwan Jahier> *) (* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *) @@ -368,7 +368,6 @@ let (gen_main_wcet_file : Soc.t -> string -> Soc.tbl -> unit) = putc (" #include <stdlib.h> #include \""^base ^".h\" - int main(){" ^ ( match io_transmit_mode () with | Lv6MainArgs.Stack -> diff --git a/src/soc2cExtern.ml b/src/soc2cExtern.ml index 33c59762e9482af2a815ef011d8e24d0ec583182..ebf31039cb955bc9e6f603e73e4b815cb3c499b5 100644 --- a/src/soc2cExtern.ml +++ b/src/soc2cExtern.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 26/02/2015 (at 11:23) by Erwan Jahier> *) +(* Time-stamp: <modified the 20/03/2015 (at 17:31) by Erwan Jahier> *) open Soc2cIdent @@ -120,13 +120,11 @@ let (gen_files : Soc.t -> Soc.tbl -> LicPrg.t -> string -> string-> string -> bo let ext_och = open_out ext_hfile in output_string ext_och (type_decl licprg); (* output_string ext_och (cpy_decl licprg); *) + List.iter (fun (sm,soc) -> let sname = Soc2cDep.step_name soc.key sm.name in - if SocUtils.ctx_is_global soc then - output_string ext_och (Printf.sprintf "void %s();\n" sname) - else - let ctx = get_ctx_name soc.key in - output_string ext_och (Printf.sprintf "void %s(%s*);\n" sname ctx) + let proto_decl,_ = Soc2cDep.get_step_prototype sm soc in + output_string ext_och proto_decl; ) extern_steps; close_out ext_och; print_string (Printf.sprintf "%s has been generated.\n" ext_hfile); @@ -140,15 +138,13 @@ let (gen_files : Soc.t -> Soc.tbl -> LicPrg.t -> string -> string-> string -> bo output_string ext_occ (const_def licprg); List.iter (fun (sm,soc) -> let sname = Soc2cDep.step_name soc.key sm.name in - if SocUtils.ctx_is_global soc then - output_string ext_occ (Printf.sprintf "void %s(){\n /* finish me! */\n}\n" sname) - else - let ctx = get_ctx_name soc.key in - output_string ext_occ ( - Printf.sprintf "void %s(%s* ctx){\n \\\\ finish me!\n}\n" sname ctx) + let _,proto_begin = Soc2cDep.get_step_prototype sm soc in + output_string ext_occ proto_begin; + output_string ext_occ (Printf.sprintf " /* finish me! */\n}\n") ) extern_steps; close_out ext_occ; print_string (Printf.sprintf "%s has been generated.\n" ext_cfile); ); needs_cfile, needs_hfile + diff --git a/test/lus2lic.sum b/test/lus2lic.sum index a719ceedfed6a329d22797582f8bc9155fd507de..907be215f1764f42bf72260a8adbb426b37573b4 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,5 +1,5 @@ ==> lus2lic0.sum <== -Test Run By jahier on Wed Mar 18 17:03:49 +Test Run By jahier on Fri Mar 20 17:38:52 Native configuration is x86_64-unknown-linux-gnu === lus2lic0 tests === @@ -63,7 +63,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus ==> lus2lic1.sum <== -Test Run By jahier on Wed Mar 18 17:03:53 +Test Run By jahier on Fri Mar 20 17:38:57 Native configuration is x86_64-unknown-linux-gnu === lus2lic1 tests === @@ -397,7 +397,7 @@ PASS: gcc -o multipar.exec multipar_multipar.c multipar_multipar_loop.c PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {} ==> lus2lic2.sum <== -Test Run By jahier on Wed Mar 18 17:04:32 +Test Run By jahier on Fri Mar 20 17:39:36 Native configuration is x86_64-unknown-linux-gnu === lus2lic2 tests === @@ -727,7 +727,7 @@ PASS: gcc -o zzz2.exec zzz2_zzz2.c zzz2_zzz2_loop.c PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {} ==> lus2lic3.sum <== -Test Run By jahier on Wed Mar 18 17:05:38 +Test Run By jahier on Fri Mar 20 17:40:42 Native configuration is x86_64-unknown-linux-gnu === lus2lic3 tests === @@ -1230,7 +1230,7 @@ PASS: ./myec2c {-o multipar.c multipar.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {} ==> lus2lic4.sum <== -Test Run By jahier on Wed Mar 18 17:06:15 +Test Run By jahier on Fri Mar 20 17:41:22 Native configuration is x86_64-unknown-linux-gnu === lus2lic4 tests === @@ -1727,13 +1727,13 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {} =============================== # Total number of failures: 14 lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 4 seconds -lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 39 seconds +lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 38 seconds lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 66 seconds -lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 37 seconds -lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 79 seconds +lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 38 seconds +lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 75 seconds * Ref time: -0.04user 0.02system 3:45.68elapsed 0%CPU (0avgtext+0avgdata 5120maxresident)k -160inputs+0outputs (0major+5502minor)pagefaults 0swaps +0.03user 0.02system 3:45.26elapsed 0%CPU (0avgtext+0avgdata 5064maxresident)k +160inputs+0outputs (0major+5534minor)pagefaults 0swaps * Quick time (-j 4): -0.03user 0.02system 1:25.43elapsed 0%CPU (0avgtext+0avgdata 5128maxresident)k -160inputs+0outputs (0major+5564minor)pagefaults 0swaps +0.03user 0.02system 1:32.47elapsed 0%CPU (0avgtext+0avgdata 5104maxresident)k +160inputs+0outputs (0major+5590minor)pagefaults 0swaps diff --git a/test/lus2lic.time b/test/lus2lic.time index aad7425d54be341b044efb3f81e5caa2bb336e0a..97ffa235afd87ead578b03f595b65cd8d299c46a 100644 --- a/test/lus2lic.time +++ b/test/lus2lic.time @@ -1,11 +1,11 @@ lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 4 seconds -lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 39 seconds +lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 38 seconds lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 66 seconds -lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 37 seconds -lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 79 seconds +lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 38 seconds +lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 75 seconds * Ref time: -0.04user 0.02system 3:45.68elapsed 0%CPU (0avgtext+0avgdata 5120maxresident)k -160inputs+0outputs (0major+5502minor)pagefaults 0swaps +0.03user 0.02system 3:45.26elapsed 0%CPU (0avgtext+0avgdata 5064maxresident)k +160inputs+0outputs (0major+5534minor)pagefaults 0swaps * Quick time (-j 4): -0.03user 0.02system 1:25.43elapsed 0%CPU (0avgtext+0avgdata 5128maxresident)k -160inputs+0outputs (0major+5564minor)pagefaults 0swaps +0.03user 0.02system 1:32.47elapsed 0%CPU (0avgtext+0avgdata 5104maxresident)k +160inputs+0outputs (0major+5590minor)pagefaults 0swaps