From 14a42a038250886e940a43df00b4d9b213d922fb Mon Sep 17 00:00:00 2001
From: Erwan Jahier <erwan.jahier@univ-grenoble-alpes.fr>
Date: Wed, 5 Jul 2017 15:51:02 +0200
Subject: [PATCH] -eeb: Extern nodes interface variables were not expanded.

Also, -eeb is now the default when using -ec.
---
 _oasis               |  2 +-
 src/l2lExpandEnum.ml | 25 ++++++++++++++-----------
 src/lv6MainArgs.ml   |  7 +++++--
 src/lv6version.ml    |  4 ++--
 test/lus2lic.sum     | 24 ++++++++++++------------
 5 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/_oasis b/_oasis
index b2ba114c..8fae8c30 100644
--- a/_oasis
+++ b/_oasis
@@ -1,6 +1,6 @@
 OASISFormat: 0.4
 Name:        lustre-v6
-Version:     1.702
+Version:     1.703
 Synopsis:    The Lustre V6 Verimag compiler
 Description: This package contains:
    (1) lus2lic: the (current) name of the compiler (and interpreter via -exec).
diff --git a/src/l2lExpandEnum.ml b/src/l2lExpandEnum.ml
index 1ef7f23a..58398263 100644
--- a/src/l2lExpandEnum.ml
+++ b/src/l2lExpandEnum.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 05/07/2017 (at 10:20) by Erwan Jahier> *)
+(* Time-stamp: <modified the 05/07/2017 (at 15:31) by Erwan Jahier> *)
 
 
 open Lxm
@@ -137,20 +137,23 @@ let rec (doit : target -> LicPrg.t -> LicPrg.t) =
     { ve_f with it = ve }
 
   and (do_node : Lic.node_exp -> Lic.node_exp) =
-    fun n -> 
+    fun n ->
+    let def_eff = 
     match n.def_eff with
-    | ExternLic | MetaOpLic | AbstractLic _ -> n
+    | ExternLic | MetaOpLic | AbstractLic _ -> n.def_eff
     | BodyLic b ->
        let eqs = List.map (fun eq -> do_eq eq) b.eqs_eff  in
        let ass = List.map (fun ve -> do_val_exp_flag ve) b.asserts_eff in
-       { n with
-         inlist_eff = List.map do_var_info n.inlist_eff;
-         outlist_eff = List.map do_var_info n.outlist_eff;
-         loclist_eff = (match n.loclist_eff with
-                        | None -> None
-                        | Some l -> Some(List.map do_var_info l));
-         def_eff = BodyLic{asserts_eff=ass; eqs_eff=eqs};
-       }
+       BodyLic{asserts_eff=ass; eqs_eff=eqs}
+    in
+    { n with
+      inlist_eff = List.map do_var_info n.inlist_eff;
+      outlist_eff = List.map do_var_info n.outlist_eff;
+      loclist_eff = (match n.loclist_eff with
+                     | None -> None
+                     | Some l -> Some(List.map do_var_info l));
+      def_eff = def_eff;
+    }
 
   in (* back to doit *)
   let outprg = LicPrg.empty in
diff --git a/src/lv6MainArgs.ml b/src/lv6MainArgs.ml
index 513ca501..b40b38bf 100644
--- a/src/lv6MainArgs.ml
+++ b/src/lv6MainArgs.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 28/06/2017 (at 16:44) by Erwan Jahier> *)
+(* Time-stamp: <modified the 05/07/2017 (at 15:37) by Erwan Jahier> *)
 (*
 Le manager d'argument adapté de celui de lutin, plus joli
 N.B. solution un peu batarde : les options sont stockées, comme avant, dans Global,
@@ -245,6 +245,9 @@ let set_v4_options opt =
   opt.expand_arrays <- true
 
 let set_ec_options opt =
+  (match global_opt.expand_enums with
+  | AsEnum -> global_opt.expand_enums <- AsBool; (* only override the default *)
+  | AsInt | AsConst | AsBool -> ());
   set_v4_options opt;
   global_opt.ec <- true;
   global_opt.no_when_not <- true;
@@ -393,7 +396,7 @@ let mkoptab (opt:t) : unit = (
     mkopt opt
       ["-ec"; "--expanded-code"]
       (Arg.Unit (fun _ -> set_ec_options opt))
-      ["Generate ec programs (actually just an alias for '-en -lv4 --no-prefix --no-whe-not')"]
+      ["Generate ec programs (set the following options: '--expand-nodes --no-when-not --expand-enums-as-bool --lustre-v4 --no-prefix')"]
     ;
     mkopt opt ~doc_level:Advanced
       ["-np"; "--no-prefix"]
diff --git a/src/lv6version.ml b/src/lv6version.ml
index 75b6f95a..b27e6a99 100644
--- a/src/lv6version.ml
+++ b/src/lv6version.ml
@@ -1,7 +1,7 @@
 (** Automatically generated from Makefile *) 
 let tool = "lus2lic"
 let branch = "master"
-let commit = "702"
-let sha_1 = "a6fab49ad78a8446078f410e07c79e7d47bd8e0a"
+let commit = "703"
+let sha_1 = "6f975e9bc4d6dfff63fcf0ab056956d1bbb018ad"
 let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")")
 let maintainer = "jahier@imag.fr"
diff --git a/test/lus2lic.sum b/test/lus2lic.sum
index 708e9588..3c91f570 100644
--- a/test/lus2lic.sum
+++ b/test/lus2lic.sum
@@ -1,5 +1,5 @@
 ==> lus2lic0.sum <==
-Test Run By jahier on Wed Jul  5 11:16:43 
+Test Run By jahier on Wed Jul  5 15:35:50 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic0 tests ===
@@ -64,7 +64,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 Jul  5 11:16:44 
+Test Run By jahier on Wed Jul  5 15:35:51 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic1 tests ===
@@ -403,7 +403,7 @@ PASS: sh multipar.sh
 PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus  {}
 
 ==> lus2lic2.sum <==
-Test Run By jahier on Wed Jul  5 11:17:40 
+Test Run By jahier on Wed Jul  5 15:36:46 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic2 tests ===
@@ -743,7 +743,7 @@ PASS: sh zzz2.sh
 PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus  {}
 
 ==> lus2lic3.sum <==
-Test Run By jahier on Wed Jul  5 11:18:55 
+Test Run By jahier on Wed Jul  5 15:38:02 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic3 tests ===
@@ -1253,7 +1253,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
 
 
 ==> lus2lic4.sum <==
-Test Run By jahier on Wed Jul  5 11:21:14 
+Test Run By jahier on Wed Jul  5 15:40:21 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic4 tests ===
@@ -1771,13 +1771,13 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {}
 ===============================
 # Total number of failures: 22
 lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds
-lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 56 seconds
-lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 74 seconds
-lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 138 seconds
+lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 55 seconds
+lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 75 seconds
+lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 139 seconds
 lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 67 seconds
 * Ref time: 
-0.05user 0.02system 5:38.56elapsed 0%CPU (0avgtext+0avgdata 5616maxresident)k
-128inputs+0outputs (0major+6179minor)pagefaults 0swaps
+0.04user 0.03system 5:38.60elapsed 0%CPU (0avgtext+0avgdata 5684maxresident)k
+64inputs+0outputs (0major+6208minor)pagefaults 0swaps
 * Quick time (-j 4):
-0.05user 0.02system 2:39.72elapsed 0%CPU (0avgtext+0avgdata 5708maxresident)k
-32inputs+0outputs (0major+6198minor)pagefaults 0swaps
+0.04user 0.03system 2:43.10elapsed 0%CPU (0avgtext+0avgdata 5564maxresident)k
+64inputs+0outputs (0major+6185minor)pagefaults 0swaps
-- 
GitLab